提交 e3d4f592 作者: Hao

add

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