panxiandiao_i 5 rokov pred
rodič
commit
0e37e3729b

+ 15 - 16
src/views/Platform/presentation/testPresenyL.vue

@@ -48,6 +48,7 @@ export default {
       userInformation: localStorage.getItem('username'),
       userNames: localStorage.getItem('realname'),
       bugshow: '',
+      postData: {},
       fromCreat: {},
       TestProgress: '',
       projectProgress: '',
@@ -121,7 +122,7 @@ export default {
       })
     },
 
-    sendReport(e, ele) {
+    async sendReport(e, ele) {
       // var node = document.getElementById('resumeId')
       // debugger
       // domtoimage.toPng(node).then(function(dataUrl) {
@@ -145,21 +146,19 @@ export default {
       // }).catch(function(error) {
       //   console.error('oops, something went wrong!', error)
       // })
-      setTimeout(() => {
-        var that = this
-        that.btn = false
-        html2canvas(document.getElementById('app-main'), { useCORS: true, windowWidth: document.getElementById('app-main').offsetWidth, windowHeight: document.getElementById('app-main').scrollHeight }).then(function(canvas) {
-          var url = canvas.toDataURL('image/png', 1.0)
-          console.log(url)
-          url = url.toString().substring(url.indexOf(',') + 1)
-          console.log(url)
-          var postData = { 'reportId': ele.id, 'imgStr': url, 'url': window.location.href, 'emailUser': e }
-          dailyReportSendmail(postData).then(res => {
-            res.code === 200 ? that.$message({ type: 'success', message: '发送测试报告成功' }) : that.$message({ type: 'error', message: '发送测试报告失败,请联系管理员!' })
-            that.btn = true
-          })
-        })
-      }, 1000)
+      // setTimeout(() => {
+      var that = this
+      that.btn = false
+      await html2canvas(document.getElementById('app-main'), { useCORS: true, windowWidth: document.getElementById('app-main').offsetWidth, windowHeight: document.getElementById('app-main').scrollHeight }).then(function(canvas) {
+        var url = canvas.toDataURL('image/png', 1.0)
+        url = url.toString().substring(url.indexOf(',') + 1)
+        that.postData = { 'reportId': ele.id, 'imgStr': url, 'url': window.location.href, 'emailUser': e }
+      })
+      dailyReportSendmail(that.postData).then(res => {
+        res.code === 200 ? that.$message({ type: 'success', message: '发送测试报告成功' }) : that.$message({ type: 'error', message: '发送测试报告失败,请联系管理员!' })
+        that.btn = true
+      })
+      // }, 1000)
     }
   }
 }