guhongwei 4 年之前
父节点
当前提交
57422001ca
共有 3 个文件被更改,包括 29 次插入1 次删除
  1. 23 0
      src/store/gensign.js
  2. 2 0
      src/store/index.js
  3. 4 1
      src/views/live/detail.vue

+ 23 - 0
src/store/gensign.js

@@ -0,0 +1,23 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  gensignInfo: `/api/onlive/user/gensign`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async gensignFetch({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.gensignInfo}`, payload);
+    return res;
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 2 - 0
src/store/index.js

@@ -4,6 +4,7 @@ import login from './login';
 import roomuser from './roomuser';
 import role from './role';
 import room from './room';
+import gensign from './gensign';
 import * as ustate from './user/state';
 import * as umutations from './user/mutations';
 
@@ -18,5 +19,6 @@ export default new Vuex.Store({
     roomuser,
     role,
     room,
+    gensign,
   },
 });

+ 4 - 1
src/views/live/detail.vue

@@ -18,6 +18,7 @@ import topInfo from '@/layout/public/top.vue';
 import detailInfo from '@/layout/live/detailInfo.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: room } = createNamespacedHelpers('room');
+const { mapActions: gensign } = createNamespacedHelpers('gensign');
 export default {
   name: 'detail',
   props: {},
@@ -31,16 +32,18 @@ export default {
     };
   },
   created() {
-    console.log(this.id, this.name);
     this.searchInfo();
   },
   methods: {
     ...room(['query', 'delete', 'update', 'fetch']),
+    ...gensign(['gensignFetch']),
     async searchInfo() {
       let res = await this.fetch(this.id);
       if (this.$checkRes(res)) {
         this.$set(this, `roomInfo`, res.data);
       }
+      res = await this.gensignFetch(this.id);
+      console.log(res);
     },
   },
   computed: {