diff --git a/src/assets/styles/global.less b/src/assets/styles/global.less index 3f3bd6f..798d0ec 100644 --- a/src/assets/styles/global.less +++ b/src/assets/styles/global.less @@ -149,6 +149,19 @@ html.theme-dark body { } } +/** + * Tab 页的内容宽度约束。 + * + * 手机上内容本来就占满宽度,平板/横屏起限制最大宽度并居中, + * 避免入口卡片、设置列表、图表被拉成整屏宽的长条。 + * 各页用 --tab-body-max 覆盖默认宽度(1rem = 16px)。 + */ +.tab-body { + width: 100%; + max-width: var(--tab-body-max, 60rem); + margin: 0 auto; +} + .loading { margin: 1rem auto; } diff --git a/src/components/DateRangeChartCard.vue b/src/components/DateRangeChartCard.vue index 021c7ce..f785f39 100644 --- a/src/components/DateRangeChartCard.vue +++ b/src/components/DateRangeChartCard.vue @@ -4,7 +4,8 @@

-
+ +
@@ -78,10 +79,12 @@ function updateChartWidth(): void { diff --git a/src/layout/MainLayout.vue b/src/layout/MainLayout.vue index d240a30..7e135bf 100644 --- a/src/layout/MainLayout.vue +++ b/src/layout/MainLayout.vue @@ -78,8 +78,15 @@ const tabList: TabItem[] = [ { value: "/store", icon: "shop-3", text: "门店", permission: permissionCodes.stat.read }, { value: "/management", icon: "setting-1", text: "管理" } ]; +/** + * 横屏平板(出现左侧导航栏)把门店并进客户页:左门店、右操作入口, + * 导航里不再单独保留门店入口。 + */ +const mergedIntoCustomer = computed(() => railVisible.value); + const list = computed(() => tabList.filter(item => ( - (!item.permission || userStore.hasPermissions(item.permission, item.permissionMode)) + (!mergedIntoCustomer.value || item.value !== "/store") + && (!item.permission || userStore.hasPermissions(item.permission, item.permissionMode)) && (!item.role || userStore.hasRoles(item.role, item.roleMode)) ))); @@ -99,7 +106,10 @@ async function syncVisibleTab(): Promise { tabVal.value = visiblePath; } - if (route.path === "/customers" && visiblePath !== "/customers") { + // 停在已隐藏的 tab 根路径上(如横屏下的 /store)时,回到第一个可见 tab; + // 只处理 tab 根路径,详情页不在这里跳转 + const tabPath = resolveTabValue(route.path); + if (route.path === tabPath && (tabPath === "/customers" || tabPath === "/store") && visiblePath !== tabPath) { await router.replace(visiblePath); } } diff --git a/src/pages/store/component/StoreCustomerGrowthChart.vue b/src/pages/store/component/StoreCustomerGrowthChart.vue index 171edad..d1bc414 100644 --- a/src/pages/store/component/StoreCustomerGrowthChart.vue +++ b/src/pages/store/component/StoreCustomerGrowthChart.vue @@ -44,7 +44,7 @@ const { maxSliderValue, visibleDateTextList, handleSliderChange -} = useStoreChartWindow(dateTextList); +} = useStoreChartWindow(dateTextList, chartWidth); const { restDaySet } = useRestDayCalendar(dateTextList); const chartOption = computed(() => ({ ...buildStoreBaseChartOption(visibleDateTextList.value), diff --git a/src/pages/store/component/StoreDataCharts.vue b/src/pages/store/component/StoreDataCharts.vue index 7bad2f7..a328631 100644 --- a/src/pages/store/component/StoreDataCharts.vue +++ b/src/pages/store/component/StoreDataCharts.vue @@ -1,32 +1,36 @@