diff --git a/entry/src/main/ets/view/CustomDialogComponent.ets b/entry/src/main/ets/view/CustomDialogComponent.ets index ed1322742e27822fe451d60019c50a7fa3a31c34..38150c15eb245b25e0b1443d9def68dcc919e21f 100644 --- a/entry/src/main/ets/view/CustomDialogComponent.ets +++ b/entry/src/main/ets/view/CustomDialogComponent.ets @@ -19,16 +19,25 @@ import CommonConstants from '../common/constants/CommonConstants'; import { GlobalContext } from '../common/utils/GlobalContext'; /** + * 自定义弹窗 * Custom pop-up window. */ +// 启动页的隐私协议内容,需要用到自定义弹窗展示。 +// The privacy policy content on the LauncherPage needs to be presented using a custom popup. @CustomDialog export default struct CustomDialogComponent { - controller: CustomDialogController = new CustomDialogController({'builder': ''}); - cancel: Function = () => {}; - confirm: Function = () => {}; + controller: CustomDialogController = new CustomDialogController({ 'builder': '' }); + // 点击不同意按钮的事件回调 + cancel: Function = () => { + }; + // 点击同意按钮的事件回调 + confirm: Function = () => { + }; build() { Column() { + // 自定义弹窗标题 + // Title of CustomDialog Text($r('app.string.dialog_text_title')) .width(CommonConstants.DIALOG_COMPONENT_WIDTH_PERCENT) .fontColor($r('app.color.dialog_text_color')) @@ -39,9 +48,13 @@ export default struct CustomDialogComponent { top: $r('app.float.dialog_text_privacy_top'), bottom: $r('app.float.dialog_text_privacy_bottom') }) + // 自定义弹窗内容 + // Content of CustomDialog Text($r('app.string.dialog_text_privacy_content')) .fontSize($r('app.float.dialog_common_text_size')) .width(CommonConstants.DIALOG_COMPONENT_WIDTH_PERCENT) + // 协议链接 + // Link of Agreement Text($r('app.string.dialog_text_privacy_statement')) .width(CommonConstants.DIALOG_COMPONENT_WIDTH_PERCENT) .fontColor($r('app.color.dialog_text_statement_color')) @@ -56,6 +69,7 @@ export default struct CustomDialogComponent { Logger.error(CommonConstants.CUSTOM_DIALOG_TAG, 'CustomDialog pushUrl error ' + JSON.stringify(error)); }); }) + // 隐私协议声明 Text($r('app.string.dialog_text_declaration_prompt')) .width(CommonConstants.DIALOG_COMPONENT_WIDTH_PERCENT) .fontColor($r('app.color.dialog_text_color')) @@ -63,6 +77,7 @@ export default struct CustomDialogComponent { .opacity($r('app.float.dialog_text_opacity')) .margin({ bottom: $r('app.float.dialog_text_declaration_bottom') }) Row() { + // 取消按钮 Text($r('app.string.dialog_button_disagree')) .fancy() .onClick(() => { @@ -73,6 +88,7 @@ export default struct CustomDialogComponent { .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(() => { @@ -88,8 +104,10 @@ export default struct CustomDialogComponent { } } +// 按钮公共样式抽取 // Common text styles. -@Extend(Text) function fancy () { +@Extend(Text) +function fancy() { .fontColor($r("app.color.dialog_fancy_text_color")) .fontSize($r("app.float.dialog_fancy_text_size")) .textAlign(TextAlign.Center)