瀏覽代碼

填空题添加词汇增加编辑功能

dsy 3 周之前
父節點
當前提交
0fc973b5a3

+ 1 - 1
.env

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

+ 3 - 0
packages/BookEep.vue

@@ -74,6 +74,7 @@ import {
   DeleteCoursewareFeedback,
   GetCoursewareFeedbackList,
 } from '@/api/book';
+import { ensureExtendedFonts } from '@/common/data';
 
 const defaultBc = {
   background_image_url: '',
@@ -255,6 +256,8 @@ export default {
   },
   mounted() {
     this.applyComponentUserAnswer();
+    // 自动注册扩展字体(惰性加载,与主应用共享 _extendedFontsLoaded 标记,仅首次请求)
+    ensureExtendedFonts();
   },
   methods: {
     backTop() {

+ 0 - 4
packages/index.js

@@ -18,7 +18,6 @@ import VueSignaturePad from 'vue-signature-pad';
 import BookEep from './BookEep.vue';
 import pkg from './package.json';
 import { setRuntimeServices } from '@/utils/runtime-services';
-import { ensureExtendedFonts } from '@/common/data';
 import EepSvgIcon from '@/common/SvgIcon';
 
 const components = [BookEep];
@@ -63,9 +62,6 @@ const install = (VueInstance, options = {}) => {
     store: options.store,
   });
 
-  // 自动注册扩展字体(惰性加载,与主应用共享 _extendedFontsLoaded 标记,仅首次请求)
-  ensureExtendedFonts();
-
   components.forEach((component) => {
     VueInstance.component(component.name || 'BookEep', component);
   });

+ 1 - 1
packages/package.json

@@ -1,6 +1,6 @@
 {
   "name": "eep-ui",
-  "version": "0.0.35",
+  "version": "0.0.37",
   "main": "eep/eep-ui.umd.js",
   "style": "eep/eep-ui.css",
   "exports": {

+ 33 - 3
src/views/book/courseware/create/components/question/fill/Fill.vue

@@ -21,7 +21,10 @@
           <ul class="word-list">
             <li v-for="(item, index) in data.word_list" :key="item.mark" class="word-item">
               <span v-html="sanitizeHTML(item.content)"></span>
-              <el-button type="text" size="mini" class="delete-word" @click="removeWord(index)">
+              <el-button type="text" size="mini" class="delete-word" @click="editWord(index)">
+                <SvgIcon icon-class="edit" size="14" />
+              </el-button>
+              <el-button type="text" size="mini" class="delete-word" style="margin-left: 0" @click="removeWord(index)">
                 <SvgIcon icon-class="delete-black" size="12" />
               </el-button>
             </li>
@@ -112,7 +115,7 @@
         @updateAnswerAnalysisFileList="updateAnswerAnalysisFileList"
         @deleteAnswerAnalysis="deleteAnswerAnalysis"
       />
-      <AddWord :visible.sync="visibleWord" @add-word="addWord" />
+      <AddWord :visible.sync="visibleWord" :word="editingWord" @add-word="addWord" @edit-word="editWordConfirm" />
     </template>
   </ModuleBase>
 </template>
@@ -149,12 +152,17 @@ export default {
       fillTypeList,
       sanitizeHTML,
       visibleWord: false,
+      editingIndex: null, // 当前编辑的词汇索引,null 表示新增模式
       wordData: { detail: [] }, // 分词校对数据
       inited: false,
       loading: false,
     };
   },
   computed: {
+    editingWord() {
+      if (this.editingIndex === null || this.editingIndex === undefined) return null;
+      return this.data.word_list[this.editingIndex] || null;
+    },
     pinyinBodyStyles() {
       const unifiedAttrib = this.data?.unified_attrib || {};
       return {
@@ -656,9 +664,31 @@ export default {
       });
     },
     openAddWord() {
+      this.editingIndex = null;
+      this.visibleWord = true;
+    },
+    /**
+     * 编辑词汇
+     * @param {number} index 词汇在 word_list 中的索引
+     */
+    editWord(index) {
+      this.editingIndex = index;
       this.visibleWord = true;
     },
     /**
+     * 确认编辑词汇
+     * @param {string} word 编辑后的词汇内容
+     */
+    editWordConfirm(word) {
+      if (!word) return;
+      if (this.editingIndex === null || this.editingIndex === undefined) return;
+      this.$set(this.data.word_list, this.editingIndex, {
+        ...this.data.word_list[this.editingIndex],
+        content: word,
+      });
+      this.editingIndex = null;
+    },
+    /**
      * 添加词汇
      * @param {string} word 词汇内容
      */
@@ -796,7 +826,7 @@ export default {
 
     :deep .pinyin-area .rich-text-container,
     :deep .pinyin-area .pinyin-paragraph,
-    :deep .pinyin-area .pinyin-sentence  {
+    :deep .pinyin-area .pinyin-sentence {
       display: inline;
     }
   }

+ 19 - 6
src/views/book/courseware/create/components/question/fill/components/AddWord.vue

@@ -1,7 +1,7 @@
 <template>
   <el-dialog
     :visible="visible"
-    title="添加词汇"
+    :title="isEdit ? '编辑词汇' : '添加词汇'"
     custom-class="add-word"
     width="740px"
     :close-on-click-modal="false"
@@ -16,7 +16,7 @@
     />
     <span slot="footer" class="dialog-footer">
       <el-button @click="closeDialog">取 消</el-button>
-      <el-button type="primary" @click="addWord">确 定</el-button>
+      <el-button type="primary" @click="confirm">{{ isEdit ? '保 存' : '确 定' }}</el-button>
     </span>
   </el-dialog>
 </template>
@@ -34,16 +34,25 @@ export default {
       type: Boolean,
       required: true,
     },
+    word: {
+      type: Object,
+      default: null,
+    },
   },
   data() {
     return {
       content: '',
     };
   },
+  computed: {
+    isEdit() {
+      return Boolean(this.word);
+    },
+  },
   watch: {
     visible(newVal) {
-      if (!newVal) {
-        this.content = '';
+      if (newVal) {
+        this.content = this.word?.content || '';
       }
     },
   },
@@ -51,8 +60,12 @@ export default {
     closeDialog() {
       this.$emit('update:visible', false);
     },
-    addWord() {
-      this.$emit('add-word', this.content);
+    confirm() {
+      if (this.isEdit) {
+        this.$emit('edit-word', this.content);
+      } else {
+        this.$emit('add-word', this.content);
+      }
       this.closeDialog();
     },
   },

+ 3 - 3
src/views/personal_workbench/project/ProductionEditorialManage.vue

@@ -84,20 +84,20 @@
             </div>
             <div
               class="producer nowrap-ellipsis"
-              :style="{ color: !isEnable(is_root) && isEnable(is_inherited_producer) ? '#ff4757' : '' }"
+              :style="{ color: !isEnable(is_root) && isEnable(is_inherited_producer) ? '#99cc00' : '' }"
               :title="producer_list.map((producer) => producer.name).join(';')"
             >
               <span>{{ producer_list.map((producer) => producer.name).join(';') }}</span>
             </div>
             <div
               class="edit-end-date"
-              :style="{ color: !isEnable(is_root) && isEnable(is_inherited_producer) ? '#ff4757' : '' }"
+              :style="{ color: !isEnable(is_root) && isEnable(is_inherited_producer) ? '#99cc00' : '' }"
             >
               {{ edit_end_date }}
             </div>
             <div
               class="audit nowrap-ellipsis"
-              :style="{ color: !isEnable(is_root) && isEnable(is_inherited_auditor) ? '#ff4757' : '' }"
+              :style="{ color: !isEnable(is_root) && isEnable(is_inherited_auditor) ? '#99cc00' : '' }"
               :title="auditor_desc"
             >
               {{ auditor_desc }}