feat: 更新文章功能和相关依赖

- 新增文章详情页面,支持根据文章 ID 加载和展示文章内容
- 添加文章卡片组件,展示推荐文章的标题、封面和阅读量
- 更新文章服务,支持获取文章列表和根据 ID 获取文章详情
- 集成腾讯云 COS SDK,支持文件上传功能
- 优化打卡功能,支持按日期加载和展示打卡记录
- 更新相关依赖,确保项目兼容性和功能完整性
- 调整样式以适应新功能的展示和交互
This commit is contained in:
richarjiang
2025-08-14 16:03:19 +08:00
parent 532cf251e2
commit 5d09cc05dc
24 changed files with 1953 additions and 513 deletions

View File

@@ -1,5 +1,5 @@
export const COS_BUCKET: string = '';
export const COS_REGION: string = '';
export const COS_BUCKET: string = 'plates-1251306435';
export const COS_REGION: string = 'ap-guangzhou';
export const COS_PUBLIC_BASE: string = '';
// 统一的对象键前缀(可按业务拆分)
@@ -19,8 +19,16 @@ export function buildCosKey(params: { prefix?: string; ext?: string; userId?: st
}
export function buildPublicUrl(key: string): string {
if (!COS_PUBLIC_BASE) return '';
return `${COS_PUBLIC_BASE.replace(/\/$/, '')}/${key.replace(/^\//, '')}`;
const cleanedKey = key.replace(/^\//, '');
if (COS_PUBLIC_BASE && COS_PUBLIC_BASE.trim()) {
return `${COS_PUBLIC_BASE.replace(/\/$/, '')}/${cleanedKey}`;
}
// 回退:使用 COS 默认公网域名
// 例如: https://<bucket>.cos.<region>.myqcloud.com/<key>
if (COS_BUCKET && COS_REGION) {
return `https://${COS_BUCKET}.cos.${COS_REGION}.myqcloud.com/${cleanedKey}`;
}
return '';
}