|
@@ -6,96 +6,96 @@ 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("/teacherdevEntering");
|
|
|
- loadingInstance.close()
|
|
|
- } else {
|
|
|
- next({ path: "/" });
|
|
|
- loadingInstance.close()
|
|
|
- }
|
|
|
+ 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("/teacherdevEntering");
|
|
|
+ loadingInstance.close()
|
|
|
+ } else {
|
|
|
+ next({ path: "/" });
|
|
|
+ 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,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ loadingInstance.close()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 教研中心
|
|
|
+ {
|
|
|
+ path: '/',
|
|
|
+ name: 'Index',
|
|
|
+ component: Index
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ name: 'login',
|
|
|
+ component: () =>
|
|
|
+ import ('../views/login.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/Preview',
|
|
|
+ name: 'Preview',
|
|
|
+ component: () =>
|
|
|
+ import ('../views/teacher-dev/Preview.vue')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: "/Viewmore",
|
|
|
+ name: 'Viewmore',
|
|
|
+ component: () =>
|
|
|
+ import ('../views/teacher-dev/Viewmore.vue')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/teacherdevEntering',
|
|
|
+ name: 'teacherdevEntering',
|
|
|
+ component: () =>
|
|
|
+ import ('../views/teacher-devEntering/index.vue')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/creadDocument',
|
|
|
+ name: 'creadDocument',
|
|
|
+ component: () =>
|
|
|
+ import ('../views/teacher-devEntering/creadDocument.vue')
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '*',
|
|
|
+ redirect: '/404'
|
|
|
}
|
|
|
- }
|
|
|
-},
|
|
|
-{
|
|
|
- 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,
|
|
|
- },
|
|
|
- })
|
|
|
- loadingInstance.close()
|
|
|
- }
|
|
|
- }
|
|
|
-},
|
|
|
-// 教研中心
|
|
|
-{
|
|
|
- path: '/',
|
|
|
- name: 'Index',
|
|
|
- component: Index
|
|
|
-},
|
|
|
-{
|
|
|
- path: '/login',
|
|
|
- name: 'login',
|
|
|
- component: () =>
|
|
|
- import('../views/login.vue'),
|
|
|
-},
|
|
|
-{
|
|
|
- path: '/Preview',
|
|
|
- name: 'Preview',
|
|
|
- component: () =>
|
|
|
- import('../views/teacher-dev/Preview.vue')
|
|
|
-},
|
|
|
-{
|
|
|
- path: "/Viewmore",
|
|
|
- name: 'Viewmore',
|
|
|
- component: () =>
|
|
|
- import('../views/teacher-dev/Viewmore.vue')
|
|
|
-},
|
|
|
-{
|
|
|
- path: '/teacherdevEntering',
|
|
|
- name: 'teacherdevEntering',
|
|
|
- component: () =>
|
|
|
- import('../views/teacher-devEntering/index.vue')
|
|
|
-},
|
|
|
-{
|
|
|
- path: '/creadDocument',
|
|
|
- name: 'creadDocument',
|
|
|
- component: () =>
|
|
|
- import('../views/teacher-devEntering/creadDocument.vue')
|
|
|
-},
|
|
|
-{
|
|
|
- path: '*',
|
|
|
- redirect: '/404'
|
|
|
-}
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
const router = new VueRouter({
|
|
|
- // mode: 'history',
|
|
|
- base: process.env.BASE_URL,
|
|
|
- routes
|
|
|
+ // mode: 'history',
|
|
|
+ base: process.env.BASE_URL,
|
|
|
+ routes
|
|
|
})
|
|
|
|
|
|
//获取原型对象上的push函数
|
|
|
const originalPush = VueRouter.prototype.push
|
|
|
-//修改原型对象中的push方法
|
|
|
+ //修改原型对象中的push方法
|
|
|
VueRouter.prototype.push = function push(location) {
|
|
|
- return originalPush.call(this, location).catch(err => err)
|
|
|
+ return originalPush.call(this, location).catch(err => err)
|
|
|
}
|
|
|
|
|
|
export default router
|