feat: refactor ecommerce toolbar from mode tabs to scenario-based tabs with rich template cards

- EcommercePage.tsx:
  - Introduce CommerceScenarioKey type (popular/poster/mainImage/scene/festival/model/background/retouch/salesVideo) and CommerceScenarioTemplate interface with scenario/output/desc/badge fields
  - Add commerceScenarioOptions (9 scenario tabs with icons) replacing cloneOutputOptions as toolbar data source; each scenario maps to an output mode via commerceScenarioOutputMap
  - Add commerceScenarioTemplates (16 templates across 8 scenarios) with thumbnail, badge, title, and description; popularCommerceScenarioTemplates aggregates cross-scenario highlights for the "热门" default tab
  - Replace activeCloneTemplateCards with activeCommerceScenarioTemplates filtered by scenario; popular tab shows highlights, others show scenario-specific templates
  - handleCommerceScenarioClick: switch scenario, auto-toggle output mode, toggle template strip visibility; clicking active scenario toggles strip; popular tab preserves current output
  - handleCloneTemplateCardClick: auto-switch output mode to match template, fill prompt, focus textarea with 80ms delayed re-focus for reliability
  - Template card markup upgraded: media thumbnail (94px cover image with hover scale), body with badge pill, title, and 2-line description
  - Active scenario button shows close indicator (CloseOutlined) when strip is open
  - Template strip defaults to visible (isCloneTemplateStripVisible initial true)
  - Add "左右滑动查看更多" scroll hint for narrow viewports
- ecommerce-standalone.css (+355 lines):
  - Scenario tabs: horizontal flex scroll with hidden scrollbar, pill-shaped buttons (grid: 24px icon + fluid label), per-scenario color accent via --mode-accent custom property (pink for popular, orange for poster/festival, green for mainImage/scene/background, blue for model/retouch/salesVideo)
  - Active/open states: radial gradient glow, lifted shadow, intensified border color
  - Icon slot: 24px rounded square with tinted background and inset highlight
  - Close indicator: absolute top-right circle with hover scale
  - Template cards: 2-column grid (94px media + fluid body), badge capsule, thumbnail with hover scale(1.035), title 820 weight, 2-line description clamp
  - Responsive: ≤1024px 2-col card grid, ≤900px scroll-hint visible + left-aligned tabs, ≤640px horizontal scroll cards with snap, compact card sizing
