From bf580d5477d65f5eefb70a8fb9a6b37eaf0ae9bb Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 06 九月 2022 09:16:25 +0800
Subject: [PATCH] 2022.9.6

---
 pages/module_consult/consulthome/consulthome.js |  145 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 135 insertions(+), 10 deletions(-)

diff --git a/pages/module_consult/consulthome/consulthome.js b/pages/module_consult/consulthome/consulthome.js
index 66ac077..f292fcd 100644
--- a/pages/module_consult/consulthome/consulthome.js
+++ b/pages/module_consult/consulthome/consulthome.js
@@ -10,7 +10,35 @@
    */
   data: {
     searchTips: '璇疯緭鍏ュ叧閿瓧鎼滅储',
-    hotTopics: []
+    hotTopics: [],
+
+    tabList: [{
+      name: '鐑棬',
+      tag: 0
+    }, {
+      name: '鏂囦欢',
+      tag: 0
+    }, {
+      name: '鏉$洰',
+      tag: 0
+    }, {
+      name: '闂瓟',
+      tag: 0
+    }, {
+      name: '妗堜緥',
+      tag: 0
+    }],
+
+    pageList: [
+      [],
+      [],
+      [],
+      [],
+      [],
+    ],
+
+    //妗堜緥鎵�娑夊強鐨勮鐐�
+    caseTag: []
   },
 
   /**
@@ -34,12 +62,14 @@
 
   },
 
+  // 鎼滅储
   gotoSearch() {
     wx.navigateTo({
       url: "/pages/module_consult/consultsearch/consultsearch"
     })
   },
 
+  // 鍔熻兘鎸夐挳
   goto(e) {
     var url = ""
     var index = e.currentTarget.dataset.index
@@ -73,24 +103,68 @@
    */
   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.formateTime(r.mfReleaseDate)
-          r.mfEffectiveDate = that.formateTime(r.mfEffectiveDate)
-          r.mfClosingDate = that.formateTime(r.mfClosingDate)
+          r.mfReleaseDate = that.formatTime(r.mfReleaseDate)
+          r.mfEffectiveDate = that.formatTime(r.mfEffectiveDate)
+          r.mfClosingDate = that.formatTime(r.mfClosingDate)
         });
         that.setData({
-          hotTopics: res
+          'pageList[0]': res,
+          'pageList[1]': res
         })
+      }
+    })
+    // 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);
       }
     })
   },
 
-  gotoDetail(e) {
-    var i = e.currentTarget.dataset.index
-    var fileId = this.data.hotTopics[i].mfGuid
+
+  // 鍘诲線鏂囦欢璇︽儏
+  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/module_consult/consultdetail/consultdetail',
       success: (res) => {
@@ -102,9 +176,60 @@
     })
   },
 
-  formateTime (t) {
+  // 鍘诲線鏉$洰璇︽儏
+  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/module_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/module_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/module_consult/consultdetailcase/consultdetailcase',
+      success: (res) => {
+        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+        res.eventChannel.emit('acceptDataFromOpenerPage', {
+          caseId: caseId
+        })
+      },
+    })
+  },
+
+  formatTime(t) {
     if (t) {
-      return moment(t).format("YYYY骞碝M鏈圖D鏃�") 
+      return moment(t).format("YYYY.MM.DD")
     } else {
       return undefined
     }

--
Gitblit v1.9.3