feat(auth): 优化隐藏登录弹窗点击逻辑和样式

- 将点击步数提示从第4次调整到第6次触发,增强用户体验
- 弹窗宽度由320px调整为340px,更加合理显示内容
- 弹窗布局对齐sms-login.tsx,验证码输入和按钮布局调整,修复小程序Button显示问题
- 登录按钮样式改用className设置宽度和圆角,取消block和shape属性
- 点击版权信息累计11次弹出登录弹窗,未达次数显示剩余步数提示
- 登录成功后同步React登录态,保持状态一致
This commit is contained in:
2026-07-15 01:45:45 +08:00
parent 38a7b4320d
commit 747a2a1d3a
2 changed files with 39 additions and 28 deletions

View File

@@ -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
>
<View
className='mx-6 rounded-2xl bg-white'
style={{ width: '320px', padding: '24px 20px' }}
className='rounded-2xl bg-white'
style={{ width: '340px', padding: '24px 20px' }}
onClick={(e) => e.stopPropagation()}
>
<View className='mb-3 flex items-center justify-between'>
@@ -226,17 +238,15 @@ const AboutPage: React.FC = () => {
/>
</View>
<View className='flex items-center gap-2 mb-6'>
<View className='flex-1'>
<Input
type='number'
placeholder='请输入6位验证码'
maxLength={6}
value={formData.code || ''}
onChange={(val) => setFormData({ ...formData, code: val })}
style={{ backgroundColor: '#f5f5f5', borderRadius: '8px' }}
/>
</View>
<View className='mb-6 flex items-center bg-white rounded-lg pr-2'>
<Input
type='number'
placeholder='请输入6位验证码'
maxLength={6}
value={formData.code || ''}
onChange={(val) => setFormData({ ...formData, code: val })}
style={{ backgroundColor: '#f5f5f5', borderRadius: '8px' }}
/>
<Button
size='small'
type={countdown > 0 ? 'default' : 'primary'}
@@ -248,17 +258,18 @@ const AboutPage: React.FC = () => {
</Button>
</View>
<Button
type='primary'
size='large'
shape='round'
loading={loading}
disabled={loading}
onClick={handleLogin}
style={{ width: '100%' }}
>
{loading ? '登录中...' : '登 录'}
</Button>
<View className='flex justify-center'>
<Button
type='primary'
size='large'
className='w-full rounded-lg p-2'
loading={loading}
disabled={loading}
onClick={handleLogin}
>
{loading ? '登录中...' : '登录'}
</Button>
</View>
</View>
</View>
)}