PagePersonFunction.ets 1.82 KB
import { BottomNavDTO } from 'wdBean/Index'
import { ColorUtils } from '../../utils/ColorUtils'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'

@Component
export struct PagePersonFunction{
  @ObjectLink item: MinePagePersonalFunctionsItem
  @State noDivider:boolean = false
  @Link percent:number
  navItem: BottomNavDTO = {} as BottomNavDTO
  build() {
    Row(){
      Column(){
        Stack({ alignContent: Alignment.TopEnd }){
          Image(this.item.imgSrc)
            .colorFilter(ColorUtils.getDrawingColorFilter(this.navItem?.homePageColor.length > 0?this.navItem?.homePageColor:''))
            .objectFit(ImageFit.Auto)
            .interpolation(ImageInterpolation.High)
          if (this.item.isShowRedPoint) {
            Button()
              .type(ButtonType.Circle)
              .width(`${this.calcHeight(12)}lpx`)
              .height(`${this.calcHeight(12)}lpx`)
              .backgroundColor(this.navItem?.noticeColor.length > 0?this.navItem?.noticeColor:$r('app.color.color_ED2800'))
          }
        }.width(`${this.calcHeight(46)}lpx`)
        .height(`${this.calcHeight(46)}lpx`)

        Text(`${this.item.msg}`)
          .margin({top:`${this.calcHeight(8)}lpx`})
          .height(`${this.calcHeight(23)}lpx`)
          .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222'))
          .fontSize(`${this.calcHeight(23)}lpx`)
      }
      .alignItems(HorizontalAlign.Center)
      .width('100%')
      Blank()
        .layoutWeight(1)
      if(!this.noDivider){
        Text().backgroundColor($r('app.color.color_222222'))
          .opacity(0.1)
          .width(`${this.calcHeight(2)}lpx`)
          .height(`${this.calcHeight(29)}lpx`)
      }
    }
  }

  calcHeight(value:number): number{
    return value * this.percent
  }
}