feat: Features架构迁移 - P0和P1部分完成
## 完成的工作 ### P0: 基础设施准备 - 创建 features/ 和 shared/ 目录结构 - 迁移共享资源:API基础设施、工具函数、类型定义 - 迁移通用composables:useMoney, useSmsCountdown, usePricingCalculator - 迁移全局样式文件 - 建立模块化导出系统 ### P1.1: 钱包模块 (wallet) - 迁移 API: wallet.ts - 迁移 Views: WalletView.vue - 新增 Composable: useWallet.ts (封装钱包状态管理) - 更新导入路径到 shared/ ### P1.2: 聊天模块 (chats) - 迁移 API: chats.ts - 迁移 Views: ChatView, MessagesView (桌面+移动) - 迁移 Composables: useChatSSE.ts - 迁移 Components: ChatAttachmentImage.vue - 更新导入路径到 shared/ ## 技术改进 - 修复 shared/composables 导出问题 (default → 命名导出) - 修复 shared/api/client.ts 类型导入路径 - 建立清晰的模块边界和导出规范 ## 文档 - 添加完整的迁移计划文档 - 添加进度跟踪文档 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
10acca637e
commit
b5903a169f
@@ -0,0 +1,175 @@
|
||||
import type {
|
||||
BalanceType,
|
||||
DisputeStatus,
|
||||
HandoffStatus,
|
||||
LedgerDirection,
|
||||
ListingReviewStatus,
|
||||
ListingStatus,
|
||||
OrderStatus,
|
||||
RealnameStatusValue,
|
||||
RiskStatus,
|
||||
SettlementStatus,
|
||||
UserStatus,
|
||||
WalletStatus,
|
||||
} from '@/types/status'
|
||||
|
||||
const listingStatusMap: Record<ListingStatus, string> = {
|
||||
draft: '草稿',
|
||||
published: '已上架',
|
||||
rented: '租用中',
|
||||
offline: '已下架',
|
||||
abnormal: '异常',
|
||||
}
|
||||
|
||||
const listingReviewStatusMap: Record<ListingReviewStatus, string> = {
|
||||
none: '未提交',
|
||||
pending: '待审核',
|
||||
approved: '已通过',
|
||||
rejected: '已拒绝',
|
||||
}
|
||||
|
||||
const orderStatusMap: Record<OrderStatus, string> = {
|
||||
pending_confirm: '待确认',
|
||||
pending_payment: '待支付',
|
||||
pending_handoff: '待交接',
|
||||
renting: '使用中',
|
||||
overdue: '已逾期',
|
||||
pending_return_confirm: '待结账确认',
|
||||
pending_checkout_confirm: '待号主确认结账',
|
||||
pending_checkout_accept: '待租客确认修正',
|
||||
checkout_disputing: '结账争议中',
|
||||
completed: '已完成',
|
||||
cancelled: '已取消',
|
||||
closed: '已关闭',
|
||||
disputing: '申诉中',
|
||||
abnormal: '异常',
|
||||
}
|
||||
|
||||
const handoffStatusMap: Record<HandoffStatus, string> = {
|
||||
pending_owner: '待号主交接',
|
||||
pending_renter_confirm: '待租客确认',
|
||||
received: '已确认收号',
|
||||
pending_owner_return_confirm: '待号主确认结账',
|
||||
pending_owner_checkout: '待号主确认结账',
|
||||
pending_renter_checkout: '待租客确认修正',
|
||||
checkout_disputed: '结账争议中',
|
||||
returned: '已归还',
|
||||
cancelled: '已取消',
|
||||
owner_timeout: '号主交接超时',
|
||||
renter_confirm_timeout: '租客确认超时',
|
||||
return_overdue: '归还逾期',
|
||||
owner_return_confirm_timeout: '号主确认结账超时',
|
||||
owner_checkout_confirm_timeout: '号主确认结账超时',
|
||||
admin_closed: '客服关闭',
|
||||
admin_abnormal: '客服标记异常',
|
||||
arbitrated: '已仲裁',
|
||||
}
|
||||
|
||||
const settlementStatusMap: Record<SettlementStatus, string> = {
|
||||
unsettled: '未结算',
|
||||
pending: '待结算',
|
||||
frozen: '冻结中',
|
||||
settled: '已结算',
|
||||
refunded: '已退款',
|
||||
cancelled: '已取消',
|
||||
closed: '已关闭',
|
||||
disputed: '争议中',
|
||||
arbitrated: '已仲裁',
|
||||
}
|
||||
|
||||
const realnameStatusMap: Partial<Record<RealnameStatusValue, string>> = {
|
||||
unverified: '未认证',
|
||||
pending: '认证中',
|
||||
verified: '已认证',
|
||||
rejected: '认证失败',
|
||||
}
|
||||
|
||||
const userStatusMap: Record<UserStatus, string> = {
|
||||
active: '正常',
|
||||
frozen: '已冻结',
|
||||
disabled: '已禁用',
|
||||
}
|
||||
|
||||
const riskStatusMap: Record<RiskStatus, string> = {
|
||||
normal: '正常',
|
||||
watch: '观察',
|
||||
restricted: '受限',
|
||||
blocked: '已拦截',
|
||||
}
|
||||
|
||||
const disputeStatusMap: Record<DisputeStatus, string> = {
|
||||
open: '待处理',
|
||||
processing: '处理中',
|
||||
resolved: '已处理',
|
||||
closed: '已关闭',
|
||||
}
|
||||
|
||||
const walletStatusMap: Record<WalletStatus, string> = {
|
||||
active: '正常',
|
||||
frozen: '已冻结',
|
||||
disabled: '已禁用',
|
||||
}
|
||||
|
||||
const ledgerDirectionMap: Record<LedgerDirection, string> = {
|
||||
in: '收入',
|
||||
out: '支出',
|
||||
freeze: '冻结',
|
||||
unfreeze: '解冻',
|
||||
}
|
||||
|
||||
const balanceTypeMap: Record<BalanceType, string> = {
|
||||
available: '可用余额',
|
||||
frozen: '冻结余额',
|
||||
}
|
||||
|
||||
function readLabel(map: Record<string, string>, value: string) {
|
||||
return map[value] || value || '-'
|
||||
}
|
||||
|
||||
export function listingStatusLabel(status: string) {
|
||||
return readLabel(listingStatusMap, status)
|
||||
}
|
||||
|
||||
export function listingReviewStatusLabel(status: string) {
|
||||
return readLabel(listingReviewStatusMap, status)
|
||||
}
|
||||
|
||||
export function orderStatusLabel(status: string) {
|
||||
return readLabel(orderStatusMap, status)
|
||||
}
|
||||
|
||||
export function handoffStatusLabel(status: string) {
|
||||
return readLabel(handoffStatusMap, status)
|
||||
}
|
||||
|
||||
export function settlementStatusLabel(status: string) {
|
||||
return readLabel(settlementStatusMap, status)
|
||||
}
|
||||
|
||||
export function realnameStatusLabel(status: string) {
|
||||
return readLabel(realnameStatusMap, status)
|
||||
}
|
||||
|
||||
export function userStatusLabel(status: string) {
|
||||
return readLabel(userStatusMap, status)
|
||||
}
|
||||
|
||||
export function riskStatusLabel(status: string) {
|
||||
return readLabel(riskStatusMap, status)
|
||||
}
|
||||
|
||||
export function disputeStatusLabel(status: string) {
|
||||
return readLabel(disputeStatusMap, status)
|
||||
}
|
||||
|
||||
export function walletStatusLabel(status: string) {
|
||||
return readLabel(walletStatusMap, status)
|
||||
}
|
||||
|
||||
export function ledgerDirectionLabel(direction: string) {
|
||||
return readLabel(ledgerDirectionMap, direction)
|
||||
}
|
||||
|
||||
export function balanceTypeLabel(type: string) {
|
||||
return readLabel(balanceTypeMap, type)
|
||||
}
|
||||
Reference in New Issue
Block a user