feat: 实现前端卡密管理界面
- 卡密列表展示与分页功能 - 单个/批量创建卡密 - 卡密删除与批量删除 - 卡密导出功能 (file-saver) - 启用/禁用状态切换 - 状态判断 (有效/已使用/已失效) - Toast 通知系统 (vue-sonner) - 登录页面错误提示优化 - 后端登录错误消息中文化
This commit is contained in:
58
frontend/src/api/accounts.ts
Normal file
58
frontend/src/api/accounts.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import request from './request'
|
||||
|
||||
export interface Account {
|
||||
id: number
|
||||
team_account_id: string
|
||||
name: string
|
||||
is_active: boolean
|
||||
seats_in_use: number
|
||||
seats_entitled: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface AccountsResponse {
|
||||
success: boolean
|
||||
data?: Account[]
|
||||
total?: number
|
||||
page?: number
|
||||
page_size?: number
|
||||
message?: string
|
||||
}
|
||||
|
||||
export interface AccountResponse {
|
||||
success: boolean
|
||||
data?: Account
|
||||
message?: string
|
||||
}
|
||||
|
||||
export interface CreateAccountRequest {
|
||||
team_account_id: string
|
||||
auth_token: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
export interface PaginationParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
}
|
||||
|
||||
export function getAccounts(params?: PaginationParams) {
|
||||
const searchParams = new URLSearchParams()
|
||||
if (params?.page) searchParams.set('page', String(params.page))
|
||||
if (params?.page_size) searchParams.set('page_size', String(params.page_size))
|
||||
const query = searchParams.toString()
|
||||
return request.get<AccountsResponse>(`/api/accounts${query ? `?${query}` : ''}`)
|
||||
}
|
||||
|
||||
export function createAccount(data: CreateAccountRequest) {
|
||||
return request.post<AccountResponse>('/api/accounts/create', data)
|
||||
}
|
||||
|
||||
export function refreshAccount(id: number) {
|
||||
return request.post<AccountResponse>(`/api/accounts/refresh?id=${id}`)
|
||||
}
|
||||
|
||||
export function deleteAccount(id: number) {
|
||||
return request.delete(`/api/accounts/delete?id=${id}`)
|
||||
}
|
||||
Reference in New Issue
Block a user