Ver Fonte

修改添加打印组件

gcj há 2 anos atrás
pai
commit
51f8dcdae2

+ 9 - 7
src/components/corpus/Strockplay.vue

@@ -51,6 +51,7 @@ export default {
     "strokePlayColor",
     "palyWidth",
     "BoxbgType",
+    "curItem",
   ],
   data() {
     return {
@@ -86,13 +87,8 @@ export default {
         _this.Book_text,
         {
           charDataLoader: function (char, onComplete) {
-            let MethodName = "hz_resource_manager-GetHZStrokesContent";
-            let data = {
-              hz: char,
-            };
-            getContentFile(MethodName, data).then((res) => {
-              onComplete(res);
-            });
+            let charData = _this.handleData();
+            onComplete(charData);
           },
           padding: 5,
           showOutline: true,
@@ -104,6 +100,12 @@ export default {
       let _this = this;
       _this.writer.animateCharacter();
     },
+    handleData() {
+      if (this.curItem) {
+        let charData = JSON.parse(JSON.stringify(this.curItem));
+        return charData;
+      }
+    },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},

+ 0 - 21
src/views/wordcard/cread.vue

@@ -148,27 +148,6 @@
           />
         </div>
       </div>
-      <div
-        class="word_main"
-        id="pdfDom"
-        ref="pdfDom"
-        v-if="writeTableData && writeTableData.result"
-      >
-        <div
-          class="none_word_main_table"
-          v-for="(itemT, indexT) in writeTableData.result"
-          :key="indexT"
-        >
-          <writeTable
-            :none="true"
-            :type="'none' + typeIndex"
-            :dataConfig="writeTableData"
-            :data="itemT"
-            :pageNumber="' ' + (indexT + 1)"
-            :totalNumber="writeTableData.result.length"
-          />
-        </div>
-      </div>
     </div>
     <div class="preview_dv" v-if="isPreview">
       <img

+ 3 - 9
src/views/wordcard/print.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="none_writeTable writeTable" v-if="dataConfig">
+  <div class="none_writeTable writeTable printTable" v-if="dataConfig">
     <div
       class="none_word_main_table"
       v-for="(data, indexT) in dataConfig.result"
@@ -41,6 +41,7 @@
                 :strokeColor="dataConfig.fontColor"
                 :palyWidth="dataConfig.playWidth"
                 :BoxbgType="dataConfig.BoxbgType"
+                :curItem="itemI.hzDetail"
                 :targetDiv="
                   'writeTop-item-' +
                   indexT +
@@ -170,15 +171,13 @@ export default {
   //方法集合
   methods: {
     download2() {
-      this.loading.close();
-      document.getElementsByTagName("body")[0].style.zoom = 2;
+      document.getElementsByClassName("printTable")[0].style.zoom = 2;
       //执行window.print打印功能
       window.print();
       this.$message({
         message: "操作成功",
         type: "success",
       });
-      document.getElementsByTagName("body")[0].style.zoom = 1;
       this.$router.replace({
         path: "/wordcard/cread",
         query: { cachesType: "push" },
@@ -217,11 +216,6 @@ export default {
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let _this = this;
-    this.loading = this.$loading({
-      lock: true,
-      text: "Loading",
-      spinner: "el-icon-loading",
-    });
     let writeTableData = localStorage.getItem("writeTableData");
     if (writeTableData) {
       _this.dataConfig = JSON.parse(writeTableData);

+ 2 - 3
src/views/wordcard/writeTable.vue

@@ -44,6 +44,7 @@
               :strokeColor="dataConfig.fontColor"
               :palyWidth="dataConfig.playWidth"
               :BoxbgType="dataConfig.BoxbgType"
+              :curItem="itemI.hzDetail"
               :targetDiv="
                 'writeTop-item-' +
                 pageNumber +
@@ -218,9 +219,7 @@ export default {
   //生命周期 - 创建完成(可以访问当前this实例)
   created() {},
   //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {
-    console.log(this.data);
-  },
+  mounted() {},
   //生命周期-创建之前
   beforeCreated() {},
   //生命周期-挂载之前