接口调试

This commit is contained in:
huyunkun 2026-05-28 20:36:10 +08:00
parent 36fe597d86
commit 22c8c1b920
8 changed files with 65 additions and 84 deletions

View File

@ -229,8 +229,18 @@ export interface LoginResult {
memberId?: string
/** 会员编号 (后端主会员业务编号,会员权益页展示及发票接口路径参数均使用此值) */
memberNo?: string
/** 注册时间 (后端返回的会员注册时间,会员权益页展示) */
registerTime?: string
/** 会员过期时间 (后端返回的会员过期时间,会员权益页展示) */
expireTime?: string
/** 发票抬头 (后端返回的会员发票抬头,会员权益页展示) */
invoiceTitle?: string
/** 发票税号 (后端返回的会员发票税号,会员权益页展示) */
invoiceTaxNo?: string
/** 账号类型 */
accountType?: AccountType
/** 单位/组类型 (单位会员专用,用于在会员权益页/支付页区分事业单位与企业/其他) */
unitOrOrgType?: UnitOrOrgType
/** 用户昵称/单位名称 */
nickname?: string
/** 是否已充值/开通会员 (后端主字段,用于登录后跳转判断) */

View File

@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { Form, Input, Button, message, Card } from 'antd'
import { ArrowLeftOutlined, BankOutlined, LockOutlined } from '@ant-design/icons'
import { loginCompany } from '../api/auth'
import { UnitOrOrgType } from '../api/auth'
import { setToken, setUserId, setMemberNo } from '../utils/request'
import './CompanyLogin.css'
@ -39,6 +40,13 @@ const CompanyLogin = () => {
setMemberNo(memberNo)
}
// 根据后端返回的 unitOrOrgType 区分价格:
// - PUBLIC_INSTITUTION (事业单位) -> 1000 元/年
// - ENTERPRISE / OTHER (企业及其他机构) -> 2000 元/年
const unitOrOrgType = result?.unitOrOrgType as UnitOrOrgType | undefined
const amount =
unitOrOrgType === UnitOrOrgType.PUBLIC_INSTITUTION ? 1000.0 : 2000.0
// 根据后端返回的 isVip 判断会员状态
// - isVip = true: 已充值会员 -> 会员权益页(/member-valid)
// - isVip = false/未返回: 未充值 -> 支付页(/payment)
@ -48,8 +56,13 @@ const CompanyLogin = () => {
memberNo,
memberId: (result?.memberId as string) || '',
memberType: '单位会员',
amount: 999.0,
unitOrOrgType,
amount,
validPeriod: '1年',
registerTime: (result?.registerTime as string) || '',
expireTime: (result?.expireTime as string) || '',
invoiceTitle: (result?.invoiceTitle as string) || '',
invoiceTaxNo: (result?.invoiceTaxNo as string) || '',
}
message.success('登录成功!')

View File

@ -104,14 +104,7 @@ const CompanyRegister = () => {
<Form.Item
label="联系人姓名"
name="name"
rules={[
{ required: true, message: '请输入联系人姓名' },
{ min: 2, max: 20, message: '姓名长度应为 2-20 个字符' },
{
pattern: /^[\u4e00-\u9fa5A-Za-z·•\s]+$/,
message: '姓名仅支持中英文及·',
},
]}
rules={[{ required: true, message: '请输入联系人姓名' }]}
>
<Input placeholder="请输入联系人姓名" maxLength={20} />
</Form.Item>
@ -166,14 +159,7 @@ const CompanyRegister = () => {
<Form.Item
label="法人代表姓名"
name="legalPersonName"
rules={[
{ required: true, message: '请输入法人代表姓名' },
{ min: 2, max: 20, message: '姓名长度应为 2-20 个字符' },
{
pattern: /^[\u4e00-\u9fa5A-Za-z·•\s]+$/,
message: '姓名仅支持中英文及·',
},
]}
rules={[{ required: true, message: '请输入法人代表姓名' }]}
>
<Input placeholder="请输入法人代表姓名" maxLength={20} />
</Form.Item>
@ -204,17 +190,7 @@ const CompanyRegister = () => {
{/* 推荐人信息 */}
<Card title="推荐人信息" className="form-card" bordered={false}>
<Form.Item
label="推荐人姓名"
name="referrerName"
rules={[
{ min: 2, max: 20, message: '姓名长度应为 2-20 个字符' },
{
pattern: /^[\u4e00-\u9fa5A-Za-z·•\s]+$/,
message: '姓名仅支持中英文及·',
},
]}
>
<Form.Item label="推荐人姓名" name="referrerName">
<Input placeholder="请输入推荐人姓名" maxLength={20} />
</Form.Item>

View File

@ -48,8 +48,8 @@
}
.header-logo {
width: 120px;
height: 120px;
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: contain;
background: #fff;
@ -127,8 +127,8 @@
}
.card-icon {
width: 64px;
height: 64px;
width: 48px;
height: 48px;
border-radius: 50%;
display: flex;
align-items: center;
@ -137,6 +137,11 @@
flex-shrink: 0;
}
.card-icon svg {
width: 32px;
height: 32px;
}
.login-card.personal .card-icon,
.login-card.company .card-icon,
.login-card.rules .card-icon {
@ -263,8 +268,8 @@
}
.header-logo {
width: 100px;
height: 100px;
width: 64px;
height: 64px;
}
.login-card {
@ -272,13 +277,13 @@
}
.card-icon {
width: 56px;
height: 56px;
width: 44px;
height: 44px;
}
.card-icon svg {
width: 48px;
height: 48px;
width: 28px;
height: 28px;
}
.card-title {
@ -292,8 +297,8 @@
}
.header-logo {
width: 140px;
height: 140px;
width: 96px;
height: 96px;
}
.title {
@ -305,13 +310,13 @@
}
.card-icon {
width: 72px;
height: 72px;
width: 56px;
height: 56px;
}
.card-icon svg {
width: 72px;
height: 72px;
width: 40px;
height: 40px;
}
.card-title {

View File

@ -15,23 +15,10 @@ const MemberValid = () => {
memberNo = getMemberNo(),
memberId = '',
memberType = '个人会员',
amount = 99.00,
validPeriod = '1年'
amount = 150.00,
validPeriod = '5年',
} = memberData
// 计算有效期
const now = new Date()
const expireDate = new Date(now)
expireDate.setFullYear(expireDate.getFullYear() + 1)
const formatDate = (date: Date) => {
return date.toLocaleDateString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
})
}
const handleBack = () => {
navigate('/')
}
@ -93,14 +80,6 @@ const MemberValid = () => {
<span className="detail-label"></span>
<span className="detail-value">{validPeriod}</span>
</div>
<div className="detail-item">
<span className="detail-label"></span>
<span className="detail-value">{formatDate(now)}</span>
</div>
<div className="detail-item">
<span className="detail-label"></span>
<span className="detail-value">{formatDate(expireDate)}</span>
</div>
</div>
</Card>

View File

@ -9,8 +9,9 @@ import {
import './Payment.css'
/**
* ()
* TODO: 上线前改回 orderInfo.amount
* ()
* 使 orderInfo.amount(), PAY_AMOUNT
* TODO: 上线前将接口金额改回 orderInfo.amount
*/
const PAY_AMOUNT = 0.01
@ -42,9 +43,9 @@ const Payment = () => {
// 订单信息
const orderInfo = {
memberId: stateData.memberId || '',
memberType: stateData.memberType || '普通会员',
amount: stateData.amount || 99.0,
validPeriod: stateData.validPeriod || '1年',
memberType: stateData.memberType || '个人会员',
amount: stateData.amount || 150.0,
validPeriod: stateData.validPeriod || '5年',
isRenew: stateData.isRenew || false, // 是否是续费
}
@ -143,7 +144,7 @@ const Payment = () => {
</div>
<div className="order-item amount-item">
<span className="order-label">{orderInfo.isRenew ? '续费金额' : '应付金额'}</span>
<span className="order-value amount-value">¥{PAY_AMOUNT.toFixed(2)}</span>
<span className="order-value amount-value">¥{orderInfo.amount.toFixed(2)}</span>
</div>
</div>
</Card>
@ -177,7 +178,7 @@ const Payment = () => {
block
size="large"
>
¥{PAY_AMOUNT.toFixed(2)}
¥{orderInfo.amount.toFixed(2)}
</Button>
<p className="payment-tips">

View File

@ -47,8 +47,12 @@ const PersonalLogin = () => {
memberNo,
memberId: (result?.memberId as string) || '',
memberType: '个人会员',
amount: 99.0,
validPeriod: '1年',
amount: 150.0,
validPeriod: '5年',
registerTime: (result?.registerTime as string) || '',
expireTime: (result?.expireTime as string) || '',
invoiceTitle: (result?.invoiceTitle as string) || '',
invoiceTaxNo: (result?.invoiceTaxNo as string) || '',
}
message.success('登录成功!')

View File

@ -159,14 +159,7 @@ const PersonalRegister = () => {
<Form.Item
label="姓名"
name="name"
rules={[
{ required: true, message: '请输入姓名' },
{ min: 2, max: 20, message: '姓名长度应为 2-20 个字符' },
{
pattern: /^[\u4e00-\u9fa5A-Za-z·•\s]+$/,
message: '姓名仅支持中英文及·',
},
]}
rules={[{ required: true, message: '请输入姓名' }]}
>
<Input placeholder="请输入姓名" maxLength={20} />
</Form.Item>