liuyu 4 سال پیش
والد
کامیت
d27567e2f5
2فایلهای تغییر یافته به همراه65 افزوده شده و 0 حذف شده
  1. 51 0
      src/layout/live/detailmetting.vue
  2. 14 0
      src/store/lookuser.js

+ 51 - 0
src/layout/live/detailmetting.vue

@@ -17,6 +17,10 @@
               <i class="iconfont iconmaikefeng-tianchong"></i>
               <p>麦克风</p>
             </el-col>
+            <el-col :span="8" class="btn" @click.native="lookuserBtn()">
+              <i class="el-icon-user"></i>
+              <p>成员</p>
+            </el-col>
           </el-col>
         </el-col>
         <el-col :span="20" class="right">
@@ -86,6 +90,22 @@
         <el-option v-for="item in microphones" :key="item.deviceId" :label="item.label" :value="item.deviceId"> </el-option>
       </el-select>
     </el-dialog>
+    <el-dialog title="成员" :visible.sync="lookuserDia" width="30%" :before-close="handleClose">
+      <el-row>
+        <el-col :span="24" class="chatList">
+          <el-col :span="24" class="list" v-for="(item, index) in userList" :key="index">
+            <p>
+              <i class="el-icon-user"></i>
+              <span class="selfColor">{{ item.username }}</span>
+              <span v-if="item.switchrole === 'anchor'"
+                ><el-button type="primary" size="mini" @click="lookuserUpdate(item.id, 'audience')">移除</el-button></span
+              >
+              <span v-else><el-button type="primary" size="mini" @click="lookuserUpdate(item.id, 'anchor')">连麦</el-button></span>
+            </p>
+          </el-col>
+        </el-col>
+      </el-row>
+    </el-dialog>
   </div>
 </template>
 
@@ -94,6 +114,7 @@ import Vue from 'vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: gensign } = createNamespacedHelpers('gensign');
 const { mapActions: chat } = createNamespacedHelpers('chat');
+const { mapActions: lookuser } = createNamespacedHelpers('lookuser');
 import TRTC from 'trtc-js-sdk';
 export default {
   name: 'detailmetting',
@@ -119,6 +140,9 @@ export default {
       open_: false,
       dataList: [],
       index: 0,
+      userList: [],
+      lookuserDia: false,
+      isanchor: true,
     };
   },
   created() {
@@ -132,6 +156,33 @@ export default {
   methods: {
     ...gensign(['gensignFetch']),
     ...chat(['query', 'create', 'fetch']),
+    ...lookuser(['lookquery', 'lookupdate']),
+    async lookuserBtn() {
+      this.lookuserDia = true;
+      this.lookuserSearch();
+    },
+    async lookuserSearch({ skip = 0, limit = 1000 } = {}) {
+      const info = { roomid: this.id };
+      let res = await this.lookquery({ skip, limit, ...info });
+      this.$set(this, `userList`, res.data);
+    },
+    async lookuserUpdate(_id, _switchrole) {
+      console.log(_id);
+      let data = {};
+      data.id = _id;
+      data.switchrole = _switchrole;
+      const res = await this.lookupdate(data);
+      if (this.$checkRes(res)) {
+        console.log(res.data);
+        this.$message({
+          message: '操作成功',
+          type: 'success',
+        });
+        this.lookuserSearch();
+      } else {
+        this.$message.error(res.errmsg);
+      }
+    },
     async chatSearch({ skip = 0, limit = 1000 } = {}) {
       const info = { roomid: this.id };
       let res = await this.query({ skip, limit, ...info });

+ 14 - 0
src/store/lookuser.js

@@ -18,6 +18,14 @@ const actions = {
     });
     return res;
   },
+  async lookquery({ commit }, { skip = 0, limit = 10, ...info } = {}) {
+    const res = await this.$axios.$get(api.roomuserInfo, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
   async create({ commit }, payload) {
     const res = await this.$axios.$post(`${api.roomuserInfo}`, payload);
     return res;
@@ -32,6 +40,12 @@ const actions = {
     });
     return res;
   },
+  async lookupdate({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.roomuserInfo}/update/${id}`, {
+      ...info,
+    });
+    return res;
+  },
   async delete({ commit }, payload) {
     const res = await this.$axios.$delete(`${api.roomuserInfo}/${payload}`);
     return res;