From edd35a251b58b1fad17015deda92324f74458434 Mon Sep 17 00:00:00 2001
From: unknown <unknown@example.com>
Date: 星期三, 17 八月 2022 00:05:30 +0800
Subject: [PATCH] 台账模块、智能咨询模块

---
 pages/module_consult/consulthome/consulthome.js |   88 +++++++++++++++++++++++++++++---------------
 1 files changed, 58 insertions(+), 30 deletions(-)

diff --git a/pages/module_consult/consulthome/consulthome.js b/pages/module_consult/consulthome/consulthome.js
index aec7504..66ac077 100644
--- a/pages/module_consult/consulthome/consulthome.js
+++ b/pages/module_consult/consulthome/consulthome.js
@@ -1,4 +1,8 @@
 // pages/module_consult/consulthome/consulthome.js
+const consultservice = require("../../../service/consultservice")
+const moment = require('../../../utils/moment.min')
+const app = getApp()
+
 Page({
 
   /**
@@ -6,38 +10,14 @@
    */
   data: {
     searchTips: '璇疯緭鍏ュ叧閿瓧鎼滅储',
-    hotTopics: [{
-      pic: '',
-      title: '鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇',
-      abstract: '鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌�',
-      time: '2022-02-04',
-      author: '浣滆��',
-      itemCount: '5',
-      tags: ['tag1', 'tag2']
-    },{
-      pic: '',
-      title: '鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇',
-      abstract: '鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌�',
-      time: '2022-02-04',
-      author: '浣滆��',
-      itemCount: '5',
-      tags: ['tag1', 'tag2']
-    },{
-      pic: '',
-      title: '鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇',
-      abstract: '鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌愭煇鏌�',
-      time: '2022-02-04',
-      author: '浣滆��',
-      itemCount: '5',
-      tags: ['tag1', 'tag2']
-    }]
+    hotTopics: []
   },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
   onLoad: function (options) {
-
+    this.getHotTopic()
   },
 
   /**
@@ -54,18 +34,24 @@
 
   },
 
-  goto (e) {
+  gotoSearch() {
+    wx.navigateTo({
+      url: "/pages/module_consult/consultsearch/consultsearch"
+    })
+  },
+
+  goto(e) {
     var url = ""
     var index = e.currentTarget.dataset.index
     switch (index) {
       case "0":
-        url = ""
+        url = "/pages/module_consult/consultproblem/consultproblem"
         break;
       case "1":
         url = "/pages/module_consult/consultsearch/consultsearch"
         break;
       case "2":
-        url = ""
+        url = "/pages/module_consult/consultonline/consultonline"
         break;
     }
     if (url != "") {
@@ -80,5 +66,47 @@
         mask: true,
       })
     }
-  }
+  },
+
+  /**
+   * 鑾峰彇鐑棬鎼滅储鍐呭
+   */
+  getHotTopic() {
+    var that = this
+    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)
+        });
+        that.setData({
+          hotTopics: res
+        })
+      }
+    })
+  },
+
+  gotoDetail(e) {
+    var i = e.currentTarget.dataset.index
+    var fileId = this.data.hotTopics[i].mfGuid
+    wx.navigateTo({
+      url: '/pages/module_consult/consultdetail/consultdetail',
+      success: (res) => {
+        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+        res.eventChannel.emit('acceptDataFromOpenerPage', {
+          fileId: fileId
+        })
+      },
+    })
+  },
+
+  formateTime (t) {
+    if (t) {
+      return moment(t).format("YYYY骞碝M鏈圖D鏃�") 
+    } else {
+      return undefined
+    }
+  },
 })
\ No newline at end of file

--
Gitblit v1.9.3