diff --git a/app/components/auth/Login.tsx b/app/components/auth/Login.tsx index 72e960c..6103ba1 100644 --- a/app/components/auth/Login.tsx +++ b/app/components/auth/Login.tsx @@ -1,19 +1,13 @@ import React, { useState } from 'react'; import { useNavigate } from '@remix-run/react'; -import { validatePhoneNumber } from '~/utils/validation'; export function Login() { const [phone, setPhone] = useState(''); const [password, setPassword] = useState(''); - const [phoneError, setPhoneError] = useState(''); const navigate = useNavigate(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); - if (!validatePhoneNumber(phone)) { - setPhoneError('请输入有效的手机号码'); - return; - } try { const response = await fetch('/api/auth/login', { method: 'POST', @@ -42,14 +36,10 @@ export function Login() { type="tel" id="phone" value={phone} - onChange={(e) => { - setPhone(e.target.value); - setPhoneError(''); - }} + onChange={(e) => setPhone(e.target.value)} required className="mt-1 block w-full px-3 py-2 bg-bolt-elements-background-depth-1 border border-bolt-elements-borderColor rounded-md shadow-sm focus:outline-none focus:ring-bolt-elements-button-primary-background focus:border-bolt-elements-button-primary-background" /> - {phoneError &&

{phoneError}

}