From 437144f41c74505d362a5214a18cec3d01b3ce4b Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 10 十月 2022 17:51:30 +0800
Subject: [PATCH] 2022.10.10
---
pages/m_consult/consultonline/consultonline.js | 134 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 110 insertions(+), 24 deletions(-)
diff --git a/pages/m_consult/consultonline/consultonline.js b/pages/m_consult/consultonline/consultonline.js
index bed0497..4ff59c9 100644
--- a/pages/m_consult/consultonline/consultonline.js
+++ b/pages/m_consult/consultonline/consultonline.js
@@ -15,17 +15,8 @@
userId: 'system',
userName: '鏅鸿兘瀹㈡湇',
type: 0,
- text: '鐢ㄦ埛鎮ㄥソ锛屽緢楂樺叴涓轰綘鏈嶅姟',
- },
- {
- id: 'system',
- time: '',
- userId: 'system',
- userName: '鏅鸿兘瀹㈡湇',
- type: 0,
- text: '鐢ㄦ埛鎮ㄥソ锛屽緢楂樺叴涓烘偍鏈嶅姟锛屾湰鏈堜俊鐢ㄨ嚜璇勭粨鏋滆緝 濂斤紝缁х画淇濇寔鍝�.鐢ㄦ埛鎮ㄥソ锛屽緢楂樺叴涓烘偍鏈嶅姟锛屾湰鏈堜俊鐢ㄨ嚜璇勭粨鏋滆緝 濂斤紝缁х画淇濇寔鍝�.鐢ㄦ埛鎮ㄥソ锛屽緢楂樺叴涓烘偍鏈嶅姟锛屾湰鏈堜俊鐢ㄨ嚜璇勭粨鏋滆緝 濂斤紝缁х画淇濇寔鍝�.鐢ㄦ埛鎮ㄥソ锛屽緢楂樺叴涓烘偍鏈嶅姟锛屾湰鏈堜俊鐢ㄨ嚜璇勭粨鏋滆緝 濂斤紝缁х画淇濇寔鍝�.鐢ㄦ埛鎮ㄥソ锛屽緢楂樺叴涓烘偍鏈嶅姟锛屾湰鏈堜俊鐢ㄨ嚜璇勭粨鏋滆緝 濂斤紝缁х画淇濇寔鍝�.',
- },
-
+ text: '灏婃暚鐨勭敤鎴凤紝灏忕櫧绔瘹涓烘偍鏈嶅姟锛屾偍鏈変粈涔堥棶棰樺憿',
+ }
],
focus: false,
@@ -37,7 +28,9 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
*/
onLoad(options) {
-
+ this.setData({
+ userId: app.globalData.accessToken.userId
+ })
},
clearInput() {
@@ -60,40 +53,133 @@
time: '',
userId: app.globalData.accessToken.userId,
userName: app.globalData.userInfo.acountname,
+ type: 0,
text: this.data.value,
})
- const keyword = this.data.value
+ console.log('-----------chat------------------');
+ console.log(record);
+ console.log(this.data.userId);
+ this.lastKeyword = this.data.value
this.setData({
record,
value: ''
})
- this.getAnswer(keyword)
+ this.getAnswer()
},
- getAnswer(q) {
+ getAnswer() {
this.search({
- keyword: q,
+ keyword: this.lastKeyword,
type: undefined
- })
+ }, 1, 1)
+ // let record = this.data.record
+ // const r = {
+ // id: 'system',
+ // time: '',
+ // userId: 'system',
+ // userName: '鏅鸿兘瀹㈡湇',
+ // type: 1,
+ // text: {
+ // tabList: [
+ // {name: '闂瓟',tag: 0},
+ // {name: '妗堜緥',tag: 0},
+ // {name: '鏉$洰',tag: 0},
+ // {name: '鏂囦欢',tag: 0}
+ // ],
+ // key1: {keyword: q, type: 1},
+ // key2: {keyword: q, type: 2},
+ // key3: {keyword: q, type: 3},
+ // key4: {keyword: q, type: 4},
+ // // pageList: p
+ // },
+ // }
+ // this.data.record.push(r)
+ // let last = this.data.record.length - 1
+ // this.setData({
+ // [`record[${last}]`]: r
+ // })
+ // this.setData({
+ // record,
+ // })
},
loadComplete() {
const results = this.data.results
- console.log(results);
-
let record = this.data.record
- results.forEach(r => {
+
+ if (results.length == 0) {
record.push({
id: 'system',
time: '',
userId: 'system',
userName: '鏅鸿兘瀹㈡湇',
- type: r.typeId,
- text: r,
+ type: 0,
+ text: '鎶辨瓑锛屾垜杩樹笉鐞嗚В鎮ㄧ殑鎰忔�濄�傝灏濊瘯閲嶆柊鍜ㄨ銆�'
})
- });
+ } else {
+ record.push({
+ id: 'system',
+ time: '',
+ userId: 'system',
+ userName: '鏅鸿兘瀹㈡湇',
+ type: 0,
+ text: '灏忕櫧缁欐偍鎻愪緵鍙傝�冨涓嬶細'
+ })
+ const map = new Map()
+ results.sort((a, b) => {
+ return b.typeId - a.typeId
+ })
+ results.forEach(r => {
+ if (!map.has(r.typeName)) {
+ r.keyword = this.lastKeyword
+ map.set(r.typeName, [])
+ map.get(r.typeName).push(r)
+ }
+ });
+ const t = []
+ const p = []
+ for (let item of map) {
+ t.push({
+ name: item[0],
+ tag: 0
+ })
+ p.push(item[1])
+ }
+ record.push({
+ id: 'system',
+ time: '',
+ userId: 'system',
+ userName: '鏅鸿兘瀹㈡湇',
+ type: 1,
+ refresh: true,
+ text: {
+ tabList: t,
+ pageList: p
+ },
+ })
+ }
+ this.setData({
+ record,
+ })
+ },
- this.setData({record})
+ gotoMore(e) {
+ const iList = e.currentTarget.dataset.index
+ const i1 = iList[0]
+ const i2 = iList[1]
+ const {keyword, typeId} = this.data.record[i1].text.pageList[i2][0]
+ console.log(keyword);
+ console.log(typeId);
+ wx.navigateTo({
+ url: '/pages/m_consult/consultresultmore/consultresultmore',
+ success: (res) => {
+ // 閫氳繃 eventChannel 鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+ res.eventChannel.emit('acceptDataFromOpenerPage', {
+ typeId: typeId,
+ keyword: keyword
+ })
+ },
+ })
}
})
\ No newline at end of file
--
Gitblit v1.9.3