|
@@ -1,20 +1,16 @@
|
|
|
-import { HOME, LOGIN, REGISTER, STUDENT, TEACHER } from "@/router/name";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ HOME,
|
|
|
|
|
+ LOGIN,
|
|
|
|
|
+ REGISTER,
|
|
|
|
|
+ STUDENT,
|
|
|
|
|
+ STUDENT_COURSE,
|
|
|
|
|
+ TEACHER,
|
|
|
|
|
+ TEACHER_COURSE
|
|
|
|
|
+} from "@/router/name";
|
|
|
import { judgeLogin } from "@/util/auth";
|
|
import { judgeLogin } from "@/util/auth";
|
|
|
import { getUserProfile } from "@/util/profileStorage";
|
|
import { getUserProfile } from "@/util/profileStorage";
|
|
|
|
|
|
|
|
export default [
|
|
export default [
|
|
|
- {
|
|
|
|
|
- path: "/",
|
|
|
|
|
- name: HOME,
|
|
|
|
|
- redirect: () => {
|
|
|
|
|
- if (judgeLogin()) {
|
|
|
|
|
- const { role } = getUserProfile();
|
|
|
|
|
- return { name: role };
|
|
|
|
|
- } else {
|
|
|
|
|
- return { name: LOGIN };
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
path: "/login",
|
|
path: "/login",
|
|
|
component: () => import("@/layouts/LoginLayout"),
|
|
component: () => import("@/layouts/LoginLayout"),
|
|
@@ -45,26 +41,42 @@ export default [
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- path: "/teacher-course",
|
|
|
|
|
- component: () => import("@/layouts/HomeLayout"),
|
|
|
|
|
|
|
+ path: "/course-teacher/:courseId",
|
|
|
|
|
+ component: () => import("@/layouts/courseLayouts/StudentCourseLayout.vue"),
|
|
|
meta: { requiresAuth: true },
|
|
meta: { requiresAuth: true },
|
|
|
children: [
|
|
children: [
|
|
|
{
|
|
{
|
|
|
- name: TEACHER,
|
|
|
|
|
|
|
+ name: TEACHER_COURSE,
|
|
|
path: "",
|
|
path: "",
|
|
|
- component: () => import("@/views/teacher/Home")
|
|
|
|
|
|
|
+ component: () => import("@/views/teacher/Dashboard")
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- path: "/student-course",
|
|
|
|
|
- component: () => import("@/layouts/HomeLayout"),
|
|
|
|
|
|
|
+ path: "/course-student/:courseId",
|
|
|
|
|
+ component: () => import("@/layouts/courseLayouts/StudentCourseLayout.vue"),
|
|
|
meta: { requiresAuth: true },
|
|
meta: { requiresAuth: true },
|
|
|
children: [
|
|
children: [
|
|
|
{
|
|
{
|
|
|
- name: TEACHER,
|
|
|
|
|
- path: "",
|
|
|
|
|
- component: () => import("@/views/teacher/Home")
|
|
|
|
|
|
|
+ name: STUDENT_COURSE,
|
|
|
|
|
+ path: "dashboard",
|
|
|
|
|
+ component: () => import("@/views/student/Dashboard")
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "code",
|
|
|
|
|
+ component: () => import("@/views/student/Code")
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "document",
|
|
|
|
|
+ component: () => import("@/views/student/Document")
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "review",
|
|
|
|
|
+ component: () => import("@/views/student/Review")
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "code",
|
|
|
|
|
+ component: () => import("@/views/student/Code")
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
@@ -79,5 +91,17 @@ export default [
|
|
|
component: () => import("@/views/student/Home")
|
|
component: () => import("@/views/student/Home")
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ path: "/",
|
|
|
|
|
+ name: HOME,
|
|
|
|
|
+ redirect: () => {
|
|
|
|
|
+ if (judgeLogin()) {
|
|
|
|
|
+ const { role } = getUserProfile();
|
|
|
|
|
+ return { name: role };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return { name: LOGIN };
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
];
|
|
];
|