zhenghy

Merge remote-tracking branch 'origin/main'

... ... @@ -155,9 +155,15 @@ function buildErrorMsg(httpStatus: number): string {
case HttpStatusCode.HttpVersionNotSupported:
message = "HTTP版本不受支持(505)";
break;
default:
default:{
// 网络连接故障
if(httpStatus != undefined){
message = `连接出错(${httpStatus})!`;
}else{
message = `连接出错!`;
}
}
}
return message;
}
... ...
... ... @@ -5,7 +5,7 @@ import router from '@ohos.router'
import { WDRouterRule, WDRouterPage } from 'wdRouter';
import { SettingPasswordParams } from './SettingPasswordLayout'
import { Router } from '@ohos.arkui.UIContext'
import { CustomToast, EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
import { CustomToast, EmitterEventId, EmitterUtils, NetworkUtil, SPHelper, ToastUtils } from 'wdKit/Index'
import { SpConstants } from 'wdConstant/Index'
import { emitter } from '@kit.BasicServicesKit'
... ... @@ -128,7 +128,12 @@ struct ForgetPasswordPage {
this.isCodeSend=false
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
}).catch((message: string)=>{
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.showToastTip(message)
} else {
this.showToastTip("验证码获取失败,请重新尝试")
}
this.codeStateSuccess=false
this.isCodeSend=false
})
... ...
... ... @@ -13,12 +13,25 @@ export struct LoginInputComponent {
pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机号页面1 3、设置->更换手机号页面2
lastTime: number = 0
@Link @Watch('startCount') codeStateSuccess: boolean //验证码获取成功与否回调 成功显示倒计时
@Watch('onCheckChange') @Prop protocolState: boolean = false //协议勾选状态
@State isNeedProtocol:boolean = false
build() {
Column() {
this.addCodeLayout()
}.width('100%').padding({ left: 25, right: 25 })
}
onCheckChange(){
if(this.isNeedProtocol){
if(this.protocolState && this.phoneContent.length >= 11){
this.codeBtnState = true
}else{
this.codeBtnState = false
}
}
}
async aboutToAppear(){
if (this.pageType == 1) {
this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
... ... @@ -27,7 +40,7 @@ export struct LoginInputComponent {
@Builder
addCodeLayout() {
if (this.pageType == 1){
TextInput({ placeholder: this.securityPhone(this.phoneContent) })
TextInput({ text: this.securityPhone(this.phoneContent) })
.placeholderColor("#CCCCCC")
.fontSize(16)
.height(48)
... ... @@ -59,11 +72,20 @@ export struct LoginInputComponent {
.onChange((content) => {
this.phoneContent = content
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 4)
if (content.length >= 11) {
if(this.isNeedProtocol){
if (content.length >= 11 && this.protocolState) {
this.codeBtnState = true
} else {
this.codeBtnState = false
}
}else{
if (content.length >= 11 ) {
this.codeBtnState = true
} else {
this.codeBtnState = false
}
}
})
}
... ... @@ -97,6 +119,12 @@ export struct LoginInputComponent {
if (this.phoneContent.length < 11) {
return
}
if(this.isNeedProtocol){
if (!this.protocolState ) {
return
}
}
let currentTime = DateTimeUtils.getTimeStamp()
if (currentTime - this.lastTime < 500) {
return
... ...
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils } from 'wdKit'
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil } from 'wdKit'
import { CustomProtocolDialog } from './CustomProtocolDialog'
import router from '@ohos.router'
import { LoginViewModel } from './LoginViewModel'
... ... @@ -106,7 +106,9 @@ struct LoginPage {
codeContent: $codeContent,
isSubmit: $isSubmit,
isCodeSend: $isCodeSend,
codeStateSuccess:$codeStateSuccess
codeStateSuccess:$codeStateSuccess,
protocolState:this.protocolState,
isNeedProtocol:true
})
} else {
this.addPassword()
... ... @@ -347,7 +349,12 @@ struct LoginPage {
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message:string)=>{
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.showToastTip(message)
} else {
this.showToastTip("验证码获取失败,请重新尝试")
}
this.codeStateSuccess=false
this.isCodeSend=false
Logger.debug(TAG, "sendVerifyCode: " + message)
... ...