From 747a2a1d3a0aadb5133a831f98ac4acc77185a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 15 Jul 2026 01:45:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(auth):=20=E4=BC=98=E5=8C=96=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E7=99=BB=E5=BD=95=E5=BC=B9=E7=AA=97=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将点击步数提示从第4次调整到第6次触发,增强用户体验 - 弹窗宽度由320px调整为340px,更加合理显示内容 - 弹窗布局对齐sms-login.tsx,验证码输入和按钮布局调整,修复小程序Button显示问题 - 登录按钮样式改用className设置宽度和圆角,取消block和shape属性 - 点击版权信息累计11次弹出登录弹窗,未达次数显示剩余步数提示 - 登录成功后同步React登录态,保持状态一致 --- .workbuddy/memory/2025-07-15.md | 6 ++-- src/pages/user/about/index.tsx | 61 +++++++++++++++++++-------------- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/.workbuddy/memory/2025-07-15.md b/.workbuddy/memory/2025-07-15.md index c1c081b..f7deb87 100644 --- a/.workbuddy/memory/2025-07-15.md +++ b/.workbuddy/memory/2025-07-15.md @@ -4,8 +4,8 @@ - 在 `src/pages/user/about/index.tsx` 底部版权信息上添加了点击 11 次弹出隐藏登录弹窗的功能 - 登录方式:手机号 + 短信验证码,复用 `loginBySms` / `sendSmsCaptcha` API(from `@/api/passport/login`) - 点击计数使用 `useRef` 保证快速点击时的同步性,超过 3 秒未点击自动重置 -- 第 4 次点击起显示步数提示(类似 Android 开发者模式),前 3 次仅轻震动反馈 -- **(已更新)** 移除了步数提示和震动,改为静默计数,点够 11 次直接弹窗 -- **(已更新)** 弹窗宽度从 300px 加大到 320px,登录按钮改用 `style={{ width: '100%' }}` 替代 `block` prop 确保显示 +- 步数提示从**第 6 次**点击开始显示(Android 开发者模式风格) +- **(已更新)** 弹窗布局完全对齐 `sms-login.tsx` 写法:验证码行取消 `gap-2`/`flex-1` 包裹,改用 `flex items-center` 直接放 Input + Button;登录按钮取消 `block`/`shape`/`style`,改用 `className='w-full rounded-lg p-2'` + 外层 `flex justify-center`,解决小程序中 Button 不显示的问题 +- 弹窗宽度从 300px 加宽到 **340px** - 登录成功后调用 `useUserContext().syncFromStorage()` 同步 React 登录态(`loginBySms` 内部已写入 storage 但不返回数据) - 弹窗 UI 使用 NutUI `Input` + `Button`,带 60 秒倒计时 diff --git a/src/pages/user/about/index.tsx b/src/pages/user/about/index.tsx index 6082e74..462b804 100644 --- a/src/pages/user/about/index.tsx +++ b/src/pages/user/about/index.tsx @@ -33,7 +33,7 @@ const AboutPage: React.FC = () => { return () => clearTimeout(timer) }, [countdown]) - /** 点击版权信息 —— 累计 11 次弹出隐藏登录 */ + /** 点击版权信息 —— 累计 11 次弹出隐藏登录 */ const handleCopyrightClick = () => { const now = Date.now() // 超过 3 秒未点击则重新计数 @@ -45,9 +45,21 @@ const AboutPage: React.FC = () => { lastClickTime.current = now const current = clickCountRef.current + const remaining = DEV_LOGIN_CLICK_COUNT - current + if (current >= DEV_LOGIN_CLICK_COUNT) { clickCountRef.current = 0 setShowLogin(true) + return + } + + // 从第 6 次开始给步数提示 + if (current >= 6) { + Taro.showToast({ + title: `再点击 ${remaining} 次开启开发者登录`, + icon: 'none', + duration: 1200, + }) } } @@ -197,8 +209,8 @@ const AboutPage: React.FC = () => { catchMove > e.stopPropagation()} > @@ -226,17 +238,15 @@ const AboutPage: React.FC = () => { /> - - - setFormData({ ...formData, code: val })} - style={{ backgroundColor: '#f5f5f5', borderRadius: '8px' }} - /> - + + setFormData({ ...formData, code: val })} + style={{ backgroundColor: '#f5f5f5', borderRadius: '8px' }} + /> - + + + )}