将 web-admin 从子模块改为仓库内普通目录,便于单仓克隆与维护。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-05-12 16:41:08 +08:00
1 parent 2e9d020d50
commit c87732fcd5
515 files changed
+74372 -1

No files matched your search

@@ -0,0 +1,24 @@
import { fetchCategoryList } from '@/api/admin'
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
let cachedFlatCategories: any[] = []
let cachedAt = 0
const CACHE_TTL = 60 * 1000
export async function ensureCategoryPathDataLoaded(force = false): Promise<void> {
if (!force && cachedFlatCategories.length > 0 && Date.now() - cachedAt < CACHE_TTL) return
const all = await fetchAllPagedRecords((page, pageSize) => fetchCategoryList({ page, pageSize }))
cachedFlatCategories = all || []
cachedAt = Date.now()
}
export function formatCategoryPathLabel(categoryId: unknown, fallbackName?: unknown): string {
const cid = String(categoryId ?? '').trim()
const fallback = String(fallbackName ?? '').trim()
if (!cid) return fallback || '—'
const path = buildTreePathLabelFromFlat(cid, cachedFlatCategories)
if (path) return path
return fallback || '—'
}