Commit 643d6712 by luyt

fix:修复二维码下载问题

1 parent d153b831
...@@ -17,7 +17,7 @@ Page({ ...@@ -17,7 +17,7 @@ Page({
headerHeight: 0, headerHeight: 0,
senceData, senceData,
// 模态框 // 模态框
isShow: true, isShow: false,
// IMG_URL: `${IMG_URL}index`, // IMG_URL: `${IMG_URL}index`,
btnList: [ btnList: [
{ {
...@@ -110,6 +110,7 @@ Page({ ...@@ -110,6 +110,7 @@ Page({
// 设置标题 // 设置标题
this.shareTitle = `给你分享一个${senceData[actNum]?.productList[activeNavIdx].proName}~`; this.shareTitle = `给你分享一个${senceData[actNum]?.productList[activeNavIdx].proName}~`;
this.getImgInfo(actNum)
this.setData({ this.setData({
actNum, actNum,
...@@ -156,7 +157,7 @@ Page({ ...@@ -156,7 +157,7 @@ Page({
}, },
// 下载海报 // 下载海报
async download() { async download() {
let { actNum, activeNavIdx, imgHeightArr } = this.data; let { actNum, activeNavIdx, imgHeightArr ,imgPath} = this.data;
let wx_user_info = wx.$storage.get("wx_user_info"); let wx_user_info = wx.$storage.get("wx_user_info");
// console.log('wx_user_info: ', wx_user_info.appId); // console.log('wx_user_info: ', wx_user_info.appId);
let params = { let params = {
...@@ -165,59 +166,22 @@ Page({ ...@@ -165,59 +166,22 @@ Page({
isShare: true, isShare: true,
}; };
console.log(' wx_user_info.appId', wx_user_info)
let res = await createQrCodeApi({ let res = await createQrCodeApi({
appId: wx_user_info.appId, appId: wx_user_info.appId,
// appId:'wx2c28337db96364d2', // appId:'wx2c28337db96364d2',
path: "pages/checkProduct/checkProduct", path: "pages/checkProduct/checkProduct",
scene: JSON.stringify(params), scene: JSON.stringify(params),
}); });
// console.log('res: ', res);
// let { actNum, imgHeightArr } = this.data;
//所有的长度
let imgAllHeight = imgHeightArr[actNum].reduce((total, current) => {
return total + current;
});
// 缺少视频的长度(前4张)+二维码的长度 (单位rpx)
let erCodeHeight =
imgHeightArr[actNum].slice(0, 4).reduce((total, current) => {
return total + current;
}) +
98 * 2;
let _this = this; let _this = this;
wx.getImageInfo({ wx.getImageInfo({
src: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${ src: imgPath,
actNum + 1
}.png`,
success: async () => { success: async () => {
// // console.log("imgAllHeight: ", imgAllHeight);
// let drawFun = new Draw({
// width: 750,
// height: imgAllHeight,
// });
let drawFun = new Draw({ let drawFun = new Draw({
width: _this.data.imgWidth, width: _this.data.imgWidth,
height: _this.data.imgHeight, height: _this.data.imgHeight,
}); });
// let imgList = [
// {
// x: 0,
// y: 0,
// width: 750,
// height: imgAllHeight,
// url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
// actNum + 1
// }.png`,
// },
// {
// x: 245 * 2,
// y: erCodeHeight + 30,
// width: 120 * 2,
// height: 120 * 2,
// url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/discovery_prod1.png`, //二维码
// },
// ];
let arr = [456, 222, 0, 496]; let arr = [456, 222, 0, 496];
let imgList = [ let imgList = [
...@@ -269,16 +233,35 @@ Page({ ...@@ -269,16 +233,35 @@ Page({
// }, // },
// 图片加载事件 // 图片加载事件
onloadFn(event) { onloadFn(event) {
console.log("event.detail", event.detail); // console.log("event.detail", event.detail);
wx.hideLoading();
// this.setData({
// imgHeight: (event.detail.height * 0.2).toFixed(0),
// });
this.setData({ this.setData({
imgHeight: event.detail.height / 5, imgHeight: event.detail.height / 5,
imgWidth: event.detail.width / 5, imgWidth: event.detail.width / 5,
}); });
}, },
// 图片视频加载回调拿到url
getImgInfo(actNum){
wx.showLoading({
title: "加载中",
});
let _this = this;
wx.getImageInfo({
src: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum + 1
}.png`,
success: async (res) => {
console.log('res: ', res)
wx.hideLoading()
wx.nextTick(() => {
_this.setData({
isShow: true,
imgPath:res.path
})
})
}
})
},
// 分享获取懂得用户数 // 分享获取懂得用户数
authorizedFn(e) { authorizedFn(e) {
let res = e.detail; let res = e.detail;
......
...@@ -58,7 +58,6 @@ Component({ ...@@ -58,7 +58,6 @@ Component({
activeNavIdx:this.data.wrapactiveNavIdx activeNavIdx:this.data.wrapactiveNavIdx
}) })
} }
console.log('outshowVideo', this.data.outshowVideo)
if(!this.data.outshowVideo){ if(!this.data.outshowVideo){
this.setData({ this.setData({
...@@ -77,7 +76,6 @@ Component({ ...@@ -77,7 +76,6 @@ Component({
}, },
observers: { observers: {
actNum: function (newval, oldval) { actNum: function (newval, oldval) {
console.log('newval, oldval: ', newval, oldval);
let navList; let navList;
let tab = [ let tab = [
"场景说明", "场景说明",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!