Bladeren bron

添加图标

@dongkboy 1 jaar geleden
bovenliggende
commit
b2bfa17827

+ 5 - 1
src/api/modules/tenant.ts

@@ -27,7 +27,11 @@ const tenantApi = (axiosInstance: ApiInstance) => ({
   //修改租户权限
   updatePerms: (data: any) => axiosInstance.post('system/updatePerms', data),
   //获取租户平台菜单数据
-  getSystemConfig: () => axiosInstance.get('system/getSystemConfig'),
+  getSystemConfig: (params:any) => axiosInstance.get('system/getInitConfig',{params}),
+  // 获取租户菜单权限
+  getTenantConfig: (params:any) => axiosInstance.get('system/getInitConfig',{params}),
+  //租户手机号校验
+  userGetPhone: (params:any) => axiosInstance.get(`system/userGet?mobile=${params}`)
 })
 
 export default tenantApi

+ 5 - 0
src/assets/icons/user.svg

@@ -0,0 +1,5 @@
+<svg width="16" height="18" viewBox="0 0 16 18" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
+<g id="ICON/sys/icon_sys_section">
+<path id="Vector" d="M14.1343 11.4272H13.2009V9.00036C13.2009 8.69138 12.9498 8.44031 12.6409 8.44031H8.72055V6.5735H9.65394C9.96294 6.5735 10.214 6.32244 10.214 6.01345V3.39989C10.214 3.09091 9.96294 2.83984 9.65394 2.83984H7.04041C6.73141 2.83984 6.48036 3.09091 6.48036 3.39989V6.01344C6.48036 6.32242 6.73141 6.57348 7.04041 6.57348H7.97381V8.4403H4.0535C3.7445 8.4403 3.49345 8.69136 3.49345 9.00034V11.4272H2.56003C2.25105 11.4272 2 11.6783 2 11.9873V14.6008C2 14.9098 2.25105 15.1609 2.56003 15.1609H5.17358C5.48258 15.1609 5.73362 14.9098 5.73362 14.6008V11.9873C5.73362 11.6783 5.48258 11.4272 5.17358 11.4272H4.24017V9.18705H7.97381V11.4272H7.04041C6.73141 11.4272 6.48036 11.6783 6.48036 11.9873V14.6008C6.48036 14.9098 6.73141 15.1609 7.04041 15.1609H9.65394C9.96294 15.1609 10.214 14.9098 10.214 14.6008V11.9873C10.214 11.6783 9.96294 11.4272 9.65394 11.4272H8.72053V9.18705H12.4542V11.4272H11.5208C11.2118 11.4272 10.9607 11.6783 10.9607 11.9873V14.6008C10.9607 14.9098 11.2118 15.1609 11.5208 15.1609H14.1343C14.4433 15.1609 14.6943 14.9098 14.6943 14.6008V11.9873C14.6943 11.6783 14.4433 11.4272 14.1343 11.4272V11.4272ZM7.22708 3.58658H9.46727V5.82677H7.22708V3.58661V3.58658ZM4.98691 12.1739V14.4141H2.7467V12.174H4.98689L4.98691 12.1739ZM9.46727 14.4141H7.22708V12.174H9.46727V14.4141ZM13.9476 14.4141H11.7074V12.174H13.9476L13.9476 14.4141Z" fill="currentColor"/>
+</g>
+</svg>

+ 6 - 0
src/assets/icons/zh.svg

@@ -0,0 +1,6 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
+<g id="Frame">
+<path id="Vector" d="M12.4106 9.9659C12.4458 9.92688 12.4729 9.88131 12.4904 9.83181C12.508 9.7823 12.5156 9.72982 12.5128 9.67737C12.5101 9.62492 12.497 9.57353 12.4744 9.52612C12.4518 9.47872 12.4201 9.43624 12.381 9.4011C11.6882 8.77671 10.8663 8.31264 9.97381 8.0419C10.9898 7.4171 11.6682 6.2955 11.6682 5.0179C11.6682 3.0619 10.077 1.4707 8.12101 1.4707C6.16501 1.4707 4.57461 3.0619 4.57461 5.0179C4.57461 6.2947 5.25301 7.4163 6.26901 8.0411C3.66101 8.8363 1.75781 11.2643 1.75781 14.1291C1.75781 14.3499 1.93701 14.5291 2.15781 14.5291C2.37861 14.5291 2.55781 14.3499 2.55781 14.1291C2.55781 11.0611 5.05381 8.5651 8.12181 8.5651C9.50021 8.5651 10.8226 9.0731 11.8458 9.9947C11.8848 10.0299 11.9303 10.0571 11.9798 10.0747C12.0293 10.0923 12.0817 10.1 12.1342 10.0973C12.1866 10.0946 12.238 10.0816 12.2855 10.0591C12.3329 10.0366 12.3754 10.0049 12.4106 9.9659ZM5.37461 5.0179C5.37461 3.5027 6.60741 2.2707 8.12181 2.2707C9.63621 2.2707 10.869 3.5027 10.869 5.0179C10.869 6.5331 9.63621 7.7651 8.12181 7.7651C6.60741 7.7651 5.37461 6.5331 5.37461 5.0179Z" fill="currentColor" stroke="currentColor" stroke-width="0.2"/>
+<path id="Vector_2" d="M9.29688 11.3219C9.29688 11.5427 9.47608 11.7219 9.69688 11.7219H13.8433C14.0641 11.7219 14.2433 11.5427 14.2433 11.3219C14.2433 11.1011 14.0641 10.9219 13.8433 10.9219H9.69688C9.47528 10.9219 9.29688 11.1011 9.29688 11.3219ZM13.8425 13.3939H9.69688C9.47608 13.3939 9.29688 13.5731 9.29688 13.7939C9.29688 14.0147 9.47608 14.1939 9.69688 14.1939H13.8433C14.0641 14.1939 14.2433 14.0147 14.2433 13.7939C14.2433 13.5731 14.0641 13.3939 13.8425 13.3939Z" fill="currentColor" stroke="currentColor" stroke-width="0.2"/>
+</g>
+</svg>

