export type KnowledgeCategory = | 'exam_policy' | 'school_intro' | 'major_guide' | 'study_method' | 'experience' | 'policy' | 'company' | 'guide' | 'announcement' export interface KnowledgeArticle { id: string title: string summary: string content: string category: KnowledgeCategory tags: string[] coverImage?: string author?: string isTop?: boolean publishedAt?: string createdAt?: string updatedAt?: string viewCount: number } export const categoryLabel: Record = { exam_policy: '考试政策', school_intro: '院校介绍', major_guide: '专业指南', study_method: '复习规划', experience: '学长经验', policy: '政策解读', company: '集团新闻', guide: '备考指南', announcement: '公告通知', } export const categories: { key: KnowledgeCategory | ''; label: string }[] = [ { key: '', label: '全部' }, { key: 'exam_policy', label: '考试政策' }, { key: 'school_intro', label: '院校专业' }, { key: 'major_guide', label: '专业指南' }, { key: 'study_method', label: '复习规划' }, { key: 'experience', label: '学长经验' }, ] export function formatDate(dateStr?: string) { if (!dateStr) return '' return new Date(dateStr).toLocaleDateString('zh-CN', { year: 'numeric', month: 'long', day: 'numeric' }) } export function formatViewCount(count: number) { if (count >= 10000) return `${(count / 10000).toFixed(1)}w+` if (count >= 1000) return `${(count / 1000).toFixed(1)}k` return String(count) }