Procházet zdrojové kódy

Merge remote-tracking branch 'origin/feature_电商平台' into feature_电商平台

licc před 1 měsícem
rodič
revize
ae6edaee87
3 změnil soubory, kde provedl 45 přidání a 9 odebrání
  1. 23 2
      src/permission.ts
  2. 5 4
      src/views/shop/info.vue
  3. 17 3
      src/views/workbench/index.vue

+ 23 - 2
src/permission.ts

@@ -10,23 +10,44 @@ import useUserStore from './stores/modules/user'
 import { INDEX_ROUTE, INDEX_ROUTE_NAME } from './router/routes'
 import { PageEnum } from './enums/pageEnum'
 import useTabsStore from './stores/modules/multipleTabs'
-import { clearAuthInfo } from './utils/auth'
+import { clearAuthInfo, getShopId } from './utils/auth'
 import config from './config'
 
 // NProgress配置
 NProgress.configure({ showSpinner: false })
 
+var shopId = getShopId();
 const loginPath = PageEnum.LOGIN
 const defaultPath = PageEnum.INDEX
 // 免登录白名单
 const whiteList: string[] = [PageEnum.LOGIN, PageEnum.ERROR_403]
+
+// 检测店铺ID变化并刷新页面的函数
+function checkShopIdChange() {
+    const currentShopId = getShopId();
+    if (shopId !== currentShopId && currentShopId && shopId) {
+        console.log('检测到店铺ID变化:', shopId, '->', currentShopId);
+        shopId = currentShopId;
+        // 刷新页面以更新数据
+        window.location.reload();
+        return true;
+    }
+    return false;
+}
+
 router.beforeEach(async (to, from, next) => {
     // 开始 Progress Bar
     NProgress.start()
+    
+    // 检测店铺ID变化
+    if (checkShopIdChange()) {
+        return; // 如果检测到变化并刷新页面,直接返回
+    }
+    
     document.title = to.meta.title ?? config.title
     const userStore = useUserStore()
     const tabsStore = useTabsStore()
-    console.warn("***userStore***",userStore.token,to.path)
+    console.warn("***userStore***",shopId,userStore.token,to.path)
     if (whiteList.includes(to.path)) {
         // 在免登录白名单,直接进入
         next()

+ 5 - 4
src/views/shop/info.vue

@@ -142,7 +142,8 @@ const formData = reactive({
   idCardFront: '',
   idCardBack: '',
   businessLicense: '',
-  operatingLicense: ''
+  operatingLicense: '',
+  userRelationId: null,
 })
 
 // 获取店铺信息
@@ -164,15 +165,15 @@ const getData = async () => {
     //@ts-ignore
     formData[key] = data[key]
   }
+  formData.userRelationId = data?data['shopUserRelationId']:''
   if (formData.banner) {
     formData.banner = formData.banner.split(',')
+  } else {
+    formData.banner = '';
   }
   if (!formData.image) {//不能是null,会报错
     formData.image = '';
   }
-  if (!formData.banner) {//不能是null,会报错
-    formData.banner = '';
-  }
   if (!formData.idCardFront) {//不能是null,会报错
     formData.idCardFront = '';
   }

+ 17 - 3
src/views/workbench/index.vue

@@ -318,7 +318,9 @@ const workbenchData: any = reactive({
                             rankNo = 'no3'
                             break
                     }
-                    return `{${rankNo}|${index + 1}} {labelName|${value}}`
+                    // 限制显示字数为5个字符,超过用省略号
+                    const displayName = value.length > 5 ? value.substring(0, 5) + '...' : value
+                    return `{${rankNo}|${index + 1}} {labelName|${displayName}}`
                 },
                 align: 'left',
                 rich: {
@@ -352,6 +354,18 @@ const workbenchData: any = reactive({
                 }
             }
         },
+        tooltip: {
+            trigger: 'axis',
+            formatter: (params: any) => {
+                if (params && params.length > 0) {
+                    const dataIndex = params[0].dataIndex
+                    const originalName = workbenchData.listOption.yAxis.data[dataIndex]
+                    const value = params[0].value
+                    return `${originalName}: ${value}次`
+                }
+                return ''
+            }
+        },
         series: [
             {
                 // data: [33, 26, 25, 15, 12, 9, 9],
@@ -443,6 +457,8 @@ const shopInfo = () => {
       if(res.image){
         config.value.webLogo = res.image
       }
+      getData()
+      dishTop10()
     })
 }
 const changeStatus = () => {
@@ -466,8 +482,6 @@ const dishTop10 = () => {
     })
 }
 shopInfo()
-getData()
-dishTop10()
 </script>
 
 <style lang="scss" scoped></style>