Files
training/website/src/services/content.js
T
Pine 05d19aed0f feat(content): 网站 资讯中心(分类feed) + 同步小程序
- 新增 user/Content.jsx:类别分段tab(政策/资讯/技能/动态) + published列表,点击展开正文
- services/content.js:listContent(cat)
- App.jsx 路由 content、data/site.js 导航加「资讯」、Home 申请区加「资讯中心」入口
- PolicyTest(政策测评) 保留;遵守 C端网页↔小程序同步约束

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-27 14:12:22 +08:00

20 lines
532 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** C 端资讯(公开浏览 /opc/content */
const API_BASE = 'https://opc.pinesound.cn';
export const CONTENT_CATS = [
{ key: 'policy', label: '政策' },
{ key: 'news', label: '资讯' },
{ key: 'skill', label: '技能' },
{ key: 'dynamic', label: '动态' },
];
export async function listContent(type) {
try {
const res = await fetch(`${API_BASE}/opc/content?type=${type}`);
const d = await res.json().catch(() => ({}));
return Array.isArray(d.items) ? d.items : [];
} catch {
return [];
}
}