qinzhipeng_v 5 жил өмнө
parent
commit
5e933a6ee9

+ 21 - 14
src/views/Platform/presentation/testPresenyL.vue

@@ -122,21 +122,28 @@ export default {
     },
 
     sendReport(e, ele) {
-      var node = document.getElementById('resumeId')
-      domtoimage.toPng(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 => {
-          res.code === 200 ? console.log('发送测试报告成功') : console.log('发送测试报告失败,请联系管理员!')
-          // res.code === 200 ? that.$message({ type: 'success', message: '发送测试报告成功' }) : that.$message({ type: 'error', message: '发送测试报告失败,请联系管理员!' })
+      // var node = document.getElementById('resumeId')
+      // domtoimage.toPng(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 => {
+      //     // res.code === 200 ? that.$message({ type: 'success', message: '发送测试报告成功' }) : that.$message({ type: 'error', message: '发送测试报告失败,请联系管理员!' })
+      //   })
+      //   var img = new Image()
+      //   img.src = dataUrl
+      //   document.body.appendChild(img)
+
+      domtoimage.toJpeg(document.getElementById('resumeId'), { quality: 0.95 })
+        .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) })
         })
-        // var img = new Image()
-        // img.src = dataUrl
-        // document.body.appendChild(img)
-      }).catch(function(error) {
-        console.error('oops, something went wrong!', error)
-      })
+      // }).catch(function(error) {
+      //   console.error('oops, something went wrong!', error)
+      // })
       // setTimeout(() => {
       //   var that = this
       //   that.btn = false