bf3ffeb4ef
- 新增 pages/content(资讯中心):类别分段tab(政策/资讯/技能/动态) + published列表;政策分类下提供「政策测评」入口(原测评页保留非tab) - 新增 pages/content-detail(资讯详情:title/summary/body) - utils/content.js:listContent(cat)/cachedContent/getContent(公开 /opc/content) - app.config:tab 政策→资讯(pages/content)、注册 content/content-detail、policy 保留注册 - custom-tab-bar:政策→资讯 Co-Authored-By: Claude <noreply@anthropic.com>
27 lines
818 B
JavaScript
27 lines
818 B
JavaScript
import { request, cachedRequest } from './api';
|
|
|
|
/** 资讯中心类别 */
|
|
export const CONTENT_CATS = [
|
|
{ key: 'policy', label: '政策' },
|
|
{ key: 'news', label: '资讯' },
|
|
{ key: 'skill', label: '技能' },
|
|
{ key: 'dynamic', label: '动态' },
|
|
];
|
|
|
|
/** 获取某类别已发布资讯(公开浏览) */
|
|
export async function listContent(type) {
|
|
const r = await request('GET', `/opc/content?type=${type}`, {}, false);
|
|
return Array.isArray(r?.items) ? r.items : [];
|
|
}
|
|
|
|
/** 带短缓存的资讯列表(切换分类时避免跳变) */
|
|
export function cachedContent(type) {
|
|
return cachedRequest('GET', `/opc/content?type=${type}`, 30000, {}, false);
|
|
}
|
|
|
|
/** 资讯详情 */
|
|
export async function getContent(id) {
|
|
const r = await request('GET', `/opc/content/${id}`, {}, false);
|
|
return r || null;
|
|
}
|