修改数据监听过多的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> </template>
<script> <script>
import store from '@/store/'
import {getAction} from '@/api/manage' import {getAction} from '@/api/manage'
export default { export default {
@ -62,7 +62,8 @@
methods: { methods: {
initWebSocket: function () { initWebSocket: function () {
// WebSocketwshttpwsshttps // 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 = new WebSocket(url);
this.websock.onopen = this.websocketonopen; this.websock.onopen = this.websocketonopen;
this.websock.onerror = this.websocketonerror; this.websock.onerror = this.websocketonerror;
@ -83,7 +84,7 @@
this.percent = data.currProgress this.percent = data.currProgress
}, },
websocketclose: function (e) { websocketclose: function (e) {
console.log("connection closed (" + e.code + ")"); console.log("connection closed (" + e + ")");
}, },
dataAdd(){ dataAdd(){
getAction("/dataSpecial/special").then((res) => { getAction("/dataSpecial/special").then((res) => {