调整商详属性和规格标签展示
This commit is contained in:
1 parent
362c1ede21
commit
104238f3c6
4 files changed
+67
-13
No files matched your search
@@ -73,7 +73,16 @@ type PreviewProduct = {
|
||||
model?: string;
|
||||
summary?: string;
|
||||
coverMediaUrl?: string;
|
||||
/** 产品详情富文本。 */
|
||||
productContent?: string;
|
||||
attributes?: Array<{ name: string; value: string; unit?: string }>;
|
||||
/** 产品规格列表。 */
|
||||
specifications?: Array<{
|
||||
groupName?: string;
|
||||
name: string;
|
||||
value: string;
|
||||
unit?: string;
|
||||
}>;
|
||||
};
|
||||
const labels: Record<SectionType, string> = {
|
||||
ANNOUNCEMENT: "公告栏",
|
||||
@@ -521,6 +530,9 @@ function PreviewSection({
|
||||
onSelect: () => void;
|
||||
product?: PreviewProduct;
|
||||
}) {
|
||||
const [productTab, setProductTab] = useState<"DETAILS" | "SPECIFICATIONS">(
|
||||
"DETAILS",
|
||||
);
|
||||
const style = {
|
||||
background: item.background,
|
||||
color: item.textColor,
|
||||
@@ -601,8 +613,8 @@ function PreviewSection({
|
||||
const attributes =
|
||||
product?.attributes?.slice(0, item.productInformationLimit || 8) || [];
|
||||
const showInformation =
|
||||
item.showProductInformation !== false &&
|
||||
(Boolean(product?.model) || attributes.length > 0);
|
||||
item.showProductInformation !== false && attributes.length > 0;
|
||||
const specifications = product?.specifications || [];
|
||||
return (
|
||||
<section className="pv-product-detail" style={style} onClick={onSelect}>
|
||||
<div className="pv-product-image">
|
||||
@@ -623,12 +635,6 @@ function PreviewSection({
|
||||
<div className="pv-product-information">
|
||||
<h2>{item.productInformationTitle || "Product information"}</h2>
|
||||
<dl>
|
||||
{product?.model && (
|
||||
<div>
|
||||
<dt>Model</dt>
|
||||
<dd>{product.model}</dd>
|
||||
</div>
|
||||
)}
|
||||
{attributes.map((attribute) => (
|
||||
<div key={attribute.name}>
|
||||
<dt>{attribute.name}</dt>
|
||||
@@ -642,6 +648,35 @@ function PreviewSection({
|
||||
)}
|
||||
<button style={{ background: primary }}>Request a quote</button>
|
||||
</div>
|
||||
<div className="pv-product-tabs">
|
||||
<div className="pv-product-tab-list" role="tablist">
|
||||
<button type="button" role="tab" className={productTab === "DETAILS" ? "active" : ""} aria-selected={productTab === "DETAILS"} onClick={() => setProductTab("DETAILS")}>
|
||||
Product Details
|
||||
</button>
|
||||
<button type="button" role="tab" className={productTab === "SPECIFICATIONS" ? "active" : ""} aria-selected={productTab === "SPECIFICATIONS"} onClick={() => setProductTab("SPECIFICATIONS")}>
|
||||
Specifications
|
||||
</button>
|
||||
</div>
|
||||
{productTab === "DETAILS" ? (
|
||||
product?.productContent ? (
|
||||
<div className="pv-product-content" dangerouslySetInnerHTML={{ __html: product.productContent }} />
|
||||
) : (
|
||||
<p className="pv-product-tab-empty">No product details available.</p>
|
||||
)
|
||||
) : specifications.length > 0 ? (
|
||||
<div className="pv-product-specifications">
|
||||
{specifications.map((specification, index) => (
|
||||
<div className="pv-product-specification-row" key={`${specification.groupName || "General"}-${specification.name}-${index}`}>
|
||||
<span>{specification.groupName || "General"}</span>
|
||||
<strong>{specification.name}</strong>
|
||||
<em>{specification.value} {specification.unit}</em>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="pv-product-tab-empty">No specifications available.</p>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -442,6 +442,8 @@ header p {
|
||||
.media-picker-backdrop{position:fixed;inset:0;z-index:1000;background:#101a1888;display:grid;place-items:center;padding:24px}.media-picker{width:min(980px,100%);max-height:calc(100vh - 48px);display:grid;grid-template-rows:auto auto 1fr auto;background:#fff;border-radius:7px;box-shadow:0 20px 60px #10211d40;overflow:hidden}.media-picker>header{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid #e4e9e7}.media-picker>header h2{margin:0;font-size:18px}.media-picker>header button{border:0;background:transparent;display:grid;place-items:center;cursor:pointer}.media-picker-toolbar{display:flex;gap:12px;padding:14px 20px;border-bottom:1px solid #e4e9e7}.media-picker-toolbar>label:first-child{display:flex;align-items:center;gap:8px;flex:1;border:1px solid #d8dee3;border-radius:5px;padding:0 11px;color:#7d8a86}.media-picker-toolbar input{border:0;outline:0;padding:10px 0;min-width:0;flex:1;font:inherit}.media-local-upload{display:inline-flex;align-items:center;gap:6px;border:1px solid #176b5b;color:#176b5b;padding:9px 13px;cursor:pointer}.media-local-upload input{display:none}.media-picker-grid{padding:18px 20px;overflow:auto;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px}.media-picker-item{position:relative;border:1px solid #dce3e0;background:#fff;padding:0;text-align:left;cursor:pointer;overflow:hidden}.media-picker-item.selected{border:2px solid #176b5b}.media-picker-item img{display:block;width:100%;aspect-ratio:1;object-fit:cover;background:#f4f7f6}.media-picker-item span{display:flex;align-items:center;gap:3px;padding:8px;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.media-picker-empty{grid-column:1/-1;min-height:200px;display:grid;place-items:center;color:#82908b}.media-picker>footer{display:flex;justify-content:flex-end;gap:10px;padding:14px 20px;border-top:1px solid #e4e9e7}.media-picker>footer button{border:1px solid #d8dee3;background:#fff;padding:9px 14px;border-radius:4px;cursor:pointer}.media-picker>footer .primary{background:#176b5b;color:#fff;border-color:#176b5b}@media(max-width:700px){.media-picker-toolbar{flex-direction:column}.media-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
||||
.specification-row{display:grid;grid-template-columns:minmax(150px,.85fr) minmax(280px,1.65fr) minmax(130px,.7fr) minmax(110px,.55fr) 42px;gap:12px;align-items:end;padding:14px 0;border-top:1px solid #edf0f2}.specification-row label{display:grid;gap:7px;min-width:0}.specification-row label>span{font-size:12px;font-weight:600;color:#53616b}.specification-row input{box-sizing:border-box;border:1px solid #d8dee3;border-radius:5px;padding:10px 12px;font:inherit;width:100%}.specification-row button{height:43px;border:1px solid #ead6d6;background:#fff;color:#a93636;border-radius:5px;display:inline-grid;place-items:center;cursor:pointer}.specification-empty{border:1px dashed #d8dee3;border-radius:5px;padding:26px;text-align:center;color:#81908b;font-size:13px}
|
||||
.pv-product-detail{padding:44px 5%;display:grid;grid-template-columns:minmax(0,1.05fr) minmax(300px,.95fr);gap:34px;align-items:start}.pv-product-image{aspect-ratio:1/1;background:#eef2f0;display:grid;place-items:center;color:#899691;overflow:hidden}.pv-product-image img{width:100%;height:100%;object-fit:contain}.pv-product-summary>span{font-size:11px;font-weight:800;color:#176b5d}.pv-product-detail h1{font-size:34px;line-height:1.12;margin:12px 0 18px}.pv-product-detail p{line-height:1.65;color:#61706b}.pv-product-detail button{border:0;color:#fff;padding:12px 20px;font-weight:700;margin-top:10px}.pv-product-information{margin:18px 0;max-height:210px;overflow:auto}.pv-product-information h2{font:500 14px Georgia,serif;margin:0 0 8px}.pv-product-information dl{margin:0}.pv-product-information dl>div{display:grid;grid-template-columns:90px minmax(0,1fr);gap:14px;padding:6px 0}.pv-product-information dt,.pv-product-information dd{margin:0;font-size:12px}.pv-product-information dt{color:#7a8783}.pv-product-information dd{font-weight:500;overflow-wrap:anywhere}.preview-frame[style*="390px"] .pv-product-detail{grid-template-columns:1fr;padding:28px 20px}.preview-frame[style*="390px"] .pv-product-detail h1{font-size:27px}
|
||||
/* 装修预览中的商详页详情与规格标签 */
|
||||
.pv-product-detail button{font-family:inherit}.pv-product-summary>button{border:0;color:#fff;padding:12px 20px;font-weight:700;margin-top:10px}.pv-product-information{max-height:none;overflow:visible}.pv-product-tabs{grid-column:1/-1;margin-top:16px}.pv-product-tab-list{display:flex;gap:28px;border-bottom:1px solid #d7dfdc}.pv-product-tab-list button{position:relative;border:0;background:transparent;color:#6b7874;padding:0 0 11px;margin:0;font-size:15px;font-weight:700;cursor:pointer}.pv-product-tab-list button.active{color:#17211f}.pv-product-tab-list button.active:after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:#17211f}.pv-product-content{padding:22px 0;line-height:1.7}.pv-product-content p{color:inherit}.pv-product-specifications{padding:22px 0}.pv-product-specification-row{display:grid;grid-template-columns:minmax(110px,.7fr) minmax(140px,1fr) minmax(180px,1.4fr);gap:18px;padding:12px 10px;border-bottom:1px solid #e2e7e5;align-items:start}.pv-product-specification-row:first-child{border-top:1px solid #e2e7e5}.pv-product-specification-row span{color:#687772;font-size:12px}.pv-product-specification-row strong{font-size:13px}.pv-product-specification-row em{font-style:normal;font-size:13px}.pv-product-tab-empty{padding:20px 0;margin:0}.preview-frame[style*="390px"] .pv-product-specification-row{grid-template-columns:1fr 1.4fr}.preview-frame[style*="390px"] .pv-product-specification-row em{grid-column:2}
|
||||
@media(max-width:900px){.specification-row{grid-template-columns:1fr 1fr}.specification-values{grid-column:1/-1}.specification-row button{grid-column:2;justify-self:end;width:42px}}
|
||||
.template-editor-layout{max-width:1500px;margin:auto;display:grid;gap:20px}.template-editor-tip,.template-selection-note{margin:0;color:#73817d;font-size:13px;line-height:1.6}.template-table .thead,.template-table .row{grid-template-columns:minmax(0,2fr) 130px 90px 180px}.template-table .row-actions{display:flex;justify-content:flex-end;gap:12px}.template-table .row-actions .danger{color:#a93636}.template-table button svg{vertical-align:middle;margin-right:4px}@media(max-width:760px){.template-table .thead{display:none}.template-table .row{grid-template-columns:1fr}.template-table .row-actions{justify-content:flex-start}}
|
||||
.media-filters{display:flex;gap:10px}.media-result-summary{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;color:#66757b;font-size:13px}.media-result-summary label{display:flex;align-items:center;gap:8px}.media-result-summary select{height:34px;border:1px solid #d8dee3;border-radius:4px;background:#fff;padding:0 8px}.media-tag{height:30px;border:1px dashed #b9c7c3;background:#f8faf9;color:#647570;border-radius:4px;padding:0 8px;display:flex;align-items:center;gap:6px;justify-content:center;cursor:pointer;overflow:hidden}.media-tag.assigned{border-style:solid;background:#e9f3ef;color:#176b5b}.media-tag-editor{display:grid;grid-template-columns:minmax(0,1fr) 30px 30px;gap:5px}.media-tag-editor input{min-width:0;border:1px solid #b8c6c2;border-radius:4px;padding:6px 8px}.media-tag-editor button{border:1px solid #d5ddda;background:#fff;border-radius:4px;display:grid;place-items:center;cursor:pointer}.media-pagination{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:20px}.media-pagination button{width:36px;height:36px;border:1px solid #d5ddda;background:#fff;border-radius:4px;display:grid;place-items:center;cursor:pointer}.media-pagination button.active{background:#176b5b;border-color:#176b5b;color:#fff}.media-pagination button:disabled{opacity:.45;cursor:not-allowed}.media-pagination span{margin-left:8px;color:#718087;font-size:13px}@media(max-width:760px){.media-filters{display:grid}.media-result-summary{align-items:flex-start}.media-pagination{flex-wrap:wrap}}
|
||||
|
||||
Reference in new issue
Block a user