qinzhipeng_v пре 5 година
родитељ
комит
82c4a4ba24
1 измењених фајлова са 13 додато и 17 уклоњено
  1. 13 17
      src/views/Platform/presentation/Templates/TestReport.vue

+ 13 - 17
src/views/Platform/presentation/Templates/TestReport.vue

@@ -48,9 +48,8 @@
         <div style="margin: 0 12%; font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
         <div style="margin: 0 12%; font-size:18px; font-family:PingFangSC-Medium,PingFang SC; font-weight:500; color:rgba(51,59,74,1); line-height:29px;">
           报告预览
           报告预览
         </div>
         </div>
-        <div class="descr" style=" margin-bottom: 2%; height: 350px; overflow:scroll; overflow-x: hidden">
+        <div class="descr" style=" margin-bottom: 2%; height:350px; overflow:scroll; overflow-x: hidden">
           <acceptthe id="resumeId" ref="acceptthe" :message="preview" />
           <acceptthe id="resumeId" ref="acceptthe" :message="preview" />
-          <img :src="'data:image/jpg;base64,' + img">
         </div>
         </div>
       </div>
       </div>
       <div align="center">
       <div align="center">
@@ -79,7 +78,6 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
-      img: '',
       form: {},
       form: {},
       Present1: false,
       Present1: false,
       presentation1: false,
       presentation1: false,
@@ -103,8 +101,8 @@ export default {
     init(index, newData) {
     init(index, newData) {
       console.log(newData, '提测tan窗')
       console.log(newData, '提测tan窗')
       this.dialogVisible1 = true
       this.dialogVisible1 = true
-      var url = location.href // 获取url中"?"符后的字串
-      var arr = url.split('=')
+      const url = location.href // 获取url中"?"符后的字串
+      const arr = url.split('=')
       switch (index) {
       switch (index) {
         case 1:
         case 1:
           this.present_task = [Number(arr[1])]
           this.present_task = [Number(arr[1])]
@@ -215,24 +213,22 @@ export default {
       this.active = 3
       this.active = 3
     },
     },
     sendReport(e) {
     sendReport(e) {
-      var ele = this.preview
+      const ele = this.preview
       setTimeout(() => {
       setTimeout(() => {
-        var targetDom = document.getElementById('resumeId')
-        // var copyDom = targetDom.cloneNode(true)
-        // document.querySelector('body').appendChild(copyDom)
-        html2canvas(targetDom, { useCORS: true }).then(canvas => {
-          var imgData = canvas.toDataURL('image/png')
-          var sendImgData = imgData.substring(imgData.indexOf(',') + 1)
-          this.img = sendImgData
-          var postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name, 'copyTo': e.names }
+        const targetDom = document.getElementById('resumeId')
+        const copyDom = targetDom.cloneNode(true)
+        document.querySelector('body').appendChild(copyDom)
+        html2canvas(copyDom, { useCORS: true }).then(canvas => {
+          const imgData = canvas.toDataURL('image/png')
+          const sendImgData = imgData.substring(imgData.indexOf(',') + 1)
+          const postData = { 'reportId': ele.id, 'imgStr': sendImgData, 'url': window.location.href, 'emailUser': e.name, 'copyTo': e.names }
           launchTestSendmail(postData).then(res => {
           launchTestSendmail(postData).then(res => {
-            // document.querySelector('body').removeChild(copyDom)
-            // copyDom = null
             res.code === 200 ? this.$message.success('发送测试报告成功') : this.$message.error('发送测试报告失败,请联系管理员!')
             res.code === 200 ? this.$message.success('发送测试报告成功') : this.$message.error('发送测试报告失败,请联系管理员!')
             this.handleClose1()
             this.handleClose1()
+            document.querySelector('body').removeChild(copyDom)
           })
           })
         })
         })
-      }, 6000)
+      }, 500)
     }
     }
   }
   }
 }
 }