# MyFinApplication **Repository Path**: erictor_admin/my-fin-application ## Basic Information - **Project Name**: MyFinApplication - **Description**: 理财案例 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-04 - **Last Updated**: 2024-02-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 个人理财项目案例 ## 1. 开通服务认证 AGC地址: [AppGallery Connect (huawei.com)](https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/) [HarmonyOS使用入门(ArkTS API9及以上)-HarmonyOS-使用入门 | 华为开发者联盟 (huawei.com)](https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/agc-get-started-harmony-arkts-0000001683915520) ![image-20240202105546426](./img/image-20240202105546426.png) ![image-20240202105732444](./img/image-20240202105732444.png) ![image-20240202105824285](./img/image-20240202105824285.png) ![image-20240202105933707](./img/image-20240202105933707.png) 下载文件放到下面路径 ![image-20240202110109403](./img/image-20240202110109403.png) 检查依赖 ![image-20240202110241131](./img/image-20240202110241131.png) ## 2. 邮箱认证 [邮箱-登录认证-ArkTS(API 9及以上)-HarmonyOS-认证服务 | 华为开发者联盟 (huawei.com)](https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/agc-auth-harmonyos-arkts-login-email-0000001679886157) ### 2.1 初始化,修改EntryAbility的onCreate以下内容 [集成SDK-ArkTS(API 9及以上)-HarmonyOS-认证服务 | 华为开发者联盟 (huawei.com)](https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/agc-auth-harmonyos-arkts-integration-0000001679766293) ``` import { initialize } from '@hw-agconnect/hmcore'; import util from '@ohos.util'; async onCreate(want, launchParam) { //初始化agconnect let input = await this.context.resourceManager.getRawFileContent('agconnect-services.json') let jsonString = util.TextDecoder.create('utf-8', { ignoreBOM: true }).decodeWithStream(input, { stream: false }); ``` ### 2.2.添加发送邮件方法 [邮箱-登录认证-ArkTS(API 9及以上)-HarmonyOS-认证服务 | 华为开发者联盟 (huawei.com)](https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/agc-auth-harmonyos-arkts-login-email-0000001679886157) ``` /* * 验证码部分 * */ import { Auth, VerifyCodeAction } from '@hw-agconnect/cloud'; import cloud from '@hw-agconnect/cloud'; @Component export default struct InputAuth { @State countDown: number = 60 @State email:string = 'gouwqiang@163.com' timer?: number //发送验证码 sendCode() { this.startCountDown() console.log('发送验证码。。。') //发送邮箱验证吗 cloud.auth().requestVerifyCode({ action: VerifyCodeAction.REGISTER_LOGIN, lang: 'zh_CN', sendInterval: 60, verifyCodeType: { email: this.email, kind: "email", } }).then(verifyCodeResult => { //验证码申请成功 console.log(JSON.stringify(verifyCodeResult),'成功了') }).catch(error => { //验证码申请失败 console.log(JSON.stringify(error),'错误') }); } //倒计时 startCountDown() { this.timer = setInterval(() => { this.countDown -= 1 if (this.countDown === 0) { this.countDown = 60 clearInterval(this.timer) } }, 1000) } build() { Column({ space: 10 }) { Text('验证码') .width('100%') .textAlign(TextAlign.Start) .fontSize(16) .fontWeight(500) .fontColor($r('app.color.font_color')) .margin({ bottom: 14 }) Row() { TextInput({ placeholder: '请输入验证码' }).width(170) Button(this.countDown == 60 ? '发送验证码' : `${this.countDown}s`) .onClick(() => { if (this.countDown === 60) { //倒计数过程不能点击 this.sendCode() } }) }.width('100%') .justifyContent(FlexAlign.SpaceBetween) }.margin({ top: 20 }) } } ``` ### 2.3 触发后去邮箱查看 ![image-20240204113544354](D:\code\Harmony\MyApp2\img\image-20240204113544354.png) ## 3.端云一体化 [创建端云一体化开发工程-端云一体化开发-应用/服务开发-DevEco Studio使用指南-工具 | 华为开发者联盟 (huawei.com)[](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/agc-harmonyos-clouddev-createproject-0000001439596128-V2) ### 3.1 创建云函数 ![image-20240205114527007](D:\code\Harmony\MyApp2\img\image-20240205114527007.png) ![image-20240205114628411](D:\code\Harmony\MyApp2\img\image-20240205114628411.png) ![image-20240205114802382](D:\code\Harmony\MyApp2\img\image-20240205114802382.png) ![image-20240205115347253](D:\code\Harmony\MyApp2\img\image-20240205115347253.png) ![image-20240205134843991](D:\code\Harmony\MyApp2\img\image-20240205134843991.png) ![image-20240205135106309](D:\code\Harmony\MyApp2\img\image-20240205135106309.png) ![image-20240205135157316](D:\code\Harmony\MyApp2\img\image-20240205135157316.png) [AppGallery Connect (huawei.com)](https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myProject/388421841221941403/9249519184595931747?appId=5765880207853589255) ![image-20240205135223734](D:\code\Harmony\MyApp2\img\image-20240205135223734.png) ### 3.2 创建云数据库 ![image-20240205135539259](D:\code\Harmony\MyApp2\img\image-20240205135539259.png) ![image-20240205135812131](D:\code\Harmony\MyApp2\img\image-20240205135812131.png) ![image-20240205135849798](D:\code\Harmony\MyApp2\img\image-20240205135849798.png) ![image-20240205135908095](D:\code\Harmony\MyApp2\img\image-20240205135908095.png) ![image-20240205135936581](D:\code\Harmony\MyApp2\img\image-20240205135936581.png) ![image-20240205140032019](D:\code\Harmony\MyApp2\img\image-20240205140032019.png) ![image-20240205140312204](D:\code\Harmony\MyApp2\img\image-20240205140312204.png) [集成SDK并使用数据库-Server(Node.js)-云侧通过SDK使用云数据库-云数据库 for Object | 华为开发者联盟 (huawei.com)](https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/agc-clouddb-sdk-integration-nodejs-0000001518387192) [定制Demo包-基于Demo实现通过云函数使用云数据库(查询)-云数据库 for Object | 华为开发者联盟 (huawei.com)](https://developer.huawei.com/consumer/cn/doc/AppGallery-connect-Guides/query-clouddb-modify-demo-0000001549461562) [![image-20240205141157761](D:\code\Harmony\MyApp2\img\image-20240205141157761.png) ![](D:\code\Harmony\MyApp2\img\image-20240205141327722.png)