From a38d1229e791fac98dc2ccede99a8d1c224fe82f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 21 Nov 2025 10:35:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(dealer):=20=E6=9B=B4=E6=96=B0=E6=8A=A5?= =?UTF-8?q?=E5=A4=87=E4=BA=BA=E5=AD=97=E6=AE=B5=E5=B9=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 报备人字段标签增加 "(ID)" 标识 - 设置报备人输入框类型为数字 - 禁用编辑模式下报备人字段 - 注释掉注册、忘记密码和服务配置相关路由及界面元素 - 移除登录页底部服务配置按钮 - 隐藏忘记密码与立即注册链接 --- src/passport/login.tsx | 99 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 4 deletions(-) diff --git a/src/passport/login.tsx b/src/passport/login.tsx index 9cc2a3c..76103cd 100644 --- a/src/passport/login.tsx +++ b/src/passport/login.tsx @@ -1,13 +1,83 @@ import {useEffect, useState} from "react"; import Taro from '@tarojs/taro' import {Input, Radio, Button} from '@nutui/nutui-react-taro' +import {loginBySms} from '@/api/passport/login' const Login = () => { const [isAgree, setIsAgree] = useState(false) + const [phone, setPhone] = useState('') + const [password, setPassword] = useState('') + const [loading, setLoading] = useState(false) + const reload = () => { 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(() => { reload() }, []) @@ -19,11 +89,23 @@ const Login = () => { <>
- + setPhone(val)} + style={{backgroundColor: '#ffffff', borderRadius: '8px'}} + />
- + setPassword(val)} + style={{backgroundColor: '#ffffff', borderRadius: '8px'}} + />
{/*
*/} {/* { {/* onClick={() => Taro.navigateTo({url: '/passport/register'})}>立即注册*/} {/*
*/}
- +
{/*
*/} {/* */}