From f9ea389c8c0ba2724a0be655423126e6569c1cff Mon Sep 17 00:00:00 2001 From: luqc Date: Tue, 28 May 2019 18:55:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=95=86=E6=88=B7=E6=B5=B7=E6=8A=A5][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=E9=87=8D=E5=8F=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/canvas/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pages/canvas/index.js b/pages/canvas/index.js index a18b77a..92f1adb 100644 --- a/pages/canvas/index.js +++ b/pages/canvas/index.js @@ -174,7 +174,7 @@ Page({ if (options && options.merchantId) { //店铺名 this.drawNormalText(ctx, "商户名称:" + this.data.data.merchantName, 30 * scale, 295 * scale, 20 * 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, 30 * scale, 320 * scale, 15 * scale, "#F4AA91", "left", "middle", scale); + // this.drawNormalText(ctx, "商户位置:" + this.data.data.shopVoList[0].buildingName + this.data.data.shopVoList[0].floorName + "--" + this.data.data.shopVoList[0].shopNumber, 30 * scale, 320 * scale, 15 * scale, "#F4AA91", "left", "middle", scale); this.drawNormalText(ctx, "商户电话:" + this.data.data.merchantLinkPhone, 30 * scale, 348 * scale, 16 * scale, "#000", "left", "middle", scale); this.drawNormalText(ctx, "长按识别,进店去看看", 155 * scale, 470 * scale, 16 * scale, "#000", "left", "middle", scale); @@ -190,11 +190,16 @@ Page({ if(i==0){ metrics = 35; that.drawNormalText(ctx, that.data.data.merchantVoList[i].merchantName, metrics, 375 * scale, 14 * scale, "#000", "left", "middle", scale); - }else{ + }else if(i<=2){ 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); + if(i==2){ + that.drawNormalText(ctx,''+that.data.data.merchantVoList[i].merchantName+"..", metrics, 375 * scale, 14 * scale, "#000", "left", "middle", scale); + }else{ + that.drawNormalText(ctx,''+that.data.data.merchantVoList[i].merchantName+"、", metrics, 375 * scale, 14 * scale, "#000", "left", "middle", scale); + } + } } ctx.draw(true);