From d3efce76cd9698b364e1db3e17aec2f7ee36d0d9 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 24 二月 2025 10:23:40 +0800 Subject: [PATCH] 1000 修改刷新页面宽度 --- src/layout/index.vue | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/src/layout/index.vue b/src/layout/index.vue index f4ee956..5402ac9 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -8,6 +8,8 @@ import { useThemeConfig } from '/@/stores/themeConfig'; import { Local } from '/@/utils/storage'; import mittBus from '/@/utils/mitt'; +import { PingLogin } from '/@/api/system'; +import { MOBILE_MIN_WIDTH } from '../constants'; // 寮曞叆缁勪欢 const layouts: any = { @@ -25,7 +27,7 @@ const onLayoutResize = () => { if (!Local.get('oldLayout')) Local.set('oldLayout', themeConfig.value.layout); const clientWidth = document.body.clientWidth; - if (clientWidth < 1000) { + if (clientWidth < MOBILE_MIN_WIDTH) { themeConfig.value.isCollapse = false; mittBus.emit('layoutMobileResize', { layout: 'defaults', @@ -38,10 +40,27 @@ }); } }; +const pingLogin = async () => { + // 5鍒嗛挓 + const interval = 1000 * 60 * 5; + // const interval = 1000 *2; + + const timer = setInterval(async () => { + const res = await PingLogin({ + loading: false, + }); + if (!res?.is_login) { + clearInterval(timer); + } + }, interval); + return timer; +}; // 椤甸潰鍔犺浇鍓� onBeforeMount(() => { onLayoutResize(); window.addEventListener('resize', onLayoutResize); + pingLogin(); + }); // 椤甸潰鍗歌浇鏃� onUnmounted(() => { -- Gitblit v1.9.3