yangchenggong1_wd

fix:bug[16831] 登录注册模块,提示蒙层样式和位置,和android 不一致,看图

bug[16789] 验证码登录,频繁点击获取验证码, 提示文案未居中,看图
... ... @@ -49,3 +49,5 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil'
export { NetworkManager } from './src/main/ets/network/NetworkManager'
export { NetworkType } from './src/main/ets/network/NetworkType'
export { CustomToast } from './src/main/ets/reusable/CustomToast'
... ...
@CustomDialog
export struct CustomToast {
public static LENGTH_LONG = 5000;
public static LENGTH_SHORT = 3000;
@State msg: string = ""
@State duration: number = CustomToast.LENGTH_SHORT
@State bgBorderRadius: number = 10
controller: CustomDialogController
dismiss: () => void = () => {
}
aboutToAppear(): void {
let intervalID = setInterval(() => {
if (this.controller != undefined) {
this.controller.close()
this.dismiss()
clearInterval(intervalID);
}
}, this.duration);
}
build() {
Row() {
Text(this.msg)
.fontWeight(FontWeight.Regular)
.fontColor($r('app.color.white'))
.fontSize("27lpx")
.lineHeight("38lpx")
}.borderRadius(`${this.bgBorderRadius}lpx`)
.padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
.backgroundColor($r("app.color.black"))
.opacity(0.7)
}
}
... ...
... ... @@ -3,6 +3,10 @@
{
"name": "white",
"value": "#FFFFFF"
},
{
"name": "black",
"value": "#000000"
}
]
}
\ No newline at end of file
... ...
... ... @@ -2,11 +2,10 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger'
import { LoginInputComponent } from './LoginInputComponent'
import { LoginViewModel } from './LoginViewModel'
import router from '@ohos.router'
import promptAction from '@ohos.promptAction'
import { WDRouterRule, WDRouterPage } from 'wdRouter';
import { SettingPasswordParams } from './SettingPasswordLayout'
import { Router } from '@ohos.arkui.UIContext'
import { EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
import { CustomToast, EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
import { SpConstants } from 'wdConstant/Index'
import { emitter } from '@kit.BasicServicesKit'
... ... @@ -31,6 +30,18 @@ struct ForgetPasswordPage {
this.sendVerifyCode()
}
}
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
... ... @@ -100,11 +111,11 @@ struct ForgetPasswordPage {
if(this.pageType == 1){
this.loginViewModel.sendVerifyCodeByToken().then(()=>{
promptAction.showToast({ message: "已发送" })
this.showToastTip("已发送")
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message: string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
})
... ... @@ -112,12 +123,12 @@ struct ForgetPasswordPage {
}
this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
promptAction.showToast({ message: "已发送" })
this.showToastTip("已发送")
this.codeStateSuccess=true
this.isCodeSend=false
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
}).catch((message: string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
})
... ... @@ -146,7 +157,7 @@ struct ForgetPasswordPage {
}
WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
}).catch((message: string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
})
return
}
... ... @@ -159,10 +170,10 @@ struct ForgetPasswordPage {
}
WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params)
promptAction.showToast({message:"校验成功,准备跳转设置页面"})
this.showToastTip("校验成功,准备跳转设置页面")
Logger.debug(TAG,"校验成功")
}).catch((error:string)=>{
promptAction.showToast({message:error})
this.showToastTip(error)
Logger.debug(TAG,"校验失败")
})
}
... ... @@ -217,4 +228,9 @@ struct ForgetPasswordPage {
// 发送eventId为1的事件,事件内容为eventData
emitter.emit(event, eventData);
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
}
\ No newline at end of file
... ...
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils } from 'wdKit'
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast } from 'wdKit'
import { CustomProtocolDialog } from './CustomProtocolDialog'
import router from '@ohos.router'
import { LoginViewModel } from './LoginViewModel'
import { LoginInputComponent } from './LoginInputComponent'
import promptAction from '@ohos.promptAction'
import { ErrorToastUtils, SPHelper } from 'wdKit'
import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
... ... @@ -47,6 +46,18 @@ struct LoginPage {
// @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录
lastTime: number = 0
@State codeStateSuccess:boolean=false
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomProtocolDialog({
... ... @@ -316,12 +327,12 @@ struct LoginPage {
//发送验证码
sendVerifyCode() {
this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
promptAction.showToast({ message: "已发送" })
this.showToastTip("已发送")
Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
this.codeStateSuccess=true
this.isCodeSend=false
}).catch((message:string)=>{
promptAction.showToast({ message: message })
this.showToastTip(message)
this.codeStateSuccess=false
this.isCodeSend=false
Logger.debug(TAG, "sendVerifyCode: " + message)
... ... @@ -339,12 +350,13 @@ struct LoginPage {
this.queryUserDetail()
EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
}).catch((error:string)=>{
promptAction.showToast({ message: error })
this.showToastTip(error)
})
} else {
this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
promptAction.showToast({ message: '登录成功' })
this.showToastTip('登录成功')
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
... ... @@ -357,12 +369,17 @@ struct LoginPage {
// url: `${WDRouterPage.getBundleInfo()}`
// })
}).catch((value: string) => {
promptAction.showToast({ message: value })
this.showToastTip(value)
})
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
queryUserDetail(){
this.loginViewModel.queryUserDetail().then(()=>{
router.back({
... ...
import ArrayList from '@ohos.util.ArrayList';
import promptAction from '@ohos.promptAction';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
import router from '@ohos.router';
import { LoginViewModel } from './LoginViewModel';
import { Logger, SPHelper, ToastUtils } from 'wdKit';
import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit';
import {
SpConstants
} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
... ... @@ -58,6 +57,19 @@ export struct SettingPasswordLayout {
loginViewModel = new LoginViewModel()
pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机
@State toastText:string = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
offset: { dx: 0, dy: -20 },
gridCount: 1,
customStyle: true,
maskColor:"#00000000"
})
aboutToAppear() {
let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
this.pageId = parseInt(params.pageID);
... ... @@ -194,7 +206,7 @@ export struct SettingPasswordLayout {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
promptAction.showToast({ message: 'submit' })
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
... ... @@ -218,7 +230,7 @@ export struct SettingPasswordLayout {
this.inputTextChange(value, item.inputTag)
})
.onSubmit((EnterKeyType) => {
promptAction.showToast({ message: 'submit' })
this.showToastTip('submit')
})
}
.alignItems(VerticalAlign.Center)
... ... @@ -264,7 +276,7 @@ export struct SettingPasswordLayout {
Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
.onClick(()=>{
if (item.compDesc == '忘记密码') {
promptAction.showToast({ message: '密码不符合密码规范' })
this.showToastTip('密码不符合密码规范')
}
})
}
... ... @@ -307,11 +319,11 @@ export struct SettingPasswordLayout {
if (this.btnStatus) {
// 需要+手机号校验
if (this.password01.length < 6 || this.password01.length > 20) {
promptAction.showToast({ message: '密码不符合密码规范' })
this.showToastTip('密码不符合密码规范')
return
}
if (this.password01 != this.password02) {
promptAction.showToast({ message: '密码不一致' })
this.showToastTip('密码不一致')
return
}
if(this.pageId == 1){ //设置密码
... ... @@ -339,7 +351,6 @@ export struct SettingPasswordLayout {
Logger.error(TAG, 'catch err:' + JSON.stringify(err));
});
}
// promptAction.showToast({ message: '请求接口' })
}
... ... @@ -363,5 +374,10 @@ export struct SettingPasswordLayout {
}
}
}
showToastTip(msg:string){
this.toastText = msg
this.dialogToast.open()
}
}
... ...