dusenyao 3 năm trước cách đây
mục cha
commit
5ec3333cf1

+ 2 - 2
src/views/live/common.js

@@ -41,10 +41,10 @@ export function updateMcResult(stid, pid) {
   rtc.updateMcResult({
     pid,
     stid,
-    success: function (data) {
+    success(data) {
       console.log('更新上麦结果请求成功,此处可处理应用层逻辑', data);
     },
-    fail: function (data) {
+    fail(data) {
       console.log('更新上麦结果请求失败:' + JSON.stringify(data));
     }
   });

+ 11 - 6
src/views/live/teacher/index.vue

@@ -236,7 +236,6 @@ export default {
       task_id: this.$route.query.task_id,
       // 连麦
       connect: false,
-      connectStudent: {},
       // 等待接通
       callLoading: false,
       dialogVisible: false,
@@ -312,6 +311,10 @@ export default {
         return '#6aee4c';
       }
       return '#38d514';
+    },
+    connectStudent() {
+      let connect = this.student_list.find(item => item.deal_mode !== 0);
+      return connect || {};
     }
   },
   watch: {
@@ -458,7 +461,6 @@ export default {
         return;
       }
       this.callLoading = true;
-      this.connectStudent = student;
       GetLiveRoomInfo({ task_id: this.task_id })
         .then(({ video_mode }) => {
           let uid = student.room_user_id;
@@ -474,7 +476,6 @@ export default {
               },
               roomUpdateFailed: data => {
                 this.callLoading = false;
-                this.connectStudent = '';
                 this.$message.error('连麦音视频模式更新请求失败! 请稍后再试!');
               }
             });
@@ -482,7 +483,6 @@ export default {
         })
         .catch(() => {
           this.callLoading = false;
-          this.connectStudent = '';
         });
     },
 
@@ -527,10 +527,14 @@ export default {
               uid: this.connectStudent.room_user_id
             });
           }
-          this.dealStudentConnection(this.connectStudent.room_user_id, 0, this.roomInfo.video_mode);
+
+          this.dealStudentConnection(
+            this.connectStudent.room_user_id,
+            0,
+            this.connectStudent.connection_mode
+          );
 
           this.callLoading = false;
-          this.connectStudent = '';
           common.updateMcResult('', 0);
           this.$message.success('下麦成功');
         },
@@ -538,6 +542,7 @@ export default {
           this.callLoading = false;
           this.connect = false;
           console.log('下麦失败', data);
+          this.$message.warning(`下麦失败:${data.errorMsg}`);
         }
       });
     },

+ 1 - 1
src/views/live/teacher/live.js

@@ -265,7 +265,7 @@ export function initListener(vue) {
     console.log('监听通知移除流事件', stream);
     vue.connect = false;
     vue.remoteStreamType = -1;
-    if (typeof vue.connectStudent === 'object' && stream.streamType() === 10) {
+    if ('room_user_id' in vue.connectStudent && stream.streamType() === 10) {
       vue.handsDown();
     }
   });