feat: update admin navigation and configuration for local deployment, enhance user experience with direct API connections

This commit is contained in:
HouYunFei
2026-06-16 12:07:35 +08:00
parent 0d90465339
commit 8a66524ea7
83 changed files with 649 additions and 7173 deletions
+15 -3
View File
@@ -1,5 +1,3 @@
import { apiGet, compactApiParams } from "@/services/api/request";
export type AssetLibraryItem = {
id: string;
title: string;
@@ -29,5 +27,19 @@ export type AssetLibraryQuery = {
};
export async function fetchAssetLibrary(query: AssetLibraryQuery = {}) {
return apiGet<AssetLibraryResponse>("/api/assets", compactApiParams(query));
const items: AssetLibraryItem[] = [];
const filtered = items.filter((item) => {
const keyword = query.keyword?.trim().toLowerCase();
if (query.type && item.type !== query.type) return false;
if (query.tag?.length && !query.tag.some((tag) => item.tags.includes(tag))) return false;
if (!keyword) return true;
return [item.title, item.description, item.content, item.url, item.category, ...item.tags].join(" ").toLowerCase().includes(keyword);
});
const page = Math.max(1, Number(query.page) || 1);
const pageSize = Math.max(1, Number(query.pageSize) || filtered.length || 1);
return {
items: filtered.slice((page - 1) * pageSize, page * pageSize),
tags: Array.from(new Set(filtered.flatMap((item) => item.tags).filter(Boolean))),
total: filtered.length,
};
}