Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yangchenggong1_wd
2024-05-08 14:34:46 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eeb9d63e9c9a4b638f938a5015c62e84afb09380
eeb9d63e
1 parent
82128e67
fix:bug[16960] 断网,进入登录页,输入手机号码,提示连接出错((undefined),预期发送验证码按钮置灰
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
6 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/AxiosRequest.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/ForgetPasswordPage.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginInputComponent.ets
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/AxiosRequest.ets
View file @
eeb9d63
...
...
@@ -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;
}
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/ForgetPasswordPage.ets
View file @
eeb9d63
...
...
@@ -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
})
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginInputComponent.ets
View file @
eeb9d63
...
...
@@ -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
...
...
sight_harmony/features/wdLogin/src/main/ets/pages/login/LoginPage.ets
View file @
eeb9d63
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)
...
...
Please
register
or
login
to post a comment