|
@@ -390,12 +390,52 @@ export class MbLoginPage implements OnDestroy {
|
|
|
this.stage.set('phone');
|
|
this.stage.set('phone');
|
|
|
this.code.set('');
|
|
this.code.set('');
|
|
|
this.error.set(null);
|
|
this.error.set(null);
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 🔴 返回手机号页时**停掉倒计时**(2026-11-18 用户实测 bug)。
|
|
|
|
|
+ *
|
|
|
|
|
+ * ## 现象
|
|
|
|
|
+ *
|
|
|
|
|
+ * 发完验证码 → 点「返回修改手机号」→ 再点「获取验证码」→ **没有任何反应**。
|
|
|
|
|
+ *
|
|
|
|
|
+ * ## 根因
|
|
|
|
|
+ *
|
|
|
|
|
+ * 这里没停倒计时,`countdown` 还在往下跑;而手机号页的按钮只判
|
|
|
|
|
+ * `!phoneValid() || busy()`,看起来是**可点的**。
|
|
|
|
|
+ * 点下去 `sendCode()` 第一行 `countdown() > 0` 直接 return、**不给任何提示** ——
|
|
|
|
|
+ * 用户看到的就是「点了没反应」。
|
|
|
|
|
+ *
|
|
|
|
|
+ * ## 修法
|
|
|
|
|
+ *
|
|
|
|
|
+ * 返回即视为「放弃这次验证码」:停掉定时器、清零倒计时。
|
|
|
|
|
+ * 用户重新点发送时是完整的新一轮,不会再被上一轮挡住。
|
|
|
|
|
+ */
|
|
|
|
|
+ this.stopCountdown();
|
|
|
this.focus(this.phoneEl());
|
|
this.focus(this.phoneEl());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 停止倒计时并清零(返回 / 卸载 / 重发时调用) */
|
|
|
|
|
+ private stopCountdown(): void {
|
|
|
|
|
+ if (this.codeTimer) {
|
|
|
|
|
+ clearInterval(this.codeTimer);
|
|
|
|
|
+ this.codeTimer = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.countdown.set(0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/** 发送验证码:真实接口 + 60s 倒计时(Demo 无倒计时,此处按规范补齐防刷) */
|
|
/** 发送验证码:真实接口 + 60s 倒计时(Demo 无倒计时,此处按规范补齐防刷) */
|
|
|
protected async sendCode(): Promise<void> {
|
|
protected async sendCode(): Promise<void> {
|
|
|
- if (this.sending() || this.countdown() > 0 || this.busy()) return;
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 🔴 倒计时未结束时给出**明确提示**,不再静默返回(2026-11-18 用户实测)。
|
|
|
|
|
+ *
|
|
|
|
|
+ * 原来这里直接 `return` —— 用户点了按钮什么都没发生,
|
|
|
|
|
+ * 分不清「是没点中」「是坏了」还是「在等冷却」。
|
|
|
|
|
+ * 现在告诉他还剩几秒。
|
|
|
|
|
+ */
|
|
|
|
|
+ if (this.countdown() > 0) {
|
|
|
|
|
+ this.error.set(`请等待 ${this.countdown()} 秒后再试`);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.sending() || this.busy()) return;
|
|
|
this.error.set(null);
|
|
this.error.set(null);
|
|
|
if (!this.phoneValid()) {
|
|
if (!this.phoneValid()) {
|
|
|
this.error.set('请输入正确的 11 位手机号');
|
|
this.error.set('请输入正确的 11 位手机号');
|