Forráskód Böngészése

修改生词模版-完成

gcj 3 éve
szülő
commit
1f1f9528ad

+ 8 - 13
src/components/Adult/inputModules/PurePreview.vue

@@ -167,7 +167,7 @@
                   show-word-limit
                 ></el-input>
               </div>
-              <div class="adult-book-input-item">
+              <!-- <div class="adult-book-input-item">
                 <span class="adult-book-lable">音频:</span>
                 <Upload
                   :changeFillId="changeMp3"
@@ -176,19 +176,16 @@
                   :uploadType="'mp3'"
                   :index="index"
                 />
-              </div>
+              </div> -->
             </template>
-            <div class="adult-book-input-item">
+            <!-- <div class="adult-book-input-item">
               <span class="adult-book-lable">配置:</span>
               <el-checkbox-group v-model="item.type" @change="forupdata">
                 <el-checkbox label="mh">描红</el-checkbox>
                 <el-checkbox label="lm">临摹</el-checkbox>
               </el-checkbox-group>
-              <!-- <el-radio-group v-model="item.type" @change="forupdata">
-                <el-radio label="mh">描红</el-radio>
-                <el-radio label="lm">临摹</el-radio>
-              </el-radio-group> -->
-            </div>
+            
+            </div> -->
           </template>
         </div>
       </template>
@@ -284,9 +281,7 @@
               </el-radio-group>
             </div>
           </div>
-          <div class="addoption" @click="addyinjie(index)">
-            添加一个音节
-          </div>
+          <div class="addoption" @click="addyinjie(index)">添加一个音节</div>
         </div>
       </template>
       <div class="Big-Book-addrole">
@@ -605,7 +600,7 @@ export default {
       this.changeCurQue(data);
     },
     // 选项的图片
