fix: bug
This commit is contained in:
@@ -20,6 +20,7 @@ export default class WebSocketUtil {
|
||||
this.heartbeatTimer = null; // 心跳计时器
|
||||
this.heartbeatInterval = options.heartbeatInterval || 30000; // 心跳间隔(ms)
|
||||
this.heartbeatMsg = options.heartbeatMsg || 'ping'; // 心跳消息
|
||||
this.isClose = false; // 手动关闭
|
||||
this.callbacks = {
|
||||
open: [], // 连接打开回调
|
||||
message: [], // 消息接收回调
|
||||
@@ -165,6 +166,7 @@ export default class WebSocketUtil {
|
||||
* @returns {WebSocketUtil} - 返回当前实例,支持链式调用
|
||||
*/
|
||||
close(code = 1000, reason = '') {
|
||||
this.isClose = true
|
||||
if (this.socketTask) {
|
||||
clearInterval(this.heartbeatTimer); // 清除心跳计时器
|
||||
clearInterval(this.reconnectTimer); // 清除重连计时器
|
||||
@@ -204,6 +206,7 @@ export default class WebSocketUtil {
|
||||
* 尝试重新连接WebSocket
|
||||
*/
|
||||
tryReconnect() {
|
||||
if(this.isClose) return
|
||||
if (this.reconnectCount < this.maxReconnectCount) {
|
||||
clearInterval(this.reconnectTimer);
|
||||
this.reconnectTimer = setTimeout(() => {
|
||||
|
||||
@@ -143,6 +143,15 @@
|
||||
"titleNView": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/dialog",
|
||||
"style": {
|
||||
"navigationBarTitleText": "AI问答",
|
||||
"app-plus": {
|
||||
"titleNView": false
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
||||
@@ -277,9 +277,13 @@ const nextStep = () => {
|
||||
|
||||
const pgrphNum = ref(1)
|
||||
const showOrder = ref(0)
|
||||
const isLastPgrph = ref(false)
|
||||
// 获取段落
|
||||
const getGraphInfoUnStudy = () => {
|
||||
|
||||
if(isLastPgrph.value){
|
||||
common.msg('您已学完全部知识点!')
|
||||
return
|
||||
}
|
||||
textChartApi({
|
||||
processType: 'PRGH-STDY',
|
||||
requestBody: JSON.stringify({
|
||||
@@ -304,6 +308,7 @@ const getGraphInfoUnStudy = () => {
|
||||
type: Number(_body.bodyTyp) || 0,
|
||||
id: _id
|
||||
}
|
||||
isLastPgrph.value = _body.chatBody.haveNext !== 'Y'
|
||||
talkingList.value.push(lastTalkingInfo.value)
|
||||
pgrphNum.value = _body.chatBody.pgrphNum
|
||||
showOrder.value = _body.chatBody.showOrder
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<view>AI问答</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@@ -17,6 +17,15 @@
|
||||
"titleNView": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/dialog",
|
||||
"style": {
|
||||
"navigationBarTitleText": "AI问答",
|
||||
"app-plus": {
|
||||
"titleNView": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
+6
-1
@@ -15,8 +15,13 @@ export const useSocketStore = defineStore('socketStore',{
|
||||
},
|
||||
actions:{
|
||||
creatSocket(){
|
||||
if(this.SocketObj && this.SocketObj?.close && !this.SocketObj?.isClose) {
|
||||
return
|
||||
}
|
||||
if(this.SocketObj?.isClose){
|
||||
this.SocketObj.isClose = false
|
||||
}
|
||||
let _baseUrl = get_base_url().split('http').join('ws')
|
||||
if(this.SocketObj && this.SocketObj?.close) return
|
||||
this.SocketObj = new SocketClass(_baseUrl + '/trastudy/trasoket/open?summary=' + getToken());
|
||||
},
|
||||
closeSocket() {
|
||||
|
||||
Reference in New Issue
Block a user