Commit 109d71b2 by luyt

feat:调整下载图片

1 parent 6ce7da75
...@@ -10,6 +10,7 @@ Page({ ...@@ -10,6 +10,7 @@ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
noPageAuth: true,
data: { data: {
navStyle, navStyle,
headerHeight: 0, headerHeight: 0,
...@@ -95,14 +96,18 @@ Page({ ...@@ -95,14 +96,18 @@ Page({
actNum, actNum,
activeNavIdx, activeNavIdx,
apiData, apiData,
// isShare
}); });
let item = apiData[actNum]?.productList[activeNavIdx]; let item = apiData[actNum]?.productList[activeNavIdx];
this.shareQuery = `sceneCode=${apiData[actNum].sceneCode}&productCode=${item?.productCode}&productName=${item?.productName}&category=${item?.category}`; this.shareQuery = `sceneCode=${apiData[actNum].sceneCode}&productCode=${item?.productCode}&productName=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&apiData=${apiData}`;
this.shareTrackData = { this.shareTrackData = {
sceneCode: apiData[actNum].sceneCode, sceneCode: apiData[actNum]?.sceneCode,
productCode: item?.productCode, productCode: item?.productCode,
productName: item?.productName, productName: item?.productName,
category: item?.category, category: item?.category,
actNum,
activeNavIdx,
apiData,
}; };
}, },
// 分享按钮 // 分享按钮
...@@ -143,14 +148,20 @@ Page({ ...@@ -143,14 +148,20 @@ Page({
}) + }) +
98 * 2; 98 * 2;
let _this = this;
wx.getImageInfo({
src: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum + 1
}.png`,
success: async () => {
// // console.log("imgAllHeight: ", imgAllHeight); // // console.log("imgAllHeight: ", imgAllHeight);
// let drawFun = new Draw({ // let drawFun = new Draw({
// width: 750, // width: 750,
// height: imgAllHeight, // 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 = [ // let imgList = [
// { // {
...@@ -176,8 +187,8 @@ Page({ ...@@ -176,8 +187,8 @@ Page({
{ {
x: 0, x: 0,
y: 0, y: 0,
width: this.data.imgWidth, width: _this.data.imgWidth,
height: this.data.imgHeight, height: _this.data.imgHeight,
url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${ url: `https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/longpic${
actNum + 1 actNum + 1
}.png`, }.png`,
...@@ -187,30 +198,33 @@ Page({ ...@@ -187,30 +198,33 @@ Page({
// y: erCodeHeight + 30, // y: erCodeHeight + 30,
// width: 120 * 2, // width: 120 * 2,
// height: 120 * 2, // height: 120 * 2,
x: this.data.imgWidth - 64, x: _this.data.imgWidth - 64,
y: this.data.imgHeight - arr[actNum] - 64, y: _this.data.imgHeight - arr[actNum] - 64,
width: 64, width: 64,
height: 64, height: 64,
url: res.data, //二维码 url: res.data, //二维码
}, },
]; ];
// console.log(imgList)
let posterUrl = await drawFun.begin({ let posterUrl = await drawFun.begin({
imageList: imgList, imageList: imgList,
}); });
this.setData({ _this.setData({
posterUrl: posterUrl.path, posterUrl: posterUrl.path,
}); });
console.log("posterUrl.path", posterUrl.path); console.log("posterUrl.path", posterUrl.path);
if (this.data.posterUrl) { if (_this.data.posterUrl) {
wx.pro.saveImageToPhotosAlbum({ wx.saveImageToPhotosAlbum({
url: this.data.posterUrl, //仅为示例,并非真实的资源 filePath: _this.data.posterUrl, //仅为示例,并非真实的资源
success(res) { success(res) {
console.log("res: ", res); console.log("res: ", res);
wx.$api.showToast("下载成功!");
}, },
}); });
} }
_this.modelcloseFn();
this.modelcloseFn(); },
});
}, },
// //模态框关闭 // //模态框关闭
// modelClose() { // modelClose() {
...@@ -242,7 +256,12 @@ Page({ ...@@ -242,7 +256,12 @@ Page({
onLoad(options) { onLoad(options) {
// actNum,activeNavIdx isShare // actNum,activeNavIdx isShare
// 扫码进来 // 扫码进来
let { actNum, activeNavIdx, isShare } = options; let { actNum, activeNavIdx, isShare, merchantId } = options;
if (merchantId) {
this.setData({
isShow: false,
});
}
if (isShare) { if (isShare) {
this.setData({ this.setData({
isShow: false, isShow: false,
...@@ -255,12 +274,14 @@ Page({ ...@@ -255,12 +274,14 @@ Page({
// 发请求 // 发请求
let senceItem = senceData[actNum]; let senceItem = senceData[actNum];
let item = senceData[actNum]?.productList[activeNavIdx]; let item = senceData[actNum]?.productList[activeNavIdx];
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&productCode=${item?.productCode}&productName=${item?.productName}&category=${item?.category}`; this.shareQuery = `sceneCode=${senceItem?.sceneCode}&productCode=${item?.productCode}&productName=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}`;
this.shareTrackData = { this.shareTrackData = {
sceneCode: senceItem.sceneCode, sceneCode: senceItem?.sceneCode,
productCode: item?.productCode, productCode: item?.productCode,
productName: item?.productName, productName: item?.productName,
category: item?.category, category: item?.category,
actNum,
activeNavIdx,
}; };
}, },
......
...@@ -227,7 +227,8 @@ Component({ ...@@ -227,7 +227,8 @@ Component({
wx.$router.go("checkProduct", { wx.$router.go("checkProduct", {
actNum, actNum,
activeNavIdx, activeNavIdx,
apiData apiData,
// isShare: true
}); });
}, },
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!