|
|
@@ -19,7 +19,7 @@ router.beforeEach(async(to, from, next) => {
|
|
|
const hasToken = getToken()
|
|
|
|
|
|
if (to.query.courseid) {
|
|
|
- store.commit('app/SET_COURSEID', to.query.courseid)
|
|
|
+ await store.commit('app/SET_COURSEID', to.query.courseid)
|
|
|
}
|
|
|
if (hasToken) {
|
|
|
if (to.path === '/login') {
|
|
|
@@ -32,7 +32,9 @@ router.beforeEach(async(to, from, next) => {
|
|
|
console.log(store.getters)
|
|
|
console.log(userinfo)
|
|
|
if (userinfo) {
|
|
|
- next()
|
|
|
+ const courseId = store.getters.courseId
|
|
|
+
|
|
|
+ next({ ...to, query: { courseid: courseId }})
|
|
|
} else {
|
|
|
try {
|
|
|
// 获取用户信息
|