|
@@ -1,10 +1,10 @@
|
|
import io from 'socket.io-client';
|
|
import io from 'socket.io-client';
|
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
-const address: any = import.meta.env.VITE_APP_BASE_API;
|
|
|
|
-const token: any = localStorage.getItem('token');
|
|
|
|
-const myInfo: any = localStorage.getItem('userInfo');
|
|
|
|
|
|
|
|
export function useWs() {
|
|
export function useWs() {
|
|
|
|
+ const address: any = import.meta.env.VITE_APP_BASE_API;
|
|
|
|
+ const token: any = localStorage.getItem('token');
|
|
|
|
+ const myInfo: any = localStorage.getItem('userInfo');
|
|
let socket: any = null; //ws实例对象
|
|
let socket: any = null; //ws实例对象
|
|
let timerManager: any = {}; //计时器管理
|
|
let timerManager: any = {}; //计时器管理
|
|
let parameter: any = {}; //参数
|
|
let parameter: any = {}; //参数
|
|
@@ -215,7 +215,7 @@ export function useWs() {
|
|
*/
|
|
*/
|
|
function sendMessage(type: string, data: any, callback?: () => void) {
|
|
function sendMessage(type: string, data: any, callback?: () => void) {
|
|
if (socket?.connected) {
|
|
if (socket?.connected) {
|
|
- callback = callback || function () {};
|
|
|
|
|
|
+ callback = callback || function () { };
|
|
//版本2就拼接进去
|
|
//版本2就拼接进去
|
|
if (version == 'v2') {
|
|
if (version == 'v2') {
|
|
type = type + '_' + version;
|
|
type = type + '_' + version;
|
|
@@ -240,7 +240,7 @@ export function useWs() {
|
|
demo: parameter.demo,
|
|
demo: parameter.demo,
|
|
test_time: testTime
|
|
test_time: testTime
|
|
},
|
|
},
|
|
- () => {}
|
|
|
|
|
|
+ () => { }
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -259,7 +259,7 @@ export function useWs() {
|
|
demo: parameter.demo,
|
|
demo: parameter.demo,
|
|
test_time: testTime
|
|
test_time: testTime
|
|
},
|
|
},
|
|
- () => {}
|
|
|
|
|
|
+ () => { }
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|