From baf79995bb835adf2e0104ecdad7b01e22dcf9bc Mon Sep 17 00:00:00 2001 From: lidra <593507091@qq.com> Date: Fri, 22 Nov 2024 09:24:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A8=A1=E6=9D=BF=E5=AE=9A=E4=B9=89=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/hmrouter_config.json | 21 + entry/oh-package.json5 | 2 +- .../ets/component/common/ConfirmDialog.ets | 26 +- .../main/ets/component/login/LoginPage.ets | 153 ++++--- .../src/main/ets/component/mine/ExitLogin.ets | 54 +-- .../src/main/ets/component/pay/PayCancel.ets | 55 ++- entry/src/main/ets/component/pay/PayCard.ets | 391 +++++++++--------- .../ets/component/pay/PayDialogContent.ets | 83 ++-- .../privacy/PrivacyDialogContent.ets | 42 -- .../component/privacy/PrivacyDialogDetail.ets | 157 ++++--- entry/src/main/ets/constant/PageConstant.ets | 1 - .../src/main/template/DialogMaskTemplate.ejs | 88 ++++ hmrouter_config.json | 6 - hvigor/hvigor-config.json5 | 2 +- 14 files changed, 550 insertions(+), 531 deletions(-) create mode 100644 entry/hmrouter_config.json delete mode 100644 entry/src/main/ets/component/privacy/PrivacyDialogContent.ets create mode 100644 entry/src/main/template/DialogMaskTemplate.ejs delete mode 100644 hmrouter_config.json diff --git a/entry/hmrouter_config.json b/entry/hmrouter_config.json new file mode 100644 index 0000000..eed3f35 --- /dev/null +++ b/entry/hmrouter_config.json @@ -0,0 +1,21 @@ +{ + "scanDir": [ + "src/main/ets" + ], + "saveGeneratedFile": false, + "autoObfuscation": true, + "customPageTemplate": [ + { + "srcPath": [ + "**/LoginPage.ets", + "**/PayDialogContent.ets", + "**/PayCard.ets", + "**/PayCancel.ets", + "**/PrivacyDialogDetail.ets", + "**/LiveComments.ets", + "**/ExitLogin.ets" + ], + "templatePath": "./src/main/template/DialogMaskTemplate.ejs" + } + ] +} \ No newline at end of file diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 72911db..4635edd 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -6,7 +6,7 @@ "author": "", "license": "", "dependencies": { - "@hadss/hmrouter": "latest" + "@hadss/hmrouter": "file:../libs/HMRouterLibrary-1.0.0-rc.10+build.3956fc22.har" } } diff --git a/entry/src/main/ets/component/common/ConfirmDialog.ets b/entry/src/main/ets/component/common/ConfirmDialog.ets index 9b91cd3..77c008b 100644 --- a/entry/src/main/ets/component/common/ConfirmDialog.ets +++ b/entry/src/main/ets/component/common/ConfirmDialog.ets @@ -19,21 +19,23 @@ export struct ConfirmDialog { content: string = ''; leftButtonName: string = ''; rightButtonName: string = ''; - leftButtonFunc = () => { }; - rightButtonFunc = () => { }; + leftButtonFunc = () => { + }; + rightButtonFunc = () => { + }; build() { Column() { Text(this.title) .fontSize(25) .fontWeight(FontWeight.Bold) - .margin({top: 20}); + .margin({ top: 20 }); Text(this.content) .fontSize(15) .fontColor($r('app.color.confirm_dialog_text_font_color')) - .margin({top: 30, bottom: 30}); + .margin({ top: 30, bottom: 30 }); Row() { - Button(this.leftButtonName, {buttonStyle: ButtonStyleMode.TEXTUAL}) + Button(this.leftButtonName, { buttonStyle: ButtonStyleMode.TEXTUAL }) .width('45%') .fontColor($r('app.color.confirm_dialog_button_font_color_1')) .fontSize(18) @@ -41,17 +43,25 @@ export struct ConfirmDialog { Divider().vertical(true).height(22).color($r('app.color.app_page_background')).opacity(0.3); - Button(this.rightButtonName, {buttonStyle: ButtonStyleMode.TEXTUAL}) + Button(this.rightButtonName, { buttonStyle: ButtonStyleMode.TEXTUAL }) .width('45%') .fontColor($r('app.color.confirm_dialog_button_font_color_2')) .fontSize(18) .onClick(this.rightButtonFunc); } - .margin({bottom: 20}) + .margin({ bottom: 20 }) .borderRadius(40); } .width(328) .backgroundColor($r('app.color.confirm_dialog_background_color')) - .borderRadius(20); + .borderRadius(20) + .position({ + x: '50%', + y: '50%' + }) + .markAnchor({ + x: '50%', + y: '50%' + }); } } \ No newline at end of file diff --git a/entry/src/main/ets/component/login/LoginPage.ets b/entry/src/main/ets/component/login/LoginPage.ets index 6ab41c4..5239d62 100644 --- a/entry/src/main/ets/component/login/LoginPage.ets +++ b/entry/src/main/ets/component/login/LoginPage.ets @@ -18,7 +18,7 @@ import { BreakpointConstants } from '../common/constants/BreakpointConstants'; import { PageConstant } from '../../constant/PageConstant'; import { LoginConstants } from '../../component/common/constants/LoginConstants'; -@HMRouter({pageUrl: PageConstant.LOGIN_PAGE, dialog: true}) +@HMRouter({ pageUrl: PageConstant.LOGIN_PAGE, dialog: true }) @Component export struct LoginPage { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; @@ -26,102 +26,93 @@ export struct LoginPage { handleLogin() { let targetName = HMRouterMgr.getCurrentParam() as string; AppStorage.setOrCreate('isLogin', true); - if(targetName) { + if (targetName) { HMRouterMgr.replace({ navigationId: this.queryNavigationInfo()?.navigationId, pageUrl: targetName, animator: false }); } else { - HMRouterMgr.pop({animator: false}); + HMRouterMgr.pop({ animator: false }); } } build() { - Row() { - Flex({direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween}) { - Column() { - Row() { - Image($r('app.media.ic_bottomsheet_close3x')) - .width(30) - .height(30) - .objectFit(ImageFit.Contain) - .margin({top: 20, right: 20}) - .onClick(() => { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId - }); + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Row() { + Image($r('app.media.ic_bottomsheet_close3x')) + .width(30) + .height(30) + .objectFit(ImageFit.Contain) + .margin({ top: 20, right: 20 }) + .onClick(() => { + HMRouterMgr.pop({ + navigationId: this.queryNavigationInfo()?.navigationId }); - } - .width('100%') - .margin(10) - .justifyContent(FlexAlign.End); + }); + } + .width('100%') + .margin(10) + .justifyContent(FlexAlign.End); - Flex({direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center}) { - Image($r('app.media.icon_login')) - .width(50) - .margin(10); - Text(LoginConstants.LOGIN_TEXT) - .fontSize(30) - .fontWeight(FontWeight.Bold); - } - .margin({bottom: 20}) - .height(120); + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon_login')) + .width(50) + .margin(10); + Text(LoginConstants.LOGIN_TEXT) + .fontSize(30) + .fontWeight(FontWeight.Bold); + } + .margin({ bottom: 20 }) + .height(120); - Flex({direction: FlexDirection.Column, justifyContent: FlexAlign.Start}) { - TextInput({placeholder: LoginConstants.LOGIN_PLACEHOLDER1, text: LoginConstants.LOGIN_INPUT_TEXT}) - .width('95%') - .height(60) - .backgroundColor($r('app.color.login_text_input_background_color')) - .margin(10); - TextInput({placeholder: LoginConstants.LOGIN_PLACEHOLDER2, text: '156****5163'}) - .width('95%') - .height(60) - .backgroundColor($r('app.color.login_text_input_background_color')) - .margin(10) - .type(InputType.Password); - } - .height('30%'); - }; + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Start }) { + TextInput({ placeholder: LoginConstants.LOGIN_PLACEHOLDER1, text: LoginConstants.LOGIN_INPUT_TEXT }) + .width('95%') + .height(60) + .backgroundColor($r('app.color.login_text_input_background_color')) + .margin(10); + TextInput({ placeholder: LoginConstants.LOGIN_PLACEHOLDER2, text: '156****5163' }) + .width('95%') + .height(60) + .backgroundColor($r('app.color.login_text_input_background_color')) + .margin(10) + .type(InputType.Password); + } + .height('30%'); + }; - Button(LoginConstants.LOGIN_BUTTON) - .width('90%') - .height($r('app.float.pay_button_height')) - .fontColor($r('app.color.login_button_font_color')) - .backgroundColor($r('app.color.login_button_background_color')) - .margin({left: 15, right: 10, bottom: 15}) - .onClick(() => { - if(!!AppStorage.get('isPrivacy')) { - this.handleLogin(); - } else { - HMRouterMgr.push({ - navigationId: this.queryNavigationInfo()?.navigationId, - pageUrl: 'privacyDialog' - }, { - onResult: (info) => { - if(info.result) { // 同意隐私协议 - console.log('is agree'); - } + Button(LoginConstants.LOGIN_BUTTON) + .width('90%') + .height($r('app.float.pay_button_height')) + .fontColor($r('app.color.login_button_font_color')) + .backgroundColor($r('app.color.login_button_background_color')) + .margin({ left: 15, right: 10, bottom: 15 }) + .onClick(() => { + if (!!AppStorage.get('isPrivacy')) { + this.handleLogin(); + } else { + HMRouterMgr.push({ + navigationId: this.queryNavigationInfo()?.navigationId, + pageUrl: 'privacyDialog' + }, { + onResult: (info) => { + if (info.result) { // 同意隐私协议 + console.log('is agree'); } - }); - } - }); - } - .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '100%' : '72%') - .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '95%' : '72%') - .backgroundColor($r('app.color.login_flex_background_color')) - .border({ - radius: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? {topLeft: 20, topRight: 20} : 20 - }) - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); + } + }); + } + }); } - .backgroundColor('rgba(0,0,0,0.2)') - .width('100%') - .height('100%') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) - .alignItems(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? VerticalAlign.Bottom : - VerticalAlign.Center) - .justifyContent(FlexAlign.Center); + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '100%' : '72%') + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '95%' : '72%') + .backgroundColor($r('app.color.login_flex_background_color')) + .border({ + radius: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 20, topRight: 20 } : 20 + }) + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); } } diff --git a/entry/src/main/ets/component/mine/ExitLogin.ets b/entry/src/main/ets/component/mine/ExitLogin.ets index 32b033f..b6ac718 100644 --- a/entry/src/main/ets/component/mine/ExitLogin.ets +++ b/entry/src/main/ets/component/mine/ExitLogin.ets @@ -23,47 +23,37 @@ import { } from '@hadss/hmrouter'; import { PageConstant } from '../../constant/PageConstant'; import { ConfirmDialog } from '../common/ConfirmDialog'; -import { MineConstants } from '../common/constants/MineConstants' +import { MineConstants } from '../common/constants/MineConstants'; -@HMInterceptor({interceptorName: 'exitLoginInterceptor'}) +@HMInterceptor({ interceptorName: 'exitLoginInterceptor' }) export class ExitLoginInterceptor implements IHMInterceptor { handle(info: HMInterceptorInfo): HMInterceptorAction { return HMInterceptorAction.DO_NEXT; } } -@HMRouter({pageUrl: PageConstant.EXIT_LOGIN, dialog: true, interceptors: ['exitLoginInterceptor']}) +@HMRouter({ pageUrl: PageConstant.EXIT_LOGIN, dialog: true, interceptors: ['exitLoginInterceptor'] }) @Component export struct ExitLogin { - build() { - Stack() { - Column() - .width('100%') - .height('100%') - .backgroundColor('rgba(0,0,0,0.5)') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); - ConfirmDialog({ - title: MineConstants.EXIT_LOGIN_TITLE, - content: MineConstants.EXIT_LOGIN_CONTENT, - leftButtonName: MineConstants.EXIT_LOGIN_LEFT_BUTTON, - rightButtonName: MineConstants.EXIT_LOGIN_RIGHT_BUTTON, - leftButtonFunc: () => { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId - }); - }, - rightButtonFunc: () => { - AppStorage.set('isLogin', false); - HMRouterMgr.pop({ - pageUrl: 'myAccount', - navigationId: this.queryNavigationInfo()?.navigationId, - animator: false - }); - } - }) - .backgroundColor($r('app.color.exit_login_background_color')) - .borderRadius(20); - } + ConfirmDialog({ + title: MineConstants.EXIT_LOGIN_TITLE, + content: MineConstants.EXIT_LOGIN_CONTENT, + leftButtonName: MineConstants.EXIT_LOGIN_LEFT_BUTTON, + rightButtonName: MineConstants.EXIT_LOGIN_RIGHT_BUTTON, + leftButtonFunc: () => { + HMRouterMgr.pop({ + navigationId: this.queryNavigationInfo()?.navigationId + }); + }, + rightButtonFunc: () => { + AppStorage.set('isLogin', false); + HMRouterMgr.pop({ + pageUrl: 'myAccount', + navigationId: this.queryNavigationInfo()?.navigationId, + animator: false + }); + } + }) } } \ No newline at end of file diff --git a/entry/src/main/ets/component/pay/PayCancel.ets b/entry/src/main/ets/component/pay/PayCancel.ets index 084f453..fc8d883 100644 --- a/entry/src/main/ets/component/pay/PayCancel.ets +++ b/entry/src/main/ets/component/pay/PayCancel.ets @@ -16,9 +16,9 @@ import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; import { PageConstant } from '../../constant/PageConstant'; import { ConfirmDialog } from '../common/ConfirmDialog'; -import { PayConstants } from '../common/constants/PayConstants' +import { PayConstants } from '../common/constants/PayConstants'; -@HMRouter({pageUrl: PageConstant.PAY_CANCEL, dialog: true}) +@HMRouter({ pageUrl: PageConstant.PAY_CANCEL, dialog: true }) @Component export struct PayCancel { pageUrl: string = ''; @@ -29,37 +29,28 @@ export struct PayCancel { } build() { - Stack({alignContent: Alignment.Center}) { - Column() - .width('100%') - .height('100%') - .backgroundColor('rgba(0,0,0,0.5)') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); - ConfirmDialog({ - title: PayConstants.PAY_CANCEL_TITLE, - content: PayConstants.PAY_CANCEL_CONTENT, - leftButtonName: PayConstants.PAY_CANCEL_BUTTON1, - rightButtonName: PayConstants.PAY_CANCEL_BUTTON2, - leftButtonFunc: () => { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId - }); - }, - rightButtonFunc: () => { - let pathStack = HMRouterMgr.getPathStack(this.queryNavigationInfo()?.navigationId!); - if (this.pageUrl === 'shoppingBag') { - for (let i = 0; i < 2; i++) { - pathStack?.pop(false); - } - } else { - for(let i = 0; i < 3; i++) { - pathStack?.pop(false); - } + ConfirmDialog({ + title: PayConstants.PAY_CANCEL_TITLE, + content: PayConstants.PAY_CANCEL_CONTENT, + leftButtonName: PayConstants.PAY_CANCEL_BUTTON1, + rightButtonName: PayConstants.PAY_CANCEL_BUTTON2, + leftButtonFunc: () => { + HMRouterMgr.pop({ + navigationId: this.queryNavigationInfo()?.navigationId + }); + }, + rightButtonFunc: () => { + let pathStack = HMRouterMgr.getPathStack(this.queryNavigationInfo()?.navigationId!); + if (this.pageUrl === 'shoppingBag') { + for (let i = 0; i < 2; i++) { + pathStack?.pop(false); + } + } else { + for (let i = 0; i < 3; i++) { + pathStack?.pop(false); } } - }); - } - .width('100%') - .height('100%'); + } + }); } } \ No newline at end of file diff --git a/entry/src/main/ets/component/pay/PayCard.ets b/entry/src/main/ets/component/pay/PayCard.ets index 4ec40b6..8f894ba 100644 --- a/entry/src/main/ets/component/pay/PayCard.ets +++ b/entry/src/main/ets/component/pay/PayCard.ets @@ -48,219 +48,210 @@ export struct PayCard { } build() { - Row() { - Column() { - Scroll() { - Column() { - Row() { - Image($r('app.media.pay_main_shop')) - .height(ResourceUtil.getCommonImgSize()[4]) - .width(ResourceUtil.getCommonImgSize()[4]) - .margin({ right: 8 }); - Text('¥') - .fontColor($r('app.color.pay_card_price_color')) - .fontSize(24); - Text(this.totalPrice.toString()) - .fontColor($r('app.color.pay_card_price_color')) - .fontSize(24); - Blank(); - Image($r('app.media.icon_close_1')) - .width(ResourceUtil.getCommonImgSize()[0]) - .height(ResourceUtil.getCommonImgSize()[0]) - .alignSelf(ItemAlign.Start) - .margin({ top: $r('app.float.pay_card_icon_margin'), right: $r('app.float.pay_card_right_margin') }) - .onClick(() => { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId, - param: new ProductMsg(DetailConstants.COLOR_SELECT_NAME_LIST[this.color!], - DetailConstants.CAPACITY_SELECT_NAME_LIST[this.memory!], - this.totalPrice!.toString()) - }); + Column() { + Scroll() { + Column() { + Row() { + Image($r('app.media.pay_main_shop')) + .height(ResourceUtil.getCommonImgSize()[4]) + .width(ResourceUtil.getCommonImgSize()[4]) + .margin({ right: 8 }); + Text('¥') + .fontColor($r('app.color.pay_card_price_color')) + .fontSize(24); + Text(this.totalPrice.toString()) + .fontColor($r('app.color.pay_card_price_color')) + .fontSize(24); + Blank(); + Image($r('app.media.icon_close_1')) + .width(ResourceUtil.getCommonImgSize()[0]) + .height(ResourceUtil.getCommonImgSize()[0]) + .alignSelf(ItemAlign.Start) + .margin({ top: $r('app.float.pay_card_icon_margin'), right: $r('app.float.pay_card_right_margin') }) + .onClick(() => { + HMRouterMgr.pop({ + navigationId: this.queryNavigationInfo()?.navigationId, + param: new ProductMsg(DetailConstants.COLOR_SELECT_NAME_LIST[this.color!], + DetailConstants.CAPACITY_SELECT_NAME_LIST[this.memory!], + this.totalPrice!.toString()) }); - } - .width(CommonConstants.FULL_PERCENT) - .margin({ bottom: $r('app.float.pay_card_top_margin'), top: 6 }); + }); + } + .width(CommonConstants.FULL_PERCENT) + .margin({ bottom: $r('app.float.pay_card_top_margin'), top: 6 }); - Row() { - Image($r('app.media.icon_position')) - .height(ResourceUtil.getCommonImgSize()[5]) - .width(ResourceUtil.getCommonImgSize()[5]) - .margin({ right: $r('app.float.pay_position_margin') }); - Column() { - Text(DetailConstants.PAY_INFO[0]) - .fontSize($r('app.float.pay_address_font')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - .width(CommonConstants.FULL_PERCENT) - .maxLines(1) - .textOverflow({ overflow: TextOverflow.Ellipsis }) - .margin({ bottom: $r('app.float.pay_address_margin') }); - Text(DetailConstants.PAY_INFO[1]) - .fontSize($r('app.float.pay_contact_font')) - .fontColor($r('app.color.pay_contact_color')) - .width(CommonConstants.FULL_PERCENT) - .maxLines(1); - } - .layoutWeight(1) - .alignItems(HorizontalAlign.Start); + Row() { + Image($r('app.media.icon_position')) + .height(ResourceUtil.getCommonImgSize()[5]) + .width(ResourceUtil.getCommonImgSize()[5]) + .margin({ right: $r('app.float.pay_position_margin') }); + Column() { + Text(DetailConstants.PAY_INFO[0]) + .fontSize($r('app.float.pay_address_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .width(CommonConstants.FULL_PERCENT) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ bottom: $r('app.float.pay_address_margin') }); + Text(DetailConstants.PAY_INFO[1]) + .fontSize($r('app.float.pay_contact_font')) + .fontColor($r('app.color.pay_contact_color')) + .width(CommonConstants.FULL_PERCENT) + .maxLines(1); } - .margin({ bottom: $r('app.float.pay_info_margin') }) - .width(CommonConstants.FULL_PERCENT) - .backgroundColor($r('app.color.pay_card_background_color_1')) - .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) - .padding({ - top: $r('app.float.pay_info_padding_top_bottom'), - bottom: $r('app.float.pay_info_padding_top_bottom'), - left: $r('app.float.pay_info_padding_left_right'), - right: $r('app.float.pay_info_padding_left_right') - }); + .layoutWeight(1) + .alignItems(HorizontalAlign.Start); + } + .margin({ bottom: $r('app.float.pay_info_margin') }) + .width(CommonConstants.FULL_PERCENT) + .backgroundColor($r('app.color.pay_card_background_color_1')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding({ + top: $r('app.float.pay_info_padding_top_bottom'), + bottom: $r('app.float.pay_info_padding_top_bottom'), + left: $r('app.float.pay_info_padding_left_right'), + right: $r('app.float.pay_info_padding_left_right') + }); - Column() { - ForEach(this.payCardSelectList, (item: SelectProjectItem, index: number) => { - Column() { - Text(item.getName()) - .fontSize($r('app.float.pay_config_title_font')) - .alignSelf(ItemAlign.Start) - .margin({ bottom: $r('app.float.pay_config_title_margin') }) - .lineHeight($r('app.float.pay_config_title_line')) - .fontWeight(CommonConstants.FONT_WEIGHT_500); - Flex({ - wrap: FlexWrap.Wrap, - justifyContent: FlexAlign.Start - }) { - ForEach(item.getSelectItemList(), (selectItem: SelectItem, selectIndex: number) => { - Row() { - Image(selectItem.getImage()) - .height(ResourceUtil.getCommonImgSize()[1]) - .width(ResourceUtil.getCommonImgSize()[1]) - .visibility(selectItem.getImage() === null ? Visibility.None : Visibility.Visible); - Text(selectItem.getName()) - .fontColor(this.getShowColor(item.getName(), selectIndex, - $r('app.color.pay_card_item_color_selected'), $r('app.color.pay_card_item_color_1'))) - .fontSize($r('app.float.pay_config_name_font')) - .textAlign(TextAlign.Center) - .margin({ - left: $r('app.float.pay_config_name_margin'), - right: $r('app.float.pay_config_name_margin') - }); + Column() { + ForEach(this.payCardSelectList, (item: SelectProjectItem, index: number) => { + Column() { + Text(item.getName()) + .fontSize($r('app.float.pay_config_title_font')) + .alignSelf(ItemAlign.Start) + .margin({ bottom: $r('app.float.pay_config_title_margin') }) + .lineHeight($r('app.float.pay_config_title_line')) + .fontWeight(CommonConstants.FONT_WEIGHT_500); + Flex({ + wrap: FlexWrap.Wrap, + justifyContent: FlexAlign.Start + }) { + ForEach(item.getSelectItemList(), (selectItem: SelectItem, selectIndex: number) => { + Row() { + Image(selectItem.getImage()) + .height(ResourceUtil.getCommonImgSize()[1]) + .width(ResourceUtil.getCommonImgSize()[1]) + .visibility(selectItem.getImage() === null ? Visibility.None : Visibility.Visible); + Text(selectItem.getName()) + .fontColor(this.getShowColor(item.getName(), selectIndex, + $r('app.color.pay_card_item_color_selected'), $r('app.color.pay_card_item_color_1'))) + .fontSize($r('app.float.pay_config_name_font')) + .textAlign(TextAlign.Center) + .margin({ + left: $r('app.float.pay_config_name_margin'), + right: $r('app.float.pay_config_name_margin') + }); + } + .onClick(() => { + PayMgr.getInstance().setProductChoose(item.getName(), selectIndex); + if (item.getName() === DetailConstants.SELECT_NAME_LIST[0]) { + this.color = PayMgr.getInstance().getProductChoose(DetailConstants.SELECT_NAME_LIST[0]); + } else if (item.getName() === DetailConstants.SELECT_NAME_LIST[1]) { + this.totalPrice = Number(DetailConstants.CUSTOMER_SERVICE_CONTENTS[selectIndex + 1]); + this.memory = PayMgr.getInstance().getProductChoose(DetailConstants.SELECT_NAME_LIST[1]); } - .onClick(() => { - PayMgr.getInstance().setProductChoose(item.getName(), selectIndex); - if (item.getName() === DetailConstants.SELECT_NAME_LIST[0]) { - this.color = PayMgr.getInstance().getProductChoose(DetailConstants.SELECT_NAME_LIST[0]); - } else if (item.getName() === DetailConstants.SELECT_NAME_LIST[1]) { - this.totalPrice = Number(DetailConstants.CUSTOMER_SERVICE_CONTENTS[selectIndex + 1]); - this.memory = PayMgr.getInstance().getProductChoose(DetailConstants.SELECT_NAME_LIST[1]); - } - }) - .backgroundColor(this.getShowColor(item.getName(), selectIndex, - $r('app.color.pay_card_item_background_color_selected'), - $r('app.color.pay_card_item_background_color'))) - .border({ - color: this.getShowColor(item.getName(), selectIndex, - $r('app.color.pay_card_item_color_selected'), $r('app.color.pay_card_item_color_2')), - width: index === 0 ? $r('app.float.pay_config_border_width') : 0, - radius: ResourceUtil.getCommonBorderRadius()[3] - }) - .height($r('app.float.pay_config_height')) - .margin({ - right: $r('app.float.pay_config_margin'), - bottom: $r('app.float.pay_config_margin') - }); - }, (selectItem: SelectItem, selectIndex: number) => JSON.stringify(selectItem) + selectIndex); - } - .width(CommonConstants.FULL_PERCENT); + }) + .backgroundColor(this.getShowColor(item.getName(), selectIndex, + $r('app.color.pay_card_item_background_color_selected'), + $r('app.color.pay_card_item_background_color'))) + .border({ + color: this.getShowColor(item.getName(), selectIndex, + $r('app.color.pay_card_item_color_selected'), $r('app.color.pay_card_item_color_2')), + width: index === 0 ? $r('app.float.pay_config_border_width') : 0, + radius: ResourceUtil.getCommonBorderRadius()[3] + }) + .height($r('app.float.pay_config_height')) + .margin({ + right: $r('app.float.pay_config_margin'), + bottom: $r('app.float.pay_config_margin') + }); + }, (selectItem: SelectItem, selectIndex: number) => JSON.stringify(selectItem) + selectIndex); } - .margin({ top: $r('app.float.pay_config_col_margin_top') }) .width(CommonConstants.FULL_PERCENT); - }, (item: SelectProjectItem, index: number) => JSON.stringify(item) + index); - } - .width(CommonConstants.FULL_PERCENT) - .margin({ bottom: $r('app.float.pay_config_col_margin_bottom') }) - .backgroundColor($r('app.color.pay_card_background_color_1')) - .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) - .padding({ - left: $r('app.float.pay_config_col_padding'), - right: $r('app.float.pay_config_col_padding') - }); - - Row() { - Image($r('app.media.icon_pay')) - .height(ResourceUtil.getCommonImgSize()[5]) - .width(ResourceUtil.getCommonImgSize()[5]) - .margin({ right: $r('app.float.pay_wallet_icon_margin') }); - Text(DetailConstants.PAY_INFO[2]) - .fontSize($r('app.float.pay_wallet_font')) - .fontWeight(CommonConstants.FONT_WEIGHT_500); - Blank(); - Checkbox() - .select(true) - .selectedColor($r('app.color.util_button_2')) - .shape(CheckBoxShape.CIRCLE) - .width($r('app.float.checkbox_width')); - } - .padding({ - top: $r('app.float.wallet_row_padding_1'), - left: $r('app.float.wallet_row_padding_2'), - bottom: $r('app.float.wallet_row_padding_1'), - right: $r('app.float.wallet_row_padding_2') - }) - .margin({ bottom: $r('app.float.wallet_row_margin') }) - .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) - .backgroundColor($r('app.color.pay_card_background_color_1')) - .width(CommonConstants.FULL_PERCENT); + } + .margin({ top: $r('app.float.pay_config_col_margin_top') }) + .width(CommonConstants.FULL_PERCENT); + }, (item: SelectProjectItem, index: number) => JSON.stringify(item) + index); } .width(CommonConstants.FULL_PERCENT) - .padding({ left: 24, right: 24 }); - } - .scrollBar(BarState.Off) - .layoutWeight(1) - .align(Alignment.Top) - .width(CommonConstants.FULL_PERCENT); + .margin({ bottom: $r('app.float.pay_config_col_margin_bottom') }) + .backgroundColor($r('app.color.pay_card_background_color_1')) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .padding({ + left: $r('app.float.pay_config_col_padding'), + right: $r('app.float.pay_config_col_padding') + }); - Button(this.payState) - .onClick(() => { - if (this.payState === DetailConstants.PAY_INFO[3]) { - HMRouterMgr.push({ - pageUrl: 'PayDialogContent', - param: { totalPrice: this.totalPrice, pageUrl: this.pageUrl } - }, { - onResult: (popInfo: PopInfo) => { - if (popInfo.result === DetailConstants.PAY_INFO[4]) { - this.payState = popInfo.result.toString(); - } - } - }); - } else if (this.payState === DetailConstants.PAY_INFO[4]) { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId, - param: new ProductMsg(DetailConstants.COLOR_SELECT_NAME_LIST[this.color!], - DetailConstants.CAPACITY_SELECT_NAME_LIST[this.memory!], - this.totalPrice!.toString()) - }); - } + Row() { + Image($r('app.media.icon_pay')) + .height(ResourceUtil.getCommonImgSize()[5]) + .width(ResourceUtil.getCommonImgSize()[5]) + .margin({ right: $r('app.float.pay_wallet_icon_margin') }); + Text(DetailConstants.PAY_INFO[2]) + .fontSize($r('app.float.pay_wallet_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_500); + Blank(); + Checkbox() + .select(true) + .selectedColor($r('app.color.util_button_2')) + .shape(CheckBoxShape.CIRCLE) + .width($r('app.float.checkbox_width')); + } + .padding({ + top: $r('app.float.wallet_row_padding_1'), + left: $r('app.float.wallet_row_padding_2'), + bottom: $r('app.float.wallet_row_padding_1'), + right: $r('app.float.wallet_row_padding_2') }) - .width('90%') - .backgroundColor($r('app.color.util_button_2')) - .height($r('app.float.pay_button_height')) - .margin(12); + .margin({ bottom: $r('app.float.wallet_row_margin') }) + .borderRadius(ResourceUtil.getCommonBorderRadius()[6]) + .backgroundColor($r('app.color.pay_card_background_color_1')) + .width(CommonConstants.FULL_PERCENT); + } + .width(CommonConstants.FULL_PERCENT) + .padding({ left: 24, right: 24 }); } - .width(CommonConstants.FULL_PERCENT) - .borderRadius(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 40, topRight: 40 } : 40) - .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '100%' : '72%') - .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '70%' : '72%') - .border({ - radius: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 20, topRight: 20 } : 20 - }) - .backgroundColor($r('app.color.pay_background_color')) - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); + .scrollBar(BarState.Off) + .layoutWeight(1) + .align(Alignment.Top) + .width(CommonConstants.FULL_PERCENT); + + Button(this.payState) + .onClick(() => { + if (this.payState === DetailConstants.PAY_INFO[3]) { + HMRouterMgr.push({ + pageUrl: 'PayDialogContent', + param: { totalPrice: this.totalPrice, pageUrl: this.pageUrl } + }, { + onResult: (popInfo: PopInfo) => { + if (popInfo.result === DetailConstants.PAY_INFO[4]) { + this.payState = popInfo.result.toString(); + } + } + }); + } else if (this.payState === DetailConstants.PAY_INFO[4]) { + HMRouterMgr.pop({ + navigationId: this.queryNavigationInfo()?.navigationId, + param: new ProductMsg(DetailConstants.COLOR_SELECT_NAME_LIST[this.color!], + DetailConstants.CAPACITY_SELECT_NAME_LIST[this.memory!], + this.totalPrice!.toString()) + }); + } + }) + .width('90%') + .backgroundColor($r('app.color.util_button_2')) + .height($r('app.float.pay_button_height')) + .margin(12); } - .backgroundColor('rgba(0,0,0,0.2)') - .width('100%') - .height('100%') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) - .alignItems(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? VerticalAlign.Bottom : - VerticalAlign.Center) - .justifyContent(FlexAlign.Center); + .width(CommonConstants.FULL_PERCENT) + .borderRadius(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 40, topRight: 40 } : 40) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '100%' : '72%') + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '70%' : '72%') + .border({ + radius: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 20, topRight: 20 } : 20 + }) + .backgroundColor($r('app.color.pay_background_color')) + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); } getShowColor(itemName: string, selectIndex: number, onFocusColor: Resource, outFocusColor: Resource): Resource { diff --git a/entry/src/main/ets/component/pay/PayDialogContent.ets b/entry/src/main/ets/component/pay/PayDialogContent.ets index 234e53b..0b7a990 100644 --- a/entry/src/main/ets/component/pay/PayDialogContent.ets +++ b/entry/src/main/ets/component/pay/PayDialogContent.ets @@ -16,7 +16,7 @@ import { HMLifecycle, HMRouter, HMRouterMgr, IHMLifecycle } from '@hadss/hmrouter'; import { PageConstant } from '../../constant/PageConstant'; import { BreakpointConstants } from '../common/constants/BreakpointConstants'; -import { PayConstants } from '../common/constants/PayConstants' +import { PayConstants } from '../common/constants/PayConstants'; @Builder export function payDialogContentBuilder(totalPrice: number) { @@ -91,57 +91,48 @@ export struct PayDialogContent { } build() { - Row() { - Column() { - // header - Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.End }) { - Image($r('app.media.ic_bottomsheet_close3x')) - .width(30) - .height(30) - .objectFit(ImageFit.Contain) - .margin({ top: 20, right: 20 }) - .onClick(() => { - HMRouterMgr.push({ - navigationId: this.queryNavigationInfo()?.navigationId, - pageUrl: 'PayCancel', - param: this.pageUrl - }); - }); - }; - - // center/content - Column() { - payDialogContentBuilder(this.totalPrice); - } - .height('75%'); - - // footer - Button(PayConstants.PAY_CARD_BUTTON, { type: ButtonType.Capsule }) + Column() { + // header + Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.End }) { + Image($r('app.media.ic_bottomsheet_close3x')) + .width(30) + .height(30) + .objectFit(ImageFit.Contain) + .margin({ top: 20, right: 20 }) .onClick(() => { HMRouterMgr.push({ navigationId: this.queryNavigationInfo()?.navigationId, - pageUrl: 'PaySuccessPageComponent', - param: { totalPrice: this.totalPrice, pageUrl: this.pageUrl } + pageUrl: 'PayCancel', + param: this.pageUrl }); - }) - .width('90%') - .backgroundColor($r('app.color.pay_dialog_button_background_color')) - .height(40) - .margin(12); + }); + }; + + // center/content + Column() { + payDialogContentBuilder(this.totalPrice); } - .backgroundColor($r('app.color.pay_background_color')) - .borderRadius(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 20, topRight: 20 } : 20) - .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '100%' : '72%') - .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '80%' : '72%') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); + .height('75%'); + + // footer + Button(PayConstants.PAY_CARD_BUTTON, { type: ButtonType.Capsule }) + .onClick(() => { + HMRouterMgr.push({ + navigationId: this.queryNavigationInfo()?.navigationId, + pageUrl: 'PaySuccessPageComponent', + param: { totalPrice: this.totalPrice, pageUrl: this.pageUrl } + }); + }) + .width('90%') + .backgroundColor($r('app.color.pay_dialog_button_background_color')) + .height(40) + .margin(12); } - .backgroundColor('rgba(0,0,0,0.2)') - .width('100%') - .height('100%') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) - .alignItems(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? VerticalAlign.Bottom : - VerticalAlign.Center) - .justifyContent(FlexAlign.Center); + .backgroundColor($r('app.color.pay_background_color')) + .borderRadius(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? { topLeft: 20, topRight: 20 } : 20) + .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '100%' : '72%') + .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? '80%' : '72%') + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); } } diff --git a/entry/src/main/ets/component/privacy/PrivacyDialogContent.ets b/entry/src/main/ets/component/privacy/PrivacyDialogContent.ets deleted file mode 100644 index 557f35b..0000000 --- a/entry/src/main/ets/component/privacy/PrivacyDialogContent.ets +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; -import { PageConstant } from '../../constant/PageConstant'; - -/** - * privacy background - */ -@HMRouter({pageUrl: PageConstant.PRIVACY_DIALOG, dialog: true}) -@Component -export struct PrivacyDialogContent { - scroller: Scroller = new Scroller(); - - aboutToAppear(): void { - HMRouterMgr.push({ - pageUrl: 'PrivacyDialogDetail' - }); - } - - build() { - Stack({alignContent: Alignment.Center}) { - Column() - .width('100%') - .height('100%') - .backgroundColor('rgba(0,0,0,0.5)') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); - }; - } -} \ No newline at end of file diff --git a/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets b/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets index bf4bba8..3a13034 100644 --- a/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets +++ b/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets @@ -15,7 +15,7 @@ import { HMLifecycle, HMLifecycleContext, HMRouter, HMRouterMgr, IHMLifecycle } from '@hadss/hmrouter'; import { PageConstant } from '../../constant/PageConstant'; -import { LoginConstants } from '../common/constants/LoginConstants' +import { LoginConstants } from '../common/constants/LoginConstants'; @HMLifecycle({ lifecycleName: 'privacyLifecycle', priority: 4 }) export class PrivacyLifecycle implements IHMLifecycle { @@ -35,7 +35,7 @@ export class PrivacyLifecycle implements IHMLifecycle { } @HMRouter({ - pageUrl: PageConstant.PRIVACY_DIALOG_DETAIL, + pageUrl: PageConstant.PRIVACY_DIALOG, dialog: true, animator: 'zoomAnimator', lifecycle: 'privacyLifecycle' @@ -45,92 +45,87 @@ export struct PrivacyDialogDetail { scroller: Scroller = new Scroller(); build() { - Stack({ alignContent: Alignment.Center }) { - Column() - .width('100%') - .height('100%') - .backgroundColor('rgba(0,0,0,0)') - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]); - - Column() { - Text(LoginConstants.PRIVACY_DIALOG_TITLE).fontSize(20) - .fontWeight(FontWeight.Bold) - .margin({ top: 20 }); - Text(LoginConstants.PRIVACY_DIALOG_TEXT1) - .fontSize(16) - .margin({ top: 20 }) - .width('90%') - .textAlign(TextAlign.Center); - - Scroll(this.scroller) { - Text() { - Span(LoginConstants.PRIVACY_DIALOG_TEXT2) - .fontColor($r('app.color.privacy_dialog_font_color_1')); - Span(LoginConstants.PRIVACY_DIALOG_TEXT3) - .fontColor($r('app.color.privacy_dialog_font_color_2')) - .onClick(() => { - HMRouterMgr.push({ navigationId: this.queryNavigationInfo()?.navigationId, pageUrl: 'privacyPage' }); - }); - Span('。') - .fontColor($r('app.color.privacy_dialog_font_color_1')); - Span('\n'); - Span(LoginConstants.PRIVACY_DIALOG_TEXT4) - .fontColor($r('app.color.privacy_dialog_font_color_1')); - } - .fontSize(14) - // .maxLines(6) - // .textOverflow({overflow:TextOverflow.Ellipsis}) - .width('90%'); - } - .scrollable(ScrollDirection.Vertical) + Column() { + Text(LoginConstants.PRIVACY_DIALOG_TITLE).fontSize(20) + .fontWeight(FontWeight.Bold) .margin({ top: 20 }); + Text(LoginConstants.PRIVACY_DIALOG_TEXT1) + .fontSize(16) + .margin({ top: 20 }) + .width('90%') + .textAlign(TextAlign.Center); - Row() { - Button(LoginConstants.PRIVACY_DIALOG_LEFT_BUTTON, { buttonStyle: ButtonStyleMode.TEXTUAL }) + Scroll(this.scroller) { + Text() { + Span(LoginConstants.PRIVACY_DIALOG_TEXT2) + .fontColor($r('app.color.privacy_dialog_font_color_1')); + Span(LoginConstants.PRIVACY_DIALOG_TEXT3) + .fontColor($r('app.color.privacy_dialog_font_color_2')) .onClick(() => { - let targetName = HMRouterMgr.getCurrentParam() as string; + HMRouterMgr.push({ navigationId: this.queryNavigationInfo()?.navigationId, pageUrl: 'privacyPage' }); + }); + Span('。') + .fontColor($r('app.color.privacy_dialog_font_color_1')); + Span('\n'); + Span(LoginConstants.PRIVACY_DIALOG_TEXT4) + .fontColor($r('app.color.privacy_dialog_font_color_1')); + } + .fontSize(14) + // .maxLines(6) + // .textOverflow({overflow:TextOverflow.Ellipsis}) + .width('90%'); + } + .scrollable(ScrollDirection.Vertical) + .margin({ top: 20 }); + + Row() { + Button(LoginConstants.PRIVACY_DIALOG_LEFT_BUTTON, { buttonStyle: ButtonStyleMode.TEXTUAL }) + .onClick(() => { + let targetName = HMRouterMgr.getCurrentParam() as string; + HMRouterMgr.pop({ + navigationId: this.queryNavigationInfo()?.navigationId, + param: targetName + }); + setTimeout(() => { HMRouterMgr.pop({ navigationId: this.queryNavigationInfo()?.navigationId, param: targetName }); - setTimeout(() => { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId, - param: targetName - }); - }, 400); - }) - .margin({ top: 20, bottom: 20 }) - .width('45%') - .fontColor($r('app.color.privacy_dialog_font_color_2')) - .fontWeight(FontWeight.Bold); + }, 400); + }) + .margin({ top: 20, bottom: 20 }) + .width('45%') + .fontColor($r('app.color.privacy_dialog_font_color_2')) + .fontWeight(FontWeight.Bold); - Divider() - .vertical(true) - .height(22) - .color($r('app.color.app_page_background')) - .opacity(0.3); + Divider() + .vertical(true) + .height(22) + .color($r('app.color.app_page_background')) + .opacity(0.3); - Button(LoginConstants.PRIVACY_DIALOG_RIGHT_BUTTON, { buttonStyle: ButtonStyleMode.TEXTUAL }) - .onClick(() => { - // 保存隐私同意标识 - AppStorage.setOrCreate('isPrivacy', true); - HMRouterMgr.pop({ param: true }); - setTimeout(() => { - HMRouterMgr.pop({ - param: true - }); - }, 400); - }) - .margin({ top: 20, bottom: 20 }) - .width('45%') - .fontColor($r('app.color.privacy_dialog_font_color_2')) - .fontWeight(FontWeight.Bold); - }; - } - .backgroundColor($r('app.color.privacy_dialog_background_color')) - .borderRadius(40) - .width('90%'); - }; - } + Button(LoginConstants.PRIVACY_DIALOG_RIGHT_BUTTON, { buttonStyle: ButtonStyleMode.TEXTUAL }) + .onClick(() => { + // 保存隐私同意标识 + AppStorage.setOrCreate('isPrivacy', true); + HMRouterMgr.pop({ param: true }); + }) + .margin({ top: 20, bottom: 20 }) + .width('45%') + .fontColor($r('app.color.privacy_dialog_font_color_2')) + .fontWeight(FontWeight.Bold); + }; + } + .backgroundColor($r('app.color.privacy_dialog_background_color')) + .borderRadius(40) + .width('90%') + .position({ + x: '50%', + y: '50%' + }) + .markAnchor({ + x: '50%', + y: '50%' + }); + }; } \ No newline at end of file diff --git a/entry/src/main/ets/constant/PageConstant.ets b/entry/src/main/ets/constant/PageConstant.ets index 3b18cbe..a1b36ca 100644 --- a/entry/src/main/ets/constant/PageConstant.ets +++ b/entry/src/main/ets/constant/PageConstant.ets @@ -27,7 +27,6 @@ export class PageConstant { static readonly PAY_DIALOG_CONTENT: string = 'PayDialogContent'; static readonly PAY_SUCCESS_PAGE_COMPONENT: string = 'PaySuccessPageComponent'; static readonly PRIVACY_DIALOG: string = 'privacyDialog'; - static readonly PRIVACY_DIALOG_DETAIL: string = 'PrivacyDialogDetail'; static readonly PRIVACY_PAGE: string = 'privacyPage'; static readonly PRODUCT_CONTENT: string = 'ProductContent'; } \ No newline at end of file diff --git a/entry/src/main/template/DialogMaskTemplate.ejs b/entry/src/main/template/DialogMaskTemplate.ejs new file mode 100644 index 0000000..e43b1e2 --- /dev/null +++ b/entry/src/main/template/DialogMaskTemplate.ejs @@ -0,0 +1,88 @@ +import { <%= componentName %> } from '<%= importPath %>' +import { TemplateService, HMRouterMgr, TranslateOption, ScaleOption, OpacityOption } from '@hadss/hmrouter' + +@Builder +export function <%= componentName %>Builder(name: string, param: Object) { + <%= componentName %>Generated() +} + +export const <%= componentName %>BuilderWrapBuilder = wrapBuilder(<%= componentName %>Builder) + +@Component +export struct <%= componentName %>Generated { + @State translateOption: TranslateOption = new TranslateOption() + @State scaleOption: ScaleOption = new ScaleOption() + @State opacityOption: OpacityOption = new OpacityOption() + private pageUrl: string = '' + private ndId: string = '' + private navigationId: string = '' + + aboutToAppear(): void { + this.navigationId = this.queryNavigationInfo()!.navigationId; + const allPathName = HMRouterMgr.getPathStack(this.navigationId)?.getAllPathName(); + this.pageUrl = allPathName ? allPathName[allPathName.length - 1] : ''; + TemplateService.aboutToAppear(this.navigationId, this.pageUrl, <%= dialog %>, + this.translateOption, this.scaleOption, this.opacityOption) + } + + aboutToDisappear(): void { + TemplateService.aboutToDisappear(this.navigationId, this.pageUrl, this.ndId) + } + + build() { + NavDestination() { + Stack({alignContent:Alignment.Bottom}) { + <%= componentName %>() + }.translate(this.translateOption) + .scale(this.scaleOption) + .opacity(this.opacityOption.opacity) + .width("100%") + .height("100%") + } + .backgroundColor("rgba(0, 0, 0, 0.2)") + <% if(dialog){ %>.mode(NavDestinationMode.DIALOG)<% } %> + .hideTitleBar(true) + .gesture(PanGesture() + .onActionStart((event: GestureEvent) => { + TemplateService.interactiveStart(this.navigationId, this.ndId, event) + }) + .onActionUpdate((event: GestureEvent) =>{ + TemplateService.interactiveProgress(this.navigationId, this.ndId, event) + }) + .onActionEnd((event: GestureEvent) =>{ + TemplateService.interactiveFinish(this.navigationId, this.ndId, event) + }) + ) + .onAppear(() => { + TemplateService.onAppear(this.navigationId, this.pageUrl, this.ndId) + }) + .onDisAppear(() => { + TemplateService.onDisAppear(this.navigationId, this.pageUrl, this.ndId) + }) + .onShown(() => { + TemplateService.onShown(this.navigationId, this.pageUrl, this.ndId) + }) + .onHidden(() => { + TemplateService.onHidden(this.navigationId, this.pageUrl, this.ndId) + }) + .onWillAppear(() => { + TemplateService.onWillAppear(this.navigationId, this.pageUrl) + }) + .onWillDisappear(() => { + TemplateService.onWillDisappear(this.navigationId, this.pageUrl, this.ndId) + }) + .onWillShow(() => { + TemplateService.onWillShow(this.navigationId, this.pageUrl, this.ndId) + }) + .onWillHide(() => { + TemplateService.onWillHide(this.navigationId, this.pageUrl, this.ndId) + }) + .onReady((navContext: NavDestinationContext) => { + this.ndId = navContext.navDestinationId! + TemplateService.onReady(this.navigationId, this.pageUrl, navContext) + }) + .onBackPressed(() => { + return TemplateService.onBackPressed(this.navigationId, this.pageUrl, this.ndId) + }) + } +} \ No newline at end of file diff --git a/hmrouter_config.json b/hmrouter_config.json deleted file mode 100644 index f0f2318..0000000 --- a/hmrouter_config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "scanDir": [ - "src/main/ets" - ], - "saveGeneratedFile": false -} \ No newline at end of file diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index 5e748e7..fd28783 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,7 +1,7 @@ { "modelVersion": "5.0.0", "dependencies": { - "@hadss/hmrouter-plugin": "latest" + "@hadss/hmrouter-plugin": "file:../libs/HMRouterPlugin-1.0.0-rc.10+build.13a19cfe.tgz" }, "execution": { // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ -- Gitee From 155e005893d8b7ff39bf3a071ef64d7cf7a58a44 Mon Sep 17 00:00:00 2001 From: lidra <593507091@qq.com> Date: Fri, 22 Nov 2024 09:24:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E4=B8=BA=E7=BA=BF?= =?UTF-8?q?=E4=B8=8A=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/oh-package.json5 | 2 +- hvigor/hvigor-config.json5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 4635edd..72911db 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -6,7 +6,7 @@ "author": "", "license": "", "dependencies": { - "@hadss/hmrouter": "file:../libs/HMRouterLibrary-1.0.0-rc.10+build.3956fc22.har" + "@hadss/hmrouter": "latest" } } diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index fd28783..5e748e7 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,7 +1,7 @@ { "modelVersion": "5.0.0", "dependencies": { - "@hadss/hmrouter-plugin": "file:../libs/HMRouterPlugin-1.0.0-rc.10+build.13a19cfe.tgz" + "@hadss/hmrouter-plugin": "latest" }, "execution": { // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ -- Gitee From afbe21de64bbc3316aa95a1dfe07242d4c22c2ca Mon Sep 17 00:00:00 2001 From: lidra <593507091@qq.com> Date: Fri, 22 Nov 2024 09:41:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=9A=90=E7=A7=81?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=BF=94=E5=9B=9E=E4=B8=80=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/component/privacy/PrivacyDialogDetail.ets | 6 ------ 1 file changed, 6 deletions(-) diff --git a/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets b/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets index 3a13034..ba7b5d8 100644 --- a/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets +++ b/entry/src/main/ets/component/privacy/PrivacyDialogDetail.ets @@ -86,12 +86,6 @@ export struct PrivacyDialogDetail { navigationId: this.queryNavigationInfo()?.navigationId, param: targetName }); - setTimeout(() => { - HMRouterMgr.pop({ - navigationId: this.queryNavigationInfo()?.navigationId, - param: targetName - }); - }, 400); }) .margin({ top: 20, bottom: 20 }) .width('45%') -- Gitee