CustomDialogComponent.ets
4.71 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import router from '@ohos.router';
import { GlobalContext } from '../common/utils/GlobalContext'
import { NavigatorModel } from '../viewModel/NavigatorModel';
@CustomDialog
export default struct CustomDialogComponent {
controller: CustomDialogController = new CustomDialogController({'builder': ''})
cancel: Function = () => {}
confirm: Function = () => {}
build(){
Column(){
Text($r('app.string.dialog_text_title'))
.width("90%")
.fontColor($r('app.color.dialog_text_color'))
.fontSize($r('app.float.dialog_text_privacy_size'))
.textAlign(TextAlign.Center)
.fontWeight('600')
.margin({
top: $r('app.float.dialog_text_privacy_top'),
bottom: $r('app.float.dialog_text_privacy_bottom')
})
Text($r('app.string.dialog_text_privacy_content'))
.fontSize($r('app.float.dialog_common_text_size'))
.width('90%')
Row(){
// Button(){
// Text($r('app.string.privacy_text_title_policy'))
// .fontSize('27lpx')
// .fontColor(Color.Red)
// .margin({left:'10lpx',right:'10lpx'})
// }
// .width('90%')
// .height('56lpx')
// .margin({top:'54lpx',right:'19lpx'})
// .backgroundColor('#80000000')
// .onClick(() => {
//
// })
// Button(){
// Text($r('app.string.privacy_text_title_protocol'))
// .fontSize('27lpx')
// .fontColor(Color.Red)
// .margin({left:'10lpx',right:'10lpx'})
// }
// .width('90%')
// .height('56lpx')
// .margin({top:'54lpx',right:'19lpx'})
// .backgroundColor('#80000000')
// .onClick(() => {
//
// })
// Navigator({ target: 'pages/PrivacyPage', type: NavigationType.Push }) {
// Button($r('app.string.privacy_text_title_policy'))
// .onClick(()=>{
// GlobalContext.getContext().setObject('isJumpPrivacy', true);
// })
// {
// // Text($r('app.string.privacy_text_title_policy'))
// // .fontSize($r('app.float.dialog_common_text_size'))
// // .width('50%')
// // .fontColor(Color.Red)
// // .onClick(() => {
// // GlobalContext.getContext().setObject('isJumpPrivacy', true);
// // })
// }
// .fancy(Const.MainConstant_BUTTON_MARGIN_TOP)
// }
// .params({ path: 'https://www.baidu.com', tips: '在线' } as NavigatorModel)
Text($r('app.string.privacy_text_title_policy'))
.fontSize($r('app.float.dialog_common_text_size'))
.width('40%')
.fontColor(Color.Red)
.onClick(() => {
//GlobalContext.getContext().setObject('isJumpPrivacy', false);
router.pushUrl({
url: 'pages/PrivacyPage'
}).catch((error: Error) => {
//Logger.error(CommonConstants.CUSTOM_DIALOG_TAG, 'CustomDialog pushUrl error ' + JSON.stringify(error));
});
})
Text($r('app.string.privacy_text_title_protocol'))
.fontSize($r('app.float.dialog_common_text_size'))
.width('40%')
.fontColor(Color.Red)
.onClick(() => {
//GlobalContext.getContext().setObject('isJumpPrivacy', true);
router.pushUrl({
url: 'pages/PrivacyPage'
}).catch((error: Error) => {
//Logger.error(CommonConstants.CUSTOM_DIALOG_TAG, 'CustomDialog pushUrl error ' + JSON.stringify(error));
});
})
}
Text($r('app.string.dialog_text_privacy_statement'))
.width('90%')
.fontColor($r('app.color.dialog_text_statement_color'))
.fontSize($r('app.float.dialog_common_text_size'))
Row() {
Text($r('app.string.dialog_button_disagree'))
.fancy()
.onClick(() => {
this.controller.close();
this.cancel();
})
Blank()
.backgroundColor($r('app.color.dialog_blank_background_color'))
.width($r('app.float.dialog_blank_width'))
.height($r('app.float.dialog_blank_height'))
Text($r('app.string.dialog_button_agree'))
.fancy()
.onClick(() => {
this.controller.close();
this.confirm();
})
}
.margin({ bottom: '1' })
}
.width('93%')
.borderRadius('15')
.backgroundColor(Color.White)
}
}
// Common text styles.
@Extend(Text) function fancy () {
.fontColor($r("app.color.dialog_fancy_text_color"))
.fontSize($r("app.float.dialog_fancy_text_size"))
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.layoutWeight('1')
}