ZhaoJing hace 1 año
padre
commit
8b3433cd43
Se han modificado 2 ficheros con 61 adiciones y 19 borrados
  1. 17 3
      src/pages/zbkc/detailIsLive.vue
  2. 44 16
      src/pages/zbkc/homework.vue

+ 17 - 3
src/pages/zbkc/detailIsLive.vue

@@ -59,10 +59,13 @@
             </div>
             <!-- v-if="user.user_role_id ==75" -->
             <div ref="fileBox" class="300px mt-46px right-box pt-30px">
-                <div v-if="user.user_role_id === '75'" class="right-nav ml-20px">
+                <!-- <div v-if="user.user_role_id === '75'" class="right-nav ml-20px">
                     <span>相关章节</span>
                     <i></i>
-                </div>
+                </div> -->
+                <!--  v-if="chapter_info.tzk_zjr_user_id === user.user_id" -->
+                <el-button v-if="user.user_id === chapter_info.tzk_zjr_user_id" type="primary" color="#1259a1" size="large" class="w-100px live-btn" @click="launchLive">启动直播工具
+                    </el-button>
                 <homeworkBlock :id="tzk_id" :dxa="chapter_info.tzk_dxa_file" :homework="chapter_info.tzk_ksce_file"
                     :file="chapter_info.tzk_files_json" :zjr="chapter_info.tzk_zjr_user_id" :ks_id="chapter_info.tzk_ksce_tq_id" @filePre="filePre">
                 </homeworkBlock>
@@ -124,7 +127,7 @@ function getChapterDetail() {
         if (res.code === "1") {
             chapter_info = res.data.one_info;
             course_title = res.data.one_info.tzk_ksmc;
-            // user.value.user_id !== chapter_info.tzk_zjr_user_id
+            // user.value.user_id !== chapter_info.tzk_zjr_user_id 当前用户非主讲人时直播画面为全框
             if (user.value.user_id !== chapter_info.tzk_zjr_user_id) {
                 let width = liveBox.value.parentElement.offsetWidth;
                 liveBox.value.style.width = width + 'px';
@@ -308,6 +311,11 @@ async function copyLink() {
     ElMessage.success("已复制");
     jfData();
 }
+
+function launchLive() {
+    window.open(chapter_info.push_rtmp_address, "_blank");
+}
+
 let wordText = $ref();
 let dialogVisible = $ref(false);
 let title = $ref('资源预览')
@@ -492,6 +500,12 @@ $color: #1259a1;
 .left-box{
     float: left;
 }
+.live-btn {
+  position: absolute;
+  right: 0;
+  top: -5px;
+}
+
 .right-box {
     // height: 460px;
     background: #ffffff;

+ 44 - 16
src/pages/zbkc/homework.vue

@@ -140,17 +140,44 @@ function submitTest() {
     let question = [];
     let flag = true;
     testInfo.forEach((item, index) => {
-        if (!item.answer) {
-            ElMessage.warning(`第${index + 1}题未选择`)
-            flag = false;
-            return
+        // 单选题或判断题
+        if (item.tq_type == '1' || item.tq_type == '3') {
+            if (!item.answer) {
+                ElMessage.warning(`第${index + 1}题未选择`)
+                flag = false;
+                return
+            }
+            question.push({
+                tq_id: item.tq_id,
+                user_answer: item.answer,
+            })
+        } else {
+            // 多选题
+            if (!item.answers || item.answers?.length == 0) {
+                ElMessage.warning(`第${index + 1}题未选择`)
+                flag = false;
+                return
+            }
+            question.push({
+                tq_id: item.tq_id,
+                user_answer: item.answers,
+            })
+            question.forEach(el => {
+                if (el.user_answer instanceof Array) {
+                    // 重新排序使选中数据的顺序为ABC....
+                    el = el.user_answer?.sort((a, b) => {
+                        return item.tq_option_choosen?.indexOf(a) - item.tq_option_choosen?.indexOf(b)
+                    })
+                }
+            })
         }
-        question.push({
-            tq_id: item.tq_id,
-            user_answer: item.answer,
-        })
     })
     if (flag) {
+        question.forEach(el => {
+            if (el.user_answer instanceof Array) { 
+                el.user_answer = el.user_answer.join('')
+            }
+        })
         request({
             url: '/txwx/question_record/save',
             data: {
@@ -185,7 +212,7 @@ function submitTest() {
 
 <template>
     <div class="w-300px h-400px flex flex-col shadow home">
-        <!--  v-if="user.user_id === props?.zjr" -->
+        <!--  v-if="user.user_id === props?.zjr" 当前用户为本章节主讲人-->
         <div v-if="user.user_id === props?.zjr" class="h-100 overflow-hidden overflow-y-auto flex-auto home_scroll"
             ref="chatBox">
             <div class="right-nav ml-20px">
@@ -253,10 +280,10 @@ function submitTest() {
 
             </div>
         </el-dialog>
-        <el-dialog v-model="wordVisiable" :title="title">
+        <el-dialog v-model="wordVisiable" :title="title" width="65%">
             <div v-if="testInfo.length > 0">
                 <div v-for="item in testInfo" :key="item.tq_id">
-                    <div class="flex">
+                    <div class="w-full flex justify-between">
                         <div class="leading-loose" v-html="item.tq_content"></div>
                         <div class="min-w-60px mt-8px ml-10px">
                             <span class="py-3px px-10px rounded-10px bg-hex-1259A1 text-white text-12px">{{
@@ -267,10 +294,11 @@ function submitTest() {
                         <el-radio-button size="30" class="mx-10px" v-for="e in item.tq_option_choosen" :label="e">{{ e
                         }}</el-radio-button>
                     </ElRadioGroup>
-                    <ElCheckboxGroup fill="#1259a1" v-else-if="item.tq_type == '2'" class="mt-10px mb-20px"
-                        v-model="item.answer">
-                        <el-checkbox-button v-for="e in item.tq_option_choosen" class="mx-10px">{{ e }}</el-checkbox-button>
-                    </ElCheckboxGroup>
+                    <el-checkbox-group fill="#1259a1" v-else-if="item.tq_type == '2'" class="mt-10px mb-20px"
+                        v-model="item.answers">
+                        <el-checkbox-button v-for="e in item.tq_option_choosen" class="mx-10px" :label="e">{{ e
+                        }}</el-checkbox-button>
+                    </el-checkbox-group>
                     <ElRadioGroup fill="#1259a1" v-else class="mt-10px mb-20px" size="30" v-model="item.answer">
                         <el-radio-button size="30" class="mx-10px" v-for="e in item.tq_option_choosen" :label="e"><span
                                 class="px-10px">{{ e }}</span></el-radio-button>
@@ -286,7 +314,7 @@ function submitTest() {
         <el-dialog v-model="answerVisiable">
             <div v-if="answerInfo.length > 0">
                 <div v-for="item in answerInfo" :key="item.tq_id">
-                    <div class="flex">
+                    <div class="flex justify-between">
                         <div class="leading-loose" v-html="item.tq_content"></div>
                         <div class="min-w-60px mt-8px ml-10px">
                             <span class="py-3px px-10px rounded-10px bg-hex-1259A1 text-white text-12px">{{