Showing
9 changed files
with
392 additions
and
500 deletions
| 1 | export { add } from "./src/main/ets/utils/Calc" | 1 | export { add } from "./src/main/ets/utils/Calc" |
| 2 | -export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordLayout" | 2 | +export { SettingPasswordParams } from "./src/main/ets/pages/login/SettingPasswordPage" |
| 3 | 3 | ||
| 4 | export { LoginModule } from './src/main/ets/LoginModule' | 4 | export { LoginModule } from './src/main/ets/LoginModule' |
| @@ -3,7 +3,7 @@ import { LoginInputComponent } from './LoginInputComponent' | @@ -3,7 +3,7 @@ import { LoginInputComponent } from './LoginInputComponent' | ||
| 3 | import { LoginViewModel } from './LoginViewModel' | 3 | import { LoginViewModel } from './LoginViewModel' |
| 4 | import router from '@ohos.router' | 4 | import router from '@ohos.router' |
| 5 | import { WDRouterRule, WDRouterPage } from 'wdRouter'; | 5 | import { WDRouterRule, WDRouterPage } from 'wdRouter'; |
| 6 | -import { SettingPasswordParams } from './SettingPasswordLayout' | 6 | +import { SettingPasswordParams } from './SettingPasswordPage' |
| 7 | import { Router } from '@ohos.arkui.UIContext' | 7 | import { Router } from '@ohos.arkui.UIContext' |
| 8 | import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit/Index' | 8 | import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, StringUtils, ToastUtils } from 'wdKit/Index' |
| 9 | import { SpConstants } from 'wdConstant/Index' | 9 | import { SpConstants } from 'wdConstant/Index' |
| @@ -22,7 +22,6 @@ struct ForgetPasswordPage { | @@ -22,7 +22,6 @@ struct ForgetPasswordPage { | ||
| 22 | @State isSubmit: boolean = false //是否可以提交 默认不可以 | 22 | @State isSubmit: boolean = false //是否可以提交 默认不可以 |
| 23 | loginViewModel: LoginViewModel = new LoginViewModel() | 23 | loginViewModel: LoginViewModel = new LoginViewModel() |
| 24 | @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件 | 24 | @State @Watch('onCodeSend') isCodeSend: boolean = false //验证码点击发送事件 |
| 25 | - pageType:number = (router.getParams() as Record<string, number>)['pageType']; //0、登录->忘记密码 1、设置->重置密码 3、设置->更换手机号页面2(不知道是啥) | ||
| 26 | phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号 | 25 | phone:string = (router.getParams() as Record<string, number>)['phone'] + ""; //登录 密码登录 填写手机号 点击忘记密码 带过来手机号 |
| 27 | @State pageTitle:string = '找回密码'; | 26 | @State pageTitle:string = '找回密码'; |
| 28 | @State codeStateSuccess:boolean=false | 27 | @State codeStateSuccess:boolean=false |
| @@ -57,7 +56,7 @@ struct ForgetPasswordPage { | @@ -57,7 +56,7 @@ struct ForgetPasswordPage { | ||
| 57 | codeContent: $codeContent, | 56 | codeContent: $codeContent, |
| 58 | isSubmit: $isSubmit, | 57 | isSubmit: $isSubmit, |
| 59 | isCodeSend: $isCodeSend, | 58 | isCodeSend: $isCodeSend, |
| 60 | - pageType:this.pageType, | 59 | + pageType:0, |
| 61 | codeStateSuccess:$codeStateSuccess | 60 | codeStateSuccess:$codeStateSuccess |
| 62 | }) | 61 | }) |
| 63 | Row() { | 62 | Row() { |
| @@ -81,21 +80,8 @@ struct ForgetPasswordPage { | @@ -81,21 +80,8 @@ struct ForgetPasswordPage { | ||
| 81 | } | 80 | } |
| 82 | 81 | ||
| 83 | aboutToAppear() { | 82 | aboutToAppear() { |
| 84 | - if (router.getParams()) { | ||
| 85 | - let params = router.getParams() as Record<string, number> | ||
| 86 | - this.pageType = params['pageType'] | ||
| 87 | - Logger.info(TAG, 'params.contentID:' + params.contentID); | ||
| 88 | - } | ||
| 89 | - if (this.pageType == 0){ | ||
| 90 | - this.pageTitle = '找回密码' | ||
| 91 | - if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){ | ||
| 92 | - this.phoneContent = this.phone | ||
| 93 | - } | ||
| 94 | - }else if (this.pageType == 1){ | ||
| 95 | - this.pageTitle = '验证当前手机号' | ||
| 96 | - } | ||
| 97 | - if (this.isCodeSend) { | ||
| 98 | - this.sendVerifyCode() | 83 | + if(StringUtils.isNotEmpty(this.phone) && this.phone.indexOf("****") === -1){ |
| 84 | + this.phoneContent = this.phone | ||
| 99 | } | 85 | } |
| 100 | } | 86 | } |
| 101 | 87 | ||
| @@ -105,20 +91,7 @@ struct ForgetPasswordPage { | @@ -105,20 +91,7 @@ struct ForgetPasswordPage { | ||
| 105 | return | 91 | return |
| 106 | } | 92 | } |
| 107 | 93 | ||
| 108 | - if(this.pageType == 1){ | ||
| 109 | - this.loginViewModel.sendVerifyCodeByToken().then(()=>{ | ||
| 110 | - this.showToastTip("已发送") | ||
| 111 | - this.codeStateSuccess=true | ||
| 112 | - this.isCodeSend=false | ||
| 113 | - }).catch((message: string)=>{ | ||
| 114 | - this.showToastTip(message) | ||
| 115 | - this.codeStateSuccess=false | ||
| 116 | - this.isCodeSend=false | ||
| 117 | - }) | ||
| 118 | - return | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){ | 94 | + if(this.phoneContent.indexOf("****")!=-1){ |
| 122 | //设置密码 忘记密码跳转过来的 需要使用上面方法 | 95 | //设置密码 忘记密码跳转过来的 需要使用上面方法 |
| 123 | this.loginViewModel.sendVerifyCodeByToken().then(()=>{ | 96 | this.loginViewModel.sendVerifyCodeByToken().then(()=>{ |
| 124 | this.showToastTip("已发送") | 97 | this.showToastTip("已发送") |
| @@ -168,22 +141,8 @@ struct ForgetPasswordPage { | @@ -168,22 +141,8 @@ struct ForgetPasswordPage { | ||
| 168 | if (this.isEmpty(this.codeContent)) { | 141 | if (this.isEmpty(this.codeContent)) { |
| 169 | return | 142 | return |
| 170 | } | 143 | } |
| 171 | - if(this.pageType == 1){ | ||
| 172 | - this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{ | ||
| 173 | - let params: SettingPasswordParams = { | ||
| 174 | - pageID:'1', | ||
| 175 | - phoneContent:this.phoneContent, | ||
| 176 | - codeContent:this.codeContent, | ||
| 177 | - pageType:this.pageType | ||
| 178 | - } | ||
| 179 | - WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params) | ||
| 180 | - }).catch((message: string)=>{ | ||
| 181 | - this.showToastTip(message) | ||
| 182 | - }) | ||
| 183 | - return | ||
| 184 | - } | ||
| 185 | 144 | ||
| 186 | - if(this.pageType == 0 && this.phoneContent.indexOf("****")!=-1){ | 145 | + if(this.phoneContent.indexOf("****")!=-1){ |
| 187 | this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{ | 146 | this.loginViewModel.checkVerifyCodeByToken(this.codeContent).then(()=>{ |
| 188 | let params: SettingPasswordParams = { | 147 | let params: SettingPasswordParams = { |
| 189 | pageID:'1', | 148 | pageID:'1', |
| @@ -203,7 +162,7 @@ struct ForgetPasswordPage { | @@ -203,7 +162,7 @@ struct ForgetPasswordPage { | ||
| 203 | pageID:'1', | 162 | pageID:'1', |
| 204 | phoneContent:this.phoneContent, | 163 | phoneContent:this.phoneContent, |
| 205 | codeContent:this.codeContent, | 164 | codeContent:this.codeContent, |
| 206 | - pageType:this.pageType | 165 | + pageType:0 |
| 207 | } | 166 | } |
| 208 | WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) | 167 | WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) |
| 209 | 168 | ||
| @@ -218,53 +177,6 @@ struct ForgetPasswordPage { | @@ -218,53 +177,6 @@ struct ForgetPasswordPage { | ||
| 218 | return (obj == undefined || obj == null || obj == ''); | 177 | return (obj == undefined || obj == null || obj == ''); |
| 219 | } | 178 | } |
| 220 | 179 | ||
| 221 | - changeBindPhone(){ | ||
| 222 | - if (!this.isSubmit) { | ||
| 223 | - return | ||
| 224 | - } | ||
| 225 | - if (this.isEmpty(this.phoneContent)) { | ||
| 226 | - return | ||
| 227 | - } | ||
| 228 | - if (this.isEmpty(this.codeContent)) { | ||
| 229 | - return | ||
| 230 | - } | ||
| 231 | - this.loginViewModel.changeBindPhone(this.phoneContent,this.codeContent).then(()=>{ | ||
| 232 | - ToastUtils.shortToast('绑定成功') | ||
| 233 | - this.querySecurity() | ||
| 234 | - }).catch((message: string) => { | ||
| 235 | - if (message != '') { | ||
| 236 | - ToastUtils.shortToast(message) | ||
| 237 | - } | ||
| 238 | - }) | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - querySecurity(){ | ||
| 242 | - this.loginViewModel.querySecurity().then(()=>{ | ||
| 243 | - SPHelper.default.save(SpConstants.USER_PHONE,this.phoneContent) | ||
| 244 | - this.sendEmitEvent() | ||
| 245 | - router.back() | ||
| 246 | - }).catch(()=>{ | ||
| 247 | - | ||
| 248 | - }) | ||
| 249 | - } | ||
| 250 | - | ||
| 251 | - sendEmitEvent(){ | ||
| 252 | - // 定义一个eventId为1的事件,事件优先级为Low | ||
| 253 | - let event: emitter.InnerEvent = { | ||
| 254 | - eventId: EmitterEventId.PHONE_CHANGE_SUCCESS, | ||
| 255 | - priority: emitter.EventPriority.LOW | ||
| 256 | - }; | ||
| 257 | - | ||
| 258 | - let eventData: emitter.EventData = { | ||
| 259 | - data: { | ||
| 260 | - content: this.phoneContent, | ||
| 261 | - } | ||
| 262 | - }; | ||
| 263 | - | ||
| 264 | - // 发送eventId为1的事件,事件内容为eventData | ||
| 265 | - emitter.emit(event, eventData); | ||
| 266 | - } | ||
| 267 | - | ||
| 268 | showToastTip(msg:string){ | 180 | showToastTip(msg:string){ |
| 269 | this.toastText = msg | 181 | this.toastText = msg |
| 270 | this.dialogToast.open() | 182 | this.dialogToast.open() |
| @@ -10,7 +10,7 @@ export struct LoginInputComponent { | @@ -10,7 +10,7 @@ export struct LoginInputComponent { | ||
| 10 | @Link isCodeSend: boolean //验证码控件是否点击 默认没有 发送接口 | 10 | @Link isCodeSend: boolean //验证码控件是否点击 默认没有 发送接口 |
| 11 | @Link isSubmit: boolean //是否可以提交 | 11 | @Link isSubmit: boolean //是否可以提交 |
| 12 | isFirst:boolean=true//是否第一次获取验证码 | 12 | isFirst:boolean=true//是否第一次获取验证码 |
| 13 | - pageType?:number; //0、登录->忘记密码 3、设置->更换手机号页面2 | 13 | + pageType?:number; //0、登录->忘记密码 |
| 14 | lastTime: number = 0 | 14 | lastTime: number = 0 |
| 15 | @Link @Watch('startCount') codeStateSuccess: boolean //验证码获取成功与否回调 成功显示倒计时 | 15 | @Link @Watch('startCount') codeStateSuccess: boolean //验证码获取成功与否回调 成功显示倒计时 |
| 16 | @Watch('onCheckChange') @Prop protocolState: boolean = false //协议勾选状态 | 16 | @Watch('onCheckChange') @Prop protocolState: boolean = false //协议勾选状态 |
| @@ -177,11 +177,10 @@ struct LoginPage { | @@ -177,11 +177,10 @@ struct LoginPage { | ||
| 177 | .onClick(() => { | 177 | .onClick(() => { |
| 178 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) | 178 | TrackingButton.click("loginPageForgotPassword",TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page) |
| 179 | if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){ | 179 | if(StringUtils.isNotEmpty(this.accountContent) && StringUtils.photoMatch(this.accountContent)){ |
| 180 | - let pageType = { 'pageType': 0, 'phone': Number(this.accountContent) } as Record<string, number>; | 180 | + let pageType = { 'phone': Number(this.accountContent) } as Record<string, number>; |
| 181 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 181 | WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) |
| 182 | }else{ | 182 | }else{ |
| 183 | - let pageType = { 'pageType': 0 } as Record<string, number>; | ||
| 184 | - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 183 | + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) |
| 185 | } | 184 | } |
| 186 | }) | 185 | }) |
| 187 | } | 186 | } |
| @@ -166,8 +166,7 @@ struct ModifyPasswordPage { | @@ -166,8 +166,7 @@ struct ModifyPasswordPage { | ||
| 166 | Column() { | 166 | Column() { |
| 167 | Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | 167 | Text("忘记密码").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) |
| 168 | .onClick(()=>{ | 168 | .onClick(()=>{ |
| 169 | - let pageType = { 'pageType': 0 } as Record<string, number>; | ||
| 170 | - WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage, pageType) | 169 | + WDRouterRule.jumpWithPage(WDRouterPage.forgetPasswordPage) |
| 171 | }) | 170 | }) |
| 172 | } | 171 | } |
| 173 | .width('100%') | 172 | .width('100%') |
sight_harmony/features/wdLogin/src/main/ets/pages/login/SettingPasswordLayout.ets
deleted
100644 → 0
| 1 | -import ArrayList from '@ohos.util.ArrayList'; | ||
| 2 | -import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; | ||
| 3 | -import router from '@ohos.router'; | ||
| 4 | -import { LoginViewModel } from './LoginViewModel'; | ||
| 5 | -import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit'; | ||
| 6 | -import { | ||
| 7 | - SpConstants | ||
| 8 | -} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' | ||
| 9 | -import data_preferences from '@ohos.data.preferences'; | ||
| 10 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 11 | - | ||
| 12 | -const TAG = "SettingPasswordLayout" | ||
| 13 | - | ||
| 14 | -export interface SettingPasswordParams { | ||
| 15 | - pageID: string; | ||
| 16 | - phoneContent?: string; | ||
| 17 | - codeContent?: string; | ||
| 18 | - tempToken?:string; | ||
| 19 | - pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机号页面1 3、设置->更换手机号页面2 | ||
| 20 | -} | ||
| 21 | - | ||
| 22 | -export default class AccoutPageDataModel { | ||
| 23 | - // 页面数据 | ||
| 24 | - compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白 | ||
| 25 | - compLogo: string | ||
| 26 | - compTitle: string | ||
| 27 | - compSubTitle: string = ''; | ||
| 28 | - compDesc: string | ||
| 29 | - compButtonTitle: string | ||
| 30 | - inputPlacholder: string | ||
| 31 | - inputTag: number | ||
| 32 | - | ||
| 33 | - constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) { | ||
| 34 | - this.compType = compType | ||
| 35 | - this.compTitle = compTitle | ||
| 36 | - this.compLogo = compLogo | ||
| 37 | - this.compDesc = compDesc | ||
| 38 | - this.compButtonTitle = compButtonTitle | ||
| 39 | - this.inputPlacholder = inputPlacholder | ||
| 40 | - this.inputTag = inputTag | ||
| 41 | - } | ||
| 42 | -} | ||
| 43 | - | ||
| 44 | -@Entry | ||
| 45 | -@Component | ||
| 46 | -export struct SettingPasswordLayout { | ||
| 47 | - @State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据 | ||
| 48 | - @State btnStatus: boolean = false; | ||
| 49 | - pageId:number = 0; | ||
| 50 | - phoneContent:string = ''; | ||
| 51 | - codeContent:string = ''; | ||
| 52 | - tempToken:string = ''; | ||
| 53 | - | ||
| 54 | - password01: string = ''; | ||
| 55 | - password02: string = ''; | ||
| 56 | - passwordOri: string = ''; | ||
| 57 | - loginViewModel = new LoginViewModel() | ||
| 58 | - pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机 | ||
| 59 | - | ||
| 60 | - @State toastText:string = "" | ||
| 61 | - dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 62 | - builder: CustomToast({ | ||
| 63 | - msg: this.toastText, | ||
| 64 | - }), | ||
| 65 | - autoCancel: false, | ||
| 66 | - alignment: DialogAlignment.Center, | ||
| 67 | - customStyle: true, | ||
| 68 | - maskColor:"#00000000" | ||
| 69 | - }) | ||
| 70 | - | ||
| 71 | - aboutToAppear() { | ||
| 72 | - let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; | ||
| 73 | - this.pageId = parseInt(params.pageID); | ||
| 74 | - this.getPageListData(this.pageId) | ||
| 75 | - | ||
| 76 | - this.phoneContent = params.phoneContent!; | ||
| 77 | - this.codeContent = params.codeContent!; | ||
| 78 | - this.pageType = params.pageType; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - getPageListData(pageId:number) { | ||
| 82 | - switch (pageId) { | ||
| 83 | - case 0: | ||
| 84 | - // 验证/更换手机号 | ||
| 85 | - this.listData.push(new AccoutPageDataModel(0, '更换手机号', '', '', '', '', 0)) | ||
| 86 | - this.listData.push(new AccoutPageDataModel(7, '', '', '', '', '请输入手机号', 10010)) | ||
| 87 | - this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088)) | ||
| 88 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 89 | - break; | ||
| 90 | - | ||
| 91 | - case 1: | ||
| 92 | - // 设置密码 | ||
| 93 | - this.listData.push(new AccoutPageDataModel(0, '设置密码', '', '', '', '', 0)) | ||
| 94 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入密码', 10086)) | ||
| 95 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '再次输入密码', 10087)) | ||
| 96 | - this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 97 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 98 | - break; | ||
| 99 | - | ||
| 100 | - case 2: | ||
| 101 | - // 修改密码 | ||
| 102 | - this.listData.push(new AccoutPageDataModel(0, '修改密码', '', '', '', '', 0)) | ||
| 103 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入原密码', 10010)) | ||
| 104 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入新密码', 10086)) | ||
| 105 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请再请输入原密码', 10087)) | ||
| 106 | - this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 107 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 108 | - this.listData.push(new AccoutPageDataModel(3, '', '', '忘记密码', '', '', 0)) | ||
| 109 | - break; | ||
| 110 | - | ||
| 111 | - case 3: | ||
| 112 | - // 绑定手机号 | ||
| 113 | - this.listData.push(new AccoutPageDataModel(0, '绑定手机号', '', '', '', '', 0)) | ||
| 114 | - this.listData.push(new AccoutPageDataModel(7, '', '', '', '', '请输入手机号', 10010)) | ||
| 115 | - this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088)) | ||
| 116 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 117 | - break; | ||
| 118 | - | ||
| 119 | - case 4: | ||
| 120 | - // 有logo的 | ||
| 121 | - this.listData.push(new AccoutPageDataModel(5, '', '', '', '', '' , 0)) | ||
| 122 | - this.listData.push(new AccoutPageDataModel(0, '修改密码', '', '', '', '', 0)) | ||
| 123 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入原密码', 10010)) | ||
| 124 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入新密码', 10086)) | ||
| 125 | - this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请再请输入原密码', 10087)) | ||
| 126 | - this.listData.push(new AccoutPageDataModel(2, '', '', '', '', '验证码', 10088)) | ||
| 127 | - this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 128 | - this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 129 | - this.listData.push(new AccoutPageDataModel(3, '', '', '忘记密码', '', '', 0)) | ||
| 130 | - break; | ||
| 131 | - | ||
| 132 | - default: | ||
| 133 | - break; | ||
| 134 | - } | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - build() { | ||
| 138 | - Navigation() { | ||
| 139 | - this.settingList() //滑动区域 | ||
| 140 | - }.titleMode(NavigationTitleMode.Mini) | ||
| 141 | - .title('') | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - // 页面布局 | ||
| 145 | - @Builder settingList() { | ||
| 146 | - Column() { | ||
| 147 | - List() { | ||
| 148 | - ForEach(this.listData, (item: AccoutPageDataModel, index: number) => { | ||
| 149 | - ListItem() { | ||
| 150 | - if (item.compType == 0) { | ||
| 151 | - this.getTitleCell(item, HorizontalAlign.Start) | ||
| 152 | - } else if (item.compType == 1) { | ||
| 153 | - this.getPasswordCell(item) | ||
| 154 | - } else if (item.compType == 2) { | ||
| 155 | - this.getCodeCell(item) | ||
| 156 | - } else if (item.compType == 3) { | ||
| 157 | - if (index == this.listData.length - 1) { | ||
| 158 | - this.getDescCell(item, HorizontalAlign.Center) | ||
| 159 | - } else { | ||
| 160 | - this.getDescCell(item, HorizontalAlign.Start) | ||
| 161 | - } | ||
| 162 | - } else if (item.compType == 4) { | ||
| 163 | - this.getButtonCell(item) | ||
| 164 | - } else if (item.compType == 5) { | ||
| 165 | - this.getLogoCell(item) | ||
| 166 | - } else if (item.compType == 7) { | ||
| 167 | - this.getPhoneCell(item) | ||
| 168 | - } else { | ||
| 169 | - Text('' + item.compType) | ||
| 170 | - } | ||
| 171 | - } | ||
| 172 | - }) | ||
| 173 | - } | ||
| 174 | - // .divider({ | ||
| 175 | - // strokeWidth: 1, | ||
| 176 | - // startMargin: 15, | ||
| 177 | - // endMargin: 10, | ||
| 178 | - // color: '#f0f0f0' | ||
| 179 | - // }) | ||
| 180 | - }.width('100%').padding('30lpx') | ||
| 181 | - } | ||
| 182 | - | ||
| 183 | - /***************************** UI元素 ******************************************/ | ||
| 184 | - | ||
| 185 | - // 标题 | ||
| 186 | - @Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 187 | - Column() { | ||
| 188 | - Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) | ||
| 189 | - } | ||
| 190 | - .width('100%') | ||
| 191 | - .height('75lpx') | ||
| 192 | - .alignItems(alignTitle) | ||
| 193 | - } | ||
| 194 | - | ||
| 195 | - // 密码输入框 | ||
| 196 | - @Builder getPasswordCell(item: AccoutPageDataModel) { | ||
| 197 | - Row() { | ||
| 198 | - Row() { | ||
| 199 | - TextInput({ placeholder: item.inputPlacholder }) | ||
| 200 | - .placeholderColor("#CCCCCC") | ||
| 201 | - .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")}) | ||
| 202 | - .type(InputType.Password) | ||
| 203 | - .showPasswordIcon(true) | ||
| 204 | - .backgroundColor('#00000000') | ||
| 205 | - .onChange((value: string) => { | ||
| 206 | - this.inputTextChange(value, item.inputTag) | ||
| 207 | - }) | ||
| 208 | - .onSubmit((EnterKeyType) => { | ||
| 209 | - this.showToastTip('submit') | ||
| 210 | - }) | ||
| 211 | - } | ||
| 212 | - .alignItems(VerticalAlign.Center) | ||
| 213 | - .height('80lpx') | ||
| 214 | - .backgroundColor('#f5f5f5') | ||
| 215 | - .borderRadius('4vp') | ||
| 216 | - } | ||
| 217 | - .width('100%') | ||
| 218 | - .height('110lpx') | ||
| 219 | - .backgroundColor(0xffffff0) | ||
| 220 | - .alignItems(VerticalAlign.Center) | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - // 手机号输入框 | ||
| 224 | - @Builder getPhoneCell(item: AccoutPageDataModel) { | ||
| 225 | - Row() { | ||
| 226 | - Row() { | ||
| 227 | - TextInput({ placeholder: item.inputPlacholder }) | ||
| 228 | - .placeholderColor("#CCCCCC") | ||
| 229 | - .backgroundColor('#00000000') | ||
| 230 | - .onChange((value: string) => { | ||
| 231 | - this.inputTextChange(value, item.inputTag) | ||
| 232 | - }) | ||
| 233 | - .onSubmit((EnterKeyType) => { | ||
| 234 | - this.showToastTip('submit') | ||
| 235 | - }) | ||
| 236 | - } | ||
| 237 | - .alignItems(VerticalAlign.Center) | ||
| 238 | - .height('80lpx') | ||
| 239 | - .backgroundColor('#f5f5f5') | ||
| 240 | - .borderRadius('4vp') | ||
| 241 | - } | ||
| 242 | - .width('100%') | ||
| 243 | - .height('110lpx') | ||
| 244 | - .backgroundColor(0xffffff0) | ||
| 245 | - .alignItems(VerticalAlign.Center) | ||
| 246 | - } | ||
| 247 | - | ||
| 248 | - // 验证码码输入框 | ||
| 249 | - @Builder getCodeCell(item: AccoutPageDataModel) { | ||
| 250 | - Row() { | ||
| 251 | - Stack() { | ||
| 252 | - Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp') | ||
| 253 | - Row() { | ||
| 254 | - TextInput({ placeholder: item.inputPlacholder }) | ||
| 255 | - .placeholderColor("#CCCCCC") | ||
| 256 | - .backgroundColor('#00000000') | ||
| 257 | - .width('67.28%') | ||
| 258 | - .onChange((value: string) => { | ||
| 259 | - this.inputTextChange(value, item.inputTag) | ||
| 260 | - }) | ||
| 261 | - Button('发送验证码') | ||
| 262 | - .width('32.71%') | ||
| 263 | - .backgroundColor('#00000000') | ||
| 264 | - .fontColor('#da3e22') | ||
| 265 | - } | ||
| 266 | - .width('100%') | ||
| 267 | - }.height('80lpx') | ||
| 268 | - } | ||
| 269 | - .width('100%') | ||
| 270 | - .height('110lpx') | ||
| 271 | - .backgroundColor(0xffffff0) | ||
| 272 | - .alignItems(VerticalAlign.Center) | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - // desc | ||
| 276 | - @Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 277 | - Column() { | ||
| 278 | - Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | ||
| 279 | - .onClick(()=>{ | ||
| 280 | - if (item.compDesc == '忘记密码') { | ||
| 281 | - this.showToastTip('密码不符合密码规范') | ||
| 282 | - } | ||
| 283 | - }) | ||
| 284 | - } | ||
| 285 | - .width('100%') | ||
| 286 | - .height('85lpx') | ||
| 287 | - .alignItems(alignTitle) | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - // 按钮 | ||
| 291 | - @Builder getButtonCell(item: AccoutPageDataModel) { | ||
| 292 | - Row() { | ||
| 293 | - Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true }) | ||
| 294 | - .width('100%') | ||
| 295 | - .height('80lpx') | ||
| 296 | - .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d') | ||
| 297 | - .fontColor('#fff') | ||
| 298 | - .borderRadius('4vp') | ||
| 299 | - .onClick(() => { | ||
| 300 | - this.buttonClick() | ||
| 301 | - }) | ||
| 302 | - } | ||
| 303 | - .padding({top:'25lpx'}) | ||
| 304 | - .alignItems(VerticalAlign.Center) | ||
| 305 | - .width('100%') | ||
| 306 | - .height('120lpx') | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - // 标题 | ||
| 310 | - @Builder getLogoCell(item: AccoutPageDataModel) { | ||
| 311 | - Column() { | ||
| 312 | - Image(item.compLogo).height('150lpx').width('150lpx') | ||
| 313 | - } | ||
| 314 | - .width('100%') | ||
| 315 | - .height('200lpx') | ||
| 316 | - } | ||
| 317 | - | ||
| 318 | - /***************************** 事件处理 ******************************************/ | ||
| 319 | - // 提交按钮点击事件 | ||
| 320 | - async buttonClick() { | ||
| 321 | - if (this.btnStatus) { | ||
| 322 | - // 需要+手机号校验 | ||
| 323 | - if (this.password01.length < 6 || this.password01.length > 20) { | ||
| 324 | - this.showToastTip('密码不符合密码规范') | ||
| 325 | - return | ||
| 326 | - } | ||
| 327 | - if (this.password01 != this.password02) { | ||
| 328 | - this.showToastTip('两次输入的密码不一致,请重新输入') | ||
| 329 | - return | ||
| 330 | - } | ||
| 331 | - if(this.pageId == 1){ //设置密码 | ||
| 332 | - SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => { | ||
| 333 | - this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{ | ||
| 334 | - if (this.pageType == 0) {//登录页 | ||
| 335 | - this.showToastTip("修改成功") | ||
| 336 | - router.back({ | ||
| 337 | - url: `${WDRouterPage.getLoginBundleInfo()}` | ||
| 338 | - }) | ||
| 339 | - }else if(this.pageType == 1){//设置 | ||
| 340 | - let params: Params = { | ||
| 341 | - pageID: 'AccountAndSecurityLayout' | ||
| 342 | - } | ||
| 343 | - this.showToastTip("修改成功") | ||
| 344 | - router.back({ | ||
| 345 | - params:params, | ||
| 346 | - url: `${WDRouterPage.getSettingBundleInfo()}` | ||
| 347 | - }) | ||
| 348 | - // WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | ||
| 349 | - } | ||
| 350 | - })) | ||
| 351 | - .catch((err: string) => { | ||
| 352 | - this.showToastTip(err) | ||
| 353 | - }); | ||
| 354 | - }).catch((err: string) => { | ||
| 355 | - this.showToastTip(err) | ||
| 356 | - Logger.error(TAG, 'catch err:' + JSON.stringify(err)); | ||
| 357 | - }); | ||
| 358 | - } | ||
| 359 | - } | ||
| 360 | - | ||
| 361 | - | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | - // 输入框数据变动:输入数据处理 | ||
| 365 | - inputTextChange(text: string, tag: number) { | ||
| 366 | - if (tag == 10086) { | ||
| 367 | - this.password01 = text; | ||
| 368 | - } else if (tag == 10087) { | ||
| 369 | - this.password02 = text; | ||
| 370 | - } else { | ||
| 371 | - this.passwordOri = text; | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - if (this.password01) { | ||
| 375 | - if ((this.password01.length >= 6 && this.password01.length <= 20) && (this.password02.length >= 6 && this.password02.length <= 20)) { | ||
| 376 | - this.btnStatus = true; | ||
| 377 | - } else { | ||
| 378 | - this.btnStatus = false; | ||
| 379 | - } | ||
| 380 | - } | ||
| 381 | - } | ||
| 382 | - | ||
| 383 | - showToastTip(msg:string){ | ||
| 384 | - this.toastText = msg | ||
| 385 | - this.dialogToast.open() | ||
| 386 | - } | ||
| 387 | -} | ||
| 388 | - |
| 1 | -import { SettingPasswordLayout } from './SettingPasswordLayout'; | 1 | +import ArrayList from '@ohos.util.ArrayList'; |
| 2 | +import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; | ||
| 3 | +import router from '@ohos.router'; | ||
| 4 | +import { LoginViewModel } from './LoginViewModel'; | ||
| 5 | +import { CustomToast, DateTimeUtils, Logger, SPHelper, ToastUtils } from 'wdKit'; | ||
| 6 | +import { | ||
| 7 | + SpConstants | ||
| 8 | +} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' | ||
| 9 | +import data_preferences from '@ohos.data.preferences'; | ||
| 10 | +import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 11 | +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; | ||
| 12 | + | ||
| 13 | +const TAG = "SettingPasswordLayout" | ||
| 14 | + | ||
| 15 | +export interface SettingPasswordParams { | ||
| 16 | + pageID: string; | ||
| 17 | + phoneContent?: string; | ||
| 18 | + codeContent?: string; | ||
| 19 | + tempToken?:string; | ||
| 20 | + pageType?:number; //0、登录->忘记密码 1、设置->重置密码 | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +export default class AccoutPageDataModel { | ||
| 24 | + // 页面数据 | ||
| 25 | + compType: number // 0:标题 / 1:密码输入框 / 2:验证码输入框 / 3:desc描述 / 4:按钮 / 5:logo / 6:子标题 7:手机号输入框 7:空白 | ||
| 26 | + compLogo: string | ||
| 27 | + compTitle: string | ||
| 28 | + compSubTitle: string = ''; | ||
| 29 | + compDesc: string | ||
| 30 | + compButtonTitle: string | ||
| 31 | + inputPlacholder: string | ||
| 32 | + inputTag: number | ||
| 33 | + | ||
| 34 | + constructor(compType: number, compTitle: string, compLogo: string, compDesc: string, compButtonTitle: string, inputPlacholder: string, inputTag: number) { | ||
| 35 | + this.compType = compType | ||
| 36 | + this.compTitle = compTitle | ||
| 37 | + this.compLogo = compLogo | ||
| 38 | + this.compDesc = compDesc | ||
| 39 | + this.compButtonTitle = compButtonTitle | ||
| 40 | + this.inputPlacholder = inputPlacholder | ||
| 41 | + this.inputTag = inputTag | ||
| 42 | + } | ||
| 43 | +} | ||
| 2 | 44 | ||
| 3 | @Entry | 45 | @Entry |
| 4 | @Component | 46 | @Component |
| 5 | -struct SettingPasswordPage { | ||
| 6 | - @State message: string = 'Hello World' | 47 | +export struct SettingPasswordPage { |
| 48 | + @State listData: Array<AccoutPageDataModel> = new Array(); // 页面配置数据 | ||
| 49 | + @State btnStatus: boolean = false; | ||
| 50 | + pageId:number = 0; | ||
| 51 | + phoneContent:string = ''; | ||
| 52 | + codeContent:string = ''; | ||
| 53 | + tempToken:string = ''; | ||
| 54 | + | ||
| 55 | + password01: string = ''; | ||
| 56 | + password02: string = ''; | ||
| 57 | + passwordOri: string = ''; | ||
| 58 | + loginViewModel = new LoginViewModel() | ||
| 59 | + pageType?:number; //0、登录->忘记密码 1、设置->重置密码 | ||
| 60 | + | ||
| 61 | + @State toastText:string = "" | ||
| 62 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 63 | + builder: CustomToast({ | ||
| 64 | + msg: this.toastText, | ||
| 65 | + }), | ||
| 66 | + autoCancel: false, | ||
| 67 | + alignment: DialogAlignment.Center, | ||
| 68 | + customStyle: true, | ||
| 69 | + maskColor:"#00000000" | ||
| 70 | + }) | ||
| 71 | + | ||
| 72 | + pageShowResetTime:number = 0; | ||
| 73 | + pageHideResetTime:number = 0; | ||
| 74 | + pageShowSetTime:number = 0; | ||
| 75 | + pageHideSetTime:number = 0; | ||
| 76 | + | ||
| 77 | + onPageShow(): void { | ||
| 78 | + if (this.pageType === 0){//重置密码 | ||
| 79 | + this.pageShowResetTime = DateTimeUtils.getTimeStamp() | ||
| 80 | + }else{ | ||
| 81 | + this.pageShowSetTime = DateTimeUtils.getTimeStamp() | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + onPageHide(): void { | ||
| 86 | + if (this.pageType === 0){ | ||
| 87 | + this.pageHideResetTime = DateTimeUtils.getTimeStamp() | ||
| 88 | + }else{ | ||
| 89 | + this.pageHideSetTime = DateTimeUtils.getTimeStamp() | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + let duration = 0 | ||
| 93 | + if(this.pageType === 0){ | ||
| 94 | + duration = Math.floor((this.pageHideResetTime - this.pageShowResetTime)/1000) | ||
| 95 | + }else{ | ||
| 96 | + duration = Math.floor((this.pageHideSetTime - this.pageShowSetTime)/1000) | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + if(this.pageType === 0){ | ||
| 100 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Reset_Password,TrackConstants.PageName.Reset_Password,duration) | ||
| 101 | + }else{ | ||
| 102 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Setup_Passwd,TrackConstants.PageName.Setup_Passwd,duration) | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + aboutToAppear() { | ||
| 107 | + let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; | ||
| 108 | + this.pageId = parseInt(params.pageID); | ||
| 109 | + this.getPageListData(this.pageId) | ||
| 110 | + | ||
| 111 | + this.phoneContent = params.phoneContent!; | ||
| 112 | + this.codeContent = params.codeContent!; | ||
| 113 | + this.pageType = params.pageType; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + getPageListData(pageId:number) { | ||
| 117 | + switch (pageId) { | ||
| 118 | + case 0: | ||
| 119 | + break; | ||
| 120 | + case 1: | ||
| 121 | + // 设置密码 | ||
| 122 | + this.listData.push(new AccoutPageDataModel(0, '设置密码', '', '', '', '', 0)) | ||
| 123 | + this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '请输入密码', 10086)) | ||
| 124 | + this.listData.push(new AccoutPageDataModel(1, '', '', '', '', '再次输入密码', 10087)) | ||
| 125 | + this.listData.push(new AccoutPageDataModel(3, '', '', '提示:密码长度6~20位,使用大写字母、小写字母、数字、特殊字符中三种或三种以上', '', '', 0)) | ||
| 126 | + this.listData.push(new AccoutPageDataModel(4, '', '', '', '确认', '', 0)) | ||
| 127 | + break; | ||
| 128 | + case 2: | ||
| 129 | + break; | ||
| 130 | + case 3: | ||
| 131 | + break; | ||
| 132 | + case 4: | ||
| 133 | + break; | ||
| 134 | + } | ||
| 135 | + } | ||
| 7 | 136 | ||
| 8 | build() { | 137 | build() { |
| 138 | + Navigation() { | ||
| 139 | + this.settingList() //滑动区域 | ||
| 140 | + }.titleMode(NavigationTitleMode.Mini) | ||
| 141 | + .title('') | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + // 页面布局 | ||
| 145 | + @Builder settingList() { | ||
| 146 | + Column() { | ||
| 147 | + List() { | ||
| 148 | + ForEach(this.listData, (item: AccoutPageDataModel, index: number) => { | ||
| 149 | + ListItem() { | ||
| 150 | + if (item.compType == 0) { | ||
| 151 | + this.getTitleCell(item, HorizontalAlign.Start) | ||
| 152 | + } else if (item.compType == 1) { | ||
| 153 | + this.getPasswordCell(item) | ||
| 154 | + } else if (item.compType == 2) { | ||
| 155 | + this.getCodeCell(item) | ||
| 156 | + } else if (item.compType == 3) { | ||
| 157 | + if (index == this.listData.length - 1) { | ||
| 158 | + this.getDescCell(item, HorizontalAlign.Center) | ||
| 159 | + } else { | ||
| 160 | + this.getDescCell(item, HorizontalAlign.Start) | ||
| 161 | + } | ||
| 162 | + } else if (item.compType == 4) { | ||
| 163 | + this.getButtonCell(item) | ||
| 164 | + } else if (item.compType == 5) { | ||
| 165 | + this.getLogoCell(item) | ||
| 166 | + } else if (item.compType == 7) { | ||
| 167 | + this.getPhoneCell(item) | ||
| 168 | + } else { | ||
| 169 | + Text('' + item.compType) | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + }) | ||
| 173 | + } | ||
| 174 | + }.width('100%') | ||
| 175 | + .padding('30lpx') | ||
| 176 | + .height('100%') | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + /***************************** UI元素 ******************************************/ | ||
| 180 | + | ||
| 181 | + // 标题 | ||
| 182 | + @Builder getTitleCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 183 | + Column() { | ||
| 184 | + Text(item.compTitle).fontWeight(FontWeight.Bold).fontSize(20).maxLines(1) | ||
| 185 | + } | ||
| 186 | + .width('100%') | ||
| 187 | + .height('75lpx') | ||
| 188 | + .alignItems(alignTitle) | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + // 密码输入框 | ||
| 192 | + @Builder getPasswordCell(item: AccoutPageDataModel) { | ||
| 9 | Row() { | 193 | Row() { |
| 10 | - Column() { | ||
| 11 | - SettingPasswordLayout() | 194 | + Row() { |
| 195 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 196 | + .placeholderColor("#CCCCCC") | ||
| 197 | + .passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")}) | ||
| 198 | + .type(InputType.Password) | ||
| 199 | + .showPasswordIcon(true) | ||
| 200 | + .backgroundColor('#00000000') | ||
| 201 | + .onChange((value: string) => { | ||
| 202 | + this.inputTextChange(value, item.inputTag) | ||
| 203 | + }) | ||
| 204 | + .onSubmit((EnterKeyType) => { | ||
| 205 | + this.showToastTip('submit') | ||
| 206 | + }) | ||
| 12 | } | 207 | } |
| 13 | - .width('100%') | 208 | + .alignItems(VerticalAlign.Center) |
| 209 | + .height('80lpx') | ||
| 210 | + .backgroundColor('#f5f5f5') | ||
| 211 | + .borderRadius('4vp') | ||
| 14 | } | 212 | } |
| 15 | - .height('100%') | 213 | + .width('100%') |
| 214 | + .height('110lpx') | ||
| 215 | + .backgroundColor(0xffffff0) | ||
| 216 | + .alignItems(VerticalAlign.Center) | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + // 手机号输入框 | ||
| 220 | + @Builder getPhoneCell(item: AccoutPageDataModel) { | ||
| 221 | + Row() { | ||
| 222 | + Row() { | ||
| 223 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 224 | + .placeholderColor("#CCCCCC") | ||
| 225 | + .backgroundColor('#00000000') | ||
| 226 | + .onChange((value: string) => { | ||
| 227 | + this.inputTextChange(value, item.inputTag) | ||
| 228 | + }) | ||
| 229 | + .onSubmit((EnterKeyType) => { | ||
| 230 | + this.showToastTip('submit') | ||
| 231 | + }) | ||
| 232 | + } | ||
| 233 | + .alignItems(VerticalAlign.Center) | ||
| 234 | + .height('80lpx') | ||
| 235 | + .backgroundColor('#f5f5f5') | ||
| 236 | + .borderRadius('4vp') | ||
| 237 | + } | ||
| 238 | + .width('100%') | ||
| 239 | + .height('110lpx') | ||
| 240 | + .backgroundColor(0xffffff0) | ||
| 241 | + .alignItems(VerticalAlign.Center) | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + // 验证码码输入框 | ||
| 245 | + @Builder getCodeCell(item: AccoutPageDataModel) { | ||
| 246 | + Row() { | ||
| 247 | + Stack() { | ||
| 248 | + Image($r('app.media.get_code_bg')).width('100%').borderRadius('4vp') | ||
| 249 | + Row() { | ||
| 250 | + TextInput({ placeholder: item.inputPlacholder }) | ||
| 251 | + .placeholderColor("#CCCCCC") | ||
| 252 | + .backgroundColor('#00000000') | ||
| 253 | + .width('67.28%') | ||
| 254 | + .onChange((value: string) => { | ||
| 255 | + this.inputTextChange(value, item.inputTag) | ||
| 256 | + }) | ||
| 257 | + Button('发送验证码') | ||
| 258 | + .width('32.71%') | ||
| 259 | + .backgroundColor('#00000000') | ||
| 260 | + .fontColor('#da3e22') | ||
| 261 | + } | ||
| 262 | + .width('100%') | ||
| 263 | + }.height('80lpx') | ||
| 264 | + } | ||
| 265 | + .width('100%') | ||
| 266 | + .height('110lpx') | ||
| 267 | + .backgroundColor(0xffffff0) | ||
| 268 | + .alignItems(VerticalAlign.Center) | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + // desc | ||
| 272 | + @Builder getDescCell(item: AccoutPageDataModel, alignTitle: HorizontalAlign) { | ||
| 273 | + Column() { | ||
| 274 | + Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) | ||
| 275 | + .onClick(()=>{ | ||
| 276 | + if (item.compDesc == '忘记密码') { | ||
| 277 | + this.showToastTip('密码不符合密码规范') | ||
| 278 | + } | ||
| 279 | + }) | ||
| 280 | + } | ||
| 281 | + .width('100%') | ||
| 282 | + .height('85lpx') | ||
| 283 | + .alignItems(alignTitle) | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + // 按钮 | ||
| 287 | + @Builder getButtonCell(item: AccoutPageDataModel) { | ||
| 288 | + Row() { | ||
| 289 | + Button(item.compButtonTitle, { type: ButtonType.Normal, stateEffect: true }) | ||
| 290 | + .width('100%') | ||
| 291 | + .height('80lpx') | ||
| 292 | + .backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d') | ||
| 293 | + .fontColor('#fff') | ||
| 294 | + .borderRadius('4vp') | ||
| 295 | + .onClick(() => { | ||
| 296 | + this.buttonClick() | ||
| 297 | + }) | ||
| 298 | + } | ||
| 299 | + .padding({top:'25lpx'}) | ||
| 300 | + .alignItems(VerticalAlign.Center) | ||
| 301 | + .width('100%') | ||
| 302 | + .height('120lpx') | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + // 标题 | ||
| 306 | + @Builder getLogoCell(item: AccoutPageDataModel) { | ||
| 307 | + Column() { | ||
| 308 | + Image(item.compLogo).height('150lpx').width('150lpx') | ||
| 309 | + } | ||
| 310 | + .width('100%') | ||
| 311 | + .height('200lpx') | ||
| 16 | } | 312 | } |
| 17 | -} | ||
| 313 | + | ||
| 314 | + /***************************** 事件处理 ******************************************/ | ||
| 315 | + // 提交按钮点击事件 | ||
| 316 | + async buttonClick() { | ||
| 317 | + if (this.btnStatus) { | ||
| 318 | + if(this.pageType === 0){ | ||
| 319 | + TrackingButton.click("resetPasswordPageConfirmButton",TrackConstants.PageName.Reset_Password,TrackConstants.PageName.Reset_Password) | ||
| 320 | + }else{ | ||
| 321 | + TrackingButton.click("setPasswordPageConfirm",TrackConstants.PageName.Setup_Passwd,TrackConstants.PageName.Setup_Passwd) | ||
| 322 | + } | ||
| 323 | + // 需要+手机号校验 | ||
| 324 | + if (this.password01.length < 6 || this.password01.length > 20) { | ||
| 325 | + this.showToastTip('密码不符合密码规范') | ||
| 326 | + return | ||
| 327 | + } | ||
| 328 | + if (this.password01 != this.password02) { | ||
| 329 | + this.showToastTip('两次输入的密码不一致,请重新输入') | ||
| 330 | + return | ||
| 331 | + } | ||
| 332 | + if(this.pageId == 1){ //设置密码 | ||
| 333 | + SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => { | ||
| 334 | + this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{ | ||
| 335 | + if (this.pageType == 0) {//登录页 | ||
| 336 | + this.showToastTip("修改成功") | ||
| 337 | + router.back({ | ||
| 338 | + url: `${WDRouterPage.getLoginBundleInfo()}` | ||
| 339 | + }) | ||
| 340 | + }else if(this.pageType == 1){//设置 | ||
| 341 | + let params: Params = { | ||
| 342 | + pageID: 'AccountAndSecurityLayout' | ||
| 343 | + } | ||
| 344 | + this.showToastTip("修改成功") | ||
| 345 | + router.back({ | ||
| 346 | + params:params, | ||
| 347 | + url: `${WDRouterPage.getSettingBundleInfo()}` | ||
| 348 | + }) | ||
| 349 | + } | ||
| 350 | + })) | ||
| 351 | + .catch((err: string) => { | ||
| 352 | + this.showToastTip(err) | ||
| 353 | + }); | ||
| 354 | + }).catch((err: string) => { | ||
| 355 | + this.showToastTip(err) | ||
| 356 | + Logger.error(TAG, 'catch err:' + JSON.stringify(err)); | ||
| 357 | + }); | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + // 输入框数据变动:输入数据处理 | ||
| 365 | + inputTextChange(text: string, tag: number) { | ||
| 366 | + if (tag == 10086) { | ||
| 367 | + this.password01 = text; | ||
| 368 | + } else if (tag == 10087) { | ||
| 369 | + this.password02 = text; | ||
| 370 | + } else { | ||
| 371 | + this.passwordOri = text; | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + if (this.password01) { | ||
| 375 | + if ((this.password01.length >= 6 && this.password01.length <= 20) && (this.password02.length >= 6 && this.password02.length <= 20)) { | ||
| 376 | + this.btnStatus = true; | ||
| 377 | + } else { | ||
| 378 | + this.btnStatus = false; | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + showToastTip(msg:string){ | ||
| 384 | + this.toastText = msg | ||
| 385 | + this.dialogToast.open() | ||
| 386 | + } | ||
| 387 | +} | ||
| 388 | + |
| 1 | import { CustomToast, DateTimeUtils, Logger, SPHelper } from 'wdKit/Index' | 1 | import { CustomToast, DateTimeUtils, Logger, SPHelper } from 'wdKit/Index' |
| 2 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 2 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 3 | import { LoginViewModel } from './LoginViewModel' | 3 | import { LoginViewModel } from './LoginViewModel' |
| 4 | -import { SettingPasswordParams } from './SettingPasswordLayout' | 4 | +import { SettingPasswordParams } from './SettingPasswordPage' |
| 5 | import { router } from '@kit.ArkUI' | 5 | import { router } from '@kit.ArkUI' |
| 6 | import { SpConstants } from 'wdConstant/Index' | 6 | import { SpConstants } from 'wdConstant/Index' |
| 7 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index' | 7 | import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index' |
| @@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
| 5 | "pages/login/ForgetPasswordPage", | 5 | "pages/login/ForgetPasswordPage", |
| 6 | "pages/login/LoginProtocolWebview", | 6 | "pages/login/LoginProtocolWebview", |
| 7 | "pages/login/SettingPasswordPage", | 7 | "pages/login/SettingPasswordPage", |
| 8 | - "pages/login/SettingPasswordLayout", | ||
| 9 | "pages/guide/GuidePages", | 8 | "pages/guide/GuidePages", |
| 10 | "pages/login/OneKeyLoginPage", | 9 | "pages/login/OneKeyLoginPage", |
| 11 | "pages/login/ModifyPasswordPage", | 10 | "pages/login/ModifyPasswordPage", |
-
Please register or login to post a comment