liuyu 5 年之前
父节点
当前提交
7f9ed23745
共有 1 个文件被更改,包括 13 次插入0 次删除
  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';
 import footInfo from '@/layout/common/footInfo.vue';
 var moment = require('moment');
 var moment = require('moment');
 const { mapActions: room } = createNamespacedHelpers('room');
 const { mapActions: room } = createNamespacedHelpers('room');
+const jwt = require('jsonwebtoken');
 export default {
 export default {
   name: 'roomInfo',
   name: 'roomInfo',
   props: {},
   props: {},
@@ -72,9 +73,18 @@ export default {
   },
   },
   created() {
   created() {
     this.seachInfo();
     this.seachInfo();
+    if (this.token) {
+      this.sesstoken();
+    }
   },
   },
   methods: {
   methods: {
     ...room(['fetch']),
     ...room(['fetch']),
+    ...mapMutations(['setUser']),
+    sesstoken() {
+      sessionStorage.setItem('token', this.token);
+      let user = jwt.decode(this.token);
+      this.setUser(user);
+    },
     async seachInfo() {
     async seachInfo() {
       let res = await this.fetch(this.id);
       let res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
       if (this.$checkRes(res)) {
@@ -94,6 +104,9 @@ export default {
     id() {
     id() {
       return this.$route.query.id;
       return this.$route.query.id;
     },
     },
+    token() {
+      return this.$route.query.token;
+    },
   },
   },
   mounted() {
   mounted() {
     this.title = this.$route.meta.title;
     this.title = this.$route.meta.title;