账户登录
This commit is contained in:
1 parent
8e80e26c91
commit
833161e34c
84 files changed
+814
-142
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { ArrowLeft, Edit3, Plus, Save, Trash2 } from "lucide-react";
|
||||
import { ArrowLeft, Edit3, Plus, Save, Trash2, X } from "lucide-react";
|
||||
import { API } from "./api";
|
||||
|
||||
const SITE = "SIT0000000000001";
|
||||
@@ -53,7 +53,7 @@ const emptyForm = (): Form => ({
|
||||
privacyPageCode: "",
|
||||
status: "DRAFT",
|
||||
sortNo: 30,
|
||||
fields: [emptyField()],
|
||||
fields: [],
|
||||
});
|
||||
const sceneLabels: Record<string, string> = {
|
||||
PRODUCT: "产品详情页按钮",
|
||||
@@ -62,6 +62,21 @@ const sceneLabels: Record<string, string> = {
|
||||
CONTENT: "新闻、案例和帮助详情页",
|
||||
PAGE: "固定或自定义页面",
|
||||
};
|
||||
const fieldTypeLabels: Record<string, string> = {
|
||||
TEXT: "单行文本",
|
||||
TEXTAREA: "多行文本",
|
||||
EMAIL: "邮箱",
|
||||
PHONE: "电话",
|
||||
NUMBER: "数字",
|
||||
SINGLE_SELECT: "下拉单选",
|
||||
MULTI_SELECT: "下拉多选",
|
||||
RADIO: "单选框",
|
||||
CHECKBOX: "复选框",
|
||||
FILE: "文件",
|
||||
IMAGE: "图片上传",
|
||||
COUNTRY: "国家",
|
||||
};
|
||||
const optionFieldTypes = new Set(["SINGLE_SELECT", "MULTI_SELECT", "RADIO", "CHECKBOX"]);
|
||||
|
||||
async function post(path: string, body: unknown) {
|
||||
const response = await fetch(API + path, {
|
||||
@@ -97,6 +112,7 @@ export default function InquirySettingsPanel() {
|
||||
const [editing, setEditing] = useState<Form | null>(null);
|
||||
const [notice, setNotice] = useState("");
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [fieldEditor, setFieldEditor] = useState<{ index: number | null; value: Field } | null>(null);
|
||||
const loadForms = () =>
|
||||
post("/inquiries/forms/list", { siteCode: SITE })
|
||||
.then((data) => setForms(data.items || []))
|
||||
@@ -139,14 +155,17 @@ export default function InquirySettingsPanel() {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
const updateField = (index: number, value: Partial<Field>) =>
|
||||
editing &&
|
||||
const saveField = () => {
|
||||
if (!editing || !fieldEditor) return;
|
||||
const value = { ...fieldEditor.value, sortNo: fieldEditor.index ?? editing.fields.length };
|
||||
setEditing({
|
||||
...editing,
|
||||
fields: editing.fields.map((field, position) =>
|
||||
position === index ? { ...field, ...value } : field,
|
||||
),
|
||||
fields: fieldEditor.index === null
|
||||
? [...editing.fields, value]
|
||||
: editing.fields.map((field, index) => index === fieldEditor.index ? value : field),
|
||||
});
|
||||
setFieldEditor(null);
|
||||
};
|
||||
|
||||
if (editing)
|
||||
return (
|
||||
@@ -167,6 +186,7 @@ export default function InquirySettingsPanel() {
|
||||
disabled={
|
||||
saving ||
|
||||
!editing.formName ||
|
||||
editing.fields.length === 0 ||
|
||||
editing.fields.some((field) => !field.fieldKey || !field.label)
|
||||
}
|
||||
onClick={saveForm}
|
||||
@@ -231,140 +251,25 @@ export default function InquirySettingsPanel() {
|
||||
<div className="section-head">
|
||||
<h2>表单字段</h2>
|
||||
<button
|
||||
onClick={() =>
|
||||
setEditing({
|
||||
...editing,
|
||||
fields: [
|
||||
...editing.fields,
|
||||
{ ...emptyField(), sortNo: editing.fields.length },
|
||||
],
|
||||
})
|
||||
}
|
||||
onClick={() => setFieldEditor({ index: null, value: emptyField() })}
|
||||
>
|
||||
<Plus size={16} />
|
||||
添加字段
|
||||
</button>
|
||||
</div>
|
||||
<div className="form-field-list">
|
||||
{editing.fields.map((field, index) => (
|
||||
<div
|
||||
className="form-field-row"
|
||||
key={field.fieldCode || index}
|
||||
>
|
||||
<Field label="标题 *">
|
||||
<input
|
||||
placeholder="Name"
|
||||
value={field.label}
|
||||
onChange={(event) =>
|
||||
updateField(index, { label: event.target.value })
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="字段键 *">
|
||||
<input
|
||||
placeholder="field_key"
|
||||
value={field.fieldKey}
|
||||
onChange={(event) =>
|
||||
updateField(index, {
|
||||
fieldKey: event.target.value
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9_]/g, "_"),
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="类型">
|
||||
<select
|
||||
value={field.fieldType}
|
||||
onChange={(event) =>
|
||||
updateField(index, { fieldType: event.target.value })
|
||||
}
|
||||
>
|
||||
<option value="TEXT">单行文本</option>
|
||||
<option value="TEXTAREA">多行文本</option>
|
||||
<option value="EMAIL">邮箱</option>
|
||||
<option value="PHONE">电话</option>
|
||||
<option value="NUMBER">数字</option>
|
||||
<option value="SINGLE_SELECT">下拉单选</option>
|
||||
<option value="MULTI_SELECT">下拉多选</option>
|
||||
<option value="RADIO">单选框</option>
|
||||
<option value="CHECKBOX">复选框</option>
|
||||
<option value="FILE">文件</option>
|
||||
<option value="IMAGE">图片上传</option>
|
||||
<option value="COUNTRY">国家</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="提示">
|
||||
<input
|
||||
placeholder="Help text"
|
||||
value={field.helpText || ""}
|
||||
onChange={(event) =>
|
||||
updateField(index, { helpText: event.target.value })
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="框内提示语">
|
||||
<input
|
||||
placeholder="Placeholder"
|
||||
value={field.placeholder || ""}
|
||||
onChange={(event) =>
|
||||
updateField(index, {
|
||||
placeholder: event.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="限制字数">
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={5000}
|
||||
placeholder="不限制"
|
||||
value={field.maxLength || ""}
|
||||
onChange={(event) =>
|
||||
updateField(index, {
|
||||
maxLength: event.target.value
|
||||
? Number(event.target.value)
|
||||
: null,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<label className="field-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={field.required}
|
||||
onChange={(event) =>
|
||||
updateField(index, { required: event.target.checked })
|
||||
}
|
||||
/>
|
||||
必填
|
||||
</label>
|
||||
<Field label="展示宽度">
|
||||
<select
|
||||
value={field.widthType}
|
||||
onChange={(event) =>
|
||||
updateField(index, { widthType: event.target.value })
|
||||
}
|
||||
>
|
||||
<option value="FULL">整行</option>
|
||||
<option value="HALF">半行</option>
|
||||
</select>
|
||||
</Field>
|
||||
<button
|
||||
className="field-delete"
|
||||
title="删除字段"
|
||||
onClick={() =>
|
||||
setEditing({
|
||||
...editing,
|
||||
fields: editing.fields.filter(
|
||||
(_, position) => position !== index,
|
||||
),
|
||||
})
|
||||
}
|
||||
>
|
||||
<Trash2 size={17} />
|
||||
</button>
|
||||
<div className="form-field-table">
|
||||
<div className="form-field-head"><span>标题</span><span>字段键</span><span>类型</span><span>必填</span><span>宽度</span><span>操作</span></div>
|
||||
{editing.fields.length === 0 ? <div className="field-empty">暂无字段,点击右上角添加字段</div> : editing.fields.map((field, index) => (
|
||||
<div className="form-field-item" key={field.fieldCode || index}>
|
||||
<strong>{field.label}</strong>
|
||||
<code>{field.fieldKey}</code>
|
||||
<span>{fieldTypeLabels[field.fieldType] || field.fieldType}</span>
|
||||
<span>{field.required ? "是" : "否"}</span>
|
||||
<span>{field.widthType === "HALF" ? "半行" : "整行"}</span>
|
||||
<div className="field-actions">
|
||||
<button title="编辑字段" onClick={() => setFieldEditor({ index, value: { ...field } })}><Edit3 size={16}/></button>
|
||||
<button className="danger" title={field.systemField ? "系统字段不可删除" : "删除字段"} disabled={field.systemField} onClick={() => setEditing({ ...editing, fields: editing.fields.filter((_, position) => position !== index) })}><Trash2 size={16}/></button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -424,6 +329,23 @@ export default function InquirySettingsPanel() {
|
||||
</section>
|
||||
</aside>
|
||||
</div>
|
||||
{fieldEditor && <div className="mask" onMouseDown={(event) => { if (event.target === event.currentTarget) setFieldEditor(null); }}>
|
||||
<section className="field-dialog" role="dialog" aria-modal="true" aria-labelledby="field-dialog-title">
|
||||
<div className="dialog-head"><div><h2 id="field-dialog-title">{fieldEditor.index === null ? "添加字段" : "编辑字段"}</h2><p>配置询盘表单中的字段标题、类型和填写规则。</p></div><button className="icon" aria-label="关闭" onClick={() => setFieldEditor(null)}><X size={19}/></button></div>
|
||||
<div className="form-grid field-dialog-grid">
|
||||
<Field label="标题 *"><input autoFocus maxLength={100} placeholder="例如 Name" value={fieldEditor.value.label} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, label: event.target.value } })}/></Field>
|
||||
<Field label="字段键 *"><input disabled={fieldEditor.value.systemField} maxLength={60} placeholder="例如 name" value={fieldEditor.value.fieldKey} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, fieldKey: event.target.value.toLowerCase().replace(/^[^a-z]+|[^a-z0-9_]/g, "_") } })}/></Field>
|
||||
<Field label="类型"><select value={fieldEditor.value.fieldType} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, fieldType: event.target.value } })}>{Object.entries(fieldTypeLabels).map(([value, label]) => <option value={value} key={value}>{label}</option>)}</select></Field>
|
||||
<Field label="展示宽度"><select value={fieldEditor.value.widthType} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, widthType: event.target.value } })}><option value="FULL">整行</option><option value="HALF">半行</option></select></Field>
|
||||
<Field label="框内提示语"><input maxLength={200} placeholder="用户输入前显示的内容" value={fieldEditor.value.placeholder || ""} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, placeholder: event.target.value } })}/></Field>
|
||||
<Field label="限制字数"><input type="number" min={1} max={5000} placeholder="不限制" value={fieldEditor.value.maxLength || ""} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, maxLength: event.target.value ? Number(event.target.value) : null } })}/></Field>
|
||||
<Field wide label="提示"><input maxLength={200} placeholder="显示在字段下方的帮助说明" value={fieldEditor.value.helpText || ""} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, helpText: event.target.value } })}/></Field>
|
||||
{optionFieldTypes.has(fieldEditor.value.fieldType) && <Field wide label="选项配置(JSON)"><textarea rows={4} placeholder='例如 ["Option A","Option B"]' value={fieldEditor.value.optionsJson || ""} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, optionsJson: event.target.value } })}/></Field>}
|
||||
<label className="dialog-check wide"><input type="checkbox" checked={fieldEditor.value.required} onChange={(event) => setFieldEditor({ ...fieldEditor, value: { ...fieldEditor.value, required: event.target.checked } })}/><span>设为必填字段</span></label>
|
||||
</div>
|
||||
<div className="dialog-foot"><button onClick={() => setFieldEditor(null)}>取消</button><button className="primary" disabled={!fieldEditor.value.label.trim() || !/^[a-z][a-z0-9_]{1,59}$/.test(fieldEditor.value.fieldKey) || editing.fields.some((field, index) => index !== fieldEditor.index && field.fieldKey === fieldEditor.value.fieldKey)} onClick={saveField}>保存字段</button></div>
|
||||
</section>
|
||||
</div>}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Save } from "lucide-react";
|
||||
import { apiPost } from "./api";
|
||||
|
||||
/** 当前后台维护的站点业务编号。 */
|
||||
const SITE = "SIT0000000000001";
|
||||
|
||||
/** 固定页面 SEO 类型定义。 */
|
||||
type SeoPageOption = {
|
||||
pageType: string;
|
||||
label: string;
|
||||
canonical: string;
|
||||
defaultTitle: string;
|
||||
defaultDescription: string;
|
||||
};
|
||||
|
||||
/** 固定页面 SEO 编辑模型。 */
|
||||
type SeoForm = {
|
||||
title: string;
|
||||
description: string;
|
||||
keywords: string;
|
||||
h1: string;
|
||||
canonicalUrl: string;
|
||||
robots: string;
|
||||
ogTitle: string;
|
||||
ogDescription: string;
|
||||
ogImageUrl: string;
|
||||
structuredData: string;
|
||||
status: string;
|
||||
};
|
||||
|
||||
/** 支持独立配置的固定页面。 */
|
||||
const pages: SeoPageOption[] = [
|
||||
{ pageType: "HOME", label: "首页", canonical: "/", defaultTitle: "Shoplix", defaultDescription: "Industrial products and solutions." },
|
||||
{ pageType: "PRODUCT_LIST", label: "产品分类页", canonical: "/products", defaultTitle: "Products | Shoplix", defaultDescription: "Explore our industrial products and technical solutions." },
|
||||
{ pageType: "NEWS_LIST", label: "新闻分类页", canonical: "/news", defaultTitle: "News | Shoplix", defaultDescription: "Read the latest company and industry news." },
|
||||
{ pageType: "CASE_LIST", label: "案例分类页", canonical: "/cases", defaultTitle: "Case Studies | Shoplix", defaultDescription: "Explore our project cases and industrial applications." },
|
||||
{ pageType: "HELP_CATEGORY_LIST", label: "帮助分类页", canonical: "/help", defaultTitle: "Help Center | Shoplix", defaultDescription: "Find product guidance and frequently asked questions." },
|
||||
];
|
||||
|
||||
/** 创建指定固定页面的默认 SEO 内容。 */
|
||||
function defaultForm(page: SeoPageOption): SeoForm {
|
||||
return {
|
||||
title: page.defaultTitle,
|
||||
description: page.defaultDescription,
|
||||
keywords: "",
|
||||
h1: page.label,
|
||||
canonicalUrl: page.canonical,
|
||||
robots: "index,follow",
|
||||
ogTitle: "",
|
||||
ogDescription: "",
|
||||
ogImageUrl: "",
|
||||
structuredData: "",
|
||||
status: "DRAFT",
|
||||
};
|
||||
}
|
||||
|
||||
/** 首页及各内容分类入口的 SEO 设置页。 */
|
||||
export default function SeoSettingsPage() {
|
||||
const [selected, setSelected] = useState(pages[0]);
|
||||
const [form, setForm] = useState<SeoForm>(() => defaultForm(pages[0]));
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [notice, setNotice] = useState("");
|
||||
|
||||
/** 加载当前固定页面的 SEO 配置,不存在时展示可直接保存的默认内容。 */
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
setLoading(true);
|
||||
setNotice("");
|
||||
setForm(defaultForm(selected));
|
||||
apiPost("/seo/detail", { siteCode: SITE, pageType: selected.pageType, targetCode: "" })
|
||||
.then((data) => {
|
||||
if (!active) return;
|
||||
setForm({
|
||||
title: data.title || selected.defaultTitle,
|
||||
description: data.description || selected.defaultDescription,
|
||||
keywords: data.keywords || "",
|
||||
h1: data.h1 || selected.label,
|
||||
canonicalUrl: data.canonicalUrl || selected.canonical,
|
||||
robots: data.robots || "index,follow",
|
||||
ogTitle: data.ogTitle || "",
|
||||
ogDescription: data.ogDescription || "",
|
||||
ogImageUrl: data.ogImageUrl || "",
|
||||
structuredData: data.structuredData || "",
|
||||
status: data.status || "DRAFT",
|
||||
});
|
||||
})
|
||||
.catch(() => undefined)
|
||||
.finally(() => { if (active) setLoading(false); });
|
||||
return () => { active = false; };
|
||||
}, [selected]);
|
||||
|
||||
/** 保存当前固定页面 SEO 配置。 */
|
||||
const save = async () => {
|
||||
try {
|
||||
setSaving(true);
|
||||
setNotice("");
|
||||
await apiPost("/seo/save", {
|
||||
siteCode: SITE,
|
||||
pageType: selected.pageType,
|
||||
targetCode: "",
|
||||
...form,
|
||||
ogTitle: form.ogTitle || form.title,
|
||||
ogDescription: form.ogDescription || form.description,
|
||||
structuredData: form.structuredData || null,
|
||||
headings: [],
|
||||
});
|
||||
setNotice(`${selected.label} SEO 设置已保存`);
|
||||
} catch (error) {
|
||||
setNotice(error instanceof Error ? error.message : "保存失败");
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="seo-settings-page">
|
||||
<div className="seo-settings-heading">
|
||||
<div><h1>页面 SEO 设置</h1><p>分别维护首页及各内容分类入口的搜索引擎信息。</p></div>
|
||||
<button className="primary" disabled={saving || loading || !form.title || !form.description || !form.h1} onClick={() => void save()}><Save size={17}/>{saving ? "保存中" : "保存"}</button>
|
||||
</div>
|
||||
<nav className="seo-page-tabs" aria-label="固定页面 SEO 类型">
|
||||
{pages.map((page) => <button key={page.pageType} className={selected.pageType === page.pageType ? "active" : ""} onClick={() => setSelected(page)}>{page.label}</button>)}
|
||||
</nav>
|
||||
{notice && <div className="notice">{notice}</div>}
|
||||
<section className="seo-settings-card">
|
||||
<div className="seo-card-head"><h2>搜索引擎优化</h2><p>系统提供默认内容,发布前请根据当前站点业务进行确认和修改。</p></div>
|
||||
<div className="seo-settings-form">
|
||||
<label className="wide"><span>SEO 标题 *</span><input maxLength={70} value={form.title} onChange={(event) => setForm({ ...form, title: event.target.value })}/><small>{form.title.length} / 70</small></label>
|
||||
<label className="wide"><span>SEO 描述 *</span><textarea rows={4} maxLength={160} value={form.description} onChange={(event) => setForm({ ...form, description: event.target.value })}/><small>{form.description.length} / 160</small></label>
|
||||
<label className="wide"><span>SEO 关键词</span><input maxLength={255} placeholder="多个关键词使用英文逗号分隔" value={form.keywords} onChange={(event) => setForm({ ...form, keywords: event.target.value })}/></label>
|
||||
<label><span>页面 H1 *</span><input maxLength={120} value={form.h1} onChange={(event) => setForm({ ...form, h1: event.target.value })}/></label>
|
||||
<label><span>Canonical</span><input maxLength={500} placeholder={selected.canonical} value={form.canonicalUrl} onChange={(event) => setForm({ ...form, canonicalUrl: event.target.value })}/></label>
|
||||
<label><span>Robots</span><select value={form.robots} onChange={(event) => setForm({ ...form, robots: event.target.value })}><option value="index,follow">允许索引并跟踪链接</option><option value="index,nofollow">允许索引、不跟踪链接</option><option value="noindex,follow">不索引、跟踪链接</option><option value="noindex,nofollow">不索引且不跟踪链接</option></select></label>
|
||||
<label><span>发布状态</span><select value={form.status} onChange={(event) => setForm({ ...form, status: event.target.value })}><option value="DRAFT">草稿</option><option value="PUBLISHED">已发布</option><option value="OFFLINE">已下线</option></select></label>
|
||||
<label><span>Open Graph 标题</span><input maxLength={100} placeholder="默认使用 SEO 标题" value={form.ogTitle} onChange={(event) => setForm({ ...form, ogTitle: event.target.value })}/></label>
|
||||
<label><span>Open Graph 图片</span><input maxLength={500} placeholder="https://..." value={form.ogImageUrl} onChange={(event) => setForm({ ...form, ogImageUrl: event.target.value })}/></label>
|
||||
<label className="wide"><span>Open Graph 描述</span><textarea rows={3} maxLength={200} placeholder="默认使用 SEO 描述" value={form.ogDescription} onChange={(event) => setForm({ ...form, ogDescription: event.target.value })}/></label>
|
||||
<label className="wide"><span>JSON-LD 结构化数据</span><textarea className="code-input" rows={7} placeholder='例如 {"@context":"https://schema.org"}' value={form.structuredData} onChange={(event) => setForm({ ...form, structuredData: event.target.value })}/></label>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -29,11 +29,12 @@ import CustomCodeManager from "./CustomCodeManager";
|
||||
import MediaCenter from "./MediaCenter";
|
||||
import LoginPage, { type Account } from "./LoginPage";
|
||||
import SettingsPage from "./SettingsPage";
|
||||
import SeoSettingsPage from "./SeoSettingsPage";
|
||||
import { apiPost } from "./api";
|
||||
|
||||
const SITE_WEB = window.location.hostname === "admin.steliro.com" ? "https://site.steliro.com" : "http://localhost:5174";
|
||||
const SITE = "SIT0000000000001";
|
||||
type Section = "products" | "product-categories" | "NEWS" | "NEWS-categories" | "CASE" | "CASE-categories" | "HELP" | "HELP-categories" | "pages" | "decoration" | "custom-code" | "media" | "inquiries" | "inquiry-settings" | "settings";
|
||||
type Section = "products" | "product-categories" | "NEWS" | "NEWS-categories" | "CASE" | "CASE-categories" | "HELP" | "HELP-categories" | "pages" | "seo-settings" | "decoration" | "custom-code" | "media" | "inquiries" | "inquiry-settings" | "settings";
|
||||
type EditorialSection = "NEWS" | "CASE" | "HELP";
|
||||
type ContentEditorState = { contentType: EditorialSection; contentCode: string };
|
||||
type Item = {
|
||||
@@ -86,6 +87,7 @@ const sectionLabels: Record<Section, string> = {
|
||||
products: "产品", "product-categories": "产品分类", NEWS: "新闻", "NEWS-categories": "新闻分类",
|
||||
CASE: "案例", "CASE-categories": "案例分类", HELP: "帮助", "HELP-categories": "帮助分类",
|
||||
pages: "页面", decoration: "店铺装修", "custom-code": "自定义代码", media: "素材中心", inquiries: "询盘", "inquiry-settings": "询盘设置",
|
||||
"seo-settings": "页面 SEO",
|
||||
settings: "系统设置",
|
||||
};
|
||||
const statusLabels: Record<string, string> = { DRAFT: "草稿", PUBLISHED: "已上架", OFFLINE: "已下架" };
|
||||
@@ -318,6 +320,7 @@ function App({ account, onAccount, onLogout }: { account: Account; onAccount: (v
|
||||
{m.label}
|
||||
</button>
|
||||
))}
|
||||
<button className={section === "seo-settings" ? "active" : ""} onClick={() => navigateSection("seo-settings")}><Search size={18}/>页面 SEO</button>
|
||||
</nav>
|
||||
<div className="aside-bottom">
|
||||
<button>
|
||||
@@ -335,7 +338,7 @@ function App({ account, onAccount, onLogout }: { account: Account; onAccount: (v
|
||||
</div>
|
||||
</aside>
|
||||
<main>
|
||||
{section === "settings" ? <SettingsPage account={account} onAccount={onAccount} onLogout={onLogout}/> : section === "decoration" ? <DecorationEditor onBack={() => navigateSection("pages")}/> : section === "custom-code" ? <CustomCodeManager/> : section === "media" ? <MediaCenter/> : editingProduct !== null ? <ProductEditor productCode={editingProduct || undefined} onBack={closeProductEditor} /> : editingContent !== null ? <ContentEditor contentType={editingContent.contentType} contentCode={editingContent.contentCode || undefined} onBack={closeContentEditor} /> : editingPage !== null ? <PageEditor pageCode={editingPage || undefined} onBack={closePageEditor}/> : <>
|
||||
{section === "settings" ? <SettingsPage account={account} onAccount={onAccount} onLogout={onLogout}/> : section === "seo-settings" ? <SeoSettingsPage/> : section === "decoration" ? <DecorationEditor onBack={() => navigateSection("pages")}/> : section === "custom-code" ? <CustomCodeManager/> : section === "media" ? <MediaCenter/> : editingProduct !== null ? <ProductEditor productCode={editingProduct || undefined} onBack={closeProductEditor} /> : editingContent !== null ? <ContentEditor contentType={editingContent.contentType} contentCode={editingContent.contentCode || undefined} onBack={closeContentEditor} /> : editingPage !== null ? <PageEditor pageCode={editingPage || undefined} onBack={closePageEditor}/> : <>
|
||||
{section.endsWith("-categories") ? <CategoryManager contentType={section === "NEWS-categories" ? "NEWS" : section === "CASE-categories" ? "CASE" : section === "HELP-categories" ? "HELP" : undefined}/> : <>
|
||||
<header>
|
||||
<div>
|
||||
|
||||
@@ -372,7 +372,7 @@ header p {
|
||||
.settings-actions { display: flex; align-items: center; gap: 18px; padding: 18px 24px; border-top: 1px solid #e6e9ed; color: #176b5b; font-size: 13px; }
|
||||
.product-editor{padding:0 0 60px}.editor-top{display:flex;justify-content:space-between;align-items:center;max-width:1500px;margin:0 auto 22px}.editor-actions{display:flex;gap:10px}.breadcrumb-title{display:flex;align-items:center;gap:9px;min-width:0}.breadcrumb-title h1{font-size:18px;margin:0}.breadcrumb-title>span{color:#9aa4ac}.breadcrumb-title em{font-style:normal;color:#176b5b;font-size:12px;margin-left:8px}.editor-top button,.section-head button,.repeat-row button,.heading-row button,.rich-toolbar button{border:1px solid #d8dee3;background:#fff;border-radius:5px;padding:9px 13px;display:inline-flex;align-items:center;gap:7px;cursor:pointer}.editor-top .back{border:0;background:transparent;padding-left:0;color:#596873}.editor-top .primary{background:#176b5b;color:#fff}.editor-layout{max-width:1500px;margin:auto;display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:22px;align-items:start}.editor-main,.editor-side{display:grid;gap:20px}.editor-side{position:sticky;top:20px}.edit-section{background:#fff;border:1px solid #dde3e7;border-radius:6px;padding:22px}.edit-section h2{font-size:17px;margin:0 0 20px}.edit-section h3{font-size:14px;margin:0}.edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.edit-grid label,.editor-side label{display:grid;gap:7px}.edit-grid label>span,.editor-side label>span{font-size:13px;font-weight:600}.edit-grid input,.edit-grid select,.edit-grid textarea,.editor-side input,.editor-side select,.editor-side textarea,.repeat-row input,.heading-row input,.heading-row select{border:1px solid #d8dee3;border-radius:5px;padding:10px 12px;font:inherit;width:100%}.edit-grid .wide{grid-column:1/-1}.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.section-head h2{margin:0}.section-head button{padding:7px 10px;color:#176b5b}.repeat-row{display:grid;grid-template-columns:1.2fr 1.6fr .7fr 42px;gap:10px;margin-top:10px}.repeat-row.specs-row{grid-template-columns:1fr 1fr 1.3fr .6fr 42px}.repeat-row button,.heading-row button{padding:8px;color:#9b3434;justify-content:center}.cover-upload{min-height:210px;border:1px dashed #bdc8c4;display:grid;place-items:center;align-content:center;gap:12px;color:#81908b;position:relative;overflow:hidden}.cover-upload img{max-width:100%;max-height:280px;object-fit:contain}.cover-upload label span{display:inline-block;background:#176b5b;color:#fff;padding:9px 14px;border-radius:5px;cursor:pointer}.cover-upload input{display:none}.cover-upload p{font-size:12px;margin:0}.rich-editor{border:1px solid #d8dee3;border-radius:5px;overflow:hidden}.rich-toolbar{display:flex;flex-wrap:wrap;gap:4px;padding:8px;background:#f7f9fa;border-bottom:1px solid #d8dee3}.rich-toolbar button{border:0;padding:7px}.rich-toolbar button.active{background:#dcece7;color:#176b5b}.rich-editor .ProseMirror{min-height:360px;padding:20px;outline:0}.rich-editor .ProseMirror h2{font-size:28px}.rich-editor .ProseMirror h3{font-size:21px}.rich-editor .ProseMirror img{max-width:100%}.editor-side .edit-section{display:grid;gap:15px}.editor-side .edit-section>h2{margin-bottom:2px}.check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center;font-size:13px}.check input{width:17px}.heading-row{display:grid;grid-template-columns:65px 1fr 38px;gap:7px}.heading-row button{padding:6px}
|
||||
.category-manager{max-width:1500px;margin:auto}.category-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px}.category-heading h1{margin:0 0 5px}.category-heading p{margin:0;color:#72808d;font-size:13px}.category-table{background:#fff;border:1px solid #dfe5e9;border-radius:6px;overflow:hidden}.category-table-head,.category-row{display:grid;grid-template-columns:minmax(300px,2fr) 1.2fr .7fr .6fr;align-items:center;gap:18px;padding:13px 20px}.category-table-head{background:#f8fafb;color:#6d7983;font-size:12px;font-weight:600;border-bottom:1px solid #e4e9ed}.category-row{min-height:64px;border-bottom:1px solid #edf0f2}.category-row:last-child{border-bottom:0}.category-name{display:grid;grid-template-columns:24px 1fr;align-items:center;min-width:0}.category-name small{grid-column:2;color:#8b969f;font-size:10px;margin-top:3px}.tree-toggle{width:24px!important;height:24px;padding:0!important;display:grid!important;place-items:center}.tree-space{width:24px}.category-actions{display:flex;gap:5px}.category-actions button{width:34px;height:34px;display:grid;place-items:center;border:1px solid #d8dee3;background:#fff;border-radius:5px;color:#176b5b;cursor:pointer}.category-dialog{width:min(720px,calc(100vw - 32px));background:#fff;border-radius:7px;box-shadow:0 24px 70px rgba(0,0,0,.24);overflow:hidden}.dialog-foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid #e6e9ed}.dialog-foot button{border:1px solid #d9dee5;background:#fff;border-radius:5px;padding:10px 18px}.dialog-foot .primary{background:#176b5b;color:#fff}
|
||||
.settings-tabs{display:flex;gap:20px;border-bottom:1px solid #dfe5e9;margin-bottom:18px}.settings-tabs button{border:0;background:transparent;padding:10px 2px;color:#6d7983;font:inherit;cursor:pointer}.settings-tabs button.active{color:#176b5b;border-bottom:2px solid #176b5b;font-weight:700}.forms-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.forms-heading h2{margin:0 0 4px}.forms-heading p{margin:0;color:#72808d;font-size:13px}.forms-list{background:#fff;border:1px solid #dfe5e9;border-radius:6px;overflow:hidden}.form-list-row{display:grid;grid-template-columns:2fr .7fr .7fr .5fr;align-items:center;gap:16px;padding:16px 20px;border-bottom:1px solid #edf0f2}.form-list-row:last-child{border-bottom:0}.form-list-row>div{display:grid;gap:4px}.form-list-row small{color:#7b8791}.form-list-row .link{border:0;background:transparent;color:#176b5b;display:flex;align-items:center;gap:5px;cursor:pointer}.inquiry-form-editor{padding-bottom:50px}.inquiry-editor-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:22px;align-items:start}.form-field-list{display:grid;gap:10px}.form-field-row{display:grid;grid-template-columns:1.2fr 1fr 1fr auto .65fr 38px;gap:8px;align-items:center}.form-field-row input,.form-field-row select{border:1px solid #d8dee3;border-radius:5px;padding:9px 10px;font:inherit;min-width:0}.form-field-row label{display:flex;align-items:center;gap:5px;font-size:12px}.form-field-row button{height:38px;border:1px solid #e2caca;background:#fff;color:#a43d3d;border-radius:5px;display:grid;place-items:center;cursor:pointer}.inquiry-form-editor .edit-section>label{display:grid;gap:7px}.inquiry-form-editor .edit-section>label>span{font-size:13px;font-weight:600}.inquiry-form-editor .edit-section>label>input{border:1px solid #d8dee3;border-radius:5px;padding:10px 12px;font:inherit}
|
||||
.settings-tabs{display:flex;gap:20px;border-bottom:1px solid #dfe5e9;margin-bottom:18px}.settings-tabs button{border:0;background:transparent;padding:10px 2px;color:#6d7983;font:inherit;cursor:pointer}.settings-tabs button.active{color:#176b5b;border-bottom:2px solid #176b5b;font-weight:700}.forms-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.forms-heading h2{margin:0 0 4px}.forms-heading p{margin:0;color:#72808d;font-size:13px}.forms-list{background:#fff;border:1px solid #dfe5e9;border-radius:6px;overflow:hidden}.form-list-row{display:grid;grid-template-columns:2fr .7fr .7fr .5fr;align-items:center;gap:16px;padding:16px 20px;border-bottom:1px solid #edf0f2}.form-list-row:last-child{border-bottom:0}.form-list-row>div{display:grid;gap:4px}.form-list-row small{color:#7b8791}.form-list-row .link{border:0;background:transparent;color:#176b5b;display:flex;align-items:center;gap:5px;cursor:pointer}.inquiry-form-editor{padding-bottom:50px}.inquiry-editor-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:22px;align-items:start}.inquiry-form-editor .edit-section>label{display:grid;gap:7px}.inquiry-form-editor .edit-section>label>span{font-size:13px;font-weight:600}.inquiry-form-editor .edit-section>label>input{border:1px solid #d8dee3;border-radius:5px;padding:10px 12px;font:inherit}.setting-check{display:flex!important;align-items:center;gap:9px;padding:10px 0;font-size:13px;cursor:pointer}.editor-side .setting-check>input{width:18px;height:18px;margin:0;flex:none}.editor-side .setting-check>span{font-weight:500}.form-field-table{border:1px solid #e1e6e9;border-radius:6px;overflow:hidden}.form-field-head,.form-field-item{display:grid;grid-template-columns:minmax(150px,1.3fr) minmax(120px,1fr) minmax(110px,.8fr) 70px 70px 88px;gap:14px;align-items:center;padding:12px 16px}.form-field-head{background:#f7f9fa;color:#6d7983;font-size:12px;border-bottom:1px solid #e1e6e9}.form-field-item{min-height:42px;border-bottom:1px solid #edf0f2;font-size:13px}.form-field-item:last-child{border-bottom:0}.form-field-item strong{font-weight:500}.form-field-item code{overflow:hidden;text-overflow:ellipsis;color:#66737d}.field-actions{display:flex;gap:6px}.field-actions button{width:34px;height:34px;border:1px solid #d8dee3;border-radius:5px;background:#fff;color:#176b5b;display:grid;place-items:center;cursor:pointer}.field-actions button.danger{color:#ad3c3c}.field-actions button:disabled{color:#b8c0c5;background:#f5f6f7;cursor:not-allowed}.field-empty{padding:42px 20px;text-align:center;color:#87929a;font-size:13px}.field-dialog{width:min(780px,calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto;background:#fff;border-radius:8px;box-shadow:0 24px 70px rgba(0,0,0,.24)}.field-dialog-grid{align-items:start}.field-dialog-grid input:disabled{background:#f1f3f4;color:#7c858c}.dialog-check{display:flex!important;grid-template-columns:auto 1fr!important;align-items:center!important;gap:9px!important;padding:4px 0}.dialog-check input{width:18px;height:18px;margin:0}.dialog-check span{font-weight:500!important}
|
||||
@media (max-width: 760px) {
|
||||
.shell {
|
||||
grid-template-columns: 68px 1fr;
|
||||
@@ -411,9 +411,10 @@ header p {
|
||||
}
|
||||
.product-editor{padding:0 0 30px}.editor-layout{grid-template-columns:1fr}.editor-side{position:static}.edit-grid{grid-template-columns:1fr}.edit-grid .wide{grid-column:auto}.repeat-row,.repeat-row.specs-row{grid-template-columns:1fr}.editor-top{align-items:flex-start}.editor-actions{flex-direction:column}.breadcrumb-title{align-items:flex-start;flex-wrap:wrap}
|
||||
.nav-children{margin-left:0;padding-left:0;border-left:0}.nav-children button{font-size:0}.category-heading{align-items:flex-start;gap:14px}.category-table{overflow-x:auto}.category-table-head,.category-row{min-width:700px}.category-heading p{display:none}
|
||||
.inquiry-editor-layout{grid-template-columns:1fr}.form-field-row{grid-template-columns:1fr}.form-list-row{grid-template-columns:1fr}.forms-heading{align-items:flex-start;gap:12px}
|
||||
.inquiry-editor-layout{grid-template-columns:1fr}.form-list-row{grid-template-columns:1fr}.forms-heading{align-items:flex-start;gap:12px}.form-field-table{overflow-x:auto}.form-field-head,.form-field-item{min-width:760px}.field-dialog .form-grid{grid-template-columns:1fr}.field-dialog .form-grid .wide{grid-column:auto}
|
||||
}
|
||||
.form-field-row{grid-template-columns:repeat(3,minmax(0,1fr)) auto;gap:12px;align-items:end;padding:16px;border:1px solid #e1e6e9;border-radius:5px;background:#fafbfb}.form-field-row>label:not(.field-check){display:grid;gap:6px}.form-field-row>label:not(.field-check)>span{font-size:12px;font-weight:700;color:#52605d}.form-field-row .field-check{display:flex;align-items:center;gap:5px;height:38px;font-size:12px}.inquiry-table{overflow-x:auto}.inquiry-table .thead,.inquiry-table .row{min-width:1120px;grid-template-columns:1.25fr 1.7fr 1.35fr 1fr 1fr .8fr .65fr}.inquiry-table .row>span{min-width:0}.inquiry-table .row>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:900px){.form-field-row{grid-template-columns:1fr 1fr}}
|
||||
.inquiry-table{overflow-x:auto}.inquiry-table .thead,.inquiry-table .row{min-width:1120px;grid-template-columns:1.25fr 1.7fr 1.35fr 1fr 1fr .8fr .65fr}.inquiry-table .row>span{min-width:0}.inquiry-table .row>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.seo-settings-page{max-width:1500px;margin:0 auto}.seo-settings-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:20px}.seo-settings-heading h1{font-size:25px;font-weight:500;margin:0 0 6px}.seo-settings-heading p{margin:0;color:#72808d;font-size:13px}.seo-settings-heading .primary{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}.seo-page-tabs{display:flex;gap:28px;overflow-x:auto;border-bottom:1px solid #dfe5e9;margin-bottom:20px;background:#fff;padding:0 20px}.seo-page-tabs button{flex:none;border:0;border-bottom:2px solid transparent;background:transparent;padding:15px 2px 13px;color:#68757f;font:inherit;cursor:pointer}.seo-page-tabs button.active{color:#176b5b;border-bottom-color:#176b5b;font-weight:500}.seo-settings-card{background:#fff;border:1px solid #dfe5e9;border-radius:6px;overflow:hidden}.seo-card-head{padding:20px 24px;border-bottom:1px solid #e6e9ed}.seo-card-head h2{font-size:17px;font-weight:500;margin:0 0 7px}.seo-card-head p{font-size:13px;color:#77838d;margin:0}.seo-settings-form{display:grid;grid-template-columns:1fr 1fr;gap:19px 22px;padding:24px}.seo-settings-form label{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:center;min-width:0}.seo-settings-form label>span{grid-column:1/-1;font-size:13px;font-weight:500}.seo-settings-form input,.seo-settings-form textarea,.seo-settings-form select{grid-column:1/-1;box-sizing:border-box;width:100%;min-width:0;border:1px solid #d8dee3;border-radius:5px;padding:10px 12px;font:inherit;resize:vertical}.seo-settings-form label>small{grid-column:2;grid-row:1;color:#89949c;font-size:11px}.seo-settings-form .wide{grid-column:1/-1}.seo-settings-form .code-input{font-family:Consolas,"Courier New",monospace;font-size:13px}.seo-settings-page .notice{margin-bottom:18px}@media(max-width:900px){.seo-settings-heading{align-items:stretch;flex-direction:column}.seo-settings-heading .primary{justify-content:center}.seo-page-tabs{gap:20px}.seo-settings-form{grid-template-columns:1fr;padding:18px}.seo-settings-form .wide{grid-column:auto}}
|
||||
|
||||
.auth-loading{min-height:100vh;display:flex;align-items:center;justify-content:center;gap:12px;color:#66737d;background:#f4f6f8}.auth-spinner{width:24px;height:24px;border:2px solid #d4ddda;border-top-color:#176b5b;border-radius:50%;animation:auth-spin .8s linear infinite}@keyframes auth-spin{to{transform:rotate(360deg)}}
|
||||
.login-page{min-height:100vh;display:grid;place-items:center;padding:24px;background:#eef2f3}.login-panel{width:min(430px,100%);background:#fff;border:1px solid #dfe5e9;border-radius:8px;padding:38px;box-shadow:0 18px 48px rgba(19,37,45,.1)}.login-brand{display:flex;align-items:center;gap:12px;margin-bottom:38px}.login-brand>span{width:48px;height:48px;border-radius:7px;background:#efbd43;display:grid;place-items:center;color:#13202b;font-size:24px;font-weight:700}.login-brand>div{display:grid}.login-brand strong{font-size:23px}.login-brand small{color:#77858e}.login-copy h1{font-size:26px;margin:0 0 9px}.login-copy p{margin:0 0 28px;color:#74818a;line-height:1.6}.login-panel form{display:grid;gap:18px}.login-panel label{display:grid;gap:8px}.login-panel label>span{font-size:13px;font-weight:600}.login-input{height:48px;border:1px solid #d6dde2;border-radius:5px;display:flex;align-items:center;padding:0 13px;gap:10px;color:#7b878f}.login-input:focus-within{border-color:#176b5b;box-shadow:0 0 0 3px rgba(23,107,91,.09)}.login-input input{border:0;outline:0;min-width:0;flex:1;font:inherit}.login-input button{border:0;background:transparent;padding:4px;color:#65727b;display:grid;place-items:center}.login-error{padding:10px 12px;border:1px solid #f0c9c9;background:#fff6f6;color:#a33b3b;border-radius:5px;font-size:13px}.login-submit{height:48px;border:0;border-radius:5px;background:#176b5b;color:#fff;font:inherit;font-weight:600;cursor:pointer}.login-submit:disabled{opacity:.55;cursor:not-allowed}
|
||||
|
||||
Reference in new issue
Block a user