|
@@ -36,11 +36,11 @@ const { t } = useI18n()
|
|
|
canTo: true 设置为true即使hidden为true,也依然可以进行路由跳转(默认 false)
|
|
|
}
|
|
|
**/
|
|
|
- async function getUserType() {
|
|
|
- const userType = await LoginApi.getInfo(); // 假设你有 LoginApi.getInfo() 方法获取用户信息
|
|
|
- console.log(userType,'getUserType');
|
|
|
- return userType.roles; // 假设返回的角色是一个数组
|
|
|
-}
|
|
|
+// async function getUserType() {
|
|
|
+// const userType = await LoginApi.getInfo(); // 假设你有 LoginApi.getInfo() 方法获取用户信息
|
|
|
+// console.log(userType,'getUserType');
|
|
|
+// return userType.roles; // 假设返回的角色是一个数组
|
|
|
+// }
|
|
|
const remainingRouter: AppRouteRecordRaw[] = [
|
|
|
{
|
|
|
path: '/system',
|
|
@@ -124,7 +124,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|
|
}
|
|
|
},
|
|
|
// {
|
|
|
- // path: '/Home',
|
|
|
+ // path: '/system/Home',
|
|
|
// component: Layout,
|
|
|
// name: 'SystemHome',
|
|
|
// meta: {
|
|
@@ -139,7 +139,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|
|
// children: [
|
|
|
// {
|
|
|
// path: 'index',
|
|
|
- // component: () => import('@/views/Home/Index.vue'),
|
|
|
+ // component: () => import('@/views/system/Home/Index.vue'),
|
|
|
// name: 'Index',
|
|
|
// meta: {
|
|
|
// title: t('router.home'),
|
|
@@ -718,17 +718,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|
|
}
|
|
|
];
|
|
|
|
|
|
-(async () => {
|
|
|
- const userRoles = await getUserType();
|
|
|
+// (async () => {
|
|
|
+// const userRoles = await getUserType();
|
|
|
|
|
|
- // 判断用户是否具有 "student" 角色
|
|
|
- if (userRoles.includes("student")) {
|
|
|
- // 如果用户不属于 "student",则从路由中移除 /system/Home 路由
|
|
|
- const systemHomeIndex = remainingRouter.findIndex(route => route.path === '/system/Home');
|
|
|
- if (systemHomeIndex !== -1) {
|
|
|
- remainingRouter.splice(systemHomeIndex, 1); // 移除该路由
|
|
|
- }
|
|
|
- }
|
|
|
-})();
|
|
|
+// // 判断用户是否具有 "student" 角色
|
|
|
+// if (userRoles.includes("student")) {
|
|
|
+// // 如果用户不属于 "student",则从路由中移除 /system/Home 路由
|
|
|
+// const systemHomeIndex = remainingRouter.findIndex(route => route.path === '/system/Home');
|
|
|
+// if (systemHomeIndex !== -1) {
|
|
|
+// remainingRouter.splice(systemHomeIndex, 1); // 移除该路由
|
|
|
+// }
|
|
|
+// }
|
|
|
+// })();
|
|
|
|
|
|
export default remainingRouter;
|