Переглянути джерело

Merge branch 'master' of http://60.205.254.193:3000/GCLS/eep_page

dsy 1 місяць тому
батько
коміт
0efb5d42d5

+ 111 - 8
src/components/CommonPreview.vue

@@ -212,7 +212,11 @@
 
                 <!-- 加载完成显示数据 -->
                 <div v-else-if="chapter.data">
-                  <ul class="scroll-container" infinite-scroll-disabled="disabled" :infinite-scroll-immediate="false">
+                  <ul
+                    :class="parseInt(drawerType) == 5 ? 'scroll-container file-list' : 'scroll-container'"
+                    infinite-scroll-disabled="disabled"
+                    :infinite-scroll-immediate="false"
+                  >
                     <li v-for="(item, index) in chapter.data" :key="`${chapter.id}-${index}`" class="list-item">
                       <template v-if="parseInt(drawerType) === 0">
                         <el-image v-if="shouldMediaShowItem(chapter, item)" :src="item.file_url" fit="contain" />
@@ -235,13 +239,36 @@
                           :video-index="index"
                         />
                       </template>
-                      <template v-else-if="parseInt(drawerType) === 3">
-                        <el-image v-if="shouldMediaShowItem(chapter, item)" :src="item.file_url" fit="contain" />
+                      <template v-else-if="parseInt(drawerType) === 3"> </template>
+                      <template v-else-if="parseInt(drawerType) === 4"> </template>
+                      <template v-else-if="parseInt(drawerType) === 5">
+                        <div class="file-name">
+                          <span>
+                            <SvgIcon icon-class="file" size="24" />
+                            <p>
+                              <span>{{ item.file_name }}</span>
+                            </p>
+                          </span>
+                          <div>
+                            <SvgIcon
+                              v-show="item.file_id"
+                              icon-class="uploadPreview"
+                              size="24"
+                              @click="viewDialog(item)"
+                            />
+
+                            <img
+                              style="width: 24px; height: 24px; cursor: pointer"
+                              src="@/assets/download.png"
+                              alt="download"
+                              @click="downLoad(item)"
+                            />
+                          </div>
+                        </div>
                       </template>
-
                       <!-- 资源底部的操作 -->
                       <div class="file-handle-info">
-                        <span v-if="parseInt(drawerType) !== 1" class="word">{{ item.file_name }}</span>
+                        <span v-if="![1, 5].includes(parseInt(drawerType))" class="word">{{ item.file_name }}</span>
                         <div class="mark">
                           <el-checkbox
                             v-model="item.is_hided"
@@ -363,6 +390,20 @@
     />
     <SimAnswerPermissionControl :visible.sync="visiblePermissionControl" :permission-control.sync="permissionControl" />
     <PreviewURL :url="preview_url" :visible.sync="visiblePreviewURL" />
+
+    <el-dialog
+      v-if="fileViewVisible"
+      :visible.sync="fileViewVisible"
+      :show-close="true"
+      :close-on-click-modal="true"
+      :modal-append-to-body="true"
+      :append-to-body="true"
+      :lock-scroll="true"
+      :width="isMobile ? '100%' : '80%'"
+      top="0"
+    >
+      <iframe v-if="fileViewVisible" :src="newpath" width="100%" :height="iframeHeight" frameborder="0"></iframe>
+    </el-dialog>
   </div>
 </template>
 
@@ -407,6 +448,7 @@ import {
 import { toggleFullScreen } from '@/utils/common';
 import * as OpenCC from 'opencc-js';
 import { isTrue } from '@/utils/validate';
+import { getConfig, getToken } from '@/utils/auth';
 import { CreateCoursewarePreviewURL } from '@/api/app';
 
 export default {
@@ -475,7 +517,7 @@ export default {
           { icon: 'audio', title: '音频', handle: 'openDrawer', param: { type: '1' } },
           { icon: 'image', title: '图片', handle: 'openDrawer', param: { type: '0' } },
           { icon: 'video', title: '视频', handle: 'openDrawer', param: { type: '2' } },
-          { icon: 'text', title: '文本', handle: 'openDrawer', param: { type: '3' } },
+          { icon: 'text', title: '文本', handle: 'openDrawer', param: { type: '5' } },
         ],
       },
       { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '11' } },
