|
|
|
@ -58,7 +58,7 @@ |
|
|
|
|
<view class="content"> |
|
|
|
|
<view style="width: 100%; overflow: hidden;"> |
|
|
|
|
<zeroMarkdownView :markdown="item.data || ''" /> |
|
|
|
|
<view class="yindao" @click="clickYinDao(item.data)"> |
|
|
|
|
<view class="yindao" v-if="isShowYindao" @click="clickYinDao(item.data)"> |
|
|
|
|
安装条件引导 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -178,6 +178,7 @@ |
|
|
|
|
title: "工单生成", |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
isShowYindao:false, |
|
|
|
|
inputValue: "", |
|
|
|
|
es: null, |
|
|
|
|
msgList: [], |
|
|
|
@ -214,11 +215,15 @@ |
|
|
|
|
} |
|
|
|
|
console.log(params); |
|
|
|
|
if (params.id == 12121212) { |
|
|
|
|
console.log('11111111111111111111111111111') |
|
|
|
|
this.queryChat("开始隐患排查," + str); |
|
|
|
|
} else { |
|
|
|
|
// this.SSE("开始隐患排查," + str, "1"); |
|
|
|
|
if (params.id != "undefined") { |
|
|
|
|
this.queryChat("开始隐患排查," + str); |
|
|
|
|
console.log('2222222222222222222222222222222') |
|
|
|
|
setTimeout(() =>{ |
|
|
|
|
this.queryChat("开始隐患排查," + str); |
|
|
|
|
},500) |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
this.$.toast('缺少相关信息'); |
|
|
|
@ -249,6 +254,7 @@ |
|
|
|
|
// }, |
|
|
|
|
methods: { |
|
|
|
|
clickYinDao(data) { |
|
|
|
|
console.log('data12121 ========>',data) |
|
|
|
|
let newData = data.content + data.reference.content |
|
|
|
|
const timer = setInterval(() => { |
|
|
|
|
data.content += data.reference.content |
|
|
|
@ -257,6 +263,7 @@ |
|
|
|
|
clearInterval(timer); |
|
|
|
|
} |
|
|
|
|
}, 50); |
|
|
|
|
console.log('data ========>',data) |
|
|
|
|
// data.content += data.reference.content |
|
|
|
|
}, |
|
|
|
|
// 建立SSE长连接 |
|
|
|
@ -287,7 +294,7 @@ |
|
|
|
|
openWhenHidden: true, |
|
|
|
|
onopen: () => {}, |
|
|
|
|
onmessage: (ev) => { |
|
|
|
|
console.log(ev); |
|
|
|
|
console.log('ev ==========》',ev); |
|
|
|
|
this.loading = true; |
|
|
|
|
const res = JSON.parse(ev.data); |
|
|
|
|
if (res?.code == 200 && res.result) { |
|
|
|
@ -372,6 +379,7 @@ |
|
|
|
|
if (res && res.data && res.data.code == 200) { |
|
|
|
|
const result = res.data.result |
|
|
|
|
let id = 1 |
|
|
|
|
let arr = this.msgList |
|
|
|
|
result.forEach((item, index) => { |
|
|
|
|
let questionList = { |
|
|
|
|
answerId: '1', |
|
|
|
@ -383,14 +391,16 @@ |
|
|
|
|
id: id + 1, |
|
|
|
|
data: item.response |
|
|
|
|
} |
|
|
|
|
this.msgList.push(questionList) |
|
|
|
|
this.msgList.push(responseList) |
|
|
|
|
arr.push(questionList) |
|
|
|
|
arr.push(responseList) |
|
|
|
|
id += 2 |
|
|
|
|
}) |
|
|
|
|
console.log(this.msgList) |
|
|
|
|
this.msgList = arr |
|
|
|
|
console.log('msgList =========>',this.msgList) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async queryChat(voiceText) { |
|
|
|
|
// console.log(voiceText,"voiceText"); |
|
|
|
|
this.loading = true; |
|
|
|
@ -461,6 +471,7 @@ |
|
|
|
|
this.active = data.tabkey - 1 > 0 ? data.tabkey - 1 : 0; |
|
|
|
|
} |
|
|
|
|
if (data.content) { |
|
|
|
|
console.log('1212111111111111111111111 ===========>',data) |
|
|
|
|
this.changeMsgList( |
|
|
|
|
data.answerId || "1", |
|
|
|
|
data.content, |
|
|
|
@ -468,6 +479,11 @@ |
|
|
|
|
data.answerOptions |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
if(JSON.stringify(data.reference) != '{}'){ |
|
|
|
|
this.isShowYindao = true |
|
|
|
|
}else{ |
|
|
|
|
this.isShowYindao = false |
|
|
|
|
} |
|
|
|
|
this.loading = false; |
|
|
|
|
if (this.isExpanded) { |
|
|
|
|
this.isExpanded = !this.isExpanded; |
|
|
|
@ -476,11 +492,11 @@ |
|
|
|
|
if (err) { |
|
|
|
|
console.log("request fail", err.errMsg); |
|
|
|
|
} |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "查询失败", |
|
|
|
|
icon: "error", |
|
|
|
|
duration: 2000, |
|
|
|
|
}); |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// title: "查询失败", |
|
|
|
|
// icon: "error", |
|
|
|
|
// duration: 2000, |
|
|
|
|
// }); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 输入框 |
|
|
|
@ -536,15 +552,18 @@ |
|
|
|
|
let id = 1; |
|
|
|
|
data = data.replace("undefined", '') |
|
|
|
|
data = data.replace("null", '') |
|
|
|
|
this.msgList = [...this.msgList] |
|
|
|
|
console.log('this.msgList ==========>',this.msgList) |
|
|
|
|
if (this.msgList.length > 0) { |
|
|
|
|
id = this.msgList[this.msgList.length - 1].id + 1; |
|
|
|
|
} |
|
|
|
|
console.log('id ========>',id) |
|
|
|
|
if (answerId == "1") { |
|
|
|
|
// 后台返回来的消息 |
|
|
|
|
let newdata = ""; |
|
|
|
|
let index = 0; |
|
|
|
|
const timer = setInterval(() => { |
|
|
|
|
newdata = newdata += data[index]; |
|
|
|
|
newdata = data[index] ? newdata += data[index] : newdata += ''; |
|
|
|
|
if (this.msgList?.filter((item) => item.id == id).length == 0) { |
|
|
|
|
this.msgList = [ |
|
|
|
|
...this.msgList, |
|
|
|
@ -585,7 +604,6 @@ |
|
|
|
|
]; |
|
|
|
|
this.scrollBottom(); |
|
|
|
|
} |
|
|
|
|
console.log('检查msgList', this.msgList) |
|
|
|
|
this.msgList.forEach(item => { |
|
|
|
|
delete item.answerOptions |
|
|
|
|
}) |
|
|
|
|