PagePersonFunction.ets 1.61 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(6)
              .height(6)
              .backgroundColor(this.navItem?.noticeColor.length > 0?this.navItem?.noticeColor:$r('app.color.color_ED2800'))
          }
        }
        .width(24)
        .height(24)

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

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