CertificateDialog.ets
1.6 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
import { personCertificateRow, CertificateRow } from '../api/userType'
@CustomDialog
export default struct CertificateDialog {
controller: CustomDialogController = new CustomDialogController({builder: ''})
@State select: number = 0
@Prop certificateList: string[] = []
@Link selectValue: string
@Link personCertificateInfo: personCertificateRow
@Link certificateData: CertificateRow[]
build() {
Column({ space: 50 }) {
//头部确认、取消操作行
Row() {
Text('取消')
.fontColor('#909090')
.onClick(() => {
if(this.selectValue == ''){
this.selectValue = this.certificateList[0]
this.personCertificateInfo.certificateId = this.certificateData[0].certificateId
}
this.controller.close()
})
Text('请选择证书类型')
Text('确定')
.fontColor('#0A7EE6')
.onClick(() => {
this.controller.close()
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
//证书选择器
TextPicker({ range: this.certificateList, selected: this.select })
.canLoop(false).divider(null)
.width('93%')
.onChange((value: string | string[], index: number | number[]) => {
this.selectValue = value as string
let newArr = this.certificateData.filter((item: CertificateRow) => item.certificateLevel + item.certificateName == value )
this.personCertificateInfo.certificateId = newArr[0]?.certificateId || 1
})
}
.backgroundColor(Color.White)
.borderRadius(24)
.padding(20)
.width('93%')
}
}