bug修复
This commit is contained in:
1 parent
3893b25848
commit
de8d37e0e6
5 files changed
+542
-20
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import PageEditor from "./PageEditor";
|
||||
import { apiPost } from "./api";
|
||||
|
||||
const SITE = "SIT0000000000001";
|
||||
|
||||
/** 关于我们固定页面设置入口。 */
|
||||
export default function AboutUsSettingsPage() {
|
||||
const [pageCode, setPageCode] = useState<string>();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
void apiPost("/pages/list", { siteCode: SITE })
|
||||
.then((data) => {
|
||||
const page = (data.items || []).find((item: { systemPageType?: string }) => item.systemPageType === "ABOUT_US");
|
||||
setPageCode(page?.pageCode);
|
||||
})
|
||||
.catch((cause) => setError(cause instanceof Error ? cause.message : "关于我们页面加载失败"))
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
if (loading) return <div className="empty"><strong>正在加载关于我们页面</strong></div>;
|
||||
if (error) return <div className="notice">{error}</div>;
|
||||
return <PageEditor key={pageCode || "new-about-us"} pageCode={pageCode} onBack={() => undefined} fixedSystemPageType="ABOUT_US" standaloneTitle="关于我们设置" onSaved={setPageCode}/>;
|
||||
}
|
||||
Reference in new issue
Block a user