|
@@ -97,6 +97,7 @@ const { isAppLoading } = useProject()
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
const layout = useRoutes?.query?.layout, layout2 = store.isLayout
|
|
const layout = useRoutes?.query?.layout, layout2 = store.isLayout
|
|
isLayout.value = layout ?? layout2
|
|
isLayout.value = layout ?? layout2
|
|
|
|
+ annRefs.value = []
|
|
initButtons()
|
|
initButtons()
|
|
})
|
|
})
|
|
|
|
|
|
@@ -195,22 +196,25 @@ const cascaderSend = async ({ projectId, contractId }) => {
|
|
}
|
|
}
|
|
|
|
|
|
//长链接消息
|
|
//长链接消息
|
|
|
|
+const annRefs = ref([])
|
|
const socketData = async (res) => {
|
|
const socketData = async (res) => {
|
|
console.log('socket:', res)
|
|
console.log('socket:', res)
|
|
const { type, data } = getObjValue(res)
|
|
const { type, data } = getObjValue(res)
|
|
if (type === 'msgUpdateMsg') {
|
|
if (type === 'msgUpdateMsg') {
|
|
//更新公告
|
|
//更新公告
|
|
- await HcAnnouncement({
|
|
|
|
|
|
+ const ref = await HcAnnouncement({
|
|
type: 'update',
|
|
type: 'update',
|
|
data: data,
|
|
data: data,
|
|
//time: 'xxx年xx月xx日 xx:xx:xx',
|
|
//time: 'xxx年xx月xx日 xx:xx:xx',
|
|
})
|
|
})
|
|
|
|
+ annRefs.value.push(ref)
|
|
} else if (type === 'msgSystemMsg') {
|
|
} else if (type === 'msgSystemMsg') {
|
|
//普通公告
|
|
//普通公告
|
|
- await HcAnnouncement({
|
|
|
|
|
|
+ const ref = await HcAnnouncement({
|
|
type: 'system',
|
|
type: 'system',
|
|
data: data,
|
|
data: data,
|
|
})
|
|
})
|
|
|
|
+ annRefs.value.push(ref)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -234,6 +238,13 @@ const userProjectClick = () => {
|
|
//页面卸载
|
|
//页面卸载
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
if (!isNullES(socket)) socket.close()
|
|
if (!isNullES(socket)) socket.close()
|
|
|
|
+ const refs = annRefs.value
|
|
|
|
+ for (let i = 0; i < refs.length; i++) {
|
|
|
|
+ if (!isNullES(refs[i])) {
|
|
|
|
+ refs[i]?.close()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ annRefs.value = []
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|