Sfoglia il codice sorgente

[小程序生成海报][修改]

tags/江西版6.1.0
luqc 6 anni fa
parent
commit
f953e71670
2 ha cambiato i file con 33 aggiunte e 13 eliminazioni
  1. +9
    -0
      ext.json
  2. +24
    -13
      pages/canvas/index.js

+ 9
- 0
ext.json Vedi File

@@ -7,6 +7,7 @@
"etcpVersion": "release",
"etcpCallbackUrl": "https://ciformall.youlane.cn/api/carCallback/etcpPaidCallback",
"ifHaveWebSocket": "0",
<<<<<<< HEAD
"ifHaveCarModular": "1",
"imgProxy": [
{
@@ -22,6 +23,14 @@
"newUrl": "https://ciformall.youlane.cn/img2"
}
]
=======
"ifHaveCarModular": "1",
"imgOrgUrl": "https://iformall-net.s3.cn-northwest-1.amazonaws.com.cn",
"imgOrgUrl2": "https://wx.qlogo.cn",
"imgOrgUrl1": "https://s3.cn-northwest-1.amazonaws.com.cn",
"imgNewUrl": "https://ciformall.youlane.cn/img",
"imgNewUrl1": "https://ciformall.youlane.cn/img1"
>>>>>>> [小程序生成海报][修改]
},
"name": "富茂客官开发",
"weappId": "wxea71200db93d756b",


+ 24
- 13
pages/canvas/index.js Vedi File

@@ -138,10 +138,8 @@ Page({
// 绘制白色背景
ctx.setFillStyle("#fbfbfb");
ctx.fillRect(0, 0, that.data.windowWidth, that.data.windowHeight);
// that.roundRect(ctx,0, 320, that.data.windowWidth, 320,50)
ctx.drawImage(res.path, 0, 50, topImageWidth, topImageHeight);
ctx.setFillStyle("blue");
that.roundRect(ctx,12, 270, 330, 150,10)
that.roundRect(ctx,12, 270, 320, 150,10)
that.drawOtherImage(ctx, scale);
that.drawOtherContent(ctx, scale,options);
that.darwAvatarArc(ctx, that.data.avatarUrl, 10, 8, 35, 35);
@@ -150,6 +148,19 @@ Page({
}
});
},
//绘制微信头像
drawAvatarimg(ctx, scale) {
var that = this;
//商户详情海报
let src1 =that.data.avatarUrl +`?imageView/2/w/${topImageWidth}/h/${topImageHeight}`;
let src2 = util.getProxyImgUrl(src1);
wx.getImageInfo({
src: src2,
success: function(res) {
that.darwAvatarArc(ctx, res.path, 10, 8, 35, 35);
}
});
},
// 商户海报绘制
drawOtherContent(ctx, scale,options) {
//昵称
@@ -158,10 +169,10 @@ Page({
this.drawNormalText(ctx,"---"+this.data.mallname+"---",175 * scale,530 * scale,16 * scale,"#000","left","middle",scale);
if (options && options.merchantId) {
//店铺名
this.drawNormalText(ctx,"商户名称:"+this.data.data.merchantName,40 * scale,300 * scale,22 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"商户位置:"+this.data.data.shopVoList[0].buildingName+this.data.data.shopVoList[0].floorName+"--"+this.data.data.shopVoList[0].shopNumber,40 * scale,340 * scale,18 * scale,"#F4AA91","left","middle",scale);
this.drawNormalText(ctx,"商户电话:"+this.data.data.merchantLinkPhone,40 * scale,380 * scale,16 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"长按识别,进店去看看",155 * scale,500 * scale,16 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"商户名称:"+this.data.data.merchantName,40 * scale,310 * scale,22 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"商户位置:"+this.data.data.shopVoList[0].buildingName+this.data.data.shopVoList[0].floorName+"--"+this.data.data.shopVoList[0].shopNumber,40 * scale,350 * scale,18 * scale,"#F4AA91","left","middle",scale);
this.drawNormalText(ctx,"商户电话:"+this.data.data.merchantLinkPhone,40 * scale,390 * scale,16 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"长按识别,进店去看看",155 * scale,510 * scale,16 * scale,"#000","left","middle",scale);
if (this.data.couponList.length > 0) {
for (let i = 0; i < this.data.couponList.length; i++) {
// 第一个商品信息
@@ -177,12 +188,12 @@ Page({
}
} else if (options && options.couponChannelId) {
this.drawNormalText(ctx,"长按识别,享优惠",155 * scale,500 * scale,16 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,this.data.data.title,40 * scale,300 * scale,23 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"售价:" + this.data.data.salePriceStr,40 * scale,330 * scale,20* scale,"#F4AA91","left","middle",scale);
this.drawNormalText(ctx,"原价:" + this.data.data.salePriceStr,120 * scale,330 * scale,16 * scale,"#DFDCDB","left","middle",scale);
this.drawNormalText(ctx,"适用门店:",40 * scale,360 * scale,16 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,this.data.data.title,40 * scale,310 * scale,23 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,"售价:" + this.data.data.salePriceStr,40 * scale,340 * scale,20* scale,"#F4AA91","left","middle",scale);
this.drawNormalText(ctx,"原价:" + this.data.data.salePriceStr,120 * scale,340 * scale,16 * scale,"#DFDCDB","left","middle",scale);
this.drawNormalText(ctx,"适用门店:",40 * scale,370 * scale,16 * scale,"#000","left","middle",scale);
for(var i=0;i<this.data.data.merchantVoList.length;i++){
this.drawNormalText(ctx,this.data.data.merchantVoList[i].merchantName+"、",40 * scale+40*i,390 * scale,16 * scale,"#000","left","middle",scale);
this.drawNormalText(ctx,this.data.data.merchantVoList[i].merchantName+"、",40 * scale+40*i,400 * scale,16 * scale,"#000","left","middle",scale);
}
ctx.draw(true);
}
@@ -207,7 +218,7 @@ Page({
wx.getImageInfo({
src: src2,
success: function(res) {
ctx.drawImage(res.path,25 * scale,435 * scale,coImageWidth,coImageHeight);
ctx.drawImage(res.path,25 * scale,455 * scale,coImageWidth,coImageHeight);
ctx.draw(true);
}
});


Caricamento…
Annulla
Salva