yuwandanmian hai 1 ano
pai
achega
285c593c07

+ 4 - 0
src/views/404.vue

@@ -29,6 +29,10 @@ export default {
       return 'The webmaster said that you can not enter this page...';
       return 'The webmaster said that you can not enter this page...';
     },
     },
   },
   },
+  beforeRouteLeave(to, from, next) {
+    // 阻止用户离开当前页面
+    next(false);
+  },
   methods: {
   methods: {
     async logout() {
     async logout() {
       await this.$store.dispatch('user/logout')
       await this.$store.dispatch('user/logout')

+ 1 - 1
src/views/embedIndex/index.vue

@@ -12,7 +12,7 @@
           <CaseIndex />
           <CaseIndex />
         </el-tab-pane>
         </el-tab-pane>
       </el-tabs>
       </el-tabs>
-      <el-button class="layout-btn" @click="layout">
+      <el-button class="layout-btn" @click="logout">
         退出
         退出
       </el-button>
       </el-button>
     </div>
     </div>

+ 29 - 13
src/views/login/index.vue

@@ -92,16 +92,16 @@ export default {
     $route: {
     $route: {
       handler: function (route) {
       handler: function (route) {
         this.redirect = route.query && route.query.redirect;
         this.redirect = route.query && route.query.redirect;
-        this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : sessionStorage.getItem('preUrl')
-        // this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : undefined
+        // this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : sessionStorage.getItem('preUrl')
+        this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : undefined
       },
       },
       immediate: true,
       immediate: true,
     },
     },
   },
   },
   created() {
   created() {
     this.$nextTick(() => {
     this.$nextTick(() => {
-      this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : sessionStorage.getItem('preUrl')
-      // this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : undefined
+      // this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : sessionStorage.getItem('preUrl')
+      this.preUrl = !!this.$route.query.preUrl ? this.$route.query.preUrl : undefined
     })
     })
   },
   },
   methods: {
   methods: {
@@ -137,18 +137,34 @@ export default {
                   }
                   }
 
 
                 }
                 }
-                if (bSwitch.includes(1) && this.preUrl === 'hospital') {
-                  sessionStorage.setItem('preUrl', 'hospital')
-                  this.$router.push({ path: '/hospital'});
-                } else if (bSwitch.includes(2) && this.preUrl === 'embedIndex') {
-                  sessionStorage.setItem('preUrl', 'embedIndex')
-                  this.$router.push({ path: '/embedIndex' });
-                } else if (bSwitch.includes(3) && this.preUrl === 'reviewIndex') {
-                  sessionStorage.setItem('preUrl', 'reviewIndex')
-                  this.$router.push({ path: '/reviewIndex' });
+                if (this.preUrl) {
+                  if (bSwitch.includes(1) && this.preUrl === 'hospital') {
+                    sessionStorage.setItem('preUrl', 'hospital')
+                    this.$router.push({ path: '/hospital'});
+                  } else if (bSwitch.includes(2) && this.preUrl === 'embedIndex') {
+                    sessionStorage.setItem('preUrl', 'embedIndex')
+                    this.$router.push({ path: '/embedIndex' });
+                  } else if (bSwitch.includes(3) && this.preUrl === 'reviewIndex') {
+                    sessionStorage.setItem('preUrl', 'reviewIndex')
+                    this.$router.push({ path: '/reviewIndex' });
+                  } else {
+                    this.$message.error('没有页面权限,请联系管理员!')
+                  }
                 } else {
                 } else {
                   this.$router.push(this.redirect || '/');
                   this.$router.push(this.redirect || '/');
                 }
                 }
+                // if (bSwitch.includes(1) && this.preUrl === 'hospital') {
+                //   sessionStorage.setItem('preUrl', 'hospital')
+                //   this.$router.push({ path: '/hospital'});
+                // } else if (bSwitch.includes(2) && this.preUrl === 'embedIndex') {
+                //   sessionStorage.setItem('preUrl', 'embedIndex')
+                //   this.$router.push({ path: '/embedIndex' });
+                // } else if (bSwitch.includes(3) && this.preUrl === 'reviewIndex') {
+                //   sessionStorage.setItem('preUrl', 'reviewIndex')
+                //   this.$router.push({ path: '/reviewIndex' });
+                // } else {
+                //   this.$router.push(this.redirect || '/');
+                // }
               }).catch((e) => {
               }).catch((e) => {
                 console.log(e)
                 console.log(e)
                 this.$message.error('获取导航菜单失败!');
                 this.$message.error('获取导航菜单失败!');

+ 1 - 1
src/views/reviewIndex/index.vue

@@ -9,7 +9,7 @@
           <CaseIndex />
           <CaseIndex />
         </el-tab-pane>
         </el-tab-pane>
       </el-tabs>
       </el-tabs>
-      <el-button class="layout-btn" @click="layout">
+      <el-button class="layout-btn" @click="logout">
         退出
         退出
       </el-button>
       </el-button>
     </div>
     </div>

+ 1 - 1
src/views/searchSystem/index.vue

@@ -15,7 +15,7 @@
           <OutpatientSearchVue v-if="activeName ==3" :is-whitelist="isWhiteList" />
           <OutpatientSearchVue v-if="activeName ==3" :is-whitelist="isWhiteList" />
         </el-tab-pane>
         </el-tab-pane>
       </el-tabs>
       </el-tabs>
-      <el-button v-if="!isWhiteList" class="layout-btn" @click="layout">
+      <el-button v-if="!isWhiteList" class="layout-btn" @click="logout">
         退出
         退出
       </el-button>
       </el-button>
     </div>
     </div>