yangchenggong1_wd

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

bug[16789] 验证码登录,频繁点击获取验证码, 提示文案未居中,看图
@@ -49,3 +49,5 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil' @@ -49,3 +49,5 @@ export { NetworkUtil } from './src/main/ets/utils/NetworkUtil'
49 export { NetworkManager } from './src/main/ets/network/NetworkManager' 49 export { NetworkManager } from './src/main/ets/network/NetworkManager'
50 50
51 export { NetworkType } from './src/main/ets/network/NetworkType' 51 export { NetworkType } from './src/main/ets/network/NetworkType'
  52 +
  53 +export { CustomToast } from './src/main/ets/reusable/CustomToast'
  1 +@CustomDialog
  2 +export struct CustomToast {
  3 + public static LENGTH_LONG = 5000;
  4 + public static LENGTH_SHORT = 3000;
  5 +
  6 + @State msg: string = ""
  7 + @State duration: number = CustomToast.LENGTH_SHORT
  8 + @State bgBorderRadius: number = 10
  9 +
  10 + controller: CustomDialogController
  11 +
  12 + dismiss: () => void = () => {
  13 + }
  14 +
  15 + aboutToAppear(): void {
  16 + let intervalID = setInterval(() => {
  17 + if (this.controller != undefined) {
  18 + this.controller.close()
  19 + this.dismiss()
  20 + clearInterval(intervalID);
  21 + }
  22 + }, this.duration);
  23 + }
  24 +
  25 + build() {
  26 + Row() {
  27 + Text(this.msg)
  28 + .fontWeight(FontWeight.Regular)
  29 + .fontColor($r('app.color.white'))
  30 + .fontSize("27lpx")
  31 + .lineHeight("38lpx")
  32 + }.borderRadius(`${this.bgBorderRadius}lpx`)
  33 + .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
  34 + .backgroundColor($r("app.color.black"))
  35 + .opacity(0.7)
  36 + }
  37 +}
@@ -3,6 +3,10 @@ @@ -3,6 +3,10 @@
3 { 3 {
4 "name": "white", 4 "name": "white",
5 "value": "#FFFFFF" 5 "value": "#FFFFFF"
  6 + },
  7 + {
  8 + "name": "black",
  9 + "value": "#000000"
6 } 10 }
7 ] 11 ]
8 } 12 }
@@ -2,11 +2,10 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger' @@ -2,11 +2,10 @@ import { Logger } from 'wdKit/src/main/ets/utils/Logger'
2 import { LoginInputComponent } from './LoginInputComponent' 2 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 promptAction from '@ohos.promptAction'  
6 import { WDRouterRule, WDRouterPage } from 'wdRouter'; 5 import { WDRouterRule, WDRouterPage } from 'wdRouter';
7 import { SettingPasswordParams } from './SettingPasswordLayout' 6 import { SettingPasswordParams } from './SettingPasswordLayout'
8 import { Router } from '@ohos.arkui.UIContext' 7 import { Router } from '@ohos.arkui.UIContext'
9 -import { EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index' 8 +import { CustomToast, EmitterEventId, EmitterUtils, SPHelper, ToastUtils } from 'wdKit/Index'
10 import { SpConstants } from 'wdConstant/Index' 9 import { SpConstants } from 'wdConstant/Index'
11 import { emitter } from '@kit.BasicServicesKit' 10 import { emitter } from '@kit.BasicServicesKit'
12 11
@@ -31,6 +30,18 @@ struct ForgetPasswordPage { @@ -31,6 +30,18 @@ struct ForgetPasswordPage {
31 this.sendVerifyCode() 30 this.sendVerifyCode()
32 } 31 }
33 } 32 }
  33 + @State toastText:string = ""
  34 + dialogToast: CustomDialogController = new CustomDialogController({
  35 + builder: CustomToast({
  36 + msg: this.toastText,
  37 + }),
  38 + autoCancel: false,
  39 + alignment: DialogAlignment.Center,
  40 + offset: { dx: 0, dy: -20 },
  41 + gridCount: 1,
  42 + customStyle: true,
  43 + maskColor:"#00000000"
  44 + })
