mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:09:19 +08:00
fix(frontend): 修复 keep-alive 场景下路由参数串用导致的接口错乱
- 商品/店铺概览页增加 isProductOverviewRoute / isShopOverviewRoute 路由路径校验 - 防止 keep-alive 切换标签时 route.params.id 被其他页复用导致错误请求 - 全店概览页 Page 标题改为 template slot 方式,移除冗余的店铺数量拉取逻辑 - 同步优化各概览页 header 样式对齐
This commit is contained in:
@@ -20,7 +20,6 @@ import { Button, DatePicker, InputNumber, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getCompanyOverviewApi } from '#/api/ecommerce/store-overview/apis';
|
||||
import { getShopPageApi } from '#/api/ecommerce/shop';
|
||||
import { exportByPost } from '#/utils/export';
|
||||
|
||||
import ComparisonSwitcher from './components/ComparisonSwitcher.vue';
|
||||
@@ -36,7 +35,6 @@ const router = useRouter();
|
||||
const loading = ref(false);
|
||||
const exportLoading = ref(false);
|
||||
const overviewData = ref<CompanyOverviewVO.Info | null>(null);
|
||||
const shopCount = ref(0);
|
||||
|
||||
// 指定店铺导出模式
|
||||
const shopExportMode = ref(false);
|
||||
@@ -275,20 +273,6 @@ const syncDateRangeToRouteQuery = async () => {
|
||||
window.history.replaceState({}, '', newUrl.toString());
|
||||
};
|
||||
|
||||
// 加载店铺数量
|
||||
const loadShopCount = async () => {
|
||||
try {
|
||||
const response = await getShopPageApi({
|
||||
page: 1,
|
||||
pageSize: 1,
|
||||
filters: {},
|
||||
});
|
||||
shopCount.value = response.total || 0;
|
||||
} catch (error) {
|
||||
console.error('获取店铺数量失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 加载概览数据
|
||||
const loadOverviewData = async () => {
|
||||
if (isRequesting.value) return;
|
||||
@@ -342,7 +326,6 @@ watch(
|
||||
let darkThemeObserver: MutationObserver | null = null;
|
||||
|
||||
onMounted(async () => {
|
||||
await loadShopCount();
|
||||
await refreshOverviewByCurrentParams(true);
|
||||
|
||||
darkThemeObserver = new MutationObserver(() => {
|
||||
@@ -467,14 +450,15 @@ const navigateToShopOverview = (shopId: number) => {
|
||||
|
||||
<template>
|
||||
<Page
|
||||
title="全店铺经营概览大盘"
|
||||
auto-content-height
|
||||
class="bg-[#f8fafc] dark:bg-[hsl(222.34deg_10.43%_12.27%)]"
|
||||
header-class="store-overview-page-header"
|
||||
>
|
||||
<template #description>
|
||||
<div class="mt-1 text-xs font-bold leading-5 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)] sm:text-sm">
|
||||
数据范围:公司旗下所有店铺汇总统计 · 共 {{ shopCount }} 家在营店铺
|
||||
<template #title>
|
||||
<div
|
||||
class="text-xl font-black tracking-tight text-slate-900 dark:text-[hsl(0deg_0%_98%)] sm:text-2xl md:text-3xl"
|
||||
>
|
||||
全店铺经营概览大盘
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -641,6 +625,10 @@ const navigateToShopOverview = (shopId: number) => {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.store-overview-page-header) {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
:deep(.store-overview-page-header) {
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user