diff --git a/miniprogram/src/pages/scan-login/index.jsx b/miniprogram/src/pages/scan-login/index.jsx index 8af2850..10b9b27 100644 --- a/miniprogram/src/pages/scan-login/index.jsx +++ b/miniprogram/src/pages/scan-login/index.jsx @@ -15,10 +15,9 @@ export default function ScanLogin() { const [busy, setBusy] = useState(false); const [msg, setMsg] = useState(''); const [done, setDone] = useState(false); - const [loginMode, setLoginMode] = useState<'wx' | 'phone'>('wx'); + const [loginMode, setLoginMode] = useState('wx'); const [gatePhone, setGatePhone] = useState(''); const [gateCode, setGateCode] = useState(''); - const [cd, setCd] = useState(0); // 冷启动/扫码进入:纯 React useEffect 读当前实例参数(wxacode 的 scene 在 router.params.scene)。 // 不再用 useLoad/useDidShow 等 Taro 元钩子(其内部在原生计时器里调度 React hook,会触发 @@ -51,9 +50,7 @@ export default function ScanLogin() { try { const r = await sendCode(gatePhone); setMsg(`验证码已发送${r.debugCode ? `(演示 ${r.debugCode})` : ''}`); - setCd(60); - // 小程序无 window,用全局 setInterval/clearInterval(源码里 window.* 会导致运行时 ReferenceError) - const t = setInterval(() => setCd((c) => (c <= 1 ? (clearInterval(t), 0) : c - 1)), 1000); + // 不启用 setInterval 倒计时:小程序原生定时器里 setState 会触发 "Invalid attempt to destruct non-iterable",改为允许随时重发 } catch (e) { setMsg((e && e.message) || '发送失败'); } finally { setBusy(false); } }; @@ -101,7 +98,7 @@ export default function ScanLogin() { setGatePhone(e.detail.value)} /> setGateCode(e.detail.value)} /> - + diff --git a/miniprogram/src/pages/scan-login/index.scss b/miniprogram/src/pages/scan-login/index.scss index 13418f1..5151df7 100644 --- a/miniprogram/src/pages/scan-login/index.scss +++ b/miniprogram/src/pages/scan-login/index.scss @@ -13,9 +13,9 @@ .sl-actions { display: flex; flex-direction: column; gap: 16rpx; margin-top: 40rpx; } /* 登录门 */ -.sl-tabs { display: flex; gap: 4px; margin: 24rpx 0; padding: 4px; border-radius: 12px; background: #161618; border: 1px solid #d7ddf0; } +.sl-tabs { display: flex; gap: 4px; margin: 24rpx 0; padding: 4px; border-radius: 12px; background: #eef1ff; border: 1px solid rgba(99,132,255,.14); } .sl-tab { flex: 1; text-align: center; padding: 12rpx 0; border-radius: 9px; color: #7a86b0; font-size: 26rpx; } -.sl-tab.on { background: #fff; color: #111; } +.sl-tab.on { background: #fff; color: #23315c; box-shadow: 0 4rpx 12rpx rgba(59,79,125,.10); } .sl-field { display: flex; flex-direction: column; gap: 14rpx; margin-top: 8rpx; } .sl-code { display: flex; gap: 12rpx; align-items: center; } .sl-code .input { flex: 1; }