Commit 8bf532f52465875164c240aebe0abe6701a8e1fd
1 parent
68ffa338
修改海报文字行高
Showing
3 changed files
with
24 additions
and
8 deletions
packageA/pages/liveStreamDetails/liveStreamDetails.js
... | ... | @@ -115,7 +115,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
115 | 115 | ctx.textAlign = 'justify'; |
116 | 116 | ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); |
117 | 117 | } |
118 | - initHeight += 22; //22为字体的高度 | |
118 | + initHeight += 35; //22为字体的高度 | |
119 | 119 | lineWidth = 0; |
120 | 120 | lastSubStrIndex = i; |
121 | 121 | titleHeight += 20; |
... | ... | @@ -173,16 +173,16 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
173 | 173 | // 绘制头像 |
174 | 174 | ctx.save(); |
175 | 175 | ctx.beginPath(); |
176 | - ctx.arc(58, 63, 28, 0, 2*Math.PI); | |
176 | + ctx.arc(58, 52, 28, 0, 2*Math.PI); | |
177 | 177 | ctx.clip(); |
178 | 178 | // console.log('1__________________>',app.globalData.userInfo['head_pic']); |
179 | - ctx.drawImage(this.data.avatarUrl, 30, 35, 56, 56); | |
179 | + ctx.drawImage(this.data.avatarUrl, 30, 24, 56, 56); | |
180 | 180 | ctx.restore(); |
181 | 181 | |
182 | 182 | // 绘制昵称 |
183 | 183 | ctx.setFontSize(14); |
184 | 184 | ctx.setFillStyle('#ADADAD'); |
185 | - ctx.fillText(this.data.nickName, 106, 68); | |
185 | + ctx.fillText(this.data.nickName, 106, 52); | |
186 | 186 | |
187 | 187 | // 绘制主图 |
188 | 188 | ctx.drawImage(this.data.coverImg, 0, 104, 480, 382); |
... | ... | @@ -191,7 +191,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
191 | 191 | // 绘制文字 |
192 | 192 | ctx.setFontSize(24); |
193 | 193 | ctx.setFillStyle('#1E1E1E'); |
194 | - this.drawText(ctx, title, 51, 563, 300, 300, 2); | |
194 | + this.drawText(ctx, title, 51, 563, 300, 360, 2); | |
195 | 195 | |
196 | 196 | // 绘制小程序码 |
197 | 197 | ctx.drawImage(this.data.ewm, 310, 525, 132, 132); |
... | ... | @@ -400,7 +400,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
400 | 400 | |
401 | 401 | |
402 | 402 | // 请求主图 |
403 | - that.getImageInfo(that.data.details['cover_img']).then(res => { | |
403 | + that.getImageInfo(that.data.details['share_img']).then(res => { | |
404 | 404 | that.setData({ |
405 | 405 | coverImg: res.path |
406 | 406 | }); |
... | ... | @@ -529,6 +529,10 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
529 | 529 | showActionSheet: 'false' |
530 | 530 | }) |
531 | 531 | var self = this; |
532 | + if (res.from === 'button') { | |
533 | + // 来自页面内转发按钮 | |
534 | + console.log(res.target) | |
535 | + } | |
532 | 536 | return { |
533 | 537 | title: this.data.details.name, |
534 | 538 | success: function(res) { |
... | ... | @@ -538,5 +542,17 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
538 | 542 | console.log('comple', res) |
539 | 543 | } |
540 | 544 | } |
545 | + }, | |
546 | + | |
547 | + onShareTimeline: function (res) { | |
548 | + if (res.from === 'button') { | |
549 | + // 来自页面内转发按钮 | |
550 | + console.log(res.target) | |
551 | + } | |
552 | + return { | |
553 | + title: '自定义转发标题', | |
554 | + path: '/page/user?id=123' | |
555 | + } | |
541 | 556 | } |
557 | + | |
542 | 558 | }) | ... | ... |
packageA/pages/liveStreamDetails/liveStreamDetails.wxml
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | |
67 | 67 | <!-- 生成海报 --> |
68 | 68 | <view class="{{showPlaybill ? 'playbill':'playbill active'}}" hidden="{{showPlaybill}}"> |
69 | - <image src="{{canvasToImgPath}}" class="playbill-pic" mode="aspectFill"></image> | |
69 | + <image src="{{canvasToImgPath}}" class="playbill-pic" mode="widthFix"></image> | |
70 | 70 | <canvas canvas-id="myCanvas" catchtouchmove="true" style="width:480px;height:738px;position:absolute;left:5000%;"></canvas> |
71 | 71 | <view class="playbill-save" bindtap="onSaveToPhone">保存至相册</view> |
72 | 72 | </view> | ... | ... |
packageA/pages/liveStreamDetails/liveStreamDetails.wxss