|
@@ -39,7 +39,8 @@
|
|
|
import echarts from 'echarts'
|
|
|
import { bugDailyList, dailyReport } from '@/api/testPresentetion'
|
|
|
import { dailyReportSendmail } from '@/api/ResultPage'
|
|
|
-import html2canvas from 'html2canvas'
|
|
|
+// import html2canvas from 'html2canvas'
|
|
|
+import domtoimage from 'dom-to-image'
|
|
|
export default {
|
|
|
name: 'TestPresenyL',
|
|
|
data() {
|
|
@@ -121,20 +122,35 @@ export default {
|
|
|
},
|
|
|
|
|
|
sendReport(e, ele) {
|
|
|
- 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)
|
|
|
- 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: '发送测试报告失败,请联系管理员!' })
|
|
|
- that.btn = true
|
|
|
- })
|
|
|
+ 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: '发送测试报告失败,请联系管理员!' })
|
|
|
})
|
|
|
- }, 1000)
|
|
|
+ // var img = new Image()
|
|
|
+ // img.src = dataUrl
|
|
|
+ // document.body.appendChild(img)
|
|
|
+ }).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)
|
|
|
+ // 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: '发送测试报告失败,请联系管理员!' })
|
|
|
+ // that.btn = true
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }, 1000)
|
|
|
}
|
|
|
}
|
|
|
}
|