feat: 定义共享类型,改造用户 API(新增 wxLogin)
- 创建 src/api/types.ts,统一定义所有业务共享类型 - 改造 src/api/user.ts,类型迁移至 types.ts,新增 wxLogin 接口 - 更新 src/api/index.ts barrel 导出(card/order 模块待后续任务创建) - 同步更新 src/store/user.ts 适配新的 WxLoginResult 返回结构 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c3896f9227
commit
4cd1040e5d
@@ -0,0 +1,95 @@
|
||||
/** 用户信息 */
|
||||
export interface UserInfo {
|
||||
id: number
|
||||
nickname: string
|
||||
avatarUrl: string
|
||||
phone?: string
|
||||
}
|
||||
|
||||
/** 微信登录结果 */
|
||||
export interface WxLoginResult {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
userId: number
|
||||
}
|
||||
|
||||
/** 账号密码登录参数(降级方案) */
|
||||
export interface LoginParams {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
/** 年卡基本信息 */
|
||||
export interface CardInfo {
|
||||
id: string
|
||||
name: string
|
||||
price: number
|
||||
originalPrice: number
|
||||
coverImage: string
|
||||
description: string
|
||||
scenicCount: number
|
||||
}
|
||||
|
||||
/** 年卡详情 */
|
||||
export interface CardDetail extends CardInfo {
|
||||
benefits: string[]
|
||||
scenicSpots: ScenicSpot[]
|
||||
validDays: number
|
||||
detail: string
|
||||
}
|
||||
|
||||
/** 景区信息 */
|
||||
export interface ScenicSpot {
|
||||
id: string
|
||||
name: string
|
||||
image: string
|
||||
address?: string
|
||||
}
|
||||
|
||||
/** 我的年卡 */
|
||||
export interface MyCard {
|
||||
id: string
|
||||
cardId: string
|
||||
cardName: string
|
||||
coverImage: string
|
||||
userName: string
|
||||
expireDate: string
|
||||
status: 'active' | 'expired' | 'inactive'
|
||||
}
|
||||
|
||||
/** 激活年卡参数 */
|
||||
export interface ActivateParams {
|
||||
realName: string
|
||||
idCard: string
|
||||
phone: string
|
||||
}
|
||||
|
||||
/** 入园码信息 */
|
||||
export interface QrCodeInfo {
|
||||
qrCode: string
|
||||
expireTime: string
|
||||
cardName: string
|
||||
userName: string
|
||||
expireDate: string
|
||||
}
|
||||
|
||||
/** 订单信息 */
|
||||
export interface OrderInfo {
|
||||
id: string
|
||||
cardId: string
|
||||
cardName: string
|
||||
price: number
|
||||
status: 'pending' | 'paid' | 'cancelled'
|
||||
createTime: string
|
||||
}
|
||||
|
||||
/** 创建订单参数 */
|
||||
export interface CreateOrderParams {
|
||||
cardId: string
|
||||
}
|
||||
|
||||
/** 模拟支付结果 */
|
||||
export interface MockPayResult {
|
||||
success: boolean
|
||||
orderId: string
|
||||
}
|
||||
Reference in New Issue
Block a user