xugenyuan

fix |> 桌面组件卡片--左图右文样式显示桌面卡片时未能显示红色的数字排序

http://192.168.1.3:8080/zentao/bug-view-18778.html

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
... ... @@ -12,7 +12,19 @@ const DAILY_NEWSPAPER_DEEP_LINK = "rmrbapp://rmrb.app/openwith?type=topic&subTyp
struct DailyNewspaperWidgetCard {
@LocalStorageProp('paperType') paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown;
@LocalStorageProp('paperInfo') paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo;
@LocalStorageProp('paperContents') paperContents: FormNewspaperPaperContent[] = [];
@LocalStorageProp('paperContents') @Watch("paperContentsUpdates") paperContents: FormNewspaperPaperContent[] = [];
@State needShowNumber: boolean = false
aboutToAppear(): void {
}
paperContentsUpdates() {
const hasAnyRightImages = this.paperContents.filter((content) => {
return content.coverUrl && content.coverUrl.length > 0
}).length > 0
this.needShowNumber = !this.paperInfo.showLeftImage && !hasAnyRightImages
}
build() {
... ... @@ -73,7 +85,12 @@ struct DailyNewspaperWidgetCard {
List() {
ForEach(this.paperContents, (item: FormNewspaperPaperContent, index: number) => {
ListItem() {
ContentCellView({content: item, index: index, hasImage: (item.coverUrl && item.coverUrl.length > 0 ? true : false)})
ContentCellView({
content: item,
index: index,
needShowNumber: this.needShowNumber,
hasImage: (item.coverUrl && item.coverUrl.length > 0 ? true : false)
})
}
}, (item: FormNewspaperPaperContent, index) => index + JSON.stringify(item))
}
... ... @@ -90,11 +107,17 @@ struct DailyNewspaperWidgetCard {
@Component
struct ContentCellView {
@Prop needShowNumber: boolean = false
@Prop content: FormNewspaperPaperContent
private index : number = 0
private hasImage: boolean = false
build() {
Row() {
if (this.needShowNumber) {
Text((this.index + 1) + "")
.fontColor("#ED2800")
.margin({left: 4, right: 4})
}
Text(this.content.title)
.maxLines((this.content.coverUrl && this.content.coverUrl.length > 0 ? 2 : 1))
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...