|
|
@ -8,13 +8,14 @@ import Liquid from 'components/home/Liquid/index.vue' |
|
|
|
import Check from 'components/system/Check/index.vue' |
|
|
|
import EditDate from 'components/system/EditDate/index.vue' |
|
|
|
import Stop from 'components/system/Stop/index.vue' |
|
|
|
import { ElMessageBox } from 'element-plus' |
|
|
|
import { useActivateDebug } from 'hooks/useActivateDebug' |
|
|
|
import { useServerTime } from 'hooks/useServerTime' |
|
|
|
import { isClose } from 'libs/socket' |
|
|
|
import { isClose, socket } from 'libs/socket' |
|
|
|
import { authRoutes } from 'router/routes' |
|
|
|
import { useDebugStore } from 'stores/debugStore' |
|
|
|
import { useSystemStore } from 'stores/systemStore' |
|
|
|
import { computed, onMounted, ref, watch } from 'vue' |
|
|
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
|
|
|
const { handleLogoClick } = useActivateDebug() |
|
|
@ -23,6 +24,36 @@ const { currentTime } = useServerTime() |
|
|
|
const systemStore = useSystemStore() |
|
|
|
const router = useRouter() |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
socket.init(receiveMessage, 'alarm') |
|
|
|
}) |
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
socket.unregisterCallback(receiveMessage, 'alarm') |
|
|
|
}) |
|
|
|
|
|
|
|
let flag = false |
|
|
|
|
|
|
|
const receiveMessage = async (data: any) => { |
|
|
|
if (flag) { |
|
|
|
return |
|
|
|
} |
|
|
|
flag = true |
|
|
|
await ElMessageBox.confirm( |
|
|
|
data, |
|
|
|
'提示', |
|
|
|
{ |
|
|
|
confirmButtonText: '确认', |
|
|
|
showClose: false, |
|
|
|
showCancelButton: false, |
|
|
|
closeOnClickModal: false, |
|
|
|
closeOnPressEscape: false, |
|
|
|
type: 'warning', |
|
|
|
}, |
|
|
|
) |
|
|
|
flag = false |
|
|
|
} |
|
|
|
|
|
|
|
watch(() => currentTime.value, () => { |
|
|
|
systemStore.currentTime = currentTime.value |
|
|
|
}) |
|
|
@ -42,6 +73,7 @@ watch(() => systemStore.systemStatus, () => { |
|
|
|
} |
|
|
|
}) |
|
|
|
onMounted(async () => { |
|
|
|
socket.init(receiveMessage, 'alarm') |
|
|
|
console.log('systemStatus', systemStore.systemStatus) |
|
|
|
if (!systemStore.systemStatus.currentUser) { |
|
|
|
await router.push('/login') |
|
|
|