123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- import Vue from 'vue';
- import Router from 'vue-router';
- const App = () => import('@/App');
- const Index = () => import('@/login/Index');
- const NotFound = () => import('@/NotFound');
- const MainPage = () => import('@/components/MainPage');
- const Home = () => import('@/components/MainPage/Home');
- const AbilityTest = () => import('@/components/MainPage/AbilityTest');
- const News = () => import('@/components/MainPage/News');
- const AboutUs = () => import('@/components/MainPage/AboutUs');
- const ContactUs = () => import('@/components/MainPage/ContactUs');
- const ExamTable = () => import('@/components/MainPage/ExamTable');
- const UserPage = () => import('@/components/UserPage');
- const DoTest = () => import('@/components/doTest/DoTest.vue');
- const RestPage = () => import('@/components/doTest/RestPage');
- const TestResult = () => import('@/components/doTest/TestResult2');
- const GuidePage = () => import('@/components/doTest/GuidePage');
- const ControlApp = () => import('@/ControlApp');
- const ControlMainPage = () => import('@/components/ControlMainPage');
- const PaperList = () => import('@/components/controlMainPage/PaperList');
- const PaperListSimple = () => import('@/components/controlMainPage/PaperListSimple');
- const DocList = () => import('@/components/controlMainPage/DocList');
- const QuestionList = () => import('@/components/controlMainPage/docList/QuestionList');
- const UserList = () => import('@/components/controlMainPage/UserList');
- const FirstEdition = () => import('@/components/report/FirstEdition');
- const PDFTest = () => import('@/components/report/PDFTest');
- const SimpleReport = () => import('@/components/report/SimpleReport');
- const ControlLogin = () => import('@/login/ControlLogin');
- const VoiceTest = () => import('@/components/VoiceTest');
- const UserTest = () => import('@/components/UserTest');
- import store from '@/store/index';
- import { getLoginUser } from '@/api/login'
- Vue.use(Router);
- export default new Router({
- routes: [{
- path: '/',
- redirect: { name: 'App' },
- },{
- path: '/app',
- name: 'App',
- component: App,
- beforeEnter: (to, from, next) => {
- getLoginUser().then(data => {
- store.dispatch('setLoginUser', data);
- next();
- }).catch(() => {
- next({name: 'Index'});
- })
- },
- redirect: { name: 'MainPage' },
- children: [{
- path: 'mainPage',
- name: 'MainPage',
- component: MainPage,
- redirect: { name: 'AbilityTest' },
- children: [{
- path: 'home',
- name: 'Home',
- component: Home
- }, {
- path: 'abilityTest',
- name: 'AbilityTest',
- component: AbilityTest,
- }, {
- path: 'news',
- name: 'News',
- component: News,
- }, {
- path: 'aboutUs',
- name: 'AboutUs',
- component: AboutUs,
- }, {
- path: 'contactUs',
- name: 'ContactUs',
- component: ContactUs,
- }, {
- path: 'examTable',
- name: 'ExamTable',
- component: ExamTable,
- }],
- },{
- path: 'userPage',
- name: 'UserPage',
- component: UserPage,
- },{
- path: 'guidePage/:examId',
- name: 'GuidePage',
- component: GuidePage
- },{
- path: 'doTest/:examId',
- name: 'DoTest',
- component: DoTest
- },{
- path: 'restPage/:examId',
- name: 'RestPage',
- component: RestPage
- },{
-
- path: 'testResult/:pid/:uid',
- name: 'TestResult',
- component: TestResult
- }]
- },
- {
- path: '/index',
- name: 'Index',
- component: Index
- },
- {
- path: '*',
- name: 'NotFound',
- component: NotFound
- },{
- path: '/ctrlApp',
- name: 'ControlApp',
- component: ControlApp,
- beforeEnter: (to, from, next) => {
- getLoginUser().then(data => {
- store.dispatch('setLoginUser', data);
- next();
- }).catch(() => {
- next({name: 'ControlLogin'});
- })
- },
- redirect: { name: 'ControlMainPage' },
- children: [{
- path: 'ctrlMainPage',
- name: 'ControlMainPage',
- component: ControlMainPage,
- redirect: { name: 'PaperListSimple' },
- children: [{
- path: 'paperList',
- name: 'PaperList',
- component: PaperList,
- },{
- path: 'paperListSimple',
- name: 'PaperListSimple',
- component: PaperListSimple,
- },{
- path: 'userList',
- name: 'UserList',
- component: UserList,
- },{
- path: 'docList',
- name: 'DocList',
- component: DocList,
- },{
- path: 'questionList/:pid',
- name: 'QuestionList',
- component: QuestionList
- }],
- },{
- path: 'firstEdition/:pid/:uid',
- name: 'FirstEdition',
- component: FirstEdition,
- },{
- path: 'pdfTest',
- name: 'PDFTest',
- component: PDFTest,
- },{
- path: 'simpleReport/:pid/:uid',
- name: 'SimpleReport',
- component: SimpleReport,
- }]
- },{
- path: '/ctrlLogin',
- name: 'ControlLogin',
- component: ControlLogin,
- },{
- path: '/voice',
- name: 'VoiceTest',
- component: VoiceTest,
- },{
- path: '/xxx',
- name: 'UserTest',
- component: UserTest,
- }]
- });
|