fix: support local entry module icons
This commit is contained in:
@@ -79,6 +79,18 @@ const AREA_OPTIONS = [
|
||||
{ value: "省局", label: "省局" }
|
||||
];
|
||||
|
||||
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}`;
|
||||
}
|
||||
|
||||
// 入口模块新建/编辑组件
|
||||
export default function EntryModuleNew() {
|
||||
const navigate = useNavigate();
|
||||
@@ -106,7 +118,7 @@ export default function EntryModuleNew() {
|
||||
);
|
||||
const [logoFile, setLogoFile] = useState<File | null>(null);
|
||||
const [logoPreview, setLogoPreview] = useState<string | null>(
|
||||
module?.path ? `${DOCUMENT_URL}${module.path}` : null
|
||||
resolveModuleLogoUrl(module?.path)
|
||||
);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user