-    changeImage(fileList, item, index) {
+    changeImage(fileList, duration, index) {
       const articleImgList = JSON.parse(JSON.stringify(fileList));
       const articleImgRes = [];
       articleImgList.forEach((item) => {
@@ -619,7 +614,7 @@ export default {
           articleImgRes.push(obj);
         }
       });
-      this.curQue.option[index].mp3_list = JSON.parse(
+      this.curQue.option[index].img_list = JSON.parse(
         JSON.stringify(articleImgRes)
       );
     },

+ 23 - 9
src/components/Adult/preview/NewWordShow.vue

@@ -213,7 +213,10 @@ export default {
     handleAnswerData() {
       let _this = this;
       _this.curQue.option.forEach((item, index) => {
-        let con = item.con;
+        let con =
+          item.imgOrText == "text"
+            ? item.con
+            : item.img_list && item.img_list.length > 0 && item.img_list[0].id;
         let arr = [];
         if (
           _this.curQue.Bookanswer.writeModel &&
@@ -273,15 +276,25 @@ export default {
       _this.ifFreeShow = true;
       _this.activeIndex = index;
       _this.activeColIndex = indexs;
-      _this.currentHz = _this.curQue.option[index].con;
+      _this.currentHz =
+        _this.curQue.option[index].imgOrText == "text"
+          ? _this.curQue.option[index].con
+          : _this.curQue.option[index].img_list[0].id;
       _this.currenHzData = imgUrl;
-      //console.log(this.currenHzData);
     },
     //删除记录
-    deleteWriteRecord(rowIndex, colIndex) {
+    deleteWriteRecord(rowIndex, colIndex, currentHz) {
       this.$set(this.curQue.option[rowIndex].imgarr, colIndex, {});
+      let answer = {
+        hz: currentHz,
+        strokes_content: "",
+        strokes_image_url: "",
+      };
+      this.changeCurQue(answer, colIndex);
+      this.$forceUpdate();
     },
     changeCurQue(answer, colIndex) {
+      debugger;
       if (answer) {
         let writeModel = this.curQue.Bookanswer.writeModel;
         let hz = answer.hz;
@@ -295,6 +308,7 @@ export default {
           writeModel[hz][colIndex] = answer;
         }
       }
+      console.log(this.curQue.Bookanswer.writeModel);
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -303,11 +317,11 @@ export default {
     if (!_this.curQue.Bookanswer) {
       _this.curQue.Bookanswer = JSON.parse(JSON.stringify(_this.userAnswer));
     }
-    if (_this.TaskModel != "ANSWER") {
-      _this.handleData();
-    } else {
-      _this.handleAnswerData();
-    }
+    // if (_this.TaskModel != "ANSWER") {
+    //   _this.handleData();
+    // } else {
+    _this.handleAnswerData();
+    //}
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},

+ 0 - 1
src/components/Adult/preview/Voicefullscreen.vue

@@ -751,7 +751,6 @@ export default {
         if (val) {
           setTimeout(() => {
             _this.cardHeight = _this.$refs.wordcard.offsetHeight;
-            console.log(_this.cardHeight, _this.screenHeight, _this.clientY);
             if (_this.screenHeight - _this.clientY > _this.cardHeight) {
               _this.top = _this.clientY + 20;
             } else {

+ 47 - 10
src/components/Adult/preview/components/FreewriteLettle.vue

@@ -16,7 +16,7 @@
     />
     <div class="right-content">
       <div class="right-strockred">
-        <template v-if="!hasPlay && data.strokes_image_url">
+        <template v-if="!hasPlay && data && data.strokes_image_url">
           <img class="img" :src="data.strokes_image_url" alt="" />
         </template>
         <FreeWriteQP
@@ -37,7 +37,10 @@
         ></a>
       </div>
       <ul class="nav-list">
-        <li @click="play()" :class="currenHzData.history ? '' : 'disabled'">
+        <li
+          @click="play()"
+          :class="currenHzData && currenHzData.history ? '' : 'disabled'"
+        >
           播放
         </li>
         <li
@@ -158,13 +161,22 @@ export default {
       this.learn_mode = mode;
     },
     resetHuahua() {
-      if (this.hasPlay) {
-        this.$message.warning("请等待播放完成");
+      let _this = this;
+      if (_this.hasPlay) {
+        _this.$message.warning("请等待播放完成");
         return;
       }
-      this.imgOrCans = false;
-      this.$refs.esign.reset();
-      this.data.strokes_image_url = "";
+      _this.imgOrCans = false;
+      _this.$refs.esign.reset();
+      if (_this.data) {
+        _this.data.strokes_image_url = "";
+      }
+      _this.$emit(
+        "deleteWriteRecord",
+        _this.rowIndex,
+        _this.colIndex,
+        _this.currentHz
+      );
       //this.removeImage();
     },
     removeImage() {
@@ -187,10 +199,34 @@ export default {
         });
       }
     },
+    //不保存到记录列表
     handleWriteImg() {
       if (this.TaskModel == "ANSWER") {
         return;
       }
+      this.$refs.esign.generate().then((res) => {
+        let Book_img = res.replace("data:image/png;base64,", "");
+        let write_img = "data:image/png;base64," + Book_img;
+        let answer = {};
+        answer = {
+          hz: this.currentHz,
+          strokes_content: JSON.stringify(this.$refs.esign.history),
+          strokes_image_url: write_img,
+        };
+        this.$emit("changeCurQue", answer, this.colIndex);
+        let obj = {
+          history: this.$refs.esign.history,
+          strokes_image_url: write_img,
+        };
+        this.closeifFreeShow(obj, this.rowIndex, this.colIndex);
+        // this.$message.warning("请先书写在保存");
+      });
+    },
+    //保存到记录列表
+    handleWriteImg_save() {
+      if (this.TaskModel == "ANSWER") {
+        return;
+      }
       this.$refs.esign
         .generate()
         .then((res) => {
@@ -203,6 +239,7 @@ export default {
             strokes_image_url: write_img,
           };
           this.$emit("changeCurQue", answer, this.colIndex);
+
           let data = {
             courseware_id: this.currentTreeID,
             hz: this.currentHz,
@@ -235,10 +272,10 @@ export default {
     let color = _this.colorsList[_this.colorIndex];
     _this.hanzicolor = color;
     _this.hanziweight = 6;
-    if (this.currenHzData.strokes_image_url) {
-      this.imgOrCans = true;
+    if (_this.currenHzData && _this.currenHzData.strokes_image_url) {
+      _this.imgOrCans = true;
     }
-    this.data = JSON.parse(JSON.stringify(this.currenHzData));
+    _this.data = JSON.parse(JSON.stringify(_this.currenHzData));
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},