Преглед на файлове

Merge branch 'test' into dev_zyh

Jack Zhou преди 22 часа
родител
ревизия
39a3ce2dd0

+ 1 - 1
.env.development

@@ -1,2 +1,2 @@
-VITE_API_HOST = 'http://192.168.14.224/Customer_Service_Online'
+VITE_API_HOST = 'http://192.168.114.65/Customer_Service_Online'
 VITE_BASE_URL = '/k_new_online/'

+ 58 - 2
src/router/index.ts

@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
 import { useUserStore } from '@/stores/modules/user'
 import { useBreadCrumb } from '@/stores/modules/breadCrumb'
 import { useHeaderSearch } from '@/stores/modules/headerSearch'
+import { useFiltersStore } from '@/stores/modules/filtersList'
 
 const router = createRouter({
   history: createWebHistory(`${import.meta.env.VITE_BASE_URL}`),
@@ -224,7 +225,6 @@ const router = createRouter({
 
 // * 路由拦截 beforeEach
 router.beforeEach(async (to, from, next) => {
-  useBreadCrumb().setRouteList(to)
   const userStore = useUserStore()
   const headerSearchStore = useHeaderSearch()
   // 如果手动跳转登录页,清除登录信息
@@ -254,6 +254,61 @@ router.beforeEach(async (to, from, next) => {
     sessionStorage.removeItem('activeCardTypeName')
   }
 
+  const SHOULD_CLEAR_FILTERS = (to, from) => {
+    const PATHS = {
+      TRACKING_HOME: '/tracking',
+      BOOKING_HOME: '/booking',
+      TRACKING_DETAIL: '/tracking/detail',
+      BOOKING_DETAIL: '/booking/detail',
+      TRACKING_ADD_VGM: '/tracking/add-vgm',
+    };
+
+    const PAGE_NAMES = {
+      BOOKING_DETAIL: 'Booking Detail',
+      TRACKING_DETAIL: 'Tracking Detail',
+      ADD_VGM: 'Add VGM',
+    };
+    const breadCrumbStore = useBreadCrumb();
+
+    // 安全获取面包屑根路径
+    const rootPath = breadCrumbStore.routeList?.[0]?.path;
+
+    // --- 定义“应该保留筛选器”的场景 (Keep Filters) ---
+
+    // 场景 1: 从详情页返回列表页,且列表页是面包屑根节点 (用户只是进去看了一眼详情又回来了)
+    const isReturningFromDetail =
+      [PATHS.TRACKING_DETAIL, PATHS.BOOKING_DETAIL].includes(from.path) &&
+      [PATHS.TRACKING_HOME, PATHS.BOOKING_HOME].includes(to.path) &&
+      rootPath === to.path;
+
+    // 场景 2: 从 VGM 页返回 Tracking 列表页
+    const isReturningFromVgm =
+      from.path === PATHS.TRACKING_ADD_VGM &&
+      to.path === PATHS.TRACKING_HOME;
+
+    // 场景 3: 从列表页进入白名单子页面 (用户正准备进去看详情,稍后会回来)
+    // 注意:这里假设 to.name 是可靠的,否则建议也用 path 映射
+    const isEnteringWhitelist =
+      (from.path === PATHS.TRACKING_HOME && [PAGE_NAMES.BOOKING_DETAIL, PAGE_NAMES.TRACKING_DETAIL, PAGE_NAMES.ADD_VGM].includes(to.name)) ||
+      (from.path === PATHS.BOOKING_HOME && [PAGE_NAMES.BOOKING_DETAIL, PAGE_NAMES.TRACKING_DETAIL].includes(to.name));
+
+    // --- 最终逻辑 ---
+    // 如果满足上述任一“保留”场景,则 NOT 清除 (返回 false)
+    // 否则,清除 (返回 true)
+    const shouldKeepFilters = isReturningFromDetail || isReturningFromVgm || isEnteringWhitelist;
+
+    return !shouldKeepFilters;
+  };
+
+  // --- 使用处 ---
+  if (SHOULD_CLEAR_FILTERS(to, from)) {
+    const filtersListStore = useFiltersStore();
+    filtersListStore.clearFilters();
+    // 可选:添加日志方便调试
+    // console.log('Filters cleared because navigation was not in a protected flow.');
+  }
+
+
   // 未登录白名单
   const whiteList = ['/login', '/public-tracking', '/public-tracking/detail', '/reset-password', '/demo-video']
   // 判断是否登录
@@ -271,7 +326,8 @@ router.beforeEach(async (to, from, next) => {
       next('/login')
     }
   }
+
+  useBreadCrumb().setRouteList(to)
   next()
 })
-
 export default router

+ 0 - 9
src/views/Booking/src/BookingView.vue

@@ -164,7 +164,6 @@ onMounted(() => {
 })
 import BookingGuide from './components/BookingGuide.vue'
 import { useGuideStore } from '@/stores/modules/guide'
-import { onBeforeRouteLeave } from 'vue-router'
 
 const guideStore = useGuideStore()
 const bookingGuideRef = ref()
@@ -172,14 +171,6 @@ const handleGuide = () => {
   bookingGuideRef.value.startGuide() // 开始引导
 }
 
-onBeforeRouteLeave((route: any) => {
-  // guideStore.clearGuide()
-  const whiteList = ['Booking Detail', 'Tracking Detail']
-  if (!whiteList.includes(route?.name)) {
-    filtersStore.clearFilters()
-  }
-})
-
 const getTabsList = (list) => {
   tabList.value.forEach((item) => {
     const current = list.find((i) => i.name === item.name)

+ 1 - 1
src/views/Dashboard/src/components/BarChart.vue

@@ -155,7 +155,7 @@ const getOption = () => {
       },
       feature: {
         saveAsImage: {
-          icon: 'path://M588.8 821.44H179.52a38.4 38.4 0 0 1-38.4-38.4v-105.088l202.432-115.584 112.96 64.576c7.872 4.48 17.6 4.48 25.472 0l400.768-228.8-0.32-0.512h0.64v-156.8a89.6 89.6 0 0 0-89.6-89.6H179.456a89.6 89.6 0 0 0-89.6 89.6v542.208a89.6 89.6 0 0 0 89.6 89.6H588.8v-51.2zM141.184 240.896a38.4 38.4 0 0 1 38.4-38.4h613.824a38.4 38.4 0 0 1 38.4 38.4v127.36L469.248 575.104 356.288 510.72a25.6 25.6 0 0 0-19.2-2.496l-6.144 2.56-189.76 108.288V240.896z m168.448 226.432c44.416 0 80.96-33.792 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376l-8.768-0.448c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832c4.096 40.32 36.16 72.448 76.544 76.544l8.832 0.448z m0-51.2a34.624 34.624 0 1 1 0-69.312 34.624 34.624 0 0 1 0 69.312z m445.888 449.024a25.6 25.6 0 0 0 36.224-0.064l138.368-138.368-36.224-36.224-94.592 94.656V545.536h-51.2v239.616l-94.72-94.656-36.224 36.224 138.368 138.432z',
+          icon: 'path://M588.8 830.976H179.52a48 48 0 0 1-48-48v-110.72l212.032-120.96 117.76 67.2a16 16 0 0 0 15.744 0.128l396.16-220.8-0.192-0.256h0.384v-156.8c0-44.16-35.84-80-80-80H179.52c-44.16 0-80 35.84-80 80v542.208c0 44.16 35.84 80 80 80H588.8v-32zM131.52 240.832a48 48 0 0 1 48-48h613.888a48 48 0 0 1 48 48V378.88L469.312 586.24l-117.76-67.2a16.128 16.128 0 0 0-12.032-1.664l-3.84 1.6-204.16 116.48V240.896zM309.632 467.2a85.76 85.76 0 0 0 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376L309.76 295.68c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832A85.76 85.76 0 0 0 300.8 466.816l8.832 0.448z m0-32a53.76 53.76 0 1 1 0-107.584 53.76 53.76 0 0 1 0 107.52z m452.736 423.04a16 16 0 0 0 22.592 0l138.368-138.368-22.592-22.656-111.104 111.104V545.6h-32v262.784l-111.04-111.104-22.592 22.656 138.368 138.368z',
           show: true,
           name: bar_title.value || props.saveImageName || 'data',
           type: 'png',

+ 1 - 1
src/views/Dashboard/src/components/PieChart.vue

@@ -126,7 +126,7 @@ const initOption: any = reactive({
     feature: {
       // restore: { show: true },
       saveAsImage: {
-        icon: 'path://M588.8 821.44H179.52a38.4 38.4 0 0 1-38.4-38.4v-105.088l202.432-115.584 112.96 64.576c7.872 4.48 17.6 4.48 25.472 0l400.768-228.8-0.32-0.512h0.64v-156.8a89.6 89.6 0 0 0-89.6-89.6H179.456a89.6 89.6 0 0 0-89.6 89.6v542.208a89.6 89.6 0 0 0 89.6 89.6H588.8v-51.2zM141.184 240.896a38.4 38.4 0 0 1 38.4-38.4h613.824a38.4 38.4 0 0 1 38.4 38.4v127.36L469.248 575.104 356.288 510.72a25.6 25.6 0 0 0-19.2-2.496l-6.144 2.56-189.76 108.288V240.896z m168.448 226.432c44.416 0 80.96-33.792 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376l-8.768-0.448c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832c4.096 40.32 36.16 72.448 76.544 76.544l8.832 0.448z m0-51.2a34.624 34.624 0 1 1 0-69.312 34.624 34.624 0 0 1 0 69.312z m445.888 449.024a25.6 25.6 0 0 0 36.224-0.064l138.368-138.368-36.224-36.224-94.592 94.656V545.536h-51.2v239.616l-94.72-94.656-36.224 36.224 138.368 138.432z',
+        icon: 'path://M588.8 830.976H179.52a48 48 0 0 1-48-48v-110.72l212.032-120.96 117.76 67.2a16 16 0 0 0 15.744 0.128l396.16-220.8-0.192-0.256h0.384v-156.8c0-44.16-35.84-80-80-80H179.52c-44.16 0-80 35.84-80 80v542.208c0 44.16 35.84 80 80 80H588.8v-32zM131.52 240.832a48 48 0 0 1 48-48h613.888a48 48 0 0 1 48 48V378.88L469.312 586.24l-117.76-67.2a16.128 16.128 0 0 0-12.032-1.664l-3.84 1.6-204.16 116.48V240.896zM309.632 467.2a85.76 85.76 0 0 0 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376L309.76 295.68c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832A85.76 85.76 0 0 0 300.8 466.816l8.832 0.448z m0-32a53.76 53.76 0 1 1 0-107.584 53.76 53.76 0 0 1 0 107.52z m452.736 423.04a16 16 0 0 0 22.592 0l138.368-138.368-22.592-22.656-111.104 111.104V545.6h-32v262.784l-111.04-111.104-22.592 22.656 138.368 138.368z',
         show: true,
         name: downloadName.value,
         type: 'png',

+ 2 - 2
src/views/Dashboard/src/components/RevenueChart.vue

@@ -293,7 +293,7 @@ const initOption = reactive({
     right: 8,
     feature: {
       saveAsImage: {
-        icon: 'path://M588.8 821.44H179.52a38.4 38.4 0 0 1-38.4-38.4v-105.088l202.432-115.584 112.96 64.576c7.872 4.48 17.6 4.48 25.472 0l400.768-228.8-0.32-0.512h0.64v-156.8a89.6 89.6 0 0 0-89.6-89.6H179.456a89.6 89.6 0 0 0-89.6 89.6v542.208a89.6 89.6 0 0 0 89.6 89.6H588.8v-51.2zM141.184 240.896a38.4 38.4 0 0 1 38.4-38.4h613.824a38.4 38.4 0 0 1 38.4 38.4v127.36L469.248 575.104 356.288 510.72a25.6 25.6 0 0 0-19.2-2.496l-6.144 2.56-189.76 108.288V240.896z m168.448 226.432c44.416 0 80.96-33.792 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376l-8.768-0.448c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832c4.096 40.32 36.16 72.448 76.544 76.544l8.832 0.448z m0-51.2a34.624 34.624 0 1 1 0-69.312 34.624 34.624 0 0 1 0 69.312z m445.888 449.024a25.6 25.6 0 0 0 36.224-0.064l138.368-138.368-36.224-36.224-94.592 94.656V545.536h-51.2v239.616l-94.72-94.656-36.224 36.224 138.368 138.432z',
+        icon: 'path://M588.8 830.976H179.52a48 48 0 0 1-48-48v-110.72l212.032-120.96 117.76 67.2a16 16 0 0 0 15.744 0.128l396.16-220.8-0.192-0.256h0.384v-156.8c0-44.16-35.84-80-80-80H179.52c-44.16 0-80 35.84-80 80v542.208c0 44.16 35.84 80 80 80H588.8v-32zM131.52 240.832a48 48 0 0 1 48-48h613.888a48 48 0 0 1 48 48V378.88L469.312 586.24l-117.76-67.2a16.128 16.128 0 0 0-12.032-1.664l-3.84 1.6-204.16 116.48V240.896zM309.632 467.2a85.76 85.76 0 0 0 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376L309.76 295.68c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832A85.76 85.76 0 0 0 300.8 466.816l8.832 0.448z m0-32a53.76 53.76 0 1 1 0-107.584 53.76 53.76 0 0 1 0 107.52z m452.736 423.04a16 16 0 0 0 22.592 0l138.368-138.368-22.592-22.656-111.104 111.104V545.6h-32v262.784l-111.04-111.104-22.592 22.656 138.368 138.368z',
         show: true,
         name: 'Revenue Spent',
         pixelRatio: 2
@@ -303,7 +303,7 @@ const initOption = reactive({
         title: 'update',
         icon:
           'path://' +
-          'M571.648 956.864v-51.2H230.144a38.4 38.4 0 0 1-38.4-38.4V195.2a38.4 38.4 0 0 1 38.4-38.4h306.368v167.488c0 49.472 40.128 89.6 89.6 89.6h167.552v88.768h51.264V384h-0.448a25.472 25.472 0 0 0-7.04-13.76L580.224 113.088a25.6 25.6 0 0 0-19.84-7.424h-330.24c-49.408 0-89.6 40.128-89.6 89.6v672c0 49.472 40.128 89.6 89.6 89.6h341.504z m54.464-594.112a38.4 38.4 0 0 1-38.4-38.4V193.088l169.728 169.664H626.112z m-224.896 346.24a20.48 20.48 0 0 0 8.576-1.92 19.008 19.008 0 0 0 7.232-6.592l52.032-82.368a22.912 22.912 0 0 0 1.408-1.92c0.448-0.64 0.896-1.28 1.28-2.048l34.816 86.4a18.176 18.176 0 0 0 4.16 5.76c1.92 1.728 4.672 2.624 8.064 2.624h47.168l-56.512-128L587.52 473.6h-55.232a11.84 11.84 0 0 0-6.272 1.664 18.048 18.048 0 0 0-5.056 5.12l-41.28 67.2a59.392 59.392 0 0 0-3.84 6.272l-31.04-74.24a9.6 9.6 0 0 0-3.776-4.544c-1.408-0.96-3.84-1.472-7.232-1.472h-47.808l51.072 109.632-88.512 125.696h52.608z m357.824 240.384a25.6 25.6 0 0 0 36.224 0l147.072-147.2-36.16-36.16-103.424 103.488V610.56h-51.264v258.752l-103.36-103.36-36.288 36.224 147.2 147.136z',
+          'M560.384 115.392a16.064 16.064 0 0 1 13.056 4.608l257.216 257.216c1.92 1.92 3.136 4.288 3.84 6.784h0.832v118.72h-32V404.48H626.112c-44.16 0-80-35.84-80-80V147.2H230.208a48 48 0 0 0-48 48v672c0 26.56 21.504 48 48 48h341.504v32H230.208c-44.16 0-80-35.776-80-80V195.2c0-44.16 35.84-80 80-80h330.24v0.192z m232.768 495.296v281.984l119.872-119.872 22.592 22.656-147.072 147.2a16.064 16.064 0 0 1-22.656 0l-147.2-147.2 22.656-22.656 119.808 119.872V610.688h32zM427.648 476.352c2.496 0 4.224 0.448 5.312 1.216a8.96 8.96 0 0 1 3.072 3.84L474.24 565.12a48.256 48.256 0 0 1 1.792-3.2c0.64-1.152 1.344-2.24 2.112-3.392l53.952-76.736a13.76 13.76 0 0 1 3.648-4.032 9.152 9.152 0 0 1 4.864-1.28h37.76L498.432 583.04l59.712 125.824h-32.64a7.872 7.872 0 0 1-5.76-2.112 15.936 15.936 0 0 1-3.264-4.48l-43.52-97.088a42.112 42.112 0 0 1-3.2 5.376l-64.768 91.648a14.208 14.208 0 0 1-5.312 5.248 13.952 13.952 0 0 1-6.272 1.408h-36.352L448 584.768l-53.248-108.416h32.96zM578.112 324.48c0 26.496 21.504 48 48 48h154.56L578.176 169.92V324.48z',
         onclick: function () {
           let filename =
             'Revenue Spent Details ' +

+ 1 - 1
src/views/Dashboard/src/components/SellerChart.vue

@@ -165,7 +165,7 @@ const updateOption = () => {
       },
       feature: {
         saveAsImage: {
-          icon: 'path://M588.8 821.44H179.52a38.4 38.4 0 0 1-38.4-38.4v-105.088l202.432-115.584 112.96 64.576c7.872 4.48 17.6 4.48 25.472 0l400.768-228.8-0.32-0.512h0.64v-156.8a89.6 89.6 0 0 0-89.6-89.6H179.456a89.6 89.6 0 0 0-89.6 89.6v542.208a89.6 89.6 0 0 0 89.6 89.6H588.8v-51.2zM141.184 240.896a38.4 38.4 0 0 1 38.4-38.4h613.824a38.4 38.4 0 0 1 38.4 38.4v127.36L469.248 575.104 356.288 510.72a25.6 25.6 0 0 0-19.2-2.496l-6.144 2.56-189.76 108.288V240.896z m168.448 226.432c44.416 0 80.96-33.792 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376l-8.768-0.448c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832c4.096 40.32 36.16 72.448 76.544 76.544l8.832 0.448z m0-51.2a34.624 34.624 0 1 1 0-69.312 34.624 34.624 0 0 1 0 69.312z m445.888 449.024a25.6 25.6 0 0 0 36.224-0.064l138.368-138.368-36.224-36.224-94.592 94.656V545.536h-51.2v239.616l-94.72-94.656-36.224 36.224 138.368 138.432z',
+          icon: 'path://M588.8 830.976H179.52a48 48 0 0 1-48-48v-110.72l212.032-120.96 117.76 67.2a16 16 0 0 0 15.744 0.128l396.16-220.8-0.192-0.256h0.384v-156.8c0-44.16-35.84-80-80-80H179.52c-44.16 0-80 35.84-80 80v542.208c0 44.16 35.84 80 80 80H588.8v-32zM131.52 240.832a48 48 0 0 1 48-48h613.888a48 48 0 0 1 48 48V378.88L469.312 586.24l-117.76-67.2a16.128 16.128 0 0 0-12.032-1.664l-3.84 1.6-204.16 116.48V240.896zM309.632 467.2a85.76 85.76 0 0 0 85.376-76.992l0.384-8.768c0-44.416-33.728-80.96-76.992-85.376L309.76 295.68c-47.36 0-85.824 38.4-85.824 85.76l0.448 8.832A85.76 85.76 0 0 0 300.8 466.816l8.832 0.448z m0-32a53.76 53.76 0 1 1 0-107.584 53.76 53.76 0 0 1 0 107.52z m452.736 423.04a16 16 0 0 0 22.592 0l138.368-138.368-22.592-22.656-111.104 111.104V545.6h-32v262.784l-111.04-111.104-22.592 22.656 138.368 138.368z',
           show: true,
           name: props.saveImageName,
           type: 'png',

+ 0 - 9
src/views/Tracking/src/TrackingView.vue

@@ -227,7 +227,6 @@ const SearchInput = () => {
 
 import TrackingGuide from './components/TrackingGuide.vue'
 import { useGuideStore } from '@/stores/modules/guide'
-import { onBeforeRouteLeave } from 'vue-router'
 
 const guideStore = useGuideStore()
 const trackingGuideRef = ref()
@@ -252,14 +251,6 @@ const clearDaterangeTags = () => {
 const clearMoreFiltersTags = () => {
   getTrackingData()
 }
-
-onBeforeRouteLeave((route: any) => {
-  // guideStore.clearGuide()
-  const whiteList = ['Booking Detail', 'Tracking Detail', 'Add VGM']
-  if (!whiteList.includes(route?.name)) {
-    filtersStore.clearFilters()
-  }
-})
 </script>
 
 <template>

+ 1 - 1
vite.config.ts

@@ -58,7 +58,7 @@ export default defineConfig(({ mode }) => {
       // 设置 https 代理
       proxy: {
         '/api': {
-          target: 'http://192.168.14.224',
+          target: 'http://192.168.114.65',
           changeOrigin: true,
           rewrite: (path: string) => path.replace(/^\/api/, '')
         }

+ 1 - 1
vite.config.ts.timestamp-1772161604204-11dfcc4937af7.mjs

@@ -59,7 +59,7 @@ var vite_config_default = defineConfig(({ mode }) => {
       // 设置 https 代理
       proxy: {
         "/api": {
-          target: "http://192.168.14.224",
+          target: "http://192.168.114.65",
           changeOrigin: true,
           rewrite: (path) => path.replace(/^\/api/, "")
         }