From 9f78f3f014a3423ea3fcab8f9f1056c57cd47fc8 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 26 八月 2022 17:16:26 +0800
Subject: [PATCH] 2022.8.26
---
pages/module_consult/consulthome/consulthome.js | 177 +++++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 129 insertions(+), 48 deletions(-)
diff --git a/pages/module_consult/consulthome/consulthome.js b/pages/module_consult/consulthome/consulthome.js
index 1601e1a..855cdbc 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,36 @@
*/
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: [],
+
+ tabList: [{
+ name: '鐑棬',
+ tag: 0
+ }, {
+ name: '鏂囦欢',
+ tag: 0
+ }, {
+ name: '鏉$洰',
+ tag: 0
+ }, {
+ name: '妗堜緥',
+ tag: 0
+ }],
+
+ pageList: [
+ [],
+ [],
+ [],
+ [],
+ ]
},
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
*/
onLoad: function (options) {
-
+ this.getHotTopic()
+ this.getTopicItem()
},
/**
@@ -54,38 +56,117 @@
},
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
- */
- onHide: function () {
+ gotoSearch() {
+ wx.navigateTo({
+ url: "/pages/module_consult/consultsearch/consultsearch"
+ })
+ },
+ goto(e) {
+ var url = ""
+ var index = e.currentTarget.dataset.index
+ switch (index) {
+ case "0":
+ url = "/pages/module_consult/consultproblem/consultproblem"
+ break;
+ case "1":
+ url = "/pages/module_consult/consultsearch/consultsearch"
+ break;
+ case "2":
+ url = "/pages/module_consult/consultonline/consultonline"
+ break;
+ }
+ if (url != "") {
+ wx.navigateTo({
+ url: url
+ })
+ } else {
+ wx.showToast({
+ title: '鍔熻兘鏁鏈熷緟',
+ duration: 1000,
+ icon: 'none',
+ mask: true,
+ })
+ }
},
/**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
+ * 鑾峰彇鐑棬鎼滅储鍐呭
*/
- onUnload: function () {
-
+ 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({
+ 'pageList[0]': res,
+ 'pageList[1]': res
+ })
+ }
+ })
},
- /**
- * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
- */
- onPullDownRefresh: function () {
-
+ getTopicItem() {
+ var that = this
+ consultservice.getTopicItem(app.globalData.accessToken.userId, {
+ success(res) {
+ res.forEach(r => {
+ r.miItemContent = r.miItemContent.replace('\\n', '<br/>')
+ // 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({
+ 'pageList[2]': res
+ })
+ console.log(that.data.pageList);
+ }
+ })
},
- /**
- * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
- */
- onReachBottom: function () {
-
+ 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) => {
+ // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+ res.eventChannel.emit('acceptDataFromOpenerPage', {
+ fileId: fileId
+ })
+ },
+ })
},
- /**
- * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
- */
- onShareAppMessage: function () {
+ 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
+ })
+ },
+ })
+ },
- }
+ formateTime(t) {
+ if (t) {
+ return moment(t).format("YYYY骞碝M鏈圖D鏃�")
+ } else {
+ return undefined
+ }
+ },
})
\ No newline at end of file
--
Gitblit v1.9.3