浏览代码

fix 微信作答websocket不能多次建立的bug

Michael Wang 3 年之前
父节点
当前提交
2346b3a524
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/features/OnlineExam/Examing/setups/useWXSocket.ts

+ 6 - 3
src/features/OnlineExam/Examing/setups/useWXSocket.ts

@@ -66,7 +66,7 @@ function onAudioAnswer(event: MessageEvent<string>) {
   }
 }
 
-let wxSocketLock = false;
+// let wxSocketLock = false;
 export function useWXSocket() {
   const { startWS } = useWebSocket();
 
@@ -75,8 +75,11 @@ export function useWXSocket() {
     () => {
       if (!store.exam.WEIXIN_ANSWER_ENABLED) return;
 
-      if (wxSocketLock) return;
-      wxSocketLock = true;
+      // console.log("start ws");
+      logger({ cnl: ["server"], act: "useWXSocket" });
+
+      // if (wxSocketLock) return;
+      // wxSocketLock = true;
 
       // init data
       store.exam.questionAnswerFileUrl = [];