Jelajahi Sumber

视频交互添加题型

natasha 9 jam lalu
induk
melakukan
6990e78503

+ 59 - 7
src/views/book/courseware/create/components/question/video_interaction/ExerciseAdd.vue

@@ -23,7 +23,7 @@
           :border-color="''"
           :component-move="componentMove"
         />
-        <!-- <component :is="getSettingCom" ref="setting" /> -->
+        <component :is="getSettingCom" ref="setting" />
       </div>
     </div>
     <footer style="text-align: right">
@@ -38,23 +38,52 @@ import SelectPage from '@/views/book/courseware/create/components/question/selec
 import SelectSetting from '@/views/book/courseware/create/components/question/select/SelectSetting.vue';
 import Judge from '@/views/book/courseware/create/components/question/judge/Judge.vue';
 import JudgeSetting from '@/views/book/courseware/create/components/question/judge/JudgeSetting.vue';
+import SortPage from '@/views/book/courseware/create/components/question/sort/Sort.vue';
+import SortSetting from '@/views/book/courseware/create/components/question/sort/SortSetting.vue';
+import MatchingPage from '@/views/book/courseware/create/components/question/matching/Matching.vue';
+import MatchingSetting from '@/views/book/courseware/create/components/question/matching/MatchingSetting.vue';
+import FillPage from '@/views/book/courseware/create/components/question/fill/Fill.vue';
+import FillSetting from '@/views/book/courseware/create/components/question/fill/FillSetting.vue';
+import RecordInput from '@/views/book/courseware/create/components/question/record_input/RecordInput.vue';
+import RecordInputSetting from '@/views/book/courseware/create/components/question/record_input/RecordInputSetting.vue';
 import RichText from '@/components/RichText.vue';
 import { SaveCoursewareExercise } from '@/api/book';
 export default {
   name: 'ExerciseAdd',
-  components: { SelectPage, SelectSetting, Judge, JudgeSetting, RichText },
+  components: {
+    SelectPage,
+    SelectSetting,
+    Judge,
+    JudgeSetting,
+    SortPage,
+    SortSetting,
+    MatchingPage,
+    MatchingSetting,
+    FillPage,
+    FillSetting,
+    RecordInput,
+    RecordInputSetting,
+    RichText,
+  },
   props: ['exerciseContent'],
   data() {
     return {
       typeList: [
         {
-          label: '选择题',
           value: 'select',
+          label: '选择题',
         },
         {
-          label: '判断题',
           value: 'judge',
+          label: '判断题',
         },
+        {
+          value: 'sort',
+          label: '排序题',
+        },
+        { value: 'matching', label: '连线题' },
+        { value: 'fill', label: '填空题' },
+        { value: 'record_input', label: '录音' },
       ],
       typeValue: 'select',
       title: '',
@@ -70,6 +99,15 @@ export default {
           return SelectPage;
         case 'judge':
           return Judge;
+        case 'sort':
+          return SortPage;
+        case 'matching':
+          return MatchingPage;
+        case 'fill':
+          return FillPage;
+        case 'record_input':
+          return RecordInput;
+
         default:
           return SelectPage;
       }
@@ -80,6 +118,14 @@ export default {
           return SelectSetting;
         case 'judge':
           return JudgeSetting;
+        case 'sort':
+          return SortSetting;
+        case 'matching':
+          return MatchingSetting;
+        case 'fill':
+          return FillSetting;
+        case 'record_input':
+          return RecordInputSetting;
         default:
           return SelectSetting;
       }
@@ -112,9 +158,14 @@ export default {
           if (res.status === 1) {
             this.$message.success('操作成功');
             if (this.exercise_id) {
-              this.$emit('submitAdd');
-            } else {
               this.$emit('submitAdd', res.exercise_id, this.typeList.find((p) => p.value === this.typeValue).label);
+            } else {
+              this.$emit(
+                'submitAdd',
+                res.exercise_id,
+                this.typeList.find((p) => p.value === this.typeValue).label,
+                'add',
+              );
             }
           }
         })
@@ -158,7 +209,8 @@ export default {
 }
 </style>
 <style lang="scss">
-.tox-tinymce-aux {
+.tox-tinymce-aux,
+.tox-tinymce-inline {
   z-index: 9999 !important;
 }
 </style>

+ 6 - 33
src/views/book/courseware/create/components/question/video_interaction/VideoInteraction.vue

@@ -33,41 +33,11 @@
           </li>
         </ul>
       </div>
-      <!-- 上传 -->
-      <!-- <el-dialog
-        :visible.sync="sourceAddFlag"
-        width="500px"
-        append-to-body
-        :show-close="true"
-        title="上传文件"
-        :close-on-click-modal="false"
-        class="module-content"
-      >
-        <UploadFile
-          v-if="sourceAddFlag"
-          key="upload_resources"
-          type="video_interaction_file"
-          :total-size="20000"
-          :file-list="file_list"
-          :file-id-list="file_id_list"
-          :label-text="''"
-          :accept-file-type="'*'"
-          :icon-class="''"
-          :limit="1"
-          :single-size="2000"
-          :upload-tip="''"
-          @updateFileList="updateFileLists"
-        />
-        <footer style="text-align: right">
-          <el-button @click="handleCancle">取 消</el-button>
-          <el-button :loading="loading" type="primary" @click="submitAdd">确 定</el-button>
-        </footer>
-      </el-dialog> -->
       <!-- 编辑练习题题目 -->
       <el-dialog
         v-if="exerciseFlag"
         :visible.sync="exerciseFlag"
-        width="90%"
+        width="1400px"
         append-to-body
         :show-close="true"
         title="练习题"
@@ -182,14 +152,17 @@ export default {
       document.getElementById('interaction-video').play();
     },
     // 确定新增资源
-    submitAdd(id, type) {
-      if (id) {
+    submitAdd(id, type, isAdd) {
+      if (isAdd) {
         this.data.file_info_list.push({
           currentTime: this.currentTime,
           file_name: type,
           id,
         });
         this.file_id_list.push(id);
+      } else {
+        let index = this.data.file_info_list.findIndex((item) => item.id === id);
+        this.data.file_info_list[index].file_name = type;
       }
 
       this.exerciseFlag = false;