| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 | 
							- // 根据角色动态生成路由
 
- import { MockMethod } from "vite-plugin-mock";
 
- // http://mockjs.com/examples.html#Object
 
- const systemRouter = {
 
-   path: "/system",
 
-   meta: {
 
-     icon: "setting",
 
-     title: "menus.hssysManagement",
 
-     rank: 11
 
-   },
 
-   children: [
 
-     {
 
-       path: "/system/user/index",
 
-       name: "User",
 
-       meta: {
 
-         icon: "flUser",
 
-         title: "menus.hsUser"
 
-       }
 
-     },
 
-     {
 
-       path: "/system/role/index",
 
-       name: "Role",
 
-       meta: {
 
-         icon: "role",
 
-         title: "menus.hsRole"
 
-       }
 
-     },
 
-     {
 
-       path: "/system/dept/index",
 
-       name: "Dept",
 
-       meta: {
 
-         icon: "dept",
 
-         title: "menus.hsDept"
 
-       }
 
-     },
 
-     {
 
-       path: "/system/dict",
 
-       component: "/system/dict/index",
 
-       name: "Dict",
 
-       meta: {
 
-         icon: "dict",
 
-         title: "menus.hsDict",
 
-         keepAlive: true
 
-       }
 
-     }
 
-   ]
 
- };
 
- const permissionRouter = {
 
-   path: "/permission",
 
-   meta: {
 
-     title: "menus.permission",
 
-     icon: "lollipop",
 
-     rank: 7
 
-   },
 
-   children: [
 
-     {
 
-       path: "/permission/page/index",
 
-       name: "PermissionPage",
 
-       meta: {
 
-         title: "menus.permissionPage"
 
-       }
 
-     },
 
-     {
 
-       path: "/permission/button/index",
 
-       name: "PermissionButton",
 
-       meta: {
 
-         title: "menus.permissionButton",
 
-         authority: []
 
-       }
 
-     }
 
-   ]
 
- };
 
- const frameRouter = {
 
-   path: "/iframe",
 
-   meta: {
 
-     icon: "monitor",
 
-     title: "menus.hsExternalPage",
 
-     rank: 10
 
-   },
 
-   children: [
 
-     {
 
-       path: "/iframe/pure",
 
-       name: "FramePure",
 
-       meta: {
 
-         title: "menus.hsPureDocument",
 
-         frameSrc: "http://yiming_chang.gitee.io/pure-admin-doc"
 
-       }
 
-     },
 
-     {
 
-       path: "/external",
 
-       name: "http://yiming_chang.gitee.io/pure-admin-doc",
 
-       meta: {
 
-         title: "menus.externalLink"
 
-       }
 
-     },
 
-     {
 
-       path: "/iframe/ep",
 
-       name: "FrameEp",
 
-       meta: {
 
-         title: "menus.hsEpDocument",
 
-         frameSrc: "https://element-plus.org/zh-CN/"
 
-       }
 
-     }
 
-   ]
 
- };
 
- const tabsRouter = {
 
-   path: "/tabs",
 
-   meta: {
 
-     icon: "IF-team-icontabs",
 
-     title: "menus.hstabs",
 
-     rank: 13
 
-   },
 
-   children: [
 
-     {
 
-       path: "/tabs/index",
 
-       name: "Tabs",
 
-       meta: {
 
-         title: "menus.hstabs"
 
-       }
 
-     },
 
-     {
 
-       path: "/tabs/query-detail",
 
-       name: "TabQueryDetail",
 
-       meta: {
 
-         // 不在menu菜单中显示
 
-         showLink: false
 
-       }
 
-     },
 
-     {
 
-       path: "/tabs/params-detail/:id",
 
-       component: "params-detail",
 
-       name: "TabParamsDetail",
 
-       meta: {
 
-         showLink: false
 
-       }
 
-     }
 
-   ]
 
- };
 
- // 添加不同按钮权限到/permission/button页面中
 
- function setDifAuthority(authority, routes) {
 
-   routes.children[1].meta.authority = [authority];
 
-   return routes;
 
- }
 
- export default [
 
-   {
 
-     url: "/getAsyncRoutes",
 
-     method: "get",
 
-     response: ({ query }) => {
 
-       if (query.name === "admin") {
 
-         return {
 
-           code: 0,
 
-           info: [
 
-             tabsRouter,
 
-             frameRouter,
 
-             systemRouter,
 
-             setDifAuthority("v-admin", permissionRouter)
 
-           ]
 
-         };
 
-       } else {
 
-         return {
 
-           code: 0,
 
-           info: [tabsRouter, setDifAuthority("v-test", permissionRouter)]
 
-         };
 
-       }
 
-     }
 
-   }
 
- ] as MockMethod[];
 
 
  |