소스 검색

'update'

master
gtz 1 년 전
부모
커밋
0440a8fa46
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. +1
    -1
      src/components/boxes/KilnRuntime.vue
  2. +6
    -2
      src/utils/wsClass.js

+ 1
- 1
src/components/boxes/KilnRuntime.vue 파일 보기

@@ -37,7 +37,7 @@ export default {
}, },
methods: { methods: {
getRuntime() { getRuntime() {
const diff = Date.now() - new Date("2023-5-12 10:00:00");
const diff = Date.now() - new Date("2023-4-21 10:36:00");
const days = parseInt(diff / 1000 / 60 / 60 / 24); const days = parseInt(diff / 1000 / 60 / 60 / 24);
const hours = parseInt( const hours = parseInt(
(diff - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60 (diff - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60


+ 6
- 2
src/utils/wsClass.js 파일 보기

@@ -28,8 +28,12 @@ function handleError(err) {
console.log('[x] 出错:', err, err.data) console.log('[x] 出错:', err, err.data)
} }


function handleClose() {
function handleClose(data) {
console.log('[x] 服务器关闭连接') console.log('[x] 服务器关闭连接')
setTimeout(() => {
const wsc = new WsClient(data);
wsc.registerListeners();
}, 30000)
} }




@@ -77,7 +81,7 @@ export default class WsClient {
if (!WsClient.socket.onopen) WsClient.socket.onopen = handleOpen if (!WsClient.socket.onopen) WsClient.socket.onopen = handleOpen
if (!WsClient.socket.onmessage) WsClient.socket.onmessage = handleData.bind(this.vueInstance) if (!WsClient.socket.onmessage) WsClient.socket.onmessage = handleData.bind(this.vueInstance)
if (!WsClient.socket.onerror) WsClient.socket.onerror = handleError if (!WsClient.socket.onerror) WsClient.socket.onerror = handleError
if (!WsClient.socket.onclose) WsClient.socket.onclose = handleClose
if (!WsClient.socket.onclose) WsClient.socket.onclose = handleClose(this.vueInstance)
} }


static createSocket() { static createSocket() {


불러오는 중...
취소
저장