## P2.1: 商品浏览模块(listings)✅ ### 完整迁移(23个文件) - API: listings.ts, listingOptions.ts, homeConfig.ts - Views: 5个页面(HomeView, ListingsView, ListingDetailView + 移动端2个) - Composables: 3个(useHomeFilters, useFilterOptions, useListingQuery) - Components: 9个(ListingCard, 各种过滤器组件) - Tests: 2个测试文件 **功能:** - 首页浏览、商品列表、详情查看 - 高级筛选(服务器、等级、哈夫币、皮肤等) - 排序和分区功能 - 横幅、公告、统计展示 **技术改进:** - 更新所有导入路径到 @/shared/ - 建立清晰的模块导出 --- ## P2.2: 用户认证模块(auth)✅ ### 完整迁移(12个文件) - API: auth.ts, realname.ts, notifications.ts - Views: 8个页面(登录、注册、个人资料、实名认证、通知 + 移动端) - 模块导出 **功能:** - 用户注册、登录、Token管理 - 实名认证、风险检查 - 个人资料编辑、头像上传 - 消息/通知中心 **技术改进:** - 统一 API 导入路径 - 类型安全增强 --- ## 里程碑 🎉 **P2 阶段完成!** **累计完成:** 6个模块 - ✅ P0: shared(基础设施)- 22个文件 - ✅ P1: wallet, chats, orders - 24个文件 - ✅ P2: listings, auth - 35个文件 **总计:** 81个文件已迁移 **剩余:** P3阶段(seller, disputes, admin)+ 清理工作 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
719 B
TypeScript
28 lines
719 B
TypeScript
import { apiClient } from './client'
|
|
|
|
import type { ApiResponse, PaginatedResult } from './types'
|
|
|
|
export interface NotificationItem {
|
|
id: number
|
|
user_id: number
|
|
type: string
|
|
title: string
|
|
content: string
|
|
biz_type: string
|
|
biz_id?: number
|
|
read_at?: string
|
|
created_at: string
|
|
}
|
|
|
|
export async function fetchNotifications(page = 1, pageSize = 20) {
|
|
const { data } = await apiClient.get<ApiResponse<PaginatedResult<NotificationItem>>>('/notifications', {
|
|
params: { page, page_size: pageSize },
|
|
})
|
|
return data.data
|
|
}
|
|
|
|
export async function markNotificationRead(id: number) {
|
|
const { data } = await apiClient.post<ApiResponse<{ read: boolean }>>(`/notifications/${id}/read`)
|
|
return data.data
|
|
}
|