feat: 本次提交更新内容如下

存了微信样式
This commit is contained in:
笔记本里的永平
2025-07-18 16:30:37 +08:00
parent 0e6bc6d783
commit aff4700a10
2 changed files with 43 additions and 53 deletions

View File

@@ -262,7 +262,7 @@
.agreement-section {
margin-bottom: 24px;
padding: 12px;
padding: 10px;
background: #f8f9fa;
border-radius: 10px;
border: 1px solid #e5e5e5;
@@ -271,15 +271,16 @@
.agreement-checkbox {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
gap: 6px;
font-size: 11px;
color: #666;
line-height: 1.4;
line-height: 1.3;
white-space: nowrap;
:global(.adm-checkbox) {
margin-top: 0;
flex-shrink: 0;
transform: scale(0.8);
}
}
@@ -289,8 +290,9 @@
align-items: center;
flex-wrap: nowrap;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
overflow: visible;
text-overflow: clip;
font-size: 11px;
}
.agreement-link {
@@ -298,6 +300,7 @@
cursor: pointer;
text-decoration: none;
white-space: nowrap;
font-size: 11px;
&:hover {
text-decoration: underline;

View File

@@ -7,7 +7,11 @@ import {
UserOutline,
} from "antd-mobile-icons";
import { useUserStore } from "@/store/module/user";
import { loginWithPassword, loginWithCode, sendVerificationCode } from "./api";
import {
loginWithPassword,
loginWithCode,
sendVerificationCode,
} from "@/api/auth";
import style from "./login.module.scss";
const Login: React.FC = () => {
@@ -77,41 +81,12 @@ const Login: React.FC = () => {
}
};
// 表单验证
const validateForm = async () => {
try {
const values = await form.validateFields();
if (!agreeToTerms) {
Toast.show({ content: "请同意用户协议和隐私政策", position: "top" });
return false;
}
if (!validatePhone(values.phone)) {
Toast.show({ content: "请输入正确的11位手机号", position: "top" });
return false;
}
if (activeTab === "password" && !values.password) {
Toast.show({ content: "请输入密码", position: "top" });
return false;
}
if (activeTab === "verification" && !values.verificationCode) {
Toast.show({ content: "请输入验证码", position: "top" });
return false;
}
return values;
} catch (error) {
return false;
}
};
// 登录处理
const handleLogin = async () => {
const values = await validateForm();
if (!values) return;
const handleLogin = async (values: any) => {
if (!agreeToTerms) {
Toast.show({ content: "请同意用户协议和隐私政策", position: "top" });
return;
}
setLoading(true);
try {
@@ -225,26 +200,36 @@ const Login: React.FC = () => {
onFinish={handleLogin}
>
{/* 手机号输入 */}
<div className={style["input-group"]}>
<label className={style["input-label"]}></label>
<Form.Item
name="phone"
label="手机号"
rules={[
{ required: true, message: "请输入手机号" },
{
pattern: /^1[3-9]\d{9}$/,
message: "请输入正确的11位手机号",
},
]}
>
<div className={style["input-wrapper"]}>
<span className={style["input-prefix"]}>+86</span>
<Input
name="phone"
placeholder="请输入手机号"
clearable
className={style["phone-input"]}
/>
</div>
</div>
</Form.Item>
{/* 密码输入 */}
{activeTab === "password" && (
<div className={style["input-group"]}>
<label className={style["input-label"]}></label>
<Form.Item
name="password"
label="密码"
rules={[{ required: true, message: "请输入密码" }]}
>
<div className={style["input-wrapper"]}>
<Input
name="password"
placeholder="请输入密码"
clearable
type={showPassword ? "text" : "password"}
@@ -257,16 +242,18 @@ const Login: React.FC = () => {
{showPassword ? <EyeOutline /> : <EyeInvisibleOutline />}
</div>
</div>
</div>
</Form.Item>
)}
{/* 验证码输入 */}
{activeTab === "verification" && (
<div className={style["input-group"]}>
<label className={style["input-label"]}></label>
<Form.Item
name="verificationCode"
label="验证码"
rules={[{ required: true, message: "请输入验证码" }]}
>
<div className={style["input-wrapper"]}>
<Input
name="verificationCode"
placeholder="请输入验证码"
clearable
className={style["code-input"]}
@@ -282,7 +269,7 @@ const Login: React.FC = () => {
{countdown > 0 ? `${countdown}s` : "获取验证码"}
</button>
</div>
</div>
</Form.Item>
)}
{/* 用户协议 */}