8 Commits 01f6988b3e ... 8bfff3c6ba

Author SHA1 Message Date
  ZhaoJing 8bfff3c6ba 优化 1 year ago
  ZhaoJing 4a97b18c73 优化 1 year ago
  ZhaoJing 8b3433cd43 优化 1 year ago
  ZhaoJing 2532a28d79 下发作业 1 year ago
  ZhaoJing 7a8e7418b2 tj 1 year ago
  ZhaoJing 6906480416 .. 1 year ago
  ZhaoJing ec97549739 Merge branch 'zhaoj' 1 year ago
  ZhaoJing 976c3961c6 优化 1 year ago

+ 0 - 1
package.json

@@ -22,7 +22,6 @@
     "file-saver": "^2.0.5",
     "lodash": "^4.17.21",
     "lodash-es": "^4.17.21",
-    "mammoth": "^1.5.1",
     "md5": "^2.3.0",
     "mpvue-calendar": "^3.0.1",
     "pinia": "2.0.23",

+ 12 - 12
src/pages/jsd/wdkc/zbkc/detail.vue

@@ -68,18 +68,18 @@
             </div>
           </div>
         </div>
-        <div
-          class="mt-20px"
-          v-if="
-            chapter_info.vod_mp4_address && chapter_info.vod_mp4_address !== ''
-          "
-          id="player-con"
-        ></div>
-        <div
-          v-else
-          class="mt-20px w-full h-460px bg-hex-000 flex items-center justify-center text-hex-fff text-18px"
-        >
-          回看视频生成中……
+        <div class="relative mt-20px">
+          <div class="mt-20px" id="player-con"></div>
+            <!-- v-if="chapter_info.status == '3' && !chapter_info.vod_mp4_address" -->
+          <div v-if="chapter_info.status == '3' && !chapter_info.vod_mp4_address"
+            class="mt-20px w-full h-460px bg-hex-000 absolute top-0 left-0 text-hex-fff text-18px leading-460px text-center">
+             回看视频生成中……
+          </div>
+          <!-- v-else-if="chapter_info.status == '1'" -->
+          <div v-else-if="chapter_info.status == '1'"
+            class="mt-20px w-full h-450px bg-hex-000 absolute top-0 left-0 text-hex-fff text-18px leading-460px text-center">
+              暂未开始, 请耐心等待……
+          </div>
         </div>
       </div>
       <div class="w-300px mt-46px right-box pt-30px">

+ 3 - 3
src/pages/jsd/wdkc/zbkc/live.vue

@@ -75,11 +75,11 @@
             <div class="w-300px mt-46px right-box pt-30px relative">
                  <el-button v-if="chapter_info.tzk_zjr_user_id === user.user_id" type="primary" color="#1259a1" size="large" class="w-100px live-btn" @click="launchLive">启动直播工具
                 </el-button>
-                <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>
-            	<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" @filePre="filePre"></homeworkBlock>
+                </div> -->
+            	<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>
             </div>
    		 </div>
   </div>

+ 2 - 2
src/pages/xsd/wdbm/chapter.vue

