PagePersonFunction.ets
1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
}
}