natasha 9 months ago
parent
commit
f0afcd05db

+ 26 - 19
src/components/Adult/preview/components/FreewriteLettle.vue

@@ -37,12 +37,12 @@
         ></a>
       </div>
       <ul class="nav-list">
-        <li
+        <!-- <li
           @click="play()"
           :class="currenHzData && currenHzData.history ? '' : 'disabled'"
         >
           播放
-        </li>
+        </li> -->
         <li
           @click="handleWriteImg"
           :class="TaskModel == 'ANSWER' ? 'disabled' : ''"
@@ -206,22 +206,28 @@ export default {
       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("请先书写在保存");
+      localStorage.removeItem("bookImg");
+      this.$nextTick(() => {
+        this.$refs.esign.handleGenerate();
+        setTimeout(() => {
+          let Book_img = localStorage
+            .getItem("bookImg")
+            .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
+          };
+          console.log(this.$refs.esign);
+          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);
+        }, 500);
       });
     },
     //保存到记录列表
@@ -372,7 +378,8 @@ export default {
       margin-top: 16px;
       > li {
         height: 34px;
-        width: 124px;
+        // width: 124px;
+        width: 100%;
         text-align: center;
         font-style: normal;
         font-weight: bold;

+ 16 - 4
src/components/Adult/preview/components/FreewriteWord.vue

@@ -79,13 +79,25 @@ export default {
       this.$refs.esign
         .generate()
         .then(res => {
-          this.resultImg = res;
-          this.handleGetImg();
-          this.changePraShow();
+          // console.log(res);
+          // this.resultImg = res;
+          localStorage.setItem("bookImg", res);
+          // this.handleGetImg();
+          // this.changePraShow();
+          return res;
         })
         .catch(err => {
-          this.changePraShow();
+          // this.changePraShow();
         });
+    },
+    // 返回笔顺
+    async returnGenerate() {
+      let res = "";
+      await this.$refs.esign.generate().then(res => {
+        console.log(res);
+        res = res;
+      });
+      return res;
     }
   },
   //生命周期 - 创建完成(可以访问当前this实例)