From 2206df0da6499846c78a358cf95ca33c218a5c5d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 14 九月 2022 08:43:37 +0800
Subject: [PATCH] 2022.9.13

---
 pages/m_consult/consulthome/consulthome.js |  200 ++++++++------------------------------------------
 1 files changed, 32 insertions(+), 168 deletions(-)

diff --git a/pages/m_consult/consulthome/consulthome.js b/pages/m_consult/consulthome/consulthome.js
index 471e6c8..19523e2 100644
--- a/pages/m_consult/consulthome/consulthome.js
+++ b/pages/m_consult/consulthome/consulthome.js
@@ -1,25 +1,14 @@
 // pages/m_consult/consulthome/consulthome.js
-const consultservice = require("../../../service/consultservice")
-const moment = require('../../../utils/moment.min')
-const app = getApp()
 
 Page({
-
+  // behaviors: [behavior],
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
     searchTips: '璇疯緭鍏ュ叧閿瓧鎼滅储',
-    hotTopics: [],
-
     tabList: [{
       name: '鐑棬',
-      tag: 0
-    }, {
-      name: '鏂囦欢',
-      tag: 0
-    }, {
-      name: '鏉$洰',
       tag: 0
     }, {
       name: '闂瓟',
@@ -27,39 +16,35 @@
     }, {
       name: '妗堜緥',
       tag: 0
-    }],
-
-    pageList: [
-      [],
-      [],
-      [],
-      [],
-      [],
-    ],
-
-    //妗堜緥鎵�娑夊強鐨勮鐐�
-    caseTag: []
+    }, {
+      name: '鏉$洰',
+      tag: 0
+    }, {
+      name: '鏂囦欢',
+      tag: 0
+    }, ],
+    refresh: false,
+    // 鐑棬鍐呭鏌ヨ鏉′欢
+    keyAll: {keyword: '', type: undefined},
+    key1: {keyword: '', type: 1},
+    key2: {keyword: '', type: 2},
+    key3: {keyword: '', type: 3},
+    key4: {keyword: '', type: 4},
+    reachBottom: [false, false, false, false, false],
+    tabIndex: 0
   },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad: function (options) {
-    this.getHotTopic()
+    // this.getHotTopic()
   },
 
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
-  onShow: function () {
-
+  onReachBottom() {
+    let reachBottom = [false, false, false, false, false]
+    reachBottom[this.data.tabIndex] = true
+    this.setData({reachBottom})
   },
 
   // 鎼滅储
@@ -98,140 +83,19 @@
     }
   },
 
-  /**
-   * 鑾峰彇鐑棬鎼滅储鍐呭
-   */
-  getHotTopic() {
-    var that = this
-    // 1. 鐑棬娉曞緥娉曡
-    consultservice.getTopicLaw(app.globalData.accessToken.userId, {
-      success(res) {
-        res.forEach(r => {
-          r.mfKeywordLv1 = r.mfKeywordLv1.split('銆�').slice(0, 5)
-          r.mfReleaseDate = that.formatTime(r.mfReleaseDate)
-          r.mfEffectiveDate = that.formatTime(r.mfEffectiveDate)
-          r.mfClosingDate = that.formatTime(r.mfClosingDate)
-        });
-        that.setData({
-          'pageList[0]': res,
-          'pageList[1]': res
-        })
-      }
+  loadingDone(e){
+    this.setData({
+      refresh: false
     })
-    // 2. 鐑棬娉曞緥娉曡鏉$洰
-    consultservice.getTopicItem(app.globalData.accessToken.userId, {
-      success(res) {
-        res.forEach(r => {
-          r.miItemContent = r.miItemContent.replaceAll('\\n', '<br/>')
-        });
-        that.setData({
-          'pageList[2]': res
-        })
-      }
-    })
-    // 3. 鐑棬闂瓟
-    consultservice.getTopicQA(app.globalData.accessToken.userId, {
-      success(res) {
-        res.forEach(r => {
-          r.cqCreateTime = that.formatTime(r.cqCreateTime)
-        });
-        that.setData({
-          'pageList[3]': res
-        })
-      }
-    })
-    // 4. 鐑棬妗堜緥
-    consultservice.getTopicCase(app.globalData.accessToken.userId, {
-      success(res) {
-        res.forEach(r => {
-          r.ecSummary = r.ecSummary.replaceAll('\\n', '<br/>')
-          r.ecMeaning = r.ecMeaning.replaceAll('\\n', '<br/>')
-          r.ecExamined = r.ecExamined.replaceAll('\\n', '<br/>')
-          r.ecEnlightenment = r.ecEnlightenment.replaceAll('\\n', '<br/>')
-          r.ecOccurDate = that.formatTime(r.ecOccurDate)
-        });
-        that.setData({
-          'pageList[4]': res
-        })
-        console.log(that.data.pageList);
-      }
+    this.setData({
+      refresh: true
     })
   },
 
-
-  // 鍘诲線鏂囦欢璇︽儏
-  gotoFile(e) {
-    const iList = e.currentTarget.dataset.index.split(',')
-    const i1 = iList[0]
-    const i2 = iList[1]
-    var fileId = this.data.pageList[i1][i2].mfGuid
-    wx.navigateTo({
-      url: '/pages/m_consult/consultdetail/consultdetail',
-      success: (res) => {
-        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
-        res.eventChannel.emit('acceptDataFromOpenerPage', {
-          fileId: fileId
-        })
-      },
+  onTabChange(e) {
+    console.log(e.detail);
+    this.setData({
+      tabIndex: e.detail
     })
-  },
-
-  // 鍘诲線鏉$洰璇︽儏
-  gotoItem(e) {
-    const iList = e.currentTarget.dataset.index.split(',')
-    const i1 = iList[0]
-    const i2 = iList[1]
-    var itemId = this.data.pageList[i1][i2].miGuid
-    wx.navigateTo({
-      url: '/pages/m_consult/consultdetailitem/consultdetailitem',
-      success: (res) => {
-        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
-        res.eventChannel.emit('acceptDataFromOpenerPage', {
-          itemId: itemId
-        })
-      },
-    })
-  },
-
-  // 鍘诲線闂瓟璇︽儏
-  gotoQA(e) {
-    const iList = e.currentTarget.dataset.index.split(',')
-    const i1 = iList[0]
-    const i2 = iList[1]
-    var qId = this.data.pageList[i1][i2].cqGuid
-    wx.navigateTo({
-      url: '/pages/m_consult/consultdetailqa/consultdetailqa',
-      success: (res) => {
-        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
-        res.eventChannel.emit('acceptDataFromOpenerPage', {
-          qId: qId
-        })
-      },
-    })
-  },
-
-  // 鍘诲線妗堜緥璇︽儏
-  gotoCase(e) {
-    const iList = e.currentTarget.dataset.index.split(',')
-    const i1 = iList[0]
-    const i2 = iList[1]
-    var caseId = this.data.pageList[i1][i2].ecGuid
-    wx.navigateTo({
-      url: '/pages/m_consult/consultdetailcase/consultdetailcase',
-      success: (res) => {
-        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
-        res.eventChannel.emit('acceptDataFromOpenerPage', {
-          caseId: caseId
-        })
-      },
-    })
-  },
-
-  formatTime(t) {
-    if (t) {
-      return moment(t).format("YYYY.MM.DD")
-    } else {
-      return undefined
-    }
-  },
+  }
 })
\ No newline at end of file

--
Gitblit v1.9.3