refactor(data): consolidate data layer under services namespace

- Move src/data/{api,dto,schemas} directories to src/data/services/*
- Update all relative imports across the codebase to reference new paths
- Use CSS color tokens for splash button gradient in splash-button.module.css
- Add responsive sizes attribute to splash background image
- Add JSDoc documentation to splash-background component referencing original Dart implementation
This commit is contained in:
2026-06-09 16:44:05 +08:00
parent 763bec4e74
commit 661e417619
98 changed files with 57 additions and 44 deletions
+117
View File
@@ -0,0 +1,117 @@
/**
* API 路径管理
* 统一管理所有接口路径
* 原始 Dart: lib/data/services/api/api_path.dart
*/
export class ApiPath {
private constructor() {}
// API 基础路径
private static readonly _baseUrl = "/api";
// ============ 功能模块分组 ============
private static readonly _auth = `${ApiPath._baseUrl}/auth`;
private static readonly _verify = `${ApiPath._baseUrl}/verify`;
private static readonly _user = `${ApiPath._baseUrl}/user`;
private static readonly _payment = `${ApiPath._baseUrl}/payment`;
private static readonly _chat = `${ApiPath._baseUrl}/chat`;
// ============ 认证相关 ============
/** 发送验证码 */
static readonly sendCode = `${ApiPath._verify}/send`;
/** 邮箱密码登录 */
static readonly emailLogin = `${ApiPath._auth}/login`;
/** 注册 */
static readonly register = `${ApiPath._auth}/register`;
/** 设备自动登录 */
static readonly guestLogin = `${ApiPath._auth}/guest`;
/** Apple 登录 */
static readonly appleLogin = `${ApiPath._auth}/login/apple`;
/** Google 登录 */
static readonly googleLogin = `${ApiPath._auth}/login/google`;
/** Facebook 登录 */
static readonly facebookLogin = `${ApiPath._auth}/login/facebook`;
/** Facebook ID 登录(v7.0 新增) */
static readonly facebookIdLogin = `${ApiPath._auth}/login/facebook/by-id`;
/** 刷新 Token */
static readonly refresh = `${ApiPath._auth}/refresh`;
/** 退出登录 */
static readonly logout = `${ApiPath._auth}/logout`;
/** 获取当前用户信息 */
static readonly getCurrentUser = `${ApiPath._auth}/me`;
// ============ 用户相关 ============
/** 获取用户统计信息 */
static readonly userStats = `${ApiPath._user}/stats`;
/** 获取个人信息(与 /auth/me 等价) */
static readonly userProfile = `${ApiPath._user}/profile`;
/** 更新个人信息 */
static readonly updateProfile = `${ApiPath._user}/profile`;
/** 上传头像 */
static readonly userAvatar = `${ApiPath._user}/avatar`;
/** 查询积分余额 */
static readonly userCredits = `${ApiPath._user}/credits`;
/** 查询积分操作历史 */
static readonly userCreditsHistory = `${ApiPath._user}/credits/history`;
// ============ 支付相关 ============
/** 创建充值订单 */
static readonly paymentCreateOrder = `${ApiPath._payment}/order/create`;
/** 查询订单状态 */
static readonly paymentOrderStatus = `${ApiPath._payment}/order/status`;
/** 获取商品套餐列表 */
static readonly paymentProducts = `${ApiPath._payment}/products`;
/** 申请退款 */
static readonly paymentRefund = `${ApiPath._payment}/refund`;
/** 获取商品详情路径 */
static getPaymentProductDetail(productId: string): string {
return `${ApiPath.paymentProducts}/${productId}`;
}
// ============ 聊天相关 ============
/** 发送消息 */
static readonly chatSend = `${ApiPath._chat}/send`;
/** 获取聊天历史 */
static readonly chatHistory = `${ApiPath._chat}/history`;
/** 语音转文字(STT */
static readonly chatStt = `${ApiPath._chat}/stt`;
/** 同步游客消息 */
static readonly chatSync = `${ApiPath._chat}/sync`;
/** 上传图片 */
static readonly chatUploadImage = `${ApiPath._chat}/upload-image`;
// ============ 数据看板相关 ============
private static readonly _metrics = `${ApiPath._baseUrl}/metrics`;
/** 上报 PWA 事件 */
static readonly metricsPwaEvent = `${ApiPath._metrics}/pwa/event`;
// ============ 数据上报相关(v7.0 新增) ============
private static readonly _data = `${ApiPath._baseUrl}/data`;
/** 上报用户信息 */
static readonly reportUserInfo = `${ApiPath._data}/report-user-info`;
}