refactor: align inquiry storage structure

This commit is contained in:
张锐 committed 2026-11-21 18:46:19 +08:00
1 parent 3fdec5a549
commit a0c723cdcc
13 files changed
+659 -32

No files matched your search

+6 -1
View File
@@ -50,7 +50,12 @@ type Item = {
customerEmail?: string;
companyName?: string;
countryCode?: string;
countryName?: string;
provinceName?: string;
cityName?: string;
clientIp?: string;
readStatus?: number;
inquiryTitle?: string;
sourceType?: string;
statusLabel?: string;
createTime?: string;
@@ -364,7 +369,7 @@ function App() {
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.countryCode || "未知"}({item.clientIp || "--"})</span><span>{item.createTime?.replace("T", " ").slice(0, 16) || "--"}</span><span>{item.productName || item.sourceType || "网站询盘"}</span><span className={`status ${item.status.toLowerCase()}`}>{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>{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></>}
</div>
))
)}