From e8db9d37e2ef39e75bb49288e9e2c091df6b01d2 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 29 八月 2025 17:48:02 +0800
Subject: [PATCH] 微信扫码看设备详情

---
 src/router/index.js |  203 +++++++++++++++++++++++++++++---------------------
 1 files changed, 118 insertions(+), 85 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index 5fb13c0..340409e 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,5 +1,6 @@
-import { createWebHistory, createRouter } from 'vue-router'
-import Layout from '@/layout'
+import { createWebHistory, createRouter } from "vue-router";
+/* Layout */
+import Layout from "@/layout";
 
 /**
  * Note: 璺敱閰嶇疆椤�
@@ -12,6 +13,8 @@
  * redirect: noRedirect             // 褰撹缃� noRedirect 鐨勬椂鍊欒璺敱鍦ㄩ潰鍖呭睉瀵艰埅涓笉鍙鐐瑰嚮
  * name:'router-name'               // 璁惧畾璺敱鐨勫悕瀛楋紝涓�瀹氳濉啓涓嶇劧浣跨敤<keep-alive>鏃朵細鍑虹幇鍚勭闂
  * query: '{"id": 1, "name": "ry"}' // 璁块棶璺敱鐨勯粯璁や紶閫掑弬鏁�
+ * roles: ['admin', 'common']       // 璁块棶璺敱鐨勮鑹叉潈闄�
+ * permissions: ['a:a:a', 'b:b:b']  // 璁块棶璺敱鐨勮彍鍗曟潈闄�
  * meta : {
     noCache: true                   // 濡傛灉璁剧疆涓簍rue锛屽垯涓嶄細琚� <keep-alive> 缂撳瓨(榛樿 false)
     title: 'title'                  // 璁剧疆璇ヨ矾鐢卞湪渚ц竟鏍忓拰闈㈠寘灞戜腑灞曠ず鐨勫悕瀛�
@@ -24,128 +27,159 @@
 // 鍏叡璺敱
 export const constantRoutes = [
   {
-    path: '/redirect',
+    path: "/redirect",
     component: Layout,
     hidden: true,
     children: [
       {
-        path: '/redirect/:path(.*)',
-        component: () => import('@/views/redirect/index.vue')
-      }
-    ]
+        path: "/redirect/:path(.*)",
+        component: () => import("@/views/redirect/index.vue"),
+      },
+    ],
   },
   {
-    path: '/login',
-    component: () => import('@/views/login'),
-    hidden: true
+    path: "/login",
+    component: () => import("@/views/login"),
+    hidden: true,
   },
   {
-    path: '/register',
-    component: () => import('@/views/register'),
-    hidden: true
+    path: "/register",
+    component: () => import("@/views/register"),
+    hidden: true,
   },
   {
     path: "/:pathMatch(.*)*",
-    component: () => import('@/views/error/404'),
-    hidden: true
-  },
-  {
-    path: '/401',
-    component: () => import('@/views/error/401'),
-    hidden: true
-  },
-  {
-    path: '',
-    component: Layout,
-    redirect: '/index',
-    children: [
-      {
-        path: '/index',
-        component: () => import('@/views/index'),
-        name: 'Index',
-        meta: { title: '棣栭〉', icon: 'dashboard', affix: true }
-      }
-    ]
-  },
-  {
-    path: '/user',
-    component: Layout,
+    component: () => import("@/views/error/404"),
     hidden: true,
-    redirect: 'noredirect',
-    children: [
-      {
-        path: 'profile',
-        component: () => import('@/views/system/user/profile/index'),
-        name: 'Profile',
-        meta: { title: '涓汉涓績', icon: 'user' }
-      }
-    ]
   },
   {
-    path: '/system/user-auth',
+    path: "/401",
+    component: () => import("@/views/error/401"),
+    hidden: true,
+  },
+
+  {
+    path: "",
     component: Layout,
+    redirect: "/index",
+    children: [
+      {
+        path: "/index",
+        component: () => import("@/views/index"),
+        name: "Index",
+        meta: { title: "棣栭〉", icon: "dashboard", affix: true },
+      },
+    ],
+  },
+  {
+    path: "/main/MobileChat",
+    component: Layout,
+    redirect: "",
     hidden: true,
     children: [
       {
-        path: 'role/:userId(\\d+)',
-        component: () => import('@/views/system/user/authRole'),
-        name: 'AuthRole',
-        meta: { title: '鍒嗛厤瑙掕壊', activeMenu: '/system/user' }
-      }
-    ]
+        path: "",
+        component: () => import("@/views/chatHome/chatHomeIndex/MobileChat"),
+        name: "MobileChat",
+        meta: { title: "AI瀵硅瘽", icon: "dashboard", affix: true },
+      },
+    ],
   },
   {
-    path: '/system/role-auth',
+    path: "/user",
     component: Layout,
     hidden: true,
+    redirect: "noredirect",
     children: [
       {
-        path: 'user/:roleId(\\d+)',
-        component: () => import('@/views/system/role/authUser'),
-        name: 'AuthUser',
-        meta: { title: '鍒嗛厤鐢ㄦ埛', activeMenu: '/system/role' }
-      }
-    ]
+        path: "profile",
+        component: () => import("@/views/system/user/profile/index"),
+        name: "Profile",
+        meta: { title: "涓汉涓績", icon: "user" },
+      },
+    ],
   },
   {
-    path: '/system/dict-data',
+    path: "/device-info",
+    component: () => import("@/views/equipmentManagement/deviceInfo/index.vue"),
+    hidden: true,
+    name: "DeviceInfo",
+    meta: { title: "璁惧淇℃伅", icon: "monitor" },
+  },
+];
+
+// 鍔ㄦ�佽矾鐢憋紝鍩轰簬鐢ㄦ埛鏉冮檺鍔ㄦ�佸幓鍔犺浇
+export const dynamicRoutes = [
+  {
+    path: "/system/user-auth",
     component: Layout,
     hidden: true,
+    permissions: ["system:user:edit"],
     children: [
       {
-        path: 'index/:dictId(\\d+)',
-        component: () => import('@/views/system/dict/data'),
-        name: 'Data',
-        meta: { title: '瀛楀吀鏁版嵁', activeMenu: '/system/dict' }
-      }
-    ]
+        path: "role/:userId(\\d+)",
+        component: () => import("@/views/system/user/authRole"),
+        name: "AuthRole",
+        meta: { title: "鍒嗛厤瑙掕壊", activeMenu: "/system/user" },
+      },
+    ],
   },
   {
-    path: '/monitor/job-log',
+    path: "/system/role-auth",
     component: Layout,
     hidden: true,
+    permissions: ["system:role:edit"],
     children: [
       {
-        path: 'index',
-        component: () => import('@/views/monitor/job/log'),
-        name: 'JobLog',
-        meta: { title: '璋冨害鏃ュ織', activeMenu: '/monitor/job' }
-      }
-    ]
+        path: "user/:roleId(\\d+)",
+        component: () => import("@/views/system/role/authUser"),
+        name: "AuthUser",
+        meta: { title: "鍒嗛厤鐢ㄦ埛", activeMenu: "/system/role" },
+      },
+    ],
   },
   {
-    path: '/tool/gen-edit',
+    path: "/system/dict-data",
     component: Layout,
     hidden: true,
+    permissions: ["system:dict:list"],
     children: [
       {
-        path: 'index/:tableId(\\d+)',
-        component: () => import('@/views/tool/gen/editTable'),
-        name: 'GenEdit',
-        meta: { title: '淇敼鐢熸垚閰嶇疆', activeMenu: '/tool/gen' }
-      }
-    ]
-  }
+        path: "index/:dictId(\\d+)",
+        component: () => import("@/views/system/dict/data"),
+        name: "Data",
+        meta: { title: "瀛楀吀鏁版嵁", activeMenu: "/system/dict" },
+      },
+    ],
+  },
+  {
+    path: "/monitor/job-log",
+    component: Layout,
+    hidden: true,
+    permissions: ["monitor:job:list"],
+    children: [
+      {
+        path: "index/:jobId(\\d+)",
+        component: () => import("@/views/monitor/job/log"),
+        name: "JobLog",
+        meta: { title: "璋冨害鏃ュ織", activeMenu: "/monitor/job" },
+      },
+    ],
+  },
+  {
+    path: "/tool/gen-edit",
+    component: Layout,
+    hidden: true,
+    permissions: ["tool:gen:edit"],
+    children: [
+      {
+        path: "index/:tableId(\\d+)",
+        component: () => import("@/views/tool/gen/editTable"),
+        name: "GenEdit",
+        meta: { title: "淇敼鐢熸垚閰嶇疆", activeMenu: "/tool/gen" },
+      },
+    ],
+  },
 ];
 
 const router = createRouter({
@@ -153,10 +187,9 @@
   routes: constantRoutes,
   scrollBehavior(to, from, savedPosition) {
     if (savedPosition) {
-      return savedPosition
-    } else {
-      return { top: 0 }
+      return savedPosition;
     }
+    return { top: 0 };
   },
 });
 

--
Gitblit v1.9.3