34 45
35 46
36 47
@@ -100,11 +111,11 @@ struct ForgetPasswordPage { @@ -100,11 +111,11 @@ struct ForgetPasswordPage {
100 111
101 if(this.pageType == 1){ 112 if(this.pageType == 1){
102 this.loginViewModel.sendVerifyCodeByToken().then(()=>{ 113 this.loginViewModel.sendVerifyCodeByToken().then(()=>{
103 - promptAction.showToast({ message: "已发送" }) 114 + this.showToastTip("已发送")
104 this.codeStateSuccess=true 115 this.codeStateSuccess=true
105 this.isCodeSend=false 116 this.isCodeSend=false
106 }).catch((message: string)=>{ 117 }).catch((message: string)=>{
107 - promptAction.showToast({ message: message }) 118 + this.showToastTip(message)
108 this.codeStateSuccess=false 119 this.codeStateSuccess=false
109 this.isCodeSend=false 120 this.isCodeSend=false
110 }) 121 })
@@ -112,12 +123,12 @@ struct ForgetPasswordPage { @@ -112,12 +123,12 @@ struct ForgetPasswordPage {
112 } 123 }
113 124
114 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { 125 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
115 - promptAction.showToast({ message: "已发送" }) 126 + this.showToastTip("已发送")
116 this.codeStateSuccess=true 127 this.codeStateSuccess=true
117 this.isCodeSend=false 128 this.isCodeSend=false
118 Logger.debug(TAG, "sendVerifyCode: " + verifyCode) 129 Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
119 }).catch((message: string)=>{ 130 }).catch((message: string)=>{
120 - promptAction.showToast({ message: message }) 131 + this.showToastTip(message)
121 this.codeStateSuccess=false 132 this.codeStateSuccess=false
122 this.isCodeSend=false 133 this.isCodeSend=false
123 }) 134 })
@@ -146,7 +157,7 @@ struct ForgetPasswordPage { @@ -146,7 +157,7 @@ struct ForgetPasswordPage {
146 } 157 }
147 WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params) 158 WDRouterRule.jumpWithPage(WDRouterPage.settingPasswordPage, params)
148 }).catch((message: string)=>{ 159 }).catch((message: string)=>{
149 - promptAction.showToast({ message: message }) 160 + this.showToastTip(message)
150 }) 161 })
151 return 162 return
152 } 163 }
@@ -159,10 +170,10 @@ struct ForgetPasswordPage { @@ -159,10 +170,10 @@ struct ForgetPasswordPage {
159 } 170 }
160 WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params) 171 WDRouterRule.jumpWithReplacePage(WDRouterPage.settingPasswordPage, params)
161 172
162 - promptAction.showToast({message:"校验成功,准备跳转设置页面"}) 173 + this.showToastTip("校验成功,准备跳转设置页面")
163 Logger.debug(TAG,"校验成功") 174 Logger.debug(TAG,"校验成功")
164 }).catch((error:string)=>{ 175 }).catch((error:string)=>{
165 - promptAction.showToast({message:error}) 176 + this.showToastTip(error)
166 Logger.debug(TAG,"校验失败") 177 Logger.debug(TAG,"校验失败")
167 }) 178 })
168 } 179 }
@@ -217,4 +228,9 @@ struct ForgetPasswordPage { @@ -217,4 +228,9 @@ struct ForgetPasswordPage {
217 // 发送eventId为1的事件,事件内容为eventData 228 // 发送eventId为1的事件,事件内容为eventData
218 emitter.emit(event, eventData); 229 emitter.emit(event, eventData);
219 } 230 }
  231 +
  232 + showToastTip(msg:string){
  233 + this.toastText = msg
  234 + this.dialogToast.open()
  235 + }
