|
@@ -6,6 +6,7 @@
|
|
|
<div class="live-title-name">{{ roomInfo.cs_item_name }} {{ roomInfo.task_name }}</div>
|
|
|
<div>
|
|
|
<el-button @click="stopGroup">结束群组讨论</el-button>
|
|
|
+ <el-button v-show="isGroup" @click="exitCurGroup_Teacher">退出小组讨论</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="live-course-name">{{ roomInfo.course_name }}</div>
|
|
@@ -20,9 +21,9 @@
|
|
|
<div class="live-container">
|
|
|
<!-- 左侧 -->
|
|
|
<div class="live-container-left">
|
|
|
- <div class="group">
|
|
|
+ <div v-show="!isGroup" class="group">
|
|
|
<template v-for="(item, i) in group_list">
|
|
|
- <div :key="item.room_id" class="group-list">
|
|
|
+ <div :key="item.room_id" class="group-list" @click="enterGroup(item.group_id)">
|
|
|
<div class="group-serial">{{ i + 1 }}</div>
|
|
|
<div class="group-list-avatar">
|
|
|
<el-avatar
|
|
@@ -35,6 +36,14 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
+ <div v-show="isGroup" class="group-discussion">
|
|
|
+ <div
|
|
|
+ v-for="(item, i) in streamList"
|
|
|
+ :id="`group-${i}`"
|
|
|
+ :key="item.id()"
|
|
|
+ class="group-box"
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
<div class="button-group">
|
|
|
<div class="button-group-left">
|
|
|
<span class="stop-group" @click="stopGroup">结束群组讨论</span>
|
|
@@ -89,15 +98,25 @@
|
|
|
<div class="student-list">
|
|
|
<div class="student-list-title">小组列表</div>
|
|
|
<ul>
|
|
|
- <template v-for="item in group_list">
|
|
|
- <li v-for="el in item.student_list" :key="el.student_id">
|
|
|
+ <template v-if="isGroup">
|
|
|
+ <li v-for="item in student_list" :key="item.room_user_id">
|
|
|
<div class="student-list-left">
|
|
|
- <el-avatar icon="el-icon-user" size="small" :src="el.student_image_url" />
|
|
|
- <span class="name">{{ el.student_name }}</span>
|
|
|
+ <el-avatar icon="el-icon-user" size="small" :src="item.student_image_url" />
|
|
|
+ <span class="name">{{ item.student_name }}</span>
|
|
|
</div>
|
|
|
- <div class="student-list-right"></div>
|
|
|
</li>
|
|
|
</template>
|
|
|
+ <template v-else>
|
|
|
+ <template v-for="item in group_list">
|
|
|
+ <li v-for="el in item.student_list" :key="el.student_id">
|
|
|
+ <div class="student-list-left">
|
|
|
+ <el-avatar icon="el-icon-user" size="small" :src="el.student_image_url" />
|
|
|
+ <span class="name">{{ el.student_name }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="student-list-right"></div>
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -111,14 +130,18 @@ import {
|
|
|
StudentExitLiveRoom,
|
|
|
StopGroup,
|
|
|
GetGroupInfo_Teacher,
|
|
|
- CreateEnterLiveRoomSession
|
|
|
+ CreateEnterLiveRoomSession,
|
|
|
+ JoinGroup_Teacher,
|
|
|
+ ExitCurGroup_Teacher,
|
|
|
+ GetMyGroupInfo_Teacher
|
|
|
} from '@/api/live';
|
|
|
-import * as common from './live';
|
|
|
+import * as common from './group';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
task_id: this.$route.query.task_id,
|
|
|
+ isGroup: false,
|
|
|
// 定时器
|
|
|
timer: null,
|
|
|
rtc: null,
|
|
@@ -155,29 +178,39 @@ export default {
|
|
|
live_room_sys_user_id: '',
|
|
|
// 直播状态
|
|
|
liveStat: false,
|
|
|
- liveMenuShow: false
|
|
|
+ liveMenuShow: false,
|
|
|
+ room_id: '',
|
|
|
+ session_id: '',
|
|
|
+ streamList: [],
|
|
|
+ student_list: []
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
loadedNumber(newVal) {
|
|
|
- if (newVal === 5) {
|
|
|
- common.createScript(
|
|
|
- 'https://class.csslcloud.net/static/SDK/docSDK/drawSdk_3.0.js'
|
|
|
- ).onload = () => {
|
|
|
- const { room_id, session_id } = this.$route.query;
|
|
|
- this.rtc = common.initSDK({
|
|
|
- userid: this.live_room_sys_user_id,
|
|
|
- roomid: room_id,
|
|
|
- sessionid: session_id
|
|
|
- });
|
|
|
- common.initListener(this); // 注册监听事件
|
|
|
- this.$loading().close();
|
|
|
- };
|
|
|
+ if (newVal === 2) {
|
|
|
+ console.log(this.room_id);
|
|
|
+ if (!this.room_id || !this.session_id) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(1);
|
|
|
+ this.rtc = common.initSDK({
|
|
|
+ userid: this.live_room_sys_user_id,
|
|
|
+ roomid: this.room_id,
|
|
|
+ sessionid: this.session_id
|
|
|
+ });
|
|
|
+ common.initListener(this); // 注册监听事件
|
|
|
+ this.loadedNumber = 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ streamList(newVal) {
|
|
|
+ if (newVal.length > 0) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ newVal[newVal.length - 1].show(`group-${newVal.length - 1}`);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- // common.downloadWebSDK(this);
|
|
|
this.getLiveRoomInfo();
|
|
|
GetGroupInfo_Teacher({ task_id: this.task_id }).then(
|
|
|
({ live_room_sys_user_id, group_list }) => {
|
|
@@ -187,8 +220,10 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- clearInterval(this.timer);
|
|
|
common.closeVideo('main');
|
|
|
+ this.streamList.forEach(item => {
|
|
|
+ common.unSubscribeStream(item);
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
getLiveRoomInfo() {
|
|
@@ -256,6 +291,35 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+ },
|
|
|
+
|
|
|
+ enterGroup(group_id) {
|
|
|
+ JoinGroup_Teacher({ task_id: this.task_id, group_id })
|
|
|
+ .then(({ room_id, session_id }) => {
|
|
|
+ console.log(room_id, session_id);
|
|
|
+ this.room_id = room_id;
|
|
|
+ this.session_id = session_id;
|
|
|
+ common.downloadWebSDK(this);
|
|
|
+ this.isGroup = true;
|
|
|
+ return GetMyGroupInfo_Teacher({ task_id: this.task_id });
|
|
|
+ })
|
|
|
+ .then(({ student_list }) => {
|
|
|
+ this.student_list = student_list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ exitCurGroup_Teacher() {
|
|
|
+ ExitCurGroup_Teacher({ task_id: this.task_id }).then(() => {
|
|
|
+ this.isGroup = false;
|
|
|
+ this.room_id = '';
|
|
|
+ this.session_id = '';
|
|
|
+ common.closeVideo('main');
|
|
|
+ this.streamList.forEach(item => {
|
|
|
+ common.unSubscribeStream(item);
|
|
|
+ });
|
|
|
+ this.streamList = [];
|
|
|
+ this.$message.success('退出小组讨论成功');
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -334,6 +398,7 @@ $live-bc: #3d3938;
|
|
|
width: 253px;
|
|
|
height: 144px;
|
|
|
margin-right: 8px;
|
|
|
+ cursor: pointer;
|
|
|
|
|
|
&-avatar {
|
|
|
display: flex;
|
|
@@ -358,6 +423,23 @@ $live-bc: #3d3938;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 分组讨论
|
|
|
+ .group-discussion {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ width: 100%;
|
|
|
+ height: 468px;
|
|
|
+ position: relative;
|
|
|
+ background-color: $live-bc;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .group-box {
|
|
|
+ width: 256px;
|
|
|
+ height: 144px;
|
|
|
+ margin: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.button-group {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|