PeopleShipRecommendHeadComponent.ets 2 KB
import { RmhRecommendDTO } from 'wdBean';
import { ToastUtils } from 'wdKit/Index';

@Component
export struct PeopleShipRecommendHeadComponent {
  @State isSelected: boolean = true
  @Consume rmhSelectedList: string[]
  @State rmhInfo: RmhRecommendDTO = {} as RmhRecommendDTO

  build() {
    Column(){
      Stack({ alignContent: Alignment.BottomEnd }) {
        Image(this.rmhInfo.headPhotoUrl.length > 0 ? this.rmhInfo.headPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon'))
          .width('44vp')
          .height('44vp')
          .borderRadius('22vp')
          .objectFit(ImageFit.Cover)

        Image( this.isSelectedRmhInfo() ? $r('app.media.rmh_selected') :  $r('app.media.rmh_unselected') )
          .width('18vp')
          .height('18vp')
          .objectFit(ImageFit.Cover)
          .margin({
            right: '-3vp'
          })
      }.margin({ top: 4, bottom: 8 })

      Row() {
        Text(this.rmhInfo.userName)
          .fontColor($r('app.color.color_222222'))
          .fontSize($r('app.float.vp_14'))
          .fontWeight(600)
          .maxLines(1)
          .textOverflow({overflow: TextOverflow.Ellipsis})
        if (this.rmhInfo.authIcon) {
          Image(this.rmhInfo.authIcon)
            .width('12vp')
            .height('12vp')
            .borderRadius(6)
            .objectFit(ImageFit.Cover)
            .margin({
              left: '2vp'
            })
        }
      }
      .alignItems(VerticalAlign.Center)
      .justifyContent(FlexAlign.Center)


      Text(this.rmhInfo.introduction)
        .fontColor($r('app.color.color_B0B0B0'))
        .fontSize($r('app.float.vp_11'))
        .margin({ top: 6, bottom: 14 })
        .textOverflow({overflow: TextOverflow.Ellipsis})
        .maxLines(2)
        .height(34)
    }
    .width('100%')
    .height('110vp')

  }

  private isSelectedRmhInfo() {
    if (this.rmhSelectedList.length > 0 && this.rmhInfo ) {
      if (this.rmhSelectedList.indexOf(this.rmhInfo.creatorId) != -1) {
        return true
      }
    }
    return false
  }
}