From 3acec796e54dc2f5e7d93e8ca72db7da9ec46f60 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期一, 28 四月 2025 17:33:56 +0800 Subject: [PATCH] 2025.04.28 --- src/views/inspection/WorkStream.vue | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/views/inspection/WorkStream.vue b/src/views/inspection/WorkStream.vue index 0800f34..1f71798 100644 --- a/src/views/inspection/WorkStream.vue +++ b/src/views/inspection/WorkStream.vue @@ -1,11 +1,12 @@ <template> <!-- <div class="border-r-small m-h-2 p-h-4"> --> <BaseCard> - <div> + <!-- <div> <input type="text" v-model="inputVal" /> <button @click="handleSend">send</button> <button @click="handleLink">link</button> - </div> + </div> --> + <div>涓氬姟鐘舵�佷腑鎺�</div> <el-scrollbar ref="scrollbarRef" :height="height"> <div ref="scrollContentRef"> <div v-for="item in streams" :key="item.index"> @@ -78,7 +79,9 @@ if (socket) { socket.close() } - socket = new WebSocket(`ws://192.168.0.138:8082/workstream`) + const url = 'ws://' + ws + '/workstream' + // socket = new WebSocket(`ws://192.168.0.138:8080/workstream`) + socket = new WebSocket(url) // 涓庢湇鍔″櫒寤虹珛杩炴帴锛氬彂閫佹秷鎭埌鏈嶅姟鍣� socket.onopen = () => { console.log('connect: ') @@ -109,15 +112,16 @@ } onMounted(() => { - // setInterval(() => { - // streams.push({ - // time: dayjs().format('YYYY-MM-DD HH:mm:ss'), - // user: users[parseInt(Math.random() * users.length)], - // obj: objs[parseInt(Math.random() * objs.length)], - // event: events[parseInt(Math.random() * events.length)] - // }) - // scrollToBottom() - // }, 10000) + // handleLink() + setInterval(() => { + streams.push({ + time: dayjs().format('YYYY-MM-DD HH:mm:ss'), + userName: users[parseInt(Math.random() * users.length)], + obj: objs[parseInt(Math.random() * objs.length)], + event: events[parseInt(Math.random() * events.length)] + }) + scrollToBottom() + }, 5000) }) onUnmounted(() => { socket.close() -- Gitblit v1.9.3