From 51600113c20d84ee54660de23324400604704dc2 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 10 八月 2022 14:26:46 +0800
Subject: [PATCH] 台账、承诺书模块

---
 pages/module_consult/consultsearch/consultsearch.js |   48 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/pages/module_consult/consultsearch/consultsearch.js b/pages/module_consult/consultsearch/consultsearch.js
index 4504269..d1008e3 100644
--- a/pages/module_consult/consultsearch/consultsearch.js
+++ b/pages/module_consult/consultsearch/consultsearch.js
@@ -11,9 +11,15 @@
     placeholder: '鎼滅储',
     value: '',
 
-    histroy: [],
+    history: ['a', 'b'],
 
-    hotTopic: [],
+    hotTopic: [{
+      name: '鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬鐑棬'
+    },{
+      name: 't2'
+    },{
+      name: 't3'
+    }],
   },
 
   /**
@@ -69,13 +75,29 @@
       },
     })
     
-    if (this.data.histroy.indexOf(this.data.value) == -1) {
-      this.data.histroy.unshift(this.data.value)
+    if (this.data.history.indexOf(this.data.value) == -1) {
+      let h = this.data.history
+      h.unshift(this.data.value)
+      if (h.length > 10) {
+        h = h.slice(0, 10)
+      }
+      this.setData({
+        history: h
+      })
       wx.setStorage({
-        data: JSON.stringify(this.data.histroy),
+        data: JSON.stringify(h),
         key: 'search_history',
       })
     }
+  },
+
+  selectHistory (e) {
+    var i = e.currentTarget.dataset.index
+    var kw = this.data.history[i]
+    this.setData({
+      value: kw
+    })
+    this.search()
   },
 
   /**
@@ -88,7 +110,7 @@
       success: (res) => {
         let h = JSON.parse(res.data)
         that.setData({
-          histroy: h
+          history: h
         })
       },
     })
@@ -107,4 +129,18 @@
       }
     })
   },
+
+  gotoDetail (e) {
+    var i = e.currentTarget.dataset.index
+    var fileId = this.data.hotTopic[i].id
+    wx.navigateTo({
+      url: '/pages/module_consult/consultdetail/consultdetail',
+      success: (res) => {
+        // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+        res.eventChannel.emit('acceptDataFromOpenerPage', {
+          fileId: fileId
+        })
+      },
+    })
+  }
 })
\ No newline at end of file

--
Gitblit v1.9.3