修改数据监听过多的BUG

This commit is contained in:
RenCheng 2025-02-28 16:46:55 +08:00
parent efc69025c1
commit 7701bc8aa8

View File

@ -32,7 +32,7 @@
</template>
<script>
import store from '@/store/'
import {getAction} from '@/api/manage'
export default {
@ -62,7 +62,8 @@
methods: {
initWebSocket: function () {
// WebSocketwshttpwsshttps
var url = window._CONFIG['domianURL'].replace("https://","ws://").replace("http://","ws://")+"/websocket/1/data_distribute";
var userId = store.getters.userInfo.id;
var url = window._CONFIG['domianURL'].replace("https://","ws://").replace("http://","ws://")+"/websocket/"+userId+"/data_distribute";
this.websock = new WebSocket(url);
this.websock.onopen = this.websocketonopen;
this.websock.onerror = this.websocketonerror;
@ -83,7 +84,7 @@
this.percent = data.currProgress
},
websocketclose: function (e) {
console.log("connection closed (" + e.code + ")");
console.log("connection closed (" + e + ")");
},
dataAdd(){
getAction("/dataSpecial/special").then((res) => {