瀏覽代碼

改了一点点

yzx 6 月之前
父節點
當前提交
5690379135
共有 2 個文件被更改,包括 45 次插入28 次删除
  1. 33 19
      src/router/modules/remaining.ts
  2. 12 9
      src/views/Login/components/LoginForm.vue

+ 33 - 19
src/router/modules/remaining.ts

@@ -111,30 +111,23 @@ const remainingRouter: AppRouteRecordRaw[] = [
       noTagsView: true
     }
   },
-  // {
-  //   path: '/system/Home/index',
-  //   component: Layout,
-  //   name: 'SystemHome',
-  //   meta: {
-  //     title: '工作台',
-  //     icon: 'ep:bell',
-  //     noCache: false,
-  //     affix: false,
-  //     breadcrumb: true,
-  //     noTagsView: true,
-  //     hidden: false
-  //   }
-  // },
   {
-    path: '/',
+    path: '/system/Home',
     component: Layout,
-    redirect: '/index',
-    name: 'Home',
-    meta: {},
+    name: 'SystemHome',
+    meta: {
+      title: '工作台',
+      icon: 'ep:bell',
+      noCache: false,
+      affix: false,
+      breadcrumb: true,
+      noTagsView: true,
+      hidden: false
+    },
     children: [
       {
         path: 'index',
-        component: () => import('@/views/Home/Index.vue'),
+        component: () => import('@/views/system/Home/Index.vue'),
         name: 'Index',
         meta: {
           title: t('router.home'),
@@ -145,6 +138,27 @@ const remainingRouter: AppRouteRecordRaw[] = [
       }
     ]
   },
+  // {
+  //   path: '/',
+  //   component: Layout,
+  //   redirect: '/index',
+  //   name: 'Home',
+  //   meta: {},
+  //   children: [
+  //     {
+  //       path: 'index',
+  //       component: () => import('@/views/Home/Index.vue'),
+  //       name: 'Index',
+  //       meta: {
+  //         title: t('router.home'),
+  //         icon: 'ep:home-filled',
+  //         noCache: false,
+  //         affix: true
+  //       }
+  //     }
+  //   ]
+  // },
+
   {
     path: '/user',
     component: Layout,

+ 12 - 9
src/views/Login/components/LoginForm.vue

@@ -268,15 +268,18 @@ const handleLogin = async (params) => {
       authUtil.removeLoginForm()
     }
     authUtil.setToken(res)
-    
-    if (!redirect.value) {
-      redirect.value = '/'
-    } 
-    // 判断是否为SSO登录
-    if (redirect.value.indexOf('sso') !== -1) {
-      window.location.href = window.location.href.replace('/login?redirect=', '')
-    } else {
-      push({ path: redirect.value || permissionStore.addRouters[0].path })
+    const userType = await LoginApi.getInfo()
+    console.log(userType,"我在这里")
+    if(userType.roles.indexOf("student") !== -1){
+        console.log("我是学生")
+        window.location.href = '/system/studentSelf/index'
+    }else{
+        console.log("我不是学生")
+        if (!redirect.value) {
+          redirect.value = '/'
+        }
+       window.location.href = '/system/Home/index'
+        // push({ path: redirect.value || permissionStore.addRouters[0].path })
     }
   } finally {
     loginLoading.value = false