Browse Source

退出

gzb
wangzhonglu 1 year ago
parent
commit
e0e4064929
2 changed files with 12 additions and 10 deletions
  1. 1
    9
      src/router/index.js
  2. 11
    1
      src/views/layout.vue

+ 1
- 9
src/router/index.js View File

63
   } else {
63
   } else {
64
     let u = localStorage.getItem("xhWebAdminUser");
64
     let u = localStorage.getItem("xhWebAdminUser");
65
     if (u) {
65
     if (u) {
66
-      let ju = JSON.parse(u);
67
-      if (ju) {
68
-        next();
69
-      } else {
70
-        next({
71
-          path: "/login",
72
-          query: to.query
73
-        });
74
-      }
66
+      next();
75
     } else {
67
     } else {
76
       next({
68
       next({
77
         path: "/login",
69
         path: "/login",

+ 11
- 1
src/views/layout.vue View File

23
         <router-link class="header_html_item" :to="{ path: '/log' }"
23
         <router-link class="header_html_item" :to="{ path: '/log' }"
24
           >登录日志</router-link
24
           >登录日志</router-link
25
         >
25
         >
26
-        <router-link class="log_out" :to="{ path: '/login' }">退出</router-link>
26
+        <div class="log_out" @click="toLogOut()">退出</div>
27
       </div>
27
       </div>
28
     </div>
28
     </div>
29
     <div class="layout_out">
29
     <div class="layout_out">
33
     </div>
33
     </div>
34
   </div>
34
   </div>
35
 </template>
35
 </template>
36
+<script>
37
+export default {
38
+  methods: {
39
+    toLogOut() {
40
+      localStorage.setItem("xhWebAdminUser", "");
41
+      this.$router.replace({ path: "/login" });
42
+    }
43
+  }
44
+};
45
+</script>
36
 
46
 
37
 <style scoped lang="less">
47
 <style scoped lang="less">
38
 html,
48
 html,

Loading…
Cancel
Save