liuyu 4 vuotta sitten
vanhempi
commit
a6dc082ce0
2 muutettua tiedostoa jossa 33 lisäystä ja 10 poistoa
  1. 29 10
      src/layout/live/detailInfo.vue
  2. 4 0
      src/store/room.js

+ 29 - 10
src/layout/live/detailInfo.vue

@@ -111,9 +111,10 @@
             <p>
               <i class="el-icon-user"></i>
               <span class="selfColor">{{ item.username }}</span>
-              <span v-if="item.switchrole === 'anchor'"
-                ><el-button type="danger" size="mini" @click="lookuserUpdate(item.id, 'audience')">移除</el-button></span
-              >
+              <span v-if="item.switchrole === 'anchor'">
+                <el-button type="danger" size="mini" @click="lookuserUpdate(item.id, 'audience')">移除</el-button>
+                <el-button type="primary" size="mini" @click="roomshangmai(item.userid)">主讲</el-button>
+              </span>
               <span v-else><el-button type="primary" size="mini" @click="lookuserUpdate(item.id, 'anchor')">连麦</el-button></span>
             </p>
           </el-col>
@@ -154,7 +155,8 @@ export default {
       client_: '',
       localStream_: '',
       sdkAppId_: '1400380125',
-      userId_: '1111',
+      userId_: '',
+      userMainId_: '',
       open_: false,
       content: '',
       dataList: [],
@@ -184,8 +186,21 @@ export default {
   methods: {
     ...gensign(['gensignFetch']),
     ...chat(['query', 'create', 'fetch']),
-    ...room(['startrecord', 'stoprecord', 'roomquest', 'roomquestclose', 'questquery', 'updateanchor']),
+    ...room(['startrecord', 'stoprecord', 'roomquest', 'roomquestclose', 'questquery', 'updateanchor', 'updateshmai']),
     ...lookuser(['lookquery', 'lookupdate']),
+    async roomshangmai(dataid) {
+      const data = {};
+      data.id = this.id;
+      data.shmaiid = dataid;
+      const res = await this.updateshmai(data);
+      if (this.$checkRes(res)) {
+        console.log(res.data);
+        this.$message({
+          message: '操作成功',
+          type: 'success',
+        });
+      }
+    },
     async queCreate() {
       const data = {};
       data.roomid = this.id;
@@ -286,19 +301,20 @@ export default {
     },
     async initclient() {
       console.log(this.user.uid);
+      this.userId_ = this.user.uid;
       if (this.anchorid === this.user.uid) {
         this.showbtn_ = true;
-        this.userId_ = 'mainr-' + this.user.uid;
+        this.userMainId_ = 'mainr-' + this.user.uid;
       } else {
-        this.userId_ = 'other-' + this.user.uid;
+        this.userMainId_ = 'other-' + this.user.uid;
       }
-      const res = await this.gensignFetch({ userid: this.userId_ });
+      const res = await this.gensignFetch({ userid: this.userMainId_ });
       if (this.$checkRes(res)) {
         console.log(res.data);
         this.client_ = TRTC.createClient({
           mode: 'live',
           sdkAppId: this.sdkAppId_,
-          userId: this.userId_,
+          userId: this.userMainId_,
           userSig: res.data,
         });
       }
@@ -319,7 +335,7 @@ export default {
         video: true,
         cameraId: this.cameraId,
         microphoneId: this.microphoneId,
-        userId: this.userId_,
+        userId: this.userMainId_,
       });
       this.localStream_.setVideoProfile('480p');
       await this.localStream_.initialize();
@@ -361,6 +377,9 @@ export default {
           } else if (usersplit_ === 'wxxcx') {
             const id_ = 'look-video-' + usertempid_;
             remoteStream.play(id_);
+          } else if (usersplit_ === 'meetu') {
+            const id_ = 'look-video-' + usertempid_;
+            remoteStream.play(id_);
           }
         }
       });

+ 4 - 0
src/store/room.js

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