增加商品详情页的分享功能:修改小程序海报无法二次显示问题

youmengting-dev
游梦婷 1 year ago
parent 17ef94ebc0
commit a880676a32
  1. 53
      physical-merchants/classify/poster/poster.vue

@ -75,8 +75,12 @@
this.dataInfo = JSON.parse(decodeURIComponent(e.obj));
}
},
mounted() {
this.couponQrCode()
onReady() {
this.$nextTick(()=>{
this.couponQrCode()
})
},
//
methods: {
@ -85,7 +89,6 @@
this.swiperIndex = e.detail.current;
},
async couponQrCode() {
uni.showLoading({
title: '加载中...'
});
@ -101,8 +104,9 @@
} else {
this.level = qrCode.CorrectLevel.L
} */
let level = qrCode.CorrectLevel.L;
console.log(that.dataInfo, " that.dataInfo")
let qrcode = await new qrCode('qrImg', {
let qrde = await new qrCode('qrImg', {
text: that.dataInfo.goLink,
width: 100,
height: 100,
@ -110,9 +114,11 @@
loadingText: '二维码生成中', // loading
colorDark: '#000000', //
colorLight: '#ffffff', //
correctLevel: qrCode.CorrectLevel.L, //L/M/Q/H
correctLevel: level, //L/M/Q/H
// usingIn: this //this
})
console.log(qrde, " qrde")
//
uni.canvasToTempFilePath({
canvasId: 'qrImg',
@ -121,7 +127,7 @@
// H5tempFilePath base64
// console.log('yz-qr:', res)
this.dataInfo.recommendCodeGoods = res.tempFilePath;
qrcode = null;
/* qrcode = null; */
/* uni.getFileSystemManager().readFile({
filePath: res.tempFilePath, //
encoding: 'base64', //
@ -135,7 +141,7 @@
},
fail: (err) => {
uni.hideLoading();
qrcode = null;
/* qrcode = null; */
console.log(err)
}
}, this);
@ -443,38 +449,7 @@
return rowText;
},
savePic(Url) {
Url = this.dialogImgUrl //
var triggerEvent = "touchstart"; //
var blob = new Blob([''], {
type: 'application/octet-stream'
}); //blob
var url = URL.createObjectURL(blob); //
var a = document.createElement('a'); // a
a.href = Url; //ahref
//a.download,使
a.download = Url.replace(/(.*\/)*([^.]+.*)/ig, "$2").split("?")[0];
/* var e = document.createEvent('MouseEvents'); //创建事件MouseEvents鼠标事件
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); //initMouseEvent*/
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent
var e = new MouseEvent('click', (true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null));
//
a.dispatchEvent(e);
//createObjectURLrevokeObjectURL
URL.revokeObjectURL(url);
/*
//
var imgs = document.getElementsByTagName("img");
for(var i = 0,o;o = imgs[i];i++){
o.addEventListener(triggerEvent,function(){
var newurl = this.getAttribute("src");
saveAs(newurl);
},false);
} */
},
},
//

Loading…
Cancel
Save