Commit cacdcfc2 by 李伟康

修改代码

1 parent b02f10be
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<view class="text text-center" style="{{tabHeight ? 'height: 60rpx;' : ''}}"> <view class="text text-center" style="{{tabHeight ? 'height: 60rpx;' : ''}}">
{{item}} {{item}}
</view> </view>
<view class="line" style="lineStyle" style="{{tabHeight ? 'margin-top: 6rpx;' : ''}}" /> <view class="line" style="{{tabHeight ? 'margin-top: 6rpx;' : ''}}" />
<!-- --> <!-- -->
<view wx:if="{{filterUtils.hasRedpoint(unreadClueCount)}}" class="redpoint" /> <view wx:if="{{filterUtils.hasRedpoint(unreadClueCount)}}" class="redpoint" />
</view> </view>
......
...@@ -84,7 +84,7 @@ Page({ ...@@ -84,7 +84,7 @@ Page({
path = setRouteData(targetPath).url path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj obj = setRouteData(targetPath).obj
} }
wx.$router.redirectTo(path, obj) wx.$router.reLaunch(path, obj)
} else this.autoLogin(obj) } else this.autoLogin(obj)
}) })
} else this.autoLogin(obj) } else this.autoLogin(obj)
......
...@@ -70,23 +70,21 @@ Component({ ...@@ -70,23 +70,21 @@ Component({
fontWeight: 500 fontWeight: 500
}, },
{ {
x: 12 + drawfun.getTextWidth(n.activityName, 14) + 9, x: 14 + drawfun.getTextWidth(n.activityName, 14) + 9,
y: 38, y: 37,
fontSize: 10, fontSize: 10,
color: '#4466F0', color: '#4466F0',
text: '众筹', text: '众筹',
textBaseline: 'top' textBaseline: 'top',
} border: {
],
lineList: [{
startX: 12 + drawfun.getTextWidth(n.activityName, 14) + 4,
startY: 38,
width: 1, width: 1,
endX: 12 + drawfun.getTextWidth(n.activityName, 14) + 4, color: '#4466F0',
endY: 54, radius: 2,
color: '#8FA5FF', padding: [2, 5],
opacity: 0.5 opacity: 0.5
}] }
}
],
}) })
console.log(res) console.log(res)
wx.hideLoading() wx.hideLoading()
......
...@@ -145,39 +145,13 @@ class Draw { ...@@ -145,39 +145,13 @@ class Draw {
this[_ctx_].textAlign = textAlign this[_ctx_].textAlign = textAlign
this[_ctx_].lineWidth = this.toRpx(2) this[_ctx_].lineWidth = this.toRpx(2)
let text_width = this.getTextWidth(text) let text_width = this.getTextWidth(text)
if (textParams.border) { if (textParams.border) this.drawBorder({
let boxX = textParams.x - 4.5, text,
boxY = textParams.y - 0.5, x: textParams.x,
boxWidth = text_width + 9, y: textParams.y,
boxHeight = lineHeight + 4 fontSize: textParams.fontSize || 12,
if (boxWidth > width - fontX - this.getTextWidth('…') - fontSize) { ...textParams.border
boxWidth = width - boxX + 9
}
this.drawFill({
x: boxX,
y: boxY,
width: boxWidth,
height: boxHeight,
color: textParams.border
})
}
if (textParams.background) {
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 + 8
}
this.drawFill({
x: boxX,
y: boxY,
width: boxWidth,
height: boxHeight,
color: textParams.background
}) })
}
const drawOneLineText = () => { const drawOneLineText = () => {
let textArr = text.toString().split(''), let textArr = text.toString().split(''),
newText = '', newText = '',
...@@ -258,6 +232,26 @@ class Draw { ...@@ -258,6 +232,26 @@ class Draw {
} else drawOneLineText() } else drawOneLineText()
this[_ctx_].stroke() this[_ctx_].stroke()
} }
drawBorder(params) {
let {
x,
y,
text,
color,
width,
radius,
opacity,
padding,
fontSize
} = params
console.log(params)
let topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY, paddingX, paddingY
// if(padding && padding.length>1)
if (radius) {
}
}
drawLine(lineParams, callback) { drawLine(lineParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
let { let {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!