From 3ac33e0ea28357bac078ac93404ac02ad9a61738 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 23 七月 2024 18:01:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 wechat_staff/pages/homeId/index.js |   73 ++++++++++++++++++++++++------------
 1 files changed, 48 insertions(+), 25 deletions(-)

diff --git a/wechat_staff/pages/homeId/index.js b/wechat_staff/pages/homeId/index.js
index 4b5c569..95ecff5 100644
--- a/wechat_staff/pages/homeId/index.js
+++ b/wechat_staff/pages/homeId/index.js
@@ -1,4 +1,4 @@
-import { getCataLogTagList, pageZSZXContentList } from '../../api/index'
+import { getCataLogTagList, pageZSZXContentList, actionDo } from '../../api/index'
 Page({
 
   /**
@@ -8,6 +8,7 @@
     tagList: [],
     activeCate: '',
     dataList: [],
+    total: 0,
     pageNum: 1,
     pageSize: 10,
 
@@ -22,12 +23,53 @@
     this.getTabList()
     this.getList()
   },
-  itemClick(e) {
-    const { id } = e.target.dataset
-    console.log(e.target.dataset);
-    wx.navigateTo({
-      url: '/pages/consult/detail',
+  onReachBottom() {
+    console.log('瑙﹀簳浜嬩欢');
+    const { total, dataList, pageNum } = this.data
+    if(total > dataList.length){
+      this.setData({ pageNum: pageNum + 1 })
+      this.getList()
+    }else{
+      wx.showToast({
+        title: '鏆傛棤鏇村鏁版嵁',
+        icon: 'none'
+      })
+    }
+  },
+  getList(){
+    const { code, tagCodes, pageSize, pageNum } = this.data
+    pageZSZXContentList({
+      catalogCode: code,
+      tagCodes: tagCodes ? [tagCodes] : [],
+      pageSize,
+      pageNum
+    }).then(res => {
+      this.setData({
+        total: res.data.total,
+        dataList: [ ...this.data.dataList, ...res.data.records ]
+      })
     })
+  },
+  itemClick(e) {
+    const item = e.currentTarget.dataset.item
+    console.log('item', item);
+    actionDo({actionType: 'view',id: item.id})
+    if(item.contentType == 'video'){
+      wx.previewMedia({
+        sources: [{ url: item.content, type: 'video' }]
+      })
+    }
+    if(item.contentType == 'link'){
+      wx.navigateTo({
+        url: '/pages/webView/index?link=' + item.content,
+      })
+    }
+    if(item.contentType == 'page'){
+      getApp().globalData.catalogCode=item.content
+      wx.switchTab({
+        url: '/pages/discover/discover'
+      })
+    }
   },
   cateClick(e) {
     const { code } = e.target.dataset
@@ -49,22 +91,6 @@
       }
       
     })
-  },
-  getList(){
-    const { code, tagCodes, pageSize, pageNum } = this.data
-    pageZSZXContentList({
-      catalogCode: code,
-      tagCodes,
-      pageSize,
-      pageNum
-    }).then(res => {
-      this.setData({
-        dataList: [ ...this.data.dataList, ...res.data.records ]
-      })
-    })
-  },
-  onReachBottom() {
-
   },
   onReady() {
 
@@ -101,9 +127,6 @@
   /**
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
-  onReachBottom() {
-
-  },
 
   /**
    * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�

--
Gitblit v1.9.3