diff --git a/build-profile.json5 b/build-profile.json5 index 616f5c7418822cca5bc66740fd62282f7a2dfbca..f5035353c1783f3c89bf2daac1644f194dfe4c2d 100755 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,6 +1,8 @@ { "app": { - "signingConfigs": [], + "signingConfigs": [ + + ], "products": [ { "name": "default", diff --git a/entry/src/main/ets/common/constants/CommonConstant.ets b/entry/src/main/ets/common/constants/CommonConstant.ets index 1eafe46b57fcf1e8d8716a3b5ea41436a4c04ace..fd569e959b9c930e377ca6edd77515bcbd40a39e 100755 --- a/entry/src/main/ets/common/constants/CommonConstant.ets +++ b/entry/src/main/ets/common/constants/CommonConstant.ets @@ -115,7 +115,6 @@ export class CommonConstants { * Length of truncated. */ static readonly SUB_LENGTH: number = 300; - /** * Type of cookie Operation. */ diff --git a/entry/src/main/ets/pages/Verify.ets b/entry/src/main/ets/pages/Verify.ets index a0fc2b4c1bd1ab296e56b924ee859a10cf891320..f8bc37e8a9fa0f4d33490e620b21de6c2357e08a 100755 --- a/entry/src/main/ets/pages/Verify.ets +++ b/entry/src/main/ets/pages/Verify.ets @@ -17,12 +17,17 @@ import { webview } from '@kit.ArkWeb'; import { showDialog } from '../common/utils/DialogUtil'; import { CommonConstants } from '../common/constants/CommonConstant'; +@Builder +export function VerifyPageBuilder() { + Verify() +} + /** * Page use to verify login free. */ -@Entry @Component -struct Verify { +export struct Verify { + pathStack: NavPathStack = new NavPathStack(); fileAccess: boolean = true; controller: webview.WebviewController = new webview.WebviewController(); isRedirect: boolean = false; @@ -32,22 +37,23 @@ struct Verify { } build() { - Column() { - Navigator({ target: CommonConstants.PAGE_INDEX, type: NavigationType.Back }) { - Row() { - Image($r('app.media.ic_back')) - .width(CommonConstants.BACK_WIDTH) - .height(CommonConstants.BACK_HEIGHT) - .objectFit(ImageFit.Contain) + NavDestination() { + Row() { + Image($r('app.media.ic_back')) + .width(CommonConstants.BACK_WIDTH) + .height(CommonConstants.BACK_HEIGHT) + .objectFit(ImageFit.Contain) - Text($r('app.string.navigator_name')) - .fontSize(CommonConstants.NAVIGATOR_SIZE) - .fontWeight(CommonConstants.FONT_WEIGHT_DEEPER) - .fontColor($r('app.color.navigator_black')) - } - .width(CommonConstants.FULL_WIDTH) + Text($r('app.string.navigator_name')) + .fontSize(CommonConstants.NAVIGATOR_SIZE) + .fontWeight(CommonConstants.FONT_WEIGHT_DEEPER) + .fontColor($r('app.color.navigator_black')) } + .onClick(() => { + this.pathStack.pop(); + }) .width(CommonConstants.FULL_WIDTH) + .margin({ top: CommonConstants.NAVIGATOR_MARGIN_TOP, left: CommonConstants.NAVIGATOR_MARGIN_LEFT @@ -81,12 +87,17 @@ struct Verify { this.isRedirect = true; showDialog(originCookie); } catch (error) { - showDialog('Failed to load the web page.'+JSON.stringify(error)); + showDialog('Failed to load the web page.' + JSON.stringify(error)); } }) } .backgroundColor($r('app.color.page_background_grey')) .width(CommonConstants.FULL_WIDTH) .height(CommonConstants.FULL_HEIGHT) + .hideTitleBar(true) + .hideToolBar(true) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack; + }) } } diff --git a/entry/src/main/ets/pages/WebIndex.ets b/entry/src/main/ets/pages/WebIndex.ets index cd52b1b1cee125751c862c362a55a1a19fcb9dc6..b4be93b79cf8f3faa1c0b09be5711d8c430c6917 100755 --- a/entry/src/main/ets/pages/WebIndex.ets +++ b/entry/src/main/ets/pages/WebIndex.ets @@ -25,9 +25,10 @@ import { showDialog } from '../common/utils/DialogUtil'; @Component struct WebIndex { controller: webview.WebviewController = new webview.WebviewController(); + pathStack: NavPathStack = new NavPathStack(); build() { - Column() { + Navigation(this.pathStack) { Text($r('app.string.navigator_name')) .fontSize(CommonConstants.NAVIGATOR_SIZE) .fontWeight(CommonConstants.FONT_WEIGHT_DEEPER) @@ -70,7 +71,7 @@ struct WebIndex { LinkButton({ buttonType: CommonConstants.CookieOperation[0], isNeedDivider: true }) LinkButton({ buttonType: CommonConstants.CookieOperation[1], isNeedDivider: true }) LinkButton({ buttonType: CommonConstants.CookieOperation[2], isNeedDivider: true }) - LinkButton({ buttonType: CommonConstants.CookieOperation[3], isNeedDivider: false }) + LinkButton({ buttonType: CommonConstants.CookieOperation[3], isNeedDivider: false, pathStack: this.pathStack }) } .justifyContent(FlexAlign.SpaceBetween) .width(CommonConstants.WEB_WIDTH) @@ -78,5 +79,7 @@ struct WebIndex { .backgroundColor($r('app.color.page_background_grey')) .width(CommonConstants.FULL_WIDTH) .height(CommonConstants.FULL_HEIGHT) + .hideTitleBar(true) + .hideToolBar(true) } } \ No newline at end of file diff --git a/entry/src/main/ets/view/LinkButton.ets b/entry/src/main/ets/view/LinkButton.ets index a2478c92c5c13529e4eca9a55e7bcef65a1987e9..48370ea7fc0d826fd9b8281740b94895464b54a7 100755 --- a/entry/src/main/ets/view/LinkButton.ets +++ b/entry/src/main/ets/view/LinkButton.ets @@ -14,7 +14,6 @@ */ import { webview } from '@kit.ArkWeb'; -import { router } from '@kit.ArkUI'; import { showDialog } from '../common/utils/DialogUtil'; import { CommonConstants } from '../common/constants/CommonConstant'; @@ -25,6 +24,7 @@ import { CommonConstants } from '../common/constants/CommonConstant'; export struct LinkButton { buttonType?: string; isNeedDivider?: boolean; + pathStack: NavPathStack = new NavPathStack(); build() { Row() { @@ -59,9 +59,7 @@ export struct LinkButton { let deleteMessage = $r('app.string.delete_success'); showDialog(deleteMessage); } else { - router.pushUrl({ - url: CommonConstants.PAGE_VERIFY - }) + this.pathStack.pushPathByName('Verify', undefined); } } catch (error) { showDialog('Operation failed.' + JSON.stringify(error)); diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 4080bdcf9a36537f9ad5d3420fafc7748a64407a..fb841787d87d7cf0dbb561436ab098a1f614631a 100755 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -10,6 +10,7 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "routerMap": "$profile:route_map", "abilities": [ { "name": "EntryAbility", diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index 47bf9e1ea671829dbc3ce99dadc2a8c3258c9ba4..758841e619ce7937ebc460c8447fbcf61a150a2a 100755 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -1,6 +1,5 @@ { "src": [ - "pages/WebIndex", - "pages/Verify" + "pages/WebIndex" ] } diff --git a/entry/src/main/resources/base/profile/route_map.json b/entry/src/main/resources/base/profile/route_map.json new file mode 100644 index 0000000000000000000000000000000000000000..84076856576c2c1df54f406f2604eb267afdf70a --- /dev/null +++ b/entry/src/main/resources/base/profile/route_map.json @@ -0,0 +1,12 @@ +{ + "routerMap": [ + { + "name": "Verify", + "pageSourceFile": "src/main/ets/pages/Verify.ets", + "buildFunction": "VerifyPageBuilder", + "data": { + "description" : "this is Verify" + } + } + ] +} \ No newline at end of file