优化WebSocket通知
This commit is contained in:
parent
58ee0eb3e3
commit
ceab393f37
@ -41,14 +41,15 @@
|
|||||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||||
import { lighten } from '@/utils';
|
import { lighten } from '@/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义参数
|
||||||
|
*/
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const useLockscreen = useLockscreenStore();
|
const useLockscreen = useLockscreenStore();
|
||||||
const designStore = useDesignSettingStore();
|
const designStore = useDesignSettingStore();
|
||||||
const isLock = computed(() => useLockscreen.isLock);
|
const isLock = computed(() => useLockscreen.isLock);
|
||||||
const lockTime = computed(() => useLockscreen.lockTime);
|
const lockTime = computed(() => useLockscreen.lockTime);
|
||||||
|
|
||||||
const proName = import.meta.env.VITE_GLOB_APP_TITLE;
|
const proName = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||||
|
|
||||||
const { getIsWaterMark } = useProjectSetting();
|
const { getIsWaterMark } = useProjectSetting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,6 +96,9 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钩子函数
|
||||||
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// document.addEventListener('mousedown', timekeeping);
|
// document.addEventListener('mousedown', timekeeping);
|
||||||
});
|
});
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
</n-icon>
|
</n-icon>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- 全局WebSocket通讯组件 -->
|
||||||
<global-websocket :uri="'/api/websocket/' + userInfo.id" @rollback="rollback" />
|
<global-websocket :uri="'/api/websocket/' + userInfo.id" @rollback="rollback" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -92,9 +93,11 @@
|
|||||||
import { MaybeElement, useFullscreen } from '@vueuse/core';
|
import { MaybeElement, useFullscreen } from '@vueuse/core';
|
||||||
import { SettingOutlined } from '@vicons/antd';
|
import { SettingOutlined } from '@vicons/antd';
|
||||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||||
import { initWebSocket } from '@/components/Websocket/index';
|
|
||||||
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义参数
|
||||||
|
*/
|
||||||
|
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
||||||
const { getDarkTheme } = useDesignSetting();
|
const { getDarkTheme } = useDesignSetting();
|
||||||
const notification = useNotification();
|
const notification = useNotification();
|
||||||
const {
|
const {
|
||||||
@ -105,24 +108,23 @@
|
|||||||
getMultiTabsSetting,
|
getMultiTabsSetting,
|
||||||
getIsProjectSetting,
|
getIsProjectSetting,
|
||||||
} = useProjectSetting();
|
} = useProjectSetting();
|
||||||
|
|
||||||
const settingStore = useProjectSettingStore();
|
const settingStore = useProjectSettingStore();
|
||||||
const designStore = useDesignSettingStore();
|
const designStore = useDesignSettingStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const userInfo: object = userStore.getUserInfo || {};
|
const userInfo: object = userStore.getUserInfo || {};
|
||||||
|
|
||||||
const navMode = getNavMode;
|
const navMode = getNavMode;
|
||||||
|
|
||||||
const drawerSetting = ref();
|
const drawerSetting = ref();
|
||||||
const collapsed = ref<boolean>(false);
|
const collapsed = ref<boolean>(false);
|
||||||
const adminBodyRef = ref<MaybeElement>();
|
const adminBodyRef = ref<MaybeElement>();
|
||||||
|
|
||||||
const { isFullscreen, toggle } = useFullscreen(adminBodyRef);
|
const { isFullscreen, toggle } = useFullscreen(adminBodyRef);
|
||||||
|
|
||||||
provide('isPageFullScreen', isFullscreen);
|
provide('isPageFullScreen', isFullscreen);
|
||||||
provide('collapsed', collapsed);
|
provide('collapsed', collapsed);
|
||||||
provide('openSetting', openSetting);
|
provide('openSetting', openSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 侦听器
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => collapsed.value,
|
() => collapsed.value,
|
||||||
(to) => {
|
(to) => {
|
||||||
@ -214,6 +216,11 @@
|
|||||||
collapsed.value = true;
|
collapsed.value = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息通知回调
|
||||||
|
* @param msg 消息
|
||||||
|
*/
|
||||||
const rollback = (msg) => {
|
const rollback = (msg) => {
|
||||||
notification.info({
|
notification.info({
|
||||||
title: '通知',
|
title: '通知',
|
||||||
@ -222,6 +229,9 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钩子函数
|
||||||
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('resize', watchWidth);
|
window.addEventListener('resize', watchWidth);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user