陈剑华

fix: 19531 【UI走查-卡片】折叠屏展开-人民号单图卡

... ... @@ -134,6 +134,10 @@ export struct RmhTitle {
return this.rmhInfo?.cnIsAttention && this.rmhInfo?.userType != "5"
}
getFollowText() {
return Number(this.followStatus) === 0 ? '关注' : '已关注'
}
build() {
Flex() {
if (this.rmhInfo.userType != '5') {
... ... @@ -201,8 +205,17 @@ export struct RmhTitle {
.textAlign(TextAlign.Start)
.height(14)
.lineHeight(14)
.width('calc(100% - 65vp)')
// .constraintSize({maxWidth:(DisplayUtils.getDeviceWidth() - 32 - 36 - 18 - this.getTextWidth(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))))})
// .width('calc(100% - 65vp)')
.constraintSize({
maxWidth:(
DisplayUtils.getDeviceWidth()
- 32
- 8 - 12
- 36
- (this.hasRightFollow() ? (19 + 6 + this.getTextWidth(this.getFollowText(), $r('app.float.font_size_13'))) : 0)
- this.getTextWidth(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)), $r("app.float.font_size_12"))
)
})
}
}
... ... @@ -226,7 +239,7 @@ export struct RmhTitle {
.margin({right: 3})
}
Text(Number(this.followStatus) === 0 ? '关注' : '已关注')
Text(this.getFollowText())
.fontSize($r('app.float.font_size_13'))
.fontWeight(600)
.fontColor(Number(this.followStatus) === 0 ? $r('app.color.color_ED2800') : 0xc6c6c6)
... ... @@ -266,10 +279,10 @@ export struct RmhTitle {
}
// 获取文本宽度
private getTextWidth(text: string) {
private getTextWidth(text: string, fontSize: Resource) {
let size = measure.measureTextSize({
textContent: text,
fontSize: $r("app.float.font_size_12")
fontSize: fontSize
})
return px2vp(Number(size.width))
}
... ...