diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..bea217714e212db8b7bf8a2e12c3346af5d676b9 --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.huawei.multifinancialmanagement", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..747b13ddc8f562513a73ad70009a15fd6d4d73e6 --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MultiFinancialManagement" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/AppScope/resources/base/media/app_icon.png differ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 --- /dev/null +++ b/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + + 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. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 1fac68091e3c0de2f86d4d1a62f3565031ac0c00..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# MultiFinancialManagement - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 8ebe3fc0cbdec73565dc0f84bbc81f35031ab942..51ea3ff8fd950eaf093ae212a043936358929f25 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,42 @@ -# MultiFinancialManagement +# 优秀实践-一次开发,多端部署-银行理财(ArkTS) -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} +### 简介 -#### 软件架构 -软件架构说明 +基于自适应和响应式布局,实现一次开发、多端部署银行理财。 +手机效果图如下: -#### 安装教程 +![](screenshots/device/phone.png) -1. xxxx -2. xxxx -3. xxxx +折叠屏效果图如下: -#### 使用说明 +![](screenshots/device/foldable.png) -1. xxxx -2. xxxx -3. xxxx +平板效果图如下: -#### 参与贡献 +![](screenshots/device/pad.png) -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +### 相关权限 +不涉及 -#### 特技 +### 使用说明 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +1. 分别在手机、折叠屏、平板安装并打开应用,不同设备的应用页面通过响应式布局和自适应布局呈现不同的效果。 +2. 点击界面内财富精选下的图片跳转到产品详情页。 +3. 点击界面内稳健增长内容跳转到基金详情页。 +4. 点击基金详情页下方对比跳转至基金比较页。 +5. 基金详情页勾选基金后点击开始对比跳转至基金比较页。 + +### 约束与限制 + +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) diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4fb1e6f33233556c1caa56be2fd142cb9ed50fa8 --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,95 @@ +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug" + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "phone", + "srcPath": "./product/phone", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "basic", + "srcPath": "./commons/basic", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "home", + "srcPath": "./features/home", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "fund", + "srcPath": "./features/fund", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "fundComparison", + "srcPath": "./features/fundComparison", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "transaction", + "srcPath": "./features/transaction", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/commons/basic/Index.ets b/commons/basic/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..368ea5fd149bbb17dbae7c1b7b405c4bbed2174b --- /dev/null +++ b/commons/basic/Index.ets @@ -0,0 +1,5 @@ +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" diff --git a/commons/basic/build-profile.json5 b/commons/basic/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/commons/basic/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/commons/basic/hvigorfile.ts b/commons/basic/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..d993120bd71f5f5dfe04480be9dc5f73c00c2599 --- /dev/null +++ b/commons/basic/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/commons/basic/obfuscation-rules.txt b/commons/basic/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/commons/basic/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/commons/basic/oh-package.json5 b/commons/basic/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a17234d269b9b51ca36a6cf80ed5722d21ae730a --- /dev/null +++ b/commons/basic/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "basic", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/commons/basic/src/main/ets/constants/CommonConstants.ets b/commons/basic/src/main/ets/constants/CommonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..7579dec3ca7b7863ddedc6280f4fc1cf9f9bfa99 --- /dev/null +++ b/commons/basic/src/main/ets/constants/CommonConstants.ets @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Common constants for all features. + */ +export class CommonConstants { + /** + * Breakpoint xs. + */ + static readonly BREAK_POINT_XS: string = 'xs'; + + /** + * Breakpoint sm. + */ + static readonly BREAK_POINT_SM: string = 'sm'; + + /** + * Breakpoint md. + */ + static readonly BREAK_POINT_MD: string = 'md'; + + /** + * Breakpoint lg. + */ + static readonly BREAK_POINT_LG: string = 'lg'; + + /** + * The break point value. + */ + static readonly BREAK_POINTS_VALUE: Array = ['320vp', '600vp', '840vp']; + + /** + * The number of columns for SM device. + */ + static readonly COLUMN_SM: number = 4; + + /** + * The number of columns for MD device. + */ + static readonly COLUMN_MD: number = 8; + + /** + * The number of columns for LG device. + */ + static readonly COLUMN_LG: number = 12; + + /** + * The full percentage of component. + */ + static readonly FULL_WIDTH_PERCENT: string = '100%'; + + /** + * The full percentage of component. + */ + static readonly FULL_HEIGHT_PERCENT: string = '100%'; + + /** + * Tab bar height. + */ + static readonly TAB_BAR_HEIGHT_PERCENT: string = '100%'; + + /** + * Tab height. + */ + static readonly TAB_HEIGHT_PERCENT: string = '50%'; + + /** + * Navigation path key of detail. + */ + static readonly PATH_DETAIL: string = 'detail'; + + /** + * Navigation path key of comparison. + */ + static readonly PATH_COMPARISON: string = 'comparison'; + + /** + * Navigation path key of comparisonDetail. + */ + static readonly PATH_COMPARISON_DETAIL: string = 'comparisonDetail'; + + /** + * Navigation path key of buying. + */ + static readonly PATH_BUYING: string = 'buying'; + + /** + * Common font weight. + */ + static readonly FONT_WEIGHT_500: number = 500; + + /** + * Common font weight. + */ + static readonly FONT_WEIGHT_700: number = 700; + + /** + * Common font family. + */ + static readonly FONT_FAMILY_HEI_TI: string = 'HarmonyHeiTi-Medium'; +} \ No newline at end of file diff --git a/commons/basic/src/main/ets/constants/RouterConstants.ets b/commons/basic/src/main/ets/constants/RouterConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cac490f68d25c1009ebc900b5f1e572d258065a --- /dev/null +++ b/commons/basic/src/main/ets/constants/RouterConstants.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Router constants for all features. + */ +export class RouterConstants { + /** + * The funding detail page url. + */ + static readonly FUNDING_DETAIL_URL: string = '@bundle:com.huawei.multifinancialmanagement/fund/ets/pages/FundingDetail'; + + /** + * The funding page url. + */ + static readonly FUNDING_URL: string = '@bundle:com.huawei.multifinancialmanagement/fund/ets/pages/Funding'; + + /** + * The trends page url. + */ + static readonly TRENDS_PAGE_URL: string = '@bundle:com.huawei.multifinancialmanagement/fund/ets/pages/TrendsPage'; + + /** + * The comparison detail page url. + */ + static readonly COMPARISON_PAGE_URL: string = '@bundle:com.huawei.multifinancialmanagement/fundComparison/ets/pages/ComparisonDetailPage'; + + /** + * The comparison detail page url. + */ + static readonly ACCOUNT_PAGE_URL: string = '@bundle:com.huawei.multifinancialmanagement/home/ets/pages/AccountPage'; +} \ No newline at end of file diff --git a/commons/basic/src/main/ets/utils/BreakpointUtil.ets b/commons/basic/src/main/ets/utils/BreakpointUtil.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7f4413f067fc9a4e98bbb03243210d9d36f88e4 --- /dev/null +++ b/commons/basic/src/main/ets/utils/BreakpointUtil.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 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. + */ + +declare interface BreakPointOption extends Record { + sm?: T, + md?: T, + lg?: T, + xl?: T, + xxl?: T +} + +export class BreakpointUtil { + options: BreakPointOption; + + constructor(option: BreakPointOption) { + this.options = option; + } + + getValue(currentPoint: string): T { + return this.options[currentPoint] as T; + } +} \ No newline at end of file diff --git a/commons/basic/src/main/ets/viewmodel/BusinessInfo.ets b/commons/basic/src/main/ets/viewmodel/BusinessInfo.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed1f34b617d1dede967aecc6a725b584c98e8747 --- /dev/null +++ b/commons/basic/src/main/ets/viewmodel/BusinessInfo.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Home page information entity class. + */ +export class BusinessInfo { + icon: Resource; + text: ResourceStr; + router?: string; + iconBig?: Resource; + + constructor(icon: Resource, text: ResourceStr, iconBig?: Resource, router?: string) { + this.icon = icon; + this.text = text; + this.iconBig = iconBig + this.router = router; + } +} \ No newline at end of file diff --git a/commons/basic/src/main/ets/viewmodel/FundDetail.ets b/commons/basic/src/main/ets/viewmodel/FundDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..babf9f6d289df8ef0e21b225badccf66202435c5 --- /dev/null +++ b/commons/basic/src/main/ets/viewmodel/FundDetail.ets @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Basic fund information. + */ +export class FundDetail { + name: ResourceStr; + amplitude: ResourceStr; + + constructor(name: ResourceStr, amplitude: ResourceStr) { + this.name = name; + this.amplitude = amplitude; + } +} \ No newline at end of file diff --git a/commons/basic/src/main/module.json5 b/commons/basic/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a68c576c9763e64432082ae025e6bcdda1d72826 --- /dev/null +++ b/commons/basic/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "basic", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true + } +} \ No newline at end of file diff --git a/commons/basic/src/main/resources/base/element/color.json b/commons/basic/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/commons/basic/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/commons/basic/src/main/resources/base/element/string.json b/commons/basic/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..98e1d8a84b3d8539ea33e79fe2ac593a05d23bb4 --- /dev/null +++ b/commons/basic/src/main/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + } + ] +} \ No newline at end of file diff --git a/commons/basic/src/main/resources/base/media/icon.png b/commons/basic/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/commons/basic/src/main/resources/base/media/icon.png differ diff --git a/features/fund/Index.ets b/features/fund/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/features/fund/build-profile.json5 b/features/fund/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/features/fund/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/fund/hvigorfile.ts b/features/fund/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..d993120bd71f5f5dfe04480be9dc5f73c00c2599 --- /dev/null +++ b/features/fund/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/fund/obfuscation-rules.txt b/features/fund/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/features/fund/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/features/fund/oh-package.json5 b/features/fund/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..317afbd47f17dad18b8982363a3949eb6cf76001 --- /dev/null +++ b/features/fund/oh-package.json5 @@ -0,0 +1,17 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "fund", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/transaction": "file:../transaction", + "@ohos/fundComparison": "file:../fundComparison", + "@ohos/basic": "file:../../commons/basic", + "@ohos/mpchart": "3.0.0-rc.1" + } +} diff --git a/features/fund/src/main/ets/constants/FundConstants.ets b/features/fund/src/main/ets/constants/FundConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0f05d611c2b793fe7212bb6e13ca10a46d8eca8 --- /dev/null +++ b/features/fund/src/main/ets/constants/FundConstants.ets @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Fund constants for fund feature. + */ +export class FundConstants { + /** + * Row space. + */ + static readonly ROW_SPACE: number = 8; + + /** + * Column space. + */ + static readonly COLUMN_SPACE: number = 6; + + /** + * Column space. + */ + static readonly TAB_COLUMN_SPACE: number = 4; + + /** + * Row space. + */ + static readonly BOTTOM_ROW_SPACE: number = 24; + + /** + * Row space. + */ + static readonly TAB_ROW_SPACE: number = 20; + + /** + * Column space. + */ + static readonly BOTTOM_COLUMN_SPACE: number = 24; + + /** + * Row space. + */ + static readonly COLLECT_COLUMN_SPACE: number = 4; + + /** + * Get fund info start index. + */ + static readonly FUND_COUNT_START: number = 0; + + /** + * Get fund info under sm power outage. + */ + static readonly FUND_COUNT_SM: number = 4; + + /** + * Get fund info under md power outage. + */ + static readonly FUND_COUNT_MD: number = 6; + + /** + * Get fund info under lg power outage. + */ + static readonly FUND_COUNT_LG: number = 12; + + /** + * Get list lanes under sm power outage. + */ + static readonly LIST_LANES_SM: number = 2; + + /** + * Get list lanes under md power outage. + */ + static readonly LIST_LANES_MD: number = 3; + + /** + * Get list lanes under lg power outage. + */ + static readonly LIST_LANES_LG: number = 5; + + /** + * Get button count under sm power outage. + */ + static readonly BUTTON_COUNT_SM: number = 5; + + /** + * Get button count under md power outage. + */ + static readonly BUTTON_COUNT_MD: number = 6; + + /** + * Get column count under sm power outage. + */ + static readonly COLUMN_COUNT_SM: number = 2; + + /** + * Get column count under md power outage. + */ + static readonly COLUMN_COUNT_MD: number = 3; + + /** + * Gradient position. + */ + static readonly GRADIENT_LEFT: number = 0; + + /** + * Gradient position. + */ + static readonly GRADIENT_CENTER: number = 0.91; + + /** + * Gradient position. + */ + static readonly GRADIENT_RIGHT: number = 1; + + /** + * Calculate the position value. + */ + static readonly CALCULATE_POSITION_LG: number = 216; + + /** + * Calculate the position value. + */ + static readonly CALCULATE_POSITION: number = 146; + + /** + * Nav bar width. + */ + static readonly NAV_BAR_WIDTH: string = '40%'; +} \ No newline at end of file diff --git a/features/fund/src/main/ets/pages/Funding.ets b/features/fund/src/main/ets/pages/Funding.ets new file mode 100644 index 0000000000000000000000000000000000000000..5453133c4d0d5cbb4e40cff7ea5b0a470340b20a --- /dev/null +++ b/features/fund/src/main/ets/pages/Funding.ets @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2023 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 { CommonConstants } from '@ohos/basic'; +import { FundConstants } from '../constants/FundConstants'; + +import { FundComponent } from '../view/FundComponent'; +import FundingViewModel from '../viewmodel/FundingViewModel'; + +@Entry +@Component +struct Funding { + @State breakPoint: string = CommonConstants.BREAK_POINT_SM; + @State currentTabIndex: number = 0; + + aboutToAppear() { + AppStorage.setOrCreate('allFund', FundingViewModel.getAllFundInfo()) + } + + @Builder + BuildTabs(icon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + 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')) + Text(title) + .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')) + } + } + + @Builder + BuildTabsMine(icon: Resource, unIcon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + Image(this.currentTabIndex === index ? icon : unIcon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(title) + .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')) + } + } + + 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: { + 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_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.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; + }) + } + } + } + .onBreakpointChange((breakpoints: string) => { + this.breakPoint = breakpoints; + }) + } +} \ No newline at end of file diff --git a/features/fund/src/main/ets/pages/FundingDetail.ets b/features/fund/src/main/ets/pages/FundingDetail.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab48b39d68e61e08935dc01bb4b54fe7409b476d --- /dev/null +++ b/features/fund/src/main/ets/pages/FundingDetail.ets @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +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'; + +@Entry +@Component +struct FundingDetail { + @StorageLink('pageInfo')pageInfo: NavPathStack = new NavPathStack(); + @State breakPoint: string = CommonConstants.BREAK_POINT_LG; + @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); + } + + 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: { + 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) + } + .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_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.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; + }) + } + } + } + .onBreakpointChange((breakpoints: string) => { + this.breakPoint = breakpoints; + }) + } + + @Builder + buildNavDestination(name: string, param: object) { + if (name === CommonConstants.PATH_DETAIL) { + if (typeof param === 'number') { + DetailComponent({ indexList: param }) + } + } else if (name === CommonConstants.PATH_COMPARISON) { + ComparisonComponent() + } else if (name === CommonConstants.PATH_COMPARISON_DETAIL) { + NavDestination() { + ComparisonDetailComponent({ chooseComparison: (param as ComparisonInfo[]) }) + } + .hideTitleBar(true) + } else if (name === CommonConstants.PATH_BUYING) { + if (typeof param === 'number') { + TransactionComponent({ indexList: param }) + } + } + } + + @Builder + BuildTabs(icon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + 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')) + Text(title) + .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')) + } + } + + @Builder + BuildTabsMine(icon: Resource, unIcon: Resource, title: ResourceStr, index: number) { + Column({ space: FundConstants.TAB_COLUMN_SPACE }) { + Image(this.currentTabIndex === index ? icon : unIcon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(title) + .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')) + } + } +} \ No newline at end of file diff --git a/features/fund/src/main/ets/pages/TrendsPage.ets b/features/fund/src/main/ets/pages/TrendsPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f9477296a0a9204962109f12808091bbb4c444b --- /dev/null +++ b/features/fund/src/main/ets/pages/TrendsPage.ets @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2023 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 { Callback } from '@kit.BasicServicesKit'; +import { display, router } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; +import { LineChart, LineChartModel } from '@ohos/mpchart'; +import { BreakpointUtil, CommonConstants } from '@ohos/basic'; +import ChartViewModel from '../viewmodel/ChartViewModel'; +import { ChartLegendComponent } from '../view/ChartLegendComponent'; +import { FundConstants } from '../constants/FundConstants'; + +@Entry +@Component +struct TrendsPage { + @State showChart: boolean = true; + @State lineChartModel: LineChartModel = ChartViewModel.getLineChartModel(); + @State tabBarIndex: number = 0; + @State name: string = (router.getParams() as Record)['name']; + @State currentPoint: string = CommonConstants.BREAK_POINT_MD; + @StorageProp('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_MD; + @StorageProp('avoidArea') areaLeft: number = 0; + @State isLandScape: boolean = false; + private controller: TabsController = new TabsController(); + private callback: Callback = (data: display.FoldDisplayMode) => { + if (this.isLandScape && data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_FULL) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.PORTRAIT); + }); + } + if (data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_MAIN) { + window.getLastWindow(getContext(this)).then((stage: window.Window) => { + stage.setPreferredOrientation(window.Orientation.LANDSCAPE) + }); + 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: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Row() { + 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(() => { + router.back(); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Row() { + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Text($r('app.string.performance_trends')) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 0; + this.controller.changeIndex(this.tabBarIndex); + }) + Text($r('app.string.unit_net_value')) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 1; + 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')) + + 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) + }) + + 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; + }) + + 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() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: $r('app.float.chart_button_margin') + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } + .tabBar($r('app.string.performance_trends')) + + TabContent() { + + } + .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) + } + } + } + .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; + }) + } +} + +@Extend(Button) +function chartButtonStyle() { + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('app.color.sixty_percent_white')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor(Color.White) + .height($r('app.float.chart_button_height')) + .constraintSize({ + minWidth: $r('app.float.chart_button_min_width'), + maxWidth: $r('app.float.chart_button_max_width') + }) +} \ No newline at end of file diff --git a/features/fund/src/main/ets/view/ChartLegendComponent.ets b/features/fund/src/main/ets/view/ChartLegendComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b79e53969ed6754084647e67b2bc5dd75408a2b --- /dev/null +++ b/features/fund/src/main/ets/view/ChartLegendComponent.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 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. + */ + +@Component +export struct ChartLegendComponent { + private name: ResourceStr = ''; + private color: ResourceStr = ''; + private value: ResourceStr = ''; + + build() { + Column() { + Row() { + Text(this.name) + .fontSize($r('app.float.text_name_size')) + .fontColor($r('app.color.name_build_text')); + Divider() + .width($r('app.float.build_divider_width')) + .height($r('app.float.build_divider_height')) + .color(this.color) + .borderRadius($r('app.float.build_divider_radius')) + .margin({ + left: $r('app.float.build_divider_margin_left') + }) + } + Text(this.value) + .fontColor($r('app.color.value_build_text')) + .fontSize($r('app.float.value_build_text_size')); + } + .alignItems(HorizontalAlign.Start) + } +} \ No newline at end of file diff --git a/features/fund/src/main/ets/view/DetailComponent.ets b/features/fund/src/main/ets/view/DetailComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa731f6159decd9bd91e5fef340a42840c31da59 --- /dev/null +++ b/features/fund/src/main/ets/view/DetailComponent.ets @@ -0,0 +1,430 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { LineChart, LineChartModel } from '@ohos/mpchart'; +import { BreakpointUtil, CommonConstants, FundDetail, RouterConstants } from '@ohos/basic'; +import ChartViewModel from '../viewmodel/ChartViewModel'; +import FundingViewModel from '../viewmodel/FundingViewModel'; +import { FundConstants } from '../constants/FundConstants'; +import { ChartLegendComponent } from './ChartLegendComponent'; + +@Component +export struct DetailComponent { + @State currentPoint: string = CommonConstants.BREAK_POINT_LG; + @State lineChartModel: LineChartModel = ChartViewModel.getLineChartModel(); + @State showChart: boolean = true; + @State indexList: number = 0; + @State tabBarIndex: number = 0; + @State fundInfo: FundDetail[] = FundingViewModel.getAllFundInfo(); + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + + build() { + NavDestination() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.ComponentSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + 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')) + .onClick(() => { + router.back(); + }) + Text($r('app.string.funding_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + Image($r('app.media.ic_public_share')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.title_height')) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Center) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Scroll() { + Column() { + Column() { + Row() { + Text(this.fundInfo[this.indexList].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')) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Row({ space: FundConstants.ROW_SPACE }) { + Text($r('app.string.currency_type')) + .buildTextStyle() + Text($r('app.string.medium_risk')) + .buildTextStyle() + Text($r('app.string.purchase_rmb')) + .buildTextStyle() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + top: $r('app.float.type_margin_top'), + bottom: $r('app.float.type_margin_bottom') + }) + + Row() { + Column({ space: FundConstants.COLUMN_SPACE }) { + Text(this.fundInfo[this.indexList].amplitude) + .fontSize($r('app.float.amplitude_size')) + .fontColor($r('app.color.amplitude_text')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text($r('app.string.one_year_amplitude')) + .fontSize($r('app.float.amplitude_time_size')) + .fontColor($r('app.color.forty_percent_white')) + } + + 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")) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.one_day_amplitude')) + .fontSize($r('app.float.amplitude_time_size')) + .fontColor($r('app.color.forty_percent_white')) + } + + Column({ space: FundConstants.COLUMN_SPACE }) { + Text($r('app.string.last_net_value_data')) + .fontSize($r('app.float.amplitude_date_size')) + .fontColor(Color.Black) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.last_net_value')) + .fontSize($r('app.float.amplitude_time_size')) + .fontColor($r('app.color.forty_percent_white')) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Bottom) + + Row() { + Text($r('app.string.last_net_value')) + .fontSize($r('app.float.value_size')) + .fontColor($r('app.color.forty_percent_white')) + Text($r('app.string.last_net_not_show')) + .fontSize($r('app.float.value_size')) + .fontColor($r('app.color.forty_percent_white')) + .margin({ + left: $r('app.float.last_net_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + top: $r('app.float.last_net_margin_tb'), + bottom: $r('app.float.last_net_margin_tb') + }) + + Row() { + Text($r('app.string.three_year_rating')) + .fontSize($r('app.float.value_size')) + .fontColor($r('app.color.forty_percent_white')) + .margin({ + right: $r('app.float.rating_margin_right') + }) + Rating() + .height($r('app.float.rating_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + } + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.scroll_column_padding_right'), + top: $r('app.float.scroll_column_padding_top'), + bottom: $r('app.float.scroll_column_padding_bottom') + }) + .margin({ + top: $r('app.float.scroll_column_margin'), + bottom: $r('app.float.scroll_column_margin') + }) + + Column() { + Row() { + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Text($r('app.string.performance_trends')) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 0; + this.controller.changeIndex(this.tabBarIndex); + }) + Text($r('app.string.unit_net_value')) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = 1; + this.controller.changeIndex(this.tabBarIndex); + }) + } + Image($r('app.media.ic_public_enlarge')) + .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 } + }) + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + bottom: $r('app.float.tab_bar_top') + }) + 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) + + Row() { + LineChart({ model: this.lineChartModel }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .layoutWeight(1) + + 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.chart_button_min_width'), + md: $r('app.float.chart_button_max_width'), + lg: $r('app.float.chart_button_max_width') + }).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) + .height('30vp') + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: $r('app.float.chart_button_margin') + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } + .tabBar($r('app.string.performance_trends')) + + TabContent() { + + } + .tabBar($r('app.string.unit_net_value')) + } + .barMode(BarMode.Scrollable, { margin: $r('app.float.tab_bar_margin')}) + .barHeight(0) + .scrollable(false) + .layoutWeight(1) + } + .backgroundColor(Color.White) + .layoutWeight(1) + .padding({ + top: $r('app.float.image_enlarge_margin'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .justifyContent(FlexAlign.Start) + } + .align(Alignment.TopStart) + .layoutWeight(1) + .scrollBar(BarState.Off) + + Row() { + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Column({ space: FundConstants.COLLECT_COLUMN_SPACE }) { + Image($r('app.media.ic_public_copy_fund')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.funding_contrasts')) + .fontSize($r('app.float.contrasts_size')) + } + .onClick(() => { + this.pageInfo.pushPath({ name: CommonConstants.PATH_COMPARISON }) + }) + Column({ space: FundConstants.COLLECT_COLUMN_SPACE }) { + 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')) + .fontSize($r('app.float.contrasts_size')) + } + } + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + Button($r('app.string.fixed_investment_button')) + .width(new BreakpointUtil({ + sm: $r('app.float.bottom_button_width'), + md: $r('app.float.bottom_button_width_md'), + 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')) + .fontColor($r('app.color.bottom_button')) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Button($r('app.string.buying_button')) + .width(new BreakpointUtil({ + sm: $r('app.float.bottom_button_width'), + md: $r('app.float.bottom_button_width_md'), + lg: $r('app.float.bottom_button_width_md') + }).getValue(this.currentPoint)) + .height($r('app.float.bottom_button_height')) + .backgroundColor($r('app.color.harmony_blue')) + .fontColor(Color.White) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .onClick(() => { + this.pageInfo.pushPath({ name: CommonConstants.PATH_BUYING, param: this.indexList }); + }) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + top: $r('app.float.bottom_padding_tb'), + bottom: $r('app.float.bottom_padding_tb'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + } + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) + } + .hideTitleBar(true) + .backgroundColor($r('app.color.common_background')) + .onBackPressed(() => { + router.back(); + return true; + }) + } +} + +@Extend(Button) +function chartButtonStyle() { + .fontSize($r('app.float.chart_button_size')) + .fontColor($r('app.color.sixty_percent_white')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .backgroundColor(Color.White) + .height($r('app.float.chart_button_height')) + .constraintSize({ + minWidth: $r('app.float.chart_button_min_width'), + maxWidth: $r('app.float.chart_button_max_width') + }) +} + +@Extend(Text) +function buildTextStyle() { + .fontSize($r('app.float.currency_size')) + .fontColor($r('app.color.currency_font')) + .border({ + width: $r('app.float.common_divider'), + color: $r('app.color.currency_border'), + radius: $r('app.float.currency_border_radius') + }) + .padding({ + top: $r('app.float.currency_padding_tb'), + bottom: $r('app.float.currency_padding_tb'), + left: $r('app.float.currency_padding_lr'), + right: $r('app.float.currency_padding_lr') + }) +} diff --git a/features/fund/src/main/ets/view/FundComponent.ets b/features/fund/src/main/ets/view/FundComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..bba10d52a3b957a4623cdef8247b689f357114ca --- /dev/null +++ b/features/fund/src/main/ets/view/FundComponent.ets @@ -0,0 +1,475 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { BreakpointUtil, BusinessInfo, CommonConstants, FundDetail, RouterConstants } from '@ohos/basic'; +import { FundConstants } from '../constants/FundConstants'; +import FundingViewModel from '../viewmodel/FundingViewModel'; + +@Component +export struct FundComponent { + @State currentPoint: string = CommonConstants.BREAK_POINT_SM; + @State tabBarIndex: number = 0; + @State backgroundX: number = 0; + private controller: TabsController = new TabsController(); + + build() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.ComponentSize + }, + columns: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + 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(); + }) + + Blank() + + 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') + }) + .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') + }) + 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({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Scroll() { + Column() { + this.buildMyFundingInfo() + + this.buildSwiperButton() + + this.buildSteadyGrowth() + + Column() { + Row() { + Image($r('app.media.ic_pursue_profit')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.pursue_profit')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.pursue_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.pursue_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + Row({ space: FundConstants.TAB_ROW_SPACE }) { + this.buildTabBarText($r('app.string.common_stock'), 0) + this.buildTabBarText($r('app.string.partial_stock_mix'), 1) + this.buildTabBarText($r('app.string.flexible_configuration'), 2) + this.buildTabBarText($r('app.string.index_funds'), 3) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .height($r('app.float.title_height')) + + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { + TabContent(){ + Row() { + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(0, 2), + md: FundingViewModel.getAllFundInfo(0, 4), + lg: FundingViewModel.getAllFundInfo(0, 6) + }).getValue(this.currentPoint), (item: FundDetail) => { + ListItem() { + Row() { + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + .margin({ + left: $r('app.float.margin_text_left') + }) + } + .justifyContent(FlexAlign.SpaceAround) + } + }) + } + .lanes(new BreakpointUtil({ + sm: 1, + md: 2, + lg: 3 + }).getValue(this.currentPoint)) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .scrollBar(BarState.Off) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .alignItems(VerticalAlign.Top) + } + .tabBar($r('app.string.common_stock')) + TabContent(){ + } + .tabBar($r('app.string.partial_stock_mix')) + TabContent(){ + } + .tabBar($r('app.string.flexible_configuration')) + TabContent(){ + } + .tabBar($r('app.string.index_funds')) + } + .barHeight(0) + .scrollable(false) + .barMode(BarMode.Scrollable) + .barWidth(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.profit_tab_height')) + } + .backgroundColor(Color.White) + .padding($r('app.float.bottom_padding')) + .margin({ + top: $r('app.float.bottom_margin_top') + }) + } + } + .scrollBar(BarState.Off) + } + .margin({ + top: $r('app.float.scroll_margin_top') + }) + } + .backgroundColor($r('app.color.common_background')) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) + } + + @Builder + buildTabBarText(text: ResourceStr, index: number) { + Text(text) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === index ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === index ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = index; + this.controller.changeIndex(this.tabBarIndex); + }) + } + + @Builder + buildSteadyGrowth() { + Column() { + Row() { + Image($r('app.media.ic_steady_growth')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.steady_growth')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.steady_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.steady_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_SM), + md: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_MD), + lg: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_LG) + }).getValue(this.currentPoint), (item: FundDetail, index: number) => { + ListItem() { + Column() { + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text($r('app.string.one_year_amplitude')) + .fontSize($r('app.float.year_text_size')) + .fontColor($r('app.color.forty_percent_white')) + } + .height($r('app.float.list_item_height')) + .width($r('app.float.list_item_width')) + .justifyContent(FlexAlign.SpaceAround) + .onClick(() => { + router.pushUrl({ + url: RouterConstants.FUNDING_DETAIL_URL, + params: { 'listIndex': index } + }) + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + }) + } + .lanes(new BreakpointUtil({ + sm: FundConstants.LIST_LANES_SM, + md: FundConstants.LIST_LANES_MD, + lg: FundConstants.LIST_LANES_LG + }).getValue(this.currentPoint), + this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.list_space_sm') : $r('app.float.list_space')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + top: $r('app.float.common_margin'), + bottom: $r('app.float.list_margin_bottom') + }) + } + .backgroundColor(Color.White) + .padding($r('app.float.list_padding')) + } + + @Builder + buildSwiperButton() { + Swiper() { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_MD), + lg: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + } + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top) + if (this.currentPoint !== CommonConstants.BREAK_POINT_LG) { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_MD) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + } + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_MD) + }).getValue(this.currentPoint), () => { + Column() { + } + .width($r('app.float.column_swiper_width')) + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top) + } + } + .height(this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.swiper_build_height_lg') : $r('app.float.swiper_build_height')) + .indicator(this.currentPoint === CommonConstants.BREAK_POINT_LG ? false : true) + .margin({ + top: $r('app.float.swiper_build_margin_top') + }) + } + + @Builder + buildMyFundingInfo() { + Column() { + Column() { + Column() { + Row() { + Text($r('app.string.my_funding')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + Row() { + Text($r('app.string.my_concern')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + .margin({ + right: $r('app.float.concern_margin_right') + }) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_width')) + .height($r('app.float.common_image')) + .fillColor(Color.White) + } + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Text($r('app.string.my_amount')) + .fontSize($r('app.float.amount_text_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + .margin({ + top: $r('app.float.amount_margin_top') + }) + } + .alignItems(HorizontalAlign.Start) + + Row() { + Image($r('app.media.ic_public_sound')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .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')) + .fontWeight(FontWeight.Normal) + .textOverflow({ + overflow: TextOverflow.Ellipsis + }) + .maxLines(1) + .layoutWeight(1) + .margin({ + left: $r('app.float.sixty_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .backgroundImage($r('app.media.ic_fund_background')) + .backgroundImageSize({ + width: $r('app.float.ic_background_image_width'), + height: $r('app.float.ic_background_image_height') + }) + .backgroundImagePosition({ + x: this.backgroundX, + y: this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.ic_background_position_lg') : $r('app.float.ic_background_position') + }) + .padding({ + top: $r('app.float.padding_common'), + bottom: $r('app.float.info_padding_bottom'), + left: new BreakpointUtil({ + sm: $r('app.float.info_padding_left'), + md: $r('app.float.padding_common'), + lg: $r('app.float.padding_common') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.info_padding_right_sm'), + md: $r('app.float.info_padding_right_md'), + lg: $r('app.float.info_padding_right_lg') + }).getValue(this.currentPoint) + }) + } + .height($r('app.float.funding_info_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .linearGradient({ + direction: GradientDirection.Right, + colors: [['#0954EA', 0], ['#6193F6', 0.91], ['#88AFFC', 1]] + }) + .justifyContent(FlexAlign.SpaceBetween) + .borderRadius($r('app.float.info_radius')) + .onAreaChange((oldVale: Area, newVale: Area) => { + let width = newVale.width; + if (typeof width === 'number') { + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + this.backgroundX = width - FundConstants.CALCULATE_POSITION_LG; + } else { + this.backgroundX = width - FundConstants.CALCULATE_POSITION; + } + } + this.backgroundX = vp2px(this.backgroundX) + }) + } +} \ No newline at end of file diff --git a/features/fund/src/main/ets/view/FundNavigationComponent.ets b/features/fund/src/main/ets/view/FundNavigationComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..e516fe725ce017870548bb9fb9ea79a15a2c3873 --- /dev/null +++ b/features/fund/src/main/ets/view/FundNavigationComponent.ets @@ -0,0 +1,477 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { BreakpointUtil, BusinessInfo, CommonConstants, FundDetail } from '@ohos/basic'; +import { FundConstants } from '../constants/FundConstants'; +import FundingViewModel from '../viewmodel/FundingViewModel'; + +@Component +export struct FundNavigationComponent { + @State currentPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State listIndex: number = 0; + @State tabBarIndex: number = 0; + @State backgroundX: number = 0; + private controller: TabsController = new TabsController(); + + build() { + GridRow({ + breakpoints: { + value: CommonConstants.BREAK_POINTS_VALUE, + reference: BreakpointsReference.ComponentSize + }, + columns: { + xs: CommonConstants.COLUMN_SM, + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + }, + direction: GridRowDirection.Row + }) { + GridCol({ + span: { + xs: CommonConstants.COLUMN_SM, + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + 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') + }) + } + } + + GridCol({ + span: { + xs: CommonConstants.COLUMN_SM, + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_LG + } + }) { + Column() { + Scroll() { + Column() { + this.buildMyFundingInfo() + + this.buildSwiperButton() + + this.buildSteadyGrowth() + + Column() { + Row() { + Image($r('app.media.ic_pursue_profit')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.pursue_profit')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.pursue_text')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.pursue_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + Row({ space: FundConstants.BOTTOM_ROW_SPACE }) { + this.buildTabBarText($r('app.string.common_stock'), 0) + this.buildTabBarText($r('app.string.partial_stock_mix'), 1) + this.buildTabBarText($r('app.string.flexible_configuration'), 2) + this.buildTabBarText($r('app.string.index_funds'), 3) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .height($r('app.float.title_height')) + + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { + TabContent(){ + Row() { + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(0, 2), + md: FundingViewModel.getAllFundInfo(0, 4), + lg: FundingViewModel.getAllFundInfo(0, 6) + }).getValue(this.currentPoint), (item: FundDetail) => { + ListItem() { + Row() { + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + .margin({ + left: $r('app.float.margin_text_left') + }) + } + .justifyContent(FlexAlign.SpaceAround) + } + }) + } + .lanes(new BreakpointUtil({ + sm: 1, + md: 2, + lg: 3 + }).getValue(this.currentPoint)) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .scrollBar(BarState.Off) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .alignItems(VerticalAlign.Top) + } + .tabBar($r('app.string.common_stock')) + TabContent(){ + } + .tabBar($r('app.string.partial_stock_mix')) + TabContent(){ + } + .tabBar($r('app.string.flexible_configuration')) + TabContent(){ + } + .tabBar($r('app.string.index_funds')) + } + .barHeight(0) + .scrollable(false) + .barMode(BarMode.Scrollable) + .barWidth(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.profit_tab_height')) + } + .backgroundColor(Color.White) + .padding($r('app.float.bottom_padding')) + .margin({ + top: $r('app.float.bottom_margin_top') + }) + } + } + .scrollBar(BarState.Off) + .margin({ + top: $r('app.float.scroll_margin_top') + }) + } + } + .backgroundColor($r('app.color.common_background')) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + if (breakpoints === CommonConstants.BREAK_POINT_XS) { + this.currentPoint = CommonConstants.BREAK_POINT_SM + } + }) + } + + @Builder + buildTabBarText(text: ResourceStr, index: number) { + Text(text) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === index ? $r('app.color.harmony_blue') : Color.Black) + .border({ + width: { + bottom: $r('app.float.tab_bar_border') + }, + color: this.tabBarIndex === index ? $r('app.color.harmony_blue') : $r('app.color.transparent_color') + }) + .padding({ + bottom: $r('app.float.tab_bar_padding_bottom') + }) + .onClick(() => { + this.tabBarIndex = index; + this.controller.changeIndex(this.tabBarIndex); + }) + } + + @Builder + buildSteadyGrowth() { + Column() { + Row() { + Image($r('app.media.ic_steady_growth')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text($r('app.string.steady_growth')) + .fontSize($r('app.float.common_font_size')) + .fontColor($r('app.color.steady_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(FontWeight.Regular) + .margin({ + left: $r('app.float.steady_margin_left') + }); + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + + List() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_SM), + md: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_MD), + lg: FundingViewModel.getAllFundInfo(FundConstants.FUND_COUNT_START, FundConstants.FUND_COUNT_LG) + }).getValue(this.currentPoint), (item: FundDetail, index: number) => { + ListItem() { + Column() { + Text(item.name) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI); + Text(item.amplitude) + .fontSize($r('app.float.amplitude_text_size')) + .fontColor($r('app.color.amplitude_text_font')) + .fontWeight(CommonConstants.FONT_WEIGHT_700); + Text($r('app.string.one_year_amplitude')) + .fontSize($r('app.float.year_text_size')) + .fontColor($r('app.color.forty_percent_white')); + } + .height($r('app.float.list_item_height')) + .width($r('app.float.list_item_width')) + .justifyContent(FlexAlign.SpaceAround) + .onClick(() => { + this.pageInfo.pushPathByName(CommonConstants.PATH_DETAIL, index); + this.listIndex = index; + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(this.listIndex === index ? $r('app.color.list_background') : Color.White) + }, (item: FundDetail, index: number) => index + JSON.stringify(item)) + } + .lanes(new BreakpointUtil({ + sm: FundConstants.LIST_LANES_SM, + md: FundConstants.LIST_LANES_MD, + lg: FundConstants.LIST_LANES_LG + }).getValue(this.currentPoint), + this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.list_space_sm') : $r('app.float.list_space')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + top: $r('app.float.common_margin'), + bottom: $r('app.float.list_margin_bottom') + }) + } + .backgroundColor(Color.White) + .padding($r('app.float.list_padding')) + } + + @Builder + buildSwiperButton() { + Swiper() { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.BUTTON_COUNT_MD), + lg: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + } + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)); + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top); + if (this.currentPoint !== CommonConstants.BREAK_POINT_LG) { + Row() { + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.BUTTON_COUNT_MD) + }).getValue(this.currentPoint), (item: BusinessInfo) => { + Column() { + Image(item.icon) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontWeight(FontWeight.Normal) + .margin({ + top: $r('app.float.button_text_margin_top') + }) + }; + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)); + + ForEach(new BreakpointUtil({ + sm: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_SM), + md: FundingViewModel.getFundingButtonBusiness(FundConstants.FUND_COUNT_START, FundConstants.COLUMN_COUNT_MD) + }).getValue(this.currentPoint), () => { + Column() { + } + .width($r('app.float.column_swiper_width')) + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)); + } + .height($r('app.float.swiper_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(VerticalAlign.Top) + } + } + .height(this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.swiper_build_height_lg') : $r('app.float.swiper_build_height')) + .indicator(this.currentPoint === CommonConstants.BREAK_POINT_LG ? false : true) + .margin({ + top: $r('app.float.swiper_build_margin_top') + }) + } + + @Builder + buildMyFundingInfo() { + Column() { + Column() { + Column() { + Row() { + Text($r('app.string.my_funding')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + Row() { + Text($r('app.string.my_concern')) + .fontWeight(FontWeight.Normal) + .fontColor(Color.White) + .fontSize($r('app.float.my_fund_size')) + .margin({ + right: $r('app.float.concern_margin_right') + }) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_width')) + .height($r('app.float.common_image')) + .fillColor(Color.White); + } + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT); + + Text($r('app.string.my_amount')) + .fontSize($r('app.float.amount_text_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_700) + .margin({ + top: $r('app.float.amount_margin_top') + }) + } + .alignItems(HorizontalAlign.Start) + + Row() { + Image($r('app.media.ic_public_sound')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .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')) + .fontWeight(FontWeight.Normal) + .textOverflow({ + overflow: TextOverflow.Ellipsis + }) + .maxLines(1) + .layoutWeight(1) + .margin({ + left: $r('app.float.sixty_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .backgroundImage($r('app.media.ic_fund_background')) + .backgroundImageSize({ + width: $r('app.float.ic_background_image_width'), + height: $r('app.float.ic_background_image_height') + }) + .backgroundImagePosition({ + x: this.backgroundX, + y: $r('app.float.ic_background_position_lg') + }) + .padding({ + top: $r('app.float.padding_common'), + bottom: $r('app.float.info_padding_bottom'), + left: new BreakpointUtil({ + sm: $r('app.float.info_padding_left'), + md: $r('app.float.padding_common'), + lg: $r('app.float.padding_common') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.info_padding_right_sm'), + md: $r('app.float.info_padding_right_md'), + lg: $r('app.float.info_padding_right_lg') + }).getValue(this.currentPoint) + }) + } + .height($r('app.float.funding_info_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .linearGradient({ + direction: GradientDirection.Right, + colors: [['#0954EA', 0], ['#6193F6', 0.91], ['#88AFFC', 1]] + }) + .justifyContent(FlexAlign.SpaceBetween) + .borderRadius($r('app.float.info_radius')) + .onAreaChange((oldVale: Area, newVale: Area) => { + let width = newVale.width; + if (typeof width === 'number') { + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + this.backgroundX = width - FundConstants.CALCULATE_POSITION_LG; + } else { + this.backgroundX = width - FundConstants.CALCULATE_POSITION; + } + } + this.backgroundX = vp2px(this.backgroundX) + }) + } +} \ No newline at end of file diff --git a/features/fund/src/main/ets/viewmodel/ChartAxisFormatter.ets b/features/fund/src/main/ets/viewmodel/ChartAxisFormatter.ets new file mode 100644 index 0000000000000000000000000000000000000000..e488755edbed65c0029605a09e46ee3fde08bd46 --- /dev/null +++ b/features/fund/src/main/ets/viewmodel/ChartAxisFormatter.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 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 { HashMap } from '@kit.ArkTS'; +import { AxisBase, IAxisValueFormatter } from '@ohos/mpchart'; + +export class ChartAxisFormatter implements IAxisValueFormatter { + xAxis: HashMap = new HashMap(); + + constructor(xAxis: HashMap) { + this.xAxis = xAxis; + } + + public getFormattedValue(value: number, axis: AxisBase): string { + let xAxis = this.xAxis.get(value); + if (xAxis) { + return xAxis; + } + return ''; + } +} \ No newline at end of file diff --git a/features/fund/src/main/ets/viewmodel/ChartViewModel.ets b/features/fund/src/main/ets/viewmodel/ChartViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..60d22c3957a08c5e42e39735b02d4056d5c57559 --- /dev/null +++ b/features/fund/src/main/ets/viewmodel/ChartViewModel.ets @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2023 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 { HashMap } from '@kit.ArkTS'; +import { EntryOhos, ILineDataSet, JArrayList, LineChartModel, LineData, LineDataSet, XAxis, XAxisPosition, + YAxis, AxisDependency, YAxisLabelPosition, + ChartColorStop, + Legend, + Description +} from '@ohos/mpchart'; +import { ChartAxisFormatter } from './ChartAxisFormatter'; + +class ChartViewModel { + xAxis: XAxis | null = null; + topAxis: XAxis | null = null; + mWidth: number = 312; + mHeight: number = 200; + minOffset: number = 30; + leftAxis: YAxis | null = null; + rightAxis: YAxis | null = null; + lineData: LineData | null = null; + lineChartModel: LineChartModel = new LineChartModel(); + maxValue: number = 0; + minValue: number = 0; + + public constructor() { + this.lineData = this.initCurveData(45); + } + + /** + * Init data. + * + * @param count Init data count. + */ + private initCurveData(count: number): LineData { + let values = this.initRandomValue(count); + + let gradientFillColor = new JArrayList(); + gradientFillColor.add(['#661f69ff', 0.1]) + gradientFillColor.add(['#00eff6ff', 1.0]) + + let dataSet = new JArrayList(); + + let set1 = new LineDataSet(values, '本基金'); + set1.setDrawFilled(true); + set1.setDrawValues(false); + set1.setGradientFillColor(gradientFillColor); + set1.setColorByColor(0x0A59F7); + set1.setLineWidth(1) + set1.setDrawCircles(false); + set1.setDrawHorizontalHighlightIndicator(false) + set1.setDrawVerticalHighlightIndicator(false) + dataSet.add(set1); + + let average = this.initRandomValue(count); + let set2 = new LineDataSet(average, '同类平均'); + set2.setDrawFilled(false); + set2.setDrawValues(false); + set2.setColorByColor(0x660A59F7); + set2.setLineWidth(1) + set2.setDrawCircles(false); + // set2.setShowFillLine(false) + dataSet.add(set2); + + let other = this.initRandomValue(count); + let set3 = new LineDataSet(other, '沪深300'); + set3.setDrawFilled(false); + set3.setDrawValues(false); + set3.setColorByColor(0xE84026); + set3.setLineWidth(1) + set3.setDrawCircles(false); + dataSet.add(set3); + + return new LineData(dataSet) + } + + /** + * Randomly generate data. + * + * @param count Init data count. + * @returns JArrayList. + */ + initRandomValue(count: number): JArrayList { + let values = new JArrayList(); + values.add(new EntryOhos(0, 0)); + let temp = 0; + for (let i = 1; i < count; i++) { + let val: number = Math.random() * 0.5; + let calculated: number = Math.random() * 100; + if (calculated > 50) { + temp += val; + values.add(new EntryOhos(i, temp)); + } else { + temp -= val; + values.add(new EntryOhos(i, temp)); + } + if (this.maxValue < temp) { + this.maxValue = temp; + } + if (this.minValue > temp) { + this.minValue = temp; + } + } + return values; + } + + /** + * Get LineChartModel. + * + * @param width + * @param height + * @returns LineChartModel + */ + getLineChartModel(): LineChartModel { + this.lineChartModel = new LineChartModel(); + this.xAxis = this.lineChartModel.getXAxis(); + if (this.xAxis) { + this.xAxis.setLabelCount(3, true); + this.xAxis.setPosition(XAxisPosition.BOTTOM); + this.xAxis.setAxisMinimum(0); + this.xAxis.setAxisMaximum(44); + this.xAxis.setAvoidFirstLastClipping(true); + this.xAxis.setDrawGridLines(false) + let xMap: HashMap = new HashMap(); + xMap.set(0, '07-14'); + xMap.set(22, '08-01'); + xMap.set(44, '08-16'); + this.xAxis.setValueFormatter(new ChartAxisFormatter(xMap)) + } + + this.leftAxis = this.lineChartModel.getAxisLeft(); + if (this.leftAxis) { + let maxy = Math.ceil(this.maxValue); + let miny = Math.floor(this.minValue) + this.leftAxis.setLabelCount(maxy - miny + 1, false); + this.leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART); + this.leftAxis.setSpaceTop(15); + this.leftAxis.setAxisMaximum(maxy); + this.leftAxis.setAxisMinimum(miny); + this.leftAxis.setDrawGridLines(false); + this.leftAxis.setDrawAxisLine(true); + let yMap: HashMap = new HashMap(); + for (let i = miny; i <= maxy; i++) { + yMap.set(i, i + '.00%'); + } + this.leftAxis.setValueFormatter(new ChartAxisFormatter(yMap)) + } + + this.rightAxis = this.lineChartModel.getAxisRight(); + if (this.rightAxis) { + this.rightAxis.setDrawGridLines(false); + this.rightAxis.setDrawAxisLine(false); + this.rightAxis.setDrawLabels(false); + } + + let legend: Legend | null = this.lineChartModel.getLegend(); + if (legend) { + legend.setEnabled(false); + } + let description: Description | null = this.lineChartModel.getDescription(); + if (description) { + description.setEnabled(false); + } + + this.lineChartModel.setMinOffset(2); + this.lineChartModel.setHighlightPerLongPressEnabled(false); + this.lineChartModel.setData(this.lineData); + return this.lineChartModel; + } +} + +export default new ChartViewModel(); \ No newline at end of file diff --git a/features/fund/src/main/ets/viewmodel/FundingViewModel.ets b/features/fund/src/main/ets/viewmodel/FundingViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7fdc89ca85d7ccdd4ee6056387626db92c0bc90 --- /dev/null +++ b/features/fund/src/main/ets/viewmodel/FundingViewModel.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2023 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 { BusinessInfo, FundDetail } from '@ohos/basic'; + +/** + * Get fund data. + */ +class FundingViewModel { + getFundingButtonBusiness(start: number, end?: number): BusinessInfo[] { + let fundingBusinessInfoList: BusinessInfo[] = [ + 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')) + ]; + return fundingBusinessInfoList.slice(start, end); + } + + getAllFundInfo(start?: number, end?: number): FundDetail[] { + let fundInfoList: FundDetail[] = [ + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_industrial'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_mixed_currency'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_bonds'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')), + new FundDetail($r('app.string.funding_short_term_B'), $r('app.string.funding_amplitude')) + ]; + return fundInfoList.slice(start, end); + } +} + +export default new FundingViewModel(); \ No newline at end of file diff --git a/features/fund/src/main/module.json5 b/features/fund/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f77feaef3d9da6fcbac112c067f07a4b8b6fcbb4 --- /dev/null +++ b/features/fund/src/main/module.json5 @@ -0,0 +1,14 @@ +{ + "module": { + "name": "fund", + "type": "shared", + "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 new file mode 100644 index 0000000000000000000000000000000000000000..43bda0899435e3f258d2278784052aeb93aec2cc --- /dev/null +++ b/features/fund/src/main/resources/base/element/color.json @@ -0,0 +1,128 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "five_percent_black", + "value": "#0dffffff" + }, + { + "name": "five_percent_white", + "value": "#0d000000" + }, + { + "name": "sixty_percent_black", + "value": "#99ffffff" + }, + { + "name": "sixty_percent_white", + "value": "#99000000" + }, + { + "name": "forty_percent_white", + "value": "#66000000" + }, + { + "name": "ten_percent_white", + "value": "#1a000000" + }, + { + "name": "harmony_blue", + "value": "#0A59F7" + }, + { + "name": "name_text", + "value": "#182431" + }, + { + "name": "currency_font", + "value": "#1F69FF" + }, + { + "name": "currency_border", + "value": "#1F69FF" + }, + { + "name": "amplitude_text", + "value": "#E84026" + }, + { + "name": "amplitude_date", + "value": "#28AD2B" + }, + { + "name": "fund_chart", + "value": "#0A59F7" + }, + { + "name": "same_average_chart", + "value": "#660a59f7" + }, + { + "name": "other_funding_chart", + "value": "#E84026" + }, + { + "name": "bottom_button", + "value": "#0A59F7" + }, + { + "name": "common_background", + "value": "#F7F7F7" + }, + { + "name": "name_build_text", + "value": "#cc000000" + }, + { + "name": "value_build_text", + "value": "#28AD2B" + }, + { + "name": "pursue_text", + "value": "#182431" + }, + { + "name": "steady_font", + "value": "#182431" + }, + { + "name": "amplitude_text_font", + "value": "#E84026" + }, + { + "name": "list_background", + "value": "#0d1f69ff" + }, + { + "name": "transparent_color", + "value": "#00000000" + }, + { + "name": "gradient_left", + "value": "#0954EA" + }, + { + "name": "gradient_center", + "value": "#6193F6" + }, + { + "name": "gradient_right", + "value": "#88AFFC" + }, + { + "name": "tab_choose_image", + "value": "#0A59F7" + }, + { + "name": "tab_un_image", + "value": "#33000000" + }, + { + "name": "home_background", + "value": "#F1F3F5" + } + ] +} \ No newline at end of file diff --git a/features/fund/src/main/resources/base/element/float.json b/features/fund/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..41acf91ef243c4fa56d4e1d7fe27c0776a1539c4 --- /dev/null +++ b/features/fund/src/main/resources/base/element/float.json @@ -0,0 +1,420 @@ +{ + "float": [ + { + "name": "nav_bar_width", + "value": "474vp" + }, + { + "name": "common_image", + "value": "24vp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "common_margin", + "value": "24vp" + }, + { + "name": "common_line_height", + "value": "22vp" + }, + { + "name": "common_font_size", + "value": "16fp" + }, + { + "name": "common_divider", + "value": "1vp" + }, + { + "name": "title_text_size", + "value": "18fp" + }, + { + "name": "title_height", + "value": "56vp" + }, + { + "name": "code_size", + "value": "12fp" + }, + { + "name": "currency_size", + "value": "10fp" + }, + { + "name": "currency_border_radius", + "value": "4vp" + }, + { + "name": "currency_padding_tb", + "value": "1vp" + }, + { + "name": "currency_padding_lr", + "value": "4vp" + }, + { + "name": "type_margin_top", + "value": "13vp" + }, + { + "name": "type_margin_bottom", + "value": "24vp" + }, + { + "name": "amplitude_size", + "value": "24fp" + }, + { + "name": "amplitude_time_size", + "value": "12fp" + }, + { + "name": "amplitude_date_size", + "value": "18fp" + }, + { + "name": "value_size", + "value": "12fp" + }, + { + "name": "last_net_margin_left", + "value": "16vp" + }, + { + "name": "last_net_margin_tb", + "value": "16vp" + }, + { + "name": "rating_margin_right", + "value": "18vp" + }, + { + "name": "rating_height", + "value": "12vp" + }, + { + "name": "scroll_column_padding_right", + "value": "56vp" + }, + { + "name": "scroll_column_padding_top", + "value": "13vp" + }, + { + "name": "scroll_column_padding_bottom", + "value": "16vp" + }, + { + "name": "scroll_column_margin", + "value": "12vp" + }, + { + "name": "chart_button_size", + "value": "12fp" + }, + { + "name": "chart_button_height", + "value": "28vp" + }, + { + "name": "chart_button_min_width", + "value": "64vp" + }, + { + "name": "chart_button_max_width", + "value": "150vp" + }, + { + "name": "chart_button_margin", + "value": "12vp" + }, + { + "name": "tab_bar_margin", + "value": "0vp" + }, + { + "name": "image_enlarge_margin", + "value": "16vp" + }, + { + "name": "chart_height", + "value": "359vp" + }, + { + "name": "contrasts_size", + "value": "12fp" + }, + { + "name": "bottom_button_width", + "value": "84vp" + }, + { + "name": "bottom_button_height", + "value": "40vp" + }, + { + "name": "bottom_padding_tb", + "value": "14vp" + }, + { + "name": "text_name_size", + "value": "12fp" + }, + { + "name": "build_divider_width", + "value": "16vp" + }, + { + "name": "build_divider_height", + "value": "2vp" + }, + { + "name": "build_divider_radius", + "value": "1vp" + }, + { + "name": "build_divider_margin_left", + "value": "8vp" + }, + { + "name": "value_build_text_size", + "value": "14fp" + }, + { + "name": "title_padding_tb", + "value": "8vp" + }, + { + "name": "pursue_margin_left", + "value": "12vp" + }, + { + "name": "bottom_padding", + "value": "12vp" + }, + { + "name": "bottom_margin_top", + "value": "12vp" + }, + { + "name": "scroll_margin_top", + "value": "16vp" + }, + { + "name": "steady_margin_left", + "value": "12vp" + }, + { + "name": "amplitude_text_size", + "value": "24fp" + }, + { + "name": "year_text_size", + "value": "12fp" + }, + { + "name": "list_item_height", + "value": "99vp" + }, + { + "name": "list_item_width", + "value": "140vp" + }, + { + "name": "list_space_sm", + "value": "12vp" + }, + { + "name": "list_space", + "value": "16vp" + }, + { + "name": "list_margin_bottom", + "value": "16vp" + }, + { + "name": "list_padding", + "value": "12vp" + }, + { + "name": "button_text_size", + "value": "12fp" + }, + { + "name": "button_text_margin_top", + "value": "5vp" + }, + { + "name": "swiper_height", + "value": "44vp" + }, + { + "name": "column_swiper_width", + "value": "48vp" + }, + { + "name": "swiper_build_height_lg", + "value": "60vp" + }, + { + "name": "swiper_build_height", + "value": "84vp" + }, + { + "name": "swiper_build_margin_top", + "value": "25vp" + }, + { + "name": "my_fund_size", + "value": "18fp" + }, + { + "name": "concern_margin_right", + "value": "8vp" + }, + { + "name": "arrow_width", + "value": "12vp" + }, + { + "name": "amount_text_size", + "value": "36fp" + }, + { + "name": "amount_margin_top", + "value": "16vp" + }, + { + "name": "news_text_size", + "value": "18fp" + }, + { + "name": "sixty_margin_left", + "value": "12vp" + }, + { + "name": "funding_info_height", + "value": "168vp" + }, + { + "name": "info_radius", + "value": "16vp" + }, + { + "name": "info_padding_left", + "value": "16vp" + }, + { + "name": "info_padding_bottom", + "value": "16vp" + }, + { + "name": "info_padding_right_sm", + "value": "16vp" + }, + { + "name": "info_padding_right_md", + "value": "28vp" + }, + { + "name": "info_padding_right_lg", + "value": "28vp" + }, + { + "name": "code_margin_left", + "value": "10vp" + }, + { + "name": "tab_text_size", + "value": "16vp" + }, + { + "name": "tab_bar_padding_bottom", + "value": "5vp" + }, + { + "name": "tab_bar_border", + "value": "2vp" + }, + { + "name": "tab_bar_top", + "value": "16vp" + }, + { + "name": "search_width", + "value": "232vp" + }, + { + "name": "search_width_sm", + "value": "248vp" + }, + { + "name": "ic_background_image_width", + "value": "136vp" + }, + { + "name": "ic_background_image_height", + "value": "126vp" + }, + { + "name": "ic_background_position_lg", + "value": "50vp" + }, + { + "name": "ic_background_position", + "value": "100vp" + }, + { + "name": "tab_text_height", + "value": "14vp" + }, + { + "name": "tab_bar_width", + "value": "96vp" + }, + { + "name": "bottom_button_width_md", + "value": "234vp" + }, + { + "name": "margin_text_left", + "value": "16vp" + }, + { + "name": "near_button_width", + "value": "108vp" + }, + { + "name": "near_button_width_lg", + "value": "156vp" + }, + { + "name": "legend_padding_lr", + "value": "96vp" + }, + { + "name": "legend_padding_lr_lg", + "value": "372vp" + }, + { + "name": "tab_bar_height", + "value": "56vp" + }, + { + "name": "trends_padding_top", + "value": "10vp" + }, + { + "name": "profit_tab_height", + "value": "100vp" + }, + { + "name": "home_tab_text_size", + "value": "10vp" + } + ] +} \ No newline at end of file diff --git a/features/fund/src/main/resources/base/element/string.json b/features/fund/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ea9a0c4e1cf098d98f40d4e4abc8e1c26a2b47e8 --- /dev/null +++ b/features/fund/src/main/resources/base/element/string.json @@ -0,0 +1,220 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "the_fund_value", + "value": "-2.01%" + }, + { + "name": "same_average_value", + "value": "-1.02%" + }, + { + "name": "other_funding_value", + "value": "-0.67%" + }, + { + "name": "my_funding", + "value": "我的基金 (元)" + }, + { + "name": "my_concern", + "value": "我的关注" + }, + { + "name": "my_amount", + "value": "******" + }, + { + "name": "funding_news", + "value": "快来看看大家最近都在购买的基金" + }, + { + "name": "funding_ranking", + "value": "排行榜" + }, + { + "name": "funding_index_zone", + "value": "指数专区" + }, + { + "name": "fixed_investment", + "value": "定投专区" + }, + { + "name": "investment_star_selection", + "value": "投资星选" + }, + { + "name": "funding_good_chance", + "value": "好机会" + }, + { + "name": "funding_folder_add", + "value": "自建组合" + }, + { + "name": "steady_growth", + "value": "稳健增长" + }, + { + "name": "funding_short_term_B", + "value": "XXX短债基金B" + }, + { + "name": "funding_amplitude", + "value": "+7.89%" + }, + { + "name": "funding_industrial", + "value": "XXX产业基金C" + }, + { + "name": "funding_mixed_currency", + "value": "XXX混合货币" + }, + { + "name": "funding_bonds", + "value": "XXX债券A" + }, + { + "name": "one_year_amplitude", + "value": "近一年涨跌幅" + }, + { + "name": "funding_title", + "value": "基金详情" + }, + { + "name": "funding_code", + "value": "000000" + }, + { + "name": "currency_type", + "value": "货币型" + }, + { + "name": "medium_risk", + "value": "R3-中风险" + }, + { + "name": "purchase_rmb", + "value": "1.00元起购" + }, + { + "name": "one_day_amplitude_data", + "value": "-0.25%" + }, + { + "name": "one_day_amplitude", + "value": "日涨跌幅" + }, + { + "name": "last_net_value_data", + "value": "1.257" + }, + { + "name": "last_net_value", + "value": "最新净值" + }, + { + "name": "last_net_not_show", + "value": "--" + }, + { + "name": "three_year_rating", + "value": "三年评级" + }, + { + "name": "the_fund", + "value": "本基金" + }, + { + "name": "same_average", + "value": "同类平均" + }, + { + "name": "other_funding", + "value": "沪深300" + }, + { + "name": "funding_contrasts", + "value": "对比" + }, + { + "name": "funding_concerned", + "value": "关注" + }, + { + "name": "fixed_investment_button", + "value": "定投" + }, + { + "name": "buying_button", + "value": "购买" + }, + { + "name": "performance_trends", + "value": "业绩走势" + }, + { + "name": "unit_net_value", + "value": "单位净值" + }, + { + "name": "near_month", + "value": "near %d month" + }, + { + "name": "near_year", + "value": "near %d year" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "pursue_profit", + "value": "pursue profit" + }, + { + "name": "common_stock", + "value": "common stock" + }, + { + "name": "partial_stock_mix", + "value": "partial stock mix" + }, + { + "name": "flexible_configuration", + "value": "flexible configuration" + }, + { + "name": "index_funds", + "value": "index funds" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_fixed_investment.png b/features/fund/src/main/resources/base/media/ic_fixed_investment.png new file mode 100644 index 0000000000000000000000000000000000000000..5d4b97d84d32b69425684a7216b75bb6463f2e76 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_fixed_investment.png differ diff --git a/features/fund/src/main/resources/base/media/ic_folder_add.png b/features/fund/src/main/resources/base/media/ic_folder_add.png new file mode 100644 index 0000000000000000000000000000000000000000..bb6631536aad96c1bc356a15f5527f522cec568c Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_folder_add.png differ diff --git a/features/fund/src/main/resources/base/media/ic_fund_background.png b/features/fund/src/main/resources/base/media/ic_fund_background.png new file mode 100644 index 0000000000000000000000000000000000000000..c0c6211e815e9faa74b143efd85dc194e0497152 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_fund_background.png differ diff --git a/features/fund/src/main/resources/base/media/ic_good_chance.png b/features/fund/src/main/resources/base/media/ic_good_chance.png new file mode 100644 index 0000000000000000000000000000000000000000..b76083f94d88205486337d68e853c6a4f960b781 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_good_chance.png differ diff --git a/features/fund/src/main/resources/base/media/ic_home_fortunes.svg b/features/fund/src/main/resources/base/media/ic_home_fortunes.svg new file mode 100644 index 0000000000000000000000000000000000000000..27236e9117514e1e9fff77ba9278728504735003 --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_home_fortunes.svg @@ -0,0 +1,11 @@ + + + 财富 + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_home_mine.svg b/features/fund/src/main/resources/base/media/ic_home_mine.svg new file mode 100644 index 0000000000000000000000000000000000000000..62a5b62bce8cbec51c56c1db00f7317e4e9a52be --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_home_mine.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_home_mine_filled.svg b/features/fund/src/main/resources/base/media/ic_home_mine_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..dbeec6ef94878c69058ce80156916747920a5102 --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_home_mine_filled.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_index_zone.png b/features/fund/src/main/resources/base/media/ic_index_zone.png new file mode 100644 index 0000000000000000000000000000000000000000..35ff8f5135015abe72e31f6f7e2d34388fcf8786 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_index_zone.png differ diff --git a/features/fund/src/main/resources/base/media/ic_life_filled.svg b/features/fund/src/main/resources/base/media/ic_life_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1aba5b5eb63534290b53c06fe7815720796b052 --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_life_filled.svg @@ -0,0 +1,20 @@ + + + 生活 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_Investment_star.png b/features/fund/src/main/resources/base/media/ic_public_Investment_star.png new file mode 100644 index 0000000000000000000000000000000000000000..30ef8aee0887446278666db3879656e1a290fe70 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_public_Investment_star.png differ diff --git a/features/fund/src/main/resources/base/media/ic_public_arrow_right.svg b/features/fund/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cc0f2ad4fd08ee0b7340c787910fd3723a36b7d --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_back.svg b/features/fund/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_cards_filled.svg b/features/fund/src/main/resources/base/media/ic_public_cards_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..965b18a454a95133c73c7a3b9b917e538c1a217c --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_cards_filled.svg @@ -0,0 +1,20 @@ + + + 信用卡 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_collect_fund.png b/features/fund/src/main/resources/base/media/ic_public_collect_fund.png new file mode 100644 index 0000000000000000000000000000000000000000..10c63939486ee40e44c4a2b2a47adc2f7d221f17 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_public_collect_fund.png differ diff --git a/features/fund/src/main/resources/base/media/ic_public_comments.svg b/features/fund/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_copy_fund.png b/features/fund/src/main/resources/base/media/ic_public_copy_fund.png new file mode 100644 index 0000000000000000000000000000000000000000..0f854dc969dcd1cdd6b14351161ca3ffd85d0a69 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_public_copy_fund.png differ diff --git a/features/fund/src/main/resources/base/media/ic_public_enlarge.svg b/features/fund/src/main/resources/base/media/ic_public_enlarge.svg new file mode 100644 index 0000000000000000000000000000000000000000..252b8fe5c6424f8d5f2eefaee0f4e410e771235e --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_enlarge.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_enlarge + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_home_filled.svg b/features/fund/src/main/resources/base/media/ic_public_home_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..deb4371a0ec1c00f635cb10894fb3eefcf8a672f --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_home_filled.svg @@ -0,0 +1,20 @@ + + + 首页 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_reduce.svg b/features/fund/src/main/resources/base/media/ic_public_reduce.svg new file mode 100644 index 0000000000000000000000000000000000000000..142d090e8c48b30f9f694ae2571754ba110f1645 --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_reduce.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_reduce + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_share.svg b/features/fund/src/main/resources/base/media/ic_public_share.svg new file mode 100644 index 0000000000000000000000000000000000000000..516c03c260f5341c1a969a769e9b19648927cf6d --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_share.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_share + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_public_sound.svg b/features/fund/src/main/resources/base/media/ic_public_sound.svg new file mode 100644 index 0000000000000000000000000000000000000000..fbe0bc76b4b98f26978f0044fcb96075aeeee8b4 --- /dev/null +++ b/features/fund/src/main/resources/base/media/ic_public_sound.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_sound + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fund/src/main/resources/base/media/ic_pursue_profit.png b/features/fund/src/main/resources/base/media/ic_pursue_profit.png new file mode 100644 index 0000000000000000000000000000000000000000..a6cbe9c7b2c7f5d646a11af3bafdf893cc825266 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_pursue_profit.png differ diff --git a/features/fund/src/main/resources/base/media/ic_ranking.png b/features/fund/src/main/resources/base/media/ic_ranking.png new file mode 100644 index 0000000000000000000000000000000000000000..cc01479c27543073a8b3ed0c8ef1a91348bde102 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_ranking.png differ diff --git a/features/fund/src/main/resources/base/media/ic_steady_growth.png b/features/fund/src/main/resources/base/media/ic_steady_growth.png new file mode 100644 index 0000000000000000000000000000000000000000..2826bef629a2bec4bfd7e09014e10faaee118981 Binary files /dev/null and b/features/fund/src/main/resources/base/media/ic_steady_growth.png differ diff --git a/features/fund/src/main/resources/base/media/icon.png b/features/fund/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/fund/src/main/resources/base/media/icon.png differ diff --git a/features/fund/src/main/resources/base/media/setting.jpeg b/features/fund/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/features/fund/src/main/resources/base/media/setting.jpeg differ diff --git a/features/fund/src/main/resources/base/profile/main_pages.json b/features/fund/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..a701dee0d60510d8c10ef6de9fa88638288e798e --- /dev/null +++ b/features/fund/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,7 @@ +{ + "src": [ + "pages/Funding", + "pages/FundingDetail", + "pages/TrendsPage" + ] +} \ No newline at end of file diff --git a/features/fund/src/main/resources/en_US/element/string.json b/features/fund/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..11df72a8c14f21df8a0ebd7929233236bd201040 --- /dev/null +++ b/features/fund/src/main/resources/en_US/element/string.json @@ -0,0 +1,220 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "the_fund_value", + "value": "-2.01%" + }, + { + "name": "same_average_value", + "value": "-1.02%" + }, + { + "name": "other_funding_value", + "value": "-0.67%" + }, + { + "name": "my_funding", + "value": "My fund (RMB)" + }, + { + "name": "my_concern", + "value": "My concern" + }, + { + "name": "my_amount", + "value": "******" + }, + { + "name": "funding_news", + "value": "Let's take a look at the funds everyone's buying." + }, + { + "name": "funding_ranking", + "value": "rankings" + }, + { + "name": "funding_index_zone", + "value": "index zone" + }, + { + "name": "fixed_investment", + "value": "fixed_investment" + }, + { + "name": "investment_star_selection", + "value": "Investment Star Selection" + }, + { + "name": "funding_good_chance", + "value": "good chance" + }, + { + "name": "funding_folder_add", + "value": "Self-built combination" + }, + { + "name": "steady_growth", + "value": "steady growth" + }, + { + "name": "funding_short_term_B", + "value": "XXXshort-term debt fund B" + }, + { + "name": "funding_amplitude", + "value": "+7.89%" + }, + { + "name": "funding_industrial", + "value": "XXXindustrial fund" + }, + { + "name": "funding_mixed_currency", + "value": "XXX Mixed Currency" + }, + { + "name": "funding_bonds", + "value": "XXXBonds" + }, + { + "name": "one_year_amplitude", + "value": "Ups and downs in the past year" + }, + { + "name": "funding_title", + "value": "Fund Details" + }, + { + "name": "funding_code", + "value": "000000" + }, + { + "name": "currency_type", + "value": "Currency type" + }, + { + "name": "medium_risk", + "value": "R3-Medium risk" + }, + { + "name": "purchase_rmb", + "value": "Purchase from ¥1.00" + }, + { + "name": "one_day_amplitude_data", + "value": "-0.25%" + }, + { + "name": "one_day_amplitude", + "value": "Daily rise and fall" + }, + { + "name": "last_net_value_data", + "value": "1.257" + }, + { + "name": "last_net_value", + "value": "Last net value" + }, + { + "name": "last_net_not_show", + "value": "--" + }, + { + "name": "three_year_rating", + "value": "Three-year rating" + }, + { + "name": "the_fund", + "value": "The fund" + }, + { + "name": "same_average", + "value": "Average" + }, + { + "name": "other_funding", + "value": "Shanghai and Shenzhen" + }, + { + "name": "funding_contrasts", + "value": "contrasts" + }, + { + "name": "funding_concerned", + "value": "concerned" + }, + { + "name": "fixed_investment_button", + "value": "fixed investment" + }, + { + "name": "buying_button", + "value": "buying" + }, + { + "name": "performance_trends", + "value": "Performance Trends" + }, + { + "name": "unit_net_value", + "value": "Unit Net Value" + }, + { + "name": "near_month", + "value": "near %d month" + }, + { + "name": "near_year", + "value": "near %d year" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "pursue_profit", + "value": "pursue profit" + }, + { + "name": "index_funds", + "value": "index funds" + }, + { + "name": "common_stock", + "value": "common stock" + }, + { + "name": "partial_stock_mix", + "value": "partial stock mix" + }, + { + "name": "flexible_configuration", + "value": "flexible configuration" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/features/fund/src/main/resources/zh_CN/element/string.json b/features/fund/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4ce2de1730879221441bf0489bb00162a06a9db1 --- /dev/null +++ b/features/fund/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,220 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "the_fund_value", + "value": "-2.01%" + }, + { + "name": "same_average_value", + "value": "-1.02%" + }, + { + "name": "other_funding_value", + "value": "-0.67%" + }, + { + "name": "my_funding", + "value": "我的基金 (元)" + }, + { + "name": "my_concern", + "value": "我的关注" + }, + { + "name": "my_amount", + "value": "******" + }, + { + "name": "funding_news", + "value": "快来看看大家最近都在购买的基金" + }, + { + "name": "funding_ranking", + "value": "排行榜" + }, + { + "name": "funding_index_zone", + "value": "指数专区" + }, + { + "name": "fixed_investment", + "value": "定投专区" + }, + { + "name": "investment_star_selection", + "value": "投资星选" + }, + { + "name": "funding_good_chance", + "value": "好机会" + }, + { + "name": "funding_folder_add", + "value": "自建组合" + }, + { + "name": "steady_growth", + "value": "稳健增长" + }, + { + "name": "funding_short_term_B", + "value": "XXX短债基金B" + }, + { + "name": "funding_amplitude", + "value": "+7.89%" + }, + { + "name": "funding_industrial", + "value": "XXX产业基金C" + }, + { + "name": "funding_mixed_currency", + "value": "XXX混合货币" + }, + { + "name": "funding_bonds", + "value": "XXX债券A" + }, + { + "name": "one_year_amplitude", + "value": "近一年涨跌幅" + }, + { + "name": "funding_title", + "value": "基金详情" + }, + { + "name": "funding_code", + "value": "000000" + }, + { + "name": "currency_type", + "value": "货币型" + }, + { + "name": "medium_risk", + "value": "R3-中风险" + }, + { + "name": "purchase_rmb", + "value": "1.00元起购" + }, + { + "name": "one_day_amplitude_data", + "value": "-0.25%" + }, + { + "name": "one_day_amplitude", + "value": "日涨跌幅" + }, + { + "name": "last_net_value_data", + "value": "1.257" + }, + { + "name": "last_net_value", + "value": "最新净值" + }, + { + "name": "last_net_not_show", + "value": "--" + }, + { + "name": "three_year_rating", + "value": "三年评级" + }, + { + "name": "the_fund", + "value": "本基金" + }, + { + "name": "same_average", + "value": "同类平均" + }, + { + "name": "other_funding", + "value": "沪深300" + }, + { + "name": "funding_contrasts", + "value": "对比" + }, + { + "name": "funding_concerned", + "value": "关注" + }, + { + "name": "fixed_investment_button", + "value": "定投" + }, + { + "name": "buying_button", + "value": "购买" + }, + { + "name": "performance_trends", + "value": "业绩走势" + }, + { + "name": "unit_net_value", + "value": "单位净值" + }, + { + "name": "near_month", + "value": "近%d月" + }, + { + "name": "near_year", + "value": "近%d年" + }, + { + "name": "search_placeholder", + "value": "搜索..." + }, + { + "name": "pursue_profit", + "value": "追求收益" + }, + { + "name": "index_funds", + "value": "指数基金" + }, + { + "name": "common_stock", + "value": "普通股票" + }, + { + "name": "partial_stock_mix", + "value": "偏股混合" + }, + { + "name": "flexible_configuration", + "value": "灵活配置" + }, + { + "name": "tab_bar_home", + "value": "首页" + }, + { + "name": "tab_bar_card", + "value": "信用卡" + }, + { + "name": "tab_bar_fortunes", + "value": "财富" + }, + { + "name": "tab_bar_life", + "value": "生活" + }, + { + "name": "tab_bar_mine", + "value": "我的" + } + ] +} \ No newline at end of file diff --git a/features/fundComparison/Index.ets b/features/fundComparison/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..44289cbaa514a9a0469d17cb5eeb73c30ad1a132 --- /dev/null +++ b/features/fundComparison/Index.ets @@ -0,0 +1,3 @@ +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 diff --git a/features/fundComparison/build-profile.json5 b/features/fundComparison/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/features/fundComparison/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/fundComparison/hvigorfile.ts b/features/fundComparison/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..d993120bd71f5f5dfe04480be9dc5f73c00c2599 --- /dev/null +++ b/features/fundComparison/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/fundComparison/obfuscation-rules.txt b/features/fundComparison/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/features/fundComparison/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/features/fundComparison/oh-package.json5 b/features/fundComparison/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8a449523209cf65ad106f160a50be194917d972d --- /dev/null +++ b/features/fundComparison/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "fundcomparison", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic" + } +} diff --git a/features/fundComparison/src/main/ets/constants/ComparisonConstants.ets b/features/fundComparison/src/main/ets/constants/ComparisonConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d9a43d9ad4e6a674fd9223d1a8cd1ac24f32671 --- /dev/null +++ b/features/fundComparison/src/main/ets/constants/ComparisonConstants.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Fund comparison constants for comparison feature. + */ +export class ComparisonConstants { + /** + * Maximum number of fund comparisons. + */ + static readonly MAX_COMPARISON_FUND_COUNT: number = 10; + + /** + * Column space. + */ + static readonly COLUMN_SPACE: number = 2; + + /** + * List space. + */ + static readonly CHOOSE_LIST_SPACE: number = 12; + + /** + * Row space. + */ + static readonly FUND_NAME_ROW_SPACE: number = 8; +} \ No newline at end of file diff --git a/features/fundComparison/src/main/ets/pages/ComparisonDetailPage.ets b/features/fundComparison/src/main/ets/pages/ComparisonDetailPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..57ad670be2232fa6ba6c42d880d4cec548555a34 --- /dev/null +++ b/features/fundComparison/src/main/ets/pages/ComparisonDetailPage.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { ComparisonDetailComponent } from '../view/ComparisonDetailComponent'; +import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; + +@Entry +@Component +struct ComparisonDetailPage { + @State chooseComparison: ComparisonInfo[] = (router.getParams() as Record)['chooseComparison']; + + build() { + Row() { + ComparisonDetailComponent({ chooseComparison: this.chooseComparison, isPage: true }) + } + .height('100%') + } +} \ No newline at end of file diff --git a/features/fundComparison/src/main/ets/view/ComparisonComponent.ets b/features/fundComparison/src/main/ets/view/ComparisonComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcc7b329c2277586f3e178992e367a874287ce9b --- /dev/null +++ b/features/fundComparison/src/main/ets/view/ComparisonComponent.ets @@ -0,0 +1,334 @@ +/* + * Copyright (c) 2023 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 { TreeMap } from '@kit.ArkTS'; +import { CommonConstants } from '@ohos/basic'; +import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; +import FundComparisonViewModel from '../viewmodel/FundComparisonViewModel'; +import { ComparisonConstants } from '../constants/ComparisonConstants'; + +@Component +export struct ComparisonComponent { + @State currentPoint: string = CommonConstants.BREAK_POINT_SM; + @State chooseComparison: ComparisonInfo[] = []; + @State map: TreeMap = new TreeMap(); + @State defaultAllComparison: ComparisonInfo[] = FundComparisonViewModel.getFundComparisonList(); + @State indexArray: number[] = []; + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + private controller: TabsController = new TabsController(); + @State tabBarIndex: number = 0; + + build() { + 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 + }) { + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + 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')) + .onClick(() => { + this.pageInfo.pop(); + }) + Text($r('app.string.funding_comparison_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + } + .height($r('app.float.title_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.Visible : Visibility.None) + + Row() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + Text($r('app.string.funding_comparison_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + .margin({ + left: $r('app.float.padding_common') + }) + } + Row() { + Search({ placeholder: $r('app.string.search_placeholder') }) + .width($r('app.float.search_width')) + .enableKeyboardOnFocus(false) + .margin({ + right: $r('app.float.padding_common') + }) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + this.pageInfo.pop(); + }) + } + } + .height($r('app.float.title_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.None : Visibility.Visible) + + Search({ placeholder: $r('app.string.search_placeholder') }) + .margin({ + top: $r('app.float.search_margin_top') + }) + .enableKeyboardOnFocus(false) + .visibility(this.currentPoint === CommonConstants.BREAK_POINT_SM ? Visibility.Visible : Visibility.None) + + Tabs() { + TabContent() { + List() { + ForEach(this.defaultAllComparison, (item: ComparisonInfo, index: number) => { + ListItem() { + Row() { + Checkbox() + .shape(CheckBoxShape.ROUNDED_SQUARE) + .select(this.indexArray.indexOf(index) != -1) + .onChange((value: boolean) => { + if (value) { + this.map.set(index, item); + } else { + this.map.remove(index); + } + this.chooseComparison = Array.from(this.map.values()); + this.indexArray = Array.from(this.map.keys()); + if (this.map.length > ComparisonConstants.MAX_COMPARISON_FUND_COUNT) { + this.map.remove(index); + this.chooseComparison = Array.from(this.map.values()); + this.indexArray = Array.from(this.map.keys()); + return; + } + }) + Column({ space: ComparisonConstants.COLUMN_SPACE }) { + Text(item.name) + .fontSize($r('app.float.name_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .lineHeight($r('app.float.common_line_height')) + Text(item.code) + .fontSize($r('app.float.code_size')) + .fontColor($r('app.color.sixty_percent_white')) + } + .layoutWeight(1) + .border({ + width: { + bottom: $r('app.float.common_border_width') + }, + color: $r('app.color.five_percent_white') + }) + .alignItems(HorizontalAlign.Start) + .padding({ + bottom: $r('app.float.list_padding_bottom') + }) + .margin({ + left: $r('app.float.list_margin_left') + }) + } + } + .height($r("app.float.list_item_height")) + }) + } + .lanes(this.currentPoint === CommonConstants.BREAK_POINT_SM ? 1 : 2) + } + .tabBar($r('app.string.fund_popularity')) + + TabContent() { + + } + .tabBar($r('app.string.self_selected')) + } + .barMode(BarMode.Fixed) + .barWidth($r('app.float.choose_tab_width')) + .layoutWeight(1) + + Row() { + if (this.chooseComparison.length > 0) { + Column() { + Row({ space: ComparisonConstants.CHOOSE_LIST_SPACE }) { + Text($r('app.string.no_currency', this.chooseComparison.length)) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 0 ? $r('app.color.harmony_blue') : Color.Black) + .onClick(() => { + this.tabBarIndex = 0; + this.controller.changeIndex(this.tabBarIndex); + }) + Text($r('app.string.currency_bar', 0)) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.common_line_height')) + .fontColor(this.tabBarIndex === 1 ? $r('app.color.harmony_blue') : Color.Black) + .onClick(() => { + this.tabBarIndex = 1; + this.controller.changeIndex(this.tabBarIndex); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Center) + .height($r('app.float.title_height')) + + Tabs({ controller: this.controller }) { + TabContent() { + List({ space: ComparisonConstants.CHOOSE_LIST_SPACE }) { + ForEach(this.chooseComparison, (item: ComparisonInfo) => { + ListItem() { + Stack() { + Row() { + Text(item.name) + .fontSize($r('app.float.stack_text_size')) + } + .backgroundColor($r('app.color.five_percent_white')) + .borderRadius($r('app.float.row_border_radius')) + .padding({ + top: $r('app.float.stack_row_padding_top'), + bottom: $r('app.float.stack_row_padding_bottom'), + left: $r('app.float.stack_row_padding_left'), + right: $r('app.float.stack_row_padding_right') + }) + .margin({ + top: $r('app.float.stack_row_margin_top') + }) + Row() { + Image($r('app.media.ic_public_close')) + .width($r('app.float.close_image')) + .height($r('app.float.close_image')) + .fillColor($r('app.color.forty_percent_white')) + .onClick(() => { + for (let i = 0; i < this.defaultAllComparison.length; i++) { + if (item.code === this.defaultAllComparison[i].code) { + this.map.remove(i); + this.indexArray = Array.from(this.map.keys()); + this.chooseComparison = Array.from(this.map.values()); + } + } + }) + } + .layoutWeight(1) + .justifyContent(FlexAlign.End) + .alignItems(VerticalAlign.Top) + } + .align(Alignment.TopEnd) + } + }) + } + .listDirection(Axis.Horizontal) + .height($r('app.float.content_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + .tabBar($r('app.string.no_currency', this.chooseComparison.length)) + + TabContent() { + + } + .tabBar($r('app.string.currency_bar', 0)) + } + .layoutWeight(1) + .barHeight(0) + .scrollable(false) + + Row() { + Column() { + Text($r('app.string.count_choose', this.chooseComparison.length)) + .fontSize($r('app.float.choose_count_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.max_count_choose')) + .fontSize($r('app.float.choose_hints_size')) + .lineHeight($r('app.float.choose_hints_lint_height')) + .fontColor($r('app.color.sixty_percent_white')) + } + + Button($r('app.string.start_comparison')) + .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')) + .fontColor(Color.White) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .onClick(() => { + this.pageInfo.pushPathByName(CommonConstants.PATH_COMPARISON_DETAIL, this.chooseComparison); + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + } else { + Row() { + Text($r('app.string.select_fund')) + .fontSize($r('app.float.common_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Button($r('app.string.start_comparison')) + .backgroundColor($r('app.color.start_comparison_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')) + .fontColor(Color.White) + .fontSize($r('app.float.common_font_size')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + } + .height(this.chooseComparison.length > 0 ? + $r('app.float.bottom_choose_height_show') : $r('app.float.bottom_choose_height')) + } + } + } + .padding({ + left: $r('app.float.comparison_padding_left'), + right: $r('app.float.comparison_padding_right'), + bottom: $r('app.float.comparison_padding_bottom') + }) + .onBreakpointChange((breakpoints: string) => { + this.currentPoint = breakpoints; + }) + } + .hideTitleBar(true) + } +} \ No newline at end of file diff --git a/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets b/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..34b99689f5e419fc40ebfabdcc5e47e68d691d46 --- /dev/null +++ b/features/fundComparison/src/main/ets/view/ComparisonDetailComponent.ets @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { CommonConstants, RouterConstants } from '@ohos/basic'; +import { ComparisonConstants } from '../constants/ComparisonConstants'; +import { ComparisonInfo } from '../viewmodel/ComparisonInfo'; +import FundComparisonViewModel from '../viewmodel/FundComparisonViewModel'; + +@Component +export struct ComparisonDetailComponent { + @State chooseComparison: ComparisonInfo[] = FundComparisonViewModel.getFundComparisonList(); + @State isListScroll: boolean = true; + @State isScroll: boolean = true; + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State isPage: Boolean = false; + @StorageProp('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; + private nameColorArr: ResourceColor[] = [ + $r('app.color.name_color_1'), + $r('app.color.name_color_2'), + $r('app.color.name_color_3') + ]; + scroller: Scroller = new Scroller(); + scrollerList: Scroller = new Scroller(); + + build() { + Column() { + Row() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .margin({ + right: $r('app.float.image_margin_right') + }) + .onClick(() => { + if (this.isPage) { + router.back(); + } else { + this.pageInfo.pop(); + } + }) + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + if (this.isPage) { + Image($r('app.media.ic_public_reduce')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + router.back(); + }) + } 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 } + }) + }) + } + } + } + Text($r('app.string.funding_comparison_title')) + .fontSize($r('app.float.title_text_size')) + .fontColor($r('app.color.sixty_percent_white')) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.common_image')) + .height($r('app.float.common_image')) + .onClick(() => { + if (this.isPage) { + router.back(); + } else { + this.pageInfo.pop(); + } + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + top: $r('app.float.title_padding_top'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Tabs() { + TabContent() { + Column() { + Row() { + Row() { + Text($r('app.string.table_fund_name')) + .fontSize($r('app.float.fund_name_size')) + .lineHeight($r('app.float.fund_name_line_height')) + .fontColor($r('app.color.sixty_percent_white')) + } + .width($r('app.float.fund_name_width')) + .height($r('app.float.fund_name_height')) + .alignItems(VerticalAlign.Center) + .justifyContent(FlexAlign.Center) + + List({ space: ComparisonConstants.FUND_NAME_ROW_SPACE, scroller: this.scrollerList }) { + ForEach(this.chooseComparison, (item: ComparisonInfo, index: number) => { + ListItem() { + Column() { + Row() { + Image($r('app.media.ic_fixing')) + .width($r('app.float.fixing_width')) + .height($r('app.float.fixing_height')) + Image($r('app.media.ic_public_cancel')) + .width($r('app.float.cancel_width')) + .height($r('app.float.cancel_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.fixing_image_padding'), + right: $r('app.float.fixing_image_padding'), + bottom: $r('app.float.fixing_image_padding') + }) + + Row() { + Divider() + .vertical(true) + .width($r('app.float.divider_fixing_width')) + .height($r('app.float.divider_fixing_height')) + .color(this.nameColorArr[index % this.nameColorArr.length]) + .borderRadius($r('app.float.divider_fixing_radius')) + Text(item.name) + .fontSize($r('app.float.list_fund_name_size')) + .lineHeight($r('app.float.list_name_line_height')) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .margin({ + left: $r('app.float.list_name_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + } + .width($r('app.float.list_name_width')) + .height($r('app.float.list_name_height')) + .backgroundColor($r('app.color.background')) + .borderRadius($r('app.float.list_name_radius')) + }) + } + .scrollBar(BarState.Off) + .listDirection(Axis.Horizontal) + .edgeEffect(EdgeEffect.None) + .onScroll((scrollOffset: number) => { + if (this.isScroll) { + let offset = this.scrollerList.currentOffset().xOffset; + this.scroller.scrollTo({ xOffset: offset, yOffset: 0 }); + } + }) + .onScrollFrameBegin((offset: number) => { + this.isListScroll = false; + return { offsetRemain: offset } + }) + .onScrollStop(() => { + this.isListScroll = true; + }) + .layoutWeight(1) + } + .height($r('app.float.list_name_height')) + + Divider() + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r("app.float.common_divider")) + .backgroundColor($r('app.color.divider_background')) + .margin({ + top: $r('app.float.divider_margin_top'), + bottom: $r('app.float.divider_margin_bottom') + }) + Text($r('app.string.base_info')) + .fontSize($r('app.float.common_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontColor($r('app.color.info_text')) + .margin({ + left: $r('app.float.info_margin_left') + }) + Scroll() { + Row() { + List() { + ForEach(FundComparisonViewModel.getComparisonCategory(), (item: ResourceStr) => { + ListItem() { + Text(item) + .fontSize($r('app.float.list_head_size')) + .lineHeight($r('app.float.list_head_line_height')) + .fontColor($r('app.color.sixty_percent_white')) + .width($r('app.float.list_head_text_width')) + } + .height($r('app.float.list_head_height')) + .width($r('app.float.list_head_width')) + }) + } + .border({ + width: { + top: $r('app.float.list_head_border'), + bottom: $r('app.float.list_head_border') + }, + color: $r('app.color.ten_percent_white') + }) + .width($r('app.float.list_head_width')) + .divider({ + strokeWidth: $r("app.float.common_divider"), + color: $r('app.color.ten_percent_white') + }) + + Scroll(this.scroller) { + Row() { + ForEach(this.chooseComparison, (item: ComparisonInfo) => { + List() { + ListItem() { + Text(item.code) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.type) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.establishedTime) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.scale}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.risksLevel) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.rating}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.dividends}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(`${item.dividendsCount}`) + .buildScrollListText() + } + .listStyle() + + ListItem() { + Text(item.fundManager) + .buildScrollListText() + } + .listStyle() + } + .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"), + color: $r('app.color.ten_percent_white') + }) + }) + } + .justifyContent(FlexAlign.Start) + } + .scrollable(ScrollDirection.Horizontal) + .scrollBar(BarState.Off) + .edgeEffect(EdgeEffect.None) + .onScroll((scrollOffset: number) => { + if (this.isListScroll) { + let offset = this.scroller.currentOffset().xOffset; + this.scrollerList.scrollTo({ xOffset: offset, yOffset: 0 }); + } + }) + .onScrollStop(() => { + this.isScroll = true; + }) + .onScrollFrameBegin((offset: number) => { + this.isScroll = false; + return { offsetRemain: offset }; + }) + .layoutWeight(1) + .align(Alignment.Start) + } + .justifyContent(FlexAlign.Start) + .alignItems(VerticalAlign.Top) + } + .layoutWeight(1) + .align(Alignment.Top) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .alignItems(HorizontalAlign.Start) + .justifyContent(FlexAlign.Start) + } + .tabBar($r('app.string.no_currency', this.chooseComparison.length)) + + TabContent() { + + } + .tabBar($r('app.string.currency_bar', 0)) + } + .barMode(BarMode.Fixed) + .barWidth($r('app.float.choose_tab_width')) + .layoutWeight(1) + } + } + + @Styles + listStyle() { + .height($r('app.float.list_style_height')) + .width($r('app.float.list_style_width')) + } +} + +@Extend(Text) +function buildScrollListText() { + .fontSize($r('app.float.list_text_size')) + .lineHeight($r('app.float.list_text_line_height')) + .fontColor($r('app.color.sixty_percent_white')) + .width($r('app.float.list_text_width')) + .textAlign(TextAlign.Center) +} diff --git a/features/fundComparison/src/main/ets/viewmodel/ComparisonInfo.ets b/features/fundComparison/src/main/ets/viewmodel/ComparisonInfo.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1d8068f4823d21178f1e141f730682748c29ddb --- /dev/null +++ b/features/fundComparison/src/main/ets/viewmodel/ComparisonInfo.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Comparison information entity class. + */ +export class ComparisonInfo { + name: ResourceStr; + code: ResourceStr; + type: ResourceStr; + establishedTime: ResourceStr; + scale: number; + risksLevel: ResourceStr; + rating: number; + dividends: number; + dividendsCount: number; + fundManager: ResourceStr; + + constructor(name: ResourceStr, code: ResourceStr, type: ResourceStr, establishedTime: ResourceStr, scale: number, + risksLevel: ResourceStr, rating: number, dividends: number, dividendsCount: number, fundManager: ResourceStr) { + this.name = name; + this.code = code; + this.type = type; + this.establishedTime = establishedTime; + this.scale = scale; + this.risksLevel = risksLevel; + this.rating = rating; + this.dividends = dividends; + this.dividendsCount = dividendsCount; + this.fundManager = fundManager; + } +} \ No newline at end of file diff --git a/features/fundComparison/src/main/ets/viewmodel/FundComparisonViewModel.ets b/features/fundComparison/src/main/ets/viewmodel/FundComparisonViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d5fc8dfe19281666769ceb2bdfe18790b8cec4e --- /dev/null +++ b/features/fundComparison/src/main/ets/viewmodel/FundComparisonViewModel.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 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 { ComparisonInfo } from './ComparisonInfo'; + +/** + * Get fund comparison data. + */ +class FundComparisonViewModel { + getFundComparisonList(): ComparisonInfo[] { + let comparisonInfoList: ComparisonInfo[] = [ + new ComparisonInfo('XXXX基金1', '000000', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'H**'), + new ComparisonInfo('XXXX基金2', '111111', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'A**'), + new ComparisonInfo('XXXX基金3', '222222', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'B**'), + new ComparisonInfo('XXXX基金4', '333333', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'C**'), + new ComparisonInfo('XXXX基金5', '444444', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'D**'), + new ComparisonInfo('XXXX基金6', '555555', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'E**'), + new ComparisonInfo('XXXX基金7', '666666', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'F**'), + new ComparisonInfo('XXXX基金8', '777777', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'G**'), + new ComparisonInfo('XXXX基金9', '888888', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'H**'), + new ComparisonInfo('XXXX基金10', '999099', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'I**'), + new ComparisonInfo('XXXX基金11', '121212', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'J**'), + new ComparisonInfo('XXXX基金12', '131313', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'K**'), + new ComparisonInfo('XXXX基金13', '000001', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'L**'), + new ComparisonInfo('XXXX基金14', '000002', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'M**'), + new ComparisonInfo('XXXX基金15', '000003', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'N**'), + new ComparisonInfo('XXXX基金16', '000004', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'O**'), + new ComparisonInfo('XXXX基金17', '000005', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'P**'), + new ComparisonInfo('XXXX基金18', '000006', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'Q**'), + new ComparisonInfo('XXXX基金19', '000007', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'R**'), + new ComparisonInfo('XXXX基金20', '000008', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'S**'), + new ComparisonInfo('XXXX基金21', '000009', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'T**'), + new ComparisonInfo('XXXX基金22', '323323', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'U**'), + new ComparisonInfo('XXXX基金23', '322443', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'V**'), + new ComparisonInfo('XXXX基金24', '667783', '股票型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'W**'), + new ComparisonInfo('XXXX基金25', '123456', '混合型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'X**'), + new ComparisonInfo('XXXX基金26', '643245', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'Y**'), + new ComparisonInfo('XXXX基金27', '908998', '债券型', '2018/09/10', 27.44, '中高风险', 2, 0, 0, 'Z**'), + ]; + return comparisonInfoList; + } + + getComparisonCategory(): ResourceStr[] { + let category: ResourceStr[] = [ + $r('app.string.category_fund_code'), + $r('app.string.category_fund_type'), + $r('app.string.category_established_time'), + $r('app.string.category_new_scale'), + $r('app.string.category_risks_level'), + $r('app.string.category_three_rating'), + $r('app.string.category_accumulated_dividends'), + $r('app.string.category_dividends_count'), + $r('app.string.category_fund_manager') + ]; + + return category; + } +} + +export default new FundComparisonViewModel(); \ No newline at end of file diff --git a/features/fundComparison/src/main/module.json5 b/features/fundComparison/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e4dbff6a466381f96d31f089d8aab66e037c4c28 --- /dev/null +++ b/features/fundComparison/src/main/module.json5 @@ -0,0 +1,14 @@ +{ + "module": { + "name": "fundComparison", + "type": "shared", + "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 new file mode 100644 index 0000000000000000000000000000000000000000..89e96acd2b7ade2f0902efba577d5b27ab3e296a --- /dev/null +++ b/features/fundComparison/src/main/resources/base/element/color.json @@ -0,0 +1,68 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "five_percent_black", + "value": "#0dffffff" + }, + { + "name": "five_percent_white", + "value": "#0d000000" + }, + { + "name": "sixty_percent_black", + "value": "#99ffffff" + }, + { + "name": "sixty_percent_white", + "value": "#99000000" + }, + { + "name": "forty_percent_white", + "value": "#66000000" + }, + { + "name": "start_button_background", + "value": "#0a59f7" + }, + { + "name": "start_comparison_background", + "value": "#660a59f7" + }, + { + "name": "name_color_1", + "value": "#0A59F7" + }, + { + "name": "name_color_2", + "value": "#E84026" + }, + { + "name": "name_color_3", + "value": "#28AD2B" + }, + { + "name": "background", + "value": "#F7F7F7" + }, + { + "name": "divider_background", + "value": "#1a000000" + }, + { + "name": "info_text", + "value": "#182431" + }, + { + "name": "ten_percent_white", + "value": "#1a000000" + }, + { + "name": "harmony_blue", + "value": "#0A59F7" + } + ] +} \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/element/float.json b/features/fundComparison/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..439663b89f6cad900be0bb99dbd3d18e757ba3ba --- /dev/null +++ b/features/fundComparison/src/main/resources/base/element/float.json @@ -0,0 +1,296 @@ +{ + "float": [ + { + "name": "common_image", + "value": "24vp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "common_line_height", + "value": "22vp" + }, + { + "name": "common_font_size", + "value": "16fp" + }, + { + "name": "common_divider", + "value": "1vp" + }, + { + "name": "title_text_size", + "value": "18fp" + }, + { + "name": "title_height", + "value": "56vp" + }, + { + "name": "search_margin_top", + "value": "24vp" + }, + { + "name": "name_size", + "value": "16fp" + }, + { + "name": "code_size", + "value": "14fp" + }, + { + "name": "common_border_width", + "value": "1vp" + }, + { + "name": "list_padding_bottom", + "value": "10vp" + }, + { + "name": "list_margin_left", + "value": "16vp" + }, + { + "name": "list_item_height", + "value": "64vp" + }, + { + "name": "tab_margin", + "value": "0vp" + }, + { + "name": "stack_text_size", + "value": "12vp" + }, + { + "name": "row_border_radius", + "value": "14vp" + }, + { + "name": "stack_row_padding_top", + "value": "5.5vp" + }, + { + "name": "stack_row_padding_bottom", + "value": "6.5vp" + }, + { + "name": "stack_row_padding_left", + "value": "8vp" + }, + { + "name": "stack_row_padding_right", + "value": "8vp" + }, + { + "name": "stack_row_margin_top", + "value": "8vp" + }, + { + "name": "close_image", + "value": "16vp" + }, + { + "name": "content_height", + "value": "45vp" + }, + { + "name": "choose_count_size", + "value": "16fp" + }, + { + "name": "choose_hints_size", + "value": "14fp" + }, + { + "name": "choose_hints_lint_height", + "value": "19vp" + }, + { + "name": "start_button_width_sm", + "value": "120vp" + }, + { + "name": "start_button_width", + "value": "221vp" + }, + { + "name": "start_button_height", + "value": "40vp" + }, + { + "name": "bottom_choose_height_show", + "value": "175vp" + }, + { + "name": "bottom_choose_height", + "value": "64vp" + }, + { + "name": "comparison_padding_left", + "value": "24vp" + }, + { + "name": "comparison_padding_right", + "value": "24vp" + }, + { + "name": "comparison_padding_bottom", + "value": "32vp" + }, + { + "name": "title_padding_top", + "value": "4vp" + }, + { + "name": "fund_name_size", + "value": "14fp" + }, + { + "name": "fund_name_line_height", + "value": "19vp" + }, + { + "name": "fund_name_width", + "value": "96vp" + }, + { + "name": "fund_name_height", + "value": "64vp" + }, + { + "name": "fixing_width", + "value": "8vp" + }, + { + "name": "fixing_height", + "value": "10.18vp" + }, + { + "name": "cancel_width", + "value": "6.79vp" + }, + { + "name": "cancel_height", + "value": "10.18vp" + }, + { + "name": "fixing_image_padding", + "value": "8vp" + }, + { + "name": "divider_fixing_width", + "value": "2vp" + }, + { + "name": "divider_fixing_height", + "value": "20vp" + }, + { + "name": "divider_fixing_radius", + "value": "1vp" + }, + { + "name": "list_fund_name_size", + "value": "14vp" + }, + { + "name": "list_name_line_height", + "value": "20vp" + }, + { + "name": "list_name_margin_left", + "value": "12vp" + }, + { + "name": "list_name_width", + "value": "96vp" + }, + { + "name": "list_name_height", + "value": "64vp" + }, + { + "name": "list_name_radius", + "value": "8vp" + }, + { + "name": "divider_margin_top", + "value": "11.5vp" + }, + { + "name": "divider_margin_bottom", + "value": "20.5vp" + }, + { + "name": "info_margin_left", + "value": "24vp" + }, + { + "name": "list_head_size", + "value": "14fp" + }, + { + "name": "list_head_line_height", + "value": "19vp" + }, + { + "name": "list_head_text_width", + "value": "60vp" + }, + { + "name": "list_head_width", + "value": "96vp" + }, + { + "name": "list_head_height", + "value": "56vp" + }, + { + "name": "list_head_border", + "value": "1vp" + }, + { + "name": "scroll_list_width", + "value": "104vp" + }, + { + "name": "list_style_height", + "value": "56vp" + }, + { + "name": "list_style_width", + "value": "100vp" + }, + { + "name": "list_text_size", + "value": "14fp" + }, + { + "name": "list_text_line_height", + "value": "19vp" + }, + { + "name": "list_text_width", + "value": "80vp" + }, + { + "name": "tab_text_size", + "value": "16vp" + }, + { + "name": "search_width", + "value": "232vp" + }, + { + "name": "choose_tab_width", + "value": "300vp" + }, + { + "name": "image_margin_right", + "value": "24vp" + } + ] +} \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/element/string.json b/features/fundComparison/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..97b9ff420b50508c4a71f2e9b0ca2938160285a2 --- /dev/null +++ b/features/fundComparison/src/main/resources/base/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "fund_popularity", + "value": "popularity" + }, + { + "name": "self_selected", + "value": "self-selected" + }, + { + "name": "select_fund", + "value": "Please select the fund from above" + }, + { + "name": "start_comparison", + "value": "Start the comparison" + }, + { + "name": "no_currency", + "value": "Non-monetary %d" + }, + { + "name": "currency_bar", + "value": "currency %d" + }, + { + "name": "count_choose", + "value": "%d funds selected" + }, + { + "name": "max_count_choose", + "value": "A maximum of 10 items can be selected for a single type" + }, + { + "name": "funding_comparison_title", + "value": "fund comparison" + }, + { + "name": "table_fund_name", + "value": "fund name" + }, + { + "name": "base_info", + "value": "base info" + }, + { + "name": "category_fund_code", + "value": "fund code" + }, + { + "name": "category_fund_type", + "value": "fund type" + }, + { + "name": "category_established_time", + "value": "established time" + }, + { + "name": "category_new_scale", + "value": "new scale" + }, + { + "name": "category_risks_level", + "value": "risks level" + }, + { + "name": "category_three_rating", + "value": "three year rating" + }, + { + "name": "category_accumulated_dividends", + "value": "accumulated dividends" + }, + { + "name": "category_dividends_count", + "value": "dividends count" + }, + { + "name": "category_fund_manager", + "value": "fund manager" + } + ] +} \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/media/ic_fixing.png b/features/fundComparison/src/main/resources/base/media/ic_fixing.png new file mode 100644 index 0000000000000000000000000000000000000000..47f0efbd64cf1806458077bc2e6c113e1589f34d Binary files /dev/null and b/features/fundComparison/src/main/resources/base/media/ic_fixing.png differ diff --git a/features/fundComparison/src/main/resources/base/media/ic_public_back.svg b/features/fundComparison/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/features/fundComparison/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/media/ic_public_cancel.svg b/features/fundComparison/src/main/resources/base/media/ic_public_cancel.svg new file mode 100644 index 0000000000000000000000000000000000000000..36565c84256be091beb9bd8d8494c5e073defc3f --- /dev/null +++ b/features/fundComparison/src/main/resources/base/media/ic_public_cancel.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cancel + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/media/ic_public_close.svg b/features/fundComparison/src/main/resources/base/media/ic_public_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..4e76b8417ed1a123708d76b64d3c16c8fc2f4908 --- /dev/null +++ b/features/fundComparison/src/main/resources/base/media/ic_public_close.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_close + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/media/ic_public_enlarge.svg b/features/fundComparison/src/main/resources/base/media/ic_public_enlarge.svg new file mode 100644 index 0000000000000000000000000000000000000000..252b8fe5c6424f8d5f2eefaee0f4e410e771235e --- /dev/null +++ b/features/fundComparison/src/main/resources/base/media/ic_public_enlarge.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_enlarge + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/media/ic_public_reduce.svg b/features/fundComparison/src/main/resources/base/media/ic_public_reduce.svg new file mode 100644 index 0000000000000000000000000000000000000000..142d090e8c48b30f9f694ae2571754ba110f1645 --- /dev/null +++ b/features/fundComparison/src/main/resources/base/media/ic_public_reduce.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_reduce + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/base/media/icon.png b/features/fundComparison/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/fundComparison/src/main/resources/base/media/icon.png differ diff --git a/features/fundComparison/src/main/resources/base/media/setting.jpeg b/features/fundComparison/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/features/fundComparison/src/main/resources/base/media/setting.jpeg differ diff --git a/features/fundComparison/src/main/resources/base/profile/main_pages.json b/features/fundComparison/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..143a64e30e20c8d58cc7c0deb75ba5a6d6573b31 --- /dev/null +++ b/features/fundComparison/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/ComparisonDetailPage" + ] +} + diff --git a/features/fundComparison/src/main/resources/en_US/element/string.json b/features/fundComparison/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..97b9ff420b50508c4a71f2e9b0ca2938160285a2 --- /dev/null +++ b/features/fundComparison/src/main/resources/en_US/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "fund_popularity", + "value": "popularity" + }, + { + "name": "self_selected", + "value": "self-selected" + }, + { + "name": "select_fund", + "value": "Please select the fund from above" + }, + { + "name": "start_comparison", + "value": "Start the comparison" + }, + { + "name": "no_currency", + "value": "Non-monetary %d" + }, + { + "name": "currency_bar", + "value": "currency %d" + }, + { + "name": "count_choose", + "value": "%d funds selected" + }, + { + "name": "max_count_choose", + "value": "A maximum of 10 items can be selected for a single type" + }, + { + "name": "funding_comparison_title", + "value": "fund comparison" + }, + { + "name": "table_fund_name", + "value": "fund name" + }, + { + "name": "base_info", + "value": "base info" + }, + { + "name": "category_fund_code", + "value": "fund code" + }, + { + "name": "category_fund_type", + "value": "fund type" + }, + { + "name": "category_established_time", + "value": "established time" + }, + { + "name": "category_new_scale", + "value": "new scale" + }, + { + "name": "category_risks_level", + "value": "risks level" + }, + { + "name": "category_three_rating", + "value": "three year rating" + }, + { + "name": "category_accumulated_dividends", + "value": "accumulated dividends" + }, + { + "name": "category_dividends_count", + "value": "dividends count" + }, + { + "name": "category_fund_manager", + "value": "fund manager" + } + ] +} \ No newline at end of file diff --git a/features/fundComparison/src/main/resources/zh_CN/element/string.json b/features/fundComparison/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..979ecb5cecfe179cbc8ad28eecc5828957604998 --- /dev/null +++ b/features/fundComparison/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,92 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "search_placeholder", + "value": "搜索..." + }, + { + "name": "fund_popularity", + "value": "热门" + }, + { + "name": "self_selected", + "value": "自选" + }, + { + "name": "select_fund", + "value": "请从上方选择基金" + }, + { + "name": "start_comparison", + "value": "开始对比" + }, + { + "name": "no_currency", + "value": "非货币 %d" + }, + { + "name": "currency_bar", + "value": "货币 %d" + }, + { + "name": "count_choose", + "value": "已选择%d只基金" + }, + { + "name": "max_count_choose", + "value": "单类型最多选10只" + }, + { + "name": "funding_comparison_title", + "value": "基金比较" + }, + { + "name": "table_fund_name", + "value": "基金名称" + }, + { + "name": "base_info", + "value": "基本信息" + }, + { + "name": "category_fund_code", + "value": "基金代码" + }, + { + "name": "category_fund_type", + "value": "基金类型" + }, + { + "name": "category_established_time", + "value": "成立日期" + }, + { + "name": "category_new_scale", + "value": "最新规模 (亿元)" + }, + { + "name": "category_risks_level", + "value": "风险等级" + }, + { + "name": "category_three_rating", + "value": "三年评级" + }, + { + "name": "category_accumulated_dividends", + "value": "累计分红" + }, + { + "name": "category_dividends_count", + "value": "分红次数" + }, + { + "name": "category_fund_manager", + "value": "基金经理" + } + ] +} \ No newline at end of file diff --git a/features/home/Index.ets b/features/home/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..73dd4a70d82ea7cbb7b720290a26d4de94dd62e4 --- /dev/null +++ b/features/home/Index.ets @@ -0,0 +1,2 @@ +export { AdvertisementDialog } from "./src/main/ets/view/AdvertisementDialog" +export { HomeComponent } from "./src/main/ets/view/HomeComponent" \ No newline at end of file diff --git a/features/home/build-profile.json5 b/features/home/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/features/home/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/home/hvigorfile.ts b/features/home/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..d993120bd71f5f5dfe04480be9dc5f73c00c2599 --- /dev/null +++ b/features/home/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/home/obfuscation-rules.txt b/features/home/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/features/home/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/features/home/oh-package.json5 b/features/home/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..31c266be418d28dbc0529c9adc15f15eaa0d4a18 --- /dev/null +++ b/features/home/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "home", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic" + } +} diff --git a/features/home/src/main/ets/constants/HomeConstants.ets b/features/home/src/main/ets/constants/HomeConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5f96157a83011c7260120ca17933f688df1425c --- /dev/null +++ b/features/home/src/main/ets/constants/HomeConstants.ets @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Home constants for home feature. + */ +export class HomeConstants { + /** + * Title row space. + */ + static readonly TITLE_ROW_SPACE: number = 16; + + /** + * Gps row space. + */ + static readonly GPS_ROW_SPACE: number = 4; + + /** + * List space. + */ + static readonly LIST_SPACE: number = 12; + + /** + * Row space. + */ + static readonly ROW_SPACE: number = 12; + + /** + * Main business row space. + */ + static readonly MAIN_ROW_SPACE: number = 8; + + /** + * Button row space. + */ + static readonly BUTTON_ROW_SPACE: number = 4; + + /** + * List sliding offset. + */ + static readonly LIST_SLIDING_OFFSET: number = -750; + + /** + * List sliding offset under lg power outage. + */ + static readonly LIST_SLIDING_OFFSET_LG: number = -450; + + /** + * Get business data start index. + */ + static readonly BUSINESS_DATA_COUNT_START: number = 0; + + /** + * Get business data under sm power outage. + */ + static readonly BUSINESS_DATA_COUNT_SM: number = 4; + + /** + * Get business data under md power outage. + */ + static readonly BUSINESS_DATA_COUNT_MD: number = 6; + + /** + * Get business data under lg power outage. + */ + static readonly BUSINESS_DATA_COUNT_LG: number = 8; + + /** + * Get swiper display count under sm power outage. + */ + static readonly SWIPER_DISPLAY_COUNT_SM: number = 1; + + /** + * Get swiper display count under md power outage. + */ + static readonly SWIPER_DISPLAY_COUNT_MD: number = 2; + + /** + * Get swiper display count under lg power outage. + */ + static readonly SWIPER_DISPLAY_COUNT_LG: number = 4; + + /** + * Get list lanes count under sm power outage. + */ + static readonly LIST_LANES_COUNT_SM: number = 1; + + /** + * Get list lanes count under md power outage. + */ + static readonly LIST_LANES_COUNT_MD: number = 2; + + /** + * Get list lanes count under lg power outage. + */ + static readonly LIST_LANES_COUNT_LG: number = 4; + + /** + * Get swiper item space under sm power outage. + */ + static readonly SWIPER_SPACE_SM: number = 13; + + /** + * Get swiper item space under md power outage. + */ + static readonly SWIPER_SPACE_MD: number = 13; + + /** + * Get swiper item space under lg power outage. + */ + static readonly SWIPER_SPACE_LG: number = 16; + + /** + * Get row space under md power outage. + */ + static readonly BUSINESS_ROW_SPACE_MD: number = 12; + + /** + * Get row space under lg power outage. + */ + static readonly BUSINESS_ROW_SPACE_LG: number = 30; + + /** + * Get flex height under sm power outage. + */ + static readonly DEMAND_FLEX_HEIGHT_SM: string = '96vp'; + + /** + * Get flex height. + */ + static readonly DEMAND_FLEX_HEIGHT: string = '48vp'; + + /** + * Get column width. + */ + static readonly DEMAND_LG_WIDTH: string = '32%'; + + /** + * Get main business row width. + */ + static readonly MAIN_BUSINESS_WIDTH: string = '20%'; +} \ No newline at end of file diff --git a/features/home/src/main/ets/pages/AccountPage.ets b/features/home/src/main/ets/pages/AccountPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a0b3fb1c996e27f8fab5d9ef348c4675c37c233 --- /dev/null +++ b/features/home/src/main/ets/pages/AccountPage.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2023 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 { window } from '@kit.ArkUI'; +import { CommonConstants } from '@ohos/basic/Index'; +import { AccountComponent } from '../view/AccountComponent'; + +@Entry +@Component +struct AccountPage { + @StorageProp('avoidArea') topHeight: number = 0; + + onPageShow() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let area = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + let topHeight = px2vp(area.topRect.height); + if (topHeight > 0) { + windowStage.setWindowLayoutFullScreen(true); + } + }); + } + + onPageHide() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + if (this.topHeight > 0) { + windowStage.setWindowLayoutFullScreen(false); + } + }); + } + + build() { + Row() { + AccountComponent() + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + + } +} \ No newline at end of file diff --git a/features/home/src/main/ets/view/AccountComponent.ets b/features/home/src/main/ets/view/AccountComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..fda1ed819f89ecb628f78af1027947fc6392ada7 --- /dev/null +++ b/features/home/src/main/ets/view/AccountComponent.ets @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { CommonConstants } from '@ohos/basic/Index'; +import { DemandDepositComponent } from './DemandDepositComponent'; +import { InvestmentComponent } from './InvestmentComponent'; +import { LiabilitiesComponent } from './LiabilitiesComponent'; + +@Preview +@Component +export struct AccountComponent { + @State breakPoint: string = CommonConstants.BREAK_POINT_SM; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + + 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: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_SM + } + }) { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(Color.White) + .onClick(() => { + router.back() + }) + Text($r('app.string.account_all_info')) + .fontSize($r('app.float.account_font_size')) + .fontColor(Color.White) + Image($r('app.media.ic_public_more')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(Color.White) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + Row() { + Text($r('app.string.account_count')) + .fontSize($r('app.float.account_count_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.account_image_width')) + .height($r('app.float.common_image_height')) + .margin({ + left: $r('app.float.account_margin_left') + }) + .fillColor(Color.White) + } + .margin({ + top: this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $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')) + } + .margin({ + top: $r('app.float.account_margin'), + bottom: this.breakPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.account_margin_bottom_lg') : $r('app.float.account_margin') + }) + Row() { + this.buildAccountItemInfo($r('app.string.current_period_amount'), $r('app.string.current_period')) + this.buildAccountItemInfo($r('app.string.investment_amount'), $r('app.string.investment_name')) + this.buildAccountItemInfo($r('app.string.remaining_due_amount'), $r('app.string.remaining_due_month')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + } + .height(this.breakPoint === CommonConstants.BREAK_POINT_LG ? + CommonConstants.FULL_HEIGHT_PERCENT : $r('app.float.account_top_height')) + .padding({ + top: $r('app.float.account_top_padding'), + bottom: $r('app.float.account_padding_common'), + left: $r('app.float.account_padding_common'), + right: $r('app.float.account_padding_common') + }) + } + .linearGradient({ + direction: GradientDirection.Left, + colors: [[$r('app.color.top_start'), 0], [$r('app.color.top_end'), 1]] + }) + .padding({ + top: this.topHeight + }) + GridCol({ + span: { + sm: CommonConstants.COLUMN_SM, + md: CommonConstants.COLUMN_MD, + lg: CommonConstants.COLUMN_MD + } + }) { + Scroll() { + Column() { + if (this.breakPoint !== CommonConstants.BREAK_POINT_LG) { + Row() { + Circle() + .fill($r('app.color.circle_color')) + .width($r('app.float.circle_width_height')) + .height($r('app.float.circle_width_height')) + .margin($r('app.float.account_margin')) + Text($r('app.string.prompt_message')) + .fontSize($r('app.float.message_font_size')) + .lineHeight($r('app.float.account_lint_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + } + + Row() { + Text($r('app.string.current_period')) + .fontSize($r('app.float.account_font_size')) + .fontColor($r('app.color.current_period_color')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.Start : FlexAlign.Center) + .margin({ + top: $r('app.float.margin_common'), + bottom: $r('app.float.current_period_margin') + }) + .padding({ + left: $r('app.float.current_period_padding') + }) + + DemandDepositComponent({ breakPoint: this.breakPoint }) + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row() { + Circle() + .fill($r('app.color.circle_color')) + .width($r('app.float.circle_width_height')) + .height($r('app.float.circle_width_height')) + .margin($r('app.float.account_margin')) + Text($r('app.string.prompt_message')) + .fontSize($r('app.float.message_font_size')) + .lineHeight($r('app.float.account_lint_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .backgroundColor(Color.White) + .borderRadius($r('app.float.common_radius')) + } + Row() { + Text($r('app.string.investment_name')) + .fontSize($r('app.float.account_font_size')) + .fontColor($r('app.color.investment_name')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.Start : FlexAlign.Center) + .margin({ + top: $r('app.float.account_margin'), + bottom: $r('app.float.current_period_margin') + }) + .padding({ + left: $r('app.float.current_period_padding') + }) + + InvestmentComponent({ breakPoint: this.breakPoint }) + Row() { + Text($r('app.string.liabilities_name')) + .fontSize($r('app.float.account_font_size')) + .fontColor($r('app.color.liabilities_name')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(this.breakPoint === CommonConstants.BREAK_POINT_LG ? FlexAlign.Start : FlexAlign.Center) + .margin({ + top: $r('app.float.margin_common'), + bottom: $r('app.float.current_period_margin') + }) + .padding({ + left: $r('app.float.current_period_padding') + }) + + LiabilitiesComponent({ breakPoint: this.breakPoint }) + } + .justifyContent(FlexAlign.Start) + } + .padding({ + left: this.breakPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.account_content_padding') : 0, + right: this.breakPoint === CommonConstants.BREAK_POINT_LG ? $r('app.float.account_content_padding') : 0 + }) + .scrollBar(BarState.Off) + } + .backgroundColor($r('app.color.account_background')) + .padding({ + bottom: this.bottom + }) + } + .backgroundColor($r('app.color.account_background')) + .onBreakpointChange((breakpoints: string) => { + this.breakPoint = breakpoints; + }) + } + + @Builder + buildAccountItemInfo(amount: ResourceStr, name: ResourceStr) { + Column() { + Text(amount) + .fontSize($r('app.float.amount_font_size')) + .fontColor(Color.White) + .fontWeight(CommonConstants.FONT_WEIGHT_500); + Text(name) + .fontSize($r('app.float.account_small_font_size')) + .fontColor(Color.White) + .opacity(0.6) + .margin({ + top: $r('app.float.amount_margin') + }) + } + } +} \ No newline at end of file diff --git a/features/home/src/main/ets/view/AdvertisementDialog.ets b/features/home/src/main/ets/view/AdvertisementDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..9521196b99603ce3c38a8f84e4e76f267c137d9c --- /dev/null +++ b/features/home/src/main/ets/view/AdvertisementDialog.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2023 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 { BreakpointUtil, CommonConstants } from '@ohos/basic'; + +@CustomDialog +export struct AdvertisementDialog { + @StorageProp('breakPoint') currentPoint: string = CommonConstants.BREAK_POINT_SM; + controller: CustomDialogController = new CustomDialogController({ + builder: AdvertisementDialog() + }); + + build() { + Column() { + Row() { + Image($r('app.media.ic_public_close')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(Color.White) + } + .justifyContent(FlexAlign.End) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .alignItems(VerticalAlign.Center) + .height($r('app.float.common_height')) + .onClick(() => { + this.controller.close(); + }) + + Image($r('app.media.ic_dialog_phone')) + .width(new BreakpointUtil({ + sm: $r('app.float.dialog_width_sm'), + md: $r('app.float.dialog_width_md'), + lg: $r('app.float.dialog_width_lg') + }).getValue(this.currentPoint)) + .height(new BreakpointUtil({ + sm: $r('app.float.dialog_height_sm'), + md: $r('app.float.dialog_height_md'), + lg: $r('app.float.dialog_height_md') + }).getValue(this.currentPoint)) + .borderRadius($r('app.float.dialog_border_radius')) + .onClick(() => { + this.controller.close(); + }) + } + .width(new BreakpointUtil({ + sm: $r('app.float.dialog_width_sm'), + md: $r('app.float.dialog_width_md'), + lg: $r('app.float.dialog_width_lg') + }).getValue(this.currentPoint)) + .height(new BreakpointUtil({ + sm: $r('app.float.dialog_all_height_sm'), + md: $r('app.float.dialog_all_height_md'), + lg: $r('app.float.dialog_all_height_lg') + }).getValue(this.currentPoint)) + } +} \ No newline at end of file diff --git a/features/home/src/main/ets/view/DemandDepositComponent.ets b/features/home/src/main/ets/view/DemandDepositComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..7dae8d0b1f0eed8a8fd3ec7306c90b00874df8d4 --- /dev/null +++ b/features/home/src/main/ets/view/DemandDepositComponent.ets @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2023 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 { CommonConstants } from '@ohos/basic/Index'; +import { HomeConstants } from '../constants/HomeConstants'; + +@Component +export struct DemandDepositComponent { + @Prop breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row({ space: HomeConstants.ROW_SPACE }) { + Column() { + Row() { + this.buildSavingCard() + this.buildImageArrowRight() + } + .justifyContent(FlexAlign.SpaceBetween) + .height($r("app.float.account_common_height")) + + Text($r('app.string.save_card_account')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildColumnItemStyles() + + Column() { + Row() { + Text($r('app.string.current_deposit')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + this.buildImageArrowRight() + } + .justifyContent(FlexAlign.SpaceBetween) + .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')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildColumnItemStyles() + Column() { + Row() { + Text($r('app.string.day_day_treasure')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + this.buildImageArrowRight() + } + .justifyContent(FlexAlign.SpaceBetween) + .height($r("app.float.account_common_height")) + Column() { + Text($r('app.string.day_day_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.yesterday_earnings_day')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .alignItems(HorizontalAlign.Start) + } + .buildColumnItemStyles() + } + .backgroundColor($r('app.color.account_background')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + bottom: $r('app.float.margin_common') + }) + .justifyContent(FlexAlign.SpaceBetween) + } else { + Row() { + Column() { + Row() { + this.buildSavingCard() + + Row() { + Text($r('app.string.save_card_account')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + + Flex({ + direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row + }) { + Row() { + Text($r('app.string.current_deposit')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + Row() { + Text($r('app.string.day_day_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + + if (this.breakPoint === CommonConstants.BREAK_POINT_MD) { + Divider() + .vertical(true) + .height($r('app.float.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') + }) + } + Row() { + Text($r('app.string.day_day_treasure')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.small_line_height')) + Row() { + Column() { + Text($r('app.string.day_day_count')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.account_lint_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.yesterday_earnings_day')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + } + .flexBasis(this.breakPoint === CommonConstants.BREAK_POINT_SM ? + HomeConstants.DEMAND_FLEX_HEIGHT_SM : HomeConstants.DEMAND_FLEX_HEIGHT) + } + } + .margin({ + right: this.breakPoint === CommonConstants.BREAK_POINT_MD ? + $r('app.float.margin_common') : $r('app.float.account_padding_common'), + left: this.breakPoint === CommonConstants.BREAK_POINT_MD ? + $r('app.float.margin_common') : $r('app.float.account_padding_common') + }) + .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')) + .justifyContent(FlexAlign.SpaceBetween) + } + } + + @Builder + buildSavingCard() { + Row() { + Text($r('app.string.saving_card')) + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500); + this.buildImageUpwards(); + } + } + + @Builder + buildImageUpwards() { + Image($r('app.media.ic_public_upwards')) + .width($r('app.float.image_account')) + .height($r('app.float.image_account')) + .margin({ + right: $r('app.float.current_period_margin') + }) + } + + @Builder + buildImageArrowRight() { + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.image_arrow')) + .height($r('app.float.common_image_height')) + .fillColor($r('app.color.image_arrow')) + .margin({ + left:$r('app.float.image_arrow_margin') + }) + } +} + +@Extend(Row) +function buildDemandRowStyles() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r("app.float.account_common_height")) +} + +@Extend(Column) +function buildColumnItemStyles() { + .width(HomeConstants.DEMAND_LG_WIDTH) + .backgroundColor(Color.White) + .alignItems(HorizontalAlign.Start) + .height($r('app.float.column_item_height')) + .padding($r('app.float.account_padding_common')) + .borderRadius($r('app.float.common_radius')) +} diff --git a/features/home/src/main/ets/view/HomeComponent.ets b/features/home/src/main/ets/view/HomeComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..b07278e85ca87ff3570047d1f1586d2501a859f7 --- /dev/null +++ b/features/home/src/main/ets/view/HomeComponent.ets @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2023 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 { router } from '@kit.ArkUI'; +import { BreakpointUtil, BusinessInfo, CommonConstants, RouterConstants } from '@ohos/basic'; +import { HomeConstants } from '../constants/HomeConstants'; +import HomeViewModel from '../viewmodel/HomeViewModel'; + +@Component +export struct HomeComponent { + @Prop currentPoint: string = CommonConstants.BREAK_POINT_SM; + @Link scrollY: number; + private offsetValue: number = 0; + + build() { + Row() { + Column() { + Row({ space: HomeConstants.TITLE_ROW_SPACE }) { + Row({ space: HomeConstants.GPS_ROW_SPACE }) { + Image($r('app.media.ic_public_gps')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + Text($r('app.string.gps_location')) + .fontSize($r('app.float.location_size')) + .fontColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + .lineHeight($r('app.float.location_text_height')) + .fontWeight(FontWeight.Normal) + } + .width($r('app.float.gps_width')) + + Blank() + + Search({ placeholder: $r('app.string.search_placeholder') }) + .width(this.currentPoint === CommonConstants.BREAK_POINT_SM ? + $r('app.float.search_width_sm') : $r('app.float.search_width')) + .borderColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? + $r('app.color.five_percent_black') : $r('app.color.five_percent_white')) + .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')) + .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') + }) + + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + + Image($r('app.media.ic_public_add_norm')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.scrollY < HomeConstants.LIST_SLIDING_OFFSET || + (this.currentPoint === CommonConstants.BREAK_POINT_LG && + this.scrollY < HomeConstants.LIST_SLIDING_OFFSET_LG) ? Color.Black : Color.White) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Scroll() { + Column() { + this.buildMainBusiness() + + Column() { + if (this.currentPoint === CommonConstants.BREAK_POINT_SM) { + this.buildButtonBusiness(HomeViewModel.getPhoneBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_START, + HomeConstants.BUSINESS_DATA_COUNT_SM)) + this.buildButtonBusiness(HomeViewModel.getPhoneBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_SM)) + } + if (this.currentPoint === CommonConstants.BREAK_POINT_MD) { + this.buildButtonBusiness(HomeViewModel.getFoldBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_START, + HomeConstants.BUSINESS_DATA_COUNT_MD)) + this.buildButtonBusiness(HomeViewModel.getFoldBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_MD)) + } + if (this.currentPoint === CommonConstants.BREAK_POINT_LG) { + this.buildButtonBusiness(HomeViewModel.getTabletBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_START, + HomeConstants.BUSINESS_DATA_COUNT_LG)) + this.buildButtonBusiness(HomeViewModel.getTabletBusiness().slice(HomeConstants.BUSINESS_DATA_COUNT_LG)) + } + } + .backgroundColor(Color.White) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .borderRadius($r('app.float.business_border_radius')) + .padding(this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.business_padding_lg') : $r('app.float.business_padding')) + .margin({ + top: $r('app.float.business_margin_top'), + bottom: this.currentPoint === CommonConstants.BREAK_POINT_LG ? + $r('app.float.business_margin_bottom_lg') : $r('app.float.business_margin_bottom') + }) + .height(new BreakpointUtil({ + sm: $r('app.float.business_width_sm'), + md: $r('app.float.business_width_md'), + lg: $r('app.float.business_width_lg') + }).getValue(this.currentPoint)) + + Swiper() { + ForEach(HomeViewModel.getSwiperBusiness(), (item: BusinessInfo) => { + Image(item.icon) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .borderRadius($r('app.float.swiper_image_border_radius')) + .height(new BreakpointUtil({ + sm: $r('app.float.swiper_image_height_sm'), + md: $r('app.float.swiper_image_height_md'), + lg: $r('app.float.swiper_image_height_lg') + }).getValue(this.currentPoint)) + }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) + } + .autoPlay(true) + .loop(true) + .itemSpace(new BreakpointUtil({ + sm: HomeConstants.SWIPER_SPACE_SM, + md: HomeConstants.SWIPER_SPACE_MD, + lg: HomeConstants.SWIPER_SPACE_LG + }).getValue(this.currentPoint)) + .displayCount(new BreakpointUtil({ + sm: HomeConstants.SWIPER_DISPLAY_COUNT_SM, + md: HomeConstants.SWIPER_DISPLAY_COUNT_MD, + lg: HomeConstants.SWIPER_DISPLAY_COUNT_LG + }).getValue(this.currentPoint)) + .indicator(this.currentPoint === CommonConstants.BREAK_POINT_SM ? true : false) + + Row() { + Text($r('app.string.home_fortune_picks')) + .fontColor($r('app.color.pick_text')) + .fontSize($r('app.float.pick_size')) + .lineHeight($r('app.float.pick_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + .fontFamily(CommonConstants.FONT_FAMILY_HEI_TI) + } + .justifyContent(FlexAlign.Start) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .margin({ + top: $r('app.float.pick_margin_top'), + bottom: $r('app.float.pick_margin_bottom') + }) + + List({ space: HomeConstants.LIST_SPACE }) { + ForEach(HomeViewModel.getListBusiness(), (item: BusinessInfo) => { + ListItem() { + Image(item.icon) + .height(new BreakpointUtil({ + sm: $r('app.float.list_image_height_sm'), + md: $r('app.float.list_image_height_md'), + lg: $r('app.float.list_image_height_lg') + }).getValue(this.currentPoint)) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .borderRadius($r('app.float.list_image_radius')) + .onClick(() => { + router.pushUrl({ + url: RouterConstants.FUNDING_URL + }) + }) + } + }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .lanes(new BreakpointUtil({ + sm: HomeConstants.LIST_LANES_COUNT_SM, + md: HomeConstants.LIST_LANES_COUNT_MD, + lg: HomeConstants.LIST_LANES_COUNT_LG + }).getValue(this.currentPoint), $r('app.float.list_lanes_space')) + } + } + .padding({ + top: $r('app.float.scroll_margin_top'), + bottom: $r('app.float.common_height') + }) + .scrollBar(BarState.Off) + .onScroll((xOffset: number, yOffset: number) => { + this.offsetValue = this.offsetValue - yOffset; + if (this.offsetValue > 0) { + this.offsetValue = 0; + } + this.scrollY = vp2px(this.offsetValue) + }) + } + .height(CommonConstants.FULL_HEIGHT_PERCENT) + } + .alignItems(VerticalAlign.Top) + .padding({ + top: $r('app.float.content_padding_top'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + } + + @Builder + buildMainBusiness() { + Row() { + ForEach(HomeViewModel.getMainBusiness(), (item: BusinessInfo) => { + if (this.currentPoint === CommonConstants.BREAK_POINT_SM) { + Column({ space: HomeConstants.MAIN_ROW_SPACE }) { + Image(item.icon) + .width($r('app.float.main_image')) + .height($r('app.float.main_image')) + Text(item.text) + .fontSize($r('app.float.main_business_size')) + .fontColor(Color.White) + } + .onClick(() => { + if (item.router) { + router.pushUrl({ + url: item.router + }) + } + }) + } else { + Row() { + Image(item.iconBig) + .width($r('app.float.main_image_big')) + .height($r('app.float.main_image_big')) + Text(item.text) + .fontSize($r('app.float.main_business_size')) + .fontColor(Color.White) + .margin({ + left: new BreakpointUtil({ + md: HomeConstants.BUSINESS_ROW_SPACE_MD, + lg: HomeConstants.BUSINESS_ROW_SPACE_LG + }).getValue(this.currentPoint) + }) + } + .width(HomeConstants.MAIN_BUSINESS_WIDTH) + .height(new BreakpointUtil({ + md: $r('app.float.business_row_height_md'), + lg: $r('app.float.business_row_height_lg') + }).getValue(this.currentPoint)) + .alignSelf(ItemAlign.Center) + .justifyContent(FlexAlign.Center) + .borderRadius($r('app.float.business_row_radius')) + .backgroundColor($r('app.color.business_background')) + .onClick(() => { + if (item.router) { + router.pushUrl({ + url: item.router + }) + } + }) + } + }, (item: BusinessInfo, index: number) => index + JSON.stringify(item)) + } + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: new BreakpointUtil({ + sm: $r('app.float.main_padding_left_sm'), + md: $r('app.float.main_padding_left_md'), + lg: $r('app.float.main_padding_left_lg') + }).getValue(this.currentPoint), + right: new BreakpointUtil({ + sm: $r('app.float.main_padding_left_sm'), + md: $r('app.float.main_padding_left_md'), + lg: $r('app.float.main_padding_left_lg') + }).getValue(this.currentPoint) + }) + .width(CommonConstants.FULL_WIDTH_PERCENT) + } + + @Builder + buildButtonBusiness(list: BusinessInfo[]) { + Row() { + ForEach(list, (item: BusinessInfo) => { + Column({ space: HomeConstants.BUTTON_ROW_SPACE }) { + Image(item.icon) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + Text(item.text) + .fontSize($r('app.float.button_text_size')) + .fontColor(Color.Black) + } + .width($r('app.float.button_business_width')) + }, (item: BusinessInfo, index?: number) => index + JSON.stringify(item)) + } + .justifyContent(FlexAlign.SpaceBetween) + .width(CommonConstants.FULL_WIDTH_PERCENT) + } +} \ No newline at end of file diff --git a/features/home/src/main/ets/view/InvestmentComponent.ets b/features/home/src/main/ets/view/InvestmentComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..767a0e73c5209c260ff2fe6f28b17cfe2e464c5b --- /dev/null +++ b/features/home/src/main/ets/view/InvestmentComponent.ets @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2023 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 { BreakpointUtil, CommonConstants } from '@ohos/basic/Index'; + +@Component +export struct InvestmentComponent { + @Prop breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + Flex({ + direction: this.breakPoint === CommonConstants.BREAK_POINT_SM ? FlexDirection.Column : FlexDirection.Row + }) { + Column() { + Row() { + Row() { + Text($r('app.string.investment_wealth')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageUpwards() + } + Row() { + if (this.breakPoint !== CommonConstants.BREAK_POINT_LG) { + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row() { + Text($r('app.string.investment_wealth_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + bottom: '40vp' + }) + } + Row() { + Text($r('app.string.half_year_treasure')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) + this.buildImageArrowRight() + } + .buildDemandRowStyles() + + Row() { + Text() { + Span($r('app.string.earnings_holding_positions')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.earnings_holding_positions_count')) + .fontSize($r('app.float.amount_font_size')) + .fontColor($r('app.color.earnings_holding_positions')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildHalfRowHeight() + + Row() { + Text() { + Span($r('app.string.last_redemption_date')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.last_date')) + .buildSpanFont() + .opacity(0.6) + } + Text($r('app.string.position_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .buildHalfRowHeight() + } + .margin({ + right: $r('app.float.account_margin'), + left: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.account_margin') : 0 + }) + .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')) + Column() { + Row() { + Row() { + Text($r('app.string.fund_name')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + this.buildImageUpwards() + } + Row() { + if (this.breakPoint !== CommonConstants.BREAK_POINT_LG) { + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + this.buildImageArrowRight() + } + } + .buildDemandRowStyles() + if (this.breakPoint === CommonConstants.BREAK_POINT_LG) { + Row() { + Text($r('app.string.investment_wealth_count')) + .fontSize($r('app.float.account_big_font')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .margin({ + bottom: '40vp' + }) + } + Row() { + Text($r('app.string.exponent_c')) + .fontSize($r('app.float.amount_font_size')) + .lineHeight($r('app.float.common_line_height')) + .fontWeight(this.breakPoint === CommonConstants.BREAK_POINT_LG ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal) + this.buildImageArrowRight() + } + .buildDemandRowStyles() + Row() { + Text() { + Span($r('app.string.yesterday_earnings_exponent')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.yesterday_exponent_count')) + .fontSize($r('app.float.amount_font_size')) + .fontColor($r('app.color.yesterday_earnings_exponent')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + Text($r('app.string.investment_wealth_count')) + .buildFontSixteen() + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .buildHalfRowHeight() + Row() { + Text() { + Span($r('app.string.earnings_holding_positions')) + .buildSpanFont() + .opacity(0.6) + Span($r('app.string.investment_holding_count')) + .fontSize($r('app.float.amount_font_size')) + .fontColor($r('app.color.earnings_holding_positions')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + Text($r('app.string.position_amount')) + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) + .opacity(0.6) + } + .buildHalfRowHeight() + } + .margin({ + top: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.investment_margin_top') : 0, + right: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.account_padding_common') : 0, + left: this.breakPoint === CommonConstants.BREAK_POINT_SM ? $r('app.float.account_padding_common') : 0 + }) + .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(new BreakpointUtil({ + sm: $r('app.float.investment_flex_height_sm'), + md: $r('app.float.investment_flex_height'), + lg: $r('app.float.investment_flex_height_lg'), + }).getValue(this.breakPoint)) + .margin({ + left: this.breakPoint === CommonConstants.BREAK_POINT_MD ? $r('app.float.margin_common') : 0, + right: this.breakPoint === CommonConstants.BREAK_POINT_MD ? $r('app.float.margin_common') : 0 + }) + } + + @Builder + buildImageUpwards() { + Image($r('app.media.ic_public_upwards')) + .width($r('app.float.image_account')) + .height($r('app.float.image_account')) + .margin({ + right: $r('app.float.current_period_margin') + }) + } + + @Builder + buildImageArrowRight() { + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.image_arrow')) + .height($r('app.float.common_image_height')) + .fillColor($r('app.color.image_arrow')) + .margin({ + left:$r('app.float.image_arrow_margin') + }) + } +} + +@Extend(Row) +function buildHalfRowHeight() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.investment_row_height')) +} + +@Extend(Span) +function buildSpanFont() { + .fontSize($r('app.float.account_small_font_size')) + .lineHeight($r('app.float.small_line_height')) +} + +@Extend(Text) +function buildFontSixteen() { + .fontSize($r('app.float.account_font_size')) + .lineHeight($r('app.float.common_line_height')) +} + +@Extend(Row) +function buildDemandRowStyles() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) +} \ No newline at end of file diff --git a/features/home/src/main/ets/view/LiabilitiesComponent.ets b/features/home/src/main/ets/view/LiabilitiesComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b04cdb53834b045e45390a3cc96e5d26abcff82 --- /dev/null +++ b/features/home/src/main/ets/view/LiabilitiesComponent.ets @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2023 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 { BreakpointUtil, CommonConstants } from '@ohos/basic/Index'; + +@Component +export struct LiabilitiesComponent { + @Prop breakPoint: string = CommonConstants.BREAK_POINT_SM; + + 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() + + 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) + } + 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) + } + } 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_height')) + } + + @Builder + buildImageArrowRight() { + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.image_arrow')) + .height($r('app.float.common_image_height')) + .fillColor($r('app.color.image_arrow')) + .margin({ + left:$r('app.float.image_arrow_margin') + }) + } +} + +@Extend(Row) +function buildRowStyles() { + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_common_height')) +} diff --git a/features/home/src/main/ets/viewmodel/HomeViewModel.ets b/features/home/src/main/ets/viewmodel/HomeViewModel.ets new file mode 100644 index 0000000000000000000000000000000000000000..87c7c27233f4a2554521c9f2a23971bb21a9657f --- /dev/null +++ b/features/home/src/main/ets/viewmodel/HomeViewModel.ets @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023 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 { BusinessInfo, RouterConstants } from '@ohos/basic'; + +/** + * Get home data. + */ +class HomeViewModel { + getMainBusiness(): BusinessInfo[] { + let mainBusinessList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_account'), $r('app.string.home_account'), $r('app.media.ic_public_account'), RouterConstants.ACCOUNT_PAGE_URL), + new BusinessInfo($r('app.media.ic_details'), $r('app.string.home_details'), $r('app.media.ic_public_details')), + new BusinessInfo($r('app.media.ic_transfers'), $r('app.string.home_transfers'), $r('app.media.ic_public_transfers')), + new BusinessInfo($r('app.media.ic_loans'), $r('app.string.home_loans'), $r('app.media.ic_public_loans')) + ]; + return mainBusinessList; + } + + getAllBusiness(): BusinessInfo[] { + let allBusinessList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_fund_investment'), $r('app.string.home_fund_investment')), + new BusinessInfo($r('app.media.ic_wealth_products'), $r('app.string.home_wealth_products')), + new BusinessInfo($r('app.media.ic_home_cards'), $r('app.string.home_cards')), + new BusinessInfo($r('app.media.ic_home_notes'), $r('app.string.home_notes')), + new BusinessInfo($r('app.media.ic_quick_profit'), $r('app.string.home_quick_profit')), + new BusinessInfo($r('app.media.ic_precious_metals'), $r('app.string.home_precious_metals')), + new BusinessInfo($r('app.media.ic_deposits'), $r('app.string.home_deposits')), + new BusinessInfo($r('app.media.ic_payment'), $r('app.string.home_payment')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')), + new BusinessInfo($r('app.media.ic_quick_loan'), $r('app.string.home_quick_loan')) + ]; + return allBusinessList; + } + + getPhoneBusiness(): BusinessInfo[] { + let allBusinessInfoList = this.getAllBusiness(); + let phoneBusinessList = allBusinessInfoList.slice(0, 7); + phoneBusinessList.push(new BusinessInfo($r('app.media.ic_home_more'), $r('app.string.home_more'))); + return phoneBusinessList; + } + + getFoldBusiness(): BusinessInfo[] { + let allBusinessInfoList = this.getAllBusiness(); + let phoneBusinessList = allBusinessInfoList.slice(0, 11); + phoneBusinessList.push(new BusinessInfo($r('app.media.ic_home_more'), $r('app.string.home_more'))); + return phoneBusinessList; + } + + getTabletBusiness(): BusinessInfo[] { + let allBusinessInfoList = this.getAllBusiness(); + let phoneBusinessList = allBusinessInfoList.slice(0, 15); + phoneBusinessList.push(new BusinessInfo($r('app.media.ic_home_more'), $r('app.string.home_more'))); + return phoneBusinessList; + } + + getSwiperBusiness(): BusinessInfo[] { + let swiperBusinessInfoList: BusinessInfo[] = [ + new BusinessInfo($r('app.media.ic_swiper_hand'), $r('app.string.swiper_image')), + new BusinessInfo($r('app.media.ic_swiper_fingerprints'), $r('app.string.swiper_image')), + new BusinessInfo($r('app.media.ic_swiper_book'), $r('app.string.swiper_image')), + new BusinessInfo($r('app.media.ic_swiper_eyeglasses'), $r('app.string.swiper_image')) + ]; + return swiperBusinessInfoList; + } + + getListBusiness(): BusinessInfo[] { + let listBusinessInfoList: BusinessInfo[] = [ + 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')) + ]; + return listBusinessInfoList; + } +} + +export default new HomeViewModel(); \ No newline at end of file diff --git a/features/home/src/main/module.json5 b/features/home/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2c96c8af59454cd5dba40d59fa9e3a555e0a4d26 --- /dev/null +++ b/features/home/src/main/module.json5 @@ -0,0 +1,14 @@ +{ + "module": { + "name": "home", + "type": "shared", + "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 new file mode 100644 index 0000000000000000000000000000000000000000..ded0fa9f0239347754a548c7ddabccebd12cfc65 --- /dev/null +++ b/features/home/src/main/resources/base/element/color.json @@ -0,0 +1,76 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "five_percent_white", + "value": "#0DFFFFFF" + }, + { + "name": "five_percent_black", + "value": "#0D000000" + }, + { + "name": "sixty_percent_white", + "value": "#99FFFFFF" + }, + { + "name": "sixty_percent_black", + "value": "#99000000" + }, + { + "name": "pick_text", + "value": "#182431" + }, + { + "name": "business_background", + "value": "#33FFFFFF" + }, + { + "name": "top_start", + "value": "#1C60EA" + }, + { + "name": "top_end", + "value": "#83ABFB" + }, + { + "name": "circle_color", + "value": "#FFF980" + }, + { + "name": "current_period_color", + "value": "#1F69FF" + }, + { + "name": "investment_name", + "value": "#C8974F" + }, + { + "name": "liabilities_name", + "value": "#C8974F" + }, + { + "name": "account_background", + "value": "#F7F7F7" + }, + { + "name": "image_arrow", + "value": "#4d000000" + }, + { + "name": "divider_color", + "value": "#1a000000" + }, + { + "name": "earnings_holding_positions", + "value": "#E84026" + }, + { + "name": "yesterday_earnings_exponent", + "value": "#28AD2B" + } + ] +} \ No newline at end of file diff --git a/features/home/src/main/resources/base/element/float.json b/features/home/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..37901d315b7012c2ff02c62c1e161a4afc48a278 --- /dev/null +++ b/features/home/src/main/resources/base/element/float.json @@ -0,0 +1,412 @@ +{ + "float": [ + { + "name": "common_image_width", + "value": "24vp" + }, + { + "name": "common_image_height", + "value": "24vp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "margin_common", + "value": "24vp" + }, + { + "name": "dialog_width_sm", + "value": "280vp" + }, + { + "name": "dialog_width_md", + "value": "302vp" + }, + { + "name": "dialog_width_lg", + "value": "394vp" + }, + { + "name": "dialog_margin_bottom", + "value": "12vp" + }, + { + "name": "dialog_height_sm", + "value": "328vp" + }, + { + "name": "dialog_height_md", + "value": "394vp" + }, + { + "name": "dialog_border_radius", + "value": "16vp" + }, + { + "name": "dialog_all_height_sm", + "value": "364vp" + }, + { + "name": "dialog_all_height_md", + "value": "430vp" + }, + { + "name": "dialog_all_height_lg", + "value": "430vp" + }, + { + "name": "location_size", + "value": "18fp" + }, + { + "name": "location_text_height", + "value": "25vp" + }, + { + "name": "gps_width", + "value": "64vp" + }, + { + "name": "business_border_radius", + "value": "16vp" + }, + { + "name": "business_padding_lg", + "value": "24vp" + }, + { + "name": "business_padding", + "value": "16vp" + }, + { + "name": "business_margin_top", + "value": "36vp" + }, + { + "name": "business_margin_bottom_lg", + "value": "16vp" + }, + { + "name": "business_margin_bottom", + "value": "12vp" + }, + { + "name": "business_width_sm", + "value": "136vp" + }, + { + "name": "business_width_md", + "value": "144vp" + }, + { + "name": "business_width_lg", + "value": "160vp" + }, + { + "name": "swiper_image_border_radius", + "value": "16vp" + }, + { + "name": "pick_size", + "value": "16fp" + }, + { + "name": "pick_text_height", + "value": "22vp" + }, + { + "name": "pick_margin_top", + "value": "21vp" + }, + { + "name": "pick_margin_bottom", + "value": "13vp" + }, + { + "name": "list_image_height", + "value": "160vp" + }, + { + "name": "list_image_radius", + "value": "16vp" + }, + { + "name": "list_lanes_space", + "value": "12vp" + }, + { + "name": "scroll_margin_top", + "value": "16vp" + }, + { + "name": "content_padding_top", + "value": "8vp" + }, + { + "name": "main_image", + "value": "48vp" + }, + { + "name": "main_business_size", + "value": "16fp" + }, + { + "name": "main_padding_left_sm", + "value": "0vp" + }, + { + "name": "main_padding_left_md", + "value": "21vp" + }, + { + "name": "main_padding_left_lg", + "value": "29vp" + }, + { + "name": "button_text_size", + "value": "12fp" + }, + { + "name": "button_business_width", + "value": "48vp" + }, + { + "name": "common_height", + "value": "56vp" + }, + { + "name": "search_width", + "value": "232vp" + }, + { + "name": "search_width_sm", + "value": "168vp" + }, + { + "name": "swiper_image_height_sm", + "value": "141vp" + }, + { + "name": "swiper_image_height_md", + "value": "132vp" + }, + { + "name": "swiper_image_height_lg", + "value": "115vp" + }, + { + "name": "list_image_height_sm", + "value": "185vp" + }, + { + "name": "list_image_height_md", + "value": "174vp" + }, + { + "name": "list_image_height_lg", + "value": "152vp" + }, + { + "name": "business_row_radius", + "value": "12vp" + }, + { + "name": "business_row_width_md", + "value": "116vp" + }, + { + "name": "business_row_width_lg", + "value": "222vp" + }, + { + "name": "business_row_height_md", + "value": "56vp" + }, + { + "name": "business_row_height_lg", + "value": "80vp" + }, + { + "name": "account_font_size", + "value": "16fp" + }, + { + "name": "account_count_size", + "value": "24vp" + }, + { + "name": "account_image_width", + "value": "12vp" + }, + { + "name": "account_margin_left", + "value": "12vp" + }, + { + "name": "account_margin_top_lg", + "value": "88vp" + }, + { + "name": "account_margin_top", + "value": "33vp" + }, + { + "name": "account_small_font_size", + "value": "12fp" + }, + { + "name": "account_padding", + "value": "8vp" + }, + { + "name": "earnings_radius", + "value": "14vp" + }, + { + "name": "account_margin", + "value": "16vp" + }, + { + "name": "account_margin_bottom_lg", + "value": "93vp" + }, + { + "name": "amount_font_size", + "value": "14fp" + }, + { + "name": "amount_margin", + "value": "8vp" + }, + { + "name": "account_top_height", + "value": "219vp" + }, + { + "name": "account_top_padding", + "value": "14vp" + }, + { + "name": "account_padding_common", + "value": "16vp" + }, + { + "name": "circle_width_height", + "value": "8vp" + }, + { + "name": "message_font_size", + "value": "14fp" + }, + { + "name": "account_lint_height", + "value": "22vp" + }, + { + "name": "current_period_margin", + "value": "12vp" + }, + { + "name": "current_period_padding", + "value": "16vp" + }, + { + "name": "common_radius", + "value": "16vp" + }, + { + "name": "account_content_padding", + "value": "32vp" + }, + { + "name": "image_account", + "value": "16vp" + }, + { + "name": "image_arrow", + "value": "12vp" + }, + { + "name": "image_arrow_margin", + "value": "8vp" + }, + { + "name": "column_item_height", + "value": "129vp" + }, + { + "name": "common_line_height", + "value": "22vp" + }, + { + "name": "account_common_height", + "value": "48vp" + }, + { + "name": "account_big_font", + "value": "24fp" + }, + { + "name": "small_line_height", + "value": "19vp" + }, + { + "name": "divider_height", + "value": "36vp" + }, + { + "name": "divider_width", + "value": "1vp" + }, + { + "name": "divider_margin", + "value": "18vp" + }, + { + "name": "account_item_padding_tb", + "value": "4vp" + }, + { + "name": "account_item_padding_rl", + "value": "12vp" + }, + { + "name": "investment_row_height", + "value": "22vp" + }, + { + "name": "investment_margin_top", + "value": "12vp" + }, + { + "name": "liabilities_divider_height", + "value": "115vp" + }, + { + "name": "investment_flex_height_sm", + "value": "304vp" + }, + { + "name": "investment_flex_height", + "value": "148vp" + }, + { + "name": "investment_flex_height_lg", + "value": "220vp" + }, + { + "name": "liabilities_item_height", + "value": "115vp" + }, + { + "name": "liabilities_height", + "value": "300vp" + }, + { + "name": "main_image_big", + "value": "40" + } + ] +} \ No newline at end of file diff --git a/features/home/src/main/resources/base/element/string.json b/features/home/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b73d578c75a5b89d4cd52b7d974c94102a21e946 --- /dev/null +++ b/features/home/src/main/resources/base/element/string.json @@ -0,0 +1,228 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "gps_location", + "value": "shenzhen" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "home_account", + "value": "account" + }, + { + "name": "home_details", + "value": "details" + }, + { + "name": "home_transfers", + "value": "transfers" + }, + { + "name": "home_loans", + "value": "loans" + }, + { + "name": "home_fund_investment", + "value": "fundInvestment" + }, + { + "name": "home_wealth_products", + "value": "wealthProducts" + }, + { + "name": "home_cards", + "value": "cards" + }, + { + "name": "home_notes", + "value": "notes" + }, + { + "name": "home_quick_profit", + "value": "quickProfit" + }, + { + "name": "home_precious_metals", + "value": "preciousMetals" + }, + { + "name": "home_deposits", + "value": "deposits" + }, + { + "name": "home_payment", + "value": "payment" + }, + { + "name": "home_quick_loan", + "value": "quickLoan" + }, + { + "name": "home_more", + "value": "more" + }, + { + "name": "swiper_image", + "value": "swiper" + }, + { + "name": "home_list", + "value": "homeListInfo" + }, + { + "name": "home_fortune_picks", + "value": "fortunePicks" + }, + { + "name": "account_all_info", + "value": "Account Overview" + }, + { + "name": "account_count", + "value": "999999.99" + }, + { + "name": "yesterday_earnings", + "value": "Yesterday's earnings + 333.33" + }, + { + "name": "current_period_amount", + "value": "8888.8" + }, + { + "name": "current_period", + "value": "current period+" + }, + { + "name": "investment_amount", + "value": "1333333.2" + }, + { + "name": "investment_name", + "value": "investment" + }, + { + "name": "remaining_due_amount", + "value": "5555.55" + }, + { + "name": "remaining_due_month", + "value": "remaining due this month" + }, + { + "name": "prompt_message", + "value": "Prepare for the old as soon as possible, worry-free old age, new users enjoy 3 gifts > >" + }, + { + "name": "liabilities_name", + "value": "liabilities" + }, + { + "name": "saving_card", + "value": "saving card" + }, + { + "name": "save_card_account", + "value": "88888.8" + }, + { + "name": "current_deposit", + "value": "current deposit" + }, + { + "name": "current_deposit_count", + "value": "33333.3" + }, + { + "name": "day_day_treasure", + "value": "day and day treasure" + }, + { + "name": "day_day_count", + "value": "33333.3" + }, + { + "name": "yesterday_earnings_day", + "value": "Yesterday's earnings 1.33" + }, + { + "name": "investment_wealth", + "value": "financial management" + }, + { + "name": "investment_wealth_count", + "value": "66666.66" + }, + { + "name": "half_year_treasure", + "value": "half a year treasure" + }, + { + "name": "earnings_holding_positions", + "value": "earnings from holding positions" + }, + { + "name": "earnings_holding_positions_count", + "value": "66.6" + }, + { + "name": "last_redemption_date", + "value": "last redemption date:" + }, + { + "name": "last_date", + "value": "2023-11-23" + }, + { + "name": "position_amount", + "value": "position amount" + }, + { + "name": "fund_name", + "value": "fund" + }, + { + "name": "exponent_c", + "value": "XXXXXXXXX exponent C" + }, + { + "name": "yesterday_earnings_exponent", + "value": "yesterday·s earnings" + }, + { + "name": "yesterday_exponent_count", + "value": "-66.6" + }, + { + "name": "investment_holding_count", + "value": "666.6" + }, + { + "name": "credit_card_account", + "value": "credit card personal consumption account" + }, + { + "name": "remaining_available_amount", + "value": "remaining available amount" + }, + { + "name": "remaining_available_count", + "value": "500000.00" + }, + { + "name": "remaining_due", + "value": "remaining RMB due" + }, + { + "name": "remaining_due_count", + "value": "55555.55" + } + ] +} \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_account.png b/features/home/src/main/resources/base/media/ic_account.png new file mode 100644 index 0000000000000000000000000000000000000000..9274cc5cb07c6564a13391f04c8087bb484b5dc7 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_account.png differ diff --git a/features/home/src/main/resources/base/media/ic_deposits.png b/features/home/src/main/resources/base/media/ic_deposits.png new file mode 100644 index 0000000000000000000000000000000000000000..22b2495c59082a514ae4c8be8802bad0267925fb Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_deposits.png differ diff --git a/features/home/src/main/resources/base/media/ic_details.png b/features/home/src/main/resources/base/media/ic_details.png new file mode 100644 index 0000000000000000000000000000000000000000..8f9ad39870ba85e252f9d287cf8b619d176eff80 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_details.png differ diff --git a/features/home/src/main/resources/base/media/ic_dialog_phone.png b/features/home/src/main/resources/base/media/ic_dialog_phone.png new file mode 100644 index 0000000000000000000000000000000000000000..b8e5d17069296ea05eb83e31de7a2ac53aede289 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_dialog_phone.png differ diff --git a/features/home/src/main/resources/base/media/ic_fund_investment.png b/features/home/src/main/resources/base/media/ic_fund_investment.png new file mode 100644 index 0000000000000000000000000000000000000000..052a6e2c1f2ce12901d2b327dc1334ba90ed66c2 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_fund_investment.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_cards.png b/features/home/src/main/resources/base/media/ic_home_cards.png new file mode 100644 index 0000000000000000000000000000000000000000..b3307a40f84bf7e5323c68cc1288b57f66c72997 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_cards.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_fold_background.png b/features/home/src/main/resources/base/media/ic_home_fold_background.png new file mode 100644 index 0000000000000000000000000000000000000000..2ecbe63c76052be4f6f9cbb2dafd0e62238eff6d Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_fold_background.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_fortunes.png b/features/home/src/main/resources/base/media/ic_home_fortunes.png new file mode 100644 index 0000000000000000000000000000000000000000..e7fe3f2436e172ea1c31a25c6670f58be9c132c0 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_fortunes.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_mine.png b/features/home/src/main/resources/base/media/ic_home_mine.png new file mode 100644 index 0000000000000000000000000000000000000000..69e2bdd33b492ab7bc1b1d826885ae41d37a8ecf Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_mine.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_more.png b/features/home/src/main/resources/base/media/ic_home_more.png new file mode 100644 index 0000000000000000000000000000000000000000..b8a3dab6d37e77a6c9df1dc7da62c5b817564a53 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_more.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_notes.png b/features/home/src/main/resources/base/media/ic_home_notes.png new file mode 100644 index 0000000000000000000000000000000000000000..25184579608e49f12fa944c84db7f52d31848fe8 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_notes.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_phone_background.png b/features/home/src/main/resources/base/media/ic_home_phone_background.png new file mode 100644 index 0000000000000000000000000000000000000000..dba3b16cfcc0687ad7d0270fe96b339fb69abf83 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_phone_background.png differ diff --git a/features/home/src/main/resources/base/media/ic_home_tablet_background.png b/features/home/src/main/resources/base/media/ic_home_tablet_background.png new file mode 100644 index 0000000000000000000000000000000000000000..631fd5f624d63d7e4b96e81cc32b8167f182911d Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_home_tablet_background.png differ diff --git a/features/home/src/main/resources/base/media/ic_life_filled.svg b/features/home/src/main/resources/base/media/ic_life_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..d94b66f2c34bcd05663a92b87eafc14d112df022 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_life_filled.svg @@ -0,0 +1,20 @@ + + + 生活 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_list_business.png b/features/home/src/main/resources/base/media/ic_list_business.png new file mode 100644 index 0000000000000000000000000000000000000000..b1dda6987abb61b24b3d5eb6cdb05a429785d123 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_list_business.png differ diff --git a/features/home/src/main/resources/base/media/ic_list_contracts.png b/features/home/src/main/resources/base/media/ic_list_contracts.png new file mode 100644 index 0000000000000000000000000000000000000000..c2252d46a7b91c5c6e5d3ef911265b7e569ae09e Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_list_contracts.png differ diff --git a/features/home/src/main/resources/base/media/ic_list_hello.png b/features/home/src/main/resources/base/media/ic_list_hello.png new file mode 100644 index 0000000000000000000000000000000000000000..041e56e2a617631f058ae76bdcc396bebd0d7fa1 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_list_hello.png differ diff --git a/features/home/src/main/resources/base/media/ic_list_money.png b/features/home/src/main/resources/base/media/ic_list_money.png new file mode 100644 index 0000000000000000000000000000000000000000..a84291e3d70d679b6ab429be1965e44fec0cd9c3 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_list_money.png differ diff --git a/features/home/src/main/resources/base/media/ic_list_paper.png b/features/home/src/main/resources/base/media/ic_list_paper.png new file mode 100644 index 0000000000000000000000000000000000000000..17795c2916f5ca877c0ec954ad50d13d90ad2e8a Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_list_paper.png differ diff --git a/features/home/src/main/resources/base/media/ic_loans.png b/features/home/src/main/resources/base/media/ic_loans.png new file mode 100644 index 0000000000000000000000000000000000000000..9482750a67a6577dc135a8a4f6122d1d9537174b Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_loans.png differ diff --git a/features/home/src/main/resources/base/media/ic_payment.png b/features/home/src/main/resources/base/media/ic_payment.png new file mode 100644 index 0000000000000000000000000000000000000000..16d83f0e3685b71cfc1758949b8f0a36bd4f6aba Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_payment.png differ diff --git a/features/home/src/main/resources/base/media/ic_precious_metals.png b/features/home/src/main/resources/base/media/ic_precious_metals.png new file mode 100644 index 0000000000000000000000000000000000000000..a623cd7c9b90c5ead379db794255e9c639636fb4 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_precious_metals.png differ diff --git a/features/home/src/main/resources/base/media/ic_public_account.png b/features/home/src/main/resources/base/media/ic_public_account.png new file mode 100644 index 0000000000000000000000000000000000000000..346335f3cbfcf018e14c5369b2096ffb26cf75f7 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_public_account.png differ diff --git a/features/home/src/main/resources/base/media/ic_public_add_norm.svg b/features/home/src/main/resources/base/media/ic_public_add_norm.svg new file mode 100644 index 0000000000000000000000000000000000000000..729f2774d24c6569215b1a0f1420ea09ecf976f4 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_add_norm.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_add_norm + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_arrow_right.svg b/features/home/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..18e4cfd5d4c9e319018d7e8686f814a9cedb684f --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_back.svg b/features/home/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_cards_filled.svg b/features/home/src/main/resources/base/media/ic_public_cards_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..3a6ae14083e31e6a44e0e3793215a6bae4831441 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_cards_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_cards_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_close.svg b/features/home/src/main/resources/base/media/ic_public_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..4e76b8417ed1a123708d76b64d3c16c8fc2f4908 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_close.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_close + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_comments.svg b/features/home/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_details.png b/features/home/src/main/resources/base/media/ic_public_details.png new file mode 100644 index 0000000000000000000000000000000000000000..057c1e22ddbdd44f21463417f5d33983c63082cb Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_public_details.png differ diff --git a/features/home/src/main/resources/base/media/ic_public_gps.svg b/features/home/src/main/resources/base/media/ic_public_gps.svg new file mode 100644 index 0000000000000000000000000000000000000000..6120484838ca7d322a5d347fdf5a1e6aee1d3d64 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_gps.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_gps + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_home_filled.svg b/features/home/src/main/resources/base/media/ic_public_home_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..552138ac5580357040697ba05c977bbd60bf62bc --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_home_filled.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_home_filled + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_loans.png b/features/home/src/main/resources/base/media/ic_public_loans.png new file mode 100644 index 0000000000000000000000000000000000000000..e332235efb1098f7f171130d5ccd320b5fb76ec0 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_public_loans.png differ diff --git a/features/home/src/main/resources/base/media/ic_public_more.svg b/features/home/src/main/resources/base/media/ic_public_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..4c34b6411bd35efcb06b4d8cd269fc351bb3350e --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_more.svg @@ -0,0 +1,16 @@ + + + Public/ic_public_more + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_more_list.svg b/features/home/src/main/resources/base/media/ic_public_more_list.svg new file mode 100644 index 0000000000000000000000000000000000000000..0a26842c9e251d43ca0e404c240f612b5268f799 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_more_list.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_more_list + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_public_transfers.png b/features/home/src/main/resources/base/media/ic_public_transfers.png new file mode 100644 index 0000000000000000000000000000000000000000..aae95f868c3502e3a8273c10a75e5bb97451fea1 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_public_transfers.png differ diff --git a/features/home/src/main/resources/base/media/ic_public_upwards.svg b/features/home/src/main/resources/base/media/ic_public_upwards.svg new file mode 100644 index 0000000000000000000000000000000000000000..0474c94964c4f3ecf14b91e10adc938fbb3c5956 --- /dev/null +++ b/features/home/src/main/resources/base/media/ic_public_upwards.svg @@ -0,0 +1,20 @@ + + + 矩形备份 2 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/home/src/main/resources/base/media/ic_quick_loan.png b/features/home/src/main/resources/base/media/ic_quick_loan.png new file mode 100644 index 0000000000000000000000000000000000000000..0754573154a3032100675a008ca7420b201cec5b Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_quick_loan.png differ diff --git a/features/home/src/main/resources/base/media/ic_quick_profit.png b/features/home/src/main/resources/base/media/ic_quick_profit.png new file mode 100644 index 0000000000000000000000000000000000000000..0e77bb25dda910b3acf7f8b7d80c280e88a3c5e1 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_quick_profit.png differ diff --git a/features/home/src/main/resources/base/media/ic_swiper_book.png b/features/home/src/main/resources/base/media/ic_swiper_book.png new file mode 100644 index 0000000000000000000000000000000000000000..4dfe9c862758f8fbbeb93707e5c322ee32666aae Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_swiper_book.png differ diff --git a/features/home/src/main/resources/base/media/ic_swiper_eyeglasses.png b/features/home/src/main/resources/base/media/ic_swiper_eyeglasses.png new file mode 100644 index 0000000000000000000000000000000000000000..5f77fcceb1f62fad64645c4a4f13065f2c3f5a06 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_swiper_eyeglasses.png differ diff --git a/features/home/src/main/resources/base/media/ic_swiper_fingerprints.png b/features/home/src/main/resources/base/media/ic_swiper_fingerprints.png new file mode 100644 index 0000000000000000000000000000000000000000..96b768b0ae36f6c56518c5cd159e13b8ed1dd8be Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_swiper_fingerprints.png differ diff --git a/features/home/src/main/resources/base/media/ic_swiper_hand.png b/features/home/src/main/resources/base/media/ic_swiper_hand.png new file mode 100644 index 0000000000000000000000000000000000000000..3dd78e343c90bc161225c1faf237af8640c6bd44 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_swiper_hand.png differ diff --git a/features/home/src/main/resources/base/media/ic_transfers.png b/features/home/src/main/resources/base/media/ic_transfers.png new file mode 100644 index 0000000000000000000000000000000000000000..093200d0be1987f959c8350e9ed7cc175058774f Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_transfers.png differ diff --git a/features/home/src/main/resources/base/media/ic_wealth_products.png b/features/home/src/main/resources/base/media/ic_wealth_products.png new file mode 100644 index 0000000000000000000000000000000000000000..cc01479c27543073a8b3ed0c8ef1a91348bde102 Binary files /dev/null and b/features/home/src/main/resources/base/media/ic_wealth_products.png differ diff --git a/features/home/src/main/resources/base/media/icon.png b/features/home/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/home/src/main/resources/base/media/icon.png differ diff --git a/features/home/src/main/resources/base/profile/main_pages.json b/features/home/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..0a9ce6b81bec5c263d66af60e5e0425958b38988 --- /dev/null +++ b/features/home/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/AccountPage" + ] +} + diff --git a/features/home/src/main/resources/en_US/element/string.json b/features/home/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..474436a541dd2a48c369b35d4402c2985e6c5fee --- /dev/null +++ b/features/home/src/main/resources/en_US/element/string.json @@ -0,0 +1,224 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "gps_location", + "value": "shenzhen" + }, + { + "name": "search_placeholder", + "value": "search..." + }, + { + "name": "home_account", + "value": "account" + }, + { + "name": "home_details", + "value": "details" + }, + { + "name": "home_transfers", + "value": "transfers" + }, + { + "name": "home_loans", + "value": "loans" + }, + { + "name": "home_fund_investment", + "value": "fundInvestment" + }, + { + "name": "home_wealth_products", + "value": "wealthProducts" + }, + { + "name": "home_cards", + "value": "cards" + }, + { + "name": "home_notes", + "value": "notes" + }, + { + "name": "home_quick_profit", + "value": "quickProfit" + }, + { + "name": "home_precious_metals", + "value": "preciousMetals" + }, + { + "name": "home_deposits", + "value": "deposits" + }, + { + "name": "home_payment", + "value": "payment" + }, + { + "name": "home_quick_loan", + "value": "quickLoan" + }, + { + "name": "home_more", + "value": "more" + }, + { + "name": "swiper_image", + "value": "swiper" + }, + { + "name": "home_list", + "value": "homeListInfo" + }, + { + "name": "home_fortune_picks", + "value": "fortunePicks" + }, + { + "name": "account_all_info", + "value": "Account Overview" + }, + { + "name": "account_count", + "value": "999999.99" + }, + { + "name": "yesterday_earnings", + "value": "Yesterday's earnings + 333.33" + }, + { + "name": "current_period_amount", + "value": "8888.8" + }, + { + "name": "current_period", + "value": "current period+" + }, + { + "name": "investment_amount", + "value": "1333333.2" + }, + { + "name": "investment_name", + "value": "investment" + }, + { + "name": "remaining_due_amount", + "value": "5555.55" + }, + { + "name": "remaining_due_month", + "value": "remaining due this month" + }, + { + "name": "prompt_message", + "value": "Prepare for the old as soon as possible, worry-free old age, new users enjoy 3 gifts > >" + }, + { + "name": "liabilities_name", + "value": "liabilities" + }, + { + "name": "saving_card", + "value": "saving card" + }, + { + "name": "save_card_account", + "value": "88888.8" + }, + { + "name": "current_deposit", + "value": "current deposit" + }, + { + "name": "day_day_treasure", + "value": "day and day treasure" + }, + { + "name": "day_day_count", + "value": "33333.3" + }, + { + "name": "yesterday_earnings_day", + "value": "Yesterday's earnings 1.33" + }, + { + "name": "investment_wealth", + "value": "financial management" + }, + { + "name": "investment_wealth_count", + "value": "66666.66" + }, + { + "name": "half_year_treasure", + "value": "half a year treasure" + }, + { + "name": "earnings_holding_positions", + "value": "earnings from holding positions" + }, + { + "name": "earnings_holding_positions_count", + "value": "66.6" + }, + { + "name": "last_redemption_date", + "value": "last redemption date:" + }, + { + "name": "last_date", + "value": "2023-11-23" + }, + { + "name": "position_amount", + "value": "position amount" + }, + { + "name": "fund_name", + "value": "fund" + }, + { + "name": "exponent_c", + "value": "XXXXXXXXX exponent C" + }, + { + "name": "yesterday_earnings_exponent", + "value": "yesterday·s earnings" + }, + { + "name": "yesterday_exponent_count", + "value": "-66.6" + }, + { + "name": "investment_holding_count", + "value": "666.6" + }, + { + "name": "credit_card_account", + "value": "credit card personal consumption account" + }, + { + "name": "remaining_available_amount", + "value": "remaining available amount" + }, + { + "name": "remaining_available_count", + "value": "500000.00" + }, + { + "name": "remaining_due", + "value": "remaining RMB due" + }, + { + "name": "remaining_due_count", + "value": "55555.55" + } + ] +} \ No newline at end of file diff --git a/features/home/src/main/resources/zh_CN/element/string.json b/features/home/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..09427c29ac2ca5cee06c29fe3219bb4082c8dddd --- /dev/null +++ b/features/home/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,224 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "gps_location", + "value": "深圳" + }, + { + "name": "search_placeholder", + "value": "搜索..." + }, + { + "name": "home_account", + "value": "账户" + }, + { + "name": "home_details", + "value": "明细" + }, + { + "name": "home_transfers", + "value": "转账" + }, + { + "name": "home_loans", + "value": "贷款" + }, + { + "name": "home_fund_investment", + "value": "基金投资" + }, + { + "name": "home_wealth_products", + "value": "理财产品" + }, + { + "name": "home_cards", + "value": "信用卡" + }, + { + "name": "home_notes", + "value": "账单" + }, + { + "name": "home_quick_profit", + "value": "速盈" + }, + { + "name": "home_precious_metals", + "value": "贵金属" + }, + { + "name": "home_deposits", + "value": "存款产品" + }, + { + "name": "home_payment", + "value": "缴费" + }, + { + "name": "home_quick_loan", + "value": "快贷" + }, + { + "name": "home_more", + "value": "更多" + }, + { + "name": "swiper_image", + "value": "swiper" + }, + { + "name": "home_list", + "value": "homeListInfo" + }, + { + "name": "home_fortune_picks", + "value": "财富精选" + }, + { + "name": "account_all_info", + "value": "账户总览" + }, + { + "name": "account_count", + "value": "999999.99" + }, + { + "name": "yesterday_earnings", + "value": "昨日收益+333.33" + }, + { + "name": "current_period_amount", + "value": "8888.8" + }, + { + "name": "current_period", + "value": "活期+" + }, + { + "name": "investment_amount", + "value": "1333333.2" + }, + { + "name": "investment_name", + "value": "投资" + }, + { + "name": "remaining_due_amount", + "value": "5555.55" + }, + { + "name": "remaining_due_month", + "value": "本月剩余应还" + }, + { + "name": "prompt_message", + "value": "备老趁早,养老无忧,新用户立享3重礼>>" + }, + { + "name": "liabilities_name", + "value": "负债" + }, + { + "name": "saving_card", + "value": "储蓄卡" + }, + { + "name": "save_card_account", + "value": "88888.8" + }, + { + "name": "current_deposit", + "value": "活期存款" + }, + { + "name": "day_day_treasure", + "value": "日日宝" + }, + { + "name": "day_day_count", + "value": "33333.3" + }, + { + "name": "yesterday_earnings_day", + "value": "昨日收益1.33" + }, + { + "name": "investment_wealth", + "value": "理财" + }, + { + "name": "investment_wealth_count", + "value": "66666.66" + }, + { + "name": "half_year_treasure", + "value": "半年宝" + }, + { + "name": "earnings_holding_positions", + "value": "持仓收益 " + }, + { + "name": "earnings_holding_positions_count", + "value": "66.6" + }, + { + "name": "last_redemption_date", + "value": "最近可赎日:" + }, + { + "name": "last_date", + "value": "2023-11-23" + }, + { + "name": "position_amount", + "value": "持仓金额" + }, + { + "name": "fund_name", + "value": "基金" + }, + { + "name": "exponent_c", + "value": "XXXXXXXXX指数C" + }, + { + "name": "yesterday_earnings_exponent", + "value": "昨日收益" + }, + { + "name": "yesterday_exponent_count", + "value": "-66.6" + }, + { + "name": "investment_holding_count", + "value": "666.6" + }, + { + "name": "credit_card_account", + "value": "信用卡个人消费账户" + }, + { + "name": "remaining_available_amount", + "value": "剩余可用额度 " + }, + { + "name": "remaining_available_count", + "value": "500000.00" + }, + { + "name": "remaining_due", + "value": "剩余应还人民币 " + }, + { + "name": "remaining_due_count", + "value": "55555.55" + } + ] +} \ No newline at end of file diff --git a/features/transaction/Index.ets b/features/transaction/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ef2174e4149976207a9863fb359f0b488a4d445 --- /dev/null +++ b/features/transaction/Index.ets @@ -0,0 +1 @@ +export { TransactionComponent } from "./src/main/ets/view/TransactionComponent" \ No newline at end of file diff --git a/features/transaction/build-profile.json5 b/features/transaction/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7502eb5a6e454cfa104704afb4bb320071aa2e9e --- /dev/null +++ b/features/transaction/build-profile.json5 @@ -0,0 +1,28 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + } + ] +} \ No newline at end of file diff --git a/features/transaction/hvigorfile.ts b/features/transaction/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..d993120bd71f5f5dfe04480be9dc5f73c00c2599 --- /dev/null +++ b/features/transaction/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hspTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hspTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/features/transaction/obfuscation-rules.txt b/features/transaction/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/features/transaction/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/features/transaction/oh-package.json5 b/features/transaction/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5ee1df01e14a3989cb6b81ac615c0c8e68c682e4 --- /dev/null +++ b/features/transaction/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "Apache-2.0", + "devDependencies": {}, + "author": "", + "name": "transaction", + "description": "Please describe the basic information.", + "main": "Index.ets", + "version": "1.0.0", + "packageType": "InterfaceHar", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic" + } +} diff --git a/features/transaction/src/main/ets/constants/TransactionConstants.ets b/features/transaction/src/main/ets/constants/TransactionConstants.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f9476f182fa2bdb2d47914bc3bb5a6198acd3a5 --- /dev/null +++ b/features/transaction/src/main/ets/constants/TransactionConstants.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 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. + */ + +/** + * Transaction constants for transaction feature. + */ +export class TransactionConstants { + /** + * Row space. + */ + static readonly ROW_SPACE: number = 12; + + /** + * Purchase rates. + */ + static readonly RATE_VALUE: number = 0; + + /** + * Rate confirmation date. + */ + static readonly RATE_MOUTH: number = 8; + + /** + * Rate confirmation date. + */ + static readonly RATE_DAY: number = 18; +} \ No newline at end of file diff --git a/features/transaction/src/main/ets/view/TransactionComponent.ets b/features/transaction/src/main/ets/view/TransactionComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3f682366e544a65f02ab82a3e9f770a26ee08f7 --- /dev/null +++ b/features/transaction/src/main/ets/view/TransactionComponent.ets @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2023 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 { window } from '@kit.ArkUI'; +import { CommonConstants, FundDetail } from '@ohos/basic'; +import { TransactionConstants } from '../constants/TransactionConstants'; + +@Component +export struct TransactionComponent { + @StorageLink('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + @State indexList: number = 0; + @StorageProp('allFund') fundInfo: FundDetail[] = []; + @StorageProp('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + + build() { + NavDestination() { + Column() { + Row() { + Image($r('app.media.ic_public_back')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .onClick(() => { + this.pageInfo.pop(); + }) + Text($r('app.string.financial_purchase')) + .fontSize($r('app.float.title_size')) + Image($r('app.media.ic_public_comments')) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Row() { + Text(this.fundInfo[this.indexList].name) + .fontSize($r('app.float.fund_text_size')) + .fontColor($r('app.color.fund_text')) + .lineHeight($r('app.float.fund_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + + Text(this.fundInfo[this.indexList].amplitude) + .fontSize($r('app.float.amplitude_size')) + .fontColor($r('app.color.amplitude_color')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.fund_text_padding_top') + }) + + Row({ space: TransactionConstants.ROW_SPACE }) { + Text($r('app.string.fixed_investment')) + .textTypeExtend() + + Text($r('app.string.fund_type')) + .textTypeExtend() + + Text($r('app.string.risk_level')) + .textTypeExtend() + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.type_padding_top'), + bottom: $r('app.float.type_padding_bottom') + }) + + Row() { + Text($r('app.string.transaction_account')) + .fontSize($r('app.float.account_size')) + .fontColor($r('app.color.account_text')) + .lineHeight($r('app.float.account_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Row() { + Text($r('app.string.payment_account')) + .fontSize($r('app.float.payment_size')) + .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')) + .height($r('app.float.arrow_height')) + .fillColor($r('app.color.arrow_right')) + .margin({ + left: $r('app.float.arrow_margin_left') + }) + } + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .height($r('app.float.account_height')) + .backgroundColor(Color.White) + .padding({ + top: $r('app.float.account_padding_top_bottom'), + bottom: $r('app.float.account_padding_top_bottom'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Row() { + Text($r('app.string.available_balance')) + .fontSize($r('app.float.available_size')) + .fontColor($r('app.color.available_text')) + .lineHeight($r('app.float.available_height')) + Image($r('app.media.ic_about')) + .width($r('app.float.about_image')) + .height($r('app.float.about_image')) + .margin({ + left: $r('app.float.about_margin_left') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.End) + .height($r('app.float.available_row_height')) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common') + }) + + Column() { + Row() { + Text($r('app.string.purchase_amount')) + .fontSize($r('app.float.purchase_size')) + .fontColor($r('app.color.purchase_text')) + .lineHeight($r('app.float.purchase_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + Text($r('app.string.transaction_rules')) + .fontSize($r('app.float.rules_size')) + .fontColor($r('app.color.rules_text')) + .lineHeight($r('app.float.rules_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + + Row() { + Text($r('app.string.money_symbol')) + .fontSize($r('app.float.symbol_size')) + TextInput() + .enableKeyboardOnFocus(false) + .fontSize($r('app.float.symbol_size')) + .backgroundColor(Color.White) + .layoutWeight(1) + .textAlign(TextAlign.End) + .type(InputType.Number) + .margin({ + left: $r('app.float.input_margin'), + right: $r('app.float.input_margin') + }) + Button($r('app.string.buy_all')) + .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")) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + + Row() { + 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")) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.Start) + .padding({ + top: $r('app.float.confirm_padding_top'), + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + .border({ + width: { + top: $r('app.float.confirm_border_width') + }, + color: $r("app.color.confirm_border") + }) + } + .height($r('app.float.buy_info_height')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .padding({ + top: $r('app.float.buy_info_padding'), + bottom: $r('app.float.buy_info_padding') + }) + + Row() { + Text($r('app.string.recommendation_no')) + .fontSize($r('app.float.recommendation_size')) + .fontColor($r('app.color.recommendation_text')) + .lineHeight($r('app.float.recommendation_text_height')) + .fontWeight(CommonConstants.FONT_WEIGHT_500) + TextInput({ placeholder: $r('app.string.recommendation_optional') }) + .fontSize($r('app.float.recommendation_size')) + .backgroundColor(Color.White) + .layoutWeight(1) + .textAlign(TextAlign.End) + .type(InputType.Number) + .padding(0) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height($r('app.float.recommendation_height')) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + }) + .margin({ + top: $r('app.float.recommendation_margin'), + bottom: $r('app.float.recommendation_margin') + }) + + Column() { + Row() { + Text($r('app.string.transaction_read')) + .fontSize($r('app.float.read_size')) + .fontColor($r('app.color.common_text')) + .lineHeight($r('app.float.read_text_height')) + .margin({ + right: $r('app.float.read_margin_right') + }) + Image($r('app.media.ic_public_arrow_right')) + .width($r('app.float.arrow_right_width')) + .height($r('app.float.common_image_height')) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + + Button($r('app.string.transaction_button')) + .backgroundColor($r('app.color.button_background')) + .width(CommonConstants.FULL_WIDTH_PERCENT) + .constraintSize({ + minWidth: $r('app.float.button_min_width'), + maxWidth: $r('app.float.button_max_width') + }) + .height($r('app.float.button_height')) + } + .layoutWeight(1) + .justifyContent(FlexAlign.SpaceBetween) + .backgroundColor(Color.White) + .padding({ + left: $r('app.float.padding_common'), + right: $r('app.float.padding_common'), + top: $r('app.float.read_padding_top'), + bottom: $r('app.float.read_padding_bottom') + }) + } + .width(CommonConstants.FULL_WIDTH_PERCENT) + .height(CommonConstants.FULL_HEIGHT_PERCENT) + .backgroundColor($r('app.color.transaction_background')) + } + .hideTitleBar(true) + .onShown(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#F7F7F7' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + .onHidden(() => { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let sysBarProps: window.SystemBarProperties = { + statusBarColor: '#00ffffff' + }; + windowStage.setWindowSystemBarProperties(sysBarProps); + }) + }) + } +} + +@Extend(Text) +function textTypeExtend() { + .fontSize($r('app.float.type_text_size')) + .fontColor($r('app.color.type_text')) + .backgroundColor($r('app.color.type_text_background')) + .padding({ + left: $r('app.float.type_text_padding_lr'), + right: $r('app.float.type_text_padding_lr'), + top: $r('app.float.type_text_padding_tb'), + bottom: $r('app.float.type_text_padding_tb') + }) +} diff --git a/features/transaction/src/main/module.json5 b/features/transaction/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..75c75d3ed9621d929aa835ba809bd7dd7fd80bd5 --- /dev/null +++ b/features/transaction/src/main/module.json5 @@ -0,0 +1,13 @@ +{ + "module": { + "name": "transaction", + "type": "shared", + "description": "$string:shared_desc", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true + } +} \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/element/color.json b/features/transaction/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..409a4b6c8389654b8bc8105cb5e5027565c67ab8 --- /dev/null +++ b/features/transaction/src/main/resources/base/element/color.json @@ -0,0 +1,72 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "fund_text", + "value": "#182431" + }, + { + "name": "amplitude_color", + "value": "#66000000" + }, + { + "name": "account_text", + "value": "#182431" + }, + { + "name": "common_text", + "value": "#99000000" + }, + { + "name": "arrow_right", + "value": "#e6000000" + }, + { + "name": "available_text", + "value": "#99000000" + }, + { + "name": "purchase_text", + "value": "#182431" + }, + { + "name": "rules_text", + "value": "#0A59F7" + }, + { + "name": "button_buy_background", + "value": "#0d000000" + }, + { + "name": "button_buy", + "value": "#0A59F7" + }, + { + "name": "confirm_border", + "value": "#1a000000" + }, + { + "name": "recommendation_text", + "value": "#182431" + }, + { + "name": "button_background", + "value": "#0A59F7" + }, + { + "name": "transaction_background", + "value": "#F7F7F7" + }, + { + "name": "type_text", + "value": "#1F69FF" + }, + { + "name": "type_text_background", + "value": "#0d1f69ff" + } + ] +} \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/element/float.json b/features/transaction/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..2393c2a2f374390f4874e6d4f6c5f28f364b51bf --- /dev/null +++ b/features/transaction/src/main/resources/base/element/float.json @@ -0,0 +1,224 @@ +{ + "float": [ + { + "name": "common_image_width", + "value": "24vp" + }, + { + "name": "common_image_height", + "value": "24vp" + }, + { + "name": "title_size", + "value": "18fp" + }, + { + "name": "padding_common", + "value": "24vp" + }, + { + "name": "fund_text_size", + "value": "16fp" + }, + { + "name": "fund_text_height", + "value": "22vp" + }, + { + "name": "amplitude_size", + "value": "12fp" + }, + { + "name": "fund_text_padding_top", + "value": "29vp" + }, + { + "name": "type_padding_top", + "value": "14vp" + }, + { + "name": "type_padding_bottom", + "value": "17vp" + }, + { + "name": "account_size", + "value": "16fp" + }, + { + "name": "account_text_height", + "value": "22vp" + }, + { + "name": "payment_size", + "value": "14fp" + }, + { + "name": "payment_text_height", + "value": "19vp" + }, + { + "name": "arrow_width", + "value": "6.74vp" + }, + { + "name": "arrow_height", + "value": "12.81vp" + }, + { + "name": "arrow_margin_left", + "value": "14vp" + }, + { + "name": "account_height", + "value": "80vp" + }, + { + "name": "account_padding_top_bottom", + "value": "29vp" + }, + { + "name": "available_size", + "value": "14fp" + }, + { + "name": "available_height", + "value": "19vp" + }, + { + "name": "about_image", + "value": "22vp" + }, + { + "name": "about_margin_left", + "value": "13vp" + }, + { + "name": "available_row_height", + "value": "48vp" + }, + { + "name": "purchase_size", + "value": "16fp" + }, + { + "name": "purchase_text_height", + "value": "22vp" + }, + { + "name": "rules_size", + "value": "14fp" + }, + { + "name": "rules_text_height", + "value": "19vp" + }, + { + "name": "symbol_size", + "value": "36fp" + }, + { + "name": "input_margin", + "value": "10vp" + }, + { + "name": "button_buy_width", + "value": "80vp" + }, + { + "name": "button_buy_height", + "value": "28vp" + }, + { + "name": "button_buy_size", + "value": "12fp" + }, + { + "name": "confirm_size", + "value": "14vp" + }, + { + "name": "confirm_text_height", + "value": "19vp" + }, + { + "name": "confirm_padding_top", + "value": "14.93vp" + }, + { + "name": "confirm_border_width", + "value": "0.5vp" + }, + { + "name": "buy_info_height", + "value": "176vp" + }, + { + "name": "buy_info_padding", + "value": "13vp" + }, + { + "name": "recommendation_size", + "value": "16fp" + }, + { + "name": "recommendation_text_height", + "value": "22vp" + }, + { + "name": "recommendation_height", + "value": "48vp" + }, + { + "name": "recommendation_margin", + "value": "12vp" + }, + { + "name": "read_size", + "value": "14fp" + }, + { + "name": "read_text_height", + "value": "21vp" + }, + { + "name": "read_margin_right", + "value": "16vp" + }, + { + "name": "arrow_right_width", + "value": "12vp" + }, + { + "name": "button_height", + "value": "40vp" + }, + { + "name": "read_padding_top", + "value": "16vp" + }, + { + "name": "read_padding_bottom", + "value": "48vp" + }, + { + "name": "type_text_size", + "value": "10fp" + }, + { + "name": "type_text_padding_lr", + "value": "4vp" + }, + { + "name": "type_text_padding_tb", + "value": "1vp" + }, + { + "name": "button_min_width", + "value": "328vp" + }, + { + "name": "button_max_width", + "value": "604vp" + } + ] +} \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/element/string.json b/features/transaction/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9126b5ea58c77ee817f0a076f44299eab4884387 --- /dev/null +++ b/features/transaction/src/main/resources/base/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "fixed_investment", + "value": "fixed_investment" + }, + { + "name": "financial_purchase", + "value": "Financial purchase" + }, + { + "name": "transaction_account", + "value": "account" + }, + { + "name": "payment_account", + "value": "payment account" + }, + { + "name": "available_balance", + "value": "Available Balance" + }, + { + "name": "purchase_amount", + "value": "Purchase Amount" + }, + { + "name": "transaction_rules", + "value": "transaction rules" + }, + { + "name": "money_symbol", + "value": "¥" + }, + { + "name": "buy_all", + "value": "Buy it all" + }, + { + "name": "confirm_share_prompt", + "value": "Buy %d rate, share confirmation is expected on %d %d" + }, + { + "name": "recommendation_no", + "value": "Recommendation No" + }, + { + "name": "recommendation_optional", + "value": "optional" + }, + { + "name": "transaction_read", + "value": "Read and agree to the Product Description, Risk Disclosure, and other agreements." + }, + { + "name": "transaction_button", + "value": "Agree to the next step of the agreement" + }, + { + "name": "fund_type", + "value": "Currency type" + }, + { + "name": "risk_level", + "value": "R3-Medium Risk" + } + ] +} \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/media/ic_about.png b/features/transaction/src/main/resources/base/media/ic_about.png new file mode 100644 index 0000000000000000000000000000000000000000..d9ec044e0e3ac4d63aa394705db4e05f22d54245 Binary files /dev/null and b/features/transaction/src/main/resources/base/media/ic_about.png differ diff --git a/features/transaction/src/main/resources/base/media/ic_public_arrow_right.svg b/features/transaction/src/main/resources/base/media/ic_public_arrow_right.svg new file mode 100644 index 0000000000000000000000000000000000000000..0cc0f2ad4fd08ee0b7340c787910fd3723a36b7d --- /dev/null +++ b/features/transaction/src/main/resources/base/media/ic_public_arrow_right.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_arrow_right + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/media/ic_public_back.svg b/features/transaction/src/main/resources/base/media/ic_public_back.svg new file mode 100644 index 0000000000000000000000000000000000000000..5d8827cf7050dbb91a3f2fc6dae78538909975e8 --- /dev/null +++ b/features/transaction/src/main/resources/base/media/ic_public_back.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_back + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/media/ic_public_comments.svg b/features/transaction/src/main/resources/base/media/ic_public_comments.svg new file mode 100644 index 0000000000000000000000000000000000000000..0211e560e1825ca9b607e21470d5ca8e309acd0e --- /dev/null +++ b/features/transaction/src/main/resources/base/media/ic_public_comments.svg @@ -0,0 +1,18 @@ + + + Public/ic_public_comments + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/transaction/src/main/resources/base/media/icon.png b/features/transaction/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/features/transaction/src/main/resources/base/media/icon.png differ diff --git a/features/transaction/src/main/resources/base/media/setting.jpeg b/features/transaction/src/main/resources/base/media/setting.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..57e67dd49d39ad64ef090f59db3db9dfe6632106 Binary files /dev/null and b/features/transaction/src/main/resources/base/media/setting.jpeg differ diff --git a/features/transaction/src/main/resources/en_US/element/string.json b/features/transaction/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9126b5ea58c77ee817f0a076f44299eab4884387 --- /dev/null +++ b/features/transaction/src/main/resources/en_US/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "fixed_investment", + "value": "fixed_investment" + }, + { + "name": "financial_purchase", + "value": "Financial purchase" + }, + { + "name": "transaction_account", + "value": "account" + }, + { + "name": "payment_account", + "value": "payment account" + }, + { + "name": "available_balance", + "value": "Available Balance" + }, + { + "name": "purchase_amount", + "value": "Purchase Amount" + }, + { + "name": "transaction_rules", + "value": "transaction rules" + }, + { + "name": "money_symbol", + "value": "¥" + }, + { + "name": "buy_all", + "value": "Buy it all" + }, + { + "name": "confirm_share_prompt", + "value": "Buy %d rate, share confirmation is expected on %d %d" + }, + { + "name": "recommendation_no", + "value": "Recommendation No" + }, + { + "name": "recommendation_optional", + "value": "optional" + }, + { + "name": "transaction_read", + "value": "Read and agree to the Product Description, Risk Disclosure, and other agreements." + }, + { + "name": "transaction_button", + "value": "Agree to the next step of the agreement" + }, + { + "name": "fund_type", + "value": "Currency type" + }, + { + "name": "risk_level", + "value": "R3-Medium Risk" + } + ] +} \ No newline at end of file diff --git a/features/transaction/src/main/resources/zh_CN/element/string.json b/features/transaction/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a2bffc5f9001dc9a0192349483668da62aea744d --- /dev/null +++ b/features/transaction/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,72 @@ +{ + "string": [ + { + "name": "shared_desc", + "value": "description" + }, + { + "name": "fixed_investment", + "value": "定投专区" + }, + { + "name": "financial_purchase", + "value": "理财购买" + }, + { + "name": "transaction_account", + "value": "账户" + }, + { + "name": "payment_account", + "value": "付款账户 (0012)" + }, + { + "name": "available_balance", + "value": "可用余额 ¥ 34,567.89" + }, + { + "name": "purchase_amount", + "value": "购买金额" + }, + { + "name": "transaction_rules", + "value": "交易规则" + }, + { + "name": "money_symbol", + "value": "¥" + }, + { + "name": "buy_all", + "value": "全部买入" + }, + { + "name": "confirm_share_prompt", + "value": "购买%d费率,预计%d月%d日确认份额" + }, + { + "name": "recommendation_no", + "value": "推荐号" + }, + { + "name": "recommendation_optional", + "value": "选填" + }, + { + "name": "transaction_read", + "value": "阅读并同意《产品说明书》《风险揭示书》等协议" + }, + { + "name": "transaction_button", + "value": "同意协议下一步" + }, + { + "name": "fund_type", + "value": "货币型" + }, + { + "name": "risk_level", + "value": "R3-中风险" + } + ] +} \ No newline at end of file diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f70ecd4112d94f9aa555adf898d53f18bf58f3e9 --- /dev/null +++ b/hvigor/hvigor-config.json5 @@ -0,0 +1,5 @@ +{ + "modelVersion": "5.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/hvigorfile.ts b/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775 --- /dev/null +++ b/hvigorfile.ts @@ -0,0 +1,6 @@ +import { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/oh-package.json5 b/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..ee60940578fe69253b703fed4ea5356c33672933 --- /dev/null +++ b/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + "@ohos/hypium": "1.0.15" + }, + "author": "", + "name": "multifinancialmanagement", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": {} +} diff --git a/product/phone/build-profile.json5 b/product/phone/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..197e83c1b9504b12a3837e0189185479662cad4b --- /dev/null +++ b/product/phone/build-profile.json5 @@ -0,0 +1,31 @@ +{ + "apiType": "stageMode", + "buildOption": { + "arkOptions": { + // "apPath": "./modules.ap" /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */ + } + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": true, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/product/phone/hvigorfile.ts b/product/phone/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3 --- /dev/null +++ b/product/phone/hvigorfile.ts @@ -0,0 +1,6 @@ +import { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/product/phone/obfuscation-rules.txt b/product/phone/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b --- /dev/null +++ b/product/phone/obfuscation-rules.txt @@ -0,0 +1,18 @@ +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file diff --git a/product/phone/oh-package.json5 b/product/phone/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9f0ccdfaf85230f64ec33ce0f62e12fa0dc70efc --- /dev/null +++ b/product/phone/oh-package.json5 @@ -0,0 +1,14 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "phone", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dynamicDependencies": {}, + "dependencies": { + "@ohos/basic": "file:../../commons/basic", + "@ohos/home": "file:../../features/home" + } +} diff --git a/product/phone/src/main/ets/entryability/EntryAbility.ets b/product/phone/src/main/ets/entryability/EntryAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..df3ac1fd36aabad56c62d7c6fc5657223159d19d --- /dev/null +++ b/product/phone/src/main/ets/entryability/EntryAbility.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2023 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 { UIAbility, Want, AbilityConstant } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { window } from '@kit.ArkUI'; + +export default class EntryAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy(): void { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + 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) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy(): void { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground(): void { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground(): void { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/product/phone/src/main/ets/pages/Index.ets b/product/phone/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83cce84d0b608e46788f2cbf18665ede9f8aa7d7 --- /dev/null +++ b/product/phone/src/main/ets/pages/Index.ets @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2023 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 { BreakpointUtil, CommonConstants } from '@ohos/basic'; +import { AdvertisementDialog, HomeComponent } from '@ohos/home'; +import { window } from '@kit.ArkUI'; + +@Entry +@Component +struct Index { + @StorageLink('breakPoint') breakPoint: string = CommonConstants.BREAK_POINT_SM; + @State currentTabIndex: number = 0; + @StorageProp('avoidArea') topHeight: number = 0; + @StorageProp('bottom') bottom: number = 0; + @State backgroundImageY: number = 0; + dialogController: CustomDialogController = new CustomDialogController({ + builder: AdvertisementDialog(), + backgroundColor: $r('app.color.dialog_background'), + alignment: DialogAlignment.Center, + maskColor: $r('app.color.dialog_mask'), + customStyle: true + }); + + aboutToAppear() { + this.dialogController.open(); + } + + onPageShow() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + let area = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + let topHeight = px2vp(area.topRect.height); + let bottomArea = windowStage.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); + let bottom = px2vp(bottomArea.bottomRect.height); + if (topHeight > 0) { + windowStage.setWindowLayoutFullScreen(true); + AppStorage.setOrCreate('avoidArea', topHeight); + AppStorage.setOrCreate('bottom', bottom); + } + }); + } + + onPageHide() { + window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { + if (this.topHeight > 0) { + windowStage.setWindowLayoutFullScreen(false); + } + }); + } + + 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 ) { + 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'); + } + + @Builder + BuildTabs(icon: Resource, title: ResourceStr, index: number) { + Column() { + Image(icon) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + .fillColor(this.getTabBarColor(index, this.currentTabIndex, this.breakPoint)) + Text(title) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.getTabBarColor(index, this.currentTabIndex, this.breakPoint)) + } + } + + @Builder + BuildTabsMine(icon: Resource, unIcon: Resource, title: ResourceStr, index: number) { + Column() { + Image(this.currentTabIndex === index ? icon : unIcon) + .width($r('app.float.common_image_width')) + .height($r('app.float.common_image_height')) + Text(title) + .fontSize($r('app.float.tab_text_size')) + .lineHeight($r('app.float.tab_text_height')) + .fontWeight(FontWeight.Regular) + .fontColor(this.getTabBarColor(index, this.currentTabIndex, this.breakPoint)) + } + } + + 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: { + 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 + }) + .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_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.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 ? + 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 + }) + } + } + } + .onBreakpointChange((breakpoints: string) => { + this.breakPoint = breakpoints; + }) + } +} \ No newline at end of file diff --git a/product/phone/src/main/module.json5 b/product/phone/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..49a824afca5e998dc28129d8f5733655a93fc1ad --- /dev/null +++ b/product/phone/src/main/module.json5 @@ -0,0 +1,40 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "phone", + "tablet", + "2in1" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ets", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:startIcon", + "startWindowBackground": "$color:start_window_background", + "minWindowWidth": 360, + "minWindowHeight": 720, + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1e87cfd0b724301369c18bd3c466acc10a2d4506 --- /dev/null +++ b/product/phone/src/main/resources/base/element/color.json @@ -0,0 +1,40 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "dialog_background", + "value": "#00FFFFFF" + }, + { + "name": "dialog_mask", + "value": "#99000000" + }, + { + "name": "home_background", + "value": "#F7F7F7" + }, + { + "name": "bar_background", + "value": "#2ef1f3f5" + }, + { + "name": "tab_choose_image", + "value": "#0A59F7" + }, + { + "name": "tab_un_image", + "value": "#33000000" + }, + { + "name": "tab_choose_text", + "value": "#0A59F7" + }, + { + "name": "tab_un_text", + "value": "#33000000" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/float.json b/product/phone/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..2b137e31ba0c2c560780eafe7399c52ac13596c0 --- /dev/null +++ b/product/phone/src/main/resources/base/element/float.json @@ -0,0 +1,28 @@ +{ + "float": [ + { + "name": "common_image_width", + "value": "24vp" + }, + { + "name": "common_image_height", + "value": "24vp" + }, + { + "name": "tab_text_size", + "value": "10fp" + }, + { + "name": "tab_text_height", + "value": "14vp" + }, + { + "name": "tab_bar_width", + "value": "96vp" + }, + { + "name": "tab_bar_height", + "value": "56vp" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/string.json b/product/phone/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c2919cc646dd8135a51e28c40dd33557df4d6ada --- /dev/null +++ b/product/phone/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiFinancialManagement" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/ic_home_fold_background.png b/product/phone/src/main/resources/base/media/ic_home_fold_background.png new file mode 100644 index 0000000000000000000000000000000000000000..2ecbe63c76052be4f6f9cbb2dafd0e62238eff6d Binary files /dev/null and b/product/phone/src/main/resources/base/media/ic_home_fold_background.png differ diff --git a/product/phone/src/main/resources/base/media/ic_home_fortunes.svg b/product/phone/src/main/resources/base/media/ic_home_fortunes.svg new file mode 100644 index 0000000000000000000000000000000000000000..27236e9117514e1e9fff77ba9278728504735003 --- /dev/null +++ b/product/phone/src/main/resources/base/media/ic_home_fortunes.svg @@ -0,0 +1,11 @@ + + + 财富 + + + + + + + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/ic_home_mine.svg b/product/phone/src/main/resources/base/media/ic_home_mine.svg new file mode 100644 index 0000000000000000000000000000000000000000..62a5b62bce8cbec51c56c1db00f7317e4e9a52be --- /dev/null +++ b/product/phone/src/main/resources/base/media/ic_home_mine.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/ic_home_mine_filled.svg b/product/phone/src/main/resources/base/media/ic_home_mine_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..dbeec6ef94878c69058ce80156916747920a5102 --- /dev/null +++ b/product/phone/src/main/resources/base/media/ic_home_mine_filled.svg @@ -0,0 +1,12 @@ + + + 我的 + + + + + + + + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/ic_home_not_background.png b/product/phone/src/main/resources/base/media/ic_home_not_background.png new file mode 100644 index 0000000000000000000000000000000000000000..fb33baf308415ec4d46654cedbdaed9eaf59ffab Binary files /dev/null and b/product/phone/src/main/resources/base/media/ic_home_not_background.png differ diff --git a/product/phone/src/main/resources/base/media/ic_home_phone_background.png b/product/phone/src/main/resources/base/media/ic_home_phone_background.png new file mode 100644 index 0000000000000000000000000000000000000000..dba3b16cfcc0687ad7d0270fe96b339fb69abf83 Binary files /dev/null and b/product/phone/src/main/resources/base/media/ic_home_phone_background.png differ diff --git a/product/phone/src/main/resources/base/media/ic_home_tablet_background.png b/product/phone/src/main/resources/base/media/ic_home_tablet_background.png new file mode 100644 index 0000000000000000000000000000000000000000..631fd5f624d63d7e4b96e81cc32b8167f182911d Binary files /dev/null and b/product/phone/src/main/resources/base/media/ic_home_tablet_background.png differ diff --git a/product/phone/src/main/resources/base/media/ic_life_filled.svg b/product/phone/src/main/resources/base/media/ic_life_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..b1aba5b5eb63534290b53c06fe7815720796b052 --- /dev/null +++ b/product/phone/src/main/resources/base/media/ic_life_filled.svg @@ -0,0 +1,20 @@ + + + 生活 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/ic_public_cards_filled.svg b/product/phone/src/main/resources/base/media/ic_public_cards_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..965b18a454a95133c73c7a3b9b917e538c1a217c --- /dev/null +++ b/product/phone/src/main/resources/base/media/ic_public_cards_filled.svg @@ -0,0 +1,20 @@ + + + 信用卡 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/ic_public_home_filled.svg b/product/phone/src/main/resources/base/media/ic_public_home_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..deb4371a0ec1c00f635cb10894fb3eefcf8a672f --- /dev/null +++ b/product/phone/src/main/resources/base/media/ic_public_home_filled.svg @@ -0,0 +1,20 @@ + + + 首页 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/product/phone/src/main/resources/base/media/icon.png b/product/phone/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 Binary files /dev/null and b/product/phone/src/main/resources/base/media/icon.png differ diff --git a/product/phone/src/main/resources/base/media/startIcon.png b/product/phone/src/main/resources/base/media/startIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..366f76459ffd4494ec40d0ddd5c59385b9c5da11 Binary files /dev/null and b/product/phone/src/main/resources/base/media/startIcon.png differ diff --git a/product/phone/src/main/resources/base/profile/main_pages.json b/product/phone/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/product/phone/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/product/phone/src/main/resources/en_US/element/string.json b/product/phone/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c2919cc646dd8135a51e28c40dd33557df4d6ada --- /dev/null +++ b/product/phone/src/main/resources/en_US/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "MultiFinancialManagement" + }, + { + "name": "tab_bar_home", + "value": "home" + }, + { + "name": "tab_bar_card", + "value": "card" + }, + { + "name": "tab_bar_fortunes", + "value": "fortunes" + }, + { + "name": "tab_bar_life", + "value": "life" + }, + { + "name": "tab_bar_mine", + "value": "mine" + } + ] +} \ No newline at end of file diff --git a/product/phone/src/main/resources/zh_CN/element/string.json b/product/phone/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d51095329edda1f8c1c15c2925d8fd7a8c28f007 --- /dev/null +++ b/product/phone/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "银行理财" + }, + { + "name": "tab_bar_home", + "value": "首页" + }, + { + "name": "tab_bar_card", + "value": "信用卡" + }, + { + "name": "tab_bar_fortunes", + "value": "财富" + }, + { + "name": "tab_bar_life", + "value": "生活" + }, + { + "name": "tab_bar_mine", + "value": "我的" + } + ] +} \ No newline at end of file diff --git a/screenshots/device/config.png b/screenshots/device/config.png new file mode 100644 index 0000000000000000000000000000000000000000..52b87b948de7a123f87ce851f0aa414750fb1342 Binary files /dev/null and b/screenshots/device/config.png differ diff --git a/screenshots/device/foldable.png b/screenshots/device/foldable.png new file mode 100644 index 0000000000000000000000000000000000000000..cb3ad4f7838a94ee19f026f908f3744f0cd9e33c Binary files /dev/null and b/screenshots/device/foldable.png differ diff --git a/screenshots/device/pad.png b/screenshots/device/pad.png new file mode 100644 index 0000000000000000000000000000000000000000..617bd55946c51d7e27a93caa6defd0a7630ab9b3 Binary files /dev/null and b/screenshots/device/pad.png differ diff --git a/screenshots/device/phone.png b/screenshots/device/phone.png new file mode 100644 index 0000000000000000000000000000000000000000..0c1b31002e193c97f120cab53da92353977741ac Binary files /dev/null and b/screenshots/device/phone.png differ diff --git a/screenshots/device/run.png b/screenshots/device/run.png new file mode 100644 index 0000000000000000000000000000000000000000..7655fa7e041bb067e028029d820bd2d320e2cd83 Binary files /dev/null and b/screenshots/device/run.png differ