= { store: ["店铺信息", "维护网站名称、行业和店铺介绍。"], account: ["账户与安全", "维护登录账户、显示名称和密码。"], social: ["社媒渠道", "配置产品分享入口和全站右侧悬浮联系渠道。"] };
return
diff --git a/web-admin/src/main.tsx b/web-admin/src/main.tsx
index b1769af..e69d013 100644
--- a/web-admin/src/main.tsx
+++ b/web-admin/src/main.tsx
@@ -43,14 +43,16 @@ import NavigationManager from "./NavigationManager";
import AgreementSettingsPage from "./AgreementSettingsPage";
import AboutUsSettingsPage from "./AboutUsSettingsPage";
import DashboardPage from "./DashboardPage";
+import CrmCustomerPage from "./CrmCustomerPage";
import { apiPost } from "./api";
import { statusLabel } from "./statusLabels";
+import { ensureCurrentSiteCode, getCurrentSiteCode, setCurrentSiteCode, type SiteOption } from "./siteContext";
const SITE_WEB =
window.location.hostname === "admin.steliro.com"
? "https://site.steliro.com"
: "http://localhost:5174";
-const SITE = "SIT0000000000001";
+const SITE = getCurrentSiteCode();
type Section =
| "dashboard"
| "products"
@@ -74,7 +76,8 @@ type Section =
| "inquiry-settings"
| "settings-store"
| "settings-account"
- | "settings-social";
+ | "settings-social"
+ | "crm-customers";
type EditorialSection = "NEWS" | "CASE" | "HELP";
type ContentEditorState = {
contentType: EditorialSection;
@@ -141,6 +144,7 @@ const systemSettingsMenus = [
{ key: "settings-store" as Section, label: "店铺信息", icon: Store },
{ key: "settings-account" as Section, label: "账户与安全", icon: UserRound },
{ key: "settings-social" as Section, label: "社媒渠道", icon: Share2 },
+ { key: "inquiry-settings" as Section, label: "询盘设置", icon: Settings },
];
const sectionLabels: Record = {
dashboard: "数据概览",
@@ -166,6 +170,7 @@ const sectionLabels: Record = {
"settings-store": "店铺信息",
"settings-account": "账户与安全",
"settings-social": "社媒渠道",
+ "crm-customers": "客户列表",
};
function App({
account,
@@ -204,6 +209,40 @@ function App({
const [query, setQuery] = useState("");
const [open, setOpen] = useState(false);
const [saving, setSaving] = useState(false);
+ const [siteDialogOpen, setSiteDialogOpen] = useState(false);
+ const [siteCreating, setSiteCreating] = useState(false);
+ const [siteError, setSiteError] = useState("");
+ const [siteForm, setSiteForm] = useState({
+ siteName: "",
+ industry: "",
+ description: "",
+ timezone: "Asia/Shanghai",
+ });
+ const currentSiteCode = getCurrentSiteCode();
+ /** 切换当前站点并重新加载所有站点级数据。 */
+ const switchSite = (siteCode: string) => {
+ if (siteCode === currentSiteCode) return;
+ setCurrentSiteCode(siteCode);
+ window.location.assign("/");
+ };
+ /** 创建站点并自动切换到新站点。 */
+ const createSite = async () => {
+ try {
+ setSiteCreating(true);
+ setSiteError("");
+ const previousCodes = new Set(account.sites.map((site) => site.siteCode));
+ await apiPost("/sites/create", siteForm);
+ const result = await apiPost<{ items: SiteOption[] }>("/sites/list", {});
+ const site = result.items.find((item) => !previousCodes.has(item.siteCode));
+ if (!site) throw new Error("站点已创建,但未能读取新站点信息,请刷新后重试");
+ setCurrentSiteCode(site.siteCode);
+ window.location.assign("/");
+ } catch (cause) {
+ setSiteError(cause instanceof Error ? cause.message : "站点创建失败");
+ } finally {
+ setSiteCreating(false);
+ }
+ };
const resolveProductRoute = () => {
if (window.location.pathname === "/products/new") return "";
const match = window.location.pathname.match(/^\/products\/([^/]+)\/edit$/);
@@ -226,6 +265,7 @@ function App({
const [contentMenuOpen, setContentMenuOpen] = useState(true);
const [frontSiteMenuOpen, setFrontSiteMenuOpen] = useState(true);
const [systemSettingsOpen, setSystemSettingsOpen] = useState(true);
+ const [crmMenuOpen, setCrmMenuOpen] = useState(true);
const navigateSection = (next: Section) => {
setEditingProduct(null);
setEditingContent(null);
@@ -447,6 +487,30 @@ function App({
Shoplix运营中心
+
+
+
+
+
+
+