@@ -490,6 +532,10 @@ export default {
 
     return {
       select_node: this.id,
+      file_preview_url: getConfig() ? getConfig().doc_preview_service_address : '',
+      newpath: '',
+      fileViewVisible: false,
+      iframeHeight: `${window.innerHeight - 100}px`,
       courseware_info: {
         book_name: '',
         is_can_start_edit: 'false',
@@ -597,7 +643,7 @@ export default {
         0: '图片资源',
         1: '音频资源',
         2: '视频资源',
-        3: '文本资源',
+        5: '文本资源',
         11: '收藏列表',
         12: '笔记列表',
         13: '搜索结果',
@@ -935,7 +981,7 @@ export default {
     /**
      * 打开抽屉并初始化加载
      * @param {Object} param - 抽屉参数
-     * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频, 3:文本)
+     * @param {string} param.type - 抽屉类型(0: 图片, 1: 音频, 2: 视频, 3:H5 游戏,4:3D 模型,5:文本)
      */
     openDrawer({ type }) {
       if (this.drawerType === type) {
@@ -1170,6 +1216,26 @@ export default {
         this.$refs.courserware.handleLocation(item);
       }
     },
+
+    downLoad(file) {
+      let userInfor = getToken();
+      let AccessToken = '';
+      if (userInfor) {
+        AccessToken = userInfor.access_token;
+      }
+      let FileID = file.file_id;
+      let data = {
+        AccessToken,
+        FileID,
+      };
+      location.href = `${process.env.VUE_APP_EEP}/FileServer/WebFileDownload?AccessToken=${data.AccessToken}&FileID=${data.FileID}`;
+    },
+    // 预览
+    viewDialog(file) {
+      this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(file.file_url)}`;
+      this.fileViewVisible = true;
+    },
+
     /**
      * 获取笔记列表
      * @param {Object} params - 参数对象
@@ -1948,6 +2014,43 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
   margin: 10px 0 0 !important;
   background-color: #eee;
 }
+
+.file-list {
+  display: flex;
+  flex-direction: column;
+  row-gap: 5px;
+
+  li {
+    align-items: center;
+
+    .file-name {
+      display: flex;
+      column-gap: 14px;
+      align-items: center;
+      justify-content: space-between;
+      max-width: 500px;
+      padding: 8px 12px;
+      font-size: 14px;
+      color: #1d2129;
+      background-color: #f7f8fa;
+      border-radius: 8px;
+
+      p {
+        margin: 0;
+      }
+
+      span,
+      div {
+        display: flex;
+        align-items: center;
+      }
+    }
+
+    .svg-icon {
+      cursor: pointer;
+    }
+  }
+}
 </style>
 
 <style lang="scss">

+ 10 - 0
src/views/book/courseware/preview/common/SoundRecord.vue

@@ -447,6 +447,16 @@ export default {
         }
       }
     },
+    // 重置状态
+    handleReset() {
+      this.hasMicro = '';
+      this.recordtime = 0;
+      window.stopAudioSound = () => {
+        if (this.audio) {
+          this.audio.pause();
+        }
+      };
+    },
   },
 };
 </script>

+ 5 - 1
src/views/book/courseware/preview/components/character/CharacterPreview.vue

@@ -398,7 +398,7 @@
           </div>
         </div>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -584,6 +584,10 @@ export default {
       this.writer.updateColor('strokeColor', color);
       this.writer.updateColor('drawingColor', color);
     },
+    // 重做
+    retry() {
+      this.handleData();
+    },
   },
 };
 </script>

+ 5 - 1
src/views/book/courseware/preview/components/character_structure/CharacterStructurePreview.vue

@@ -152,7 +152,7 @@
           </div>
         </div>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -386,6 +386,10 @@ export default {
 
       return classname;
     },
+    // 重做
+    retry() {
+      this.handleData([]);
+    },
   },
 };
 </script>

+ 5 - 1
src/views/book/courseware/preview/components/image_text/ImageTextPreview.vue

@@ -58,7 +58,7 @@
         />
       </div>
     </div>
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -281,6 +281,10 @@ export default {
       if (theme !== '') this.sentenceTheme = theme;
       if (size) this.fontSize = size;
     },
+    // 重做
+    retry() {
+      this.initData();
+    },
   },
 };
 </script>

+ 18 - 1
src/views/book/courseware/preview/components/newWord_template/NewWordTemplatePreview.vue

@@ -56,6 +56,7 @@
                     : '#deebff',
               }"
               @input="changeAnswer(item, index)"
+              ref="editDiv"
             />
           </div>
           <div class="items-flex">
@@ -101,6 +102,7 @@
                         ? data.unified_attrib.assist_color
                         : '#deebff',
                   }"
+                  ref="editDiv"
                   @input="changeAnswer(item, index, indexs)"
                 />
               </div>
@@ -181,6 +183,7 @@
                         ? data.unified_attrib.assist_color
                         : '#deebff',
                   }"
+                  ref="editDiv"
                   @input="changeAnswer(items, index, indexs)"
                 />
               </div>
@@ -201,6 +204,7 @@
                     ? data.unified_attrib.assist_color
                     : '#deebff',
               }"
+              ref="editDiv"
               @input="changeAnswer(item, index)"
             />
           </div>
@@ -208,7 +212,7 @@
         </div>
       </div>
     </div>
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"
@@ -540,6 +544,19 @@ export default {
 
       return classname;
     },
+    // 重做
+    retry() {
+      this.handleData();
+      if (this.$refs.editDiv) {
+        if (this.$refs.editDiv.length > 0) {
+          this.$refs.editDiv.forEach((item) => {
+            item.handleReset();
+          });
+        } else {
+          this.$refs.editDiv.handleReset();
+        }
+      }
+    },
   },
 };
 </script>

+ 3 - 0
src/views/book/courseware/preview/components/newWord_template/components/EditDiv.vue

@@ -279,6 +279,9 @@ export default {
       e.target.innerHTML = e.target.innerHTML.replace(/&nbsp;/gi, '').trim();
       this.$emit('input', e.target.innerHTML);
     },
+    handleReset() {
+      document.getElementById(this.id).innerHTML = '';
+    },
   },
 };
 </script>

+ 8 - 1
src/views/book/courseware/preview/components/pinyin_base/PinyinBasePreview.vue

@@ -150,7 +150,7 @@
           />
         </template>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -660,6 +660,13 @@ export default {
         .join(' ');
       item.con = answer;
     },
+    // 重做
+    retry() {
+      this.handleData();
+      if (this.data.property.fun_type !== 'mark' && this.isEnable(this.data.property.is_enable_voice_answer)) {
+        this.$refs.record.handleReset();
+      }
+    },
   },
 };
 </script>

+ 7 - 1
src/views/book/courseware/preview/components/record_input/RecordInputPreview.vue

@@ -27,7 +27,7 @@
           @handleWav="handleWav"
         />
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -84,6 +84,12 @@ export default {
     handleWav(data) {
       this.data.answer.answer_list.answer_record_list = data;
     },
+    // 重做
+    retry() {
+      this.data.answer.answer_list.input = '';
+      this.data.answer.answer_list.answer_record_list = [];
+      this.$refs.record.handleReset();
+    },
   },
 };
 </script>

+ 11 - 0
src/views/book/courseware/preview/components/record_input/SoundRecord.vue

@@ -377,6 +377,17 @@ export default {
         }
       }
     },
+    // 重置状态
+    handleReset() {
+      this.hasMicro = '';
+
+      this.recordtime = 0;
+      window.stopAudioSound = () => {
+        if (this.audio) {
+          this.audio.pause();
+        }
+      };
+    },
   },
 };
 </script>

+ 23 - 1
src/views/book/courseware/preview/components/table/TablePreview.vue

@@ -222,7 +222,7 @@
           </tr>
         </table>
       </div>
-      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
+      <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" @retry="retry" />
       <AnswerCorrect
         :answer-correct="data?.answer_correct"
         :visible.sync="visibleAnswerCorrect"
@@ -666,6 +666,28 @@ export default {
       }
       return {};
     },
+    // 重做
+    retry() {
+      this.data.option_list.forEach((item) => {
+        item.forEach((items) => {
+          items.model_essay.forEach((li) => {
+            if (li.type === 'input') {
+              li.value = '';
+              li.write_base64 = '';
+            }
+          });
+        });
+      });
+      if (this.$refs.record) {
+        if (this.$refs.record.length > 0) {
+          this.$refs.record.forEach((item) => {
+            item.handleReset();
+          });
+        } else {
+          this.$refs.record.handleReset();
+        }
+      }
+    },
   },
 };
 </script>

+ 0 - 1
src/views/book/courseware/preview/components/video_interaction/VideoInteractionPreview.vue

@@ -25,7 +25,6 @@
       @click="lookReport"
       >{{ convertText('查看答题报告') }}</el-button
     >
-    <PreviewOperation @showAnswerAnalysis="showAnswerAnalysis" />
     <AnswerCorrect
       :answer-correct="data?.answer_correct"
       :visible.sync="visibleAnswerCorrect"