提交 e3d4f592 作者: Hao

add

父级 4deab78d
......@@ -91,10 +91,9 @@ function websocketonmessage(e: MessageEvent<any>) {
// 关闭
function websocketclose(e: any) {
console.log("连接关闭");
clearInterval(HeartbeatTime);
useUserStore().disconnect(); // 修改连接状态
connectMsg(callBack)
creatWebSocket(wsUrl);
}
......@@ -104,11 +103,7 @@ function websocketsend(res: any) {
// 检查连接状态
websocket.send(JSON.stringify(res));
} else {
ElMessage({
showClose: true,
message: "请选择设备连接",
type: "error",
});
connectMsg(callBack)
}
}
......@@ -118,11 +113,7 @@ function websocketsend(res: any) {
function sendWebSocket(data: any) {
// 如果未保持连接状态 不允许直接发送消息 提示请选择连接设备
if (!useUserStore().isConnected) {
ElMessage({
showClose: true,
message: "请选择设备连接",
type: "error",
});
creatWebSocket(wsUrl);;
// websocketsend(data);
} else {
console.log("发送时的数据,方便调试", {
......
......@@ -63,7 +63,7 @@
<li
class="bubble-h1"
@click="setChatMessage(item.text)"
v-for="(item,index) in wantMessage"
v-for="(item, index) in wantMessage"
:key="index"
>
{{ item.text }}
......@@ -481,10 +481,12 @@ const vShrink: Directive<HTMLElement, boolean | Props> = {
}
},
}
function getSessionId(from, to) {
return from < to ? `${from}-${to}` : `${to}-${from}`
}
function getCheckMesssages() {
let query = {
sessionId: `${store.chatInfo.clientId}-${store.chatInfo.serviceId}`,
sessionId: getSessionId(store.chatInfo.clientId, store.chatInfo.serviceId),
}
checkMesssages(query).then(({ code, data, description }) => {
data = data || []
......@@ -670,10 +672,10 @@ const handleButtonClick = () => {
sendData(msg.trim(), 0)
automaticPromptRef.value.setState('')
}
function setChatMessage(text){
console.log(text,'text')
function setChatMessage(text) {
console.log(text, 'text')
automaticPromptRef.value.setState(text)
// automaticPromptRef.value.elAutocomplete = item
// automaticPromptRef.value.elAutocomplete = item
}
const sendData = (msg, msgType) => {
let data = {
......
No preview for this file type
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,7 +10,7 @@
this.resizeTo(800,600);
this.focus();
</script> -->
<script type="module" crossorigin src="/assets/index.2985ec2a.js"></script>
<script type="module" crossorigin src="/assets/index.350af0b6.js"></script>
<link rel="modulepreload" crossorigin href="/assets/vendor.d471d1e7.js">
<link rel="stylesheet" href="/assets/index.5aee5cd9.css">
</head>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论