Browse Source

[canvas][修改]:[生成海报分享到朋友圈文字的修改]

tags/江西版6.1.0
meo 6 years ago
parent
commit
a9848961e1
1 changed files with 12 additions and 7 deletions
  1. +12
    -7
      pages/canvas/index.js

+ 12
- 7
pages/canvas/index.js View File

@@ -195,15 +195,20 @@ Page({
this.drawNormalText(ctx, "适用门店:", 30 * scale, 348 * scale, 16 * scale, "#000", "left", "middle", scale); this.drawNormalText(ctx, "适用门店:", 30 * scale, 348 * scale, 16 * scale, "#000", "left", "middle", scale);


//适用门店字体的排列 //适用门店字体的排列
this.data.data.merchantVoList.map(function (file, index) {
let word = file.merchantName;
let metrics = ctx.measureText(word).width;
metrics += metrics;
that.drawNormalText(ctx, that.data.data.merchantVoList[index].merchantName,metrics, 375 * scale, 14 * scale, "#000", "left", "middle", scale);
})
for (let i = 0; i < that.data.data.merchantVoList.length;i++){
let metrics;
if(i==0){
metrics = 35;
that.drawNormalText(ctx, that.data.data.merchantVoList[i].merchantName, metrics, 375 * scale, 14 * scale, "#000", "left", "middle", scale);
}else{
let word = that.data.data.merchantVoList[i - 1].merchantName;
let metrics = (ctx.measureText(word).width) * scale;
metrics += metrics;
that.drawNormalText(ctx,'、'+that.data.data.merchantVoList[i].merchantName, metrics, 375 * scale, 14 * scale, "#000", "left", "middle", scale);
}
}
ctx.draw(true); ctx.draw(true);
} }

ctx.draw(true); ctx.draw(true);
}, },
//绘制小程序码 //绘制小程序码


Loading…
Cancel
Save