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/component/aside.vue  |    5 +++--
 src/layout/logo/index.vue       |    3 ++-
 src/layout/navMenu/vertical.vue |   11 ++++++-----
 src/layout/index.vue            |    3 ++-
 src/constants/index.ts          |    7 +++++++
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/constants/index.ts b/src/constants/index.ts
index c976e25..8006684 100644
--- a/src/constants/index.ts
+++ b/src/constants/index.ts
@@ -115,6 +115,13 @@
 export const TENANT_CODE = window.moduleConfig?.auth?.tenant?.code;
 //#endregion
 
+
+
+//#region ====================== 鍏朵粬 ======================
+// 绉诲姩绔渶灏忓搴︼紝杈惧埌杩欎釜闃堝�间細鍒锋柊椤甸潰
+export const MOBILE_MIN_WIDTH = 480;
+//#endregion
+
 export const responsePropertiesDict = {
 	required: '蹇呭~',
 	description: '璇存槑',
diff --git a/src/layout/component/aside.vue b/src/layout/component/aside.vue
index 8a8fb58..bd4ba14 100644
--- a/src/layout/component/aside.vue
+++ b/src/layout/component/aside.vue
@@ -17,6 +17,7 @@
 import { useThemeConfig } from '/@/stores/themeConfig';
 import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
 import mittBus from '/@/utils/mitt';
+import { MOBILE_MIN_WIDTH } from '/@/constants';
 
 // 寮曞叆缁勪欢
 const Logo = defineAsyncComponent(() => import('/@/layout/logo/index.vue'));
@@ -41,7 +42,7 @@
 	const asideBrTheme = ['#FFFFFF', '#FFF', '#fff', '#ffffff'];
 	const asideBrColor = asideBrTheme.includes(menuBar) ? 'layout-el-aside-br-color' : '';
 	// 鍒ゆ柇鏄惁鏄墜鏈虹
-	if (state.clientWidth <= 1000) {
+	if (state.clientWidth <= MOBILE_MIN_WIDTH) {
 		if (isCollapse) {
 			document.body.setAttribute('class', 'el-popup-parent--hidden');
 			const asideEle = document.querySelector('.layout-container') as HTMLElement;
@@ -80,7 +81,7 @@
 		el?.parentNode?.removeChild(el);
 	}, 300);
 	const clientWidth = document.body.clientWidth;
-	if (clientWidth < 1000) themeConfig.value.isCollapse = false;
+	if (clientWidth < MOBILE_MIN_WIDTH) themeConfig.value.isCollapse = false;
 	document.body.setAttribute('class', '');
 };
 // 璁剧疆/杩囨护璺敱锛堥潪闈欐�佽矾鐢�/鏄惁鏄剧ず鍦ㄨ彍鍗曚腑锛�
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 32fb68d..5402ac9 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -9,6 +9,7 @@
 import { Local } from '/@/utils/storage';
 import mittBus from '/@/utils/mitt';
 import { PingLogin } from '/@/api/system';
+import { MOBILE_MIN_WIDTH } from '../constants';
 
 // 寮曞叆缁勪欢
 const layouts: any = {
@@ -26,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',
diff --git a/src/layout/logo/index.vue b/src/layout/logo/index.vue
index 6946d98..78af8a1 100644
--- a/src/layout/logo/index.vue
+++ b/src/layout/logo/index.vue
@@ -12,6 +12,7 @@
 import { computed, onMounted, ref } from 'vue';
 import { storeToRefs } from 'pinia';
 import { useThemeConfig } from '/@/stores/themeConfig';
+import { MOBILE_MIN_WIDTH } from '/@/constants';
 
 // 瀹氫箟鍙橀噺鍐呭
 const storesThemeConfig = useThemeConfig();
@@ -20,7 +21,7 @@
 // 璁剧疆 logo 鐨勬樉绀恒�俢lassic 缁忓吀甯冨眬榛樿鏄剧ず logo
 const setShowLogo = computed(() => {
 	let { isCollapse, layout } = themeConfig.value;
-	return !isCollapse || layout === 'classic' || document.body.clientWidth < 1000;
+	return !isCollapse || layout === 'classic' || document.body.clientWidth < MOBILE_MIN_WIDTH;
 });
 // logo 鐐瑰嚮瀹炵幇鑿滃崟灞曞紑/鏀惰捣
 const onThemeConfigChange = () => {
diff --git a/src/layout/navMenu/vertical.vue b/src/layout/navMenu/vertical.vue
index 2d6b8fd..1d52062 100644
--- a/src/layout/navMenu/vertical.vue
+++ b/src/layout/navMenu/vertical.vue
@@ -31,12 +31,13 @@
 </template>
 
 <script setup lang="ts" name="navMenuVertical">
-import { defineAsyncComponent, reactive, computed, onMounted, watch } from 'vue';
-import { useRoute, onBeforeRouteUpdate, RouteRecordRaw } from 'vue-router';
 import { storeToRefs } from 'pinia';
+import { computed, defineAsyncComponent, onMounted, reactive, watch } from 'vue';
+import type { RouteRecordRaw } from 'vue-router';
+import { onBeforeRouteUpdate, useRoute } from 'vue-router';
+import { MOBILE_MIN_WIDTH } from '/@/constants';
 import { useThemeConfig } from '/@/stores/themeConfig';
 import other from '/@/utils/other';
-import { MenuTypeEnum } from '/@/api/menu/type';
 
 // 寮曞叆缁勪欢
 const SubItem = defineAsyncComponent(() => import('/@/layout/navMenu/subItem.vue'));
@@ -100,13 +101,13 @@
 	// 淇锛歨ttps://gitee.com/lyt-top/vue-next-admin/issues/I3YX6G
 	state.defaultActive = setParentHighlight(to);
 	const clientWidth = document.body.clientWidth;
-	if (clientWidth < 1000) themeConfig.value.isCollapse = false;
+	if (clientWidth < MOBILE_MIN_WIDTH) themeConfig.value.isCollapse = false;
 });
 // 璁剧疆鑿滃崟鐨勬敹璧�/灞曞紑
 watch(
 	themeConfig.value,
 	() => {
-		document.body.clientWidth <= 1000 ? (state.isCollapse = false) : (state.isCollapse = themeConfig.value.isCollapse);
+		document.body.clientWidth <= MOBILE_MIN_WIDTH ? (state.isCollapse = false) : (state.isCollapse = themeConfig.value.isCollapse);
 	},
 	{
 		immediate: true,

--
Gitblit v1.9.3