From aa0a4040c0b07f964a25b03eb4c90be04c2bc55a Mon Sep 17 00:00:00 2001 From: Hacker_DL Date: Thu, 17 Jul 2025 04:44:14 +0000 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=A3=E7=A0=81=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E3=80=81=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hacker_DL --- entry/src/main/ets/pages/AdvertisingPage.ets | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/entry/src/main/ets/pages/AdvertisingPage.ets b/entry/src/main/ets/pages/AdvertisingPage.ets index 1748f27..aabf542 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 -- Gitee