Browse Source

修改 退出

yuwandanmian 1 năm trước cách đây
mục cha
commit
1d5e5ceda8

+ 0 - 5
src/layout/components/AppMain.vue

@@ -66,11 +66,6 @@ export default {
     this.keepAliveComponentInstance = this.$refs.keepAliveContainer.childNodes[0].__vue__;
     this.keepAliveComponentInstance = this.$refs.keepAliveContainer.childNodes[0].__vue__;
 
 
   },
   },
-  beforeDestroy() {
-    setToken('');
-    sessionStorage.removeItem("route")
-    this.$router.push(`/login`);
-  },
   watch: {
   watch: {
     $route(to, from) {
     $route(to, from) {
       const { tagsView } = this.$store.state
       const { tagsView } = this.$store.state

+ 3 - 7
src/layout/components/Navbar.vue

@@ -43,14 +43,10 @@ export default {
     toggleSideBar() {
     toggleSideBar() {
       this.$store.dispatch('app/toggleSideBar');
       this.$store.dispatch('app/toggleSideBar');
     },
     },
-    async logout() {
-      // setToken('');
-      // // 清除缓存的权限菜单
-      // sessionStorage.removeItem("route")
-      // sessionStorage.removeItem("preUrl")
-      // this.$router.push(`/login`);
+    async layout() {
       await this.$store.dispatch('user/logout')
       await this.$store.dispatch('user/logout')
-      this.$router.push(`/login?id=123123`)
+      const preUrl = sessionStorage.getItem("preUrl")
+      this.$router.push({ path: '/login', query: { preUrl }})
     },
     },
   },
   },
 };
 };

+ 5 - 5
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="onLayout">
+      <el-button class="layout-btn" @click="layout">
         退出
         退出
       </el-button>
       </el-button>
     </div>
     </div>
@@ -45,10 +45,10 @@ export default {
       console.log(tab.name);
       console.log(tab.name);
       this.activeName = tab.name
       this.activeName = tab.name
     },
     },
-    onLayout() {
-      setToken('');
-      sessionStorage.removeItem("route")
-      this.$router.push(`/login`);
+    async layout() {
+      await this.$store.dispatch('user/logout')
+      const preUrl = sessionStorage.getItem("preUrl")
+      this.$router.push({ path: '/login', query: { preUrl }})
     },
     },
     onFeedback() {
     onFeedback() {
       this.feedbackData.bSwitch = true
       this.feedbackData.bSwitch = true

+ 6 - 6
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="onLayout">
+      <el-button class="layout-btn" @click="layout">
         退出
         退出
       </el-button>
       </el-button>
     </div>
     </div>
@@ -35,11 +35,11 @@ export default {
     handleClick(tab, event) {
     handleClick(tab, event) {
       this.activeName = tab.name
       this.activeName = tab.name
     },
     },
-    onLayout() {
-      setToken('');
-      sessionStorage.removeItem("route")
-      this.$router.push(`/login`);
-    }
+    async layout() {
+      await this.$store.dispatch('user/logout')
+      const preUrl = sessionStorage.getItem("preUrl")
+      this.$router.push({ path: '/login', query: { preUrl }})
+    },
   },
   },
 };
 };
 </script>
 </script>

+ 5 - 6
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="onLayout">
+      <el-button v-if="!isWhiteList" class="layout-btn" @click="layout">
         退出
         退出
       </el-button>
       </el-button>
     </div>
     </div>
@@ -51,11 +51,10 @@ export default {
       console.log(tab.name);
       console.log(tab.name);
       this.activeName = tab.name
       this.activeName = tab.name
     },
     },
-    onLayout() {
-      // jingmiao_token
-      setToken('');
-      sessionStorage.removeItem("route")
-      this.$router.push(`/login`);
+    async layout() {
+      await this.$store.dispatch('user/logout')
+      const preUrl = sessionStorage.getItem("preUrl")
+      this.$router.push({ path: '/login', query: { preUrl }})
     },
     },
   },
   },
 };
 };