Skip to content

Let's use AI to Earn!

主题色和登录流程

daoyianebcf0aa0dfd3
diff --git a/src/api/apiReq.ts b/src/api/apiReq.ts
index f41be268..604178d5 100644
--- a/src/api/apiReq.ts
+++ b/src/api/apiReq.ts
@@ -51,9 +51,9 @@ export const getRegistUrlApi = (mail: string) => {
return sxRequest.get<LoginResponse>(`user/login/mail/regist/url?mail=${mail}`);
};
-// 检查注册状态
+// 检查注册状态 post!!
export const checkRegistStatusApi = (data: RegistCheckParams) => {
- return sxRequest.get<LoginResponse>(`user/login/mail/regist/back`, data);
+ return sxRequest.post<LoginResponse>(`user/login/mail/regist/back`, data);
};
// 发送重置密码邮件
diff --git a/src/app/[lng]/forgot-password/forgot-password.module.css b/src/app/[lng]/forgot-password/forgot-password.module.css
index 6bf24f8d..7f8090ce 100644
--- a/src/app/[lng]/forgot-password/forgot-password.module.css
+++ b/src/app/[lng]/forgot-password/forgot-password.module.css
@@ -9,75 +9,85 @@
.box {
width: 100%;
- max-width: 400px;
+ max-width: 420px;
padding: 32px;
- background: white;
- border-radius: 8px;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+ background: var(--card-background);
+ border-radius: 16px;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.title {
- text-align: center;
- margin-bottom: 24px;
+ font-size: 28px;
color: var(--text-color);
- font-size: 24px;
- font-weight: 500;
+ text-align: center;
+ margin-bottom: 32px;
+ font-weight: 600;
}
.form {
display: flex;
flex-direction: column;
- gap: 1rem;
+ gap: 20px;
}
.inputGroup {
- display: flex;
- flex-direction: column;
- gap: 0.5rem;
+ position: relative;
}
.input {
- padding: 0.8rem;
- border: 1px solid #ddd;
- border-radius: 4px;
- font-size: 1rem;
- transition: border-color 0.3s;
+ width: 100%;
+ padding: 12px 16px;
+ border: 1px solid var(--border-color);
+ border-radius: 8px;
+ font-size: 16px;
+ transition: all 0.3s;
+ background: var(--card-background);
}
.input:focus {
outline: none;
- border-color: #0070f3;
+ border-color: var(--theColor5);
+ box-shadow: 0 0 0 2px rgba(216, 181, 245, 0.1);
+}
+
+.input::placeholder {
+ color: var(--grayColor6);
}
.submitButton {
- margin-top: 24px;
- height: 40px;
- font-size: 16px;
- background-color: #0070f3;
- color: white;
- padding: 0.8rem;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- transition: background-color 0.3s;
+ height: 44px !important;
+ font-size: 16px !important;
+ font-weight: 500 !important;
+ border-radius: 8px !important;
+ background: var(--theColor5) !important;
+ border-color: var(--theColor5) !important;
+ transition: all 0.3s !important;
}
.submitButton:hover {
- background-color: #0051a2;
+ background: var(--theColor6) !important;
+ border-color: var(--theColor6) !important;
+ transform: translateY(-1px);
+ box-shadow: 0 4px 12px rgba(216, 181, 245, 0.2);
+}
+
+.submitButton:active {
+ transform: scale(0.98);
}
.links {
- margin-top: 16px;
+ margin-top: 24px;
text-align: center;
- font-size: 0.9rem;
}
.link {
- color: var(--primary-color);
+ color: var(--theColor5);
text-decoration: none;
+ transition: color 0.3s;
}
.link:hover {
+ color: var(--theColor6);
text-decoration: underline;
}
@@ -88,15 +98,15 @@
}
.title {
- font-size: 20px;
- margin-bottom: 20px;
+ font-size: 24px;
+ margin-bottom: 24px;
}
.input {
- padding: 0.7rem;
+ padding: 10px 14px;
}
.submitButton {
- padding: 0.7rem;
+ height: 40px !important;
}
}
\ No newline at end of file
diff --git a/src/app/[lng]/login/login.module.css b/src/app/[lng]/login/login.module.css
index 4ac7baa7..cfcb409b 100644
--- a/src/app/[lng]/login/login.module.css
+++ b/src/app/[lng]/login/login.module.css
@@ -46,12 +46,12 @@
.input:focus {
outline: none;
- border-color: var(--primary-color);
+ border-color: var(--theColor5);
box-shadow: 0 0 0 2px rgba(216, 181, 245, 0.1);
}
.input::placeholder {
- color: #999;
+ color: var(--grayColor6);
}
.submitButton {
@@ -59,14 +59,14 @@
font-size: 16px !important;
font-weight: 500 !important;
border-radius: 8px !important;
- background: var(--primary-color) !important;
- border-color: var(--primary-color) !important;
+ background: var(--theColor5) !important;
+ border-color: var(--theColor5) !important;
transition: all 0.3s !important;
}
.submitButton:hover {
- background: var(--primary-hover) !important;
- border-color: var(--primary-hover) !important;
+ background: var(--theColor6) !important;
+ border-color: var(--theColor6) !important;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(216, 181, 245, 0.2);
}
@@ -79,7 +79,7 @@
display: flex;
align-items: center;
margin: 24px 0;
- color: #999;
+ color: var(--grayColor6);
}
.divider::before,
@@ -106,14 +106,86 @@
}
.link {
- color: var(--primary-color);
+ color: var(--theColor5);
text-decoration: none;
- font-size: 14px;
transition: color 0.3s;
}
.link:hover {
- color: var(--primary-hover);
+ color: var(--theColor6);
+ text-decoration: underline;
+}
+
+/* Modal 样式 */
+.modalWrapper :global(.ant-modal-content) {
+ border-radius: 16px !important;
+ overflow: hidden;
+}
+
+.modalWrapper :global(.ant-modal-header) {
+ border-bottom: 1px solid var(--border-color);
+ padding: 20px 24px;
+}
+
+.modalWrapper :global(.ant-modal-title) {
+ font-size: 20px !important;
+ font-weight: 600 !important;
+ color: var(--text-color) !important;
+}
+
+.modalWrapper :global(.ant-modal-body) {
+ padding: 24px !important;
+}
+
+.modalWrapper :global(.ant-form-item-label > label) {
+ color: var(--text-color) !important;
+ font-size: 14px !important;
+}
+
+.modalWrapper :global(.ant-input-affix-wrapper) {
+ border-radius: 8px !important;
+ border-color: var(--border-color) !important;
+ padding: 8px 12px !important;
+ transition: all 0.3s !important;
+}
+
+.modalWrapper :global(.ant-input-affix-wrapper:hover) {
+ border-color: var(--theColor5) !important;
+}
+
+.modalWrapper :global(.ant-input-affix-wrapper-focused) {
+ border-color: var(--theColor5) !important;
+ box-shadow: 0 0 0 2px rgba(216, 181, 245, 0.1) !important;
+}
+
+.modalWrapper :global(.ant-input) {
+ font-size: 16px !important;
+ color: var(--text-color) !important;
+}
+
+.modalWrapper :global(.ant-input::placeholder) {
+ color: var(--grayColor6) !important;
+}
+
+.modalWrapper :global(.ant-btn-primary) {
+ height: 44px !important;
+ font-size: 16px !important;
+ font-weight: 500 !important;
+ border-radius: 8px !important;
+ background: var(--theColor5) !important;
+ border-color: var(--theColor5) !important;
+ transition: all 0.3s !important;
+}
+
+.modalWrapper :global(.ant-btn-primary:hover) {
+ background: var(--theColor6) !important;
+ border-color: var(--theColor6) !important;
+ transform: translateY(-1px);
+ box-shadow: 0 4px 12px rgba(216, 181, 245, 0.2);
+}
+
+.modalWrapper :global(.ant-btn-primary:active) {
+ transform: scale(0.98);
}
/* 移动端适配 */
diff --git a/src/app/[lng]/login/page.tsx b/src/app/[lng]/login/page.tsx
index 9b65ba99..38bcff8e 100644
--- a/src/app/[lng]/login/page.tsx
+++ b/src/app/[lng]/login/page.tsx
@@ -19,6 +19,8 @@ export default function LoginPage() {
const [isModalOpen, setIsModalOpen] = useState(false);
const [registCode, setRegistCode] = useState("");
const [form] = Form.useForm();
+ const [isActivating, setIsActivating] = useState(false);
+ const [activationTimer, setActivationTimer] = useState<NodeJS.Timeout | null>(null);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
@@ -51,50 +53,27 @@ export default function LoginPage() {
const handleRegistSubmit = async (values: { password: string; inviteCode?: string }) => {
try {
- const response = await checkRegistStatusApi({
- code: registCode,
- mail: email,
- password: values.password,
- inviteCode: values.inviteCode || ''
- });
+ setIsActivating(true);
+ message.info('激活链接已发送至邮箱,请查收并点击激活');
- if (!response) return;
-
- if (response.code === 0 && response.data.token) {
- setIsChecking(false);
- setIsModalOpen(false);
- setToken(response.data.token);
- if (response.data.userInfo) {
- setUserInfo(response.data.userInfo);
- }
- message.success('注册成功,已自动登录');
- router.push('/');
- } else {
- message.error(response.msg || '注册失败');
- }
- } catch (error) {
- message.error('注册失败,请稍后重试');
- }
- };
-
- // 检查注册状态
- useEffect(() => {
- let timer: NodeJS.Timeout;
-
- if (isChecking && !isModalOpen) {
- timer = setInterval(async () => {
+ // 开始循环检查注册状态
+ const timer = setInterval(async () => {
try {
const response = await checkRegistStatusApi({
code: registCode,
mail: email,
- password: form.getFieldValue('password'),
- inviteCode: form.getFieldValue('inviteCode') || ''
+ password: values.password,
+ inviteCode: values.inviteCode || ''
});
if (!response) return;
if (response.code === 0 && response.data.token) {
- clearInterval(timer);
+ // 注册成功,清除定时器
+ if (activationTimer) {
+ clearInterval(activationTimer);
+ }
+ setIsActivating(false);
setIsChecking(false);
setIsModalOpen(false);
setToken(response.data.token);
@@ -107,15 +86,23 @@ export default function LoginPage() {
} catch (error) {
console.error('检查注册状态失败:', error);
}
- }, 3000);
+ }, 2000); // 每2秒检查一次
+
+ setActivationTimer(timer);
+ } catch (error) {
+ message.error('注册失败,请稍后重试');
+ setIsActivating(false);
}
+ };
+ // 组件卸载时清除定时器
+ useEffect(() => {
return () => {
- if (timer) {
- clearInterval(timer);
+ if (activationTimer) {
+ clearInterval(activationTimer);
}
};
- }, [isChecking, isModalOpen, email, router, registCode, form, setToken, setUserInfo]);
+ }, [activationTimer]);
const handleGoogleSuccess = (credentialResponse: any) => {
console.log("Google 登录成功:", credentialResponse);
@@ -188,11 +175,16 @@ export default function LoginPage() {
onCancel={() => {
setIsModalOpen(false);
setIsChecking(false);
+ setIsActivating(false);
+ if (activationTimer) {
+ clearInterval(activationTimer);
+ }
}}
maskClosable={false}
keyboard={false}
closable={true}
footer={null}
+ className={styles.modalWrapper}
>
<Form
form={form}
@@ -218,8 +210,13 @@ export default function LoginPage() {
</Form.Item>
<Form.Item>
- <Button type="primary" htmlType="submit" block>
- 完成注册
+ <Button
+ type="primary"
+ htmlType="submit"
+ block
+ loading={isActivating}
+ >
+ {isActivating ? '等待激活中...' : '完成注册'}
</Button>
</Form.Item>
</Form>