+ 1 - 2
src/router/modules/organization.ts

@@ -1,7 +1,6 @@
 import type { RouteRecordRaw } from 'vue-router'
 
 const Layout = () => import('@/layouts/index.vue')
-
 const routes: RouteRecordRaw = {
   path: '/organizationManagement/organization',
   component: Layout,
@@ -9,7 +8,7 @@ const routes: RouteRecordRaw = {
   name: 'OrganizationManagementorganization',
   meta: {
     title: '租户管理',
-
+    icon:'zh',
   },
   children: [
     {

+ 1 - 0
src/router/modules/personnel.ts

@@ -9,6 +9,7 @@ const routes: RouteRecordRaw = {
   name: 'Personnel',
   meta: {
     title: '成员管理',
+    icon:'user'
   },
   children: [
     {

+ 1 - 0
src/store/modules/user.ts

@@ -44,6 +44,7 @@ const useUserStore = defineStore(
       userName.value = data.userName
       token.value = res.data
       if(token.value){
+        getPermissions();
         getUserInfo();
       }
     }

+ 54 - 9
src/utils/composables/routeUtils.ts

@@ -13,7 +13,7 @@ export interface RouteItem {
     title?: string;
     icon?: string;
     auth?: string[];
-    menu?:boolean;
+    menu?: boolean;
   };
   children?: RouteItem[];
 }
@@ -22,7 +22,7 @@ export interface TreeNode {
   id: number;
   title: string;
   icon?: string;
-  type?:string,
+  type?: string,
   children?: TreeNode[];
   [key: string]: any; // 允许任意其他属性
 }
@@ -33,6 +33,51 @@ let idCounter = ref(0);
 const generateId = (): number => {
   return ++idCounter.value;
 };
+// function extractImportPath(func: any) {
+//   if (!func) {
+//     console.log("No function provided");
+//     return null;
+//   }
+
+//   if (typeof func !== "function") {
+//     console.error("Provided value is not a function");
+//     return null;
+//   }
+//   // 将函数转换为字符串
+//   const funcStr = func.toString();
+
+//   // 如果字符串中包含 "layouts",返回 "layout"
+//   if (funcStr.includes("layouts")) {
+//     return "layout";
+//   }
+
+//   // 检查 import() 的结构是否存在
+//   const startIndex = funcStr.indexOf('import("') + 8;
+//   const endIndex = funcStr.indexOf('")', startIndex);
+
+//   if (startIndex > 7 && endIndex > startIndex) {
+//     let path = funcStr.substring(startIndex, endIndex);
+
+//     // 如果路径中存在时间戳(例如 ?t=xxx),将其去掉
+//     if (path.includes("?")) {
+//       path = path.split("?")[0];
+//     }
+
+//     // 如果路径中存在 .vue 后缀,将其移除
+//     if (path.endsWith(".vue")) {
+//       path = path.slice(0, -4);
+//     }
+
+//     // 去掉路径中的 /src/views 前缀
+//     const prefixToRemove = "/src/views";
+//     if (path.startsWith(prefixToRemove)) {
+//       path = path.slice(prefixToRemove.length);
+//     }
+
+//     return path;
+//   }
+//   return null;
+// }
 
 // 预处理函数:确保 children 和 auth 类型正确
 export const preprocessRoutes = (routes: any[]): RouteItem[] => {
@@ -46,8 +91,8 @@ export const preprocessRoutes = (routes: any[]): RouteItem[] => {
         auth: Array.isArray(route.meta?.auth)
           ? route.meta.auth
           : route.meta?.auth
-          ? [route.meta.auth]
-          : [],
+            ? [route.meta.auth]
+            : [],
       },
       // 确保 children 存在且是数组
       children: route.children ? preprocessRoutes(route.children) : [],
@@ -74,20 +119,20 @@ const parseAuthToChildren = (authList: string[]): TreeNode[] => {
 };
 
 // 将 RouteItem 转换为 TreeNode
-export const convertToTreeData = (id:number,routes: RouteItem[]): TreeNode[] => {
-  idCounter.value=id;
+export const convertToTreeData = (id: number, routes: RouteItem[]): TreeNode[] => {
+  idCounter.value = id;
   return routes.filter(route => route.meta?.menu !== false).map(route => {
     const node: TreeNode = {
       id: generateId(),
       title: route.meta?.title || route.name || '',
       icon: route.meta?.icon,
-      type:route.path?"1":'0',
+      type: route.path ? "1" : '0',
+
     };
 
     if (route.children && route.children.length > 0) {
-      node.children = convertToTreeData(idCounter.value,route.children);
+      node.children = convertToTreeData(idCounter.value, route.children);
     }
-
     if (route.meta?.auth) {
       const authNodes = parseAuthToChildren(route.meta.auth);
       node.children = node.children ? node.children.concat(authNodes) : authNodes;