|
@@ -75,7 +75,26 @@ router.beforeEach(async(to, from, next) => {
|
|
|
console.log('userinfo', userinfo)
|
|
|
// console.log('to', {...to} )
|
|
|
if (userinfo) {
|
|
|
- next()
|
|
|
+ const courseId = store.getters.courseId
|
|
|
+ const testId = store.getters.testId
|
|
|
+ const shareCourseId = store.getters.shareCourseId
|
|
|
+ await store.commit('SET_TESTID', '')
|
|
|
+ await store.commit('SET_COURSEID', '')
|
|
|
+ await store.commit('SET_SHARECOURSEID', '')
|
|
|
+ // // 根据角色生成可访问的路线图
|
|
|
+ if (courseId) {
|
|
|
+ next({ ...to, query: { courseid: courseId, userid: hasToken }, replace: true })
|
|
|
+ } else if (testId) {
|
|
|
+ next({ ...to, query: { courseid: testId, userid: hasToken }, replace: true })
|
|
|
+ } else if (shareCourseId) {
|
|
|
+ next({
|
|
|
+ path: '/courseDetail',
|
|
|
+ query: { courseid: shareCourseId, urlType: 1, userid: hasToken },
|
|
|
+ replace: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ next()
|
|
|
+ }
|
|
|
} else {
|
|
|
try {
|
|
|
// 获取用户信息
|