diff --git a/commons/base/src/main/ets/utils/AvPlayerUtil.ets b/commons/base/src/main/ets/utils/AvPlayerUtil.ets index 2234b0c4f1da50875818ea8a6380b57e694ce6dd..65f510c3e8d280da9842738098639c719ae7e06c 100644 --- a/commons/base/src/main/ets/utils/AvPlayerUtil.ets +++ b/commons/base/src/main/ets/utils/AvPlayerUtil.ets @@ -20,9 +20,10 @@ import { BusinessError } from '@kit.BasicServicesKit'; import Logger from './Logger'; import { CommonConstants } from '../constants/CommonConstants'; +const uiContext: common.UIAbilityContext | undefined = AppStorage.get('uiContext'); + export class AvPlayerUtil { private avPlayer?: media.AVPlayer; - private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; private url: resourceManager.RawFileDescriptor | null = null; private playState: boolean = true; private surfaceId: string = ''; @@ -41,7 +42,7 @@ export class AvPlayerUtil { } switch (state) { case CommonConstants.AV_PLAYER_IDLE_STATE: - this.url = await this.context.resourceManager.getRawFd(CommonConstants.LIVE_VIDEO_NAME); + this.url = await uiContext!.resourceManager.getRawFd(CommonConstants.LIVE_VIDEO_NAME); this.avPlayer.fdSrc = this.url; Logger.info('AVPlayer state idle called.'); break; @@ -105,7 +106,7 @@ export class AvPlayerUtil { this.surfaceId = surfaceId; Logger.info('Created AvPlayer successfully.'); // Entering idle state. - this.url = await this.context.resourceManager.getRawFd(CommonConstants.LIVE_VIDEO_NAME); + this.url = await uiContext!.resourceManager.getRawFd(CommonConstants.LIVE_VIDEO_NAME); this.avPlayer.fdSrc = this.url; this.setAVPlayerCallback(); } else { diff --git a/commons/base/src/main/ets/utils/PipWindowUtil.ets b/commons/base/src/main/ets/utils/PipWindowUtil.ets index 8271034f4c09830eeb3b71ae76c24c57437f48b1..90def497aea6c98458f10603d001ed2bc1358f48 100644 --- a/commons/base/src/main/ets/utils/PipWindowUtil.ets +++ b/commons/base/src/main/ets/utils/PipWindowUtil.ets @@ -43,7 +43,7 @@ export class PipWindowUtil { getXComponentController(): XComponentController { return this.mXComponentController; } - + // [Start start_pip] async startPip(navId: string, mXComponentController: XComponentController, context: Context, pageInfos: NavPathStack): Promise { if (canIUse('SystemCapability.Window.SessionManager')) { @@ -80,7 +80,8 @@ export class PipWindowUtil { }); } } - + // [End start_pip] + // [Start init_pip_controller] initPipController(): void { if (!this.pipController) { return; @@ -94,7 +95,7 @@ export class PipWindowUtil { }); } } - + // [End init_pip_controller] onStateChange(state: PiPWindow.PiPState, reason: string): void { if (canIUse('SystemCapability.Window.SessionManager')) { let curState: string = ''; @@ -140,7 +141,7 @@ export class PipWindowUtil { break; } } - + // [Start stop_pip] // Disable the pip function by calling stopPip. async stopPip(): Promise { if (canIUse('SystemCapability.Window.SessionManager')) { @@ -161,4 +162,5 @@ export class PipWindowUtil { } } } + // [End stop_pip] } \ No newline at end of file diff --git a/commons/base/src/main/ets/utils/WindowUtil.ets b/commons/base/src/main/ets/utils/WindowUtil.ets index 05342607f968af7bf717f5fa9ffc38a4863c9a9b..fa433d1ec30f1e54c710b03446d256cbdd60e001 100644 --- a/commons/base/src/main/ets/utils/WindowUtil.ets +++ b/commons/base/src/main/ets/utils/WindowUtil.ets @@ -19,6 +19,8 @@ import { BreakpointConstants } from '../constants/BreakpointConstants'; import { CommonConstants } from '../constants/CommonConstants'; import Logger from './Logger'; +const uiContext: UIContext | undefined = AppStorage.get('uiContext'); + export class WindowUtil { private windowStage?: window.WindowStage; private mainWindowClass?: window.Window; @@ -77,7 +79,7 @@ export class WindowUtil { return; } let topHeight: number = this.mainWindowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height; - AppStorage.setOrCreate('topRectHeight', px2vp(topHeight)); + AppStorage.setOrCreate('topRectHeight', uiContext?.px2vp(topHeight)); } updateBreakpoint(windowWidth: number): void { diff --git a/features/detail/src/main/ets/constants/DetailConstants.ets b/features/detail/src/main/ets/constants/DetailConstants.ets index 5077688f9ae4e7f16cd9f728996c82db9ec9596c..b5c74884ea5eb9fa7ccb06d84d81e3c1869ce479 100644 --- a/features/detail/src/main/ets/constants/DetailConstants.ets +++ b/features/detail/src/main/ets/constants/DetailConstants.ets @@ -17,7 +17,7 @@ export class DetailConstants { /** * Living. */ - static readonly LIVING: string = getContext(this).resourceManager.getStringSync($r('app.string.living')); + static readonly LIVING = (context: Context): string => context.resourceManager.getStringSync($r('app.string.living')); /** * Product detail resources. @@ -58,23 +58,23 @@ export class DetailConstants { /** * Customer service contents. */ - static readonly CUSTOMER_SERVICE_CONTENTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.store')), + static readonly CUSTOMER_SERVICE_CONTENTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.store')), '¥12999', '¥13999', - getContext(this).resourceManager.getStringSync($r('app.string.buy')), - getContext(this).resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS2')), - getContext(this).resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS3')), - getContext(this).resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS4'))]; + context.resourceManager.getStringSync($r('app.string.buy')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS1')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS2')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS3')), + context.resourceManager.getStringSync($r('app.string.CUSTOMER_SERVICE_CONTENTS4'))]; /** * Product color list. */ - static readonly COLOR_SELECT_NAME_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST4'))]; + static readonly COLOR_SELECT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST1')), + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST2')), + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST3')), + context.resourceManager.getStringSync($r('app.string.COLOR_SELECT_NAME_LIST4'))]; /** * Product name list. @@ -84,16 +84,16 @@ export class DetailConstants { /** * Product type list. */ - static readonly TYPE_SELECT_NAME_LIST: string[] = - [getContext(this).resourceManager.getStringSync($r('app.string.Official_standard'))]; + static readonly TYPE_SELECT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.Official_standard'))]; /** * Product select type list. */ - static readonly SELECT_NAME_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST3'))]; + static readonly SELECT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST1')), + context.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST2')), + context.resourceManager.getStringSync($r('app.string.SELECT_NAME_LIST3'))]; /** * Product image list. @@ -104,44 +104,44 @@ export class DetailConstants { /** * Button names. */ - static readonly BUTTON_NAMES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.add_cart')), - getContext(this).resourceManager.getStringSync($r('app.string.buy'))]; + static readonly BUTTON_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.add_cart')), + context.resourceManager.getStringSync($r('app.string.buy'))]; /** * Pay address and contact. */ - static readonly PAY_INFO: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.pay_info1')), - getContext(this).resourceManager.getStringSync($r('app.string.pay_info2')), - getContext(this).resourceManager.getStringSync($r('app.string.pay_info3')), - getContext(this).resourceManager.getStringSync($r('app.string.pay_info4'))]; + static readonly PAY_INFO = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.pay_info1')), + context.resourceManager.getStringSync($r('app.string.pay_info2')), + context.resourceManager.getStringSync($r('app.string.pay_info3')), + context.resourceManager.getStringSync($r('app.string.pay_info4'))]; /** * Product config list. */ - static readonly PRODUCT_CONFIG_NAMES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES2')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES4')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES5')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES6')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES7')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES8'))]; + static readonly PRODUCT_CONFIG_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES4')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES5')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES6')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES7')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_CONFIG_NAMES8'))]; /** * User comment list. */ - static readonly USER_COMMENT_NAMES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES1')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES2')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES3')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES4')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES5')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES6')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES7')), - getContext(this).resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES8'))]; + static readonly USER_COMMENT_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES1')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES2')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES3')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES4')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES5')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES6')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES7')), + context.resourceManager.getStringSync($r('app.string.USER_COMMENT_NAMES8'))]; /** * List space. @@ -161,8 +161,8 @@ export class DetailConstants { /** * Picture number. */ - static readonly PICTURE_INDICATOR: string[] = ['/5', '3D', - getContext(this).resourceManager.getStringSync($r('app.string.compare'))]; + static readonly PICTURE_INDICATOR = (context: Context): string[] => ['/5', '3D', + context.resourceManager.getStringSync($r('app.string.compare'))]; /** * Picture list space list. @@ -172,25 +172,25 @@ export class DetailConstants { /** * Product discount name list. */ - static readonly PRODUCT_DISCOUNT_NAMES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES2')), + static readonly PRODUCT_DISCOUNT_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES2')), 'Mate X5:', - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES3'))]; + context.resourceManager.getStringSync($r('app.string.PRODUCT_DISCOUNT_NAMES3'))]; /** * Product price name list. */ - static readonly PRODUCT_PRICE_NAMES: string[] = ['¥', '12999', '¥13999', - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES1')), + static readonly PRODUCT_PRICE_NAMES = (context: Context): string[] => ['¥', '12999', '¥13999', + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES1')), '07', ':', '14', ':', '50', - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES2')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES4')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES5')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES6')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES7')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES8'))]; + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES4')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES5')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES6')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES7')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRICE_NAMES8'))]; /** * 80 percent. diff --git a/features/detail/src/main/ets/constants/LiveConstants.ets b/features/detail/src/main/ets/constants/LiveConstants.ets index c995e6e6358d1cae10c9b161d29507cc3f1ca7f0..faa28ff623ce11e09c43c70725d4854986f57a88 100644 --- a/features/detail/src/main/ets/constants/LiveConstants.ets +++ b/features/detail/src/main/ets/constants/LiveConstants.ets @@ -20,122 +20,108 @@ export class LiveConstants { static readonly LIVE_PRODUCT_IMAGE_LIST: Resource[] = [$r('app.media.live_product_1'), $r('app.media.live_product_2'), $r('app.media.live_product_3'), $r('app.media.live_product_4'), $r('app.media.live_product_5'), $r('app.media.live_product_6'), $r('app.media.live_product_7'), $r('app.media.live_product_8')]; - /** * Live product name list. */ static readonly LIVE_PRODUCT_NAME_LIST: string[] = ['HUAWEI Mate 60 Pro', 'XXXXXXXXXXX', 'XXXXXXXXXXX', 'XXXXXXXXXXX', - 'XXXXXXXXXXX','XXXXXXXXXXX','XXXXXXXXXXX','XXXXXXXXXXX']; - + 'XXXXXXXXXXX', 'XXXXXXXXXXX', 'XXXXXXXXXXX', 'XXXXXXXXXXX']; /** * Live product price list. */ - static readonly LIVE_PRODUCT_PRICE_LIST: string[] = ['¥ 6999', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX','XXXX']; - + static readonly LIVE_PRODUCT_PRICE_LIST: string[] = + ['¥ 6999', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX', 'XXXX']; /** * Shop car product image list. */ static readonly SHOP_CAR_PRODUCT_IMAGE_LIST: Resource[] = [$r('app.media.live_bag_product_1'), $r('app.media.live_bag_product_2'), $r('app.media.live_bag_product_3'), $r('app.media.live_bag_product_4')]; - /** * Shop car product name list. */ static readonly SHOP_CAR_PRODUCT_NAME_LIST: string[] = ['HUAWEI Mate 60 Pro', 'Mate Xs 2', 'MateBook E Go', 'HUAWEI Mate 50']; - /** * Shop car product remark list. */ - static readonly SHOP_CAR_PRODUCT_REMARK_LIST: string[] = - [getContext(this).resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST1'))]; - + static readonly SHOP_CAR_PRODUCT_REMARK_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST1')), + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST2')), + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST3')), + context.resourceManager.getStringSync($r('app.string.OP_CAR_PRODUCT_REMARK_LIST1'))]; /** * Shop car product discounts list. */ - static readonly SHOP_CAR_PRODUCT_DISCOUNTS_LIST: string[][] = [ - [getContext(this).resourceManager.getStringSync($r('app.string.Gifted_points')), - getContext(this).resourceManager.getStringSync($r('app.string.flagship_machine'))], - [getContext(this).resourceManager.getStringSync($r('app.string.flagship_machine'))], - [getContext(this).resourceManager.getStringSync($r('app.string.cheaper'))], - [getContext(this).resourceManager.getStringSync($r('app.string.Gifted_points')), - getContext(this).resourceManager.getStringSync($r('app.string.flagship_machine'))]]; + static readonly SHOP_CAR_PRODUCT_DISCOUNTS_LIST = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.Gifted_points')), + context.resourceManager.getStringSync($r('app.string.flagship_machine'))], + [context.resourceManager.getStringSync($r('app.string.flagship_machine'))], + [context.resourceManager.getStringSync($r('app.string.cheaper'))], + [context.resourceManager.getStringSync($r('app.string.Gifted_points')), + context.resourceManager.getStringSync($r('app.string.flagship_machine'))]]; /** * Shop car product price list. */ static readonly SHOP_CAR_PRODUCT_PRICE_LIST: number[] = [6999, 9999, 4899, 4999]; - /** * Shop car icon resources. */ static readonly SHOP_CAR_ICON_RESOURCES: Resource[] = [$r('app.media.icon_bag'), $r('app.media.icon_search'), $r('app.media.icon_order')]; - /** * Shop car icon names. */ - static readonly SHOP_CAR_ICON_NAMES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.Shopping_bag')), - getContext(this).resourceManager.getStringSync($r('app.string.search')), - getContext(this).resourceManager.getStringSync($r('app.string.Order'))]; - + static readonly SHOP_CAR_ICON_NAMES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.Shopping_bag')), + context.resourceManager.getStringSync($r('app.string.search')), + context.resourceManager.getStringSync($r('app.string.Order'))]; /** * Shop car tab list. */ - static readonly SHOP_CAR_TABS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.all')), - getContext(this).resourceManager.getStringSync($r('app.string.phone')), - getContext(this).resourceManager.getStringSync($r('app.string.mac')), - getContext(this).resourceManager.getStringSync($r('app.string.PC')), - getContext(this).resourceManager.getStringSync($r('app.string.watch')), - getContext(this).resourceManager.getStringSync($r('app.string.earphone'))]; - + static readonly SHOP_CAR_TABS = (context: Context): string[] => { + return [ + context.resourceManager.getStringSync($r('app.string.all')), + context.resourceManager.getStringSync($r('app.string.phone')), + context.resourceManager.getStringSync($r('app.string.mac')), + context.resourceManager.getStringSync($r('app.string.PC')), + context.resourceManager.getStringSync($r('app.string.watch')), + context.resourceManager.getStringSync($r('app.string.earphone'))] + }; /** * Live Comments. */ - static readonly LIVE_COMMENTS_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST3'))]; - + static readonly LIVE_COMMENTS_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST1')), + context.resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST2')), + context.resourceManager.getStringSync($r('app.string.LIVE_COMMENTS_LIST3'))]; /** * Comments layout weight. */ static readonly COMMENTS_WIDTH: string[] = ['228vp', '400vp', '290vp'] - /** * Shopping list interval. */ static readonly SHOPPING_LIST_SPACE: string[] = ['12vp', '10vp']; - /** * Currency symbol. */ static readonly CURRENCY_SYMBOL: string = "¥ "; - /** * Eight. */ static readonly EIGHT: number = 8; - /** * Ninety percent. */ static readonly NINETY_PERCENT: string = '90%'; - /** * Pay button text. */ - static readonly PAY_BUTTON_TEXT: string = getContext(this).resourceManager.getStringSync($r('app.string.buy_now')); - + static readonly PAY_BUTTON_TEXT = + (context: Context): string => context.resourceManager.getStringSync($r('app.string.buy_now')); /** * X component params. */ static readonly X_COMPONENT_PARAMS: string[] = ['live', 'surface']; - /** * X component aspect ratio. */ diff --git a/features/detail/src/main/ets/view/Comment.ets b/features/detail/src/main/ets/view/Comment.ets index 8b885a5f68aced70ca9a71b99240f955e63d6dfe..24aca21618e907e936bb196add4dfabd9cf53fc4 100644 --- a/features/detail/src/main/ets/view/Comment.ets +++ b/features/detail/src/main/ets/view/Comment.ets @@ -19,10 +19,11 @@ import { LiveConstants } from '../constants/LiveConstants'; @Component export struct Comment { @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { - ForEach(LiveConstants.LIVE_COMMENTS_LIST, (item: string, index: number) => { + ForEach(LiveConstants.LIVE_COMMENTS_LIST(this.context), (item: string, index: number) => { Row() { Text($r('app.string.official_review')) .fontColor(Color.White) diff --git a/features/detail/src/main/ets/view/CommonView.ets b/features/detail/src/main/ets/view/CommonView.ets index e0cf50c8cb3c5415410b794bc5aebf91bdd81997..e392a3338080e48a1232ed8d2b9a8fcf36897ace 100644 --- a/features/detail/src/main/ets/view/CommonView.ets +++ b/features/detail/src/main/ets/view/CommonView.ets @@ -99,8 +99,10 @@ export struct DetailTopIcon { @Component export struct CommentsTitle { + private context: Context = this.getUIContext().getHostContext()! + build() { - Text(DetailConstants.USER_COMMENT_NAMES[0]) + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[0]) .fontSize($r('app.float.user_comments_title_font')) .lineHeight($r('app.float.user_comments_title_line')) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -110,6 +112,8 @@ export struct CommentsTitle { @Component export struct UserCommentInfo { + private context: Context = this.getUIContext().getHostContext()! + build() { Row() { Image($r('app.media.user_profile')) @@ -117,7 +121,7 @@ export struct UserCommentInfo { .height(ResourceUtil.getCommonImgSize()[2]) .margin({ right: $r('app.float.comments_profile_margin') }) Column() { - Text(DetailConstants.USER_COMMENT_NAMES[4]) + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[4]) .fontSize($r('app.float.comments_user_font')) .lineHeight($r('app.float.comments_user_line')) .fontWeight(FontWeight.Normal) @@ -139,8 +143,10 @@ export struct UserCommentInfo { @Component export struct CommentsContent { + private context: Context = this.getUIContext().getHostContext()! + build() { - Text(DetailConstants.USER_COMMENT_NAMES[5]) + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[5]) .fontSize($r('app.float.comment_text_font')) .fontWeight(FontWeight.Normal) .lineHeight($r('app.float.comment_text_line')) @@ -149,6 +155,8 @@ export struct CommentsContent { @Component export struct CommentContentExtra { + private context: Context = this.getUIContext().getHostContext()! + build() { Column() { Image($r('app.media.comment_picture')) @@ -160,7 +168,7 @@ export struct CommentContentExtra { top: $r('app.float.tag_padding'), bottom: $r('app.float.tag_padding') }) - Text(DetailConstants.USER_COMMENT_NAMES[7]) + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[7]) .opacity(CommonConstants.TEXT_OPACITY[2]) .fontSize($r('app.float.comment_extra_font')) .fontWeight(FontWeight.Normal) diff --git a/features/detail/src/main/ets/view/CustomerServiceView.ets b/features/detail/src/main/ets/view/CustomerServiceView.ets index 735daf9177b2e3b090a3cb4fa7f0d97f03294d26..a4040e6466745b614c98ec5bab6e7a14c7e7d3e2 100644 --- a/features/detail/src/main/ets/view/CustomerServiceView.ets +++ b/features/detail/src/main/ets/view/CustomerServiceView.ets @@ -22,6 +22,7 @@ export struct CustomerServiceView { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('topRectHeight') topRectHeight: number = 0; @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { @@ -35,7 +36,7 @@ export struct CustomerServiceView { Visibility.None) NormalImage({ imageResource: $r('app.media.shop_logo') }) .margin({ right: $r('app.float.top_icon_right_margin') }) - Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS[0]) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[0]) .fontSize($r('app.float.customer_service_font')) .lineHeight($r('app.float.customer_service_line_height')) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -71,7 +72,7 @@ export struct CustomerServiceView { .aspectRatio(1) Column() { - Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS[4]) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[4]) .fontSize($r('app.float.service_card_font_3')) .lineHeight($r('app.float.service_card_line_3')) .fontWeight(FontWeight.Normal) @@ -83,14 +84,14 @@ export struct CustomerServiceView { $r('app.float.service_card_margin_3_lg') : $r('app.float.service_card_margin_3') }) Row() { - Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS[1]) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[1]) .fontSize($r('app.float.service_card_font_1')) .lineHeight(CommonConstants.FULL_PERCENT) .fontWeight(CommonConstants.FONT_WEIGHT_500) .fontColor($r('app.color.service_font_color')) .margin({ right: $r('app.float.service_card_margin') }) .displayPriority(2) - Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS[2]) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[2]) .fontSize($r('app.float.service_card_font_2')) .lineHeight($r('app.float.service_card_line_2')) .fontWeight(FontWeight.Normal) @@ -105,7 +106,7 @@ export struct CustomerServiceView { Visibility.None) Blank() .displayPriority(3) - Button(DetailConstants.CUSTOMER_SERVICE_CONTENTS[3]) + Button(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[3]) .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.service_button_width_lg') : $r('app.float.service_button_width')) .height(CommonConstants.FULL_PERCENT) @@ -135,17 +136,17 @@ export struct CustomerServiceView { .backgroundColor(Color.White) MessageView({ - messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS[5], + messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[5], isReceiving: false, isSameSender: false }) MessageView({ - messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS[6], + messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[6], isReceiving: true, isSameSender: false }) MessageView({ - messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS[7], + messageContent: DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[7], isReceiving: true, isSameSender: true }) diff --git a/features/detail/src/main/ets/view/LiveHome.ets b/features/detail/src/main/ets/view/LiveHome.ets index e7a71e79cb2e5989701d2edabc2b4bd60303b4cc..3d4722bf0151f9dbaea11fbeeb06fec1d664d293 100644 --- a/features/detail/src/main/ets/view/LiveHome.ets +++ b/features/detail/src/main/ets/view/LiveHome.ets @@ -34,6 +34,7 @@ export struct LiveHome { @State utilShoppingBag: boolean = false; @State utilCustomerService: boolean = false; @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! private onFoldStatusChange: Callback = (data: display.FoldStatus) => { if (canIUse('SystemCapability.Window.SessionManager')) { if (data === display.FoldStatus.FOLD_STATUS_FOLDED && @@ -113,7 +114,7 @@ export struct LiveHome { @Builder PayCardButton() { - Text(LiveConstants.PAY_BUTTON_TEXT) + Text(LiveConstants.PAY_BUTTON_TEXT(this.context)) .width($r('app.float.pay_button_width')) .height($r('app.float.live_pay_button_height')) .fontColor(Color.White) diff --git a/features/detail/src/main/ets/view/LiveMaskLayer.ets b/features/detail/src/main/ets/view/LiveMaskLayer.ets index 5c6749ef350a88a154651b439353f7b71a52dc83..538809dc47bfc78cc84da10a02891508dd20381d 100644 --- a/features/detail/src/main/ets/view/LiveMaskLayer.ets +++ b/features/detail/src/main/ets/view/LiveMaskLayer.ets @@ -29,6 +29,7 @@ export struct LiveMaskLayer { @Link isMoreDetail: boolean; build() { + // [Start change_flex_direction] Flex({ direction: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? FlexDirection.Row : FlexDirection.Column, @@ -42,6 +43,7 @@ export struct LiveMaskLayer { isMoreDetail: this.isMoreDetail }) } + // [End change_flex_direction] .layoutWeight(1) .padding({ left: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint), diff --git a/features/detail/src/main/ets/view/LiveShopList.ets b/features/detail/src/main/ets/view/LiveShopList.ets index eadfbfbb33b1f98f3ad4763a1c1c433d2a0c97f3..234c74044ab553d144cdd0219365344c1513807d 100644 --- a/features/detail/src/main/ets/view/LiveShopList.ets +++ b/features/detail/src/main/ets/view/LiveShopList.ets @@ -112,7 +112,9 @@ export struct LiveShopList { CommonConstants.FULL_PERCENT) .width(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? CommonConstants.FULL_PERCENT : $r('app.float.shop_width_index0_lg')) + // [Start set_list_direction] .listDirection(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Axis.Vertical : Axis.Horizontal) + // [End set_list_direction] } } \ No newline at end of file diff --git a/features/detail/src/main/ets/view/LiverHeader.ets b/features/detail/src/main/ets/view/LiverHeader.ets index c9baf697c45637ce47a9d428013e1fe419358889..2cc426f123adcca0b36e5c95dbb713aa8cc304f1 100644 --- a/features/detail/src/main/ets/view/LiverHeader.ets +++ b/features/detail/src/main/ets/view/LiverHeader.ets @@ -56,7 +56,7 @@ export struct LiverHeader { return; } this.pipWindowUtil.startPip(DetailConstants.NAVIGATION_ID, this.pipWindowUtil.getXComponentController(), - getContext(this), this.pageInfos); + this.getUIContext().getHostContext()!, this.pageInfos); } else { this.pageInfos.pop(); } diff --git a/features/detail/src/main/ets/view/PayCard.ets b/features/detail/src/main/ets/view/PayCard.ets index accc96567103986ae3192d0d13e57cd3e76aaf8b..407c5485984c50e633190eb3acf25297813e977f 100644 --- a/features/detail/src/main/ets/view/PayCard.ets +++ b/features/detail/src/main/ets/view/PayCard.ets @@ -24,7 +24,8 @@ export struct PayCard { @Prop currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @Link isOpen: boolean; @Link detailType: string; - private payCardSelectList: SelectProjectItem[] = new PayCardViewModel().getPayCardSelectList(); + private context: Context = this.getUIContext().getHostContext()! + private payCardSelectList: SelectProjectItem[] = new PayCardViewModel(this.context).getPayCardSelectList(); public dialogController?: CustomDialogController; build() { @@ -36,7 +37,7 @@ export struct PayCard { .height(ResourceUtil.getCommonImgSize()[4]) .width(ResourceUtil.getCommonImgSize()[4]) .margin({ right: $r('app.float.pay_card_product_margin') }) - Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS[1]) + Text(DetailConstants.CUSTOMER_SERVICE_CONTENTS(this.context)[1]) .fontColor($r('app.color.service_font_color')) .fontSize($r('app.float.pay_card_price_font')) Blank() @@ -80,14 +81,14 @@ export struct PayCard { .width(ResourceUtil.getCommonImgSize()[5]) .margin({ right: $r('app.float.pay_position_margin') }) Column() { - Text(DetailConstants.PAY_INFO[0]) + Text(DetailConstants.PAY_INFO(this.context)[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]) + Text(DetailConstants.PAY_INFO(this.context)[1]) .fontSize($r('app.float.pay_contact_font')) .fontColor($r('app.color.pay_contact_color')) .width(CommonConstants.FULL_PERCENT) @@ -170,7 +171,7 @@ export struct PayCard { .height(ResourceUtil.getCommonImgSize()[5]) .width(ResourceUtil.getCommonImgSize()[5]) .margin({ right: $r('app.float.pay_wallet_icon_margin') }) - Text(DetailConstants.PAY_INFO[2]) + Text(DetailConstants.PAY_INFO(this.context)[2]) .fontSize($r('app.float.pay_wallet_font')) .fontWeight(CommonConstants.FONT_WEIGHT_500) Blank() @@ -197,7 +198,7 @@ export struct PayCard { .align(Alignment.Top) .width(CommonConstants.FULL_PERCENT) - Button(DetailConstants.PAY_INFO[3]) + Button(DetailConstants.PAY_INFO(this.context)[3]) .width(CommonConstants.FULL_PERCENT) .backgroundColor($r('app.color.util_button_2')) .height($r('app.float.pay_button_height')) diff --git a/features/detail/src/main/ets/view/ProductConfig.ets b/features/detail/src/main/ets/view/ProductConfig.ets index 7ea5537765ecb434aa4bdad04de40a1311f49555..b777656ff4068f445af680bc5a8956def055d4b7 100644 --- a/features/detail/src/main/ets/view/ProductConfig.ets +++ b/features/detail/src/main/ets/view/ProductConfig.ets @@ -22,16 +22,17 @@ import { CommentContentExtra, CommentsContent, CommentsTitle, ConfigTipIcon, Con @Component export struct ProductConfig { @Prop pageBreakpoint: string; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { Column() { Row() { - ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES[0] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[0] }) .margin({ right: $r('app.float.products_config_margin_12') }) Column() { Row() { - ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES[1] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[1] }) Blank() RightArrow() } @@ -63,8 +64,8 @@ export struct ProductConfig { Row() { Column() { - ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES[2] }) - ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES[3] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[2] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[3] }) } .width($r('app.float.config_text_col_width')) .height($r('app.float.config_text_col_height')) @@ -101,9 +102,9 @@ export struct ProductConfig { .margin({ bottom: $r('app.float.products_config_margin_12') }) Row() { - ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES[4] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[4] }) .margin({ right: $r('app.float.products_config_margin_12') }) - ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES[5] }) + ProductsConfigText({ configText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[5] }) Blank() RightArrow() } @@ -119,10 +120,10 @@ export struct ProductConfig { Scroll() { Row() { ConfigTipIcon() - ConfigTipText({ tipText: DetailConstants.PRODUCT_CONFIG_NAMES[6] }) + ConfigTipText({ tipText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[6] }) .margin({ right: $r('app.float.products_config_margin_12') }) ConfigTipIcon() - ConfigTipText({ tipText: DetailConstants.PRODUCT_CONFIG_NAMES[7] }) + ConfigTipText({ tipText: DetailConstants.PRODUCT_CONFIG_NAMES(this.context)[7] }) .layoutWeight(1) } .height(CommonConstants.FULL_PERCENT) @@ -153,6 +154,7 @@ export struct ProductConfig { export struct UserComments { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('isShowingSidebar') isShowingSidebar: boolean = false; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { @@ -160,7 +162,7 @@ export struct UserComments { CommentsTitle() .layoutWeight(1) Blank() - Text(DetailConstants.USER_COMMENT_NAMES[6]) + Text(DetailConstants.USER_COMMENT_NAMES(this.context)[6]) .fontSize($r('app.float.all_comments_font')) .lineHeight($r('app.float.all_comments_line')) .fontWeight(FontWeight.Normal) @@ -184,9 +186,9 @@ export struct UserComments { Scroll() { Row() { - CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES[1] }) - CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES[2] }) - CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES[3] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[1] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[2] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[3] }) } } .align(Alignment.Start) @@ -211,6 +213,7 @@ export struct UserComments { @Component export struct AllComments { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + private context: Context = this.getUIContext().getHostContext()! build() { Scroll() { @@ -219,9 +222,9 @@ export struct AllComments { Scroll() { Row() { - CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES[1] }) - CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES[2] }) - CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES[3] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[1] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[2] }) + CommentsTag({ tagText: DetailConstants.USER_COMMENT_NAMES(this.context)[3] }) } } .align(Alignment.Start) diff --git a/features/detail/src/main/ets/view/ProductDetail.ets b/features/detail/src/main/ets/view/ProductDetail.ets index 651345f39383153c2694a72ab4774588b7063f02..3134644024dac98bc83e9b3a413d233d2c87c8cd 100644 --- a/features/detail/src/main/ets/view/ProductDetail.ets +++ b/features/detail/src/main/ets/view/ProductDetail.ets @@ -31,8 +31,9 @@ export struct ProductPicture { @Prop pageBreakpoint: string; @Link isMoreLiveDetail: boolean; @Consume('pageInfos') pageInfos: NavPathStack; + private context: Context = this.getUIContext().getHostContext()! private pipWindowUtil: PipWindowUtil | undefined = PipWindowUtil.getPipWindowUtil(); - private abilityName: string = (getContext(this) as common.UIAbilityContext).abilityInfo.name; + private abilityName: string = (this.context as common.UIAbilityContext).abilityInfo.name; @Builder PictureIndicator(text: string) { @@ -83,11 +84,14 @@ export struct ProductPicture { .visibility(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) Blank() + // [Start product_detail] Image(this.isSplitMode ? $r('app.media.icon_split') : $r('app.media.ic_mate_pad_2')) + // [StartExclude product_detail] .height(ResourceUtil.getCommonImgSize()[1]) .width(ResourceUtil.getCommonImgSize()[1]) .margin({ right: this.pageBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.picture_icon_margin_sm') : $r('app.float.picture_icon_margin') }) + // [EndExclude product_detail] .onClick(() => { if (deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0]) { return; @@ -98,11 +102,12 @@ export struct ProductPicture { abilityName: 'SecondAbility' }; let option: StartOptions = { windowMode: AbilityConstant.WindowMode.WINDOW_MODE_SPLIT_PRIMARY }; - (getContext(this) as common.UIAbilityContext).startAbility(want, option); + (this.context as common.UIAbilityContext).startAbility(want, option); } else { - (getContext(this) as common.UIAbilityContext).terminateSelf(); + (this.context as common.UIAbilityContext).terminateSelf(); } }) + // [End product_detail] .visibility(this.pageBreakpoint === BreakpointConstants.BREAKPOINT_MD || this.isSplitMode ? Visibility.Visible : Visibility.None) Image($r('app.media.ic_more')) @@ -123,7 +128,7 @@ export struct ProductPicture { .width(ResourceUtil.getCommonImgSize()[0]) .height(ResourceUtil.getCommonImgSize()[0]) .borderRadius(ResourceUtil.getCommonBorderRadius()[4]) - Text(DetailConstants.LIVING) + Text(DetailConstants.LIVING(this.context)) .fontSize($r('app.float.picture_live_font')) .lineHeight($r('app.float.picture_live_line')) .fontWeight(FontWeight.Normal) @@ -170,7 +175,7 @@ export struct ProductPicture { Row() { Column() { - Text(JSON.stringify(this.currentSwiperIndex + 1) + DetailConstants.PICTURE_INDICATOR[0]) + Text(JSON.stringify(this.currentSwiperIndex + 1) + DetailConstants.PICTURE_INDICATOR(this.context)[0]) .fontSize($r('app.float.picture_number_font')) .fontWeight(FontWeight.Normal) .fontColor(Color.White) @@ -186,12 +191,12 @@ export struct ProductPicture { .padding({ right: ResourceUtil.getPageColPadding().getValue(this.currentBreakpoint) }) Row() { - this.PictureIndicator(DetailConstants.PICTURE_INDICATOR[1]) + this.PictureIndicator(DetailConstants.PICTURE_INDICATOR(this.context)[1]) Image(ResourceUtil.getArrowRight()) .width($r('app.float.picture_arrow_width')) .height($r('app.float.picture_arrow_height')) .margin({ right: $r('app.float.picture_arrow_margin') }) - this.PictureIndicator(DetailConstants.PICTURE_INDICATOR[2]) + this.PictureIndicator(DetailConstants.PICTURE_INDICATOR(this.context)[2]) Image(ResourceUtil.getArrowRight()) .width($r('app.float.picture_arrow_width')) .height($r('app.float.picture_arrow_height')) diff --git a/features/detail/src/main/ets/view/ProductDiscount.ets b/features/detail/src/main/ets/view/ProductDiscount.ets index dc6cbc0c9c8821e335d35bb5a23db6b38f870344..e16dea90ec6f9079a9fa23657ec287b032e1cf72 100644 --- a/features/detail/src/main/ets/view/ProductDiscount.ets +++ b/features/detail/src/main/ets/view/ProductDiscount.ets @@ -20,27 +20,28 @@ import { RightArrow } from './CommonView'; @Component export struct ProductDiscount { @Prop pageBreakpoint: string; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { - Text(DetailConstants.PRODUCT_DISCOUNT_NAMES[0]) + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[0]) .fontSize($r('app.float.discount_text_font_1')) .lineHeight($r('app.float.discount_text_line')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .margin({ bottom: $r('app.float.discount_text_margin_1') }) - Text(DetailConstants.PRODUCT_DISCOUNT_NAMES[1]) + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[1]) .fontSize($r('app.float.discount_text_font_2')) .fontColor($r('app.color.products_info_text')) .lineHeight($r('app.float.discount_text_line')) .fontWeight(FontWeight.Normal) .margin({ bottom: $r('app.float.discount_text_margin_2') }) Row() { - Text(DetailConstants.PRODUCT_DISCOUNT_NAMES[2]) + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[2]) .fontSize($r('app.float.discount_text_font_2')) .fontColor($r('app.color.products_info_text')) .fontWeight(FontWeight.Normal) .margin({ right: $r('app.float.discount_text_margin_3') }) - Text(DetailConstants.PRODUCT_DISCOUNT_NAMES[3]) + Text(DetailConstants.PRODUCT_DISCOUNT_NAMES(this.context)[3]) .layoutWeight(1) .fontSize($r('app.float.discount_text_font_2')) .fontWeight(FontWeight.Normal) diff --git a/features/detail/src/main/ets/view/ProductHome.ets b/features/detail/src/main/ets/view/ProductHome.ets index 20049dacb3c60b5cce3e98815ef9112c109f98ad..c3eb26c9a597c1c7a67d48d2d319ec1a190e6029 100644 --- a/features/detail/src/main/ets/view/ProductHome.ets +++ b/features/detail/src/main/ets/view/ProductHome.ets @@ -48,9 +48,11 @@ export struct ProductHome { build() { NavDestination() { + // [Start product_side_bar_container] SideBarContainer() { Column() { Image($r('app.media.icon_close_4')) + // [StartExclude product_side_bar_container_1] .width(ResourceUtil.getCommonImgSize()[1]) .height(ResourceUtil.getCommonImgSize()[1]) .onClick(() => { @@ -62,6 +64,7 @@ export struct ProductHome { top: $r('app.float.detail_lg_top_row_margin'), bottom: $r('app.float.detail_lg_top_row_margin') }) + // [EndExclude product_side_bar_container_1] AllComments() } .alignItems(HorizontalAlign.End) @@ -73,6 +76,7 @@ export struct ProductHome { }) Row() { + // [StartExclude product_side_bar_container_2] if (this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG) { Column() { Scroll() { @@ -114,9 +118,9 @@ export struct ProductHome { abilityName: 'SecondAbility' }; let option: StartOptions = { windowMode: AbilityConstant.WindowMode.WINDOW_MODE_SPLIT_PRIMARY }; - (getContext(this) as common.UIAbilityContext).startAbility(want, option); + (this.getUIContext().getHostContext() as common.UIAbilityContext).startAbility(want, option); } else { - (getContext(this) as common.UIAbilityContext).terminateSelf(); + (this.getUIContext().getHostContext() as common.UIAbilityContext).terminateSelf(); } }) DetailTopIcon({ imageResource: $r('app.media.ic_more') }) @@ -148,11 +152,14 @@ export struct ProductHome { .layoutWeight(1) .justifyContent(FlexAlign.Start) } + // [EndExclude product_side_bar_container_2] } + // [StartExclude product_side_bar_container_3] .alignItems(VerticalAlign.Top) .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) .layoutWeight(2) + // [EndExclude product_side_bar_container_3] } .showSideBar(this.isShowingSidebar) .showControlButton(false) @@ -161,9 +168,10 @@ export struct ProductHome { strokeWidth: $r('app.float.sidebar_divider_width'), color: ResourceUtil.getCommonDividerColor() }) - .minSideBarWidth(px2vp(this.windowWidth) / CommonConstants.THREE) - .maxSideBarWidth(px2vp(this.windowWidth) / CommonConstants.THREE) + .minSideBarWidth(this.getUIContext().px2vp(this.windowWidth) / CommonConstants.THREE) + .maxSideBarWidth(this.getUIContext().px2vp(this.windowWidth) / CommonConstants.THREE) .autoHide(false) + // [End product_side_bar_container] } .hideTitleBar(true) } diff --git a/features/detail/src/main/ets/view/ProductMoreDetail.ets b/features/detail/src/main/ets/view/ProductMoreDetail.ets index 9afa64a05818486b75beeab667ccd03c9199484c..944fb991e9c067e4e8352787cb5d0c324112adb6 100644 --- a/features/detail/src/main/ets/view/ProductMoreDetail.ets +++ b/features/detail/src/main/ets/view/ProductMoreDetail.ets @@ -48,8 +48,10 @@ export struct ProductMoreDetail { build() { NavDestination() { + // [Start product_more_detail_view] Row() { Column() { + // [StartExclude product_more_detail_view_1] Scroll() { Column() { ProductPicture({ @@ -69,6 +71,7 @@ export struct ProductMoreDetail { ProductUtilView({ isMoreDetail: $isMoreDetail, isShoppingBag: $isShoppingBag, isCustomerService: $isCustomerService }) + // [EndExclude product_more_detail_view_1] } .height(CommonConstants.FULL_PERCENT) // Setting the width ratio of offering details to side panel. @@ -88,11 +91,14 @@ export struct ProductMoreDetail { CustomerServiceView() } } + // [StartExclude product_more_detail_view_2] .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) .height(CommonConstants.FULL_PERCENT) + // [EndExclude product_more_detail_view_2] // Setting the width ratio of offering details to side panel. .layoutWeight(CommonConstants.THREE) } + // [End product_more_detail_view] .height(CommonConstants.FULL_PERCENT) .width(CommonConstants.FULL_PERCENT) } diff --git a/features/detail/src/main/ets/view/ProductPrice.ets b/features/detail/src/main/ets/view/ProductPrice.ets index de14e6d541c1bbc5ccc5aece7770299e50749c9b..e05b960c35277ab05622a527260c15c364b86cb4 100644 --- a/features/detail/src/main/ets/view/ProductPrice.ets +++ b/features/detail/src/main/ets/view/ProductPrice.ets @@ -20,23 +20,24 @@ import { RightArrow } from './CommonView'; @Component export struct ProductPrice { @Prop pageBreakpoint: string; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { Row() { - Text(DetailConstants.PRODUCT_PRICE_NAMES[0]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[0]) .fontSize($r('app.float.product_price_font_1')) .lineHeight($r('app.float.product_price_line_1')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .fontColor(Color.White) .displayPriority(4) - Text(DetailConstants.PRODUCT_PRICE_NAMES[1]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[1]) .fontSize($r('app.float.product_price_font_2')) .lineHeight($r('app.float.product_price_line_2')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .fontColor(Color.White) .displayPriority(4) - Text(DetailConstants.PRODUCT_PRICE_NAMES[2]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[2]) .decoration({ type: TextDecorationType.LineThrough, color: Color.White @@ -50,12 +51,12 @@ export struct ProductPrice { Blank() .displayPriority(2) Row() { - this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES[3]) - this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES[4]) - this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES[5]) - this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES[6]) - this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES[7]) - this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES[8]) + this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[3]) + this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[4]) + this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[5]) + this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[6]) + this.TimeTip(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[7]) + this.TimeText(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[8]) } .displayPriority(3) } @@ -75,7 +76,7 @@ export struct ProductPrice { }) Row() { - Text(DetailConstants.PRODUCT_PRICE_NAMES[9]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[9]) .fontSize($r('app.float.product_price_font_3')) .fontWeight(FontWeight.Normal) .lineHeight($r('app.float.product_price_line_3')) @@ -90,13 +91,13 @@ export struct ProductPrice { }) Row() { - this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES[10]) - this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES[11]) - this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES[12]) + this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[10]) + this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[11]) + this.ProductTag(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[12]) Blank() .displayPriority(2) Row() { - Text(DetailConstants.PRODUCT_PRICE_NAMES[13]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[13]) .fontColor(Color.White) .fontSize($r('app.float.product_price_font_3')) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -120,7 +121,7 @@ export struct ProductPrice { .margin({ right: $r('app.float.price_position_margin') }) Column() { Row() { - Text(DetailConstants.PRODUCT_PRICE_NAMES[14]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[14]) .fontSize($r('app.float.product_price_font_3')) .fontWeight(FontWeight.Normal) .lineHeight($r('app.float.product_price_line_3')) @@ -130,7 +131,7 @@ export struct ProductPrice { } .width(CommonConstants.FULL_PERCENT) - Text(DetailConstants.PRODUCT_PRICE_NAMES[15]) + Text(DetailConstants.PRODUCT_PRICE_NAMES(this.context)[15]) .fontSize($r('app.float.product_price_font_3')) .lineHeight($r('app.float.product_price_line_3')) .margin({ top: $r('app.float.price_position_margin') }) diff --git a/features/detail/src/main/ets/view/ProductUtilView.ets b/features/detail/src/main/ets/view/ProductUtilView.ets index 33b778bd6dee6cf3e2a3fc7399420919d3a9f451..885f2f421f362a1e5394944cee1d5a19a231b974 100644 --- a/features/detail/src/main/ets/view/ProductUtilView.ets +++ b/features/detail/src/main/ets/view/ProductUtilView.ets @@ -32,29 +32,36 @@ export struct ProductUtilView { @State detailType: string = CommonConstants.BIND_SHEET_PAGE_TYPES[3]; @Consume('pageInfos') pageInfos: NavPathStack; public isLivePage: boolean = false; + // [Start dialog_controller] private dialogController: CustomDialogController | null = new CustomDialogController({ builder: PayCardDialog(), customStyle: true }); + // [End dialog_controller] + private context: Context = this.getUIContext().getHostContext()! aboutToDisappear(): void { this.dialogController = null; } - + // [Start pay_card_builder] @Builder PayCardBuilder() { Column() { PayCard({ + // [StartExclude pay_card_builder_1] isOpen: $isDialogOpen, detailType: $detailType, currentBreakpoint: this.currentBreakpoint + // [EndExclude pay_card_builder_1] }) } + // [StartExclude pay_card_builder_2] .padding({ top: $r('app.float.util_pay_padding') }) .width(CommonConstants.FULL_PERCENT) .height(CommonConstants.FULL_PERCENT) + // [EndExclude pay_card_builder_2] } - + // [End pay_card_builder] build() { GridRow({ columns: { @@ -99,7 +106,7 @@ export struct ProductUtilView { }) Blank() .displayPriority(1) - Button(DetailConstants.BUTTON_NAMES[0]) + Button(DetailConstants.BUTTON_NAMES(this.context)[0]) .fontSize($r('app.float.util_button_font')) .fontColor($r('app.color.util_button_2')) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -110,7 +117,9 @@ export struct ProductUtilView { .backgroundColor($r('app.color.util_button_1')) .margin({ right: $r('app.float.util_button_margin') }) .displayPriority(2) - Button(DetailConstants.BUTTON_NAMES[1]) + // [Start dialog_btn] + Button(DetailConstants.BUTTON_NAMES(this.context)[1]) + // [StartExclude dialog_btn] .fontSize($r('app.float.util_button_font')) .fontColor(Color.White) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -119,6 +128,7 @@ export struct ProductUtilView { .borderRadius(ResourceUtil.getCommonBorderRadius()[7]) .backgroundColor($r('app.color.util_button_2')) .displayPriority(4) + // [EndExclude dialog_btn] .bindSheet($$this.isDialogOpen, this.PayCardBuilder(), { height: $r('app.float.pay_bind_sheet_height'), @@ -143,6 +153,7 @@ export struct ProductUtilView { this.isDialogOpen = false; } }) + // [End dialog_btn] } .backgroundColor($r('app.color.products_info')) .height(deviceInfo.deviceType === CommonConstants.DEVICE_TYPES[0] ? CommonConstants.TAB_BAR_HEIGHT : @@ -172,32 +183,38 @@ export struct ProductUtilView { }) } } - +// [Start pay_card_dialog] @CustomDialog struct PayCardDialog { + // [StartExclude pay_card_dialog_1] @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @State isDialogOpen: boolean = false; @State detailType: string = CommonConstants.BIND_SHEET_PAGE_TYPES[3]; private dialogController?: CustomDialogController; + // [EndExclude pay_card_dialog_1] build() { Column() { PayCard({ + // [StartExclude pay_card_dialog_2] isOpen: $isDialogOpen, detailType: $detailType, currentBreakpoint: this.currentBreakpoint, dialogController: this.dialogController + // [EndExclude pay_card_dialog_2] }) } + // [StartExclude pay_card_dialog_3] .backgroundColor(ResourceUtil.getCommonBackgroundColor()[0]) .padding({ top: $r('app.float.pay_dialog_padding') }) .width(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? $r('app.float.pay_dialog_width_lg') : $r('app.float.pay_dialog_width')) .height(DetailConstants.EIGHTY_PERCENT) .borderRadius(ResourceUtil.getCommonBorderRadius()[8]) + // [EndExclude pay_card_dialog_3] } } - +// [End pay_card_dialog] export class NavParams { viewName: string = ''; diff --git a/features/detail/src/main/ets/view/ShopBag.ets b/features/detail/src/main/ets/view/ShopBag.ets index dc3f9ee612aafffd17c25711c5a99647ff2d9706..23aff6d3a0b6ad231a3795fbd4bd815515498019 100644 --- a/features/detail/src/main/ets/view/ShopBag.ets +++ b/features/detail/src/main/ets/view/ShopBag.ets @@ -27,6 +27,7 @@ export struct ShopBag { @Builder payCardBuilder() {}; @BuilderParam PayCardButton: () => void = this.payCardBuilder; private scroller: Scroller = new Scroller(); + private context: Context = this.getUIContext().getHostContext()! @Builder tabBuilder(title: string, targetIndex: number) { @@ -48,7 +49,7 @@ export struct ShopBag { Column() { ShopBagHeader({ isMoreDetail: this.isMoreDetail }) Tabs({ barPosition: BarPosition.Start }) { - ForEach(LiveConstants.SHOP_CAR_TABS, (item: string, index: number) => { + ForEach(LiveConstants.SHOP_CAR_TABS(this.context), (item: string, index: number) => { TabContent() { Scroll(this.scroller) { ShopList({ PayCardButton: this.PayCardButton }) diff --git a/features/detail/src/main/ets/view/ShopBagHeader.ets b/features/detail/src/main/ets/view/ShopBagHeader.ets index 573a206dd0f3618db223051e58d49750b518f055..13ef2adbfb65c102ff09a9d5d7e0a255f32d93ea 100644 --- a/features/detail/src/main/ets/view/ShopBagHeader.ets +++ b/features/detail/src/main/ets/view/ShopBagHeader.ets @@ -18,7 +18,7 @@ import { ShopCarIcon, ShopCarModel } from '../viewmodel/ShopCarViewModel'; @Component export struct ShopBagHeader { - private shopCarIcons: ShopCarIcon[] = new ShopCarModel().getShopCarIconList(); + private shopCarIcons: ShopCarIcon[] = new ShopCarModel(this.getUIContext().getHostContext()!).getShopCarIconList(); @Link isMoreDetail: boolean; build() { diff --git a/features/detail/src/main/ets/view/ShopList.ets b/features/detail/src/main/ets/view/ShopList.ets index 254708a18657a457a65d750dc015322e7e6667b3..7a8f5565f0acbc1d5c4ed9e7ea8c75dfbf01cc39 100644 --- a/features/detail/src/main/ets/view/ShopList.ets +++ b/features/detail/src/main/ets/view/ShopList.ets @@ -22,7 +22,7 @@ export struct ShopList { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @Builder payCardBuilder() {}; @BuilderParam PayCardButton:() => void = this.payCardBuilder; - private shopCarProduct: ShopCarProduct[] = new ShopCarModel().getShopCarProductList(); + private shopCarProduct: ShopCarProduct[] = new ShopCarModel(this.getUIContext().getHostContext()!).getShopCarProductList(); build() { Column() { diff --git a/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets b/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets index ccb42a20f0e3529c13422be6ba43139e3a6328c0..167338f9d578bc9e4f29761eee0fd5cedbfda065 100644 --- a/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets +++ b/features/detail/src/main/ets/viewmodel/PayCardViewModel.ets @@ -18,10 +18,10 @@ import { DetailConstants } from '../constants/DetailConstants'; export class PayCardViewModel { private payCardSelectList: SelectProjectItem[] = []; - constructor(){ + constructor(context: Context) { let selectListTmp:SelectItem[][] = []; let selectListItemTmp:SelectItem[] = []; - DetailConstants.COLOR_SELECT_NAME_LIST.forEach((item: string, index: number) => { + DetailConstants.COLOR_SELECT_NAME_LIST(context).forEach((item: string, index: number) => { selectListItemTmp.push(new SelectItem(item, DetailConstants.COLOR_SELECT_IMAGE_LIST[index])); }) selectListTmp.push(selectListItemTmp); @@ -31,12 +31,12 @@ export class PayCardViewModel { }) selectListTmp.push(selectListItemTmp); selectListItemTmp = []; - DetailConstants.TYPE_SELECT_NAME_LIST.forEach((item: string)=>{ + DetailConstants.TYPE_SELECT_NAME_LIST(context).forEach((item: string)=>{ selectListItemTmp.push(new SelectItem(item, null)); }) selectListTmp.push(selectListItemTmp); selectListItemTmp = []; - DetailConstants.SELECT_NAME_LIST.forEach((item: string, index: number) =>{ + DetailConstants.SELECT_NAME_LIST(context).forEach((item: string, index: number) =>{ this.payCardSelectList.push(new SelectProjectItem(item, selectListTmp[index])); }) } diff --git a/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets b/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets index 85590daa1bbaed4c122a32b822712b6f5be644c8..cf1926e03bcfcfbcefac5cc38dff5ee47f745418 100644 --- a/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets +++ b/features/detail/src/main/ets/viewmodel/ShopCarViewModel.ets @@ -19,15 +19,16 @@ export class ShopCarModel { private shopCarProductList: ShopCarProduct[] = []; private shopCarIconList: ShopCarIcon[] = []; - constructor() { + constructor(context: Context) { LiveConstants.SHOP_CAR_PRODUCT_NAME_LIST.forEach((item: string, index: number) => { this.shopCarProductList.push(new ShopCarProduct(LiveConstants.SHOP_CAR_PRODUCT_IMAGE_LIST[index], item, - LiveConstants.SHOP_CAR_PRODUCT_REMARK_LIST[index], LiveConstants.SHOP_CAR_PRODUCT_DISCOUNTS_LIST[index], + LiveConstants.SHOP_CAR_PRODUCT_REMARK_LIST(context)[index], + LiveConstants.SHOP_CAR_PRODUCT_DISCOUNTS_LIST(context)[index], LiveConstants.SHOP_CAR_PRODUCT_PRICE_LIST[index])); }); LiveConstants.SHOP_CAR_ICON_RESOURCES.forEach((item: Resource, index: number) => { - this.shopCarIconList.push(new ShopCarIcon(item, LiveConstants.SHOP_CAR_ICON_NAMES[index])); + this.shopCarIconList.push(new ShopCarIcon(item, LiveConstants.SHOP_CAR_ICON_NAMES(context)[index])); }); } @@ -47,7 +48,7 @@ export class ShopCarProduct { private discounts: string[]; private price: number; - constructor(image: Resource, name: string, remark:string, discounts:string[], price: number) { + constructor(image: Resource, name: string, remark: string, discounts: string[], price: number) { this.name = name; this.image = image; this.remark = remark; @@ -67,11 +68,11 @@ export class ShopCarProduct { return this.price; } - getRemark(): string{ + getRemark(): string { return this.remark; } - getDiscounts(): string[]{ + getDiscounts(): string[] { return this.discounts; } } diff --git a/features/home/src/main/ets/constants/ClassifyConstants.ets b/features/home/src/main/ets/constants/ClassifyConstants.ets index b92778c44d362bcaa6724c56916f561b326540a0..3000ccacc0c7d35012fc8bc4e58db8fb068d2df8 100644 --- a/features/home/src/main/ets/constants/ClassifyConstants.ets +++ b/features/home/src/main/ets/constants/ClassifyConstants.ets @@ -17,23 +17,22 @@ export class ClassifyConstants { /** * Navigation list. */ - static readonly NAV_ROUTER_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST4')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST5')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST6')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST7')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST8')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST9')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST10')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST11')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST12')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST13')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST14')), - getContext(this).resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST15'))]; - + static readonly NAV_ROUTER_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST1')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST2')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST3')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST4')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST5')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST6')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST7')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST8')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST9')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST10')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST11')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST12')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST13')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST14')), + context.resourceManager.getStringSync($r('app.string.NAV_ROUTER_LIST15'))]; /** * Shop Matrix. */ @@ -42,15 +41,13 @@ export class ClassifyConstants { ['Mate 60 Pro+', 'Mate 60', 'Mate 60 Pro', 'Mate X5', 'Mate X3', 'Mate 50', 'Mate 50 Pro', 'Mate Xs 2', 'Mate 50E', 'Mate 50 RS'], ['P60 ', 'P60 Pro', 'P60 Art ', 'P50 Pro', 'P50E', 'P50 Pocket']]; - /** * Shop title list. */ - static readonly SHOP_TITLE_LIST: Array = [ - getContext(this).resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST3'))]; - + static readonly SHOP_TITLE_LIST = (context: Context): Array => [ + context.resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST1')), + context.resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST2')), + context.resourceManager.getStringSync($r('app.string.SHOP_TITLE_LIST3'))]; /** * Shop matrix image. */ @@ -63,44 +60,36 @@ export class ClassifyConstants { $r('app.media.classify_product_10')], [$r('app.media.classify_product_11'), $r('app.media.classify_product_12'), $r('app.media.classify_product_13'), $r('app.media.classify_product_14'), $r('app.media.classify_product_15'), $r('app.media.classify_product_16')]]; - /** * Banner images. */ static readonly BANNER_IMAGE: Array = [$r('app.media.classify_banner1'), $r('app.media.classify_banner2'), $r('app.media.classify_banner3')]; - /** * Banner image scale. */ static readonly BANNER_IMAGE_RATIO: number = 2.32; - /** * Number of pictures displayed in the banner. */ static readonly SWIPER_DISPLAY_COUNT: number[] = [1, 2, 3]; - /** * Interval of swiper. */ static readonly SWIPER_ITEM_SPACE: number[] = [0, 12, 16]; - /** * Interval of swiper. */ static readonly SWIPER_DIVIDER_WIDTH: string = '2vp'; - /** * Input prompt. */ - static readonly INPUT_PROMPT_STRING: string = - getContext(this).resourceManager.getStringSync($r('app.string.search')); - + static readonly INPUT_PROMPT_STRING = + (context: Context): string => context.resourceManager.getStringSync($r('app.string.search')); /** * Grid row gutters. */ static readonly GRID_ROW_GUTTERS: number[] = [24, 8, 16, 12]; - /** * Page info list. */ diff --git a/features/home/src/main/ets/constants/HomeConstants.ets b/features/home/src/main/ets/constants/HomeConstants.ets index bd01d84ec88aa0ccfe1e61e134a0b14c55cfb3d7..91ff629425b6588adb5fabb75ceeec177cdb40e6 100644 --- a/features/home/src/main/ets/constants/HomeConstants.ets +++ b/features/home/src/main/ets/constants/HomeConstants.ets @@ -17,12 +17,12 @@ export class HomeConstants { /** * Footer tab topics. */ - static readonly FOOTER_TOPIC_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST4')), - getContext(this).resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST5'))]; + static readonly FOOTER_TOPIC_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST1')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST2')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST3')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST4')), + context.resourceManager.getStringSync($r('app.string.FOOTER_TOPIC_LIST5'))]; /** * Footer topic icons. */ @@ -37,16 +37,16 @@ export class HomeConstants { /** * Top bar text list. */ - static readonly TOP_BAR_TEXTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS2')), - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS3')), - getContext(this).resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS4'))]; + static readonly TOP_BAR_TEXTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS1')), + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS2')), + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS3')), + context.resourceManager.getStringSync($r('app.string.TOP_BAR_TEXTS4'))]; /** * Search placeholder. */ - static readonly SEARCH_PLACEHOLDER: string = - getContext(this).resourceManager.getStringSync($r('app.string.searching')); + static readonly SEARCH_PLACEHOLDER = (context: Context): string => + context.resourceManager.getStringSync($r('app.string.searching')); /** * Recommended product list. */ @@ -60,17 +60,17 @@ export class HomeConstants { /** * Good categories. */ - static readonly GOOD_CATEGORIES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES1')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES2')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES3')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES4')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES5')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES6')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES7')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES8')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES9')), - getContext(this).resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES10'))]; + static readonly GOOD_CATEGORIES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES1')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES2')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES3')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES4')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES5')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES6')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES7')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES8')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES9')), + context.resourceManager.getStringSync($r('app.string.GOOD_CATEGORIES10'))]; /** * Good category images. */ @@ -112,28 +112,28 @@ export class HomeConstants { /** * Price unit. */ - static readonly PRICE_UNIT: string[] = ['¥', - getContext(this).resourceManager.getStringSync($r('app.string.PRICE_UNIT'))]; + static readonly PRICE_UNIT = (context: Context): string[] => ['¥', + context.resourceManager.getStringSync($r('app.string.PRICE_UNIT'))]; /** * Home title list. */ - static readonly HOME_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.HOME_TITLES1')), - getContext(this).resourceManager.getStringSync($r('app.string.HOME_TITLES2')), - getContext(this).resourceManager.getStringSync($r('app.string.HOME_TITLES3'))]; + static readonly HOME_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.HOME_TITLES1')), + context.resourceManager.getStringSync($r('app.string.HOME_TITLES2')), + context.resourceManager.getStringSync($r('app.string.HOME_TITLES3'))]; /** * Home button text list. */ - static readonly BUTTON_TEXTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.BUTTON_TEXTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.BUTTON_TEXTS2'))]; + static readonly BUTTON_TEXTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.BUTTON_TEXTS1')), + context.resourceManager.getStringSync($r('app.string.BUTTON_TEXTS2'))]; /** * Welfare tip text. */ - static readonly TIP_TEXTS: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.TIP_TEXTS1')), - getContext(this).resourceManager.getStringSync($r('app.string.TIP_TEXTS2')), - getContext(this).resourceManager.getStringSync($r('app.string.TIP_TEXTS3'))]; + static readonly TIP_TEXTS = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.TIP_TEXTS1')), + context.resourceManager.getStringSync($r('app.string.TIP_TEXTS2')), + context.resourceManager.getStringSync($r('app.string.TIP_TEXTS3'))]; /** * Gradient color list. */ @@ -147,18 +147,18 @@ export class HomeConstants { /** * Section products title list. */ - static readonly SECTION_PRODUCTS_TITLES: string[][] = [ - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES1'))], + static readonly SECTION_PRODUCTS_TITLES = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES1'))], ['HUAWEI Mate 50', - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES2'))], + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_TITLES2'))], ['Sound X NEW'], ['HUAWEI MatePad Air'], ['HUAWEI MateBook 14s']]; /** * Section products info list. */ - static readonly SECTION_PRODUCTS_INFO: string[] = ['', - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), '', - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO2')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO3'))]; + static readonly SECTION_PRODUCTS_INFO = (context: Context): string[] => ['', + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), '', + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO2')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO3'))]; /** * Section products price list. */ @@ -166,17 +166,17 @@ export class HomeConstants { /** * Section products feature list. */ - static readonly SECTION_PRODUCTS_FEATURES: string[][] = [ - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES1'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES2'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES3'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES4'))], - [getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES5'))]]; + static readonly SECTION_PRODUCTS_FEATURES = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES1'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES2'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES3'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES4'))], + [context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_FEATURES5'))]]; /** * Section products comment list. */ - static readonly SECTION_PRODUCTS_COMMENTS: string = - getContext(this).resourceManager.getStringSync($r('app.string.HOME_REVIEW')); + static readonly SECTION_PRODUCTS_COMMENTS = (context: Context): string => + context.resourceManager.getStringSync($r('app.string.HOME_REVIEW')); /** * Welfare grid column gutter list. */ @@ -194,34 +194,34 @@ export class HomeConstants { /** * Flash sale product title list. */ - static readonly FLASH_SALE_PRODUCT_TITLES: string[][] = [['HUAWEI Mate 50'], ['Mate Xs 2'], + static readonly FLASH_SALE_PRODUCT_TITLES = (context: Context): string[][] => [['HUAWEI Mate 50'], ['Mate Xs 2'], ['HUAWEI nova \u200B1\u200B0', - getContext(this).resourceManager.getStringSync($r('app.string.Hot_Seller'))], - ['MateBook E Go', getContext(this).resourceManager.getStringSync($r('app.string.New_Launch'))], - ['MateBook E Go', getContext(this).resourceManager.getStringSync($r('app.string.New_Launch'))], - ['MateBook E Go', getContext(this).resourceManager.getStringSync($r('app.string.New_Launch'))]]; + context.resourceManager.getStringSync($r('app.string.Hot_Seller'))], + ['MateBook E Go', context.resourceManager.getStringSync($r('app.string.New_Launch'))], + ['MateBook E Go', context.resourceManager.getStringSync($r('app.string.New_Launch'))], + ['MateBook E Go', context.resourceManager.getStringSync($r('app.string.New_Launch'))]]; /** * Flash sale product info list. */ - static readonly FLASH_SALE_PRODUCT_INFO: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO6')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO4')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), - getContext(this).resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), + static readonly FLASH_SALE_PRODUCT_INFO = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO1')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO6')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO4')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), + context.resourceManager.getStringSync($r('app.string.SECTION_PRODUCTS_INFO5')), ]; /** * Flash sale product feature list. */ - static readonly FLASH_SALE_PRODUCT_FEATURES: string[][] = [ - [getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES1')), - getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES2'))], - [getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES3'))], - [getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES4'))], - [getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))], - [getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))], - [getContext(this).resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))]]; + static readonly FLASH_SALE_PRODUCT_FEATURES = (context: Context): string[][] => [ + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES1')), + context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES2'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES3'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES4'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))], + [context.resourceManager.getStringSync($r('app.string.FLASH_SALE_PRODUCT_FEATURES5'))]]; /** * Flash sale product price list. */ diff --git a/features/home/src/main/ets/constants/ShoppingBagConstants.ets b/features/home/src/main/ets/constants/ShoppingBagConstants.ets index 60400af4aae3d188b1245b8de6177a47021ff56c..31cce83705e22c74b21470d25a6c1905074790ab 100644 --- a/features/home/src/main/ets/constants/ShoppingBagConstants.ets +++ b/features/home/src/main/ets/constants/ShoppingBagConstants.ets @@ -12,25 +12,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { Context } from "@kit.AbilityKit"; export class ShoppingBagConstants { /** * Product names. */ - static readonly PRODUCT_NAME_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST2')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST1')) + static readonly PRODUCT_NAME_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_NAME_LIST1')) ]; /** * Product types. */ - static readonly PRODUCT_TYPE_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIS2')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST1')) + static readonly PRODUCT_TYPE_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIS2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_TYPE_LIST1')) ]; /** * Product images. @@ -40,15 +41,15 @@ export class ShoppingBagConstants { /** * Product preferential list. */ - static readonly PRODUCT_PREFERENTIALList_LIST: Array> = [ - [getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE2'))], - [getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE4'))], - [getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE4'))], - [getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE2'))]]; + static readonly PRODUCT_PREFERENTIALList_LIST = (context: Context): Array> => [ + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE2'))], + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE4'))], + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE4'))], + [context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PREFERENTIALList_LIST_MESSAGE2'))]]; /** * Product price list. */ @@ -60,30 +61,30 @@ export class ShoppingBagConstants { /** * Product present list. */ - static readonly PRODUCT_PRESENT_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE1')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE2')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE3')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE1')) + static readonly PRODUCT_PRESENT_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE2')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE3')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_PRESENT_LIST_MESSAGE1')) ]; /** * Product service list. */ - static readonly PRODUCT_SERVICE_LIST: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), - getContext(this).resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')) + static readonly PRODUCT_SERVICE_LIST = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')), + context.resourceManager.getStringSync($r('app.string.PRODUCT_SERVICE_LIST_message')) ]; /** * Preference details title. */ - static readonly PREFERENCE_DETAILS_TITLE: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE1')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE12')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE2')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE3')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE4')) + static readonly PREFERENCE_DETAILS_TITLE = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE12')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE2')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE3')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE4')) ]; /** * Preference details price. @@ -96,35 +97,35 @@ export class ShoppingBagConstants { /** * Shopping bag titles. */ - static readonly SHOPPING_BAG_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES1')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES2')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES3'))]; + static readonly SHOPPING_BAG_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES1')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES2')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_BAG_TITLES3'))]; /** * Shopping discount title list. */ - static readonly SHOPPING_DISCOUNT_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE5')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE6')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE7')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE8')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE1')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE9')) + static readonly SHOPPING_DISCOUNT_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE5')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE6')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE7')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE8')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE1')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE9')) ]; /** * Shopping card foot title list. */ - static readonly SHOPPING_CARD_FOOT_TITLES: string[] = [ - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES1')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES2')), + static readonly SHOPPING_CARD_FOOT_TITLES = (context: Context): string[] => [ + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES1')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES2')), '¥', '1299', - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES3')), - getContext(this).resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES4'))]; + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES3')), + context.resourceManager.getStringSync($r('app.string.SHOPPING_CARD_FOOT_TITLES4'))]; /** * Shopping card name list. */ - static readonly SHOPPING_CARD_NAMES: string[] = ['¥', '-', '1', '+', - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE10')), - getContext(this).resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE11')), + static readonly SHOPPING_CARD_NAMES = (context: Context): string[] => ['¥', '-', '1', '+', + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE10')), + context.resourceManager.getStringSync($r('app.string.PREFERENCE_DETAILS_TITLE_MESSAGE11')), ]; } \ No newline at end of file diff --git a/features/home/src/main/ets/view/Categories.ets b/features/home/src/main/ets/view/Categories.ets index 470ca1600cd869c0b64626dd659463152c5331f4..31cd13effcbd09b3c463062a87b52a5aef89d3d0 100644 --- a/features/home/src/main/ets/view/Categories.ets +++ b/features/home/src/main/ets/view/Categories.ets @@ -21,7 +21,8 @@ import { IconInfo, IconInfoViewModel } from '../viewmodel/IconInfoViewModel'; export struct Categories { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @State isNextCategory: boolean = false; - private categoryIcons: IconInfo[] = new IconInfoViewModel().getCategoryList(); + private context: Context = this.getUIContext().getHostContext()! + private categoryIcons: IconInfo[] = new IconInfoViewModel(this.context).getCategoryList(); build() { Column() { diff --git a/features/home/src/main/ets/view/ClassifyContent.ets b/features/home/src/main/ets/view/ClassifyContent.ets index 81724cb220b3bb7c0d2dd7252bc6e2925580fd76..9f924c3747b76268b6995ce1814c8b73b8685a0e 100644 --- a/features/home/src/main/ets/view/ClassifyContent.ets +++ b/features/home/src/main/ets/view/ClassifyContent.ets @@ -24,10 +24,11 @@ export struct ClassifyContent { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @Provide('pageInfo') pageInfo: NavPathStack = new NavPathStack(); @State currentClassifyIndex: number = 0; + private context: Context = this.getUIContext().getHostContext()! @Builder PageMap(name: string) { - if (name === ClassifyConstants.NAV_ROUTER_LIST[0]) { + if (name === ClassifyConstants.NAV_ROUTER_LIST(this.context)[0]) { ClassifyNavDestination({ name: name }) } else { NavDestination() @@ -36,16 +37,17 @@ export struct ClassifyContent { } aboutToAppear(): void { - this.pageInfo.pushPath({ name: ClassifyConstants.NAV_ROUTER_LIST[0] }, false); + this.pageInfo.pushPath({ name: ClassifyConstants.NAV_ROUTER_LIST(this.context)[0] }, false); } build() { Column() { ClassifyHeader() - + // [Start navigation_mode_split] Navigation(this.pageInfo) { + // [StartExclude navigation_mode_split] List() { - ForEach(ClassifyConstants.NAV_ROUTER_LIST, (item: string, index: number) => { + ForEach(ClassifyConstants.NAV_ROUTER_LIST(this.context), (item: string, index: number) => { ListItem() { Stack({ alignContent: Alignment.Start }) { Row() { @@ -83,6 +85,7 @@ export struct ClassifyContent { }, (item: string, index: number) => item + index) } .scrollBar(BarState.Off) + // [EndExclude navigation_mode_split] } .layoutWeight(1) // Setting the double column view of the navigation. @@ -97,6 +100,7 @@ export struct ClassifyContent { .getValue(this.currentBreakpoint), new BreakpointType($r('app.float.classify_navigation_bar_width_sm'), $r('app.float.classify_navigation_bar_width_md'), $r('app.float.classify_navigation_bar_width_lg')) .getValue(this.currentBreakpoint)]) + // [End navigation_mode_split] .hideToolBar(true) .hideTitleBar(true) .navDestination(this.PageMap) diff --git a/features/home/src/main/ets/view/ClassifyHeader.ets b/features/home/src/main/ets/view/ClassifyHeader.ets index edba2967c1e248972a207cc584c31bc4355feb20..e71bafcd9ae6b9f947388032fd84d79c82263366 100644 --- a/features/home/src/main/ets/view/ClassifyHeader.ets +++ b/features/home/src/main/ets/view/ClassifyHeader.ets @@ -21,12 +21,13 @@ import { ClassifyConstants } from '../constants/ClassifyConstants'; export struct ClassifyHeader { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! build() { Row() { Row() { Stack({ alignContent: Alignment.Start }) { - TextInput({ placeholder: ClassifyConstants.INPUT_PROMPT_STRING }) + TextInput({ placeholder: ClassifyConstants.INPUT_PROMPT_STRING(this.context) }) .placeholderFont({ size: $r('app.float.classify_header_input_font_size'), weight: FontWeight.Normal diff --git a/features/home/src/main/ets/view/ClassifyShopList.ets b/features/home/src/main/ets/view/ClassifyShopList.ets index c587324a694e29d31fbae4637f8bea4d21479e4a..d0745e4eff0ebf00d67ffa605f178e4b28f633b0 100644 --- a/features/home/src/main/ets/view/ClassifyShopList.ets +++ b/features/home/src/main/ets/view/ClassifyShopList.ets @@ -21,7 +21,8 @@ import { ShopListViewModel, ShopListItem, ShopItem } from '../viewmodel/ShopList export struct ClassifyShopList { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @Consume('pageInfos') pageInfos: NavPathStack; - private shopList: ShopListViewModel = new ShopListViewModel(); + private context: Context = this.getUIContext().getHostContext()! + private shopList: ShopListViewModel = new ShopListViewModel(this.context); build() { List() { diff --git a/features/home/src/main/ets/view/CommonView.ets b/features/home/src/main/ets/view/CommonView.ets index 10c0db1f1708086a4ee2e9ff5a0057b3691b49ea..0648ac135e114410f5668c502b7e9223aa7c3bca 100644 --- a/features/home/src/main/ets/view/CommonView.ets +++ b/features/home/src/main/ets/view/CommonView.ets @@ -35,6 +35,7 @@ export struct HomeButton { @Component export struct TitleView { public titleText: string = ''; + private context: Context = this.getUIContext().getHostContext()! build() { Row() { @@ -45,7 +46,7 @@ export struct TitleView { Blank() - Text(HomeConstants.TIP_TEXTS[1]) + Text(HomeConstants.TIP_TEXTS(this.context)[1]) .fontSize($r('app.float.title_tip_font')) .lineHeight($r('app.float.title_tip_line')) .fontWeight(FontWeight.Normal) diff --git a/features/home/src/main/ets/view/FlashSale.ets b/features/home/src/main/ets/view/FlashSale.ets index 3706877af6ee65049c4423645f23f557600d8582..75694884f93db4c61f4b266b450e0e6cd0713cda 100644 --- a/features/home/src/main/ets/view/FlashSale.ets +++ b/features/home/src/main/ets/view/FlashSale.ets @@ -22,11 +22,12 @@ import { HomeButton, ProductFeature, ProductInfo, ProductPrice, ProductTitle, Ti export struct FlashSale { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('windowWidth') windowWidth: number = 0; - private flashSaleProductList: SectionProduct[] = new SectionProductsViewModel().getFlashSaleProductList(); + private context: Context = this.getUIContext().getHostContext()! + private flashSaleProductList: SectionProduct[] = new SectionProductsViewModel(this.context).getFlashSaleProductList(); build() { Column() { - TitleView({ titleText: HomeConstants.HOME_TITLES[2] }) + TitleView({ titleText: HomeConstants.HOME_TITLES(this.context)[2] }) GridRow({ columns: { @@ -59,7 +60,7 @@ export struct FlashSale { ProductFeature({ feature: item.getFeature() }) Blank() ProductPrice({ price: item.getPrice(), originalPrice: item.getOriginalPrice() }) - HomeButton({ buttonText: HomeConstants.BUTTON_TEXTS[1] }) + HomeButton({ buttonText: HomeConstants.BUTTON_TEXTS(this.context)[1] }) .margin({ top: $r('app.float.flash_button_top'), bottom: $r('app.float.flash_button_bottom'), @@ -103,7 +104,7 @@ export struct FlashSale { getImageHeight(currentBreakpoint: string, windowWidth: number): number { // Obtain the window width and subtract the blank parts on both sides. - let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], + let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[2], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[3]) .getValue(this.currentBreakpoint) * 2; if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { diff --git a/features/home/src/main/ets/view/Home.ets b/features/home/src/main/ets/view/Home.ets index 84a7968c3248eca4662093c43be46ca5e8392f73..3a88f1314a2e5653c522e628ee748902c72ac200 100644 --- a/features/home/src/main/ets/view/Home.ets +++ b/features/home/src/main/ets/view/Home.ets @@ -25,7 +25,8 @@ export struct Home { @State currentBottomIndex: number = 0; @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('topRectHeight') topRectHeight: number = 0; - private tabList: FooterTab[] = new FooterTabViewModel().getTabList(); + private context: Context = this.getUIContext().getHostContext()! + private tabList: FooterTab[] = new FooterTabViewModel(this.context).getTabList(); @Builder BottomTabBuilder(item: FooterTab, index: number) { diff --git a/features/home/src/main/ets/view/HomeHeader.ets b/features/home/src/main/ets/view/HomeHeader.ets index a9dc4aa168c8bd0d1be8a1f709905cfcd901939b..f138e4a08018f3b9f12a916b2607fa9eb23f0654 100644 --- a/features/home/src/main/ets/view/HomeHeader.ets +++ b/features/home/src/main/ets/view/HomeHeader.ets @@ -21,6 +21,7 @@ import { HomeConstants } from '../constants/HomeConstants'; export struct HomeHeader { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { @@ -69,7 +70,7 @@ export struct HomeHeader { TopTabBar() { List({ space: new BreakpointType(HomeConstants.HOME_HEADER_LIST_SPACES[0], HomeConstants.HOME_HEADER_LIST_SPACES[1], HomeConstants.HOME_HEADER_LIST_SPACES[2]).getValue(this.currentBreakpoint) }) { - ForEach(HomeConstants.TOP_BAR_TEXTS, (item: string, index: number) => { + ForEach(HomeConstants.TOP_BAR_TEXTS(this.context), (item: string, index: number) => { ListItem() { Text(item) .fontSize(index === 0 ? $r('app.float.top_bar_text_selected_font') : $r('app.float.top_bar_text_font')) @@ -96,7 +97,7 @@ export struct HomeHeader { SearchBar() { Row() { Stack({ alignContent: Alignment.Start }) { - TextInput({ placeholder: HomeConstants.SEARCH_PLACEHOLDER }) + TextInput({ placeholder: HomeConstants.SEARCH_PLACEHOLDER(this.context) }) .placeholderFont({ size: $r('app.float.search_input_font'), weight: FontWeight.Normal diff --git a/features/home/src/main/ets/view/RecommendedProductView.ets b/features/home/src/main/ets/view/RecommendedProductView.ets index e5b800293449d783d87bfe4ae1a57539e4b72673..c3d74581ef39bfef6402b32ad716e3524e328a93 100644 --- a/features/home/src/main/ets/view/RecommendedProductView.ets +++ b/features/home/src/main/ets/view/RecommendedProductView.ets @@ -71,7 +71,7 @@ export struct RecommendedProductView { getSwiperWidth(currentBreakpoint: string, windowWidth: number): string { // Obtain the window width and subtract the blank parts on both sides. - let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], + let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[2], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[3]) .getValue(this.currentBreakpoint); if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { diff --git a/features/home/src/main/ets/view/Selection.ets b/features/home/src/main/ets/view/Selection.ets index ccc657ba9b6e397fc378800334d846c770949c06..353d037455edf6b4f077ff31ef80cda6e0ffc243 100644 --- a/features/home/src/main/ets/view/Selection.ets +++ b/features/home/src/main/ets/view/Selection.ets @@ -22,11 +22,12 @@ import { ProductComments, ProductFeature, ProductInfo, ProductPrice, ProductTitl export struct Selection { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('windowWidth') windowWidth: number = 0; - private sectionProducts: SectionProduct[] = new SectionProductsViewModel().getSectionProductList(); + private context: Context = this.getUIContext().getHostContext()! + private sectionProducts: SectionProduct[] = new SectionProductsViewModel(this.context).getSectionProductList(); build() { Column() { - TitleView({ titleText: HomeConstants.HOME_TITLES[1] }) + TitleView({ titleText: HomeConstants.HOME_TITLES(this.context)[1] }) GridRow({ columns: { @@ -101,7 +102,7 @@ export struct Selection { getStackHeight(currentBreakpoint: string, windowWidth: number): string { // Obtain the window width and subtract the blank parts on both sides. - let result: number = px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], + let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[1], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[2], HomeConstants.RECOMMENDED_PRODUCT_VIEW_SPACES[3]) .getValue(this.currentBreakpoint) * 2; if (currentBreakpoint === BreakpointConstants.BREAKPOINT_LG) { diff --git a/features/home/src/main/ets/view/ShoppingBagContent.ets b/features/home/src/main/ets/view/ShoppingBagContent.ets index 12cdb74177c6fc6358905ad7085e999af2671ff5..e553e1546ed81073e15626540fbd20db899ef053 100644 --- a/features/home/src/main/ets/view/ShoppingBagContent.ets +++ b/features/home/src/main/ets/view/ShoppingBagContent.ets @@ -40,18 +40,19 @@ export struct ShoppingBagContent { struct ShoppingBagView { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('topRectHeight') topRectHeight: number = 0; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { Column() { Row() { - Text(ShoppingBagConstants.SHOPPING_BAG_TITLES[0]) + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[0]) .font({ size: $r('app.float.bag_title_font'), weight: CommonConstants.FONT_WEIGHT_500 }) Blank() - Text(ShoppingBagConstants.SHOPPING_BAG_TITLES[1]) + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[1]) .font({ size: $r('app.float.bag_name_font') }) @@ -89,6 +90,7 @@ export struct DetailShoppingBagView { @StorageLink('topRectHeight') topRectHeight: number = 0; @Consume('pageInfos') pageInfos: NavPathStack; public isMoreDetail: boolean = false; + private context: Context = this.getUIContext().getHostContext()! build() { Column() { @@ -105,13 +107,13 @@ export struct DetailShoppingBagView { this.pageInfos.pop(); } }) - Text(ShoppingBagConstants.SHOPPING_BAG_TITLES[0]) + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[0]) .font({ size: $r('app.float.bag_title_font'), weight: CommonConstants.FONT_WEIGHT_500 }) Blank() - Text(ShoppingBagConstants.SHOPPING_BAG_TITLES[1]) + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[1]) .font({ size: $r('app.float.bag_name_font') }) .opacity(CommonConstants.TEXT_OPACITY[2]) Image($r('app.media.icon_close')) @@ -157,7 +159,8 @@ export struct DetailShoppingBagView { @Component export struct ShoppingBagCard { - private ShoppingBagList: ShoppingBagProduct[] = new ShoppingBagListViewModel().getShoppingBagItemData(); + private context: Context = this.getUIContext().getHostContext()! + private ShoppingBagList: ShoppingBagProduct[] = new ShoppingBagListViewModel(this.context).getShoppingBagItemData(); build() { Scroll() { @@ -180,7 +183,7 @@ export struct ShoppingBagCard { color: ResourceUtil.getCommonBorderColor()[3] }) - Text(ShoppingBagConstants.SHOPPING_BAG_TITLES[2]) + Text(ShoppingBagConstants.SHOPPING_BAG_TITLES(this.context)[2]) .font({ size: $r('app.float.bag_name_font'), weight: CommonConstants.FONT_WEIGHT_500 diff --git a/features/home/src/main/ets/view/ShoppingBagDiscounts.ets b/features/home/src/main/ets/view/ShoppingBagDiscounts.ets index aee678e5a138c29920aaeaed2ac30c52c56d45f2..1b87e3cf4549b3987883927fedbf501fd331a7a0 100644 --- a/features/home/src/main/ets/view/ShoppingBagDiscounts.ets +++ b/features/home/src/main/ets/view/ShoppingBagDiscounts.ets @@ -25,19 +25,20 @@ import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; export struct ShoppingBagDiscounts { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageLink('topRectHeight') topRectHeight: number = 0; - private ShoppingBagList: ShoppingBagProduct[]= new ShoppingBagListViewModel().getShoppingBagItemData(); - private PreferenceDetailsList: PreferenceDetails[]= new PreferenceDetailsList().getPreferenceDetailsList(); + private context: Context = this.getUIContext().getHostContext()! + private ShoppingBagList: ShoppingBagProduct[]= new ShoppingBagListViewModel(this.context).getShoppingBagItemData(); + private PreferenceDetailsList: PreferenceDetails[]= new PreferenceDetailsList(this.context).getPreferenceDetailsList(); private ShoppingBagProductItem: ShoppingBagProduct = this.ShoppingBagList[2]; build() { Column() { Scroll() { Column() { - Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES[0]) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[0]) .fontSize($r('app.float.bag_discount_font_1')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .lineHeight($r('app.float.bag_discount_line_1')) - Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES[1]) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[1]) .fontSize($r('app.float.bag_discount_font_2')) .lineHeight($r('app.float.bag_discount_line_2')) .fontWeight(FontWeight.Normal) @@ -52,11 +53,11 @@ export struct ShoppingBagDiscounts { titleEllipsis: true }) Row() { - Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES[2]) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[2]) .fontSize($r('app.float.bag_discount_font_3')) .fontWeight(CommonConstants.FONT_WEIGHT_500) Blank() - Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES[3]) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[3]) .fontSize($r('app.float.bag_discount_font_2')) .fontWeight(FontWeight.Normal) } @@ -65,11 +66,11 @@ export struct ShoppingBagDiscounts { .justifyContent(FlexAlign.Center) Row() { - Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES[4]) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[4]) .fontSize($r('app.float.bag_discount_font_3')) .fontWeight(CommonConstants.FONT_WEIGHT_500) Blank() - Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES[5]) + Text(ShoppingBagConstants.SHOPPING_DISCOUNT_TITLES(this.context)[5]) .fontSize($r('app.float.bag_discount_font_2')) .fontWeight(FontWeight.Normal) Image($r('app.media.ic_public_more_list')) diff --git a/features/home/src/main/ets/view/ShoppingCardFoot.ets b/features/home/src/main/ets/view/ShoppingCardFoot.ets index 09cd6b9de3ecc952d22404b6d402b6817629f007..1c9fb1a2dbacef4290a2dc031236661e1f37d367 100644 --- a/features/home/src/main/ets/view/ShoppingCardFoot.ets +++ b/features/home/src/main/ets/view/ShoppingCardFoot.ets @@ -20,6 +20,7 @@ import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; export struct ShoppingCardFoot { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; public isMoreDetail: boolean = false; + private context: Context = this.getUIContext().getHostContext()! build() { Row(){ @@ -36,7 +37,7 @@ export struct ShoppingCardFoot { color: ResourceUtil.getCommonBorderColor()[2] }) .shape(CheckBoxShape.ROUNDED_SQUARE) - Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES[0]) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[0]) .fontSize($r('app.float.shop_card_font_1')) .lineHeight($r('app.float.shop_card_line_1')) .fontWeight(FontWeight.Normal) @@ -49,20 +50,20 @@ export struct ShoppingCardFoot { Row(){ Column(){ Row(){ - Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES[1]) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[1]) .fontSize($r('app.float.shop_card_font_1')) .lineHeight($r('app.float.shop_card_line_1')) - Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES[2]) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[2]) .fontSize($r('app.float.shop_card_font_1')) .lineHeight($r('app.float.shop_card_line_2')) .fontColor($r('app.color.shop_card_font_color')) - Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES[3]) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[3]) .fontSize($r('app.float.shop_card_font_2')) .lineHeight($r('app.float.shop_card_line_3')) .fontColor($r('app.color.shop_card_font_color')) } Row(){ - Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES[4]) + Text(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[4]) .fontSize($r('app.float.shop_card_font_3')) .lineHeight($r('app.float.shop_card_line_4')) .fontWeight(FontWeight.Normal) @@ -77,7 +78,8 @@ export struct ShoppingCardFoot { } } - Button(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES[5], { type: ButtonType.Capsule, stateEffect: true }) + Button(ShoppingBagConstants.SHOPPING_CARD_FOOT_TITLES(this.context)[5], + { type: ButtonType.Capsule, stateEffect: true }) .labelStyle({ font:{ size:$r('app.float.shop_card_font_2') diff --git a/features/home/src/main/ets/view/ShoppingCardItem.ets b/features/home/src/main/ets/view/ShoppingCardItem.ets index 88de4c93b8a9189f29d981f62f042a260dd8020e..820930fb7c6eb63424d1cfee6aaaa9ebd3d8505b 100644 --- a/features/home/src/main/ets/view/ShoppingCardItem.ets +++ b/features/home/src/main/ets/view/ShoppingCardItem.ets @@ -19,7 +19,8 @@ import { ShoppingBagListViewModel, ShoppingBagProduct } from '../viewmodel/Shopp @Component export struct ShoppingCardItem { - public shoppingBagProductItem: ShoppingBagProduct = new ShoppingBagListViewModel().getShoppingBagItemData()[2]; + private context: Context = this.getUIContext().getHostContext()! + public shoppingBagProductItem: ShoppingBagProduct = new ShoppingBagListViewModel(this.context).getShoppingBagItemData()[2]; public titleEllipsis?: boolean; build() { @@ -99,7 +100,7 @@ export struct ShoppingCardItem { wrap:FlexWrap.Wrap }) { Row() { - Text(ShoppingBagConstants.SHOPPING_CARD_NAMES[0]) + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[0]) .font({ size: $r('app.float.card_item_font_3'), weight: CommonConstants.FONT_WEIGHT_500 @@ -112,7 +113,7 @@ export struct ShoppingCardItem { .margin({ right: $r('app.float.card_price_margin') }) - Text(ShoppingBagConstants.SHOPPING_CARD_NAMES[0] + + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[0] + JSON.stringify(this.shoppingBagProductItem.getOriginalPrice())) .font({ size: $r('app.float.card_item_font_5'), @@ -130,8 +131,8 @@ export struct ShoppingCardItem { } Blank() Row() { - this.AddButton(ShoppingBagConstants.SHOPPING_CARD_NAMES[1]) - Text(ShoppingBagConstants.SHOPPING_CARD_NAMES[2]) + this.AddButton(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[1]) + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[2]) .fontSize($r('app.float.card_number_font')) .width($r('app.float.card_number_width')) .margin({ @@ -139,7 +140,7 @@ export struct ShoppingCardItem { right: $r('app.float.card_number_margin') }) .textAlign(TextAlign.Center) - this.AddButton(ShoppingBagConstants.SHOPPING_CARD_NAMES[3]) + this.AddButton(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[3]) } } .width(CommonConstants.FULL_PERCENT) @@ -154,7 +155,7 @@ export struct ShoppingCardItem { Column() { Row() { - Text(ShoppingBagConstants.SHOPPING_CARD_NAMES[4]) + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[4]) .fontSize($r('app.float.card_item_font_3')) .width($r('app.float.card_gift_width')) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -178,7 +179,7 @@ export struct ShoppingCardItem { }) Row() { - Text(ShoppingBagConstants.SHOPPING_CARD_NAMES[5]) + Text(ShoppingBagConstants.SHOPPING_CARD_NAMES(this.context)[5]) .fontSize($r('app.float.card_item_font_3')) .width($r('app.float.card_gift_width')) .fontWeight(CommonConstants.FONT_WEIGHT_500) diff --git a/features/home/src/main/ets/view/WelfareView.ets b/features/home/src/main/ets/view/WelfareView.ets index b6c1e73565f705bf33faf5752a4af8b851d0d763..91b03b3c2bac802dec7042e5cd872cc4e6aadde6 100644 --- a/features/home/src/main/ets/view/WelfareView.ets +++ b/features/home/src/main/ets/view/WelfareView.ets @@ -21,19 +21,20 @@ import { HomeButton } from './CommonView'; @Component export struct WelfareView { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; - private welfareList: IconInfo[] = new IconInfoViewModel().getWelfareList(); + private context: Context = this.getUIContext().getHostContext()! + private welfareList: IconInfo[] = new IconInfoViewModel(this.context).getWelfareList(); build() { Column() { Row() { - Text(HomeConstants.HOME_TITLES[0]) + Text(HomeConstants.HOME_TITLES(this.context)[0]) .fontSize($r('app.float.title_font')) .lineHeight($r('app.float.title_line')) .fontWeight(CommonConstants.FONT_WEIGHT_500) Blank() - HomeButton({ buttonText: HomeConstants.BUTTON_TEXTS[0] }) + HomeButton({ buttonText: HomeConstants.BUTTON_TEXTS(this.context)[0] }) } .justifyContent(FlexAlign.Start) .height($r('app.float.title_height')) @@ -47,7 +48,7 @@ export struct WelfareView { $r('app.float.welfare_image_size_sm') : $r('app.float.welfare_image_size')) .height(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? $r('app.float.welfare_image_size_sm') : $r('app.float.welfare_image_size')) - Text(HomeConstants.TIP_TEXTS[0]) + Text(HomeConstants.TIP_TEXTS(this.context)[0]) .fontSize($r('app.float.welfare_tip_font')) .fontWeight(FontWeight.Normal) .lineHeight($r('app.float.welfare_tip_line')) diff --git a/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets b/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets index df3e9377f0326098699f7ea323bf98622bdc2b5d..306952fd298ee98931b70b5484d2c07a9baba04e 100644 --- a/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets +++ b/features/home/src/main/ets/viewmodel/FooterTabViewModel.ets @@ -18,8 +18,8 @@ import { HomeConstants } from '../constants/HomeConstants'; export class FooterTabViewModel { private tabList: FooterTab[] = []; - constructor() { - HomeConstants.FOOTER_TOPIC_LIST.forEach((item: string, index: number) => { + constructor(context: Context) { + HomeConstants.FOOTER_TOPIC_LIST(context).forEach((item: string, index: number) => { this.tabList.push(new FooterTab(item, HomeConstants.FOOTER_TOPIC_ICONS[index], HomeConstants.FOOTER_TOPIC_ICONS_SELECTED[index])); }); diff --git a/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets b/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets index a65abd0226a2da2a66638564acc5916cb652539a..8896e74fcbb883621eceafebe44281df870d3622 100644 --- a/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets +++ b/features/home/src/main/ets/viewmodel/IconInfoViewModel.ets @@ -19,12 +19,12 @@ export class IconInfoViewModel { private categoryList: IconInfo[] = []; private welfareList: IconInfo[] = []; - constructor() { - HomeConstants.GOOD_CATEGORIES.forEach((item: string, index: number) => { + constructor(context: Context) { + HomeConstants.GOOD_CATEGORIES(context).forEach((item: string, index: number) => { this.categoryList.push(new IconInfo(item, HomeConstants.GOOD_CATEGORY_IMG[index])); }); HomeConstants.WELFARE_PRODUCTS.forEach((item: string, index: number) => { - this.welfareList.push(new IconInfo(this.makeUpPrice(item), HomeConstants.WELFARE_PRODUCT_IMG[index])); + this.welfareList.push(new IconInfo(this.makeUpPrice(item, context), HomeConstants.WELFARE_PRODUCT_IMG[index])); }); } @@ -32,8 +32,8 @@ export class IconInfoViewModel { return this.categoryList; } - makeUpPrice(price: string): string { - return HomeConstants.PRICE_UNIT[0] + price + HomeConstants.PRICE_UNIT[1]; + makeUpPrice(price: string, context: Context): string { + return HomeConstants.PRICE_UNIT(context)[0] + price + HomeConstants.PRICE_UNIT(context)[1]; } getWelfareList(): IconInfo[] { diff --git a/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets b/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets index 10af0c887bba74409149f5f2f97d66cc733d52a5..828eefac43c933b347c4486fe9f79fe49f182d18 100644 --- a/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets +++ b/features/home/src/main/ets/viewmodel/SectionProductsViewModel.ets @@ -19,16 +19,18 @@ export class SectionProductsViewModel { private sectionProductList: SectionProduct[] = []; private flashSaleProductList: SectionProduct[] = []; - constructor() { + constructor(context: Context) { HomeConstants.SECTION_PRODUCT_IMAGES.forEach((item: Resource, index: number) => { - this.sectionProductList.push(new SectionProduct(item, HomeConstants.SECTION_PRODUCTS_TITLES[index], - HomeConstants.SECTION_PRODUCTS_PRICES[index], HomeConstants.SECTION_PRODUCTS_FEATURES[index], - HomeConstants.SECTION_PRODUCTS_COMMENTS, HomeConstants.SECTION_PRODUCTS_INFO[index])); + this.sectionProductList.push(new SectionProduct(item, HomeConstants.SECTION_PRODUCTS_TITLES(context)[index], + HomeConstants.SECTION_PRODUCTS_PRICES[index], HomeConstants.SECTION_PRODUCTS_FEATURES(context)[index], + HomeConstants.SECTION_PRODUCTS_COMMENTS(context), HomeConstants.SECTION_PRODUCTS_INFO(context)[index])); }); HomeConstants.FLASH_SALE_PRODUCT_IMAGES.forEach((item: Resource, index: number) => { - this.flashSaleProductList.push(new SectionProduct(item, HomeConstants.FLASH_SALE_PRODUCT_TITLES[index], - HomeConstants.FLASH_SALE_PRODUCT_PRICES[index], HomeConstants.FLASH_SALE_PRODUCT_FEATURES[index], '', - HomeConstants.FLASH_SALE_PRODUCT_INFO[index], HomeConstants.FLASH_SALE_PRODUCT_ORIGINAL_PRICES[index])); + this.flashSaleProductList.push(new SectionProduct(item, HomeConstants.FLASH_SALE_PRODUCT_TITLES(context)[index], + HomeConstants.FLASH_SALE_PRODUCT_PRICES[index], + HomeConstants.FLASH_SALE_PRODUCT_FEATURES(context)[index], '', + HomeConstants.FLASH_SALE_PRODUCT_INFO(context)[index], + HomeConstants.FLASH_SALE_PRODUCT_ORIGINAL_PRICES[index])); }); } diff --git a/features/home/src/main/ets/viewmodel/ShopListViewModel.ets b/features/home/src/main/ets/viewmodel/ShopListViewModel.ets index 554f2f5ff7ba1d24f967440ccff2345f3a93e6e1..ba89328ece7f632b977fc801e239ad7cd519ae50 100644 --- a/features/home/src/main/ets/viewmodel/ShopListViewModel.ets +++ b/features/home/src/main/ets/viewmodel/ShopListViewModel.ets @@ -18,13 +18,13 @@ import { ClassifyConstants } from '../constants/ClassifyConstants'; export class ShopListViewModel { private shopList: Array = []; - constructor() { + constructor(context: Context) { ClassifyConstants.SHOP_MATRIX.forEach((item: Array, index: number) =>{ let shopItemList: Array = []; item.forEach((item: string, itemIndex: number) => { shopItemList.push(new ShopItem(item,ClassifyConstants.SHOP_MATRIX_IMAGE[index][itemIndex])); }) - this.shopList.push(new ShopListItem(ClassifyConstants.SHOP_TITLE_LIST[index], shopItemList)); + this.shopList.push(new ShopListItem(ClassifyConstants.SHOP_TITLE_LIST(context)[index], shopItemList)); }) } diff --git a/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets b/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets index 94191adb3d1194bca27783a3c6782e9cc67ab7df..50c5cb69a682f4621c90211d7cb1bf187efb6e9e 100644 --- a/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets +++ b/features/home/src/main/ets/viewmodel/ShoppingBagListViewModel.ets @@ -18,13 +18,16 @@ import { ShoppingBagConstants } from '../constants/ShoppingBagConstants'; export class ShoppingBagListViewModel { private ShoppingBagList: ShoppingBagProduct[] = []; - constructor() { - ShoppingBagConstants.PRODUCT_NAME_LIST.forEach((item: string, index: number) => { + constructor(context: Context) { + ShoppingBagConstants.PRODUCT_NAME_LIST(context).forEach((item: string, index: number) => { this.ShoppingBagList.push( - new ShoppingBagProduct(item, ShoppingBagConstants.PRODUCT_IMAGE_LIST[index], ShoppingBagConstants.PRODUCT_TYPE_LIST[index], - ShoppingBagConstants.PRODUCT_PREFERENTIALList_LIST[index], ShoppingBagConstants.PRODUCT_PRICE_LIST[index], - ShoppingBagConstants.PRODUCT_ORIGINAL_PRICE_LIST[index], ShoppingBagConstants.PRODUCT_PRESENT_LIST[index], - ShoppingBagConstants.PRODUCT_SERVICE_LIST[index])); + new ShoppingBagProduct(item, ShoppingBagConstants.PRODUCT_IMAGE_LIST[index], + ShoppingBagConstants.PRODUCT_TYPE_LIST(context)[index], + ShoppingBagConstants.PRODUCT_PREFERENTIALList_LIST(context)[index], + ShoppingBagConstants.PRODUCT_PRICE_LIST[index], + ShoppingBagConstants.PRODUCT_ORIGINAL_PRICE_LIST[index], + ShoppingBagConstants.PRODUCT_PRESENT_LIST(context)[index], + ShoppingBagConstants.PRODUCT_SERVICE_LIST(context)[index])); }) } @@ -91,8 +94,8 @@ export class ShoppingBagProduct { export class PreferenceDetailsList { private preferenceDetailsList: PreferenceDetails[] = []; - constructor() { - ShoppingBagConstants.PREFERENCE_DETAILS_TITLE.forEach((item, index) => { + constructor(context: Context) { + ShoppingBagConstants.PREFERENCE_DETAILS_TITLE(context).forEach((item, index) => { this.preferenceDetailsList.push(new PreferenceDetails(item, ShoppingBagConstants.PREFERENCE_DETAILS_PRICE[index])); }) } diff --git a/products/phone/src/main/ets/entryability/EntryAbility.ets b/products/phone/src/main/ets/entryability/EntryAbility.ets index b45999d587953df4f31e05c4177faa2e89a855bd..d0ff09dc03876f6bc104389ab476b07ed8ec2831 100644 --- a/products/phone/src/main/ets/entryability/EntryAbility.ets +++ b/products/phone/src/main/ets/entryability/EntryAbility.ets @@ -53,6 +53,8 @@ export default class EntryAbility extends UIAbility { this.windowObj.on('windowStatusChange', this.onWindowStatusChange); } }) + AppStorage.setOrCreate('uiContext', this.context); + console.log(JSON.stringify(this.context) + '555555555555') if (this.windowUtil !== undefined) { this.windowUtil.setWindowStage(windowStage); diff --git a/products/phone/src/main/ets/secondability/SecondAbility.ets b/products/phone/src/main/ets/secondability/SecondAbility.ets index b40b43f2d8fc58e5afd84f5639cff5051b60f4e0..fb4de71c22c5d3bcc7abb390c7b0841935076ec2 100644 --- a/products/phone/src/main/ets/secondability/SecondAbility.ets +++ b/products/phone/src/main/ets/secondability/SecondAbility.ets @@ -73,7 +73,7 @@ export default class SecondAbility extends UIAbility { if (canIUse('SystemCapability.Window.SessionManager')) { display.on(`foldStatusChange`, this.onFoldStatusChange); } - + AppStorage.setOrCreate('uiContext', this.context); if (this.windowUtil !== undefined) { this.windowUtil.setWindowStage(windowStage); await this.windowUtil.setMainWindow();