Bläddra i källkod

修改了一些问题

dusenyao 4 år sedan
förälder
incheckning
90b92aceab

+ 5 - 0
.eslintrc.js

@@ -12,6 +12,11 @@ module.exports = {
     es6: true
   },
 
+  globals: {
+    // 直播SDK
+    Rtc: true
+  },
+
   extends: ['plugin:vue/strongly-recommended', 'eslint:recommended', '@vue/prettier'],
 
   rules: {

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

@@ -10,7 +10,6 @@ let rtc;
  * @returns { object }
  */
 export function initSDK(data) {
-  // eslint-disable-next-line no-undef
   rtc = new Rtc(data);
   return rtc;
 }
@@ -45,6 +44,14 @@ export function initListener() {
     console.log(settingData);
   });
 
+  rtc.on('speak_context', function (speakData) {
+    console.log(speakData); // 人员列表事件(人员麦序变化时广播)
+  });
+
+  rtc.on('switch_settings', function (data) {
+    console.log(data); // 房间设置事件
+  });
+
   rtc.on('allow_sub', stream => {
     alert('监听到有流');
     rtc.trySubscribeStream({
@@ -57,6 +64,11 @@ export function initListener() {
       }
     });
   });
+
+  rtc.on('publishStreamErr', function (data) {
+    console.log('推流意外终止:' + data.streamName);
+    // 直播开启状态下,尝试重推这条流
+  });
 }
 
 /**
@@ -113,8 +125,24 @@ export function createLocalStream() {
 }
 
 /**
+ * @method closeVideo
+ * @description 结束本地流
+ */
+export function closeVideo() {
+  rtc.closeVideo({
+    streamName: 'main',
+    success: function () {
+      console.log('结束本地流成功');
+    },
+    fail: function (str) {
+      console.log(str);
+    }
+  });
+}
+
+/**
  * @method publishStream
- * @description 推流
+ * @description 推送本地
  */
 export function publishStream() {
   rtc.publish({
@@ -156,3 +184,67 @@ export function publishStream() {
 export function handsUp(data) {
   rtc.handsUp(data);
 }
+
+/**
+ * @method pauseAudio
+ * @description 关闭本地流声音
+ */
+export function pauseAudio() {
+  rtc.pauseAudio({
+    streamName: 'main',
+    success: function () {
+      console.log('关闭本地流声音成功');
+    },
+    fail: function (str) {
+      console.log(str);
+    }
+  });
+}
+
+/**
+ * @method playAudio
+ * @description 开启本地流声音
+ */
+export function playAudio() {
+  rtc.playAudio({
+    streamName: 'main',
+    success: function () {
+      console.log('开启本地流声音成功');
+    },
+    fail: function (str) {
+      console.log(str);
+    }
+  });
+}
+
+/**
+ * @method pauseVideo
+ * @description 关闭本地流视频画面
+ */
+export function pauseVideo() {
+  rtc.pauseVideo({
+    streamName: 'main',
+    success: function () {
+      console.log('关闭本地流视频画面成功');
+    },
+    fail: function (str) {
+      console.log(str);
+    }
+  });
+}
+
+/**
+ * @method playVideo
+ * @description 开启本地流视频画面
+ */
+export function playVideo() {
+  rtc.playVideo({
+    streamName: 'main',
+    success: function () {
+      console.log('开启本地流视频画面成功');
+    },
+    fail: function (str) {
+      console.log(str);
+    }
+  });
+}

+ 4 - 1
src/views/teacher/cs_item_detail/ClassroomTask.vue

@@ -175,7 +175,10 @@
                   <span>完成情况:</span>
                   <el-row>
                     <el-col :span="20">
-                      <circle-progress :total-count="100" :finish-count="66" />
+                      <circle-progress
+                        :total-count="list.student_count"
+                        :finish-count="list.student_count_finish_task"
+                      />
                     </el-col>
                     <el-col :span="4">
                       已完成 {{ list.student_count_finish_task }}/{{ list.student_count }}

+ 2 - 2
src/views/teacher/cs_item_detail/index.vue

@@ -115,9 +115,9 @@ export default {
     .cs-item-class-name {
       color: #a4a4a4;
       .el-button {
-        position: relative;
+        position: absolute;
         top: -24px;
-        right: -32px;
+        right: 0;
       }
     }
   }