chenquansheng

fix |> 修复文章详情页吴评论数时滑到评论区不显示正文标识

... ... @@ -185,53 +185,13 @@ export struct CommentIconComponent {
Image(this.styleType == 1 ? $r('app.media.comment_icon') :
$r('app.media.comment_icon_white')).width(24).height(24)
// Stack({alignContent:Alignment.Start}) {
if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) {
RelativeContainer() {
Image(this.styleType == 1 ? this.showMainText?$r('app.media.comment_icon_text_bg'):$r('app.media.comment_icon_number_bg') : this.showMainText?$r('app.media.comment_icon_text_block_bg'):$r('app.media.ic_like_back_Select'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 20,
right: 1,
bottom: 1
}
})
.alignRules({
top: { anchor: "Text", align: VerticalAlign.Top },
left: { anchor: "Text", align: HorizontalAlign.Start },
right: { anchor: "Text", align: HorizontalAlign.End },
bottom: { anchor: "Text", align: VerticalAlign.Bottom },
})// .offset({
// x:-6
// })
.id("Image")
Text(this.showMainText?'正文':NumberFormatterUtils.formatNumberWithWan(this.publishCommentModel.totalCommentNumer))// Text("44444444")
.fontSize(8)
.fontColor(this.showMainText?'#222222':'#ffffff')// .backgroundColor('#ED2800')
.height(12)
.textAlign(TextAlign.Center)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})// .margin({left: 4,right:4
// })
/*动态计算文字宽度*/
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.publishCommentModel.totalCommentNumer)) +
12)// .backgroundColor(Color.Green)
.id("Text")
.visibility(this.publishCommentModel.totalCommentNumer ? Visibility.Visible : Visibility.Hidden)
// .offset({
// x: 3
// })
if (this.showMainText) {
this.commentIcon()
}else {
if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) {
this.commentIcon()
}
// }
.offset({
x: this.showMainText?8:12,
y: -2
})
}
}
}
... ... @@ -242,6 +202,55 @@ export struct CommentIconComponent {
// .backgroundColor(Color.Blue)
}
@Builder
commentIcon() {
RelativeContainer() {
Image(this.styleType == 1 ? this.showMainText?$r('app.media.comment_icon_text_bg'):$r('app.media.comment_icon_number_bg') : this.showMainText?$r('app.media.comment_icon_text_block_bg'):$r('app.media.ic_like_back_Select'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 20,
right: 1,
bottom: 1
}
})
.alignRules({
top: { anchor: "Text", align: VerticalAlign.Top },
left: { anchor: "Text", align: HorizontalAlign.Start },
right: { anchor: "Text", align: HorizontalAlign.End },
bottom: { anchor: "Text", align: VerticalAlign.Bottom },
})// .offset({
// x:-6
// })
.id("Image")
Text(this.showMainText?'正文':NumberFormatterUtils.formatNumberWithWan(this.publishCommentModel.totalCommentNumer))// Text("44444444")
.fontSize(8)
.fontColor(this.showMainText?'#222222':'#ffffff')// .backgroundColor('#ED2800')
.height(12)
.textAlign(TextAlign.Center)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})// .margin({left: 4,right:4
// })
/*动态计算文字宽度*/
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.publishCommentModel.totalCommentNumer)) +
12)// .backgroundColor(Color.Green)
.id("Text")
.visibility(this.publishCommentModel.totalCommentNumer ? Visibility.Visible : Visibility.Hidden)
// .offset({
// x: 3
// })
}
// }
.offset({
x: this.showMainText?8:12,
y: -2
})
}
private getMeasureText(text: string) {
... ...