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,7 +115,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | ||
115 | ctx.textAlign = 'justify'; | 115 | ctx.textAlign = 'justify'; |
116 | ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); | 116 | ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); |
117 | } | 117 | } |
118 | - initHeight += 22; //22为字体的高度 | 118 | + initHeight += 35; //22为字体的高度 |
119 | lineWidth = 0; | 119 | lineWidth = 0; |
120 | lastSubStrIndex = i; | 120 | lastSubStrIndex = i; |
121 | titleHeight += 20; | 121 | titleHeight += 20; |
@@ -173,16 +173,16 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | @@ -173,16 +173,16 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | ||
173 | // 绘制头像 | 173 | // 绘制头像 |
174 | ctx.save(); | 174 | ctx.save(); |
175 | ctx.beginPath(); | 175 | ctx.beginPath(); |
176 | - ctx.arc(58, 63, 28, 0, 2*Math.PI); | 176 | + ctx.arc(58, 52, 28, 0, 2*Math.PI); |
177 | ctx.clip(); | 177 | ctx.clip(); |
178 | // console.log('1__________________>',app.globalData.userInfo['head_pic']); | 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 | ctx.restore(); | 180 | ctx.restore(); |
181 | 181 | ||
182 | // 绘制昵称 | 182 | // 绘制昵称 |
183 | ctx.setFontSize(14); | 183 | ctx.setFontSize(14); |
184 | ctx.setFillStyle('#ADADAD'); | 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 | ctx.drawImage(this.data.coverImg, 0, 104, 480, 382); | 188 | ctx.drawImage(this.data.coverImg, 0, 104, 480, 382); |
@@ -191,7 +191,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | @@ -191,7 +191,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | ||
191 | // 绘制文字 | 191 | // 绘制文字 |
192 | ctx.setFontSize(24); | 192 | ctx.setFontSize(24); |
193 | ctx.setFillStyle('#1E1E1E'); | 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 | ctx.drawImage(this.data.ewm, 310, 525, 132, 132); | 197 | ctx.drawImage(this.data.ewm, 310, 525, 132, 132); |
@@ -400,7 +400,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | @@ -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 | that.setData({ | 404 | that.setData({ |
405 | coverImg: res.path | 405 | coverImg: res.path |
406 | }); | 406 | }); |
@@ -529,6 +529,10 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | @@ -529,6 +529,10 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | ||
529 | showActionSheet: 'false' | 529 | showActionSheet: 'false' |
530 | }) | 530 | }) |
531 | var self = this; | 531 | var self = this; |
532 | + if (res.from === 'button') { | ||
533 | + // 来自页面内转发按钮 | ||
534 | + console.log(res.target) | ||
535 | + } | ||
532 | return { | 536 | return { |
533 | title: this.data.details.name, | 537 | title: this.data.details.name, |
534 | success: function(res) { | 538 | success: function(res) { |
@@ -538,5 +542,17 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | @@ -538,5 +542,17 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un | ||
538 | console.log('comple', res) | 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,7 +66,7 @@ | ||
66 | 66 | ||
67 | <!-- 生成海报 --> | 67 | <!-- 生成海报 --> |
68 | <view class="{{showPlaybill ? 'playbill':'playbill active'}}" hidden="{{showPlaybill}}"> | 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 | <canvas canvas-id="myCanvas" catchtouchmove="true" style="width:480px;height:738px;position:absolute;left:5000%;"></canvas> | 70 | <canvas canvas-id="myCanvas" catchtouchmove="true" style="width:480px;height:738px;position:absolute;left:5000%;"></canvas> |
71 | <view class="playbill-save" bindtap="onSaveToPhone">保存至相册</view> | 71 | <view class="playbill-save" bindtap="onSaveToPhone">保存至相册</view> |
72 | </view> | 72 | </view> |
packageA/pages/liveStreamDetails/liveStreamDetails.wxss
@@ -224,7 +224,7 @@ | @@ -224,7 +224,7 @@ | ||
224 | } | 224 | } |
225 | .playbill-pic { | 225 | .playbill-pic { |
226 | display: block; | 226 | display: block; |
227 | - width: 478rpx; | 227 | + width: 560rpx; |
228 | height: 737rpx; | 228 | height: 737rpx; |
229 | /* border-width: 31rpx 20rpx 51rpx; | 229 | /* border-width: 31rpx 20rpx 51rpx; |
230 | border-color: #f23030; | 230 | border-color: #f23030; |