| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | this.setData({ |
| | | userId: app.globalData.accessToken.userId |
| | | }) |
| | | }, |
| | | |
| | | clearInput() { |
| | |
| | | type: 0, |
| | | text: this.data.value, |
| | | }) |
| | | console.log('-----------chat------------------'); |
| | | console.log(record); |
| | | console.log(this.data.userId); |
| | | this.lastKeyword = this.data.value |
| | | this.setData({ |
| | | record, |
| | |
| | | userId: 'system', |
| | | userName: '智能客服', |
| | | type: 0, |
| | | text: '不好意思,暂无相关解答,请试试其他关键词' |
| | | text: '抱歉,我还不理解您的意思。请尝试重新咨询。' |
| | | }) |
| | | } else { |
| | | record.push({ |
| | |
| | | userId: 'system', |
| | | userName: '智能客服', |
| | | type: 0, |
| | | text: '小白给您提供参考如下' |
| | | 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 |