Sfoglia il codice sorgente

Merge branch 'master' into NPC-lhd

natasha 3 anni fa
parent
commit
d999079302

+ 6 - 2
src/components/Adult/Preview.vue

@@ -171,7 +171,11 @@
             >
               <template v-if="itemss.data">
                 <template v-if="itemss.type == 'ligature_chs'">
-                  <Ligature :cur-que="itemss.data" :theme-color="themeColor" :TaskModel="TaskModel" />
+                  <Ligature
+                    :cur-que="itemss.data"
+                    :theme-color="themeColor"
+                    :TaskModel="TaskModel"
+                  />
                 </template>
                 <template v-if="itemss.data.type == 'image'">
                   <Picture
@@ -717,7 +721,7 @@ export default {
               if (Bookanswer) {
                 // let answerData = JSON.parse(_this.bookAnswerContent);
                 let answerData = JSON.parse(Bookanswer);
-                if (answerData) {
+                if (answerData && itemss.data) {
                   itemss.data.Bookanswer =
                     answerData.length > 0 &&
                     answerData[index].table_list &&

+ 1 - 0
src/components/Adult/preview/ArticleViewChs/Practicechs.vue

@@ -322,6 +322,7 @@ export default {
     "NNPENewWordList",
     "currentTreeID",
     "config",
+    "TaskModel",
   ],
   components: {
     AudioLine,

+ 43 - 12
src/components/Adult/preview/NewWordShow.vue

@@ -77,7 +77,7 @@
                 ]"
               ></div> -->
               <img
-                v-if="!playStatus && items.strokes_image_url"
+                v-if="!playStatus && items && items.strokes_image_url"
                 :src="items.strokes_image_url"
                 alt=""
               />
@@ -111,7 +111,6 @@
         :colIndex="activeColIndex"
         :closeifFreeShow="closeifFreeShow"
         :TaskModel="TaskModel"
-        :writeList="curQue.Bookanswer.writeModel"
         @changeCurQue="changeCurQue"
         @deleteWriteRecord="deleteWriteRecord"
       />
@@ -211,6 +210,30 @@ export default {
         });
       });
     },
+    // 处理数据
+    handleAnswerData() {
+      let _this = this;
+      _this.curQue.option.forEach((item, index) => {
+        let con = item.con;
+        let arr = [];
+        if (
+          _this.curQue.Bookanswer.writeModel &&
+          _this.curQue.Bookanswer.writeModel[con]
+        ) {
+          arr = _this.curQue.Bookanswer.writeModel[con].map((it) => {
+            if (it && it.strokes_content) {
+              it.history = JSON.parse(it.strokes_content);
+            }
+
+            return it;
+          });
+        } else {
+          arr = [null, null, null, null, null, null];
+        }
+        item.imgarr = arr;
+      });
+      console.log(_this.curQue.option);
+    },
     changePraShow() {
       this.isPraShow = false;
       this.ifFreeShow = false;
@@ -239,35 +262,39 @@ export default {
       this.isPraShow = true;
     },
     closeifFreeShow(data, rowIndex, colIndex) {
-      this.curQue.option[rowIndex].imgarr[colIndex - 1] = data;
+      this.curQue.option[rowIndex].imgarr[colIndex] = data;
       this.ifFreeShow = false;
       this.freeWrite(data, rowIndex, colIndex);
       this.$forceUpdate();
     },
     freeWrite(imgUrl, index, indexs) {
-      this.ifFreeShow = true;
-      this.activeIndex = index;
-      this.activeColIndex = indexs;
-      this.currentHz = this.curQue.option[index].con;
-      this.currenHzData = imgUrl;
+      let _this = this;
+      if (_this.TaskModel == "ANSWER" && !imgUrl) {
+        return;
+      }
+      _this.ifFreeShow = true;
+      _this.activeIndex = index;
+      _this.activeColIndex = indexs;
+      _this.currentHz = _this.curQue.option[index].con;
+      _this.currenHzData = imgUrl;
       //console.log(this.currenHzData);
     },
     //删除记录
     deleteWriteRecord(rowIndex, colIndex) {
       this.$set(this.curQue.option[rowIndex].imgarr, colIndex, {});
     },
-    changeCurQue(answer, rowIndex) {
+    changeCurQue(answer, colIndex) {
       if (answer) {
         let writeModel = this.curQue.Bookanswer.writeModel;
         let hz = answer.hz;
         if (writeModel.hasOwnProperty(hz)) {
-          writeModel[hz][rowIndex] = answer;
+          writeModel[hz][colIndex] = answer;
         } else {
           writeModel[hz] = [];
           for (let i = 0; i < 6; i++) {
             writeModel[hz].push(null);
           }
-          writeModel[hz][0] = answer;
+          writeModel[hz][colIndex] = answer;
         }
         console.log(this.curQue.Bookanswer);
       }
@@ -279,7 +306,11 @@ export default {
     if (!_this.curQue.Bookanswer) {
       _this.curQue.Bookanswer = JSON.parse(JSON.stringify(_this.userAnswer));
     }
-    this.handleData();
+    if (_this.TaskModel != "ANSWER") {
+      _this.handleData();
+    } else {
+      _this.handleAnswerData();
+    }
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},

+ 15 - 3
src/components/Adult/preview/components/FreewriteLettle.vue

@@ -30,13 +30,22 @@
           ref="esign"
           id="esign"
         />
-        <a @click="resetHuahua" class="clean-btn"></a>
+        <a
+          @click="resetHuahua"
+          class="clean-btn"
+          v-if="TaskModel != 'ANSWER'"
+        ></a>
       </div>
       <ul class="nav-list">
         <li @click="play()" :class="currenHzData.history ? '' : 'disabled'">
           播放
         </li>
-        <li @click="handleWriteImg">保存</li>
+        <li
+          @click="handleWriteImg"
+          :class="TaskModel == 'ANSWER' ? 'disabled' : ''"
+        >
+          保存
+        </li>
       </ul>
     </div>
   </div>
@@ -179,6 +188,9 @@ export default {
       }
     },
     handleWriteImg() {
+      if (this.TaskModel == "ANSWER") {
+        return;
+      }
       this.$refs.esign
         .generate()
         .then((res) => {
@@ -190,7 +202,7 @@ export default {
             strokes_content: JSON.stringify(this.$refs.esign.history),
             strokes_image_url: write_img,
           };
-          this.$emit("changeCurQue", answer, this.rowIndex);
+          this.$emit("changeCurQue", answer, this.colIndex);
           let data = {
             courseware_id: this.currentTreeID,
             hz: this.currentHz,