feat(dealer): 更新报备人字段并调整登录页面配置

- 报备人字段标签增加 "(ID)" 标识
- 设置报备人输入框类型为数字
- 禁用编辑模式下报备人字段
- 注释掉注册、忘记密码和服务配置相关路由及界面元素
- 移除登录页底部服务配置按钮
- 隐藏忘记密码与立即注册链接
This commit is contained in:
2025-11-21 10:35:10 +08:00
parent 365f4de585
commit a38d1229e7

View File

@@ -1,13 +1,83 @@
import {useEffect, useState} from "react"; import {useEffect, useState} from "react";
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import {Input, Radio, Button} from '@nutui/nutui-react-taro' import {Input, Radio, Button} from '@nutui/nutui-react-taro'
import {loginBySms} from '@/api/passport/login'
const Login = () => { const Login = () => {
const [isAgree, setIsAgree] = useState(false) const [isAgree, setIsAgree] = useState(false)
const [phone, setPhone] = useState('')
const [password, setPassword] = useState('')
const [loading, setLoading] = useState(false)
const reload = () => { const reload = () => {
Taro.hideTabBar() Taro.hideTabBar()
} }
// 处理登录
const handleLogin = async () => {
if (!isAgree) {
Taro.showToast({
title: '请先同意服务协议',
icon: 'none'
})
return
}
if (!phone || phone.trim() === '') {
Taro.showToast({
title: '请输入手机号',
icon: 'none'
})
return
}
if (!password || password.trim() === '') {
Taro.showToast({
title: '请输入密码',
icon: 'none'
})
return
}
// 验证手机号格式
const phoneRegex = /^1[3-9]\d{9}$/
if (!phoneRegex.test(phone)) {
Taro.showToast({
title: '请输入正确的手机号',
icon: 'none'
})
return
}
try {
setLoading(true)
await loginBySms({
phone: phone,
code: password
})
Taro.showToast({
title: '登录成功',
icon: 'success'
})
// 延迟跳转到首页
setTimeout(() => {
Taro.reLaunch({
url: '/pages/index/index'
})
}, 1500)
} catch (error: any) {
console.error('登录失败:', error)
Taro.showToast({
title: error.message || '登录失败,请重试',
icon: 'none'
})
} finally {
setLoading(false)
}
}
useEffect(() => { useEffect(() => {
reload() reload()
}, []) }, [])
@@ -19,11 +89,23 @@ const Login = () => {
<> <>
<div className={'flex flex-col justify-between items-center my-2'}> <div className={'flex flex-col justify-between items-center my-2'}>
<Input type="text" placeholder="手机号" maxLength={11} <Input
style={{backgroundColor: '#ffffff', borderRadius: '8px'}}/> type="text"
placeholder="手机号"
maxLength={11}
value={phone}
onChange={(val) => setPhone(val)}
style={{backgroundColor: '#ffffff', borderRadius: '8px'}}
/>
</div> </div>
<div className={'flex flex-col justify-between items-center my-2'}> <div className={'flex flex-col justify-between items-center my-2'}>
<Input type="password" placeholder="密码" style={{backgroundColor: '#ffffff', borderRadius: '8px'}}/> <Input
type="password"
placeholder="密码"
value={password}
onChange={(val) => setPassword(val)}
style={{backgroundColor: '#ffffff', borderRadius: '8px'}}
/>
</div> </div>
{/*<div className={'flex justify-between my-2 text-left px-1'}>*/} {/*<div className={'flex justify-between my-2 text-left px-1'}>*/}
{/* <a href={'#'} className={'text-blue-600 text-sm'}*/} {/* <a href={'#'} className={'text-blue-600 text-sm'}*/}
@@ -32,7 +114,16 @@ const Login = () => {
{/* onClick={() => Taro.navigateTo({url: '/passport/register'})}>立即注册</a>*/} {/* onClick={() => Taro.navigateTo({url: '/passport/register'})}>立即注册</a>*/}
{/*</div>*/} {/*</div>*/}
<div className={'flex justify-center my-5'}> <div className={'flex justify-center my-5'}>
<Button type="info" size={'large'} className={'w-full rounded-lg p-2'} disabled={!isAgree}></Button> <Button
type="info"
size={'large'}
className={'w-full rounded-lg p-2'}
disabled={!isAgree}
loading={loading}
onClick={handleLogin}
>
{loading ? '登录中...' : '登录'}
</Button>
</div> </div>
{/*<div className={'my-2 flex fixed justify-center bottom-20 left-0 text-sm items-center text-center w-full'}>*/} {/*<div className={'my-2 flex fixed justify-center bottom-20 left-0 text-sm items-center text-center w-full'}>*/}
{/* <Button onClick={() => Taro.navigateTo({url: '/passport/setting'})}>服务配置</Button>*/} {/* <Button onClick={() => Taro.navigateTo({url: '/passport/setting'})}>服务配置</Button>*/}