|
@@ -0,0 +1,506 @@
|
|
|
+<template>
|
|
|
+ <div class="live">
|
|
|
+ <!--顶部-->
|
|
|
+ <div class="live-top">
|
|
|
+ <div class="live-title">
|
|
|
+ <div class="live-title-name">{{ roomInfo.cs_item_name }} {{ roomInfo.task_name }}</div>
|
|
|
+ <div>
|
|
|
+ <el-button @click="stopGroup">结束群组讨论</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="live-course-name">{{ roomInfo.course_name }}</div>
|
|
|
+ <div class="live-teacher">
|
|
|
+ <span class="live-teacher-name">
|
|
|
+ <svg-icon icon-class="person" />{{ roomInfo.teacher_name }}
|
|
|
+ </span>
|
|
|
+ <span><svg-icon icon-class="people" />{{ roomInfo.student_count }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 主容器 -->
|
|
|
+ <div class="live-container">
|
|
|
+ <!-- 左侧 -->
|
|
|
+ <div class="live-container-left">
|
|
|
+ <div class="group">
|
|
|
+ <template v-for="(item, i) in group_list">
|
|
|
+ <div :key="item.room_id" class="group-list">
|
|
|
+ <div class="group-serial">{{ i + 1 }}</div>
|
|
|
+ <div class="group-list-avatar">
|
|
|
+ <el-avatar
|
|
|
+ v-for="li in item.student_list"
|
|
|
+ :key="li.student_id"
|
|
|
+ icon="el-icon-user"
|
|
|
+ :src="li.student_image_url"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="button-group">
|
|
|
+ <div class="button-group-left">
|
|
|
+ <span class="stop-group" @click="stopGroup">结束群组讨论</span>
|
|
|
+ </div>
|
|
|
+ <div class="button-group-right"></div>
|
|
|
+ </div>
|
|
|
+ <div class="live-container-left-chat">
|
|
|
+ <div class="chat-top">
|
|
|
+ <span>聊天</span>
|
|
|
+ <!-- <label @click="chatBans">
|
|
|
+ <input v-model="roomData.allow_chat" type="checkbox" class="allow-chat" />
|
|
|
+ <span>禁言</span>
|
|
|
+ </label> -->
|
|
|
+ </div>
|
|
|
+ <div class="chat-window">
|
|
|
+ <ul class="chat-window-ul">
|
|
|
+ <li v-for="(item, i) in chatList" :key="i">
|
|
|
+ <div class="msg-normal">
|
|
|
+ <span>{{ item.username }}: </span>
|
|
|
+ <span>{{ item.msg }}</span>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="chat-speak">
|
|
|
+ <el-input
|
|
|
+ v-model="msg"
|
|
|
+ placeholder="输入发言"
|
|
|
+ maxlength="400"
|
|
|
+ @keydown.enter.native="sendMsg"
|
|
|
+ >
|
|
|
+ <el-button slot="append" @click="sendMsg">发送</el-button>
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 右侧 -->
|
|
|
+ <div class="live-container-right">
|
|
|
+ <div
|
|
|
+ class="live-teacher-lens"
|
|
|
+ @mouseover="liveMenuShow = true"
|
|
|
+ @mouseout="liveMenuShow = false"
|
|
|
+ >
|
|
|
+ <div id="live"></div>
|
|
|
+ <div :style="{ bottom: liveMenuShow ? '0' : '-40px' }" class="live-wrapper">
|
|
|
+ <div>
|
|
|
+ {{ roomInfo.teacher_name }}
|
|
|
+ </div>
|
|
|
+ <div></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <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">
|
|
|
+ <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>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { GetLiveRoomInfo, StudentExitLiveRoom, StopGroup, GetGroupInfo_Teacher } from '@/api/live';
|
|
|
+import * as common from './live';
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ task_id: this.$route.query.task_id,
|
|
|
+ // 定时器
|
|
|
+ timer: null,
|
|
|
+ rtc: null,
|
|
|
+ roomData: {
|
|
|
+ desc: '直播间标题',
|
|
|
+ name: '姓名',
|
|
|
+ user: {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ role: 'talker',
|
|
|
+ rommid: ''
|
|
|
+ },
|
|
|
+ max_users: 1,
|
|
|
+ allow_chat: true,
|
|
|
+ allow_audio: true,
|
|
|
+ allow_speak: true
|
|
|
+ },
|
|
|
+ roomInfo: {
|
|
|
+ room_id: '',
|
|
|
+ video_mode: 1,
|
|
|
+ task_name: '',
|
|
|
+ cs_item_name: '',
|
|
|
+ course_name: '',
|
|
|
+ teacher_name: '',
|
|
|
+ student_count: 0
|
|
|
+ },
|
|
|
+ loadedNumber: 0,
|
|
|
+ speakData: {},
|
|
|
+ roomContext: {},
|
|
|
+ msg: '',
|
|
|
+ chatList: [],
|
|
|
+ // 小组列表
|
|
|
+ group_list: [],
|
|
|
+ live_room_sys_user_id: '',
|
|
|
+ // 直播状态
|
|
|
+ liveStat: false,
|
|
|
+ liveMenuShow: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ 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();
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // common.downloadWebSDK(this);
|
|
|
+ this.getLiveRoomInfo();
|
|
|
+ GetGroupInfo_Teacher({ task_id: this.task_id }).then(
|
|
|
+ ({ live_room_sys_user_id, group_list }) => {
|
|
|
+ this.group_list = group_list;
|
|
|
+ this.live_room_sys_user_id = live_room_sys_user_id;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ common.closeVideo('main');
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getLiveRoomInfo() {
|
|
|
+ GetLiveRoomInfo({ task_id: this.task_id }).then(
|
|
|
+ ({
|
|
|
+ room_id,
|
|
|
+ video_mode,
|
|
|
+ task_name,
|
|
|
+ cs_item_name,
|
|
|
+ course_name,
|
|
|
+ teacher_name,
|
|
|
+ student_count
|
|
|
+ }) => {
|
|
|
+ this.roomInfo = {
|
|
|
+ room_id,
|
|
|
+ video_mode,
|
|
|
+ task_name,
|
|
|
+ cs_item_name,
|
|
|
+ course_name,
|
|
|
+ teacher_name,
|
|
|
+ student_count
|
|
|
+ };
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ // 发消息
|
|
|
+ sendMsg() {
|
|
|
+ common.sendMsg(this.msg);
|
|
|
+ this.msg = '';
|
|
|
+ },
|
|
|
+
|
|
|
+ chatBans() {
|
|
|
+ common.roomUpdate({
|
|
|
+ allow_chat: !this.roomData.allow_chat,
|
|
|
+ roomUpdateSuccess: function (data) {
|
|
|
+ console.log(data, '房间模板配置更新请求成功!');
|
|
|
+ },
|
|
|
+ roomUpdateFailed: function (data) {
|
|
|
+ console.log(data, '房间模板配置更新请求失败! 请稍后再试!');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ studentExitLiveRoom(room_user_id) {
|
|
|
+ StudentExitLiveRoom({ task_id: this.task_id, room_user_id });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 分组讨论
|
|
|
+ stopGroup() {
|
|
|
+ StopGroup({ task_id: this.task_id }).then(() => {
|
|
|
+ this.$message.success('结束分组讨论成功');
|
|
|
+ const {
|
|
|
+ room_info: { live_room_sys_user_id, room_id, session_id, room_user_id }
|
|
|
+ } = this.$route.query;
|
|
|
+ this.$router.push({
|
|
|
+ path: '/live/teacher',
|
|
|
+ query: {
|
|
|
+ live_room_sys_user_id,
|
|
|
+ room_id,
|
|
|
+ session_id,
|
|
|
+ task_id: this.task_id,
|
|
|
+ room_user_id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+@import '~@/styles/mixin.scss';
|
|
|
+$live-bc: #3d3938;
|
|
|
+
|
|
|
+.live {
|
|
|
+ @include container;
|
|
|
+
|
|
|
+ // 顶部
|
|
|
+ &-top {
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 24px 32px;
|
|
|
+ border-top-left-radius: 8px;
|
|
|
+ border-top-right-radius: 8px;
|
|
|
+
|
|
|
+ .live-title {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ &-name {
|
|
|
+ font-size: 22px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 7px 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .live-course-name {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #737373;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .live-teacher {
|
|
|
+ margin-top: 12px;
|
|
|
+
|
|
|
+ .svg-icon {
|
|
|
+ margin-right: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-name {
|
|
|
+ margin-right: 60px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 主容器
|
|
|
+ &-container {
|
|
|
+ display: flex;
|
|
|
+ justify-content: left;
|
|
|
+
|
|
|
+ &-left {
|
|
|
+ width: 832px;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 8px;
|
|
|
+
|
|
|
+ .group {
|
|
|
+ width: 100%;
|
|
|
+ height: 468px;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ background-color: #4d4d4d;
|
|
|
+ overflow: hidden;
|
|
|
+ padding: 10px 24px;
|
|
|
+
|
|
|
+ &-list {
|
|
|
+ background-color: #646464;
|
|
|
+ position: relative;
|
|
|
+ padding: 24px;
|
|
|
+ width: 253px;
|
|
|
+ height: 144px;
|
|
|
+ margin-right: 8px;
|
|
|
+
|
|
|
+ &-avatar {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-around;
|
|
|
+ align-items: center;
|
|
|
+ margin-top: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .group-serial {
|
|
|
+ position: absolute;
|
|
|
+ display: inline-block;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ height: 24px;
|
|
|
+ width: 24px;
|
|
|
+ color: #fff;
|
|
|
+ background-color: #3d3d3d;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 24px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .button-group {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 48px;
|
|
|
+ background-color: #4d4d4d;
|
|
|
+ padding: 0 15px;
|
|
|
+ border-bottom-left-radius: 5px;
|
|
|
+
|
|
|
+ .svg-icon {
|
|
|
+ font-size: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-left {
|
|
|
+ .stop-group {
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ > span {
|
|
|
+ display: inline-block;
|
|
|
+ height: 100%;
|
|
|
+ padding: 14px 16px;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ &:active,
|
|
|
+ &:hover {
|
|
|
+ background-color: #3d3d3d;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 聊天窗口
|
|
|
+ &-chat {
|
|
|
+ height: 278px;
|
|
|
+ border: 1px solid #ccc;
|
|
|
+ border-bottom-left-radius: 8px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .chat-top {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 15px 15px 10px;
|
|
|
+ border-bottom: 1px solid #e6e6e6;
|
|
|
+ color: #959595;
|
|
|
+
|
|
|
+ label {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .allow-chat {
|
|
|
+ margin-right: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .chat-window {
|
|
|
+ position: relative;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ &-ul {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow: auto;
|
|
|
+
|
|
|
+ .msg-normal {
|
|
|
+ padding: 7px 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .chat-speak {
|
|
|
+ padding: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &-right {
|
|
|
+ padding: 8px;
|
|
|
+ background-color: #2c2c2c;
|
|
|
+ border-end-end-radius: 8px;
|
|
|
+
|
|
|
+ .live-teacher-lens {
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ #live {
|
|
|
+ width: 352px;
|
|
|
+ height: 198px;
|
|
|
+ background-color: $live-bc;
|
|
|
+ }
|
|
|
+
|
|
|
+ .live-wrapper {
|
|
|
+ position: absolute;
|
|
|
+ height: 40px;
|
|
|
+ width: 100%;
|
|
|
+ background-color: #000;
|
|
|
+ opacity: 0.7;
|
|
|
+ color: #fff;
|
|
|
+ line-height: 40px;
|
|
|
+ padding: 0 16px;
|
|
|
+ transition: all 300ms ease-in 0s;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 学员列表
|
|
|
+ .student-list {
|
|
|
+ width: 100%;
|
|
|
+ padding: 24px 16px;
|
|
|
+ margin-top: 2px;
|
|
|
+ height: calc(100% - 200px);
|
|
|
+ background-color: #2c2c2c;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #fff;
|
|
|
+
|
|
|
+ &-title {
|
|
|
+ margin-bottom: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ li {
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 16px;
|
|
|
+
|
|
|
+ .student-list-left {
|
|
|
+ flex: 8;
|
|
|
+
|
|
|
+ .name {
|
|
|
+ vertical-align: super;
|
|
|
+ margin-left: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .student-list-right {
|
|
|
+ flex: 2;
|
|
|
+
|
|
|
+ .svg-icon {
|
|
|
+ font-size: 18px;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-top: 7px;
|
|
|
+ margin-right: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|