diff --git a/entry/src/main/ets/pages/AdvertisingPage.ets b/entry/src/main/ets/pages/AdvertisingPage.ets index 1748f27270a6ef41119f32e3294be1338e080962..aabf542faf917592a9647c858ceb925ee2154d8e 100644 --- a/entry/src/main/ets/pages/AdvertisingPage.ets +++ b/entry/src/main/ets/pages/AdvertisingPage.ets @@ -23,12 +23,15 @@ import CommonConstants from '../common/constants/CommonConstants'; @Entry @Component struct AdvertisingPage { + // 打开广告页后,在onPageShow方法内开始2秒倒计时(用户可手动点击跳过),倒计时结束后跳转到首页。 @State countDownSeconds: number = CommonConstants.ADVERTISING_COUNT_DOWN_SECONDS; private timeId: number = 0; onPageShow() { + // 开启2秒倒计时 this.timeId = setInterval(() => { if (this.countDownSeconds == 0) { + // 跳转到首页 this.jumpToAppHomePage(); } else { this.countDownSeconds--; @@ -88,12 +91,12 @@ struct AdvertisingPage { Column() { Text($r('app.string.healthy_life_text')) .bottomTextStyle(FontWeight.Bolder, - CommonConstants.ADVERTISING_HEALTHY_LIFE_TEXT_SPACING, + CommonConstants.ADVERTISING_HEALTHY_LIFE_TEXT_SPACING, $r('app.float.advertising_text_title_size'), $r('app.color.advertising_text_title_color')) Text($r('app.string.healthy_life_introduce')) .bottomTextStyle(FontWeight.Normal, - CommonConstants.ADVERTISING_TEXT_INTRODUCE_LETTER_SPACING, + CommonConstants.ADVERTISING_TEXT_INTRODUCE_LETTER_SPACING, $r('app.float.advertising_text_introduce_size'), $r('app.color.launcher_text_introduce_color')) .opacity($r('app.float.advertising_text_opacity')) @@ -112,11 +115,13 @@ struct AdvertisingPage { .height(CommonConstants.FULL_HEIGHT) } } + // Bottom text common style. -@Extend(Text) function bottomTextStyle (fontWeight: number, +@Extend(Text) +function bottomTextStyle(fontWeight: number, textAttribute: number, fontSize: Resource, fontColor: Resource) { - .fontWeight(fontWeight) - .letterSpacing(textAttribute) - .fontSize(fontSize) - .fontColor(fontColor) -} + .fontWeight(fontWeight) + .letterSpacing(textAttribute) + .fontSize(fontSize) + .fontColor(fontColor) +} \ No newline at end of file