lsc 3 days ago
parent
commit
b825c2da72
5 changed files with 8 additions and 29 deletions
  1. 0 0
      dist/index.html
  2. 1 1
      dist/report.html
  3. 0 0
      dist/static/js/app.298dca94.js
  4. 6 28
      src/permission.js
  5. 1 0
      src/views/login/index.vue

File diff suppressed because it is too large
+ 0 - 0
dist/index.html


File diff suppressed because it is too large
+ 1 - 1
dist/report.html


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.298dca94.js


+ 6 - 28
src/permission.js

@@ -23,11 +23,9 @@ router.beforeEach(async(to, from, next) => {
   let isWeChat = Cookies.get('isWeChat')
   if (to.query.courseid !== '' && to.query.courseid !== undefined) {
     console.log(to.query.courseid)
-    isWeChat = '1'
     await store.commit('SET_COURSEID', to.query.courseid)
   }
   if (to.query.testid !== '' && to.query.testid !== undefined) {
-    isWeChat = '1'
     await store.commit('SET_TESTID', to.query.testid)
   }
   const shareCourseId =
@@ -35,38 +33,14 @@ router.beforeEach(async(to, from, next) => {
       ? window.location.href.split('?shareCourseId=')[1].toString()
       : ''
   if (shareCourseId) {
-    isWeChat = '1'
     await store.commit('SET_SHARECOURSEID', shareCourseId)
   }
   if (hasToken) {
     await store.commit('user/SET_ID', hasToken)
     if (to.path === '/login' || to.path === '/login2') {
       // if is logged in, redirect to the home page
-      store.commit('user/SET_ID', hasToken)
       if (isWeChat === '1') {
-        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({
-            path: '/courseDetail',
-            query: { courseid: courseId, userid: hasToken },
-            replace: true
-          })
-        } else if (testId) {
-          next({ path: '/testDetail', query: { courseid: testId, userid: hasToken }, replace: true })
-        } else if (shareCourseId) {
-          next({
-            path: '/courseDetail',
-            query: { courseid: shareCourseId, urlType: 1, userid: hasToken },
-            replace: true
-          })
-        } else {
-          next({ path: '/' })
-        }
+        next({ path: '/' })
       } else {
         next('/appStoreCopy')
       }
@@ -78,7 +52,11 @@ router.beforeEach(async(to, from, next) => {
       // console.log('to', {...to} )
       if (userinfo) {
         console.log(store)
-        next()
+        if (isWeChat === '1') {
+          next()
+        } else {
+          next('/appStoreCopy')
+        }
       } else {
         try {
           // 获取用户信息

+ 1 - 0
src/views/login/index.vue

@@ -54,6 +54,7 @@ export default {
     this.timer = null
   },
   mounted() {
+    Cookies.set('isWeChat', '1')
     this.getLogin()
     this.timer = setInterval(() => {
       this.getLogin()

Some files were not shown because too many files changed in this diff