Explorar o código

修改一些细节

dusenyao %!s(int64=4) %!d(string=hai) anos
pai
achega
e29f19dc4a

BIN=BIN
GCLS-Learn_Web.zip


+ 0 - 1
public/index.html

@@ -12,6 +12,5 @@
       <strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
     </noscript>
     <div id="app"></div>
-    <!-- <script src="https://class.csslcloud.net/static/dist/js/websdk_4.0.js"></script> -->
   </body>
 </html>

+ 1 - 0
src/components/select/SelectCourse.vue

@@ -130,6 +130,7 @@ export default {
   }
 
   .el-dropdown-link {
+    cursor: pointer;
     font-size: 24px;
     color: $color;
     font-weight: 600;

+ 7 - 0
src/icons/svg/people.svg

@@ -0,0 +1,7 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M24 0H0V24H24V0Z" fill="white" fill-opacity="0.01"/>
+<path d="M9.5 10C11.433 10 13 8.433 13 6.5C13 4.56701 11.433 3 9.5 3C7.567 3 6 4.56701 6 6.5C6 8.433 7.567 10 9.5 10Z" stroke="#2C2C2C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M16.3038 3.5C17.3202 4.11245 18 5.22685 18 6.5C18 7.77315 17.3202 8.88755 16.3038 9.5" stroke="#2C2C2C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M2 20.4V21H17V20.4C17 18.1598 17 17.0397 16.5641 16.184C16.1806 15.4314 15.5686 14.8195 14.816 14.436C13.9603 14 12.8402 14 10.6 14H8.4C6.1598 14 5.0397 14 4.18404 14.436C3.43139 14.8195 2.81947 15.4314 2.43598 16.184C2 17.0397 2 18.1598 2 20.4Z" stroke="#2C2C2C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+<path d="M22 20.9996V20.3996C22 18.1594 22 17.0393 21.564 16.1836C21.1805 15.431 20.5686 14.819 19.8159 14.4355" stroke="#2C2C2C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 6 - 0
src/icons/svg/person.svg

@@ -0,0 +1,6 @@
+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M24 0H0V24H24V0Z" fill="white" fill-opacity="0.01"/>
+<path d="M12 11C14.4853 11 16.5 8.98528 16.5 6.5C16.5 4.01472 14.4853 2 12 2C9.51472 2 7.5 4.01472 7.5 6.5C7.5 8.98528 9.51472 11 12 11Z" stroke="#333333" stroke-width="1.5" stroke-linejoin="round"/>
+<path d="M2.5 22C2.5 17.7812 5.5875 13.8438 8.2 13C8.2 13 10.575 15.5312 12 17.2188L15.8 13C17.9375 13.2812 21.5 17.7812 21.5 22" stroke="#333333" stroke-width="1.5" stroke-linejoin="round"/>
+<path d="M1 22H23" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>

+ 132 - 36
src/views/live/index.vue

@@ -2,21 +2,26 @@
   <div class="live">
     <!--顶部-->
     <div class="live-top">
-      <div class="live-page-title">直播间</div>
-      <div class="live-desc">{{ roomData.desc }}</div>
-      <div class="live-info">
-        <div>
-          <span class="live-name">{{ roomData.name }}</span>
-        </div>
+      <div class="live-title">
+        <div class="live-title-name">{{ roomInfo.cs_item_name }} {{ roomInfo.task_name }}</div>
         <div>
           <!-- <el-button @click="playAudio">开启本地流声音</el-button> -->
           <template v-if="userType === 'TEACHER'">
             <el-button v-if="!liveStat" @click="startLive">开启直播</el-button>
-            <el-button v-if="liveStat" @click="closeLiveRoom">结束直播</el-button>
+            <el-button v-if="liveStat" icon="el-icon-switch-button" @click="closeLiveRoom">
+              结束直播
+            </el-button>
             <el-button v-if="liveStat" @click="publishStream">推流</el-button>
           </template>
         </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">
@@ -90,16 +95,25 @@
               placeholder="输入发言"
               maxlength="400"
               @keydown.enter.native="sendMsg"
-            ></el-input>
+            >
+              <el-button slot="append" @click="sendMsg">发送</el-button>
+            </el-input>
           </div>
         </div>
       </div>
       <!-- 右侧 -->
       <div class="live-container-right">
-        <div class="live-teacher-lens">
+        <div class="live-teacher-lens" @mouseover="liveWrapperOver" @mouseout="liveWrapperOut">
           <div id="live"></div>
+          <div v-show="liveMenuShow" class="live-wrapper">
+            <div>
+              {{ roomInfo.teacher_name }}
+            </div>
+            <div></div>
+          </div>
         </div>
         <div class="student-list">
+          <div class="student-list-title">学生列表</div>
           <ul>
             <li v-for="item in student_list" :key="item.room_user_id">
               <div class="student-list-left">
@@ -204,6 +218,15 @@ export default {
         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: {},
@@ -215,7 +238,8 @@ export default {
       // 直播间学员列表
       student_list: [],
       // 直播状态
-      liveStat: false
+      liveStat: false,
+      liveMenuShow: false
     };
   },
   computed: {
@@ -225,8 +249,8 @@ export default {
     }
   },
   watch: {
-    loadedNumber(newValue) {
-      if (newValue === 5) {
+    loadedNumber(newVal) {
+      if (newVal === 5) {
         this.initSDK();
         this.$loading().close();
       }
@@ -235,6 +259,7 @@ export default {
   created() {
     this.downloadWebSDK();
     this.getLiveRoomStudentList();
+    this.getLiveRoomInfo();
   },
   mounted() {
     document.addEventListener(
@@ -262,6 +287,14 @@ export default {
       this.getCurMaterialSent();
     }
   },
+  beforeDestroy() {
+    // 清除所有定时器
+    // let end = setInterval(() => {}, 1000);
+    // for (let i = 1; i <= end; i++) {
+    //   clearInterval(i);
+    // }
+    CloseLiveRoom({ task_id: this.task_id });
+  },
   methods: {
     // 加载直播所需 SDK,加载完成后才能初始化
     downloadWebSDK() {
@@ -329,10 +362,34 @@ export default {
       this.getLiveStat();
     },
 
+    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
+          };
+        }
+      );
+    },
+
     closeLiveRoom() {
       CloseLiveRoom({ task_id: this.task_id }).then(() => {
-        this.$message.success('关闭直播成功');
         this.$router.push('/');
+        this.$message.success('关闭直播成功');
       });
     },
 
@@ -411,7 +468,7 @@ export default {
 
     chatBans() {
       common.roomUpdate({
-        allow_chat: this.roomData.allow_chat,
+        allow_chat: !this.roomData.allow_chat,
         roomUpdateSuccess: function (data) {
           console.log(data, '房间模板配置更新请求成功!');
         },
@@ -472,6 +529,14 @@ export default {
       this.dialogVisibleComplete = false;
     },
 
+    liveWrapperOver() {
+      this.liveMenuShow = true;
+    },
+
+    liveWrapperOut() {
+      this.liveMenuShow = false;
+    },
+
     getCurMaterialSent() {
       const timer = setInterval(() => {
         GetCurMaterialSent({ task_id: this.task_id })
@@ -501,37 +566,47 @@ $live-bc: #3d3938;
 .live {
   @include container;
 
+  // 顶部
   &-top {
     background-color: #fff;
     padding: 24px 32px;
     border-top-left-radius: 8px;
     border-top-right-radius: 8px;
-  }
 
-  &-page-title {
-    font-size: 12px;
-  }
+    .live-title {
+      display: flex;
+      justify-content: space-between;
 
-  &-desc {
-    margin: 17px 0 8px;
-  }
+      &-name {
+        font-size: 22px;
+      }
 
-  &-info {
-    display: flex;
-    justify-content: space-between;
+      .el-button {
+        border-radius: 4px;
+        padding: 7px 12px;
+      }
+    }
 
-    .el-button {
-      border-radius: 4px;
-      padding: 7px 12px;
+    .live-course-name {
+      font-size: 14px;
+      color: #737373;
+      line-height: 30px;
     }
-  }
 
-  &-name {
-    opacity: 0.4;
-    line-height: 30px;
+    .live-teacher {
+      margin-top: 12px;
+
+      .svg-icon {
+        margin-right: 8px;
+      }
+
+      &-name {
+        margin-right: 60px;
+      }
+    }
   }
 
-  // 主要容器
+  // 主容器
   &-container {
     display: flex;
     justify-content: left;
@@ -733,10 +808,27 @@ $live-bc: #3d3938;
       background-color: #2c2c2c;
       border-end-end-radius: 8px;
 
-      #live {
-        width: 352px;
-        height: 198px;
-        background-color: $live-bc;
+      .live-teacher-lens {
+        position: relative;
+        overflow: hidden;
+
+        #live {
+          width: 352px;
+          height: 198px;
+          background-color: $live-bc;
+        }
+
+        .live-wrapper {
+          position: absolute;
+          bottom: 0;
+          height: 40px;
+          width: 100%;
+          background-color: #000;
+          opacity: 0.7;
+          color: #fff;
+          line-height: 40px;
+          padding: 0 16px;
+        }
       }
 
       .student-list {
@@ -748,6 +840,10 @@ $live-bc: #3d3938;
         font-size: 14px;
         color: #fff;
 
+        &-title {
+          margin-bottom: 16px;
+        }
+
         li {
           display: flex;
           margin-bottom: 16px;

+ 23 - 20
src/views/live/live.js

@@ -3,13 +3,13 @@ import store from '@/store';
 import { GetLiveRoomInfo } from '@/api/live';
 
 /**
- * @description WebSDK 实例化对象
+ * WebSDK 实例化对象
  */
 let rtc;
 
 /**
  * @method initSDK
- * @description 初始化SDK方法
+ * 初始化SDK方法
  * @param { object } data 初始化SDK所需参数
  * @returns { object }
  */
@@ -47,15 +47,15 @@ export function publishStream(streamName) {
 }
 
 /**
- * @description 查询直播是否开启
+ * 查询直播是否开启
  */
 export function getLiveStat(obj) {
   rtc.getLiveStat(obj);
 }
 
 /**
+ * 开启直播
  * @method startLive
- * @description 开启直播
  */
 export function startLive() {
   rtc.startLive({
@@ -113,8 +113,8 @@ export function createLocalStream() {
 }
 
 /**
+ * 结束本地流
  * @method closeVideo
- * @description 结束本地流
  */
 export function closeVideo(streamName) {
   rtc.closeVideo({
@@ -142,9 +142,9 @@ export function initListener(vue) {
     vue.roomData = data;
     // 初始化画板需要的数据
     let canvasInitData = {
-      allowDraw: data.user.role === 'presenter', // 是否具有书写画笔权限(讲师权限) true / false
+      allowDraw: store.state.user.user_type === 'TEACHER', // 是否具有书写画笔权限(讲师权限) true / false
       id: 'draw-parent',
-      pptDisplay: 1, // 文档展示方式。默认0,按窗口  1, 按宽度
+      pptDisplay: 1, // 文档展示方式。默认0,按窗口  1,按宽度
       liveId: data.live.status === 1 ? data.live.id : '' // 如果直播已经开始,需将直播 id 传入 sdk 中
     };
     // 初始化画板
@@ -365,8 +365,8 @@ export function initListener(vue) {
 }
 
 /**
+ * 结束直播
  * @method stopLive
- * @description 结束直播
  */
 export function stopLive() {
   rtc.stopLive({
@@ -386,8 +386,8 @@ export function stopLive() {
 }
 
 /**
+ * 关闭本地流声音
  * @method pauseAudio
- * @description 关闭本地流声音
  */
 export function pauseAudio() {
   rtc.pauseAudio({
@@ -402,8 +402,8 @@ export function pauseAudio() {
 }
 
 /**
+ * 开启本地流声音
  * @method playAudio
- * @description 开启本地流声音
  */
 export function playAudio() {
   rtc.playAudio({
@@ -419,8 +419,8 @@ export function playAudio() {
 }
 
 /**
+ * 关闭本地流视频画面
  * @method pauseVideo
- * @description 关闭本地流视频画面
  */
 export function pauseVideo() {
   rtc.pauseVideo({
@@ -435,8 +435,8 @@ export function pauseVideo() {
 }
 
 /**
+ * 开启本地流视频画面
  * @method playVideo
- * @description 开启本地流视频画面
  */
 export function playVideo() {
   rtc.playVideo({
@@ -465,7 +465,7 @@ export function getDevice() {
 }
 
 /**
- * @description 推送桌面共享
+ * 推送桌面共享
  */
 export function publishShareStream() {
   rtc.publishShareStream({
@@ -486,7 +486,7 @@ export function unPubShareStream() {
 }
 
 /**
- * @description 开启、结束、暂停、恢复录制
+ * 开启、结束、暂停、恢复录制
  * @param { String } status: 'start' 开启, 'end' 结束, 'pause' 暂停, 'resume' 恢复
  */
 export function liveRecord(status) {
@@ -504,7 +504,7 @@ export function liveRecord(status) {
 // 排麦
 
 /**
- * @description 老师端发起邀请,邀请学生上麦。(举手模式)
+ * 老师端发起邀请,邀请学生上麦。(举手模式)
  * @param {String} uid 被邀请用户id
  */
 export function invite(uid) {
@@ -524,8 +524,8 @@ export function invite(uid) {
 }
 
 /**
+ * 申请连麦
  * @method handsUp
- * @description 申请连麦
  */
 export function handsUp(data) {
   rtc.handsUp(data);
@@ -540,7 +540,7 @@ export function handsDown(Object) {
 }
 
 /**
- * @description 学生端接受老师的上麦邀请,同意上麦
+ * 学生端接受老师的上麦邀请,同意上麦
  */
 export function inviteAccept() {
   rtc.inviteAccept({
@@ -556,15 +556,15 @@ export function inviteAccept() {
 // 聊天组件
 
 /**
- * @descrption 发送聊天
- * @param {String} msg length不能超过400
+ * 发送聊天
+ * @param {String} msg length不能超过 400
  */
 export function sendMsg(msg) {
   rtc.sendMsg(msg);
 }
 
 /**
- * @description 房间配置项更新
+ * 房间配置项更新
  * @param {Object} option 房间配置项 (具体看2.0 https://doc.bokecc.com/class/developer/web/chat.html),以键值对的形式传
  */
 export function roomUpdate(option) {
@@ -573,6 +573,9 @@ export function roomUpdate(option) {
 
 // 文档
 
+/**
+ * 变更画笔
+ */
 export function drawChange(action, value) {
   rtc.drawChange({
     action,

+ 1 - 1
src/views/teacher/create_course/step_table/CourseInfo.vue

@@ -19,7 +19,7 @@
             :show-file-list="false"
             accept="image/*"
           >
-            <img v-if="form.imageUrl" :src="form.imageUrl" class="avatar" />
+            <el-image v-if="form.imageUrl" fit="contain" :src="form.imageUrl" class="avatar" />
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
           </el-upload>
         </el-form-item>

+ 17 - 4
src/views/teacher/create_course/step_table/NewTask.vue

@@ -68,9 +68,10 @@
                     :key="item.courseware_id"
                     color="#fff"
                     closable
+                    :title="item.courseware_name"
                     @close="closeCourse(i, 'live')"
                   >
-                    {{ item.courseware_name }}
+                    <span>{{ item.courseware_name }}</span>
                   </el-tag>
                 </div>
               </el-form-item>
@@ -90,9 +91,10 @@
                   :key="item.file_id"
                   color="#fff"
                   closable
+                  :title="item.file_name"
                   @close="closeFile(i, liveForm.file_info_list)"
                 >
-                  {{ item.file_name }}
+                  <span>{{ item.file_name }}</span>
                 </el-tag>
               </el-form-item>
 
@@ -124,9 +126,10 @@
                     :key="item.courseware_id"
                     color="#fff"
                     closable
+                    :title="item.courseware_name"
                     @close="closeCourse(i, 'course')"
                   >
-                    {{ item.courseware_name }}
+                    <span>{{ item.courseware_name }}</span>
                   </el-tag>
                 </div>
               </el-form-item>
@@ -165,9 +168,10 @@
                   :key="item.file_id"
                   color="#fff"
                   closable
+                  :title="item.file_name"
                   @close="closeFile(i, basicForm.file_info_list)"
                 >
-                  {{ item.file_name }}
+                  <span>{{ item.file_name }}</span>
                 </el-tag>
               </el-form-item>
 
@@ -493,6 +497,15 @@ export default {
 
       .el-tag {
         margin-right: 16px;
+
+        > span {
+          display: inline-block;
+          vertical-align: bottom;
+          max-width: 200px;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+        }
       }
     }
   }

+ 2 - 2
src/views/teacher/main/CurriculaList.vue

@@ -75,10 +75,10 @@
                 </span>
                 <el-dropdown-menu slot="dropdown">
                   <el-dropdown-item @click.native="edit(row.id)">
-                    <svg-icon icon-class="edit" /> Edit
+                    <svg-icon icon-class="edit" /> 编辑
                   </el-dropdown-item>
                   <el-dropdown-item @click.native="studentList(row.id)">
-                    <svg-icon icon-class="students" /> Students
+                    <svg-icon icon-class="students" /> 学生列表
                   </el-dropdown-item>
                 </el-dropdown-menu>
               </el-dropdown>