|
@@ -83,7 +83,7 @@ Page({ |
|
|
// 首先要绘制顶部的背景图片,因为它在最底层,然后才能绘制其他内容 |
|
|
// 首先要绘制顶部的背景图片,因为它在最底层,然后才能绘制其他内容 |
|
|
// 绘制背景图 |
|
|
// 绘制背景图 |
|
|
let bgimg1 = this.data.poterbg + `?imageView/2/w/${wW}/h/${wH}` |
|
|
let bgimg1 = this.data.poterbg + `?imageView/2/w/${wW}/h/${wH}` |
|
|
let bgimg2 = bgimg1.replace(imgOrgUrl1, imgNewUrl1) |
|
|
|
|
|
|
|
|
let bgimg2 = bgimg1.replace(this.getimgurl(this.data.poterbg), this.getnewimgurl(this.data.poterbg)) |
|
|
wx.getImageInfo({ |
|
|
wx.getImageInfo({ |
|
|
src: bgimg2, |
|
|
src: bgimg2, |
|
|
success: function(res) { |
|
|
success: function(res) { |
|
@@ -112,7 +112,7 @@ Page({ |
|
|
let topImageWidth = parseInt(315 * scale) // 因为小数有时候会请求不到图片,所以转成int |
|
|
let topImageWidth = parseInt(315 * scale) // 因为小数有时候会请求不到图片,所以转成int |
|
|
let topImageHeight = parseInt(200 * scale) |
|
|
let topImageHeight = parseInt(200 * scale) |
|
|
let src1 = this.data.data.merchantImgUrl + `?imageView/2/w/${topImageWidth}/h/${topImageHeight}` |
|
|
let src1 = this.data.data.merchantImgUrl + `?imageView/2/w/${topImageWidth}/h/${topImageHeight}` |
|
|
let src2 = src1.replace(imgOrgUrl, imgNewUrl) |
|
|
|
|
|
|
|
|
let src2 = src1.replace(this.getimgurl(this.data.data.merchantImgUrl), this.getnewimgurl(this.data.data.merchantImgUrl)) |
|
|
wx.getImageInfo({ |
|
|
wx.getImageInfo({ |
|
|
src: src2, |
|
|
src: src2, |
|
|
success: function(res) { |
|
|
success: function(res) { |
|
@@ -168,6 +168,22 @@ Page({ |
|
|
ctx.draw(true) |
|
|
ctx.draw(true) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
//判断图片路径 |
|
|
|
|
|
getimgurl(str){ |
|
|
|
|
|
if(str.indexOf(imgOrgUrl)!=-1){ |
|
|
|
|
|
return imgOrgUrl |
|
|
|
|
|
}else if(str.indexOf(imgOrgUrl1)!=-1){ |
|
|
|
|
|
return imgOrgUrl1; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// |
|
|
|
|
|
getnewimgurl(str){ |
|
|
|
|
|
if(str.indexOf(imgOrgUrl)!=-1){ |
|
|
|
|
|
return imgNewUrl |
|
|
|
|
|
}else if(str.indexOf(imgOrgUrl1)!=-1){ |
|
|
|
|
|
return imgNewUrl1; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
//截取商品名 |
|
|
//截取商品名 |
|
|
substrTile(str) { |
|
|
substrTile(str) { |
|
|
return str.substr(0, 5) + '...' |
|
|
return str.substr(0, 5) + '...' |
|
@@ -182,8 +198,7 @@ Page({ |
|
|
for (let i = 0; i < that.data.couponList.length; i++) { |
|
|
for (let i = 0; i < that.data.couponList.length; i++) { |
|
|
let imageItem = that.data.couponList[i].coverImg |
|
|
let imageItem = that.data.couponList[i].coverImg |
|
|
let src1 = imageItem + `?imageView/2/w/${cotentImageWidth}/h/${cotentImageHeight}` |
|
|
let src1 = imageItem + `?imageView/2/w/${cotentImageWidth}/h/${cotentImageHeight}` |
|
|
|
|
|
|
|
|
let src2 = src1.replace(imgOrgUrl, imgNewUrl) |
|
|
|
|
|
|
|
|
let src2 = src1.replace(this.getimgurl(imageItem), this.getnewimgurl(imageItem)) |
|
|
wx.getImageInfo({ |
|
|
wx.getImageInfo({ |
|
|
src: src2, |
|
|
src: src2, |
|
|
success: function(res) { |
|
|
success: function(res) { |
|
@@ -195,25 +210,12 @@ Page({ |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (this.data.qrCode) { |
|
|
|
|
|
let coImageWidth = parseInt(120 * scale) |
|
|
|
|
|
let coImageHeight = parseInt(120 * scale) |
|
|
|
|
|
let src1 = this.data.qrCode + `?imageView/2/w/${coImageWidth}/h/${coImageHeight}` |
|
|
|
|
|
let src2 = src1.replace(imgOrgUrl, imgNewUrl) |
|
|
|
|
|
wx.getImageInfo({ |
|
|
|
|
|
src: src2, |
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
ctx.drawImage(res.path, 115 * scale, 425 * scale, coImageWidth, coImageHeight) |
|
|
|
|
|
ctx.draw(true) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
if (this.data.qrCode) { |
|
|
if (this.data.qrCode) { |
|
|
let coImageWidth = parseInt(120 * scale) |
|
|
let coImageWidth = parseInt(120 * scale) |
|
|
let coImageHeight = parseInt(120 * scale) |
|
|
let coImageHeight = parseInt(120 * scale) |
|
|
let src1 = this.data.qrCode + `?imageView/2/w/${coImageWidth}/h/${coImageHeight}` |
|
|
let src1 = this.data.qrCode + `?imageView/2/w/${coImageWidth}/h/${coImageHeight}` |
|
|
let src2 = src1.replace(imgOrgUrl, imgNewUrl) |
|
|
|
|
|
|
|
|
let src2 = src1.replace(this.getimgurl(this.data.qrCode), this.getnewimgurl(this.data.qrCode)) |
|
|
wx.getImageInfo({ |
|
|
wx.getImageInfo({ |
|
|
src: src2, |
|
|
src: src2, |
|
|
success: function(res) { |
|
|
success: function(res) { |
|
|