fix |> 桌面组件卡片--左图右文样式显示桌面卡片时未能显示红色的数字排序
http://192.168.1.3:8080/zentao/bug-view-18778.html Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
25 additions
and
2 deletions
| @@ -12,7 +12,19 @@ const DAILY_NEWSPAPER_DEEP_LINK = "rmrbapp://rmrb.app/openwith?type=topic&subTyp | @@ -12,7 +12,19 @@ const DAILY_NEWSPAPER_DEEP_LINK = "rmrbapp://rmrb.app/openwith?type=topic&subTyp | ||
| 12 | struct DailyNewspaperWidgetCard { | 12 | struct DailyNewspaperWidgetCard { |
| 13 | @LocalStorageProp('paperType') paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown; | 13 | @LocalStorageProp('paperType') paperType: FormNewspaperPaperType = FormNewspaperPaperType.unknown; |
| 14 | @LocalStorageProp('paperInfo') paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo; | 14 | @LocalStorageProp('paperInfo') paperInfo: FormNewspaperPaperInfo = {} as FormNewspaperPaperInfo; |
| 15 | - @LocalStorageProp('paperContents') paperContents: FormNewspaperPaperContent[] = []; | 15 | + @LocalStorageProp('paperContents') @Watch("paperContentsUpdates") paperContents: FormNewspaperPaperContent[] = []; |
| 16 | + @State needShowNumber: boolean = false | ||
| 17 | + | ||
| 18 | + aboutToAppear(): void { | ||
| 19 | + | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + paperContentsUpdates() { | ||
| 23 | + const hasAnyRightImages = this.paperContents.filter((content) => { | ||
| 24 | + return content.coverUrl && content.coverUrl.length > 0 | ||
| 25 | + }).length > 0 | ||
| 26 | + this.needShowNumber = !this.paperInfo.showLeftImage && !hasAnyRightImages | ||
| 27 | + } | ||
| 16 | 28 | ||
| 17 | build() { | 29 | build() { |
| 18 | 30 | ||
| @@ -73,7 +85,12 @@ struct DailyNewspaperWidgetCard { | @@ -73,7 +85,12 @@ struct DailyNewspaperWidgetCard { | ||
| 73 | List() { | 85 | List() { |
| 74 | ForEach(this.paperContents, (item: FormNewspaperPaperContent, index: number) => { | 86 | ForEach(this.paperContents, (item: FormNewspaperPaperContent, index: number) => { |
| 75 | ListItem() { | 87 | ListItem() { |
| 76 | - ContentCellView({content: item, index: index, hasImage: (item.coverUrl && item.coverUrl.length > 0 ? true : false)}) | 88 | + ContentCellView({ |
| 89 | + content: item, | ||
| 90 | + index: index, | ||
| 91 | + needShowNumber: this.needShowNumber, | ||
| 92 | + hasImage: (item.coverUrl && item.coverUrl.length > 0 ? true : false) | ||
| 93 | + }) | ||
| 77 | } | 94 | } |
| 78 | }, (item: FormNewspaperPaperContent, index) => index + JSON.stringify(item)) | 95 | }, (item: FormNewspaperPaperContent, index) => index + JSON.stringify(item)) |
| 79 | } | 96 | } |
| @@ -90,11 +107,17 @@ struct DailyNewspaperWidgetCard { | @@ -90,11 +107,17 @@ struct DailyNewspaperWidgetCard { | ||
| 90 | 107 | ||
| 91 | @Component | 108 | @Component |
| 92 | struct ContentCellView { | 109 | struct ContentCellView { |
| 110 | + @Prop needShowNumber: boolean = false | ||
| 93 | @Prop content: FormNewspaperPaperContent | 111 | @Prop content: FormNewspaperPaperContent |
| 94 | private index : number = 0 | 112 | private index : number = 0 |
| 95 | private hasImage: boolean = false | 113 | private hasImage: boolean = false |
| 96 | build() { | 114 | build() { |
| 97 | Row() { | 115 | Row() { |
| 116 | + if (this.needShowNumber) { | ||
| 117 | + Text((this.index + 1) + "") | ||
| 118 | + .fontColor("#ED2800") | ||
| 119 | + .margin({left: 4, right: 4}) | ||
| 120 | + } | ||
| 98 | Text(this.content.title) | 121 | Text(this.content.title) |
| 99 | .maxLines((this.content.coverUrl && this.content.coverUrl.length > 0 ? 2 : 1)) | 122 | .maxLines((this.content.coverUrl && this.content.coverUrl.length > 0 ? 2 : 1)) |
| 100 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 123 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
-
Please register or login to post a comment