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' }} + /> - + + + )}