dusenyao 4 年之前
父节点
当前提交
a3f8600cdf
共有 3 个文件被更改,包括 25 次插入31 次删除
  1. 15 7
      src/views/live/student/group.vue
  2. 8 22
      src/views/live/student/index.vue
  3. 2 2
      src/views/live/teacher/index.vue

+ 15 - 7
src/views/live/student/group.vue

@@ -111,7 +111,10 @@ export default {
   data() {
     return {
       task_id: this.$route.query.task_id,
-      room_user_id: this.$route.query.live_room_sys_user_id,
+      room_user_id: '',
+      session_id: '',
+      live_room_sys_user_id: '',
+      room_id: '',
       // 定时器
       timer: null,
       rtc: null,
@@ -159,11 +162,10 @@ export default {
         common.createScript(
           'https://class.csslcloud.net/static/SDK/docSDK/drawSdk_3.0.js'
         ).onload = () => {
-          const { live_room_sys_user_id, room_id, sessionid } = this.$route.query;
           this.rtc = common.initSDK({
-            userid: live_room_sys_user_id,
-            roomid: room_id,
-            sessionid
+            userid: this.live_room_sys_user_id,
+            roomid: this.room_id,
+            sessionid: this.session_id
           });
           common.initListener(this); // 注册监听事件
           this.getLiveStat();
@@ -184,7 +186,6 @@ export default {
     this.getMyGroupInfo_Student();
   },
   mounted() {
-    common.downloadWebSDK(this);
     this.GetGroupStatus();
   },
   beforeDestroy() {
@@ -290,8 +291,15 @@ export default {
     getMyGroupInfo_Student() {
       GetMyGroupInfo_Student({
         task_id: this.task_id
-      }).then(({ student_list }) => {
+      }).then(({ live_room_sys_user_id, room_id, student_list }) => {
+        let data = student_list.find(el => {
+          return el.is_self === 'true';
+        });
+        this.session_id = data.session_id;
+        this.live_room_sys_user_id = live_room_sys_user_id;
+        this.room_id = room_id;
         this.student_list = student_list;
+        common.downloadWebSDK(this);
       });
     }
   }

+ 8 - 22
src/views/live/student/index.vue

@@ -134,7 +134,6 @@ import {
   GetCurMaterialSent,
   GetLiveRoomInfo,
   GetGroupStatus,
-  GetMyGroupInfo_Student,
   CreateEnterLiveRoomSession
 } from '@/api/live';
 import CurMaterial from '@/components/live/CurMaterial.vue';
@@ -232,7 +231,10 @@ export default {
 
     GetGroupStatus({ task_id: this.task_id }).then(({ is_enable_group }) => {
       if (is_enable_group === 'true') {
-        this.getMyGroupInfo_Student();
+        this.$router.push({
+          path: '/live/student/group',
+          query: { task_id: this.task_id }
+        });
       } else {
         this.$loading({
           text: '加载直播所需SDK中...',
@@ -366,7 +368,10 @@ export default {
           .then(({ is_enable_group }) => {
             if (is_enable_group === 'true') {
               clearInterval(this.timer_group);
-              this.getMyGroupInfo_Student();
+              this.$router.push({
+                path: '/live/student/group',
+                query: { task_id: this.task_id }
+              });
             }
           })
           .catch(() => {
@@ -375,25 +380,6 @@ export default {
       }, 5000);
     },
 
-    getMyGroupInfo_Student() {
-      GetMyGroupInfo_Student({
-        task_id: this.task_id
-      }).then(({ live_room_sys_user_id, room_id, student_list }) => {
-        let data = student_list.find(el => {
-          return el.is_self === 'true';
-        });
-        this.$router.push({
-          path: '/live/student/group',
-          query: {
-            task_id: this.task_id,
-            live_room_sys_user_id,
-            room_id,
-            sessionid: data.session_id
-          }
-        });
-      });
-    },
-
     // 弹出框方法
     dialogMaterialClose() {
       this.dialogVisibleMaterial = false;

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

@@ -261,7 +261,7 @@ export default {
       liveMenuShow: false,
       // 分组讨论
       groupNumList: [],
-      group_count: 2,
+      group_count: 1,
       dialogVisibleGroup: false
     };
   },
@@ -532,7 +532,7 @@ export default {
     startGroup() {
       let num = Math.ceil(this.student_list.length / 2);
       num = num < 2 ? 2 : num;
-      for (let i = 2; i <= num; i++) {
+      for (let i = 1; i <= num; i++) {
         this.groupNumList.push(i);
       }
       this.dialogVisibleGroup = true;