yuwandanmian 2 سال پیش
والد
کامیت
809121f81c
2فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 1 0
      src/App.vue
  2. 9 2
      src/views/login/index.vue

+ 1 - 0
src/App.vue

@@ -36,6 +36,7 @@ export default {
     },
     isTimeOut() {
       this.currentTime = new Date().getTime();
+      console.log(6666)
       // 判断上次最后一次点击的时间和这次点击的时间间隔是否大于30分钟
       if (this.currentTime - this.lastTime > this.timeOut) {
         if (null != this.token) {

+ 9 - 2
src/views/login/index.vue

@@ -75,6 +75,7 @@ export default {
       loading: false,
       passwordType: 'password',
       redirect: undefined,
+      preUrl: ''
     };
   },
   watch: {
@@ -86,6 +87,10 @@ export default {
       immediate: true,
     },
   },
+  created() {
+    console.log('login create')
+    this.preUrl = sessionStorage.getItem('preUrl') ? sessionStorage.getItem('preUrl') : this.$route.query.preUrl
+  },
   methods: {
     showPwd() {
       if (this.passwordType === 'password') {
@@ -119,9 +124,11 @@ export default {
                     break
                   }
                 }
-                if (bSwitch === 1) {
+                if (bSwitch === 1 && this.preUrl === 'hospital') {
+                  sessionStorage.setItem('preUrl', 'hospital')
                   this.$router.push({ path: '/hospital'});
-                } else if (bSwitch === 2) {
+                } else if (bSwitch === 2 && this.preUrl === 'embedIndex') {
+                  sessionStorage.setItem('preUrl', 'embedIndex')
                   this.$router.push({ path: '/embedIndex' });
                 } else {
                   this.$router.push(this.redirect || '/');