fix: support local entry module icons
This commit is contained in:
@@ -48,6 +48,18 @@ interface LoaderData {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
function resolveModuleLogoUrl(path?: string | null): string | null {
|
||||
if (!path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (path.startsWith("/images/") || path.startsWith("http://") || path.startsWith("https://")) {
|
||||
return path;
|
||||
}
|
||||
|
||||
return `${DOCUMENT_URL}${path}`;
|
||||
}
|
||||
|
||||
// 🔑 客户端加载函数 - 在浏览器端执行,axios-client 会自动添加 JWT
|
||||
export async function clientLoader({ request }: ClientLoaderFunctionArgs) {
|
||||
try {
|
||||
@@ -259,11 +271,10 @@ export default function EntryModulesList() {
|
||||
title: 'Logo图片',
|
||||
width: '150px',
|
||||
render: (_: any, record: EntryModule) => {
|
||||
if (!record.path) {
|
||||
const logoUrl = resolveModuleLogoUrl(record.path);
|
||||
if (!logoUrl) {
|
||||
return <span className="text-gray-400">未上传</span>;
|
||||
}
|
||||
|
||||
const logoUrl = `${DOCUMENT_URL}${record.path}`;
|
||||
const hasFailed = failedImages.has(record.id!);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user