liuyu 4 years ago
parent
commit
ce1a752031
4 changed files with 88 additions and 10 deletions
  1. 76 8
      src/layout/live/detailInfo.vue
  2. 7 2
      src/layout/room/detailInfo.vue
  3. 4 0
      src/store/room.js
  4. 1 0
      src/views/room/detail.vue

+ 76 - 8
src/layout/live/detailInfo.vue

@@ -4,9 +4,9 @@
       <el-col :span="24" class="info">
         <el-col :span="4" class="left">
           <el-col :span="24" class="leftTop">
-            <el-image :src="roomInfo.filedir"></el-image>
-            <p>{{ roomInfo.title }}</p>
-            <p>{{ roomInfo.content }}</p>
+            <el-image :src="roomdetail.filedir"></el-image>
+            <p>{{ roomdetail.title }}</p>
+            <p>{{ roomdetail.content }}</p>
           </el-col>
           <el-col :span="24" class="leftDown">
             <el-col :span="8" class="btn" @click.native="shexiangBtn()">
@@ -50,9 +50,19 @@
               <el-col :span="18" class="one">
                 <div id="main-video" class="video-box col-div" style="justify-content: flex-end"></div>
               </el-col>
+              <el-col :span="6" class="two">
+                <el-col :span="24" class="twoOne" v-for="(item, index) in zjrList" :key="index">
+                  <p>
+                    <span class="zjr-sel-info">{{ item.zjrname }}</span>
+                    <span class="twobtn">
+                      <el-button type="danger" size="mini" @click="zjrChange(item.zjrid)">主讲</el-button>
+                    </span>
+                  </p>
+                </el-col>
+              </el-col>
             </el-col>
           </el-col>
-          <el-col :span="2" class="noVideo"> </el-col>
+          <el-col :span="2" class="noVideo"></el-col>
           <el-col :span="24" class="rightDown">
             <!-- 开始直播 -->
           </el-col>
@@ -131,6 +141,7 @@ const { mapActions: gensign } = createNamespacedHelpers('gensign');
 const { mapActions: chat } = createNamespacedHelpers('chat');
 const { mapActions: room } = createNamespacedHelpers('room');
 const { mapActions: lookuser } = createNamespacedHelpers('lookuser');
+const { mapActions: roomuser } = createNamespacedHelpers('roomuser');
 import TRTC from 'trtc-js-sdk';
 export default {
   name: 'detailInfo',
@@ -173,9 +184,12 @@ export default {
       ov6: '',
       ov7: '',
       showbtn_: false,
+      roomdetail: {},
+      zjrList: [],
     };
   },
   created() {
+    this.getRoomInfo();
     this.initclient();
     this.getDevices();
     this.chatSearch();
@@ -186,8 +200,46 @@ export default {
   methods: {
     ...gensign(['gensignFetch']),
     ...chat(['query', 'create', 'fetch']),
-    ...room(['startrecord', 'stoprecord', 'roomquest', 'roomquestclose', 'questquery', 'updateanchor', 'updateshmai']),
+    ...room({
+      roomfetch: 'fetch',
+      startrecord: 'startrecord',
+      stoprecord: 'stoprecord',
+      roomquest: 'roomquest',
+      roomquestclose: 'roomquestclose',
+      questquery: 'questquery',
+      updateanchor: 'updateanchor',
+      updateshmai: 'updateshmai',
+      switchzjr: 'switchzjr',
+    }),
     ...lookuser(['lookquery', 'lookupdate']),
+    ...roomuser({ roomuserfetch: 'fetch' }),
+    async zjrChange(zjrid) {
+      const data = {};
+      data.id = this.id;
+      data.switchzjr = zjrid;
+      const res = await this.switchzjr(data);
+      if (this.$checkRes(res)) {
+        console.log(res.data);
+        this.$message({
+          message: '操作成功',
+          type: 'success',
+        });
+      }
+    },
+    async getRoomInfo() {
+      const res = await this.roomfetch(this.id);
+      if (this.$checkRes(res)) {
+        console.log(res.data);
+        this.$set(this, `roomdetail`, res.data);
+        for (const elm of res.data.zjr) {
+          const ru = await this.roomuserfetch(elm);
+          if (this.$checkRes(ru)) {
+            const newdata = { zjrid: elm, zjrname: ru.data.name };
+            this.zjrList.push(newdata);
+          }
+        }
+      }
+    },
     async roomshangmai(dataid) {
       const data = {};
       data.id = this.id;
@@ -356,7 +408,7 @@ export default {
           if (usersplit_ === 'other') {
             this.index_ = this.index_ + 1;
             const id_ = 'othe-video-' + this.index_;
-            const ovid = usertempid_.substring(5);
+            const ovid = usertempid_.substring(6);
             if (this.index_ === 1) {
               this.ov1 = ovid;
             } else if (this.index_ === 2) {
@@ -378,7 +430,8 @@ export default {
             const id_ = 'look-video-' + usertempid_;
             remoteStream.play(id_);
           } else if (usersplit_ === 'meetu') {
-            const id_ = 'look-video-' + usertempid_;
+            const ovid = usertempid_.substring(6);
+            const id_ = 'look-video-' + ovid;
             remoteStream.play(id_);
           }
         }
@@ -612,9 +665,24 @@ export default {
         .two {
           height: 480px;
           overflow: hidden;
+          background-color: white;
           .twoOne {
-            height: 160px;
+            height: 30px;
+            width: 100%;
             overflow: hidden;
+            span:first-child {
+              float: left;
+              width: 65%;
+              text-align: left;
+              overflow: hidden;
+              text-overflow: ellipsis;
+              white-space: nowrap;
+              // font-weight: bold;
+            }
+            span:last-child {
+              float: right;
+              width: 30%;
+            }
           }
         }
         .three {

+ 7 - 2
src/layout/room/detailInfo.vue

@@ -10,11 +10,16 @@
             <el-form-item label="房间号" prop="name">
               <el-input v-model.number="form.name" placeholder="房间号必须是数字"></el-input>
             </el-form-item>
-            <el-form-item label="主" prop="anchorid">
-              <el-select v-model="form.anchorid" placeholder="请选择主" filterable>
+            <el-form-item label="主" prop="anchorid">
+              <el-select v-model="form.anchorid" placeholder="请选择主持人" filterable>
                 <el-option v-for="item in newlist" :key="item.id" :label="item.name" :value="item.id"> </el-option>
               </el-select>
             </el-form-item>
+            <el-form-item label="主讲人">
+              <el-checkbox-group v-model="form.zjr">
+                <el-checkbox v-for="item in newlist" :label="item.id" :key="item.id" :value="item.id">{{ item.name }}</el-checkbox>
+              </el-checkbox-group>
+            </el-form-item>
             <el-form-item label="直播时间" required>
               <el-col :span="9">
                 <el-form-item prop="starttime">

+ 4 - 0
src/store/room.js

@@ -69,6 +69,10 @@ const actions = {
     const res = await this.$axios.$post(`${api.roomInfo}/updateshmai`, info);
     return res;
   },
+  async switchzjr({ commit }, info) {
+    const res = await this.$axios.$post(`${api.roomInfo}/switchzjr`, info);
+    return res;
+  },
 };
 
 export default {

+ 1 - 0
src/views/room/detail.vue

@@ -27,6 +27,7 @@ export default {
   data: () => ({
     form: {
       adverts: [],
+      zjr: [],
     },
     newlist: [],
   }),