账户登录

This commit is contained in:
张锐 committed 2026-11-22 12:49:09 +08:00
1 parent f08dcee83a
commit 8e80e26c91
57 files changed
+1401 -100

No files matched your search

+11 -3
View File
@@ -46,7 +46,7 @@ type Item = {
slug: string;
status: string;
model?: string;
publishTime?: string;
publishTime?: number;
inquiryCode?: string;
customerName?: string;
customerEmail?: string;
@@ -60,9 +60,17 @@ type Item = {
inquiryTitle?: string;
sourceType?: string;
statusLabel?: string;
createTime?: string;
createTime?: number;
};
/** 将毫秒时间戳格式化为本地列表时间。 */
function formatTime(value?: number): string {
if (!value) return "--";
return new Intl.DateTimeFormat("zh-CN", {
year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hour12: false,
}).format(new Date(value));
}
async function post(path: string, body: unknown) {
return apiPost(path, body);
}
@@ -371,7 +379,7 @@ function App({ account, onAccount, onLogout }: { account: Account; onAccount: (v
item.productCode || item.contentCode || item.pageCode || item.inquiryCode || index
}
>
{section === "inquiries" ? <><span><strong>{item.companyName || item.customerName || "--"}</strong><small>{item.customerName || "--"}</small></span><span>{item.customerEmail || "--"}</span><span>{item.countryName || item.countryCode || "未知"}({item.clientIp || "--"})</span><span>{item.createTime?.replace("T", " ").slice(0, 16) || "--"}</span><span>{item.productName || item.inquiryTitle || item.sourceType || "网站询盘"}</span><span className={`status ${item.status.toLowerCase()}`}>{item.readStatus === 0 ? "未读" : item.statusLabel || item.status}</span><div className="row-actions"><button className="link">查看</button></div></> : <><span><strong>{item.productName || item.title || item.pageName}</strong><small>{item.model || item.productCode || item.contentCode || item.pageCode}</small></span><code>/{item.slug}</code><span className={`status ${item.status.toLowerCase()}`}>{statusLabels[item.status] || item.status}</span><span>{item.publishTime?.replace("T", " ").slice(0, 16) || "--"}</span><div className="row-actions">{["products", "NEWS", "CASE", "HELP"].includes(section) && item.slug && <a className="link" href={`${SITE_WEB}/${section === "products" ? "products" : section === "CASE" ? "cases" : section === "NEWS" ? "news" : "help"}/${encodeURIComponent(item.slug)}`} target="_blank" rel="noreferrer">查看前台</a>}<button className="link" onClick={() => section === "products" && item.productCode ? openProductEditor(item.productCode) : ["NEWS", "CASE", "HELP"].includes(section) && item.contentCode ? openContentEditor(section as EditorialSection, item.contentCode) : section === "pages" && item.pageCode ? openPageEditor(item.pageCode) : undefined}>编辑</button>{["products", "NEWS", "CASE", "HELP"].includes(section) && <><button className="link" onClick={() => void changeItemStatus(item)}>{item.status === "PUBLISHED" ? "下架" : "上架"}</button><button className="link danger" onClick={() => void deleteItem(item)}>删除</button></>}</div></>}
{section === "inquiries" ? <><span><strong>{item.companyName || item.customerName || "--"}</strong><small>{item.customerName || "--"}</small></span><span>{item.customerEmail || "--"}</span><span>{item.countryName || item.countryCode || "未知"}({item.clientIp || "--"})</span><span>{formatTime(item.createTime)}</span><span>{item.productName || item.inquiryTitle || item.sourceType || "网站询盘"}</span><span className={`status ${item.status.toLowerCase()}`}>{item.readStatus === 0 ? "未读" : item.statusLabel || item.status}</span><div className="row-actions"><button className="link">查看</button></div></> : <><span><strong>{item.productName || item.title || item.pageName}</strong><small>{item.model || item.productCode || item.contentCode || item.pageCode}</small></span><code>/{item.slug}</code><span className={`status ${item.status.toLowerCase()}`}>{statusLabels[item.status] || item.status}</span><span>{formatTime(item.publishTime)}</span><div className="row-actions">{["products", "NEWS", "CASE", "HELP"].includes(section) && item.slug && <a className="link" href={`${SITE_WEB}/${section === "products" ? "products" : section === "CASE" ? "cases" : section === "NEWS" ? "news" : "help"}/${encodeURIComponent(item.slug)}`} target="_blank" rel="noreferrer">查看前台</a>}<button className="link" onClick={() => section === "products" && item.productCode ? openProductEditor(item.productCode) : ["NEWS", "CASE", "HELP"].includes(section) && item.contentCode ? openContentEditor(section as EditorialSection, item.contentCode) : section === "pages" && item.pageCode ? openPageEditor(item.pageCode) : undefined}>编辑</button>{["products", "NEWS", "CASE", "HELP"].includes(section) && <><button className="link" onClick={() => void changeItemStatus(item)}>{item.status === "PUBLISHED" ? "下架" : "上架"}</button><button className="link danger" onClick={() => void deleteItem(item)}>删除</button></>}</div></>}
</div>
))
)}