瀏覽代碼

书写字段

natasha 1 年之前
父節點
當前提交
51a97c5fe2
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      src/views/exercise_questions/preview/components/common/FreewriteLettle.vue

+ 6 - 5
src/views/exercise_questions/preview/components/common/FreewriteLettle.vue

@@ -23,7 +23,7 @@
         </a>
       </div>
       <ul class="nav-list">
-        <li :class="currenHzData && currenHzData.history ? '' : 'disabled'" @click="play()">播放</li>
+        <li :class="currenHzData && currenHzData.strokes_content ? '' : 'disabled'" @click="play()">播放</li>
         <li :class="disabled ? 'disabled' : ''" @click="handleWriteImg">保存</li>
       </ul>
     </div>
@@ -49,7 +49,7 @@ export default {
       type: Object,
       default: () => ({
         strokes_image: '',
-        history: [],
+        strokes_content: '[]',
       }),
     },
     rowIndex: {
@@ -111,7 +111,7 @@ export default {
   methods: {
     play() {
       let _this = this;
-      if (this.currenHzData && this.currenHzData.history) {
+      if (this.currenHzData && this.currenHzData.strokes_content) {
         if (this.hasPlay) {
           this.$message.warning('请等待播放完成');
           return;
@@ -122,7 +122,7 @@ export default {
         let cxt = document.getElementById('esign').getContext('2d');
         cxt.clearRect(0, 0, c.width, c.height);
         let history = null;
-        history = _this.currenHzData.history;
+        history = JSON.parse(_this.currenHzData.strokes_content);
         const len = history.length;
         let i = 0;
         const runner = () => {
@@ -193,7 +193,8 @@ export default {
         };
         this.$emit('changeCurQue', answer, this.colIndex);
         let obj = {
-          history: this.$refs.esign.history,
+          hz: this.currentHz,
+          strokes_content: JSON.stringify(this.$refs.esign.history),
           strokes_image: write_img,
         };
         this.$emit('closeIfFreeShow', obj, this.rowIndex, this.colIndex);