更换贺报下载的方法14

This commit is contained in:
xuxingjun
2024-12-26 14:55:15 +08:00
parent bc34e0591d
commit 77cc861e52

View File

@@ -115,61 +115,6 @@ export default {
domToImage() {
console.log('this.$refs.xingdownLoad', this.$refs.xingdownLoad);
this.$refs.xingdownLoad = this.$refs.xingdownLoad
// let domElement = this.$refs.generateImg
// console.log('this.$refs.generateImg',domElement);
// console.log(location);
// html2canvas(domElement, {
// width: domElement.offsetWidth,
// height: domElement.offsetHeight,
// backgroundColor: '#fff',
// scale: 1,
// dpi: 300
// }).then((canvas) => {
// // 转换canvas为PNG图片并压缩
// canvas.toBlob(
// (blob) => {
// // const a = document.createElement('a')
// // a.href = URL.createObjectURL(blob)
// // a.download = '业绩贺报.png'
// // a.click()
// // let newimg = new Image()
// // newimg.src = URL.createObjectURL(blob)
// // newimg.onload = function () {
// // URL.revokeObjectURL(newimg.src)
// // callback(newimg)
// // }
// this.blobToBase64(blob).then((base64String) => {
// console.log('xing');
// base64Excel({ base64Img: base64String }).then(res => {
// if (res.result == '0') {
// console.log('xingxing');
// if(this.downLoadJin == false) {
// this.downLoadJin = true
// EWebBridge.webCallAppInJs('download', {
// name: '业绩贺报.png',
// url: res.path
// })
// .then(() => {
// console.log('下载完成')
// })
// .catch(() => {
// this.$toast.fail('图片下载失败,请重新下载!')
// })
// }
// setTimeout(() => {
// this.downLoadJin = false
// }, 5000);
// }
// })
// })
// },
// 'image/png'
// // quality
// )
// })
setTimeout(() => {
let domElement = this.$refs.xingdownLoad;
async function captureAndProcessImage() {
@@ -215,6 +160,8 @@ export default {
// 检查结果,并处理下载逻辑
if (res.result === '0') {
console.log(5555);
console.log(res);
console.log(res.path);
// if (!this.downLoadJin) {
// this.downLoadJin = true;
// 调用原生应用下载接口,并等待其完成
@@ -222,6 +169,7 @@ export default {
name: '业绩贺报.png',
url: res.path
});
console.log('下载完成');
// } else {
// // this.$toast.fail('已有下载任务在进行,请稍后再试!');
@@ -242,7 +190,7 @@ export default {
// 调用 captureAndProcessImage 函数
captureAndProcessImage();
this.$refs.xingdownLoad = null;
this.$refs.xingdownLoad.parentNode.removeChild(this.$refs.xingdownLoad);
return false
}, 500);