|
@@ -3,6 +3,7 @@ import store from './store'
|
|
|
import NProgress from 'nprogress' // progress bar
|
|
|
import 'nprogress/nprogress.css' // progress bar style
|
|
|
// import { getToken } from '@/utils/auth' // get token from cookie
|
|
|
+import Cookies from 'js-cookie'
|
|
|
|
|
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
|
|
|
|
@@ -17,7 +18,7 @@ router.beforeEach(async(to, from, next) => {
|
|
|
// determine whether the user has logged in
|
|
|
// const hasToken = getToken()
|
|
|
const hasToken = store.getters.id
|
|
|
-
|
|
|
+ const isWeChat = Cookies.get('isWeChat')
|
|
|
if (to.query.courseid !== '' && to.query.courseid !== undefined) {
|
|
|
console.log(to.query.courseid)
|
|
|
await store.commit('SET_COURSEID', to.query.courseid)
|
|
@@ -33,10 +34,13 @@ router.beforeEach(async(to, from, next) => {
|
|
|
await store.commit('SET_SHARECOURSEID', shareCourseId)
|
|
|
}
|
|
|
if (hasToken) {
|
|
|
- if (to.path === '/login') {
|
|
|
+ if (to.path === '/login' || to.path === '/login2') {
|
|
|
// if is logged in, redirect to the home page
|
|
|
-
|
|
|
- next({ path: '/' })
|
|
|
+ if(isWeChat == '1'){
|
|
|
+ next({ path: '/' })
|
|
|
+ }else {
|
|
|
+ next('/appStoreCopy')
|
|
|
+ }
|
|
|
NProgress.done()
|
|
|
} else {
|
|
|
const userinfo = store.getters.userinfo && Object.keys(store.getters.userinfo).length > 0
|