HeadPictureCardComponent.ets 1.15 KB
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CompUtils } from '../../utils/CompUtils';

@Component
export struct HeadPictureCardComponent {
  @State compDTO: CompDTO = {} as CompDTO

  build() {
    Stack() {
      Image(this.compDTO.backgroundImgUrl)
        .width(CommonConstants.FULL_WIDTH)
        .height(CommonConstants.FULL_HEIGHT)

      if (this.compDTO.extraData) {
        Row()
          .width(CommonConstants.FULL_WIDTH)
          .height(59)
          .linearGradient({
            colors: [
              ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
            ]
          })
        Row() {
          Text(CompUtils.getLabelTitle(this.compDTO.extraData))
            .width(CommonConstants.FULL_WIDTH)
            .height(CommonConstants.FULL_HEIGHT)
            .fontColor(Color.White)
            .fontSize($r('app.float.normal_text_size'))
            .fontWeight(FontWeight.Bold)
            .maxLines(2)
        }
        .height(25)
        .margin({ left: 12, bottom: 10, right: 12 })
      }
    }
    .alignContent(Alignment.Bottom)
    .width(CommonConstants.FULL_WIDTH)
    .height(200)
  }
}