diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png index cd45accb1dfd2fd0da16c732c72faa6e46b26521..a39445dc87828b76fed6d2ec470dd455c45319e3 100644 Binary files a/AppScope/resources/base/media/app_icon.png and b/AppScope/resources/base/media/app_icon.png differ diff --git a/README.md b/README.md index 505c46b003f402b9b536ed374e4f03f4ca49db1f..697056123bcaf573528958ce45b36875e4b8ea41 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 一次开发,多端部署-银行理财 +# 优秀实践-一次开发,多端部署-银行理财 ### 简介 @@ -33,10 +33,4 @@ 1. 本示例仅支持标准系统上运行,支持设备:华为手机。 2. HarmonyOS系统:HarmonyOS NEXT Developer Beta1及以上。 3. DevEco Studio版本:DevEco Studio NEXT Developer Beta1及以上。 -4. HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 - -### 注意 - -运行时需设置引用所有HSP模块。点击Run > Edit Configurations,选择Deploy Multi Hap标签页,勾选Deploy Multi Hap Packages, 选择使用方模块(phone)和所有HSP模块,点击OK。单击Run > Run “模块名称”(如Run “phone”)或![](screenshots/device/run.PNG)来启动应用/服务的编译构建。 - -![](screenshots/device/config.png) +4. HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta1 SDK及以上。 \ No newline at end of file diff --git a/commons/basic/Index.ets b/commons/basic/Index.ets index 368ea5fd149bbb17dbae7c1b7b405c4bbed2174b..06829cca5599dd6a8f9a361b31afb0f78de54876 100644 --- a/commons/basic/Index.ets +++ b/commons/basic/Index.ets @@ -1,5 +1,6 @@ -export { CommonConstants } from "./src/main/ets/constants/CommonConstants" -export { RouterConstants } from "./src/main/ets/constants/RouterConstants" -export { BreakpointUtil } from "./src/main/ets/utils/BreakpointUtil" -export { BusinessInfo } from "./src/main/ets/viewmodel/BusinessInfo" -export { FundDetail } from "./src/main/ets/viewmodel/FundDetail" +export { CommonConstants } from './src/main/ets/constants/CommonConstants'; +export { RouterConstants } from './src/main/ets/constants/RouterConstants'; +export { BreakpointUtil } from './src/main/ets/utils/BreakpointUtil'; +export { logger } from './src/main/ets/utils/Logger'; +export { BusinessInfo } from './src/main/ets/viewmodel/BusinessInfo'; +export { FundDetail } from './src/main/ets/viewmodel/FundDetail'; diff --git a/commons/basic/hvigorfile.ts b/commons/basic/hvigorfile.ts index d993120bd71f5f5dfe04480be9dc5f73c00c2599..42187071482d292588ad40babeda74f7b8d97a23 100644 --- a/commons/basic/hvigorfile.ts +++ b/commons/basic/hvigorfile.ts @@ -1,6 +1,6 @@ -import { hspTasks } from '@ohos/hvigor-ohos-plugin'; +import { harTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/commons/basic/src/main/ets/constants/CommonConstants.ets b/commons/basic/src/main/ets/constants/CommonConstants.ets index 7579dec3ca7b7863ddedc6280f4fc1cf9f9bfa99..9e807259223d0744f79fd5a6c77c23b624ee1d39 100644 --- a/commons/basic/src/main/ets/constants/CommonConstants.ets +++ b/commons/basic/src/main/ets/constants/CommonConstants.ets @@ -42,6 +42,11 @@ export class CommonConstants { */ static readonly BREAK_POINTS_VALUE: Array = ['320vp', '600vp', '840vp']; + /** + * The break point value. + */ + static readonly BREAK_POINTS_VALUE_NUMBER: Array = [320, 600, 840]; + /** * The number of columns for SM device. */ diff --git a/commons/basic/src/main/ets/constants/RouterConstants.ets b/commons/basic/src/main/ets/constants/RouterConstants.ets index 8cac490f68d25c1009ebc900b5f1e572d258065a..971a8c5ba2c047202197b90d99cd0ece0d3afad6 100644 --- a/commons/basic/src/main/ets/constants/RouterConstants.ets +++ b/commons/basic/src/main/ets/constants/RouterConstants.ets @@ -20,25 +20,25 @@ export class RouterConstants { /** * The funding detail page url. */ - static readonly FUNDING_DETAIL_URL: string = '@bundle:com.huawei.multifinancialmanagement/fund/ets/pages/FundingDetail'; + static readonly FUNDING_DETAIL_URL: string = 'FundingDetail'; /** * The funding page url. */ - static readonly FUNDING_URL: string = '@bundle:com.huawei.multifinancialmanagement/fund/ets/pages/Funding'; + static readonly FUNDING_URL: string = 'Funding'; /** * The trends page url. */ - static readonly TRENDS_PAGE_URL: string = '@bundle:com.huawei.multifinancialmanagement/fund/ets/pages/TrendsPage'; + static readonly TRENDS_PAGE_URL: string = 'TrendsPage'; /** * The comparison detail page url. */ - static readonly COMPARISON_PAGE_URL: string = '@bundle:com.huawei.multifinancialmanagement/fundComparison/ets/pages/ComparisonDetailPage'; + static readonly COMPARISON_PAGE_URL: string = 'ComparisonDetailPage'; /** * The comparison detail page url. */ - static readonly ACCOUNT_PAGE_URL: string = '@bundle:com.huawei.multifinancialmanagement/home/ets/pages/AccountPage'; + static readonly ACCOUNT_PAGE_URL: string = 'AccountPage'; } \ No newline at end of file diff --git a/commons/basic/src/main/ets/utils/Logger.ets b/commons/basic/src/main/ets/utils/Logger.ets new file mode 100644 index 0000000000000000000000000000000000000000..748109dff1f6bc518942e8bcc8d2f508f6eb1637 --- /dev/null +++ b/commons/basic/src/main/ets/utils/Logger.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { hilog } from '@kit.PerformanceAnalysisKit'; + +const LOG_DOMAIN: number = 0xFF00; + +class Logger { + private domain: number; + private prefix: string; + private format: string = '%{public}s, %{public}s'; + + constructor(prefix: string, domain: number) { + this.prefix = prefix; + this.domain = domain; + } + + debug(...args: string[]): void { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: string[]): void { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: string[]): void { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: string[]): void { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export const logger = new Logger('MultiFinancialManagement', LOG_DOMAIN); \ No newline at end of file diff --git a/commons/basic/src/main/module.json5 b/commons/basic/src/main/module.json5 index a68c576c9763e64432082ae025e6bcdda1d72826..6823e5bd3cad8ec31f718f4decd76f50a5244775 100644 --- a/commons/basic/src/main/module.json5 +++ b/commons/basic/src/main/module.json5 @@ -1,13 +1,12 @@ { "module": { "name": "basic", - "type": "shared", + "type": "har", "description": "$string:shared_desc", "deviceTypes": [ "phone", "tablet", "2in1" - ], - "deliveryWithInstall": true + ] } } \ No newline at end of file diff --git a/features/fund/Index.ets b/features/fund/Index.ets index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c90b6ba4549bd22467d6642e2bf088876e7bf33c 100644 --- a/features/fund/Index.ets +++ b/features/fund/Index.ets @@ -0,0 +1,3 @@ +export { Funding } from './src/main/ets/view/Funding'; +export { FundingDetail } from './src/main/ets/view/FundingDetail'; +export { TrendsPage } from './src/main/ets/view/TrendsPage'; \ No newline at end of file diff --git a/features/fund/hvigorfile.ts b/features/fund/hvigorfile.ts index d993120bd71f5f5dfe04480be9dc5f73c00c2599..42187071482d292588ad40babeda74f7b8d97a23 100644 --- a/features/fund/hvigorfile.ts +++ b/features/fund/hvigorfile.ts @@ -1,6 +1,6 @@ -import { hspTasks } from '@ohos/hvigor-ohos-plugin'; +import { harTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/features/fund/src/main/ets/view/DetailComponent.ets b/features/fund/src/main/ets/view/DetailComponent.ets index aa731f6159decd9bd91e5fef340a42840c31da59..cac46e3618c6c61a18503990ecbe8928b022bd11 100644 --- a/features/fund/src/main/ets/view/DetailComponent.ets +++ b/features/fund/src/main/ets/view/DetailComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; import { LineChart, LineChartModel } from '@ohos/mpchart'; import { BreakpointUtil, CommonConstants, FundDetail, RouterConstants } from '@ohos/basic'; import ChartViewModel from '../viewmodel/ChartViewModel'; @@ -30,6 +29,7 @@ export struct DetailComponent { @State tabBarIndex: number = 0; @State fundInfo: FundDetail[] = FundingViewModel.getAllFundInfo(); @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); private controller: TabsController = new TabsController(); build() { @@ -59,11 +59,11 @@ export struct DetailComponent { .width($r('app.float.common_image')) .height($r('app.float.common_image')) .onClick(() => { - router.back(); + this.pageIndexInfos.pop(); }) Text($r('app.string.funding_title')) .fontSize($r('app.float.title_text_size')) - .fontColor($r('app.color.sixty_percent_white')) + .fontColor($r('sys.color.mask_secondary')) Image($r('app.media.ic_public_share')) .width($r('app.float.common_image')) .height($r('app.float.common_image')) @@ -123,7 +123,7 @@ export struct DetailComponent { Column({ space: FundConstants.COLUMN_SPACE }) { Text($r('app.string.one_day_amplitude_data')) .fontSize($r('app.float.amplitude_date_size')) - .fontColor($r("app.color.amplitude_date")) + .fontColor($r('app.color.amplitude_date')) .fontWeight(CommonConstants.FONT_WEIGHT_500) Text($r('app.string.one_day_amplitude')) .fontSize($r('app.float.amplitude_time_size')) @@ -191,7 +191,7 @@ export struct DetailComponent { Row() { Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { Text($r('app.string.performance_trends')) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) .border({ @@ -208,7 +208,7 @@ export struct DetailComponent { this.controller.changeIndex(this.tabBarIndex); }) Text($r('app.string.unit_net_value')) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) .border({ @@ -229,10 +229,8 @@ export struct DetailComponent { .width($r('app.float.common_image')) .height($r('app.float.common_image')) .onClick(() => { - router.pushUrl({ - url: RouterConstants.TRENDS_PAGE_URL, - params: { name: this.fundInfo[this.indexList].name } - }) + this.pageIndexInfos.pushPathByName(RouterConstants.TRENDS_PAGE_URL, + { 'name': this.fundInfo[this.indexList].name } as Record); }) } .width(CommonConstants.FULL_WIDTH_PERCENT) @@ -274,7 +272,7 @@ export struct DetailComponent { .fontSize($r('app.float.chart_button_size')) .fontColor($r('app.color.harmony_blue')) .fontWeight(CommonConstants.FONT_WEIGHT_500) - .backgroundColor($r('app.color.five_percent_white')) + .backgroundColor($r('app.color.five_percent_white_fund')) .height($r('app.float.chart_button_height')) .width(new BreakpointUtil({ sm: $r('app.float.chart_button_min_width'), @@ -338,7 +336,7 @@ export struct DetailComponent { this.pageInfo.pushPath({ name: CommonConstants.PATH_COMPARISON }) }) Column({ space: FundConstants.COLLECT_COLUMN_SPACE }) { - Image($r("app.media.ic_public_collect_fund")) + Image($r('app.media.ic_public_collect_fund')) .width($r('app.float.common_image')) .height($r('app.float.common_image')) Text($r('app.string.funding_concerned')) @@ -353,7 +351,7 @@ export struct DetailComponent { lg: $r('app.float.bottom_button_width_md') }).getValue(this.currentPoint)) .height($r('app.float.bottom_button_height')) - .backgroundColor($r('app.color.five_percent_white')) + .backgroundColor($r('app.color.five_percent_white_fund')) .fontColor($r('app.color.bottom_button')) .fontSize($r('app.float.common_font_size')) .fontWeight(CommonConstants.FONT_WEIGHT_500) @@ -393,7 +391,7 @@ export struct DetailComponent { .hideTitleBar(true) .backgroundColor($r('app.color.common_background')) .onBackPressed(() => { - router.back(); + this.pageIndexInfos.pop(); return true; }) } @@ -402,7 +400,7 @@ export struct DetailComponent { @Extend(Button) function chartButtonStyle() { .fontSize($r('app.float.chart_button_size')) - .fontColor($r('app.color.sixty_percent_white')) + .fontColor($r('sys.color.mask_secondary')) .fontWeight(CommonConstants.FONT_WEIGHT_500) .backgroundColor(Color.White) .height($r('app.float.chart_button_height')) diff --git a/features/fund/src/main/ets/view/FundComponent.ets b/features/fund/src/main/ets/view/FundComponent.ets index bba10d52a3b957a4623cdef8247b689f357114ca..7b815c87c541a8e634da19a7aee23ed677a8be99 100644 --- a/features/fund/src/main/ets/view/FundComponent.ets +++ b/features/fund/src/main/ets/view/FundComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; import { BreakpointUtil, BusinessInfo, CommonConstants, FundDetail, RouterConstants } from '@ohos/basic'; import { FundConstants } from '../constants/FundConstants'; import FundingViewModel from '../viewmodel/FundingViewModel'; @@ -23,6 +22,9 @@ export struct FundComponent { @State currentPoint: string = CommonConstants.BREAK_POINT_SM; @State tabBarIndex: number = 0; @State backgroundX: number = 0; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); private controller: TabsController = new TabsController(); build() { @@ -45,24 +47,38 @@ export struct FundComponent { lg: CommonConstants.COLUMN_LG } }) { - Column() { - Row() { - Image($r('app.media.ic_public_back')) - .width($r('app.float.common_image')) - .height($r('app.float.common_image')) - .fillColor(Color.Black) - .onClick(() => { - router.back(); - }) + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) + .onClick(() => { + this.pageIndexInfos.pop(); + }) - Blank() + Search({ placeholder: $r('app.string.search_placeholder') }) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.Visible : Visibility.None) + .enableKeyboardOnFocus(false) + .placeholderColor($r('sys.color.mask_secondary')) + .borderColor($r('app.color.five_percent_white_fund')) + .searchIcon({ + color: $r('sys.color.mask_secondary') + }) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.search_width_sm') : $r('app.float.search_width')) + .margin({ + left: $r('app.float.common_margin'), + right: $r('app.float.common_margin') + }) + Row() { Search({ placeholder: $r('app.string.search_placeholder') }) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.None : Visibility.Visible) .enableKeyboardOnFocus(false) - .placeholderColor($r('app.color.sixty_percent_white')) - .borderColor($r('app.color.five_percent_white')) + .placeholderColor($r('sys.color.mask_secondary')) + .borderColor($r('app.color.five_percent_white_fund')) .searchIcon({ - color: $r('app.color.sixty_percent_white') + color: $r('sys.color.mask_secondary') }) .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.search_width_sm') : $r('app.float.search_width')) @@ -75,16 +91,19 @@ export struct FundComponent { .height($r('app.float.common_image')) .fillColor(Color.Black) } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .backgroundColor(Color.White) - .justifyContent(FlexAlign.SpaceBetween) - .padding({ - left: $r('app.float.padding_common'), - right: $r('app.float.padding_common'), - top: $r('app.float.title_padding_tb'), - bottom: $r('app.float.title_padding_tb') - }) } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.title_padding_tb'), + bottom: $r('app.float.title_padding_tb') + }) + .margin({ + top: this.topHeight + }) } GridCol({ @@ -196,7 +215,8 @@ export struct FundComponent { .scrollBar(BarState.Off) } .margin({ - top: $r('app.float.scroll_margin_top') + top: $r('app.float.scroll_margin_top'), + bottom: this.bottom }) } .backgroundColor($r('app.color.common_background')) @@ -213,7 +233,7 @@ export struct FundComponent { @Builder buildTabBarText(text: ResourceStr, index: number) { Text(text) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === index ? $r('app.color.harmony_blue') : Color.Black) .border({ @@ -274,10 +294,8 @@ export struct FundComponent { .width($r('app.float.list_item_width')) .justifyContent(FlexAlign.SpaceAround) .onClick(() => { - router.pushUrl({ - url: RouterConstants.FUNDING_DETAIL_URL, - params: { 'listIndex': index } - }) + this.pageIndexInfos.pushPathByName(RouterConstants.FUNDING_DETAIL_URL, + { 'listIndex': index } as Record); }) } .width(CommonConstants.FULL_WIDTH_PERCENT) @@ -412,7 +430,7 @@ export struct FundComponent { .fillColor($r('app.color.sixty_percent_black')) Text($r('app.string.funding_news')) .fontSize($r('app.float.news_text_size')) - .fontColor($r('app.color.sixty_percent_black')) + .fontColor($r('sys.color.font_on_secondary')) .fontWeight(FontWeight.Normal) .textOverflow({ overflow: TextOverflow.Ellipsis diff --git a/features/fund/src/main/ets/view/FundNavigationComponent.ets b/features/fund/src/main/ets/view/FundNavigationComponent.ets index e516fe725ce017870548bb9fb9ea79a15a2c3873..7eee6a4bd841835e6b58f6a99e659a2802b19c3a 100644 --- a/features/fund/src/main/ets/view/FundNavigationComponent.ets +++ b/features/fund/src/main/ets/view/FundNavigationComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; import { BreakpointUtil, BusinessInfo, CommonConstants, FundDetail } from '@ohos/basic'; import { FundConstants } from '../constants/FundConstants'; import FundingViewModel from '../viewmodel/FundingViewModel'; @@ -25,6 +24,7 @@ export struct FundNavigationComponent { @State listIndex: number = 0; @State tabBarIndex: number = 0; @State backgroundX: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); private controller: TabsController = new TabsController(); build() { @@ -49,42 +49,40 @@ export struct FundNavigationComponent { lg: CommonConstants.COLUMN_LG } }) { - Column() { - Row() { - Image($r('app.media.ic_public_back')) - .width($r('app.float.common_image')) - .height($r('app.float.common_image')) - .fillColor(Color.Black) - .onClick(() => { - router.back(); - }) - Search({ placeholder: $r('app.string.search_placeholder') }) - .enableKeyboardOnFocus(false) - .placeholderColor($r('app.color.sixty_percent_white')) - .borderColor($r('app.color.five_percent_white')) - .searchIcon({ - color: $r('app.color.sixty_percent_white') - }) - .layoutWeight(1) - .margin({ - left: $r('app.float.common_margin'), - right: $r('app.float.common_margin') - }) - Image($r('app.media.ic_public_comments')) - .width($r('app.float.common_image')) - .height($r('app.float.common_image')) - .fillColor(Color.Black) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .backgroundColor(Color.White) - .justifyContent(FlexAlign.SpaceBetween) - .padding({ - left: $r('app.float.padding_common'), - right: $r('app.float.padding_common'), - top: $r('app.float.title_padding_tb'), - bottom: $r('app.float.title_padding_tb') - }) + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) + .onClick(() => { + this.pageIndexInfos.pop(); + }) + Search({ placeholder: $r('app.string.search_placeholder') }) + .enableKeyboardOnFocus(false) + .placeholderColor($r('app.color.sixty_percent_white')) + .borderColor($r('app.color.five_percent_white_fund')) + .searchIcon({ + color: $r('app.color.sixty_percent_white') + }) + .layoutWeight(1) + .margin({ + left: $r('app.float.common_margin'), + right: $r('app.float.common_margin') + }) + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .fillColor(Color.Black) } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.title_padding_tb'), + bottom: $r('app.float.title_padding_tb') + }) } GridCol({ @@ -217,7 +215,7 @@ export struct FundNavigationComponent { @Builder buildTabBarText(text: ResourceStr, index: number) { Text(text) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === index ? $r('app.color.harmony_blue') : Color.Black) .border({ diff --git a/features/fund/src/main/ets/pages/Funding.ets b/features/fund/src/main/ets/view/Funding.ets similarity index 36% rename from features/fund/src/main/ets/pages/Funding.ets rename to features/fund/src/main/ets/view/Funding.ets index 5453133c4d0d5cbb4e40cff7ea5b0a470340b20a..6157f9603ad95689dde79e0ad96f3a5907523cd8 100644 --- a/features/fund/src/main/ets/pages/Funding.ets +++ b/features/fund/src/main/ets/view/Funding.ets @@ -12,21 +12,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { CommonConstants } from '@ohos/basic'; -import { FundConstants } from '../constants/FundConstants'; -import { FundComponent } from '../view/FundComponent'; +import { CommonConstants } from '@ohos/basic/'; +import { window } from '@kit.ArkUI'; +import { FundConstants } from '../constants/FundConstants'; +import { FundComponent } from './FundComponent'; import FundingViewModel from '../viewmodel/FundingViewModel'; -@Entry @Component -struct Funding { - @State breakPoint: string = CommonConstants.BREAK_POINT_SM; +export struct Funding { + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; @State currentTabIndex: number = 0; - - aboutToAppear() { - AppStorage.setOrCreate('allFund', FundingViewModel.getAllFundInfo()) - } + @StorageProp('avoidArea') topHeight: number = 0; @Builder BuildTabs(icon: Resource, title: ResourceStr, index: number) { @@ -34,12 +31,12 @@ struct Funding { Image(icon) .width($r('app.float.common_image')) .height($r('app.float.common_image')) - .fillColor(this.currentTabIndex === index ? $r("app.color.tab_choose_image") : $r('app.color.tab_un_image')) + .fillColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) Text(title) .fontSize($r('app.float.home_tab_text_size')) - .lineHeight($r("app.float.tab_text_height")) + .lineHeight($r('app.float.tab_text_height')) .fontWeight(FontWeight.Regular) - .fontColor(this.currentTabIndex === index ? $r("app.color.tab_choose_image") : $r('app.color.tab_un_image')) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) } } @@ -53,71 +50,88 @@ struct Funding { .fontSize($r('app.float.home_tab_text_size')) .lineHeight($r('app.float.tab_text_height')) .fontWeight(FontWeight.Regular) - .fontColor(this.currentTabIndex === index ? $r("app.color.tab_choose_image") : $r('app.color.tab_un_image')) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) } } build() { - GridRow({ - breakpoints: { - value: CommonConstants.BREAK_POINTS_VALUE, - reference: BreakpointsReference.WindowSize - }, - columns: { - sm: CommonConstants.COLUMN_SM, - md: CommonConstants.COLUMN_MD, - lg: CommonConstants.COLUMN_LG - }, - direction: GridRowDirection.Row - }) { - GridCol({ - span: { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { sm: CommonConstants.COLUMN_SM, md: CommonConstants.COLUMN_MD, lg: CommonConstants.COLUMN_LG - } + }, + direction: GridRowDirection.Row }) { - Column() { - Tabs({ - barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End - }) { - TabContent() { - FundComponent() - } - .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Tabs({ + barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() { + FundComponent() + } + .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) - TabContent() { + TabContent() { + } + .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), + $r('app.string.tab_bar_mine'), 4)) } - .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), - $r('app.string.tab_bar_mine'), 4)) - } - .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) - .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? - $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) - .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) + .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) + .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.TAB_HEIGHT_PERCENT : 0) - .backgroundColor($r('app.color.home_background')) - .scrollable(false) - .onChange((index: number) => { - this.currentTabIndex = index; - }) + .backgroundColor($r('app.color.home_background')) + .scrollable(false) + .onChange((index: number) => { + this.currentTabIndex = index; + }) + } } } } - .onBreakpointChange((breakpoints: string) => { - this.breakPoint = breakpoints; + .hideTitleBar(true) + .onWillShow(() => { + AppStorage.setOrCreate('allFund', FundingViewModel.getAllFundInfo()); + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#FFFFFF' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#00ffffff' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) }) } } \ No newline at end of file diff --git a/features/fund/src/main/ets/pages/FundingDetail.ets b/features/fund/src/main/ets/view/FundingDetail.ets similarity index 40% rename from features/fund/src/main/ets/pages/FundingDetail.ets rename to features/fund/src/main/ets/view/FundingDetail.ets index ab48b39d68e61e08935dc01bb4b54fe7409b476d..dc5178d78974a7fd73150325a68db7ad903519f5 100644 --- a/features/fund/src/main/ets/pages/FundingDetail.ets +++ b/features/fund/src/main/ets/view/FundingDetail.ets @@ -13,98 +13,98 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; -import { CommonConstants } from '@ohos/basic'; -import { ComparisonComponent, ComparisonInfo, ComparisonDetailComponent } from '@ohos/fundComparison'; -import { TransactionComponent } from '@ohos/transaction'; +import { CommonConstants } from '@ohos/basic/'; +import { ComparisonComponent, ComparisonInfo, ComparisonDetailComponent } from '@ohos/fundComparison/'; +import { TransactionComponent } from '@ohos/transaction/'; import { FundConstants } from '../constants/FundConstants'; -import { DetailComponent } from '../view/DetailComponent'; -import { FundNavigationComponent } from '../view/FundNavigationComponent'; +import { DetailComponent } from './DetailComponent'; +import { FundNavigationComponent } from './FundNavigationComponent'; -@Entry @Component -struct FundingDetail { - @StorageLink('pageInfo')pageInfo: NavPathStack = new NavPathStack(); - @State breakPoint: string = CommonConstants.BREAK_POINT_LG; +export struct FundingDetail { + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; @State currentTabIndex: number = 0; @State index: number = 0; - - aboutToAppear() { - let param: Record = router.getParams() as Record; - if (param) { - this.index = param['listIndex']; - } - this.pageInfo.pushPath({ name: CommonConstants.PATH_DETAIL, param: this.index }, false); - } + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); build() { - GridRow({ - breakpoints: { - value: CommonConstants.BREAK_POINTS_VALUE, - reference: BreakpointsReference.WindowSize - }, - columns: { - sm: CommonConstants.COLUMN_SM, - md: CommonConstants.COLUMN_MD, - lg: CommonConstants.COLUMN_LG - }, - direction: GridRowDirection.Row - }) { - GridCol({ - span: { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { sm: CommonConstants.COLUMN_SM, md: CommonConstants.COLUMN_MD, lg: CommonConstants.COLUMN_LG - } + }, + direction: GridRowDirection.Row }) { - Column() { - Tabs({ - barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End - }) { - TabContent() { - Navigation(this.pageInfo) { - FundNavigationComponent({ listIndex: this.index }) + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Tabs({ + barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() { + Navigation(this.pageInfo) { + FundNavigationComponent({ listIndex: this.index }) + } + .navDestination(this.buildNavDestination) + .hideTitleBar(true) + .hideBackButton(true) + .mode(this.breakPoint === CommonConstants.BREAK_POINT_LG ? NavigationMode.Split : NavigationMode.Stack) + .navBarWidth(FundConstants.NAV_BAR_WIDTH) } - .navDestination(this.buildNavDestination) - .hideTitleBar(true) - .hideBackButton(true) - .mode(this.breakPoint === CommonConstants.BREAK_POINT_LG ? NavigationMode.Split : NavigationMode.Stack) - .navBarWidth(FundConstants.NAV_BAR_WIDTH) - } - .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) + .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) - TabContent() { + TabContent() { + } + .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), + $r('app.string.tab_bar_mine'), 4)) } - .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), - $r('app.string.tab_bar_mine'), 4)) + .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) + .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) + .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + CommonConstants.TAB_HEIGHT_PERCENT : 0) + .backgroundColor($r('app.color.home_background')) + .scrollable(false) + .onChange((index: number) => { + this.currentTabIndex = index; + }) } - .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) - .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? - $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) - .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? - CommonConstants.TAB_HEIGHT_PERCENT : 0) - .backgroundColor($r('app.color.home_background')) - .scrollable(false) - .onChange((index: number) => { - this.currentTabIndex = index; - }) } } } - .onBreakpointChange((breakpoints: string) => { - this.breakPoint = breakpoints; + .hideTitleBar(true) + .onWillAppear(() => { + this.pageInfo.pushPath({ name: CommonConstants.PATH_DETAIL, param: this.index }, false); + }) + .margin({ + top: this.topHeight, + bottom: this.bottom }) } @@ -134,12 +134,12 @@ struct FundingDetail { Image(icon) .width($r('app.float.common_image')) .height($r('app.float.common_image')) - .fillColor(this.currentTabIndex === index ? $r("app.color.tab_choose_image") : $r('app.color.tab_un_image')) + .fillColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) Text(title) .fontSize($r('app.float.home_tab_text_size')) - .lineHeight($r("app.float.tab_text_height")) + .lineHeight($r('app.float.tab_text_height')) .fontWeight(FontWeight.Regular) - .fontColor(this.currentTabIndex === index ? $r("app.color.tab_choose_image") : $r('app.color.tab_un_image')) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) } } @@ -153,7 +153,7 @@ struct FundingDetail { .fontSize($r('app.float.home_tab_text_size')) .lineHeight($r('app.float.tab_text_height')) .fontWeight(FontWeight.Regular) - .fontColor(this.currentTabIndex === index ? $r("app.color.tab_choose_image") : $r('app.color.tab_un_image')) + .fontColor(this.currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image')) } } } \ No newline at end of file diff --git a/features/fund/src/main/ets/pages/TrendsPage.ets b/features/fund/src/main/ets/view/TrendsPage.ets similarity index 36% rename from features/fund/src/main/ets/pages/TrendsPage.ets rename to features/fund/src/main/ets/view/TrendsPage.ets index 1f9477296a0a9204962109f12808091bbb4c444b..4033a3585863553294560dd252e963995938171d 100644 --- a/features/fund/src/main/ets/pages/TrendsPage.ets +++ b/features/fund/src/main/ets/view/TrendsPage.ets @@ -14,26 +14,25 @@ */ import { Callback } from '@kit.BasicServicesKit'; -import { display, router } from '@kit.ArkUI'; -import { hilog } from '@kit.PerformanceAnalysisKit'; +import { display } from '@kit.ArkUI'; import { window } from '@kit.ArkUI'; import { LineChart, LineChartModel } from '@ohos/mpchart'; -import { BreakpointUtil, CommonConstants } from '@ohos/basic'; +import { BreakpointUtil, CommonConstants, logger } from '@ohos/basic/'; import ChartViewModel from '../viewmodel/ChartViewModel'; -import { ChartLegendComponent } from '../view/ChartLegendComponent'; +import { ChartLegendComponent } from './ChartLegendComponent'; import { FundConstants } from '../constants/FundConstants'; -@Entry @Component -struct TrendsPage { +export struct TrendsPage { @State showChart: boolean = true; @State lineChartModel: LineChartModel = ChartViewModel.getLineChartModel(); @State tabBarIndex: number = 0; - @State name: string = (router.getParams() as Record)['name']; + @State name: string = ''; @State currentPoint: string = CommonConstants.BREAK_POINT_MD; @StorageProp('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_MD; @StorageProp('avoidArea') areaLeft: number = 0; @State isLandScape: boolean = false; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); private controller: TabsController = new TabsController(); private callback: Callback = (data: display.FoldDisplayMode) => { if (this.isLandScape && data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_FULL) { @@ -48,93 +47,66 @@ struct TrendsPage { this.isLandScape = true; } }; - aboutToAppear(): void { - if (!this.isLandScape && this.breakPoint === CommonConstants.BREAK_POINT_SM) { - window.getLastWindow(getContext(this)).then((stage: window.Window) => { - stage.setPreferredOrientation(window.Orientation.LANDSCAPE); - this.isLandScape = true; - }); - } - try { - display.on('foldDisplayModeChange', this.callback); - } catch (exception) { - hilog.error(0x0000, 'testTag', '%{public}s', 'Failed to register callback. Code: ' + JSON.stringify(exception)); - } - } - - aboutToDisappear(): void { - if (this.isLandScape) { - window.getLastWindow(getContext(this)).then((stage: window.Window) => { - stage.setPreferredOrientation(window.Orientation.PORTRAIT); - }); - this.isLandScape = false; - } - try { - display.off('foldDisplayModeChange', this.callback); - } catch (exception) { - hilog.error(0x0000, 'testTag', '%{public}s', 'Failed to register callback. Code: ' + JSON.stringify(exception)); - } - } build() { - GridRow({ - breakpoints: { - value: CommonConstants.BREAK_POINTS_VALUE, - reference: BreakpointsReference.WindowSize - }, - columns: { - sm: CommonConstants.COLUMN_SM, - md: CommonConstants.COLUMN_MD, - lg: CommonConstants.COLUMN_LG - }, - direction: GridRowDirection.Row - }) { - GridCol({ - span: { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { sm: CommonConstants.COLUMN_SM, md: CommonConstants.COLUMN_MD, lg: CommonConstants.COLUMN_LG - } + }, + direction: GridRowDirection.Row }) { - Row() { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { Row() { - Text(this.name) - .fontSize($r('app.float.common_font_size')) - .fontColor($r('app.color.name_text')) - .lineHeight($r('app.float.common_line_height')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - Text($r('app.string.funding_code')) - .fontSize($r('app.float.code_size')) - .fontColor($r('app.color.forty_percent_white')) - .margin({ - left: $r('app.float.code_margin_left') + Row() { + Text(this.name) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.name_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.funding_code')) + .fontSize($r('app.float.code_size')) + .fontColor($r('app.color.forty_percent_white')) + .margin({ + left: $r('app.float.code_margin_left') + }) + } + .alignItems(VerticalAlign.Bottom) + + Image($r('app.media.ic_public_reduce')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageIndexInfos.pop(); }) } - .alignItems(VerticalAlign.Bottom) - - Image($r('app.media.ic_public_reduce')) - .width($r('app.float.common_image')) - .height($r('app.float.common_image')) - .onClick(() => { - router.back(); - }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - } - GridCol({ - span: { - sm: CommonConstants.COLUMN_SM, - md: CommonConstants.COLUMN_MD, - lg: CommonConstants.COLUMN_LG - } - }) { - Column() { - Row() { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { Text($r('app.string.performance_trends')) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) .border({ @@ -151,7 +123,7 @@ struct TrendsPage { this.controller.changeIndex(this.tabBarIndex); }) Text($r('app.string.unit_net_value')) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) .border({ @@ -168,118 +140,151 @@ struct TrendsPage { this.controller.changeIndex(this.tabBarIndex); }) } - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.Start) - .alignItems(VerticalAlign.Center) - .margin({ - bottom: $r('app.float.tab_bar_top') - }) - .height($r('app.float.title_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .margin({ + bottom: $r('app.float.tab_bar_top') + }) + .height($r('app.float.title_height')) - Tabs({ controller: this.controller }) { - TabContent() { - Column() { - Row() { - ChartLegendComponent({ - name: $r('app.string.the_fund'), - color: $r('app.color.fund_chart'), - value: $r('app.string.the_fund_value') - }) - ChartLegendComponent({ - name: $r('app.string.same_average'), - color: $r('app.color.same_average_chart'), - value: $r('app.string.same_average_value') - }) - ChartLegendComponent({ - name: $r('app.string.other_funding'), - color: $r('app.color.other_funding_chart'), - value: $r('app.string.other_funding_value') + Tabs({ controller: this.controller }) { + TabContent() { + Column() { + Row() { + ChartLegendComponent({ + name: $r('app.string.the_fund'), + color: $r('app.color.fund_chart'), + value: $r('app.string.the_fund_value') + }) + ChartLegendComponent({ + name: $r('app.string.same_average'), + color: $r('app.color.same_average_chart'), + value: $r('app.string.same_average_value') + }) + ChartLegendComponent({ + name: $r('app.string.other_funding'), + color: $r('app.color.other_funding_chart'), + value: $r('app.string.other_funding_value') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: new BreakpointUtil({ + sm: $r('app.float.legend_padding_lr'), + md: $r('app.float.legend_padding_lr'), + lg: $r('app.float.legend_padding_lr_lg') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.legend_padding_lr'), + md: $r('app.float.legend_padding_lr'), + lg: $r('app.float.legend_padding_lr_lg') + }).getValue(this.currentPoint) }) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - .padding({ - left: new BreakpointUtil({ - sm: $r('app.float.legend_padding_lr'), - md: $r('app.float.legend_padding_lr'), - lg: $r('app.float.legend_padding_lr_lg') - }).getValue(this.currentPoint), - right: new BreakpointUtil({ - sm: $r('app.float.legend_padding_lr'), - md: $r('app.float.legend_padding_lr'), - lg: $r('app.float.legend_padding_lr_lg') - }).getValue(this.currentPoint) - }) - Row() { - if (this.showChart) { - LineChart({ model: this.lineChartModel }) - } else { - LineChart({ model: this.lineChartModel }) + Row() { + if (this.showChart) { + LineChart({ model: this.lineChartModel }) + } else { + LineChart({ model: this.lineChartModel }) + } } - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .layoutWeight(1) - .onAreaChange(() => { - this.lineChartModel = ChartViewModel.getLineChartModel(); - this.showChart = !this.showChart; - }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .layoutWeight(1) + .onAreaChange(() => { + this.lineChartModel = ChartViewModel.getLineChartModel(); + this.showChart = !this.showChart; + }) - Row() { - Button($r('app.string.near_month', 1)) - .fontSize($r('app.float.chart_button_size')) - .fontColor($r('app.color.harmony_blue')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - .backgroundColor($r('app.color.five_percent_white')) - .height($r('app.float.chart_button_height')) - .width(new BreakpointUtil({ - sm: $r('app.float.near_button_width'), - md: $r('app.float.near_button_width'), - lg: $r('app.float.near_button_width_lg') - }).getValue(this.currentPoint)) - Button($r('app.string.near_month', 3)) - .chartButtonStyle() - Button($r('app.string.near_month', 6)) - .chartButtonStyle() - Button($r('app.string.near_year', 1)) - .chartButtonStyle() - Button($r('app.string.near_year', 3)) - .chartButtonStyle() + Row() { + Button($r('app.string.near_month', 1)) + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('app.color.harmony_blue')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor($r('app.color.five_percent_white_fund')) + .height($r('app.float.chart_button_height')) + .width(new BreakpointUtil({ + sm: $r('app.float.near_button_width'), + md: $r('app.float.near_button_width'), + lg: $r('app.float.near_button_width_lg') + }).getValue(this.currentPoint)) + Button($r('app.string.near_month', 3)) + .chartButtonStyle() + Button($r('app.string.near_month', 6)) + .chartButtonStyle() + Button($r('app.string.near_year', 1)) + .chartButtonStyle() + Button($r('app.string.near_year', 3)) + .chartButtonStyle() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: $r('app.float.chart_button_margin') + }) } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - .margin({ - top: $r('app.float.chart_button_margin') - }) + .height(CommonConstants.FULL_HEIGHT_PERCENT) } - .height(CommonConstants.FULL_HEIGHT_PERCENT) - } - .tabBar($r('app.string.performance_trends')) + .tabBar($r('app.string.performance_trends')) - TabContent() { + TabContent() { + } + .tabBar($r('app.string.unit_net_value')) } - .tabBar($r('app.string.unit_net_value')) + .barMode(BarMode.Scrollable, { margin: $r('app.float.tab_bar_margin') }) + .barHeight(0) + .scrollable(false) + .layoutWeight(1) + .focusable(false) } - .barMode(BarMode.Scrollable, { margin: $r('app.float.tab_bar_margin') }) - .barHeight(0) - .scrollable(false) - .layoutWeight(1) - .focusable(false) } } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .padding({ + left: $r('app.float.padding_common'), + right: this.isLandScape ? this.areaLeft : $r('app.float.padding_common'), + bottom: $r('app.float.padding_common'), + top: this.currentPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.trends_padding_top') : 0 + }) + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .height(CommonConstants.FULL_HEIGHT_PERCENT) - .padding({ - left: $r('app.float.padding_common'), - right: this.isLandScape ? this.areaLeft : $r('app.float.padding_common'), - bottom: $r('app.float.padding_common'), - top: this.currentPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.trends_padding_top') : 0 + .hideTitleBar(true) + .onAppear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(false); + }) + if (!this.isLandScape && this.breakPoint === CommonConstants.BREAK_POINT_SM) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.LANDSCAPE); + this.isLandScape = true; + }); + } + try { + display.on('foldDisplayModeChange', this.callback); + } catch (exception) { + logger.error('Failed to register callback. Code: ' + JSON.stringify(exception)); + } }) - .onBreakpointChange((breakpoints: string) => { - this.currentPoint = breakpoints; + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(true); + }) + if (this.isLandScape) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.PORTRAIT); + }); + this.isLandScape = false; + } + try { + display.off('foldDisplayModeChange', this.callback); + } catch (exception) { + logger.error('Failed to register callback. Code: ' + JSON.stringify(exception)); + } }) } } diff --git a/features/fund/src/main/ets/viewmodel/FundingViewModel.ets b/features/fund/src/main/ets/viewmodel/FundingViewModel.ets index f7fdc89ca85d7ccdd4ee6056387626db92c0bc90..a36648e9a939543671322d69ba5e20c326034b31 100644 --- a/features/fund/src/main/ets/viewmodel/FundingViewModel.ets +++ b/features/fund/src/main/ets/viewmodel/FundingViewModel.ets @@ -24,11 +24,11 @@ class FundingViewModel { new BusinessInfo($r('app.media.ic_ranking'), $r('app.string.funding_ranking')), new BusinessInfo($r('app.media.ic_index_zone'), $r('app.string.funding_index_zone')), new BusinessInfo($r('app.media.ic_fixed_investment'), $r('app.string.fixed_investment')), - new BusinessInfo($r("app.media.ic_public_Investment_star"), $r('app.string.investment_star_selection')), - new BusinessInfo($r("app.media.ic_good_chance"), $r('app.string.funding_good_chance')), - new BusinessInfo($r("app.media.ic_folder_add"), $r('app.string.funding_folder_add')), - new BusinessInfo($r("app.media.ic_folder_add"), $r('app.string.funding_folder_add')), - new BusinessInfo($r("app.media.ic_folder_add"), $r('app.string.funding_folder_add')) + new BusinessInfo($r('app.media.ic_public_Investment_star'), $r('app.string.investment_star_selection')), + new BusinessInfo($r('app.media.ic_good_chance'), $r('app.string.funding_good_chance')), + new BusinessInfo($r('app.media.ic_folder_add'), $r('app.string.funding_folder_add')), + new BusinessInfo($r('app.media.ic_folder_add'), $r('app.string.funding_folder_add')), + new BusinessInfo($r('app.media.ic_folder_add'), $r('app.string.funding_folder_add')) ]; return fundingBusinessInfoList.slice(start, end); } diff --git a/features/fund/src/main/module.json5 b/features/fund/src/main/module.json5 index f77feaef3d9da6fcbac112c067f07a4b8b6fcbb4..c023333804df678c4d8c5252057fa20b638818a3 100644 --- a/features/fund/src/main/module.json5 +++ b/features/fund/src/main/module.json5 @@ -1,14 +1,12 @@ { "module": { "name": "fund", - "type": "shared", + "type": "har", "description": "$string:shared_desc", "deviceTypes": [ "phone", "tablet", "2in1" - ], - "deliveryWithInstall": true, - "pages": "$profile:main_pages" + ] } } \ No newline at end of file diff --git a/features/fund/src/main/resources/base/element/color.json b/features/fund/src/main/resources/base/element/color.json index 43bda0899435e3f258d2278784052aeb93aec2cc..38c6f302bc9a1b37b819666e4e4babf1a9ddc78a 100644 --- a/features/fund/src/main/resources/base/element/color.json +++ b/features/fund/src/main/resources/base/element/color.json @@ -9,7 +9,7 @@ "value": "#0dffffff" }, { - "name": "five_percent_white", + "name": "five_percent_white_fund", "value": "#0d000000" }, { diff --git a/features/fund/src/main/resources/base/element/float.json b/features/fund/src/main/resources/base/element/float.json index 41acf91ef243c4fa56d4e1d7fe27c0776a1539c4..bbc471cee206bf6a96993754ff8948a2f4271715 100644 --- a/features/fund/src/main/resources/base/element/float.json +++ b/features/fund/src/main/resources/base/element/float.json @@ -329,8 +329,8 @@ "value": "10vp" }, { - "name": "tab_text_size", - "value": "16vp" + "name": "tab_text_size_fund", + "value": "16fp" }, { "name": "tab_bar_padding_bottom", diff --git a/features/fund/src/main/resources/base/profile/main_pages.json b/features/fund/src/main/resources/base/profile/main_pages.json index a701dee0d60510d8c10ef6de9fa88638288e798e..9a81b4ef6c19153c2a381ce08dc7e47810411cc7 100644 --- a/features/fund/src/main/resources/base/profile/main_pages.json +++ b/features/fund/src/main/resources/base/profile/main_pages.json @@ -1,7 +1,7 @@ { "src": [ - "pages/Funding", - "pages/FundingDetail", - "pages/TrendsPage" + "view/Funding", + "view/FundingDetail", + "view/TrendsPage" ] } \ No newline at end of file diff --git a/features/fundComparison/Index.ets b/features/fundComparison/Index.ets index 44289cbaa514a9a0469d17cb5eeb73c30ad1a132..81aa5de9d68f96b6eb6f837b0c6b0a3df758a802 100644 --- a/features/fundComparison/Index.ets +++ b/features/fundComparison/Index.ets @@ -1,3 +1,4 @@ -export { ComparisonComponent } from "./src/main/ets/view/ComparisonComponent" -export { ComparisonDetailComponent } from "./src/main/ets/view/ComparisonDetailComponent" -export { ComparisonInfo } from "./src/main/ets/viewmodel/ComparisonInfo" \ No newline at end of file +export { ComparisonComponent } from './src/main/ets/view/ComparisonComponent'; +export { ComparisonDetailComponent } from './src/main/ets/view/ComparisonDetailComponent'; +export { ComparisonInfo } from './src/main/ets/viewmodel/ComparisonInfo'; +export { ComparisonDetailPage } from './src/main/ets/view/ComparisonDetailPage'; \ No newline at end of file diff --git a/features/fundComparison/hvigorfile.ts b/features/fundComparison/hvigorfile.ts index d993120bd71f5f5dfe04480be9dc5f73c00c2599..42187071482d292588ad40babeda74f7b8d97a23 100644 --- a/features/fundComparison/hvigorfile.ts +++ b/features/fundComparison/hvigorfile.ts @@ -1,6 +1,6 @@ -import { hspTasks } from '@ohos/hvigor-ohos-plugin'; +import { harTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/features/fundComparison/src/main/ets/view/ComparisonComponent.ets b/features/fundComparison/src/main/ets/view/ComparisonComponent.ets index bcc7b329c2277586f3e178992e367a874287ce9b..87d7bfdbf19271a9e525e3bdf08a7c085b4e3bdd 100644 --- a/features/fundComparison/src/main/ets/view/ComparisonComponent.ets +++ b/features/fundComparison/src/main/ets/view/ComparisonComponent.ets @@ -21,7 +21,7 @@ import { ComparisonConstants } from '../constants/ComparisonConstants'; @Component export struct ComparisonComponent { - @State currentPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageLink('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; @State chooseComparison: ComparisonInfo[] = []; @State map: TreeMap = new TreeMap(); @State defaultAllComparison: ComparisonInfo[] = FundComparisonViewModel.getFundComparisonList(); @@ -156,7 +156,7 @@ export struct ComparisonComponent { width: { bottom: $r('app.float.common_border_width') }, - color: $r('app.color.five_percent_white') + color: $r('app.color.five_percent_white_fund') }) .alignItems(HorizontalAlign.Start) .padding({ @@ -167,7 +167,7 @@ export struct ComparisonComponent { }) } } - .height($r("app.float.list_item_height")) + .height($r('app.float.list_item_height_comparison')) }) } .lanes(this.currentPoint === CommonConstants.BREAK_POINT_SM ? 1 : 2) @@ -188,7 +188,7 @@ export struct ComparisonComponent { Column() { Row({ space: ComparisonConstants.CHOOSE_LIST_SPACE }) { Text($r('app.string.no_currency', this.chooseComparison.length)) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) .onClick(() => { @@ -196,7 +196,7 @@ export struct ComparisonComponent { this.controller.changeIndex(this.tabBarIndex); }) Text($r('app.string.currency_bar', 0)) - .fontSize($r('app.float.tab_text_size')) + .fontSize($r('app.float.tab_text_size_fund')) .lineHeight($r('app.float.common_line_height')) .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) .onClick(() => { @@ -219,7 +219,7 @@ export struct ComparisonComponent { Text(item.name) .fontSize($r('app.float.stack_text_size')) } - .backgroundColor($r('app.color.five_percent_white')) + .backgroundColor($r('app.color.five_percent_white_fund')) .borderRadius($r('app.float.row_border_radius')) .padding({ top: $r('app.float.stack_row_padding_top'), @@ -281,7 +281,7 @@ export struct ComparisonComponent { } Button($r('app.string.start_comparison')) - .backgroundColor($r("app.color.start_button_background")) + .backgroundColor($r('app.color.start_button_background')) .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.start_button_width_sm') : $r('app.float.start_button_width')) .height($r('app.float.start_button_height')) @@ -325,9 +325,6 @@ export struct ComparisonComponent { right: $r('app.float.comparison_padding_right'), bottom: $r('app.float.comparison_padding_bottom') }) - .onBreakpointChange((breakpoints: string) => { - this.currentPoint = breakpoints; - }) } .hideTitleBar(true) } diff --git a/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets b/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets index 34b99689f5e419fc40ebfabdcc5e47e68d691d46..c341be8f1439dd314b03b671211bbb4ced440c61 100644 --- a/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets +++ b/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; import { CommonConstants, RouterConstants } from '@ohos/basic'; import { ComparisonConstants } from '../constants/ComparisonConstants'; import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; @@ -27,6 +26,7 @@ export struct ComparisonDetailComponent { @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); @State isPage: Boolean = false; @StorageProp('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); private nameColorArr: ResourceColor[] = [ $r('app.color.name_color_1'), $r('app.color.name_color_2'), @@ -47,7 +47,7 @@ export struct ComparisonDetailComponent { }) .onClick(() => { if (this.isPage) { - router.back(); + this.pageIndexInfos.pop(); } else { this.pageInfo.pop(); } @@ -58,17 +58,15 @@ export struct ComparisonDetailComponent { .width($r('app.float.common_image')) .height($r('app.float.common_image')) .onClick(() => { - router.back(); + this.pageIndexInfos.pop(); }) } else { Image($r('app.media.ic_public_enlarge')) .width($r('app.float.common_image')) .height($r('app.float.common_image')) .onClick(() => { - router.pushUrl({ - url: RouterConstants.COMPARISON_PAGE_URL, - params: { chooseComparison: this.chooseComparison } - }) + this.pageIndexInfos.pushPathByName(RouterConstants.COMPARISON_PAGE_URL, + { 'chooseComparison': this.chooseComparison } as Record); }) } } @@ -81,7 +79,7 @@ export struct ComparisonDetailComponent { .height($r('app.float.common_image')) .onClick(() => { if (this.isPage) { - router.back(); + this.pageIndexInfos.pop(); } else { this.pageInfo.pop(); } @@ -176,7 +174,7 @@ export struct ComparisonDetailComponent { Divider() .width(CommonConstants.FULL_WIDTH_PERCENT) - .height($r("app.float.common_divider")) + .height($r('app.float.common_divider')) .backgroundColor($r('app.color.divider_background')) .margin({ top: $r('app.float.divider_margin_top'), @@ -214,7 +212,7 @@ export struct ComparisonDetailComponent { }) .width($r('app.float.list_head_width')) .divider({ - strokeWidth: $r("app.float.common_divider"), + strokeWidth: $r('app.float.common_divider'), color: $r('app.color.ten_percent_white') }) @@ -277,12 +275,12 @@ export struct ComparisonDetailComponent { .listStyle() } .divider({ - strokeWidth: $r("app.float.common_divider"), + strokeWidth: $r('app.float.common_divider'), color: $r('app.color.ten_percent_white') }) .width($r('app.float.scroll_list_width')) .border({ - width: $r("app.float.common_divider"), + width: $r('app.float.common_divider'), color: $r('app.color.ten_percent_white') }) }) diff --git a/features/fundComparison/src/main/ets/pages/ComparisonDetailPage.ets b/features/fundComparison/src/main/ets/view/ComparisonDetailPage.ets similarity index 73% rename from features/fundComparison/src/main/ets/pages/ComparisonDetailPage.ets rename to features/fundComparison/src/main/ets/view/ComparisonDetailPage.ets index 57ad670be2232fa6ba6c42d880d4cec548555a34..4b06aa934f06c3e638ffbef21b21141002c4bc8f 100644 --- a/features/fundComparison/src/main/ets/pages/ComparisonDetailPage.ets +++ b/features/fundComparison/src/main/ets/view/ComparisonDetailPage.ets @@ -13,19 +13,18 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; -import { ComparisonDetailComponent } from '../view/ComparisonDetailComponent'; +import { ComparisonDetailComponent } from './ComparisonDetailComponent'; import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; +import { CommonConstants } from '@ohos/basic'; -@Entry @Component -struct ComparisonDetailPage { - @State chooseComparison: ComparisonInfo[] = (router.getParams() as Record)['chooseComparison']; +export struct ComparisonDetailPage { + @State chooseComparison: ComparisonInfo[] = []; build() { Row() { ComparisonDetailComponent({ chooseComparison: this.chooseComparison, isPage: true }) } - .height('100%') + .height(CommonConstants.FULL_HEIGHT_PERCENT) } } \ No newline at end of file diff --git a/features/fundComparison/src/main/module.json5 b/features/fundComparison/src/main/module.json5 index e4dbff6a466381f96d31f089d8aab66e037c4c28..f242d81556965593d2576b5a9b91661a53b2cf11 100644 --- a/features/fundComparison/src/main/module.json5 +++ b/features/fundComparison/src/main/module.json5 @@ -1,14 +1,12 @@ { "module": { "name": "fundComparison", - "type": "shared", + "type": "har", "description": "$string:shared_desc", "deviceTypes": [ "phone", "tablet", "2in1" - ], - "deliveryWithInstall": true, - "pages": "$profile:main_pages" + ] } } \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/element/color.json b/features/fundComparison/src/main/resources/base/element/color.json index 89e96acd2b7ade2f0902efba577d5b27ab3e296a..5aab27af19f11e4e82a92cd24eaad2172d4ec455 100644 --- a/features/fundComparison/src/main/resources/base/element/color.json +++ b/features/fundComparison/src/main/resources/base/element/color.json @@ -9,7 +9,7 @@ "value": "#0dffffff" }, { - "name": "five_percent_white", + "name": "five_percent_white_fund", "value": "#0d000000" }, { diff --git a/features/fundComparison/src/main/resources/base/element/float.json b/features/fundComparison/src/main/resources/base/element/float.json index 439663b89f6cad900be0bb99dbd3d18e757ba3ba..a4195493f66887916b0e24a25febdd63b912ba40 100644 --- a/features/fundComparison/src/main/resources/base/element/float.json +++ b/features/fundComparison/src/main/resources/base/element/float.json @@ -53,7 +53,7 @@ "value": "16vp" }, { - "name": "list_item_height", + "name": "list_item_height_comparison", "value": "64vp" }, { @@ -277,8 +277,8 @@ "value": "80vp" }, { - "name": "tab_text_size", - "value": "16vp" + "name": "tab_text_size_fund", + "value": "16fp" }, { "name": "search_width", diff --git a/features/fundComparison/src/main/resources/base/profile/main_pages.json b/features/fundComparison/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 143a64e30e20c8d58cc7c0deb75ba5a6d6573b31..0000000000000000000000000000000000000000 --- a/features/fundComparison/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "src": [ - "pages/ComparisonDetailPage" - ] -} - diff --git a/features/home/Index.ets b/features/home/Index.ets index 73dd4a70d82ea7cbb7b720290a26d4de94dd62e4..4afbb6428fbc6a1978c03c42d71fc9156b124e01 100644 --- a/features/home/Index.ets +++ b/features/home/Index.ets @@ -1,2 +1,3 @@ -export { AdvertisementDialog } from "./src/main/ets/view/AdvertisementDialog" -export { HomeComponent } from "./src/main/ets/view/HomeComponent" \ No newline at end of file +export { AdvertisementDialog } from './src/main/ets/view/AdvertisementDialog'; +export { HomeComponent } from './src/main/ets/view/HomeComponent'; +export { AccountPage } from './src/main/ets/view/AccountPage'; \ No newline at end of file diff --git a/features/home/hvigorfile.ts b/features/home/hvigorfile.ts index d993120bd71f5f5dfe04480be9dc5f73c00c2599..42187071482d292588ad40babeda74f7b8d97a23 100644 --- a/features/home/hvigorfile.ts +++ b/features/home/hvigorfile.ts @@ -1,6 +1,6 @@ -import { hspTasks } from '@ohos/hvigor-ohos-plugin'; +import { harTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/features/home/src/main/ets/constants/HomeConstants.ets b/features/home/src/main/ets/constants/HomeConstants.ets index e5f96157a83011c7260120ca17933f688df1425c..ca4de3458b043e33cf754062f2f18a5104d954ee 100644 --- a/features/home/src/main/ets/constants/HomeConstants.ets +++ b/features/home/src/main/ets/constants/HomeConstants.ets @@ -50,12 +50,12 @@ export class HomeConstants { /** * List sliding offset. */ - static readonly LIST_SLIDING_OFFSET: number = -750; + static readonly LIST_SLIDING_OFFSET: number = -250; /** * List sliding offset under lg power outage. */ - static readonly LIST_SLIDING_OFFSET_LG: number = -450; + static readonly LIST_SLIDING_OFFSET_LG: number = -150; /** * Get business data start index. diff --git a/features/home/src/main/ets/view/AccountComponent.ets b/features/home/src/main/ets/view/AccountComponent.ets index fda1ed819f89ecb628f78af1027947fc6392ada7..3f42f68575cb779a7db86b10e74f24b87fe2f112 100644 --- a/features/home/src/main/ets/view/AccountComponent.ets +++ b/features/home/src/main/ets/view/AccountComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; import { CommonConstants } from '@ohos/basic/Index'; import { DemandDepositComponent } from './DemandDepositComponent'; import { InvestmentComponent } from './InvestmentComponent'; @@ -22,9 +21,10 @@ import { LiabilitiesComponent } from './LiabilitiesComponent'; @Preview @Component export struct AccountComponent { - @State breakPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; @StorageProp('avoidArea') topHeight: number = 0; @StorageProp('bottom') bottom: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); build() { GridRow({ @@ -53,7 +53,7 @@ export struct AccountComponent { .height($r('app.float.common_image_height')) .fillColor(Color.White) .onClick(() => { - router.back() + this.pageIndexInfos.pop(); }) Text($r('app.string.account_all_info')) .fontSize($r('app.float.account_font_size')) @@ -83,15 +83,13 @@ export struct AccountComponent { $r('app.float.account_margin_top_lg') : $r('app.float.account_margin_top') }) Row() { - Row() { - Text($r('app.string.yesterday_earnings')) - .fontSize($r('app.float.account_small_font_size')) - .fontColor(Color.White) - } - .backgroundColor($r('app.color.five_percent_white')) - .padding($r('app.float.account_padding')) - .borderRadius($r('app.float.earnings_radius')) + Text($r('app.string.yesterday_earnings')) + .fontSize($r('app.float.account_small_font_size')) + .fontColor(Color.White) } + .backgroundColor($r('app.color.five_percent_white')) + .padding($r('app.float.account_padding')) + .borderRadius($r('app.float.earnings_radius')) .margin({ top: $r('app.float.account_margin'), bottom: this.breakPoint === CommonConstants.BREAK_POINT_LG ? @@ -226,9 +224,6 @@ export struct AccountComponent { }) } .backgroundColor($r('app.color.account_background')) - .onBreakpointChange((breakpoints: string) => { - this.breakPoint = breakpoints; - }) } @Builder diff --git a/features/home/src/main/ets/pages/AccountPage.ets b/features/home/src/main/ets/view/AccountPage.ets similarity index 94% rename from features/home/src/main/ets/pages/AccountPage.ets rename to features/home/src/main/ets/view/AccountPage.ets index 1a0b3fb1c996e27f8fab5d9ef348c4675c37c233..6c10a7cf39398e3e403b5ea07e53107367797295 100644 --- a/features/home/src/main/ets/pages/AccountPage.ets +++ b/features/home/src/main/ets/view/AccountPage.ets @@ -15,11 +15,10 @@ import { window } from '@kit.ArkUI'; import { CommonConstants } from '@ohos/basic/Index'; -import { AccountComponent } from '../view/AccountComponent'; +import { AccountComponent } from './AccountComponent'; -@Entry @Component -struct AccountPage { +export struct AccountPage { @StorageProp('avoidArea') topHeight: number = 0; onPageShow() { diff --git a/features/home/src/main/ets/view/DemandDepositComponent.ets b/features/home/src/main/ets/view/DemandDepositComponent.ets index 7dae8d0b1f0eed8a8fd3ec7306c90b00874df8d4..150837770b0753c9b0be5b1badd3d7fa4afb465e 100644 --- a/features/home/src/main/ets/view/DemandDepositComponent.ets +++ b/features/home/src/main/ets/view/DemandDepositComponent.ets @@ -29,7 +29,7 @@ export struct DemandDepositComponent { this.buildImageArrowRight() } .justifyContent(FlexAlign.SpaceBetween) - .height($r("app.float.account_common_height")) + .height($r('app.float.account_common_height')) Text($r('app.string.save_card_account')) .fontSize($r('app.float.account_big_font')) @@ -46,7 +46,7 @@ export struct DemandDepositComponent { this.buildImageArrowRight() } .justifyContent(FlexAlign.SpaceBetween) - .height($r("app.float.account_common_height")) + .height($r('app.float.account_common_height')) Text($r('app.string.current_deposit_count')) .fontSize($r('app.float.account_big_font')) .lineHeight($r('app.float.common_line_height')) @@ -61,7 +61,7 @@ export struct DemandDepositComponent { this.buildImageArrowRight() } .justifyContent(FlexAlign.SpaceBetween) - .height($r("app.float.account_common_height")) + .height($r('app.float.account_common_height')) Column() { Text($r('app.string.day_day_count')) .fontSize($r('app.float.account_big_font')) @@ -206,7 +206,7 @@ export struct DemandDepositComponent { function buildDemandRowStyles() { .width(CommonConstants.FULL_WIDTH_PERCENT) .justifyContent(FlexAlign.SpaceBetween) - .height($r("app.float.account_common_height")) + .height($r('app.float.account_common_height')) } @Extend(Column) diff --git a/features/home/src/main/ets/view/HomeComponent.ets b/features/home/src/main/ets/view/HomeComponent.ets index b07278e85ca87ff3570047d1f1586d2501a859f7..c51f4125864a46fc1fed2c8d901375a7b60a05e2 100644 --- a/features/home/src/main/ets/view/HomeComponent.ets +++ b/features/home/src/main/ets/view/HomeComponent.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { router } from '@kit.ArkUI'; import { BreakpointUtil, BusinessInfo, CommonConstants, RouterConstants } from '@ohos/basic'; import { HomeConstants } from '../constants/HomeConstants'; import HomeViewModel from '../viewmodel/HomeViewModel'; @@ -22,6 +21,7 @@ import HomeViewModel from '../viewmodel/HomeViewModel'; export struct HomeComponent { @Prop currentPoint: string = CommonConstants.BREAK_POINT_SM; @Link scrollY: number; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); private offsetValue: number = 0; build() { @@ -57,13 +57,13 @@ export struct HomeComponent { .placeholderColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || (this.currentPoint === CommonConstants.BREAK_POINT_LG && this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? - $r('app.color.sixty_percent_black') : $r('app.color.sixty_percent_white')) + $r('app.color.sixty_percent_black_home') : $r('app.color.sixty_percent_white_home')) .enableKeyboardOnFocus(false) .searchIcon({ color: this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || (this.currentPoint === CommonConstants.BREAK_POINT_LG && this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? - $r('app.color.sixty_percent_black') : $r('app.color.sixty_percent_white') + $r('app.color.sixty_percent_black_home') : $r('app.color.sixty_percent_white_home') }) Image($r('app.media.ic_public_comments')) @@ -173,9 +173,7 @@ export struct HomeComponent { .width(CommonConstants.FULL_WIDTH_PERCENT) .borderRadius($r('app.float.list_image_radius')) .onClick(() => { - router.pushUrl({ - url: RouterConstants.FUNDING_URL - }) + this.pageIndexInfos.pushPathByName(RouterConstants.FUNDING_URL, null); }) } }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) @@ -193,12 +191,12 @@ export struct HomeComponent { bottom: $r('app.float.common_height') }) .scrollBar(BarState.Off) - .onScroll((xOffset: number, yOffset: number) => { + .onWillScroll((xOffset: number, yOffset: number) => { this.offsetValue = this.offsetValue - yOffset; if (this.offsetValue > 0) { this.offsetValue = 0; } - this.scrollY = vp2px(this.offsetValue) + this.scrollY = vp2px(this.offsetValue); }) } .height(CommonConstants.FULL_HEIGHT_PERCENT) @@ -226,9 +224,7 @@ export struct HomeComponent { } .onClick(() => { if (item.router) { - router.pushUrl({ - url: item.router - }) + this.pageIndexInfos.pushPathByName(item.router, null); } }) } else { @@ -257,9 +253,7 @@ export struct HomeComponent { .backgroundColor($r('app.color.business_background')) .onClick(() => { if (item.router) { - router.pushUrl({ - url: item.router - }) + this.pageIndexInfos.pushPathByName(item.router, null); } }) } diff --git a/features/home/src/main/ets/view/LiabilitiesComponent.ets b/features/home/src/main/ets/view/LiabilitiesComponent.ets index 7b04cdb53834b045e45390a3cc96e5d26abcff82..f274054fbda3684cd032d492187480cc706f8a47 100644 --- a/features/home/src/main/ets/view/LiabilitiesComponent.ets +++ b/features/home/src/main/ets/view/LiabilitiesComponent.ets @@ -21,127 +21,125 @@ export struct LiabilitiesComponent { build() { Column() { - Column() { - Row() { - Text($r('app.string.credit_card_account')) - .fontSize($r('app.float.account_font_size')) - .lineHeight($r('app.float.common_line_height')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - Image($r('app.media.ic_public_more_list')) - .width($r('app.float.common_image_width')) - .height($r('app.float.common_image_height')) - } - .buildRowStyles() + Row() { + Text($r('app.string.credit_card_account')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Image($r('app.media.ic_public_more_list')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + } + .buildRowStyles() - Flex({ - direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row - }) { - if (this.breakPoint !== CommonConstants.BREAK_POINT_SM) { - Column() { - Row() { - Text($r('app.string.remaining_available_count')) - .fontSize(this.breakPoint === CommonConstants.BREAK_POINT_LG ? - $r('app.float.account_big_font') : $r('app.float.account_font_size')) - .lineHeight($r('app.float.common_line_height')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - this.buildImageArrowRight() - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - Row() { - Text($r('app.string.remaining_available_amount')) - .fontSize($r('app.float.account_small_font_size')) - .lineHeight($r('app.float.small_line_height')) - .opacity(0.6) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.Start) + Flex({ + direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row + }) { + if (this.breakPoint !== CommonConstants.BREAK_POINT_SM) { + Column() { + Row() { + Text($r('app.string.remaining_available_count')) + .fontSize(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_big_font') : $r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() } - Divider() - .vertical(true) - .height($r('app.float.liabilities_divider_height')) - .width($r('app.float.divider_width')) - .color($r('app.color.divider_color')) - .margin({ - left: $r('app.float.divider_margin'), - right: $r('app.float.divider_margin') - }) - Column() { - Row() { - Text($r('app.string.remaining_due_count')) - .fontSize(this.breakPoint === CommonConstants.BREAK_POINT_LG ? - $r('app.float.account_big_font') : $r('app.float.account_font_size')) - .lineHeight($r('app.float.common_line_height')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - this.buildImageArrowRight() - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - Row() { - Text($r('app.string.remaining_due')) - .fontSize($r('app.float.amount_font_size')) - .lineHeight($r('app.float.small_line_height')) - .opacity(0.6) - } - .width(CommonConstants.FULL_WIDTH_PERCENT) - .justifyContent(FlexAlign.Start) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + Row() { + Text($r('app.string.remaining_available_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) } - } else { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + } + Divider() + .vertical(true) + .height($r('app.float.liabilities_divider_height')) + .width($r('app.float.divider_width')) + .color($r('app.color.divider_color')) + .margin({ + left: $r('app.float.divider_margin'), + right: $r('app.float.divider_margin') + }) + Column() { Row() { - Text() { - Span($r('app.string.remaining_available_amount')) - .fontSize($r('app.float.account_small_font_size')) - .lineHeight($r('app.float.small_line_height')) - .opacity(0.6) - Span($r('app.string.remaining_available_count')) - .fontSize($r('app.float.account_font_size')) - .lineHeight($r('app.float.small_line_height')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - } + Text($r('app.string.remaining_due_count')) + .fontSize(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_big_font') : $r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) this.buildImageArrowRight() } - .buildRowStyles() - + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) Row() { - Text() { - Span($r('app.string.remaining_due')) - .fontSize($r('app.float.amount_font_size')) - .lineHeight($r('app.float.small_line_height')) - .opacity(0.6) - Span($r('app.string.remaining_due_count')) - .fontSize($r('app.float.account_font_size')) - .lineHeight($r('app.float.common_line_height')) - .fontWeight(CommonConstants.FONT_WEIGHT_500) - } - this.buildImageArrowRight() + Text($r('app.string.remaining_due')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) } - .buildRowStyles() + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) } + } else { + Row() { + Text() { + Span($r('app.string.remaining_available_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + Span($r('app.string.remaining_available_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.small_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + .buildRowStyles() + + Row() { + Text() { + Span($r('app.string.remaining_due')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + Span($r('app.string.remaining_due_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + .buildRowStyles() } - .height($r('app.float.liabilities_item_height')) } - .margin({ - right: new BreakpointUtil({ - sm: $r('app.float.account_margin'), - md: $r('app.float.margin_common'), - lg: 0 - }).getValue(this.breakPoint), - left: new BreakpointUtil({ - sm: $r('app.float.account_margin'), - md: $r('app.float.margin_common'), - lg: 0 - }).getValue(this.breakPoint) - }) - .padding({ - top: $r('app.float.account_item_padding_tb'), - bottom: $r('app.float.account_item_padding_tb'), - right: $r('app.float.account_item_padding_rl'), - left: $r('app.float.account_item_padding_rl') - }) - .backgroundColor(Color.White) - .borderRadius($r('app.float.common_radius')) + .height($r('app.float.liabilities_item_height')) } .height($r('app.float.liabilities_height')) + .margin({ + right: new BreakpointUtil({ + sm: $r('app.float.account_margin'), + md: $r('app.float.margin_common'), + lg: 0 + }).getValue(this.breakPoint), + left: new BreakpointUtil({ + sm: $r('app.float.account_margin'), + md: $r('app.float.margin_common'), + lg: 0 + }).getValue(this.breakPoint) + }) + .padding({ + top: $r('app.float.account_item_padding_tb'), + bottom: $r('app.float.account_item_padding_tb'), + right: $r('app.float.account_item_padding_rl'), + left: $r('app.float.account_item_padding_rl') + }) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) } @Builder diff --git a/features/home/src/main/ets/viewmodel/HomeViewModel.ets b/features/home/src/main/ets/viewmodel/HomeViewModel.ets index 87c7c27233f4a2554521c9f2a23971bb21a9657f..a7b049780241b8500193df678d4270e2268068bf 100644 --- a/features/home/src/main/ets/viewmodel/HomeViewModel.ets +++ b/features/home/src/main/ets/viewmodel/HomeViewModel.ets @@ -97,16 +97,16 @@ class HomeViewModel { new BusinessInfo($r('app.media.ic_list_paper'), $r('app.string.home_list')), new BusinessInfo($r('app.media.ic_list_contracts'), $r('app.string.home_list')), new BusinessInfo($r('app.media.ic_list_hello'), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_money"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')), - new BusinessInfo($r("app.media.ic_list_business"), $r('app.string.home_list')) + new BusinessInfo($r('app.media.ic_list_money'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')), + new BusinessInfo($r('app.media.ic_list_business'), $r('app.string.home_list')) ]; return listBusinessInfoList; } diff --git a/features/home/src/main/module.json5 b/features/home/src/main/module.json5 index 2c96c8af59454cd5dba40d59fa9e3a555e0a4d26..0d2d567275cbb9fb91c8a070cb5f5de143475e41 100644 --- a/features/home/src/main/module.json5 +++ b/features/home/src/main/module.json5 @@ -1,14 +1,12 @@ { "module": { "name": "home", - "type": "shared", + "type": "har", "description": "$string:shared_desc", "deviceTypes": [ "phone", "tablet", "2in1" - ], - "deliveryWithInstall": true, - "pages": "$profile:main_pages" + ] } } \ No newline at end of file diff --git a/features/home/src/main/resources/base/element/color.json b/features/home/src/main/resources/base/element/color.json index ded0fa9f0239347754a548c7ddabccebd12cfc65..ecb94f3781b51e5866e41a3e7d8706dd61d6583b 100644 --- a/features/home/src/main/resources/base/element/color.json +++ b/features/home/src/main/resources/base/element/color.json @@ -13,11 +13,11 @@ "value": "#0D000000" }, { - "name": "sixty_percent_white", + "name": "sixty_percent_white_home", "value": "#99FFFFFF" }, { - "name": "sixty_percent_black", + "name": "sixty_percent_black_home", "value": "#99000000" }, { diff --git a/features/home/src/main/resources/base/profile/main_pages.json b/features/home/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 0a9ce6b81bec5c263d66af60e5e0425958b38988..0000000000000000000000000000000000000000 --- a/features/home/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "src": [ - "pages/AccountPage" - ] -} - diff --git a/features/transaction/Index.ets b/features/transaction/Index.ets index 7ef2174e4149976207a9863fb359f0b488a4d445..c4539903430c121861dd9c076f55029e0ff9d660 100644 --- a/features/transaction/Index.ets +++ b/features/transaction/Index.ets @@ -1 +1 @@ -export { TransactionComponent } from "./src/main/ets/view/TransactionComponent" \ No newline at end of file +export { TransactionComponent } from './src/main/ets/view/TransactionComponent'; \ No newline at end of file diff --git a/features/transaction/hvigorfile.ts b/features/transaction/hvigorfile.ts index d993120bd71f5f5dfe04480be9dc5f73c00c2599..42187071482d292588ad40babeda74f7b8d97a23 100644 --- a/features/transaction/hvigorfile.ts +++ b/features/transaction/hvigorfile.ts @@ -1,6 +1,6 @@ -import { hspTasks } from '@ohos/hvigor-ohos-plugin'; +import { harTasks } from '@ohos/hvigor-ohos-plugin'; export default { - system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ } diff --git a/features/transaction/src/main/ets/view/TransactionComponent.ets b/features/transaction/src/main/ets/view/TransactionComponent.ets index b3f682366e544a65f02ab82a3e9f770a26ee08f7..9047f079d4df03896137b9cc7e40ef82edc943dc 100644 --- a/features/transaction/src/main/ets/view/TransactionComponent.ets +++ b/features/transaction/src/main/ets/view/TransactionComponent.ets @@ -94,7 +94,7 @@ export struct TransactionComponent { Row() { Text($r('app.string.payment_account')) .fontSize($r('app.float.payment_size')) - .fontColor($r("app.color.common_text")) + .fontColor($r('app.color.common_text')) .lineHeight($r('app.float.payment_text_height')) Image($r('app.media.ic_public_arrow_right')) .width($r('app.float.arrow_width')) @@ -171,11 +171,11 @@ export struct TransactionComponent { right: $r('app.float.input_margin') }) Button($r('app.string.buy_all')) - .backgroundColor($r("app.color.button_buy_background")) + .backgroundColor($r('app.color.button_buy_background')) .width($r('app.float.button_buy_width')) .height($r('app.float.button_buy_height')) .fontSize($r('app.float.button_buy_size')) - .fontColor($r("app.color.button_buy")) + .fontColor($r('app.color.button_buy')) .fontWeight(CommonConstants.FONT_WEIGHT_500) } .width(CommonConstants.FULL_WIDTH_PERCENT) @@ -186,11 +186,11 @@ export struct TransactionComponent { }) Row() { - Text($r("app.string.confirm_share_prompt", TransactionConstants.RATE_VALUE, + Text($r('app.string.confirm_share_prompt', TransactionConstants.RATE_VALUE, TransactionConstants.RATE_MOUTH, TransactionConstants.RATE_DAY)) - .fontSize($r("app.float.confirm_size")) - .fontColor($r("app.color.common_text")) - .lineHeight($r("app.float.confirm_text_height")) + .fontSize($r('app.float.confirm_size')) + .fontColor($r('app.color.common_text')) + .lineHeight($r('app.float.confirm_text_height')) } .width(CommonConstants.FULL_WIDTH_PERCENT) .justifyContent(FlexAlign.Start) @@ -203,7 +203,7 @@ export struct TransactionComponent { width: { top: $r('app.float.confirm_border_width') }, - color: $r("app.color.confirm_border") + color: $r('app.color.confirm_border') }) } .height($r('app.float.buy_info_height')) diff --git a/features/transaction/src/main/module.json5 b/features/transaction/src/main/module.json5 index 75c75d3ed9621d929aa835ba809bd7dd7fd80bd5..0366a6ce273b4a73707ed62e0f0f88e40342700b 100644 --- a/features/transaction/src/main/module.json5 +++ b/features/transaction/src/main/module.json5 @@ -1,13 +1,12 @@ { "module": { "name": "transaction", - "type": "shared", + "type": "har", "description": "$string:shared_desc", "deviceTypes": [ "phone", "tablet", "2in1" - ], - "deliveryWithInstall": true + ] } } \ No newline at end of file diff --git a/oh-package.json5 b/oh-package.json5 index ee60940578fe69253b703fed4ea5356c33672933..937148751f46d6dc971bb87e8fdd35911931dc54 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -2,7 +2,6 @@ "modelVersion": "5.0.0", "license": "", "devDependencies": { - "@ohos/hypium": "1.0.15" }, "author": "", "name": "multifinancialmanagement", diff --git a/product/phone/oh-package.json5 b/product/phone/oh-package.json5 index 9f0ccdfaf85230f64ec33ce0f62e12fa0dc70efc..7a777161c5d81f1f467c7ff5f9f2c123e7a151d4 100644 --- a/product/phone/oh-package.json5 +++ b/product/phone/oh-package.json5 @@ -9,6 +9,8 @@ "dynamicDependencies": {}, "dependencies": { "@ohos/basic": "file:../../commons/basic", - "@ohos/home": "file:../../features/home" + "@ohos/home": "file:../../features/home", + "@ohos/fund": "file:../../features/fund", + "@ohos/fundComparison": "file:../../features/fundComparison" } } diff --git a/product/phone/src/main/ets/entryability/EntryAbility.ets b/product/phone/src/main/ets/entryability/EntryAbility.ets index df3ac1fd36aabad56c62d7c6fc5657223159d19d..a7dbce920e78486514c9cc450e3718ce8f5bb4c1 100644 --- a/product/phone/src/main/ets/entryability/EntryAbility.ets +++ b/product/phone/src/main/ets/entryability/EntryAbility.ets @@ -16,9 +16,12 @@ import { UIAbility, Want, AbilityConstant } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; +import { display, window } from '@kit.ArkUI'; +import { CommonConstants } from '@ohos/basic'; export default class EntryAbility extends UIAbility { + private windowObj?: window.Window; + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } @@ -31,6 +34,14 @@ export default class EntryAbility extends UIAbility { // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + windowStage.getMainWindow().then((data: window.Window) => { + this.windowObj = data; + this.updateBreakpoint(this.windowObj.getWindowProperties().windowRect.width); + this.windowObj.on('windowSizeChange', (windowSize: window.Size) => { + this.updateBreakpoint(windowSize.width); + }) + }) + windowStage.loadContent('pages/Index', (err: BusinessError, data) => { if (err.code) { hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); @@ -40,6 +51,19 @@ export default class EntryAbility extends UIAbility { }); } + private updateBreakpoint(windowWidth: number): void{ + let windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels; + let curBp: string = ''; + if (windowWidthVp < CommonConstants.BREAK_POINTS_VALUE_NUMBER[1]) { + curBp = CommonConstants.BREAK_POINT_SM; + } else if (windowWidthVp < CommonConstants.BREAK_POINTS_VALUE_NUMBER[2]) { + curBp = CommonConstants.BREAK_POINT_MD; + } else { + curBp = CommonConstants.BREAK_POINT_LG; + } + AppStorage.setOrCreate('breakPoint', curBp); + } + onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); diff --git a/product/phone/src/main/ets/pages/Index.ets b/product/phone/src/main/ets/pages/Index.ets index 83cce84d0b608e46788f2cbf18665ede9f8aa7d7..7889791fcf5811bca92a3521d15c02d80e46e747 100644 --- a/product/phone/src/main/ets/pages/Index.ets +++ b/product/phone/src/main/ets/pages/Index.ets @@ -13,9 +13,11 @@ * limitations under the License. */ -import { BreakpointUtil, CommonConstants } from '@ohos/basic'; -import { AdvertisementDialog, HomeComponent } from '@ohos/home'; import { window } from '@kit.ArkUI'; +import { BreakpointUtil, CommonConstants, RouterConstants } from '@ohos/basic'; +import { AccountPage, AdvertisementDialog, HomeComponent } from '@ohos/home'; +import { Funding, FundingDetail, TrendsPage } from '@ohos/fund'; +import { ComparisonDetailPage, ComparisonInfo } from '@ohos/fundComparison'; @Entry @Component @@ -25,6 +27,7 @@ struct Index { @StorageProp('avoidArea') topHeight: number = 0; @StorageProp('bottom') bottom: number = 0; @State backgroundImageY: number = 0; + @StorageLink('pageIndexInfos') pageIndexInfos: NavPathStack = new NavPathStack(); dialogController: CustomDialogController = new CustomDialogController({ builder: AdvertisementDialog(), backgroundColor: $r('app.color.dialog_background'), @@ -62,7 +65,7 @@ struct Index { getTabBarColor(index: number, currentTabIndex: number, breakPoint: string): ResourceColor { if (this.backgroundImageY < -20 && this.currentTabIndex === 0 && index === 0) { return $r('app.color.tab_choose_image') - } else if (index === 0 && breakPoint === CommonConstants.BREAK_POINT_LG ) { + } else if (index === 0 && breakPoint === CommonConstants.BREAK_POINT_LG) { return currentTabIndex === index ? Color.White : $r('app.color.tab_un_image'); } return currentTabIndex === index ? $r('app.color.tab_choose_image') : $r('app.color.tab_un_image'); @@ -97,89 +100,134 @@ struct Index { } } + @Builder + PagesMap(name: string, param?: object) { + if (name === RouterConstants.FUNDING_URL) { + Funding() + } else if (name === RouterConstants.ACCOUNT_PAGE_URL) { + NavDestination() { + AccountPage() + } + .hideTitleBar(true) + .onWillShow(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(false); + }) + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(true); + }) + }) + } else if (name === RouterConstants.FUNDING_DETAIL_URL) { + FundingDetail({ index: (param as Record)['listIndex'] }) + } else if (name === RouterConstants.TRENDS_PAGE_URL) { + TrendsPage({ name: (param as Record)['name'] }) + } else if (name === RouterConstants.COMPARISON_PAGE_URL) { + NavDestination() { + ComparisonDetailPage({ chooseComparison: (param as Record)['chooseComparison'] }) + } + .hideTitleBar(true) + .onWillShow(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(false); + }) + }) + .onWillDisappear(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + windowStage.setWindowLayoutFullScreen(true); + }) + }) + } + } + build() { - GridRow({ - breakpoints: { - value: CommonConstants.BREAK_POINTS_VALUE, - reference: BreakpointsReference.WindowSize - }, - columns: { - sm: CommonConstants.COLUMN_SM, - md: CommonConstants.COLUMN_MD, - lg: CommonConstants.COLUMN_LG - }, - direction: GridRowDirection.Row - }) { - GridCol({ - span: { + Navigation(this.pageIndexInfos) { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.WindowSize + }, + columns: { sm: CommonConstants.COLUMN_SM, md: CommonConstants.COLUMN_MD, lg: CommonConstants.COLUMN_LG - } + }, + direction: GridRowDirection.Row }) { - Column() { - Tabs({ - barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End - }) { - TabContent() { - HomeComponent({ - currentPoint: this.breakPoint, - scrollY: this.backgroundImageY - }) - .margin({ - top: this.topHeight + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Tabs({ + barPosition: this.breakPoint === CommonConstants.BREAK_POINT_LG ? BarPosition.Start : BarPosition.End + }) { + TabContent() { + HomeComponent({ + currentPoint: this.breakPoint, + scrollY: this.backgroundImageY }) - } - .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) + .margin({ + top: this.topHeight + }) + } + .tabBar(this.BuildTabs($r('app.media.ic_public_home_filled'), $r('app.string.tab_bar_home'), 0)) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) - .backgroundColor(Color.White) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_public_cards_filled'), $r('app.string.tab_bar_card'), 1)) + .backgroundColor(Color.White) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) - .backgroundColor(Color.White) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_home_fortunes'), $r('app.string.tab_bar_fortunes'), 2)) + .backgroundColor(Color.White) - TabContent() { - } - .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) - .backgroundColor(Color.White) + TabContent() { + } + .tabBar(this.BuildTabs($r('app.media.ic_life_filled'), $r('app.string.tab_bar_life'), 3)) + .backgroundColor(Color.White) - TabContent() { + TabContent() { + } + .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), + $r('app.string.tab_bar_mine'), 4)) + .backgroundColor(Color.White) } - .tabBar(this.BuildTabsMine($r('app.media.ic_home_mine'), $r('app.media.ic_home_mine_filled'), - $r('app.string.tab_bar_mine'), 4)) - .backgroundColor(Color.White) - } - .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) - .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? - $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) - .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + .vertical(this.breakPoint === CommonConstants.BREAK_POINT_LG) + .barWidth(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.tab_bar_width') : CommonConstants.TAB_BAR_HEIGHT_PERCENT) + .barHeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.TAB_HEIGHT_PERCENT : $r('app.float.tab_bar_height')) - .backgroundImage(this.currentTabIndex === 0 ? new BreakpointUtil({ - sm: $r('app.media.ic_home_phone_background'), - md: $r('app.media.ic_home_fold_background'), - lg: $r('app.media.ic_home_tablet_background') - }).getValue(this.breakPoint) : $r('app.media.ic_home_not_background')) - .backgroundImageSize(ImageSize.Contain) - .backgroundImagePosition({ - y: this.backgroundImageY - }) - .backgroundColor($r('app.color.home_background')) - .scrollable(false) - .onChange((index: number) => { - this.currentTabIndex = index; - }) - .padding({ - bottom: this.bottom - }) + .backgroundImage(this.currentTabIndex === 0 ? new BreakpointUtil({ + sm: $r('app.media.ic_home_phone_background'), + md: $r('app.media.ic_home_fold_background'), + lg: $r('app.media.ic_home_tablet_background') + }).getValue(this.breakPoint) : $r('app.media.ic_home_not_background')) + .backgroundImageSize(ImageSize.Contain) + .backgroundImagePosition({ + y: this.backgroundImageY + }) + .backgroundColor($r('app.color.home_background')) + .scrollable(false) + .onChange((index: number) => { + this.currentTabIndex = index; + }) + .padding({ + bottom: this.bottom + }) + } } } } - .onBreakpointChange((breakpoints: string) => { - this.breakPoint = breakpoints; - }) + .mode(NavigationMode.Stack) + .navDestination(this.PagesMap) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .hideTitleBar(true) + .hideToolBar(true) } } \ No newline at end of file diff --git a/product/phone/src/main/module.json5 b/product/phone/src/main/module.json5 index 49a824afca5e998dc28129d8f5733655a93fc1ad..3ef13f42c4677c39fe11d9c046a48dabf137bd76 100644 --- a/product/phone/src/main/module.json5 +++ b/product/phone/src/main/module.json5 @@ -17,7 +17,7 @@ "name": "EntryAbility", "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", - "icon": "$media:icon", + "icon": "$media:layered_image", "label": "$string:EntryAbility_label", "startWindowIcon": "$media:startIcon", "startWindowBackground": "$color:start_window_background", diff --git a/product/phone/src/main/resources/base/media/background.png b/product/phone/src/main/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d Binary files /dev/null and b/product/phone/src/main/resources/base/media/background.png differ diff --git a/product/phone/src/main/resources/base/media/foreground.png b/product/phone/src/main/resources/base/media/foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902 Binary files /dev/null and b/product/phone/src/main/resources/base/media/foreground.png differ diff --git a/product/phone/src/main/resources/base/media/layered_image.json b/product/phone/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a --- /dev/null +++ b/product/phone/src/main/resources/base/media/layered_image.json @@ -0,0 +1,7 @@ +{ + "layered-image": + { + "background" : "$media:background", + "foreground" : "$media:foreground" + } +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/startIcon.png b/product/phone/src/main/resources/base/media/startIcon.png index 366f76459ffd4494ec40d0ddd5c59385b9c5da11..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b 100644 Binary files a/product/phone/src/main/resources/base/media/startIcon.png and b/product/phone/src/main/resources/base/media/startIcon.png differ diff --git a/screenshots/device/config.png b/screenshots/device/config.png deleted file mode 100644 index 52b87b948de7a123f87ce851f0aa414750fb1342..0000000000000000000000000000000000000000 Binary files a/screenshots/device/config.png and /dev/null differ