This commit is contained in:
2026-06-16 19:11:50 +08:00
parent 3469071819
commit 5811cbac16
2 changed files with 589 additions and 118 deletions
+355
View File
@@ -17433,3 +17433,358 @@ html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[d
margin-left: 0 !important;
}
}
/* Ecommerce home scenario templates */
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs {
display: flex !important;
align-items: stretch !important;
justify-content: center !important;
gap: 9px !important;
width: min(100%, 1180px) !important;
margin: 0 auto 10px !important;
padding: 5px 0 !important;
overflow-x: auto !important;
scrollbar-width: none !important;
scroll-snap-type: x proximity !important;
border: 0 !important;
border-radius: 0 !important;
background: transparent !important;
box-shadow: none !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs::-webkit-scrollbar {
display: none !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs button {
--mode-accent: #1073cc;
position: relative !important;
display: grid !important;
grid-template-columns: 24px minmax(0, 1fr) !important;
grid-template-rows: auto !important;
align-items: center !important;
justify-items: start !important;
gap: 8px !important;
flex: 0 0 auto !important;
width: auto !important;
min-width: 104px !important;
min-height: 40px !important;
padding: 7px 12px !important;
scroll-snap-align: start !important;
border: 1px solid rgba(16, 32, 44, 0.07) !important;
border-radius: 20px !important;
background: rgba(255, 255, 255, 0.6) !important;
color: rgba(16, 32, 44, 0.68) !important;
box-shadow:
0 2px 6px rgba(16, 32, 44, 0.03),
inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
text-align: left !important;
cursor: pointer !important;
transition:
background 180ms ease,
border-color 180ms ease,
color 180ms ease,
box-shadow 180ms ease,
transform 180ms ease !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs button:hover {
background: rgba(255, 255, 255, 0.86) !important;
border-color: color-mix(in srgb, var(--mode-accent) 22%, transparent) !important;
color: rgba(16, 32, 44, 0.86) !important;
box-shadow:
0 8px 18px color-mix(in srgb, var(--mode-accent) 10%, transparent),
inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
transform: translateY(-1px) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs button.is-active {
background:
radial-gradient(circle at 24% 16%, color-mix(in srgb, var(--mode-accent) 14%, transparent), transparent 54%),
rgba(255, 255, 255, 0.98) !important;
border-color: color-mix(in srgb, var(--mode-accent) 35%, transparent) !important;
color: rgba(16, 32, 44, 0.96) !important;
box-shadow:
0 10px 24px color-mix(in srgb, var(--mode-accent) 14%, transparent),
inset 0 1px 0 rgba(255, 255, 255, 0.98) !important;
transform: translateY(-1px) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs button.is-open {
background:
radial-gradient(circle at 24% 16%, color-mix(in srgb, var(--mode-accent) 18%, transparent), transparent 50%),
rgba(255, 255, 255, 1) !important;
border-color: color-mix(in srgb, var(--mode-accent) 45%, transparent) !important;
box-shadow:
0 12px 28px color-mix(in srgb, var(--mode-accent) 16%, transparent),
inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs button:focus-visible {
outline: 2px solid color-mix(in srgb, var(--mode-accent) 45%, transparent) !important;
outline-offset: 2px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs .ecom-command-mode-icon {
grid-row: auto !important;
display: inline-grid !important;
width: 24px !important;
min-width: 24px !important;
height: 24px !important;
place-items: center !important;
border: 0 !important;
border-radius: 8px !important;
background: color-mix(in srgb, var(--mode-accent) 10%, rgba(255, 255, 255, 0.9)) !important;
color: var(--mode-accent) !important;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
font-size: 13px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button.is-active .ecom-command-mode-icon,
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button.is-open .ecom-command-mode-icon {
background: color-mix(in srgb, var(--mode-accent) 16%, rgba(255, 255, 255, 0.95)) !important;
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.9),
0 2px 6px color-mix(in srgb, var(--mode-accent) 12%, transparent) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs strong {
min-width: 0 !important;
max-width: 88px !important;
overflow: hidden !important;
color: rgba(16, 32, 44, 0.82) !important;
font-size: 12.5px !important;
font-weight: 760 !important;
letter-spacing: -0.01em !important;
line-height: 1 !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button.is-active strong,
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button.is-open strong {
color: rgba(16, 32, 44, 0.95) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs .ecom-command-scenario-close {
position: absolute !important;
top: 4px !important;
right: 4px !important;
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
width: 15px !important;
height: 15px !important;
border-radius: 50% !important;
background: rgba(16, 32, 44, 0.05) !important;
color: rgba(16, 32, 44, 0.42) !important;
font-size: 9px !important;
transition:
background 160ms ease,
color 160ms ease,
transform 160ms ease !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs .ecom-command-scenario-close:hover {
background: rgba(16, 32, 44, 0.1) !important;
color: rgba(16, 32, 44, 0.7) !important;
transform: scale(1.08) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-scroll-hint {
display: none !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs .ecom-command-scenario-close .anticon {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
line-height: 1 !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--popular) {
--mode-accent: #c04468;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--poster),
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--festival) {
--mode-accent: #cc6b14;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--mainImage),
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--scene),
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--background) {
--mode-accent: #0f8f72;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--model),
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--retouch),
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs button:has(.ecom-command-mode-icon--salesVideo) {
--mode-accent: #1073cc;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-strip {
grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
gap: 12px !important;
width: min(100%, 1180px) !important;
margin: 16px auto 10px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card {
display: grid !important;
grid-template-columns: 94px minmax(0, 1fr) !important;
align-items: stretch !important;
gap: 12px !important;
aspect-ratio: auto !important;
min-height: 132px !important;
padding: 10px !important;
border-radius: 18px !important;
text-align: left !important;
background:
radial-gradient(circle at 20% 0%, rgba(30, 189, 219, 0.08), transparent 46%),
linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 254, 0.94)) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__media {
position: relative !important;
display: block !important;
width: 94px !important;
min-width: 94px !important;
height: 112px !important;
overflow: hidden !important;
border: 1px solid rgba(30, 189, 219, 0.14) !important;
border-radius: 14px !important;
background: rgba(232, 249, 253, 0.6) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__media img {
display: block !important;
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
transition: transform 220ms ease !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card:hover .ecom-command-template-card__media img {
transform: scale(1.035) !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__body {
display: grid !important;
align-content: center !important;
gap: 7px !important;
min-width: 0 !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__badge {
justify-self: start !important;
max-width: 100% !important;
padding: 4px 8px !important;
overflow: hidden !important;
border-radius: 999px !important;
background: rgba(232, 249, 253, 0.9) !important;
color: #0f829b !important;
font-size: 10px !important;
font-weight: 760 !important;
line-height: 1 !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__body strong {
min-width: 0 !important;
overflow: hidden !important;
color: #10202c !important;
font-size: 15px !important;
font-weight: 820 !important;
line-height: 1.25 !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__body em {
display: -webkit-box !important;
min-width: 0 !important;
overflow: hidden !important;
color: rgba(85, 111, 126, 0.78) !important;
font-size: 12px !important;
font-style: normal !important;
font-weight: 620 !important;
line-height: 1.45 !important;
-webkit-line-clamp: 2 !important;
-webkit-box-orient: vertical !important;
}
@media (max-width: 1024px) {
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-strip {
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
}
@media (max-width: 900px) {
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs {
justify-content: flex-start !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-scroll-hint {
display: block !important;
width: min(100%, 1180px) !important;
margin: -4px auto 6px !important;
text-align: center !important;
font-size: 11px !important;
font-weight: 480 !important;
line-height: 1 !important;
color: rgba(16, 32, 44, 0.36) !important;
}
}
@media (max-width: 640px) {
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs {
width: 100% !important;
margin-bottom: 8px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs.ecom-command-mode-tabs button {
min-width: 112px !important;
min-height: 44px !important;
padding: 7px 10px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs .ecom-command-mode-icon {
width: 24px !important;
min-width: 24px !important;
height: 24px !important;
font-size: 13px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-scenario-tabs strong {
font-size: 12px !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-strip {
display: flex !important;
gap: 10px !important;
width: 100% !important;
margin-top: 12px !important;
overflow-x: auto !important;
scrollbar-width: none !important;
scroll-snap-type: x mandatory !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-strip::-webkit-scrollbar {
display: none !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card {
grid-template-columns: 84px minmax(0, 1fr) !important;
flex: 0 0 min(86vw, 360px) !important;
min-height: 118px !important;
scroll-snap-align: start !important;
}
html body #root .ecommerce-standalone.ecommerce-standalone .product-clone-page[data-tool="clone"][data-tool="clone"]:not(.is-history-detail) .ecom-command-template-card__media {
width: 84px !important;
min-width: 84px !important;
height: 98px !important;
}
}