DialogTip.ets
1.8 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
import { noticeRow } from '../api/notice'
import { HmParseHTML } from "@wuyan/html_parse"
@CustomDialog
export default struct DialogTip{
controller: CustomDialogController = new CustomDialogController({builder: ''})
cancel: Function = () => {}
confirm: Function = () => {}
@Prop noticeDetail: noticeRow
@State count: number = 5
aboutToAppear(): void {
let timer = setInterval(() => {
this.count--
if(this.count <= 0){
this.count = 0
clearInterval(timer)
}
}, 1000)
}
build() {
Column({space: 10}){
Text('- 温馨提示 -').fontSize(16).lineHeight(21).fontColor('#fff').fontWeight(600).margin({bottom: 20})
HmParseHTML({
htmlStr: this.noticeDetail?.noticeContent || '', // 富文本内容-必传
baseFontColor: '#fff',
baseFontSize: 14
})
Text(`我已知晓(${this.count}s后可关闭)`)
.fontSize(16).lineHeight(21).fontColor('#1890ff').fontWeight(600).textAlign(TextAlign.Center)
.margin({top: 60}).width('100%').border({width: {top: 1}, color: '#fff'}).padding({top: 20, bottom: 20})
.visibility(this.count > 0 ? Visibility.Visible : Visibility.None)
Text('我已知晓')
.fontSize(16).lineHeight(21).fontColor('#1890ff').fontWeight(600).textAlign(TextAlign.Center)
.margin({top: 60}).width('100%').border({width: {top: 1}, color: '#fff'}).padding({top: 20, bottom: 20})
.visibility(this.count == 0 ? Visibility.Visible : Visibility.None)
.onClick(() => {
this.confirm()
this.controller.close()
})
}.backgroundImage($r('app.media.login_back'))
.backgroundImageSize({width: '100%'}).width('100%')
.backgroundImagePosition(Alignment.Center)
.padding({top: 20,left: 13, right: 13})
}
}