Commit b02f10be by 李伟康

提交代码

1 parent c830b6a5
......@@ -35,31 +35,59 @@ Component({
{
userInfo
} = wx.$storage.get(),
res = await drawfun.begin({
imageList: [{
x: 0,
y: 0,
width: 279,
height: 66,
url: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/poster-bg.png'
},
{
x: 16,
y: 70,
width: 247,
height: 472,
url: n.posterUrl
}
],
textList: [{
x: 12,
y: 14,
fontSize: 14,
color: '#2D2D33',
text: userInfo.merchantName,
textBaseline:'top'
}]
})
merchantName = userInfo.merchantName.length > 12 ? `${userInfo.merchantName.substring(0, 12)}...` : userInfo.merchantName,
res = await drawfun.begin({
imageList: [{
x: 0,
y: 0,
width: 279,
height: 66,
url: 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/poster-bg.png'
},
{
x: 16,
y: 70,
width: 247,
height: 472,
url: n.posterUrl
}
],
textList: [{
x: 12,
y: 14,
fontSize: 14,
color: '#2D2D33',
text: merchantName,
textBaseline: 'top'
},
{
x: 12,
y: 36,
fontSize: 14,
color: '#1B233D',
text: n.activityName,
textBaseline: 'top',
fontWeight: 500
},
{
x: 12 + drawfun.getTextWidth(n.activityName, 14) + 9,
y: 38,
fontSize: 10,
color: '#4466F0',
text: '众筹',
textBaseline: 'top'
}
],
lineList: [{
startX: 12 + drawfun.getTextWidth(n.activityName, 14) + 4,
startY: 38,
width: 1,
endX: 12 + drawfun.getTextWidth(n.activityName, 14) + 4,
endY: 54,
color: '#8FA5FF',
opacity: 0.5
}]
})
console.log(res)
wx.hideLoading()
this.setData({
......@@ -67,11 +95,18 @@ Component({
show: true
})
},
download() {
const filePath = this.data.poster
wx.saveImageToPhotosAlbum({
filePath
})
},
hide() {
this.setData({
show: false,
poster: ''
})
}
},
noScroll() {}
}
})
\ No newline at end of file
......@@ -6,6 +6,10 @@
bottom: 0;
left: 0;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.bg {
position: absolute;
......@@ -13,12 +17,31 @@
height: 100%;
z-index: -1;
background: rgba(28, 27, 35, 0.60);
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.80), 0 0 1px 0 rgba(92, 114, 246, 0.30), inset 0 0 1px 0 rgba(93, 115, 235, 0.30);
}
.poster {
width: 558rpx;
height: 1108rpx;
height: 60%;
border-radius: 8rpx;
}
.btn {
width: 320rpx;
height: 88rpx;
line-height: 88rpx;
background-image: linear-gradient(-60deg, #556AF5 0%, #7197FF 100%);
border-radius: 16rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
margin-top: 32rpx;
}
.tips {
margin: 16rpx 80rpx 0;
font-size: 24rpx;
color: #FFFFFF;
line-height: 36rpx;
}
}
\ No newline at end of file
<block wx:if="{{show}}">
<view class="layout">
<view class="layout" catchtouchmove="noScroll">
<view class="bg" bindtap="hide"></view>
<image src="{{poster}}" class="poster"></image>
<image src="{{poster}}" class="poster" mode="aspectFit"></image>
<view class="btn" bindtap="download">保存至相册</view>
<view class="tips">
提示:这是您的专属活动海报,请下载转发给门店员工注册并参与活动分享。请不要将此海报转发给非相关活动参与者,避免活动数据泄漏。
</view>
</view>
</block>
\ No newline at end of file
......@@ -146,12 +146,12 @@ class Draw {
this[_ctx_].lineWidth = this.toRpx(2)
let text_width = this.getTextWidth(text)
if (textParams.border) {
let boxX = this.toRpx(textParams.x - 4.5),
boxY = this.toRpx(textParams.y - 0.5),
boxWidth = text_width + this.toRpx(9),
boxHeight = lineHeight + this.toRpx(4)
let boxX = textParams.x - 4.5,
boxY = textParams.y - 0.5,
boxWidth = text_width + 9,
boxHeight = lineHeight + 4
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) {
boxWidth = width - boxX + this.toRpx(9)
boxWidth = width - boxX + 9
}
this.drawFill({
x: boxX,
......@@ -162,12 +162,12 @@ class Draw {
})
}
if (textParams.background) {
let boxX = this.toRpx(textParams.x - 4),
boxY = this.toRpx(textParams.y),
boxWidth = text_width + this.toRpx(8),
boxHeight = lineHeight + this.toRpx(3)
let boxX = textParams.x - 4,
boxY = textParams.y,
boxWidth = text_width + 8,
boxHeight = lineHeight + 3
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) {
boxWidth = width - boxX + this.toRpx(8)
boxWidth = width - boxX + 8
}
this.drawFill({
x: boxX,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!