已申请列表添加websocket

This commit is contained in:
a0049873 2022-11-29 17:37:10 +08:00
parent bcbfd87eb7
commit 3d90e73659
2 changed files with 15 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian
* @Date: 2022-05-06 11:12:00
* @LastEditors: Light
* @LastEditTime: 2022-11-24 10:53:41
* @LastEditTime: 2022-11-29 17:28:20
* @Description: 告诉大家这是什么
-->
<template>
@ -19,13 +19,14 @@
import { getCategoryTreePage } from '@/api/personalCenter'
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import Cookies from 'js-cookie'
import { onBeforeUnmount, onMounted, watch, nextTick } from 'vue'
import { onBeforeUnmount, onMounted, watch, ref } from 'vue'
import { useRouter } from 'vue-router'
import mybus from '@/myplugins/mybus'
const router = useRouter()
const locale = zhCN
const token = Cookies.get('ucsToken')
const whoShow1 = ref(whoShow)
console.log('token=================>', token)
let ws = new WebSocket(
`ws://${window.SITE_CONFIG['websocketURL']}/websocket?token=${token}`
@ -39,6 +40,13 @@
if (router.currentRoute.value.name === 'mynoticeView') {
mybus.emit('noticeListInit')
}
//
if (
router.currentRoute.value.name === 'DetailsPageconetent' &&
whoShow1.value.itShowXiHaiAn
) {
mybus.emit('initDetailsPageconetent')
}
}
ws.onerror = function (e) {
console.log('WebSocket连接异常============================>', e)

View File

@ -2,7 +2,7 @@
* @Author: Light
* @Date: 2022-11-18 11:53:43
* @LastEditors: Light
* @LastEditTime: 2022-11-29 11:50:25
* @LastEditTime: 2022-11-29 17:28:02
* @Description: 告诉大家这是什么
-->
<template>
@ -447,8 +447,12 @@
}
}
})
mybus.on('initDetailsPageconetent', () => {
initApply()
})
onBeforeUnmount(() => {
mybus.off('selectCamera')
mybus.off('initDetailsPageconetent')
})
</script>
<style lang="less" scoped>