feat: 更新文章功能和相关依赖
- 新增文章详情页面,支持根据文章 ID 加载和展示文章内容 - 添加文章卡片组件,展示推荐文章的标题、封面和阅读量 - 更新文章服务,支持获取文章列表和根据 ID 获取文章详情 - 集成腾讯云 COS SDK,支持文件上传功能 - 优化打卡功能,支持按日期加载和展示打卡记录 - 更新相关依赖,确保项目兼容性和功能完整性 - 调整样式以适应新功能的展示和交互
This commit is contained in:
23
services/recommendations.ts
Normal file
23
services/recommendations.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { api } from '@/services/api';
|
||||
|
||||
export enum RecommendationType {
|
||||
Article = 'article',
|
||||
Checkin = 'checkin',
|
||||
}
|
||||
|
||||
export type RecommendationCard = {
|
||||
id: string;
|
||||
type: RecommendationType;
|
||||
title?: string;
|
||||
coverUrl: string;
|
||||
articleId?: string;
|
||||
subtitle?: string;
|
||||
extra?: Record<string, any>;
|
||||
};
|
||||
|
||||
export async function fetchRecommendations(): Promise<RecommendationCard[]> {
|
||||
// 后端返回 BaseResponseDto<data>,services/api 会自动解出 data 字段
|
||||
return api.get<RecommendationCard[]>(`/recommendations/list`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user