guhongwei 4 anni fa
parent
commit
b497ba3c4e
2 ha cambiato i file con 23 aggiunte e 9 eliminazioni
  1. 1 8
      src/views/live/index.vue
  2. 22 1
      src/views/user/index.vue

+ 1 - 8
src/views/live/index.vue

@@ -143,7 +143,7 @@ export default {
 <style lang="less" scoped>
 .style {
   width: 100%;
-  min-height: 667px;
+  height: 100%;
   position: relative;
   background-color: #f9fafc;
 }
@@ -153,11 +153,4 @@ export default {
   position: relative;
   z-index: 999;
 }
-.main {
-  min-height: 570px;
-}
-.foot {
-  position: absolute;
-  bottom: 0;
-}
 </style>

+ 22 - 1
src/views/user/index.vue

@@ -49,10 +49,31 @@ export default {
     };
   },
   created() {},
-  methods: {},
+  methods: {
+    sesstoken() {
+      if (this.token) {
+        sessionStorage.setItem('token', this.token);
+        let user = jwt.decode(this.token);
+        if (user && user.uid) {
+          this.setUser(user);
+        }
+      } else {
+        this.$router.push({ path: '/login' });
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },
+  watch: {
+    token: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.sesstoken();
+      },
+    },
+  },
   mounted() {
     this.title = this.$route.meta.title;
     this.isleftarrow = this.$route.meta.isleftarrow;