| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- import {
- HOME,
- LOGIN,
- REGISTER,
- STUDENT,
- STUDENT_COURSE,
- TEACHER,
- TEACHER_COURSE
- } from "@/router/name";
- import { judgeLogin } from "@/util/auth";
- import { getUserProfile } from "@/util/profileStorage";
- export default [
- {
- path: "/login",
- component: () => import("@/layouts/LoginLayout"),
- meta: { requiresAuth: false },
- children: [
- {
- name: REGISTER,
- path: "/register",
- component: () => import("@/views/login/Register.vue")
- },
- {
- name: LOGIN,
- path: "",
- component: () => import("@/views/login/Login.vue")
- }
- ]
- },
- {
- path: "/teacher",
- component: () => import("@/layouts/HomeLayout"),
- meta: { requiresAuth: false },
- children: [
- {
- name: TEACHER,
- path: "",
- component: () => import("@/views/teacher/Home")
- },
- {
- path: "setting",
- component: () => import("@/layouts/SettingLayout"),
- children: [
- {
- path: "profile",
- component: () => import("@/views/setting/Profile")
- },
- {
- path: "password",
- component: () => import("@/views/setting/Password")
- }
- ]
- }
- ]
- },
- {
- path: "/course-teacher/:courseId",
- component: () => import("@/layouts/courseLayouts/TeacherCourseLayout.vue"),
- meta: { requiresAuth: false },
- children: [
- {
- name: TEACHER_COURSE,
- path: "dashboard",
- component: () => import("@/views/teacher/Dashboard")
- },
- {
- path: "question",
- component: () => import("@/views/teacher/Question")
- },
- {
- path: "question/:id",
- component: () => import("@/views/teacher/Question/questionDetail.vue")
- },
- {
- path: "result",
- component: () => import("@/views/teacher/Result")
- },
- {
- path: "code",
- component: () => import("@/views/teacher/Code/index")
- },
- {
- path: "code/:codeId",
- component: () => import("@/views/teacher/Code/detail")
- },
- {
- path: "code/:codeId/test",
- component: () => import("@/views/teacher/Code/test")
- },
- {
- path: "document",
- component: () => import("@/views/teacher/Document/index")
- },
- {
- path: "document/:documentId",
- component: () => import("@/views/teacher/Document/detail")
- },
- {
- path: "document/:documentId/content",
- component: () => import("@/views/teacher/Document/docContent")
- },
- {
- path: "review",
- component: () => import("@/views/teacher/Review")
- },
- {
- path: "review/:reviewId",
- component: () => import("@/views/teacher/Review/ReviewDetail"),
- children: [
- {
- path: "",
- component: () =>
- import("@/views/teacher/Review/ReviewDetail/Detail")
- },
- {
- path: "groups",
- component: () =>
- import("@/views/teacher/Review/ReviewDetail/Groups")
- }
- ]
- },
- {
- path: "review/:reviewId/groups/:groupId",
- component: () =>
- import("@/views/teacher/Review/ReviewDetail/GroupDocDetail")
- },
- {
- path: "review/:reviewId/groups/:groupId/argue",
- component: () =>
- import("@/views/teacher/Review/ReviewDetail/GroupArgueDetail")
- }
- ]
- },
- {
- path: "/course-student/:courseId",
- component: () => import("@/layouts/courseLayouts/StudentCourseLayout.vue"),
- meta: { requiresAuth: false },
- children: [
- {
- name: STUDENT_COURSE,
- path: "dashboard",
- component: () => import("@/views/student/Dashboard")
- },
- {
- path: "code",
- component: () => import("@/views/student/Code/index")
- },
- {
- path: "code/:homeworkId",
- component: () => import("@/views/student/Code/ProjectList/index")
- },
- {
- path: "code/:homeworkId/:projectId",
- component: () => import("@/views/student/Code/ProjectDetail/index"),
- children: [
- {
- path: "",
- component: () =>
- import("@/views/student/Code/ProjectDetail/BuildDetail")
- },
- {
- path: "deploy",
- component: () =>
- import("@/views/student/Code/ProjectDetail/DeployDetail")
- },
- {
- path: "test",
- component: () =>
- import("@/views/student/Code/ProjectDetail/TestDetail")
- }
- ]
- },
- {
- path: "code/:homeworkId/:projectId/test/unit/:unitTestId",
- component: () =>
- import("@/views/student/Code/ProjectDetail/Test/UnitTestDetail")
- },
- {
- path: "code/:homeworkId/:projectId/test/functional/:functionalTestId",
- component: () =>
- import("@/views/student/Code/ProjectDetail/Test/FunctionalTestDetail")
- },
- {
- path: "document",
- component: () => import("@/views/student/Document/index")
- },
- {
- path: "document/:documentId",
- component: () => import("@/views/student/Document/detail")
- },
- {
- path: "review",
- component: () => import("@/views/student/Review")
- },
- {
- path: "review/:reviewId",
- component: () => import("@/views/student/Review/ReviewDetail"),
- children: [
- {
- path: "self",
- component: () =>
- import("@/views/student/Review/ReviewDetail/ReviewSelfDetail")
- },
- {
- path: "",
- component: () =>
- import("@/views/student/Review/ReviewDetail/ReviewDocs")
- }
- ]
- },
- {
- path: "review/:reviewId/doc/:docReviewId",
- component: () => import("@/views/student/Review/ReviewDocDetail")
- },
- {
- path: "code",
- component: () => import("@/views/student/Code")
- },
- {
- path: "group",
- component: () => import("@/views/student/Group")
- }
- ]
- },
- {
- path: "/student",
- component: () => import("@/layouts/HomeLayout"),
- meta: { requiresAuth: false },
- children: [
- {
- name: STUDENT,
- path: "",
- component: () => import("@/views/student/Home")
- },
- {
- path: "setting",
- component: () => import("@/layouts/SettingLayout"),
- children: [
- {
- path: "profile",
- component: () => import("@/views/setting/Profile")
- },
- {
- path: "password",
- component: () => import("@/views/setting/Password")
- }
- ]
- }
- ]
- },
- {
- path: "/",
- name: HOME,
- redirect: () => {
- if (judgeLogin()) {
- const { role } = getUserProfile();
- return { name: role };
- } else {
- return { name: LOGIN };
- }
- }
- }
- ];
|