123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- import Vue from 'vue';
- import VueRouter from 'vue-router';
- import Index from '../views/teacher-dev/index.vue';
- Vue.use(VueRouter);
- import { Loading } from 'element-ui';
- import { getToken } from '@/utils/auth'; // get token from cookie
- const routes = [{
- path: '/EnterSys',
- // component: Index,
- beforeEnter: (to, from, next) => {
- let loadingInstance = Loading.service({
- text: '跳转中...',
- });
- let token = getToken();
- if (token) {
- if (JSON.parse(token).popedom_code_list.indexOf(2000006) === -1) {
- next({ path: '/' });
- loadingInstance.close();
- } else {
- next('/teacherdevEntering');
- loadingInstance.close();
- }
- }
- },
- },
- {
- path: '/GoodsDetail',
- beforeEnter: (to, from, next) => {
- let loadingInstance = Loading.service({
- text: '跳转中...',
- });
- if (to.query.goods_type === 401) {
- next({
- path: '/Preview',
- query: {
- id: to.query.goods_id,
- invok_module: to.query.invok_module,
- },
- });
- loadingInstance.close();
- }
- },
- },
- // 教研中心
- {
- path: '/',
- name: 'Index',
- component: Index,
- meta: { title: '', keepAlive: false },
- },
- {
- path: '/login',
- name: 'login',
- component: () =>
- import ('../views/login.vue'),
- },
- {
- path: '/Preview',
- name: 'Preview',
- component: () =>
- import ('../views/teacher-dev/Preview.vue'),
- },
- {
- path: '/Viewmore',
- name: 'Viewmore',
- meta: { title: '', keepAlive: false },
- component: () =>
- import ('../views/teacher-dev/Viewmore.vue'),
- },
- {
- path: '/TextAnalysis',
- name: 'TextAnalysis',
- meta: { title: '', keepAlive: false },
- component: () =>
- import ('../views/teacher-dev/TextAnalysis.vue'),
- },
- {
- path: '/Integration/TextAnalyser',
- name: 'IntegrationTextAnalysis',
- meta: { title: '', keepAlive: false },
- component: () =>
- import ('../views/teacher-dev/TextAnalysis.vue'),
- },
- {
- path: '/teacherdevEntering',
- name: 'teacherdevEntering',
- meta: { title: '', keepAlive: false },
- component: () =>
- import ('../views/teacher-devEntering/index.vue'),
- },
- {
- path: '/creadDocument',
- name: 'creadDocument',
- component: () =>
- import ('../views/teacher-devEntering/creadDocument.vue'),
- },
- {
- path: '/discountCodeList',
- name: 'discountCodeList',
- component: () =>
- import ('@/views/teacher-devEntering/discountCodeList'),
- },
- {
- path: '/textanalysis/Result',
- component: () =>
- import ('@/views/Textanalysis/index'),
- },
- {
- path: '/textanalysis/WordTable',
- component: () =>
- import ('@/views/Textanalysis/WordTable'),
- },
- {
- path: '/corpus/seekPage',
- component: () =>
- import ('@/views/corpus/seekPage'),
- },
- {
- path: '/Integration/Corpus',
- name: 'IntegrationCorpus',
- component: () =>
- import ('@/views/corpus/seekPage'),
- },
- {
- path: '/corpus/Result',
- component: () =>
- import ('@/views/corpus/Result'),
- },
- {
- path: '/wordcard/table',
- component: () =>
- import ('@/views/wordcard/table'),
- },
- {
- path: '/wordcard/cread',
- component: () =>
- import ('@/views/wordcard/cread'),
- meta: { title: '创建词汇卡片', keepAlive: true },
- },
- {
- path: '/wordcard/print',
- component: () =>
- import ('@/views/wordcard/print'),
- },
- {
- path: '/CalligraphyMaster/table',
- component: () =>
- import ('@/views/CalligraphyMaster/table'),
- },
- {
- path: '/CalligraphyMaster/cread',
- component: () =>
- import ('@/views/CalligraphyMaster/cread'),
- },
- {
- path: '/CalligraphyMaster/fontFamilyList',
- component: () =>
- import ('@/views/CalligraphyMaster/fontFamilyList'),
- },
- {
- path: '/textanalysis/checkArticle',
- component: () =>
- import ('@/views/Textanalysis/CheckArticle'),
- },
- {
- path: '/textanalysis/checkPinyin',
- component: () =>
- import ('@/views/Textanalysis/CheckPinyin'),
- },
- {
- path: '/textanalysis/checkWord',
- component: () =>
- import ('@/views/Textanalysis/CheckWord'),
- },
- {
- path: '/textanalysis/checkPos',
- component: () =>
- import ('@/views/Textanalysis/CheckPos'),
- },
- {
- path: '*',
- redirect: '/404',
- },
- ];
- const router = new VueRouter({
- // mode: 'history',
- base: process.env.BASE_URL,
- routes,
- });
- // 获取原型对象上的push函数
- const originalPush = VueRouter.prototype.push;
- // 修改原型对象中的push方法
- VueRouter.prototype.push = function push(location) {
- return originalPush.call(this, location).catch((err) => err);
- };
- export default router;
|