Showing
3 changed files
with
34 additions
and
9 deletions
| 1 | +import { WDRouterRule } from 'wdRouter'; | ||
| 2 | +import { WDRouterPage } from 'wdRouter'; | ||
| 3 | + | ||
| 1 | @Entry | 4 | @Entry |
| 2 | @Component | 5 | @Component |
| 3 | struct GuidePages { | 6 | struct GuidePages { |
| @@ -56,6 +59,7 @@ struct GuidePages { | @@ -56,6 +59,7 @@ struct GuidePages { | ||
| 56 | .onClick(() => { | 59 | .onClick(() => { |
| 57 | if (index == 3) { | 60 | if (index == 3) { |
| 58 | // 跳转到首页 | 61 | // 跳转到首页 |
| 62 | + WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) | ||
| 59 | } | 63 | } |
| 60 | }) | 64 | }) |
| 61 | .id('index') | 65 | .id('index') |
| @@ -15,6 +15,7 @@ struct LaunchPage { | @@ -15,6 +15,7 @@ struct LaunchPage { | ||
| 15 | private context?: common.UIAbilityContext; | 15 | private context?: common.UIAbilityContext; |
| 16 | private timerId: number = 0; | 16 | private timerId: number = 0; |
| 17 | private isJumpToAdvertising: boolean = false; | 17 | private isJumpToAdvertising: boolean = false; |
| 18 | + private isJumpToGuide: boolean = false; | ||
| 18 | 19 | ||
| 19 | dialogController: CustomDialogController = new CustomDialogController({ | 20 | dialogController: CustomDialogController = new CustomDialogController({ |
| 20 | builder: CustomDialogComponent( | 21 | builder: CustomDialogComponent( |
| @@ -40,7 +41,9 @@ struct LaunchPage { | @@ -40,7 +41,9 @@ struct LaunchPage { | ||
| 40 | onConfirm() { | 41 | onConfirm() { |
| 41 | // Save privacy agreement status. | 42 | // Save privacy agreement status. |
| 42 | this.saveIsPrivacy(); | 43 | this.saveIsPrivacy(); |
| 43 | - this.jumpToAdvertisingPage(); | 44 | + //跳转引导页 |
| 45 | + this.jumpToGuidePage(); | ||
| 46 | + | ||
| 44 | } | 47 | } |
| 45 | 48 | ||
| 46 | jumpToAdvertisingPage() { | 49 | jumpToAdvertisingPage() { |
| @@ -57,6 +60,21 @@ struct LaunchPage { | @@ -57,6 +60,21 @@ struct LaunchPage { | ||
| 57 | }, 1000); | 60 | }, 1000); |
| 58 | } | 61 | } |
| 59 | 62 | ||
| 63 | + jumpToGuidePage() { | ||
| 64 | + this.timerId = setTimeout(() => { | ||
| 65 | + this.isJumpToGuide = true; | ||
| 66 | + | ||
| 67 | + WDRouterRule.jumpWithPage(WDRouterPage.guidePage) | ||
| 68 | + | ||
| 69 | + // router.pushUrl({ | ||
| 70 | + // url: 'pages/LaunchAdvertisingPage' | ||
| 71 | + // }).catch((error: Error) => { | ||
| 72 | + // //Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'LauncherPage pushUrl error ' + JSON.stringify(error)); | ||
| 73 | + // }); | ||
| 74 | + }, 1000); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + | ||
| 60 | onPageShow() { | 78 | onPageShow() { |
| 61 | this.context = getContext(this) as common.UIAbilityContext; | 79 | this.context = getContext(this) as common.UIAbilityContext; |
| 62 | // Get the operation class for saving data. | 80 | // Get the operation class for saving data. |
| @@ -66,11 +84,13 @@ struct LaunchPage { | @@ -66,11 +84,13 @@ struct LaunchPage { | ||
| 66 | if (value) { | 84 | if (value) { |
| 67 | // let isJumpPrivacy: boolean = globalThis.isJumpPrivacy ?? false; | 85 | // let isJumpPrivacy: boolean = globalThis.isJumpPrivacy ?? false; |
| 68 | // let isJumpPrivacy: boolean = (GlobalContext.getContext().getObject('isJumpPrivacy') as boolean) ?? false; | 86 | // let isJumpPrivacy: boolean = (GlobalContext.getContext().getObject('isJumpPrivacy') as boolean) ?? false; |
| 69 | - // if (!isJumpPrivacy) { | 87 | + //if (!isJumpPrivacy) { |
| 70 | this.dialogController.open(); | 88 | this.dialogController.open(); |
| 71 | // } | 89 | // } |
| 72 | } else { | 90 | } else { |
| 91 | + //跳转广告页 | ||
| 73 | this.jumpToAdvertisingPage(); | 92 | this.jumpToAdvertisingPage(); |
| 93 | + | ||
| 74 | } | 94 | } |
| 75 | }); | 95 | }); |
| 76 | }); | 96 | }); |
| @@ -80,9 +100,13 @@ struct LaunchPage { | @@ -80,9 +100,13 @@ struct LaunchPage { | ||
| 80 | if (this.isJumpToAdvertising) { | 100 | if (this.isJumpToAdvertising) { |
| 81 | router.clear(); | 101 | router.clear(); |
| 82 | } | 102 | } |
| 103 | + if (this.isJumpToGuide) { | ||
| 104 | + router.clear(); | ||
| 105 | + } | ||
| 83 | // globalThis.isJumpPrivacy = true; | 106 | // globalThis.isJumpPrivacy = true; |
| 84 | - //GlobalContext.getContext().setObject('isJumpPrivacy', true); | 107 | + // GlobalContext.getContext().setObject('isJumpPrivacy', true); |
| 85 | clearTimeout(this.timerId); | 108 | clearTimeout(this.timerId); |
| 109 | + this.dialogController.close(); | ||
| 86 | } | 110 | } |
| 87 | 111 | ||
| 88 | getDataPreferences(common: Object) { | 112 | getDataPreferences(common: Object) { |
| @@ -104,8 +128,6 @@ struct LaunchPage { | @@ -104,8 +128,6 @@ struct LaunchPage { | ||
| 104 | }); | 128 | }); |
| 105 | } | 129 | } |
| 106 | 130 | ||
| 107 | - | ||
| 108 | - | ||
| 109 | build(){ | 131 | build(){ |
| 110 | 132 | ||
| 111 | Stack({alignContent:Alignment.Bottom}){ | 133 | Stack({alignContent:Alignment.Bottom}){ |
| @@ -81,9 +81,8 @@ export default struct CustomDialogComponent { | @@ -81,9 +81,8 @@ export default struct CustomDialogComponent { | ||
| 81 | .width('40%') | 81 | .width('40%') |
| 82 | .fontColor(Color.Red) | 82 | .fontColor(Color.Red) |
| 83 | .onClick(() => { | 83 | .onClick(() => { |
| 84 | - //GlobalContext.getContext().setObject('isJumpPrivacy', false); | ||
| 85 | - | ||
| 86 | - // WDRouterRule.jumpWithPage(WDRouterPage.privacyPage) | 84 | + //GlobalContext.getContext().setObject('isJumpPrivacy', true); |
| 85 | + //WDRouterRule.jumpWithPage(WDRouterPage.privacyPage) | ||
| 87 | // router.pushUrl({ | 86 | // router.pushUrl({ |
| 88 | // url: 'pages/PrivacyPage' | 87 | // url: 'pages/PrivacyPage' |
| 89 | // }).catch((error: Error) => { | 88 | // }).catch((error: Error) => { |
| @@ -96,7 +95,7 @@ export default struct CustomDialogComponent { | @@ -96,7 +95,7 @@ export default struct CustomDialogComponent { | ||
| 96 | .fontColor(Color.Red) | 95 | .fontColor(Color.Red) |
| 97 | .onClick(() => { | 96 | .onClick(() => { |
| 98 | //GlobalContext.getContext().setObject('isJumpPrivacy', true); | 97 | //GlobalContext.getContext().setObject('isJumpPrivacy', true); |
| 99 | - // WDRouterRule.jumpWithPage(WDRouterPage.privacyPage) | 98 | + //WDRouterRule.jumpWithPage(WDRouterPage.privacyPage) |
| 100 | // router.pushUrl({ | 99 | // router.pushUrl({ |
| 101 | // url: 'pages/PrivacyPage' | 100 | // url: 'pages/PrivacyPage' |
| 102 | // }).catch((error: Error) => { | 101 | // }).catch((error: Error) => { |
-
Please register or login to post a comment