ref |> 解决多次点击需要登录的按钮时,会多次弹窗登录页面问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
9 additions
and
0 deletions
| @@ -10,14 +10,23 @@ import { common } from '@kit.AbilityKit' | @@ -10,14 +10,23 @@ import { common } from '@kit.AbilityKit' | ||
| 10 | 10 | ||
| 11 | class LoginJumpHandler implements JumpInterceptorAction { | 11 | class LoginJumpHandler implements JumpInterceptorAction { |
| 12 | 12 | ||
| 13 | + private logining = false | ||
| 14 | + | ||
| 13 | /// 说明是调用了跳转 WDRouterPage.loginPage 页面的行为 | 15 | /// 说明是调用了跳转 WDRouterPage.loginPage 页面的行为 |
| 14 | on(params?: object | undefined, singleMode?: boolean | undefined): boolean { | 16 | on(params?: object | undefined, singleMode?: boolean | undefined): boolean { |
| 15 | 17 | ||
| 18 | + if (this.logining) { | ||
| 19 | + return true | ||
| 20 | + } | ||
| 21 | + this.logining = true | ||
| 22 | + | ||
| 16 | HuaweiAuth.sharedInstance().fetchAnonymousPhone().then((anonymousPhone) => { | 23 | HuaweiAuth.sharedInstance().fetchAnonymousPhone().then((anonymousPhone) => { |
| 17 | 24 | ||
| 18 | router.pushUrl({url: WDRouterPage.oneKeyLoginPage.url()}) | 25 | router.pushUrl({url: WDRouterPage.oneKeyLoginPage.url()}) |
| 26 | + this.logining = false | ||
| 19 | }).catch((error: string) => { | 27 | }).catch((error: string) => { |
| 20 | router.pushUrl({url: WDRouterPage.loginPage.url()}) | 28 | router.pushUrl({url: WDRouterPage.loginPage.url()}) |
| 29 | + this.logining = false | ||
| 21 | }) | 30 | }) |
| 22 | return true | 31 | return true |
| 23 | } | 32 | } |
-
Please register or login to post a comment