dc38c3fa8b
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m26s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m26s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m59s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 4m22s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 5m22s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m17s
CI/CD Pipeline / Integration Tests (push) Successful in 2m51s
CI/CD Pipeline / Unit Tests (push) Successful in 11m48s
CI/CD Pipeline / Build Staging API Image (push) Successful in 12m46s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 29s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 35s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m7s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 5m47s
CI/CD Pipeline / Canary Release to Production (push) Failing after 1147h9m38s
CI/CD Pipeline / Deploy Production (push) Failing after 1147h16m52s
CI/CD Pipeline / CI Gate (push) Failing after 1147h16m53s
CI/CD Pipeline / Build Production API Image (push) Failing after 1147h16m53s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 1147h28m39s
CI/CD Pipeline / PR Build API Image (push) Failing after 1147h28m41s
CI/CD Pipeline / Frontend Lint (push) Failing after 1147h28m42s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1147h16m53s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 1147h28m44s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1147h50m2s
CI/CD Pipeline / Build Production Web Image (push) Failing after 1147h50m3s
CI/CD Pipeline / PR Build Web Image (push) Failing after 1148h1m50s
118 lines
3.9 KiB
TypeScript
118 lines
3.9 KiB
TypeScript
import React from "react"
|
|
import { Modal, Tabs, Form, Input, Button } from "antd"
|
|
import { useBindContactForm } from "./hooks/useBindContactForm"
|
|
import type { BindContactModalProps } from "./types"
|
|
|
|
const BindContactModal: React.FC<BindContactModalProps> = ({ open, onSuccess, onCancel }) => {
|
|
const {
|
|
activeTab,
|
|
setActiveTab,
|
|
form,
|
|
loading,
|
|
codeLoading,
|
|
countdown,
|
|
codeDisabled,
|
|
handleSendCode,
|
|
handleSubmit,
|
|
} = useBindContactForm({ open, onSuccess, onCancel })
|
|
|
|
return (
|
|
<Modal
|
|
title="绑定联系方式"
|
|
open={open}
|
|
onCancel={onCancel}
|
|
footer={null}
|
|
destroyOnHidden
|
|
maskClosable={false}
|
|
>
|
|
<p style={{ color: "#666", marginBottom: 16 }}>为了保障账号安全,请绑定您的邮箱或手机号</p>
|
|
|
|
<Tabs
|
|
activeKey={activeTab}
|
|
onChange={(key) => setActiveTab(key as "email" | "phone")}
|
|
items={[
|
|
{
|
|
key: "email",
|
|
label: "邮箱绑定",
|
|
children: (
|
|
<Form form={form} layout="vertical">
|
|
<Form.Item
|
|
name="email"
|
|
label="邮箱"
|
|
rules={[
|
|
{ required: true, message: "请输入邮箱" },
|
|
{ type: "email", message: "请输入有效的邮箱地址" },
|
|
]}
|
|
>
|
|
<Input placeholder="请输入邮箱地址" size="large" />
|
|
</Form.Item>
|
|
<Form.Item
|
|
name="email_code"
|
|
label="验证码"
|
|
rules={[{ required: true, message: "请输入验证码" }]}
|
|
>
|
|
<div style={{ display: "flex", gap: 8 }}>
|
|
<Input placeholder="请输入验证码" size="large" style={{ flex: 1 }} />
|
|
<Button
|
|
size="large"
|
|
onClick={handleSendCode}
|
|
loading={codeLoading}
|
|
disabled={codeDisabled}
|
|
>
|
|
{countdown > 0 ? `${countdown}s 后重发` : "发送验证码"}
|
|
</Button>
|
|
</div>
|
|
</Form.Item>
|
|
</Form>
|
|
),
|
|
},
|
|
{
|
|
key: "phone",
|
|
label: "手机绑定",
|
|
children: (
|
|
<Form form={form} layout="vertical">
|
|
<Form.Item
|
|
name="phone"
|
|
label="手机号"
|
|
rules={[
|
|
{ required: true, message: "请输入手机号" },
|
|
{ pattern: /^1[3-9]\d{9}$/, message: "请输入有效的手机号" },
|
|
]}
|
|
>
|
|
<Input placeholder="请输入手机号" size="large" />
|
|
</Form.Item>
|
|
<Form.Item
|
|
name="phone_code"
|
|
label="验证码"
|
|
rules={[{ required: true, message: "请输入验证码" }]}
|
|
>
|
|
<div style={{ display: "flex", gap: 8 }}>
|
|
<Input placeholder="请输入验证码" size="large" style={{ flex: 1 }} />
|
|
<Button
|
|
size="large"
|
|
onClick={handleSendCode}
|
|
loading={codeLoading}
|
|
disabled={codeDisabled}
|
|
>
|
|
{countdown > 0 ? `${countdown}s 后重发` : "发送验证码"}
|
|
</Button>
|
|
</div>
|
|
</Form.Item>
|
|
</Form>
|
|
),
|
|
},
|
|
]}
|
|
/>
|
|
|
|
<div style={{ marginTop: 16 }}>
|
|
<Button type="primary" block size="large" loading={loading} onClick={handleSubmit}>
|
|
确认绑定
|
|
</Button>
|
|
</div>
|
|
</Modal>
|
|
)
|
|
}
|
|
|
|
export default BindContactModal
|
|
export type { BindContactModalProps } from "./types"
|