guhongwei 5 years ago
parent
commit
1a82d34721
1 changed files with 11 additions and 10 deletions
  1. 11 10
      src/views/student/certCard.vue

+ 11 - 10
src/views/student/certCard.vue

@@ -78,16 +78,16 @@ export default {
       this.template = new printTemplate();
       this.template = new printTemplate();
       this.template.push({
       this.template.push({
         name: 'expressDelivery1',
         name: 'expressDelivery1',
-        unit: 'mm',
-        size: [210, 297],
-        fixed: [{ type: 'image', x: 0, y: 0, default: this.zhengshu, width: 210, height: 297 }],
+        unit: 'px',
+        size: [1046.93, 714.02],
+        fixed: [{ type: 'image', x: 0, y: 0, default: this.zhengshu, width: 1046.93, height: 714.02 }],
         data: {
         data: {
-          school_name: { type: 'text', x: 15, y: 15, fontSize: 3.5 },
-          entry_year: { type: 'text', x: 56, y: 55, fontSize: 3.5 },
-          major: { type: 'text', x: 107, y: 105, fontSize: 3.5 },
-          name: { type: 'text', x: 158, y: 155, fontSize: 3.5 },
-          termname: { type: 'text', x: 15, y: 255, fontSize: 3.5 },
-          cernum: { type: 'text', x: 100, y: 250, fontSize: 3.5 },
+          school_name: { type: 'text', x: 15, y: 15, fontSize: 16 },
+          entry_year: { type: 'text', x: 56, y: 55, fontSize: 16 },
+          major: { type: 'text', x: 107, y: 105, fontSize: 16 },
+          name: { type: 'text', x: 158, y: 155, fontSize: 16 },
+          termname: { type: 'text', x: 15, y: 255, fontSize: 16 },
+          cernum: { type: 'text', x: 100, y: 250, fontSize: 16 },
         },
         },
       });
       });
     },
     },
@@ -103,10 +103,11 @@ export default {
       let duplicate = _.cloneDeep(this.list);
       let duplicate = _.cloneDeep(this.list);
       duplicate = duplicate.map(i => {
       duplicate = duplicate.map(i => {
         i.cernum = `2020${i.termname}${i.classname}`;
         i.cernum = `2020${i.termname}${i.classname}`;
+        i.entry_year = `nihao${i.termname}${i.classname}`;
         return i;
         return i;
       });
       });
       // this.template.print('expressDelivery1', [duplicate[0]]).then(pdf => {
       // this.template.print('expressDelivery1', [duplicate[0]]).then(pdf => {
-      this.template.print('expressDelivery1', [duplicate[0], duplicate[1]]).then(pdf => {
+      this.template.print('expressDelivery1', [duplicate[0]]).then(pdf => {
         if (pdf) {
         if (pdf) {
           this.$message.success('生成成功');
           this.$message.success('生成成功');
           this.url = pdf.output('bloburi', { filename: '证书' });
           this.url = pdf.output('bloburi', { filename: '证书' });