Browse Source

填空题修改

dsy 1 month ago
parent
commit
2dfed64782

+ 1 - 1
.env

@@ -11,4 +11,4 @@ VUE_APP_BookWebSI = '/GCLSBookWebSI/ServiceInterface'
 VUE_APP_EepServer = '/EEPServer/SI'
 
 #version
-VUE_APP_VERSION = '2026.07.28'
+VUE_APP_VERSION = '2026.07.30'

+ 10 - 0
src/api/app.js

@@ -27,6 +27,16 @@ export function GetFileStoreInfo(data) {
 }
 
 /**
+ * 保存文件(Bytes Base64 文本)
+ * @param {object} data 请求数据
+ * @param {string} data.base64_text Base64 编码的文件内容
+ * @param {string} data.file_suffix_name 文件后缀名
+ */
+export function SaveFileByteBase64Text(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=file_store_manager-SaveFileByteBase64Text`, data);
+}
+
+/**
  * 上传文件
  * @param {string} SecurityLevel 保密级别
  * @param {object} file 文件对象

+ 1 - 1
src/views/book/courseware/create/components/question/table/Table.vue

@@ -579,7 +579,7 @@ export default {
             const text = col.content;
             if (!text) return;
             let obj = {
-              text: text,
+              text,
               pinyin_proofread_word_list: [],
             };
             this.$set(col, 'paragraph_list_parameter', obj);

+ 62 - 5
src/views/book/courseware/create/components/question/voice_matrix/VoiceMatrix.vue

@@ -3,10 +3,6 @@
     <template #content>
       <div class="container">
         <div class="batch-set">
-          <SvgIcon icon-class="font-bold" size="16" @click="BatchSetFormat('bold')" />
-          <SvgIcon icon-class="font-italic" size="16" @click="BatchSetFormat('italic')" />
-          <SvgIcon icon-class="font-underline" size="16" @click="BatchSetFormat('strikethrough')" />
-          <SvgIcon icon-class="font-strikethrough" size="16" @click="BatchSetFormat('underline')" />
           <el-select
             v-model="font"
             style="width: 120px"
@@ -24,6 +20,13 @@
             <el-option v-for="size in fontSizeList" :key="size" :label="size" :value="size" />
           </el-select>
           <el-color-picker v-model="color" @change="BatchSetFormat('color', color)" />
+          <SvgIcon icon-class="font-bold" size="20" @click="BatchSetFormat('bold')" />
+          <SvgIcon icon-class="font-italic" size="20" @click="BatchSetFormat('italic')" />
+          <SvgIcon icon-class="font-underline" size="24" @click="BatchSetFormat('strikethrough')" />
+          <SvgIcon icon-class="font-strikethrough" size="24" @click="BatchSetFormat('underline')" />
+          <SvgIcon icon-class="align-left" size="20" @click="BatchSetFormat('align', 'LEFT')" />
+          <SvgIcon icon-class="align-center" size="20" @click="BatchSetFormat('align', 'MIDDLE')" />
+          <SvgIcon icon-class="align-right" size="20" @click="BatchSetFormat('align', 'RIGHT')" />
         </div>
 
         <div class="option-list">
@@ -43,6 +46,13 @@
               <span class="multilingual" @click="openMultilingual(i, j)">
                 <SvgIcon icon-class="multilingual" class-name="multilingual" width="12" height="12" />
               </span>
+              <span
+                class="toggle-pill"
+                :class="{ 'is-active': li.is_only_text }"
+                @click="toggleOnlyText(li, !li.is_only_text)"
+              >
+                <span class="toggle-dot"></span>
+              </span>
             </div>
           </div>
         </div>
@@ -222,6 +232,16 @@ export default {
       let curIndex = 0;
       this.data.option_list.forEach((row) => {
         row.forEach((item, i) => {
+          // 跳过没有内容和 is_only_text 为 true 的单元格
+          const plainText = item.content.replace(/<[^>]+>/g, '').trim();
+          if (plainText.length === 0 || item.is_only_text) {
+            row[i].lrc_data = {
+              begin_time: 0,
+              end_time: 0,
+              text: '',
+            };
+            return;
+          }
           const lrcData = lrcArr[curIndex];
           if (lrcData) {
             row[i].lrc_data = lrcData;
@@ -310,6 +330,9 @@ export default {
     saveSubtitles(dataList) {
       this.data.option_list = dataList;
     },
+    toggleOnlyText(item, val) {
+      this.$set(item, 'is_only_text', val);
+    },
     openMultilingual(i, j) {
       this.curSelectRow = i;
       this.curSelectColumn = j;
@@ -336,7 +359,10 @@ export default {
       }
       const text = this.data.option_list
         .map((item) =>
-          item.map(({ content = '' }) => {
+          item.map(({ content = '', is_only_text }) => {
+            console.log(is_only_text);
+
+            if (is_only_text) return '';
             const plainText = content.replace(/<[^>]+>/g, '').trim();
             return plainText;
           }),
@@ -418,6 +444,37 @@ export default {
           right: 3px;
           cursor: pointer;
         }
+
+        .toggle-pill {
+          position: absolute;
+          top: 6px;
+          right: 22px;
+          display: flex;
+          align-items: center;
+          width: 22px;
+          height: 12px;
+          padding: 0 2px;
+          cursor: pointer;
+          background: #c0c4cc;
+          border-radius: 6px;
+          transition: background 0.2s;
+
+          &.is-active {
+            background: #a0cfff;
+          }
+
+          .toggle-dot {
+            width: 8px;
+            height: 8px;
+            background: #fff;
+            border-radius: 50%;
+            transition: transform 0.2s;
+          }
+
+          &.is-active .toggle-dot {
+            transform: translateX(10px);
+          }
+        }
       }
     }
   }

+ 1 - 7
src/views/book/courseware/create/components/question/voice_matrix/VoiceMatrixSetting.vue

@@ -9,11 +9,6 @@
       <el-form-item label="列数">
         <el-input-number v-model="property.column_count" :min="1" />
       </el-form-item>
-      <el-form-item label="对齐方式">
-        <el-radio-group v-model="property.align">
-          <el-radio v-for="{ value, label } in alignTypeList" :key="value" :label="value">{{ label }}</el-radio>
-        </el-radio-group>
-      </el-form-item>
       <el-form-item label="按列播放">
         <el-radio-group v-model="property.is_enable_column_play">
           <el-radio v-for="{ value, label } in switchOption" :key="value" :label="value">{{ label }}</el-radio>
@@ -39,7 +34,7 @@
 <script>
 import SettingMixin from '@/views/book/courseware/create/components/common/SettingMixin';
 
-import { getVoiceMatrixProperty, switchOption, alignTypeList } from '@/views/book/courseware/data/voiceMatrix';
+import { getVoiceMatrixProperty, switchOption } from '@/views/book/courseware/data/voiceMatrix';
 
 export default {
   name: 'VoiceMatrixSetting',
@@ -48,7 +43,6 @@ export default {
     return {
       property: getVoiceMatrixProperty(),
       switchOption,
-      alignTypeList,
     };
   },
   methods: {},

+ 1 - 8
src/views/book/courseware/data/voiceMatrix.js

@@ -8,13 +8,6 @@ import {
 import { getRandomNumber } from '@/utils';
 export { switchOption };
 
-export const alignTypeList = [
-  { value: 'left', label: '左对齐' },
-  { value: 'center', label: '居中对齐' },
-  { value: 'right', label: '右对齐' },
-  { value: 'justify', label: '两端对齐' },
-];
-
 export function getVoiceMatrixProperty() {
   return {
     serial_number: 1,
@@ -23,7 +16,6 @@ export function getVoiceMatrixProperty() {
     sn_display_mode: displayList[1].value,
     sn_style: serialNumberStyleList[0].value,
     sn_background_color: '#ea3232', // 序号背景色
-    align: alignTypeList[0].value, // 对齐方式
     is_enable_row_play: switchOption[0].value, // 是否开启行播放
     is_enable_column_play: switchOption[0].value, // 是否开启列播放
     is_enable_record: switchOption[0].value, // 是否开启录音
@@ -42,6 +34,7 @@ export function getOption() {
       text: '',
     },
     multilingual: [], // 多语言
+    is_only_text: false, // 是否仅显示文本
   };
 }
 

+ 6 - 0
src/views/book/courseware/preview/components/fill/FillPreview.vue

@@ -250,6 +250,12 @@ export default {
     'data.record_list'(val) {
       this.answer.record_list = val;
     },
+    'answer.record_list': {
+      handler(val) {
+        this.data.record_list = val;
+      },
+      immediate: true,
+    },
   },
   methods: {
     handleWav(data) {

+ 8 - 1
src/views/book/courseware/preview/components/voice_matrix/VoiceMatrixPreview.vue

@@ -114,6 +114,7 @@
                     ? 'read'
                     : '',
                 ]"
+                :style="{ ...getBodyStyles() }"
                 @mouseenter="matrixCellMouseenter(i, j, column.type)"
               >
                 <!-- 文本 -->
@@ -131,7 +132,7 @@
                     (curTime < column.lrc_data.end_time / 1000 || column.lrc_data.end_time === -1)
                       ? 'playing'
                       : '',
-                    column.isTitle ? 'title' : '',
+                    column?.is_only_text ? 'title' : '',
                   ]"
                   @click="matrixCellClick(i, j)"
                 >
@@ -365,6 +366,7 @@ export default {
       }
       this.selectedLine = { type: '', index: -1 };
       this.selectCell = { row, column };
+      if (this.data.option_list[row][column]?.is_only_text) return;
       this.handleChangeTime(this.data.option_list[row][column].lrc_data);
       // 设置录音文件名
       this.setRecordingFileName(row, column);
@@ -655,6 +657,11 @@ $border-color: #e6e6e6;
 .voice-matrix-preview {
   @include preview-base;
 
+  .rich-text {
+    font-family: inherit;
+    font-size: inherit;
+  }
+
   .main {
     color: #262626;