Showing
2 changed files
with
48 additions
and
17 deletions
| @@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | @@ -3,31 +3,29 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 3 | 3 | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct PeopleShipAttentionContentListHeadComponent { | 5 | export struct PeopleShipAttentionContentListHeadComponent { |
| 6 | - | ||
| 7 | - @State index: number = 0 | ||
| 8 | @ObjectLink item: FollowListDetailItem | 6 | @ObjectLink item: FollowListDetailItem |
| 7 | + | ||
| 9 | build() { | 8 | build() { |
| 10 | - Column(){ | 9 | + Column() { |
| 11 | // 头像 | 10 | // 头像 |
| 12 | PeopleShipHomePageHeadComponent({ | 11 | PeopleShipHomePageHeadComponent({ |
| 13 | diameter: 48, | 12 | diameter: 48, |
| 14 | iconDiameter: 16, | 13 | iconDiameter: 16, |
| 15 | - headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') : | ||
| 16 | - ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? | ||
| 17 | - this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')), | ||
| 18 | - authIcon: this.index == 0 ? '' : this.item.authIcon | 14 | + headPhotoUrl: (this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? |
| 15 | + this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'), | ||
| 16 | + authIcon: this.item.authIcon | ||
| 19 | }).margin({ | 17 | }).margin({ |
| 20 | bottom: '8vp' | 18 | bottom: '8vp' |
| 21 | }) | 19 | }) |
| 22 | 20 | ||
| 23 | - Text(this.index == 0 ? '我的关注' : this.item.attentionUserName) | 21 | + Text(this.item.attentionUserName) |
| 24 | .fontColor($r('app.color.color_666666')) | 22 | .fontColor($r('app.color.color_666666')) |
| 25 | .fontSize($r('app.float.vp_13')) | 23 | .fontSize($r('app.float.vp_13')) |
| 26 | .fontWeight(400) | 24 | .fontWeight(400) |
| 27 | .height('18vp') | 25 | .height('18vp') |
| 28 | .lineHeight('18vp') | 26 | .lineHeight('18vp') |
| 29 | .maxLines(1) | 27 | .maxLines(1) |
| 30 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 28 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 31 | .padding({ | 29 | .padding({ |
| 32 | left: '2vp', | 30 | left: '2vp', |
| 33 | right: '2vp' | 31 | right: '2vp' |
| @@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent { | @@ -36,7 +34,7 @@ export struct PeopleShipAttentionContentListHeadComponent { | ||
| 36 | .alignItems(HorizontalAlign.Center) | 34 | .alignItems(HorizontalAlign.Center) |
| 37 | .width('78vp') | 35 | .width('78vp') |
| 38 | .margin({ | 36 | .margin({ |
| 39 | - left: this.index == 0 ? '8vp' : '4vp', | 37 | + left: '4vp', |
| 40 | top: '14vp', | 38 | top: '14vp', |
| 41 | bottom: '14vp' | 39 | bottom: '14vp' |
| 42 | }) | 40 | }) |
| @@ -10,27 +10,23 @@ export struct PeopleShipAttentionContentListTopComponent { | @@ -10,27 +10,23 @@ export struct PeopleShipAttentionContentListTopComponent { | ||
| 10 | Column() { | 10 | Column() { |
| 11 | List(){ | 11 | List(){ |
| 12 | ListItem() { | 12 | ListItem() { |
| 13 | - PeopleShipAttentionContentListHeadComponent({ | ||
| 14 | - index: 0, | ||
| 15 | - item: this.followList[0] | ||
| 16 | - }) | 13 | + this.PeopleShipFollowTop() |
| 17 | }.onClick(() => { | 14 | }.onClick(() => { |
| 18 | // 跳转到关注列表-我的 | 15 | // 跳转到关注列表-我的 |
| 19 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage) | 16 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage) |
| 20 | }) | 17 | }) |
| 21 | 18 | ||
| 22 | 19 | ||
| 23 | - ForEach(this.followList, (item: FollowListDetailItem, index: number) => { | 20 | + ForEach(this.followList, (item: FollowListDetailItem) => { |
| 24 | ListItem() { | 21 | ListItem() { |
| 25 | PeopleShipAttentionContentListHeadComponent({ | 22 | PeopleShipAttentionContentListHeadComponent({ |
| 26 | - index: index + 1, | ||
| 27 | item: item | 23 | item: item |
| 28 | }) | 24 | }) |
| 29 | }.onClick(() => { | 25 | }.onClick(() => { |
| 30 | let creatorId = item.attentionCreatorId || '' | 26 | let creatorId = item.attentionCreatorId || '' |
| 31 | ProcessUtils.gotoPeopleShipHomePage(creatorId) | 27 | ProcessUtils.gotoPeopleShipHomePage(creatorId) |
| 32 | }) | 28 | }) |
| 33 | - }, (item: FollowListDetailItem) => item.attentionCreatorId) | 29 | + }, (item: FollowListDetailItem, index: number) => item.attentionCreatorId + index) |
| 34 | } | 30 | } |
| 35 | .listDirection(Axis.Horizontal) | 31 | .listDirection(Axis.Horizontal) |
| 36 | .scrollBar(BarState.Off) | 32 | .scrollBar(BarState.Off) |
| @@ -39,4 +35,41 @@ export struct PeopleShipAttentionContentListTopComponent { | @@ -39,4 +35,41 @@ export struct PeopleShipAttentionContentListTopComponent { | ||
| 39 | Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) | 35 | Divider().strokeWidth(1).color($r('app.color.color_F5F5F5')) |
| 40 | } | 36 | } |
| 41 | } | 37 | } |
| 38 | + | ||
| 39 | + @Builder | ||
| 40 | + PeopleShipFollowTop() { | ||
| 41 | + Column(){ | ||
| 42 | + // 头像 | ||
| 43 | + Image( $r('app.media.attention_mine') ) | ||
| 44 | + .alt($r('app.media.attention_mine')) | ||
| 45 | + .width(48) | ||
| 46 | + .height(48) | ||
| 47 | + .borderRadius(24) | ||
| 48 | + .objectFit(ImageFit.ScaleDown) | ||
| 49 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 50 | + .margin({ | ||
| 51 | + bottom: '8vp' | ||
| 52 | + }) | ||
| 53 | + | ||
| 54 | + Text('我的关注') | ||
| 55 | + .fontColor($r('app.color.color_666666')) | ||
| 56 | + .fontSize($r('app.float.vp_13')) | ||
| 57 | + .fontWeight(400) | ||
| 58 | + .height('18vp') | ||
| 59 | + .lineHeight('18vp') | ||
| 60 | + .maxLines(1) | ||
| 61 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 62 | + .padding({ | ||
| 63 | + left: '2vp', | ||
| 64 | + right: '2vp' | ||
| 65 | + }) | ||
| 66 | + } | ||
| 67 | + .alignItems(HorizontalAlign.Center) | ||
| 68 | + .width('78vp') | ||
| 69 | + .margin({ | ||
| 70 | + left: '8vp', | ||
| 71 | + top: '14vp', | ||
| 72 | + bottom: '14vp' | ||
| 73 | + }) | ||
| 74 | + } | ||
| 42 | } | 75 | } |
-
Please register or login to post a comment