liuyu 4 anos atrás
pai
commit
7f9ed23745
1 arquivos alterados com 13 adições e 0 exclusões
  1. 13 0
      src/views/onlive/roomInfo.vue

+ 13 - 0
src/views/onlive/roomInfo.vue

@@ -50,6 +50,7 @@ import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 var moment = require('moment');
 const { mapActions: room } = createNamespacedHelpers('room');
+const jwt = require('jsonwebtoken');
 export default {
   name: 'roomInfo',
   props: {},
@@ -72,9 +73,18 @@ export default {
   },
   created() {
     this.seachInfo();
+    if (this.token) {
+      this.sesstoken();
+    }
   },
   methods: {
     ...room(['fetch']),
+    ...mapMutations(['setUser']),
+    sesstoken() {
+      sessionStorage.setItem('token', this.token);
+      let user = jwt.decode(this.token);
+      this.setUser(user);
+    },
     async seachInfo() {
       let res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
@@ -94,6 +104,9 @@ export default {
     id() {
       return this.$route.query.id;
     },
+    token() {
+      return this.$route.query.token;
+    },
   },
   mounted() {
     this.title = this.$route.meta.title;