natasha преди 1 година
родител
ревизия
52a839757d

+ 28 - 41
src/views/exercise_questions/preview/ChinesePreview.vue

@@ -74,7 +74,7 @@
             <div v-for="(items, indexs) in item.imgArr" :key="indexs" class="con-box">
               <div
                 :class="['strockplay-newWord', (indexs + 1) % writer_number_yuan !== 0 ? 'border-left-none' : '']"
-                @click="freeWrite(items, index, indexs)"
+                @click="freeWrite(items, index, indexs, item.mark)"
               >
                 <SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
                 <img
@@ -96,7 +96,7 @@
           <div class="words-dic-box">
             <div v-for="(itemc, indexc) in item.imgArr" :key="indexc" class="words-dic-item">
               <span class="pinyin">{{ item.pinyin_arr[indexc].pinyin_item }}</span>
-              <div :class="['strockplay-newWord']" @click="freeWrite(itemc, index, indexc)">
+              <div :class="['strockplay-newWord']" @click="freeWrite(itemc, index, indexc, item.mark)">
                 <SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
                 <img
                   v-if="!play_status && itemc && itemc.strokes_image_url"
@@ -148,9 +148,7 @@ export default {
       hanzi_color: '#404040', // 描红汉字底色
       writer_number_yuan: 19,
       writer_number: null, // 书写个数
-      answer_list: {
-        write_model: {},
-      }, // 用户答题数据
+      answer_list: [], // 用户答题数据
       if_free_show: false,
       free_img: [],
       active_index: null,
@@ -197,6 +195,7 @@ export default {
         '快',
         '素',
       ],
+      active_mark: '',
     };
   },
   watch: {
@@ -216,19 +215,7 @@ export default {
   methods: {
     // 初始化数据
     handleData() {
-      // if (
-      //   document.getElementsByClassName('preview-content') &&
-      //   document.getElementsByClassName('preview-content')[0] &&
-      //   !this.writer_number
-      // ) {
-      //   this.writer_number_yuan =
-      //     Math.floor((document.getElementsByClassName('preview-content')[0].clientWidth - 128) / 64) - 1;
-      // }
-      // if (this.data.property.learn_type === 'paint') {
-      //   this.writer_number = this.writer_number_yuan - 5;
-      // } else {
-      //   this.writer_number = this.writer_number_yuan;
-      // }
+      this.answer_list = [];
       this.writer_number_yuan = Math.floor(
         (document.getElementsByClassName('preview-content')[0].clientWidth - 128) / 64,
       );
@@ -246,37 +233,37 @@ export default {
             item.pinyin_arr.push(obj);
           });
           item.imgArr = arr;
-          this.answer_list.write_model[this.hz_data[index]] = arr;
+          // this.answer_list.write_model[this.hz_data[index]] = arr;
         } else if (item.content.trim()) {
-          // let MethodName = 'hz_resource_manager-GetHZStrokesContent';
-          // let data = {
-          //   hz: item.content.trim(),
-          // };
-          // GetStaticResources(MethodName, data).then((res) => {
-          //   this.$set(item, 'strokes', res);
-          // });
-
           for (let i = 0; i < this.writer_number; i++) {
             arr.push(null);
           }
           item.imgArr = arr;
-          this.answer_list.write_model[item.content] = arr;
+          // this.answer_list.write_model[item.content] = arr;
         }
+        let obj = {
+          mark: item.mark,
+          strokes_content_list: arr,
+        };
+        this.answer_list.push(obj);
       });
+      console.log(this.data);
+      console.log(this.answer_list);
     },
     changePraShow() {
       this.if_free_show = false;
     },
-    closeIfFreeShow(data, rowIndex, colIndex) {
+    closeIfFreeShow(data, rowIndex, colIndex, mark) {
       this.data.option_list[rowIndex].imgArr[colIndex] = data;
       this.if_free_show = false;
-      this.freeWrite(data, rowIndex, colIndex);
+      this.freeWrite(data, rowIndex, colIndex, mark);
       this.$forceUpdate();
     },
-    freeWrite(imgUrl, index, indexs) {
+    freeWrite(imgUrl, index, indexs, mark) {
       this.if_free_show = true;
       this.active_index = index;
       this.active_col_index = indexs;
+      this.active_mark = mark;
       if (this.data.property.learn_type === 'dictation') {
         this.current_hz = this.hz_data[index];
       } else {
@@ -287,20 +274,20 @@ export default {
     // 删除记录
     deleteWriteRecord(rowIndex, colIndex, current_hz) {
       this.$set(this.data.option_list[rowIndex].imgArr, colIndex, {});
-      let answer = {
-        hz: current_hz,
-        strokes_content: '',
-        strokes_image_url: '',
-      };
-      this.changeCurQue(answer, colIndex);
+      this.changeCurQue(null, colIndex, this.active_mark);
       this.current_hz_data = null;
+      this.active_mark = '';
       this.$forceUpdate();
     },
-    changeCurQue(answer, colIndex) {
+    changeCurQue(answer, colIndex, mark) {
       if (answer) {
-        let write_model = this.answer_list.write_model;
-        let hz = answer.hz;
-        write_model[hz][colIndex] = answer;
+        let write_model = [];
+        this.answer_list.forEach((itema) => {
+          if (itema.mark === mark) {
+            write_model = itema.strokes_content_list;
+          }
+        });
+        write_model[colIndex] = answer;
       }
     },
   },

+ 7 - 6
src/views/exercise_questions/preview/ChooseTonePreview.vue

@@ -47,12 +47,12 @@
             con_preview[i].user_answer[con_preview[i].item_active_index].select_tone === value
               ? 'active'
               : data.property.answer_mode === 'label' &&
-                  con_preview[i].user_answer[con_preview[i].item_active_index] &&
-                  con_preview[i].user_answer[con_preview[i].item_active_index].select_tone === value &&
-                  con_preview[i].user_answer[con_preview[i].item_active_index].select_letter === active_letter &&
-                  select_item_index === i
-                ? 'active'
-                : '',
+                con_preview[i].user_answer[con_preview[i].item_active_index] &&
+                con_preview[i].user_answer[con_preview[i].item_active_index].select_tone === value &&
+                con_preview[i].user_answer[con_preview[i].item_active_index].select_letter === active_letter &&
+                select_item_index === i
+              ? 'active'
+              : '',
           ]"
           @click="chooseTone(con_preview[i], value, i)"
         >
@@ -158,6 +158,7 @@ export default {
         };
         this.con_preview.push(obj);
       });
+      console.log(this.con_preview);
     },
     handleReplaceTone(e) {
       this.$nextTick(() => {

+ 0 - 1
src/views/exercise_questions/preview/WritePictruePreview.vue

@@ -108,7 +108,6 @@ export default {
         let obj = {
           mark: item.mark,
           value: '',
-          audio_file_id: '',
           accessory_file_id: [], // 上传文件列表
         };
         this.answer_list.push(obj);