220 } 236 }
1 -import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils } from 'wdKit' 1 +import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast } from 'wdKit'
2 import { CustomProtocolDialog } from './CustomProtocolDialog' 2 import { CustomProtocolDialog } from './CustomProtocolDialog'
3 import router from '@ohos.router' 3 import router from '@ohos.router'
4 import { LoginViewModel } from './LoginViewModel' 4 import { LoginViewModel } from './LoginViewModel'
5 import { LoginInputComponent } from './LoginInputComponent' 5 import { LoginInputComponent } from './LoginInputComponent'
6 -import promptAction from '@ohos.promptAction'  
7 import { ErrorToastUtils, SPHelper } from 'wdKit' 6 import { ErrorToastUtils, SPHelper } from 'wdKit'
8 import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'; 7 import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
9 import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'; 8 import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
@@ -47,6 +46,18 @@ struct LoginPage { @@ -47,6 +46,18 @@ struct LoginPage {
47 // @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录 46 // @State isPasswordSubmit: boolean = false //账户密码状态 是否出发登录
48 lastTime: number = 0 47 lastTime: number = 0
49 @State codeStateSuccess:boolean=false 48 @State codeStateSuccess:boolean=false
  49 + @State toastText:string = ""
  50 + dialogToast: CustomDialogController = new CustomDialogController({
  51 + builder: CustomToast({
  52 + msg: this.toastText,
  53 + }),
  54 + autoCancel: false,
  55 + alignment: DialogAlignment.Center,
  56 + offset: { dx: 0, dy: -20 },
  57 + gridCount: 1,
  58 + customStyle: true,
  59 + maskColor:"#00000000"
  60 + })
50 61
51 dialogController: CustomDialogController = new CustomDialogController({ 62 dialogController: CustomDialogController = new CustomDialogController({
52 builder: CustomProtocolDialog({ 63 builder: CustomProtocolDialog({
@@ -316,12 +327,12 @@ struct LoginPage { @@ -316,12 +327,12 @@ struct LoginPage {
316 //发送验证码 327 //发送验证码
317 sendVerifyCode() { 328 sendVerifyCode() {
318 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => { 329 this.loginViewModel.sendVerifyCode(this.phoneContent).then((verifyCode) => {
319 - promptAction.showToast({ message: "已发送" }) 330 + this.showToastTip("已发送")
320 Logger.debug(TAG, "sendVerifyCode: " + verifyCode) 331 Logger.debug(TAG, "sendVerifyCode: " + verifyCode)
321 this.codeStateSuccess=true 332 this.codeStateSuccess=true
322 this.isCodeSend=false 333 this.isCodeSend=false
323 }).catch((message:string)=>{ 334 }).catch((message:string)=>{
324 - promptAction.showToast({ message: message }) 335 + this.showToastTip(message)
325 this.codeStateSuccess=false 336 this.codeStateSuccess=false
326 this.isCodeSend=false 337 this.isCodeSend=false
327 Logger.debug(TAG, "sendVerifyCode: " + message) 338 Logger.debug(TAG, "sendVerifyCode: " + message)
@@ -339,12 +350,13 @@ struct LoginPage { @@ -339,12 +350,13 @@ struct LoginPage {
339 this.queryUserDetail() 350 this.queryUserDetail()
340 EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) 351 EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION)
341 }).catch((error:string)=>{ 352 }).catch((error:string)=>{
342 - promptAction.showToast({ message: error }) 353 + this.showToastTip(error)
343 }) 354 })
344 } else { 355 } else {
345 this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => { 356 this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
346 Logger.debug(TAG, "requestLogin: " + data.jwtToken) 357 Logger.debug(TAG, "requestLogin: " + data.jwtToken)
347 - promptAction.showToast({ message: '登录成功' }) 358 + this.showToastTip('登录成功')
  359 +
348 ///同步兴趣tag 360 ///同步兴趣tag
349 let interestsModel = new InterestsHobbiesModel() 361 let interestsModel = new InterestsHobbiesModel()
350 interestsModel.updateInterests() 362 interestsModel.updateInterests()
@@ -357,12 +369,17 @@ struct LoginPage { @@ -357,12 +369,17 @@ struct LoginPage {
357 // url: `${WDRouterPage.getBundleInfo()}` 369 // url: `${WDRouterPage.getBundleInfo()}`
358 // }) 370 // })
359 }).catch((value: string) => { 371 }).catch((value: string) => {
360 - promptAction.showToast({ message: value }) 372 + this.showToastTip(value)
361 }) 373 })
362 } 374 }
363 375
364 } 376 }
365 377
  378 + showToastTip(msg:string){
  379 + this.toastText = msg
  380 + this.dialogToast.open()
  381 + }
  382 +
366 queryUserDetail(){ 383 queryUserDetail(){
367 this.loginViewModel.queryUserDetail().then(()=>{ 384 this.loginViewModel.queryUserDetail().then(()=>{
368 router.back({ 385 router.back({
@@ -490,4 +507,4 @@ struct ProtocolComponent { @@ -490,4 +507,4 @@ struct ProtocolComponent {
490 .backgroundColor('#66000000') 507 .backgroundColor('#66000000')
491 508
492 } 509 }
493 -}  
  510 +}
1 import ArrayList from '@ohos.util.ArrayList'; 1 import ArrayList from '@ohos.util.ArrayList';
2 -import promptAction from '@ohos.promptAction';  
3 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; 2 import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index';
4 import router from '@ohos.router'; 3 import router from '@ohos.router';
5 import { LoginViewModel } from './LoginViewModel'; 4 import { LoginViewModel } from './LoginViewModel';
6 -import { Logger, SPHelper, ToastUtils } from 'wdKit'; 5 +import { CustomToast, Logger, SPHelper, ToastUtils } from 'wdKit';
7 import { 6 import {
8 SpConstants 7 SpConstants
9 } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' 8 } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants'
@@ -58,6 +57,19 @@ export struct SettingPasswordLayout { @@ -58,6 +57,19 @@ export struct SettingPasswordLayout {
58 loginViewModel = new LoginViewModel() 57 loginViewModel = new LoginViewModel()
59 pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机 58 pageType?:number; //0、登录->忘记密码 1、设置->重置密码 2、设置->更换手机
60 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 + offset: { dx: 0, dy: -20 },
  68 + gridCount: 1,
  69 + customStyle: true,
  70 + maskColor:"#00000000"
  71 + })
  72 +
61 aboutToAppear() { 73 aboutToAppear() {
62 let params:SettingPasswordParams = router.getParams() as SettingPasswordParams; 74 let params:SettingPasswordParams = router.getParams() as SettingPasswordParams;
63 this.pageId = parseInt(params.pageID); 75 this.pageId = parseInt(params.pageID);
@@ -194,7 +206,7 @@ export struct SettingPasswordLayout { @@ -194,7 +206,7 @@ export struct SettingPasswordLayout {
194 this.inputTextChange(value, item.inputTag) 206 this.inputTextChange(value, item.inputTag)
195 }) 207 })
196 .onSubmit((EnterKeyType) => { 208 .onSubmit((EnterKeyType) => {
197 - promptAction.showToast({ message: 'submit' }) 209 + this.showToastTip('submit')
198 }) 210 })
199 } 211 }
200 .alignItems(VerticalAlign.Center) 212 .alignItems(VerticalAlign.Center)
@@ -218,7 +230,7 @@ export struct SettingPasswordLayout { @@ -218,7 +230,7 @@ export struct SettingPasswordLayout {
218 this.inputTextChange(value, item.inputTag) 230 this.inputTextChange(value, item.inputTag)
219 }) 231 })
220 .onSubmit((EnterKeyType) => { 232 .onSubmit((EnterKeyType) => {
221 - promptAction.showToast({ message: 'submit' }) 233 + this.showToastTip('submit')
222 }) 234 })
223 } 235 }
224 .alignItems(VerticalAlign.Center) 236 .alignItems(VerticalAlign.Center)
@@ -264,7 +276,7 @@ export struct SettingPasswordLayout { @@ -264,7 +276,7 @@ export struct SettingPasswordLayout {
264 Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'}) 276 Text(item.compDesc).fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
265 .onClick(()=>{ 277 .onClick(()=>{
266 if (item.compDesc == '忘记密码') { 278 if (item.compDesc == '忘记密码') {
267 - promptAction.showToast({ message: '密码不符合密码规范' }) 279 + this.showToastTip('密码不符合密码规范')
268 } 280 }
269 }) 281 })
270 } 282 }
@@ -307,11 +319,11 @@ export struct SettingPasswordLayout { @@ -307,11 +319,11 @@ export struct SettingPasswordLayout {
307 if (this.btnStatus) { 319 if (this.btnStatus) {
308 // 需要+手机号校验 320 // 需要+手机号校验
309 if (this.password01.length < 6 || this.password01.length > 20) { 321 if (this.password01.length < 6 || this.password01.length > 20) {
310 - promptAction.showToast({ message: '密码不符合密码规范' }) 322 + this.showToastTip('密码不符合密码规范')
311 return 323 return
312 } 324 }
313 if (this.password01 != this.password02) { 325 if (this.password01 != this.password02) {
314 - promptAction.showToast({ message: '密码不一致' }) 326 + this.showToastTip('密码不一致')
315 return 327 return
316 } 328 }
317 if(this.pageId == 1){ //设置密码 329 if(this.pageId == 1){ //设置密码
@@ -339,7 +351,6 @@ export struct SettingPasswordLayout { @@ -339,7 +351,6 @@ export struct SettingPasswordLayout {
339 Logger.error(TAG, 'catch err:' + JSON.stringify(err)); 351 Logger.error(TAG, 'catch err:' + JSON.stringify(err));
340 }); 352 });
341 } 353 }
342 - // promptAction.showToast({ message: '请求接口' })  
343 } 354 }
344 355
345 356
@@ -363,5 +374,10 @@ export struct SettingPasswordLayout { @@ -363,5 +374,10 @@ export struct SettingPasswordLayout {
363 } 374 }
364 } 375 }
365 } 376 }
  377 +
  378 + showToastTip(msg:string){
  379 + this.toastText = msg
  380 + this.dialogToast.open()
  381 + }
366 } 382 }
367 383