qinzhipeng_v 5 years ago
parent
commit
1db1cce0f2
1 changed files with 22 additions and 24 deletions
  1. 22 24
      src/views/Platform/presentation/testPresenyL.vue

+ 22 - 24
src/views/Platform/presentation/testPresenyL.vue

@@ -39,8 +39,8 @@
 import echarts from 'echarts'
 import { bugDailyList, dailyReport } from '@/api/testPresentetion'
 import { dailyReportSendmail } from '@/api/ResultPage'
-// import html2canvas from 'html2canvas'
-import domtoimage from 'dom-to-image'
+import html2canvas from 'html2canvas'
+// import domtoimage from 'dom-to-image'
 export default {
   name: 'TestPresenyL',
   data() {
@@ -122,8 +122,7 @@ export default {
     },
 
     sendReport(e, ele) {
-      var node = document.getElementById('resumeId')
-      debugger
+      // var node = document.getElementById('resumeId')
       // domtoimage.toPng(node).then(function(dataUrl) {
       //   var url = dataUrl
       //   url = url.toString().substring(url.indexOf(',') + 1)
@@ -135,29 +134,28 @@ export default {
       //   img.src = dataUrl
       //   document.body.appendChild(img)
 
-      domtoimage.toJpeg(node).then(function(dataUrl) {
-        debugger
-        var url = dataUrl
-        url = url.toString().substring(url.indexOf(',') + 1)
-        var postData = { 'reportId': ele.id, 'imgStr': url, 'url': window.location.href, 'emailUser': e }
-        dailyReportSendmail(postData).then(res => { console.log(res) })
-      })
+      // domtoimage.toJpeg(node).then(function(dataUrl) {
+      //   var url = dataUrl
+      //   url = url.toString().substring(url.indexOf(',') + 1)
+      //   var postData = { 'reportId': ele.id, 'imgStr': url, 'url': window.location.href, 'emailUser': e }
+      //   dailyReportSendmail(postData).then(res => { console.log(res) })
+      // })
       // }).catch(function(error) {
       //   console.error('oops, something went wrong!', error)
       // })
-      // setTimeout(() => {
-      //   var that = this
-      //   that.btn = false
-      //   html2canvas(document.getElementById('resumeId'), { useCORS: true, windowWidth: document.getElementById('resumeId').scrollWidth, windowHeight: document.getElementById('resumeId').scrollHeight }).then(function(canvas) {
-      //     var url = canvas.toDataURL('image/png', 1.0)
-      //     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
+        html2canvas(document.getElementById('resumeId'), { useCORS: true, windowWidth: document.getElementById('resumeId').scrollWidth, windowHeight: document.getElementById('resumeId').scrollHeight }).then(function(canvas) {
+          var url = canvas.toDataURL('image/png', 1.0)
+          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)
     }
   }
 }