@@ -103,7 +103,7 @@ const linkTo = (name) => {
 };
 let apiName;
 function filterData() {
-    page = 1;
+    form_query.page = 1;
     getListData(apiName);
 }
 if (route.params.tjk_id) {
@@ -145,7 +145,7 @@ function getListData(name) {
 }
 
 let handleSelectionChange = (val) => {
-    page = val;
+    form_query.page = val;
     getListData(apiName);
 };
 // 报名

+ 2 - 0
src/pages/xsd/wdbm/index.vue

@@ -411,6 +411,8 @@ function getDetailList() {
   detail_loading = true;
   let data = {
     tbm_lclx,
+    page: bm_page,
+    limit: bm_limit,
     tbm_user_id: user.value.user_id,
     M5jxrcL:'',
   };

+ 3 - 1
src/pages/xsd/wdjf/index.vue

@@ -14,7 +14,7 @@
         </ul>
         <nodata v-else></nodata>
         <div class="mt-20px flex justify-center">
-            <el-pagination v-model:current-page="page" v-model:page-size="limit" layout="total, prev, pager, next"
+            <el-pagination v-model:current-page="cur_page" v-model:page-size="limit" layout="total, prev, pager, next"
                 :total="total" :background="true" @current-change="handleSelectionChange"></el-pagination>
         </div>
     </div>
@@ -30,6 +30,8 @@ let cur_page = $ref(1);
 let listData = $ref([])
 function initData() {
     let data = {
+        limit,
+        page: cur_page,
         create_user_id: user.value.user_id
     }
     jf_list(data).then(res => {

+ 15 - 10
src/pages/zbkc/detail.vue

@@ -54,16 +54,20 @@
                         </div>
                     </div>
                 </div>
-                <div class="mt-20px" v-if="chapter_info.vod_mp4_address && chapter_info.vod_mp4_address !== ''"
-                    id="player-con"></div>
-                <div v-else-if="chapter_info.status == '3' && !chapter_info.vod_mp4_address"
-                    class="mt-20px w-full h-460px bg-hex-000 flex items-center justify-center text-hex-fff text-18px">
-                    回看视频生成中……
-                </div>
-                <div v-else-if="chapter_info.status == '1'"
-                    class="mt-20px w-full h-460px bg-hex-000 flex items-center justify-center text-hex-fff text-18px">
-                    暂未开始, 请耐心等待……
+                <div class="relative mt-20px">
+                    <div class="mt-20px" id="player-con"></div>
+                    <!-- v-if="chapter_info.status == '3' && !chapter_info.vod_mp4_address" -->
+                    <div v-if="chapter_info.status == '3' && !chapter_info.vod_mp4_address"
+                        class="mt-20px w-full h-460px bg-hex-000 absolute top-0 left-0 text-hex-fff text-18px leading-460px text-center">
+                        回看视频生成中……
+                    </div>
+                    <!-- v-else-if="chapter_info.status == '1'" -->
+                    <div v-else-if="chapter_info.status == '1'"
+                        class="mt-20px w-full h-450px bg-hex-000 absolute top-0 left-0 text-hex-fff text-18px leading-460px text-center">
+                        暂未开始, 请耐心等待……
+                    </div>
                 </div>
+
                 <!-- <div class="mt-20px" id="player-con"></div> -->
             </div>
             <div class="w-300px mt-46px right-box pt-30px">
@@ -71,7 +75,7 @@
                     <span>相关章节</span>
                     <i></i>
                 </div>
-                <ul v-if="chapterList.length>0" class="mt-25px right-chapter-list">
+                <ul v-if="chapterList.length > 0" class="mt-25px right-chapter-list">
                     <li v-for="item in chapterList" :key="item.tzk_id" :class="item.tzk_id === tzk_id ? 'selected' : ''"
                         @click="changeChapter(item)">
                         {{ item.tzk_ksmc }}
@@ -122,6 +126,7 @@ function getChapterDetail() {
             chapter_info = res.data.one_info;
             course_title = res.data.one_info.tzk_ksmc;
             if (chapter_info.vod_mp4_address && chapter_info.vod_mp4_address !== '') {
+                console.log(11);
                 var player = new Aliplayer(
                     {
                         id: "player-con",

+ 25 - 22
src/pages/zbkc/detailIsLive.vue

@@ -59,12 +59,15 @@
             </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" @filePre="filePre">
+                    :file="chapter_info.tzk_files_json" :zjr="chapter_info.tzk_zjr_user_id" :ks_id="chapter_info.tzk_ksce_tq_id" @filePre="filePre">
                 </homeworkBlock>
             </div>
         </div>
@@ -86,7 +89,6 @@ import ChatBlock from "./chat.vue";
 import homeworkBlock from "./homework.vue";
 import { useRoute, useRouter } from "vue-router";
 import { user } from '../../store/index';
-import mammoth from 'mammoth/mammoth.browser';
 import {
     chapter_detail,
     chapter_list,
@@ -125,6 +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 当前用户非主讲人时直播画面为全框
             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('资源预览')
@@ -315,23 +323,6 @@ function filePre(item) {
     console.log(item, 111111);
     dialogVisible = true;
     previewUrl = item;
-    getWordText(getFullUrl(item))
-}
-function getWordText(url) {
-    console.log(url);
-    const xhr = new XMLHttpRequest();
-    xhr.open("get", url, true);
-    xhr.responseType = "arraybuffer";
-    xhr.onload = () => {
-        if (xhr.status == 200) {
-            mammoth.convertToHtml({ arrayBuffer: new Uint8Array(xhr.response) }).then((resultObject) => {
-                nextTick(() => {
-                    wordText = resultObject.value;
-                });
-            });
-        }
-    };
-    xhr.send();
 }
 </script>
 
@@ -509,6 +500,12 @@ $color: #1259a1;
 .left-box{
     float: left;
 }
+.live-btn {
+  position: absolute;
+  right: 0;
+  top: -5px;
+}
+
 .right-box {
     // height: 460px;
     background: #ffffff;
@@ -575,11 +572,17 @@ $color: #1259a1;
     text-align: center;
 }
 
-:deep(.chat) {
+:deep(.home) {
     // background-color: rgba($color:#fff, $alpha: .7);
     position: absolute;
     top: 60px;
     right: 10px;
 
 }
+:deep(.chat){
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    z-index: 100;
+}
 </style>

+ 203 - 40
src/pages/zbkc/homework.vue

@@ -1,7 +1,7 @@
 <script setup>
 import { user } from '~/store/index';
 import downLoadFile1 from '@/utils/download'
-import mammoth from 'mammoth/mammoth.browser';
+// import { ElRadioGroup, ElRadio, ElCheckboxGroup, ElCheckbox } from 'element-plus'
 const props = defineProps({
     id: String,
     homework: String,
@@ -9,10 +9,11 @@ const props = defineProps({
     dxa: String,
     user_id: String,
     zjr: String,
+    ks_id: String,
 })
 const chatBox = ref()
 const ws = new WebSocket("wss://socket.txhlwxx.com")
-const emits = defineEmits(['filePre', 'edit', 'download', 'enter'])
+const emits = defineEmits(['filePre', 'edit'])
 // let userList = ref(undefined)
 const msgList = ref([])
 
@@ -22,29 +23,11 @@ let title = $ref('')
 let filecontent = $ref('');
 let fileName = $ref('');
 let downItem = $ref('');
-let ban_id = $ref([]);
-let isBanned = $ref(false)
-let ban_me = $ref(false);
+
 let login_data = $ref({});
 let login_id = $ref([]);
-let wordText = $ref();
-function getWordText(url) {
-    console.log(url);
-    const xhr = new XMLHttpRequest();
-    xhr.open("get", url, true);
-    xhr.responseType = "arraybuffer";
-    xhr.onload = () => {
-        if (xhr.status == 200) {
-            mammoth.convertToHtml({ arrayBuffer: new Uint8Array(xhr.response) }).then((resultObject) => {
-                console.log(resultObject, 'rej');
-                nextTick(() => {
-                    wordText = resultObject.value;
-                });
-            });
-        }
-    };
-    xhr.send();
-}
+let testInfo = $ref([]);
+let answer = $ref();
 ws.addEventListener('message', (e) => {
     if (e.data) {
         try {
@@ -63,18 +46,34 @@ ws.addEventListener('message', (e) => {
             }
             if (data.type === 'say') {
                 const [id, name] = data.from_client_name.split('|')
-                const fileType = data.content?.split(";")[2]?.split('|')[1];
-                fileName = data.content.split(";")[0];
-                filecontent = data.content?.split(";")[2].split('|')[0];
+                console.log(data.content, 'cc');
+                let fileType
+                if (data.content.includes('|')) {
+                    fileType = data.content?.split(";")[2]?.split('|')[1];
+                    fileName = data.content.split(";")[0];
+                    filecontent = data.content?.split(";")[2].split('|')[0];
+                }
+                // user.value.user_id !== props?.zjr
                 if (fileType && user.value.user_id !== props?.zjr) {
-
                     downItem = data.content
                     switch (fileType) {
                         case 'home':
                             title = '作业';
                             wordVisiable = true;
-                            let url = getFullUrl(filecontent)
-                            getWordText(url)
+                            request({
+                                url: '/txwx/question/index',
+                                data: {
+                                    tq_id: props?.ks_id,
+                                    tqr_data_type: '4',
+                                    tqr_data_id: props?.id,
+                                    tqr_pos: '1'
+                                }
+                            }).then(res => {
+                                if (res.code == '1') {
+                                    testInfo = res.data.page_data;
+                                }
+                            })
+                            // let url = getFullUrl(filecontent)
                             break
                         case 'file':
                             title = '文件';
@@ -86,8 +85,10 @@ ws.addEventListener('message', (e) => {
                             break
                     }
                 }
+                if (fileType && user.value.user_id === props?.zjr) {
+                    ElMessage.success('下发成功!');
+                }
             }
-
         } catch (error) {
             console.error(error);
         }
@@ -134,12 +135,88 @@ function filePre(item) {
 function download(item) {
     downLoadFile1(getFullUrl(item.split(';')[2].split('|')[0]), `${item.split(';')[0]}`)
 }
+
+let answerVisiable = $ref(false);
+let answerInfo = $ref([]);
+function submitTest() {
+    let question = [];
+    let flag = true;
+    testInfo.forEach((item, index) => {
+        // 单选题或判断题
+        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)
+                    })
+                }
+            })
+        }
+    })
+    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: {
+                tqr_data_type: '4',
+                tqr_data_id: props?.id,
+                tqr_pos: '1',
+                question,
+            }
+        }).then(res => {
+            if (res.code == '1') {
+                ElMessage.success(res.msg);
+                wordVisiable = false;
+                request({
+                    url: '/txwx/question/index',
+                    data: {
+                        tq_id: props?.ks_id,
+                        tqr_data_type: '4',
+                        tqr_data_id: props?.id,
+                        tqr_pos: '1'
+                    }
+                }).then(res => {
+                    if (res.code == '1') {
+                        answerInfo = res.data.page_data;
+                        answerVisiable = true;
+                    }
+                })
+            }
+        })
+    }
+}
 </script>
 
 <template>
-    <div class="w-300px h-400px flex flex-col shadow chat">
-        <!--  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="w-300px h-400px flex flex-col shadow home">
+        <!--  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">
                 <span>相关章节</span>
                 <i></i>
@@ -205,8 +282,65 @@ function download(item) {
 
             </div>
         </el-dialog>
-        <el-dialog  v-model="wordVisiable" :title="title">
-            <div id="wordView" v-html="wordText"></div>
+        <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="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">{{
+                                item.tq_type_name }}</span>
+                        </div>
+                    </div>
+                    <ElRadioGroup fill="#1259a1" v-if="item.tq_type == '1'" class="mt-10px mb-20px" v-model="item.answer">
+                        <el-radio-button size="30" class="mx-10px" v-for="e in item.tq_option_choosen" :label="e">{{ e
+                        }}</el-radio-button>
+                    </ElRadioGroup>
+                    <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>
+                    </ElRadioGroup>
+                </div>
+                <div id="footer" class="flex justify-center my-30px">
+                    <el-button class="mr-20px" @click="submitTest">提交</el-button>
+                    <el-button class="over" @click="wordVisiable = false">跳过</el-button>
+                </div>
+            </div>
+
+        </el-dialog>
+        <el-dialog v-model="answerVisiable" width="65%">
+            <div v-if="answerInfo.length > 0">
+                <div v-for="item in answerInfo" :key="item.tq_id">
+                    <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">{{
+                                item.tq_type_name }}</span>
+                        </div>
+                    </div>
+                    <div class="flex my-15px text-16px">
+                        <p class="mr-10px">正确答案: </p>
+                        <p class="text-hex-5dc248">{{ item.tq_answer }}</p>
+                    </div>
+                    <div class="flex text-16px">
+                        <p class="mr-10px">你的答案: </p>
+                        <p :class="item.my_answer.tqr_correct == '0' ? 'text-red-500' : 'text-hex-1259A1'">{{
+                            item.my_answer?.tqr_user_answer }}</p>
+                    </div>
+                    <div class="mb-25px mt-15px text-16px">
+                        <p class="text-red-500">解析: </p>
+                        <p class="leading-loose">{{ item.tq_alyz }}</p>
+                    </div>
+                </div>
+                <div id="footer" class="flex justify-center my-30px">
+                    <el-button class="mr-20px over bg-gray-500" @click="answerVisiable = false">确认</el-button>
+                </div>
+            </div>
         </el-dialog>
     </div>
 </template>
@@ -214,6 +348,7 @@ function download(item) {
 <style lang="scss" scoped>
 $color: #1259A1;
 
+
 .chat_li {
     // background-color: rgba($color: #000000, $alpha: .4);
     height: 40px;
@@ -253,17 +388,23 @@ $color: #1259A1;
 
 ::v-deep .el-button {
     width: 111px !important;
-    height: 32px;
-    opacity: 0.7;
-    background: linear-gradient(90deg, #2586e9 1%, #57c6d8 100%);
-    border-radius: 38px;
-    padding: 5px 40px;
+    height: 40px;
+    // opacity: 0.7;
+    background: $color;
+    border-radius: 10px !important;
+    // padding: 10px 40px;
+    color: #fff;
 
     span {
         font-size: 14px;
     }
 }
 
+::v-deep .over {
+    background-color: #f2f2f2;
+    color: $color;
+}
+
 .home_scroll::-webkit-scrollbar {
     width: 2px;
 }
@@ -309,4 +450,26 @@ $color: #1259A1;
         background: rgba(108, 93, 211, 0.2);
     }
 }
+
+::v-deep .western {
+    line-height: 30px !important;
+
+    img {
+        display: inline-block;
+    }
+}
+
+::v-deep .el-radio-button {
+    .el-radio-button__inner {
+        border-radius: 20px !important;
+        padding: 8px 25px;
+        background-color: #f2f2f2;
+    }
+}
+
+::v-deep .el-checkbox-button__inner {
+    border-radius: 20px !important;
+    padding: 8px 25px;
+    background-color: #f2f2f2;
+}
 </style>