功能迭代

This commit is contained in:
张锐 committed 2026-11-30 21:14:38 +08:00
1 parent 0b41b03011
commit 148d1297b2
15 files changed
+4705 -99

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

+5
View File
@@ -0,0 +1,5 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_localhost FALSE / FALSE 1798635247 JSESSIONID 4A716E18A919595B44857D86E4405795
+5
View File
@@ -0,0 +1,5 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_localhost FALSE / FALSE 1798630810 JSESSIONID 2CDAD74E39F8A0ACF8A2173966647DC8
+87
View File
@@ -0,0 +1,87 @@
# 将厂家英文素材发布到首页和关于我们页面。
$loginBody = @{ username = 'admin'; password = 'Shoplix@2026' } | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/auth/login' -ContentType 'application/json' -Body $loginBody -SessionVariable adminSession | Out-Null
function New-Section {
param(
[string]$Id,
[string]$Type,
[string]$Title,
[string]$Subtitle = '',
[string]$ImageUrl = '',
[string]$VideoUrl = '',
[string]$Background = '#ffffff',
[string]$TextColor = '#17211f',
[string]$ButtonText = '',
[string]$ButtonUrl = '',
[string]$SourceType = '',
[int]$Limit = 3,
[string]$HeroHeight = '80'
)
return [ordered]@{
id = $Id; type = $Type; title = $Title; subtitle = $Subtitle
imageUrl = $ImageUrl; imageUrls = @(); videoUrl = $VideoUrl; heroHeight = $HeroHeight
buttonText = $ButtonText; buttonUrl = $ButtonUrl; sourceType = $SourceType; limit = $Limit
visible = $true; background = $Background; textColor = $TextColor
showProductInformation = $true; productInformationTitle = 'Product information'; productInformationLimit = 8
}
}
function Save-And-Publish {
param([string]$PageType, [object]$Schema)
$schemaJson = $Schema | ConvertTo-Json -Depth 12 -Compress
$saveBody = @{ siteCode = 'SIT0000000000001'; pageType = $PageType; schema = $schemaJson } | ConvertTo-Json -Compress
Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/decorations/save' -ContentType 'application/json' -Body $saveBody -WebSession $adminSession | Out-Null
$publishBody = @{ siteCode = 'SIT0000000000001'; pageType = $PageType } | ConvertTo-Json -Compress
Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/decorations/publish' -ContentType 'application/json' -Body $publishBody -WebSession $adminSession | Out-Null
}
$heroUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/37af4f25c31f462b8429884af30d14d3.jpg'
$factoryUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/7a75f01f4f6048bf9666fd9b48b60f72.jpg'
$marketsUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/1200c08946744254a4c1577bcadd691b.jpg'
$strengthsUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/7416eaa60400423db8b2700ec4f40650.jpg'
$workflowUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/bf41428561e24bb2834b4aa6a8879f35.jpg'
$aboutUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/ce6c0f6323244fde8ad2cb4c7067007b.jpg'
$videoUrl = 'https://oss-api.steliro.com/shoplix-test/media/SIT0000000000001/2026/11/ef0ffeeb4c79420ea80927f78f7af840.mp4'
$homeDetailBody = @{ siteCode = 'SIT0000000000001'; pageType = 'HOME' } | ConvertTo-Json
$homeDetail = Invoke-RestMethod -Method Post -Uri 'http://localhost:8081/api/admin/v1/decorations/detail' -ContentType 'application/json' -Body $homeDetailBody -WebSession $adminSession
$homeSchema = $homeDetail.schema | ConvertFrom-Json
$homeSchema.sections = @($homeSchema.sections | Where-Object { $_.id -notin @('factory-home-en', 'strengths-home-en', 'workflow-home-en') })
$hero = $homeSchema.sections | Where-Object { $_.type -eq 'HERO' } | Select-Object -First 1
$hero.imageUrl = $heroUrl
$hero.imageUrls = @($heroUrl)
$hero.title = 'Reliable Trimmer Heads for Global Buyers'
$hero.subtitle = 'Factory-direct garden tool parts, flexible OEM/ODM service and dependable quality for wholesalers, distributors and brands.'
$hero.buttonText = 'Explore Products'
$productIndex = [Array]::IndexOf($homeSchema.sections, ($homeSchema.sections | Where-Object { $_.type -eq 'PRODUCTS' } | Select-Object -First 1))
$beforeProducts = @($homeSchema.sections[0..$productIndex])
$afterProducts = @($homeSchema.sections[($productIndex + 1)..($homeSchema.sections.Count - 1)])
$homeSchema.sections = @(
$beforeProducts
(New-Section -Id 'strengths-home-en' -Type 'RICH_TEXT' -Title 'Manufacturing Strength for Stable Supply' -Subtitle 'Focused production experience, a skilled team and scalable daily capacity support repeat orders and long-term sourcing programs.' -ImageUrl $strengthsUrl -Background '#f2f7f5')
(New-Section -Id 'factory-home-en' -Type 'RICH_TEXT' -Title 'Inside Our Production & Warehousing' -Subtitle 'From precision machining and material preparation to finished goods storage, our facilities support an organized and traceable workflow.' -ImageUrl $factoryUrl)
(New-Section -Id 'workflow-home-en' -Type 'RICH_TEXT' -Title 'A Clear OEM & ODM Workflow' -Subtitle 'We coordinate requirement review, sample development, materials, production, quality inspection and export packing.' -ImageUrl $workflowUrl -Background '#f7f9f8')
$afterProducts
)
Save-And-Publish -PageType 'HOME' -Schema $homeSchema
$about = [ordered]@{
global = [ordered]@{ primaryColor = '#176b5d'; backgroundColor = '#ffffff'; textColor = '#17211f'; fontFamily = 'Inter'; contentWidth = 1200 }
sections = @(
(New-Section -Id 'about-header' -Type 'HEADER' -Title 'TRIMMER HEAD SOURCING')
(New-Section -Id 'about-hero' -Type 'HERO' -Title 'A Specialized Partner for Garden Tool Components' -Subtitle 'Yongkang Hongyu combines product development, manufacturing and export support for trimmer heads, trimmer line and related accessories.' -ImageUrl $aboutUrl -ButtonText 'Request a Quote' -ButtonUrl '/contact-us' -Background '#17342e' -TextColor '#ffffff' -HeroHeight '50')
(New-Section -Id 'about-company' -Type 'RICH_TEXT' -Title 'Built for Consistent B2B Supply' -Subtitle 'Our team manages machining, assembly, warehousing and final inspection to support consistent OEM and wholesale orders for buyers across multiple regions.' -ImageUrl $aboutUrl -Background '#f4f7f6')
(New-Section -Id 'about-factory' -Type 'RICH_TEXT' -Title 'Manufacturing & Warehousing' -Subtitle 'Dedicated production areas and organized storage help us maintain stable lead times, product consistency and order traceability.' -ImageUrl $factoryUrl)
(New-Section -Id 'about-strengths' -Type 'RICH_TEXT' -Title 'Capabilities at a Glance' -Subtitle 'Focused industry experience, extensive product options, a skilled production team and scalable daily output.' -ImageUrl $strengthsUrl -Background '#f2f7f5')
(New-Section -Id 'about-workflow' -Type 'RICH_TEXT' -Title 'OEM & ODM from Requirement to Shipment' -Subtitle 'A practical six-step workflow keeps custom projects clear and manageable from initial review through export packing.' -ImageUrl $workflowUrl)
(New-Section -Id 'about-video' -Type 'VIDEO' -Title 'Take a Short Tour of Our Factory' -Subtitle 'Meet our team and learn about our production, capacity and quality approach through an English-narrated factory introduction.' -VideoUrl $videoUrl -Background '#edf5f2')
(New-Section -Id 'about-markets' -Type 'RICH_TEXT' -Title 'Supporting Buyers in Global Markets' -Subtitle 'We work with distributors, wholesalers and garden tool brands across Europe, Asia, the Americas and other international markets.' -ImageUrl $marketsUrl)
(New-Section -Id 'about-inquiry' -Type 'INQUIRY' -Title 'Discuss Your Garden Tool Parts Project' -Subtitle 'Tell us your target models, quantities, market requirements or customization needs. Our team will respond with product and sourcing guidance.' -Background '#e7efec')
(New-Section -Id 'about-footer' -Type 'FOOTER' -Title 'TRIMMER HEAD SOURCING' -Subtitle 'Garden Tool Parts & Accessories' -Background '#101a25' -TextColor '#ffffff')
)
}
Save-And-Publish -PageType 'ABOUT_US' -Schema $about
Write-Output 'HOME_AND_ABOUT_PUBLISHED'
Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

+39
View File
@@ -29,6 +29,7 @@ type SectionType =
| "ANNOUNCEMENT" | "ANNOUNCEMENT"
| "HEADER" | "HEADER"
| "HERO" | "HERO"
| "VIDEO"
| "RICH_TEXT" | "RICH_TEXT"
| "PRODUCTS" | "PRODUCTS"
| "PRODUCT_DETAIL" | "PRODUCT_DETAIL"
@@ -42,6 +43,8 @@ type Section = {
subtitle: string; subtitle: string;
imageUrl: string; imageUrl: string;
imageUrls: string[]; imageUrls: string[];
/** 视频介绍区块的视频地址。 */
videoUrl: string;
/** 首页轮播区域占浏览器可视高度的百分比。 */ /** 首页轮播区域占浏览器可视高度的百分比。 */
heroHeight: HeroHeight; heroHeight: HeroHeight;
buttonText: string; buttonText: string;
@@ -89,6 +92,7 @@ const labels: Record<SectionType, string> = {
ANNOUNCEMENT: "公告栏", ANNOUNCEMENT: "公告栏",
HEADER: "导航栏", HEADER: "导航栏",
HERO: "轮播横幅", HERO: "轮播横幅",
VIDEO: "视频介绍",
RICH_TEXT: "富文本", RICH_TEXT: "富文本",
PRODUCTS: "产品展示", PRODUCTS: "产品展示",
PRODUCT_DETAIL: "产品详情", PRODUCT_DETAIL: "产品详情",
@@ -143,6 +147,7 @@ function createSection(type: SectionType): Section {
: "", : "",
imageUrl: "", imageUrl: "",
imageUrls: [], imageUrls: [],
videoUrl: "",
heroHeight: "80", heroHeight: "80",
buttonText: type === "HERO" ? "Explore Products" : "", buttonText: type === "HERO" ? "Explore Products" : "",
buttonUrl: type === "HERO" ? "/products" : "", buttonUrl: type === "HERO" ? "/products" : "",
@@ -585,6 +590,22 @@ function PreviewSection({
{item.subtitle || {item.subtitle ||
"Add your English introduction, advantages or service description here."} "Add your English introduction, advantages or service description here."}
</p> </p>
{item.imageUrl && <img src={item.imageUrl} alt={item.title} />}
</section>
);
if (item.type === "VIDEO")
return (
<section className="pv-video" style={style} onClick={onSelect}>
<div>
<span>OUR FACTORY</span>
<h2>{item.title || "Built for reliable garden tool supply"}</h2>
<p>{item.subtitle}</p>
</div>
{item.videoUrl ? (
<video controls preload="metadata" src={item.videoUrl} />
) : (
<div className="pv-video-placeholder">请配置英文介绍视频 URL</div>
)}
</section> </section>
); );
if (item.type === "PRODUCTS" || item.type === "CONTENT") if (item.type === "PRODUCTS" || item.type === "CONTENT")
@@ -871,6 +892,24 @@ function SectionSettings({
</Field> </Field>
</> </>
)} )}
{item.type === "VIDEO" && (
<Field label="视频 URL">
<input
value={item.videoUrl || ""}
onChange={(e) => onChange({ videoUrl: e.target.value })}
placeholder="https://...mp4"
/>
</Field>
)}
{item.type === "RICH_TEXT" && (
<Field label="展示图片 URL">
<input
value={item.imageUrl || ""}
onChange={(e) => onChange({ imageUrl: e.target.value })}
placeholder="https://...jpg"
/>
</Field>
)}
{item.type === "CONTENT" && ( {item.type === "CONTENT" && (
<Field label="内容来源"> <Field label="内容来源">
<select <select
+3564 -60
View File
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -317,7 +317,7 @@ function CustomCodeRuntime() {
useEffect(() => { let nodes: HTMLElement[] = []; post("/custom-codes/list", { siteCode: "SIT0000000000001" }).then(data => { (data.items || []).forEach((item: { content: string; position: string }) => { const container = item.position === "HEAD" ? document.head : document.body; const wrapper = document.createElement("div"); wrapper.innerHTML = item.content; Array.from(wrapper.children).forEach(child => { let node: HTMLElement = child as HTMLElement; if (child.tagName === "SCRIPT") { const script = document.createElement("script"); Array.from(child.attributes).forEach(attribute => script.setAttribute(attribute.name, attribute.value)); script.text = child.textContent || ""; node = script; } container.insertBefore(node, item.position === "BODY_START" ? container.firstChild : null); nodes.push(node); }); }); }).catch(() => undefined); return () => nodes.forEach(node => node.remove()); }, []); useEffect(() => { let nodes: HTMLElement[] = []; post("/custom-codes/list", { siteCode: "SIT0000000000001" }).then(data => { (data.items || []).forEach((item: { content: string; position: string }) => { const container = item.position === "HEAD" ? document.head : document.body; const wrapper = document.createElement("div"); wrapper.innerHTML = item.content; Array.from(wrapper.children).forEach(child => { let node: HTMLElement = child as HTMLElement; if (child.tagName === "SCRIPT") { const script = document.createElement("script"); Array.from(child.attributes).forEach(attribute => script.setAttribute(attribute.name, attribute.value)); script.text = child.textContent || ""; node = script; } container.insertBefore(node, item.position === "BODY_START" ? container.firstChild : null); nodes.push(node); }); }); }).catch(() => undefined); return () => nodes.forEach(node => node.remove()); }, []);
return null; return null;
} }
type DecorationSection = { id:string; type:string; title:string; subtitle:string; imageUrl:string; imageUrls?:string[]; heroHeight?:"30"|"50"|"80"|"100"; buttonText:string; buttonUrl:string; sourceType:string; limit:number; visible:boolean; background:string; textColor:string; showProductInformation?:boolean; productInformationTitle?:string; productInformationLimit?:number }; type DecorationSection = { id:string; type:string; title:string; subtitle:string; imageUrl:string; imageUrls?:string[]; videoUrl?:string; heroHeight?:"30"|"50"|"80"|"100"; buttonText:string; buttonUrl:string; sourceType:string; limit:number; visible:boolean; background:string; textColor:string; showProductInformation?:boolean; productInformationTitle?:string; productInformationLimit?:number };
type ProductDetailConfiguration = { type ProductDetailConfiguration = {
/** 是否在商品摘要区域展示产品信息。 */ /** 是否在商品摘要区域展示产品信息。 */
showProductInformation?: boolean; showProductInformation?: boolean;
@@ -337,13 +337,14 @@ function DecoratedPage({ pageType, fallback }: { pageType: string; fallback: Rea
function LiveSection({section}:{section:DecorationSection}) { function LiveSection({section}:{section:DecorationSection}) {
const style={background:section.background,color:section.textColor}; const style={background:section.background,color:section.textColor};
if(section.type==="ANNOUNCEMENT")return <div className="live-announcement" style={style}>{section.title}</div>; if(section.type==="ANNOUNCEMENT")return <div className="live-announcement" style={style}>{section.title}</div>;
if(section.type==="HEADER")return <LiveHeader style={style}/>; if(section.type==="HEADER")return <LiveHeader section={section} style={style}/>;
if(section.type==="HERO")return <LiveHero section={section} style={style}/>; if(section.type==="HERO")return <LiveHero section={section} style={style}/>;
if(section.type==="RICH_TEXT")return <section className="live-rich" style={style}><h2>{section.title}</h2><p>{section.subtitle}</p></section>; if(section.type==="RICH_TEXT")return <section className="live-rich" style={style}><h2>{section.title}</h2><p>{section.subtitle}</p>{section.imageUrl&&<img src={assetUrl(section.imageUrl)} alt={section.title}/>}</section>;
if(section.type==="VIDEO")return <section className="live-video" style={style}><div><p>OUR FACTORY</p><h2>{section.title}</h2><span>{section.subtitle}</span></div>{section.videoUrl&&<video controls playsInline preload="metadata" src={assetUrl(section.videoUrl)}/>}</section>;
if(section.type==="PRODUCT_DETAIL")return <RuntimeProductDetail configuration={section}/>; if(section.type==="PRODUCT_DETAIL")return <RuntimeProductDetail configuration={section}/>;
if(section.type==="PRODUCTS"||section.type==="CONTENT")return <LiveCollection section={section}/>; if(section.type==="PRODUCTS"||section.type==="CONTENT")return <LiveCollection section={section}/>;
if(section.type==="INQUIRY")return <section className="live-inquiry" style={style}><div><p>START A PROJECT</p><h2>{section.title}</h2><span>{section.subtitle}</span></div><InquiryForm scene="GENERAL"/></section>; if(section.type==="INQUIRY")return <section className="live-inquiry" style={style}><div><p>START A PROJECT</p><h2>{section.title}</h2><span>{section.subtitle}</span></div><InquiryForm scene="GENERAL"/></section>;
if(section.type==="FOOTER")return <footer className="live-footer" style={style}><div><b>SHOPLIX</b><p>Industrial Solutions</p></div><div><b>Explore</b><a href="/products">Products</a><a href="/cases">Cases</a><a href="/news">News</a></div><div><b>Company</b><a href="/about-us">About Us</a><a href="/contact-us">Contact Us</a><a href="/privacy-policy">Privacy Policy</a></div><small>{section.subtitle||"Copyright © 2026. All rights reserved."}</small></footer>; if(section.type==="FOOTER")return <footer className="live-footer" style={style}><div><b>{section.title||"Trimmer Head Sourcing"}</b><p>{section.subtitle||"Garden Tool Parts & Accessories"}</p></div><div><b>Explore</b><a href="/products">Products</a><a href="/cases">Cases</a><a href="/news">News</a></div><div><b>Company</b><a href="/about-us">About Us</a><a href="/contact-us">Contact Us</a><a href="/privacy-policy">Privacy Policy</a></div><small>Copyright © 2026. All rights reserved.</small></footer>;
return null; return null;
} }
/** 首页首屏轮播组件,支持自动播放、左右切换和指示点。 */ /** 首页首屏轮播组件,支持自动播放、左右切换和指示点。 */
@@ -365,13 +366,13 @@ function RuntimeProductDetail({ configuration }: { configuration: ProductDetailC
return <ProductDetailView data={product} configuration={configuration}/>; return <ProductDetailView data={product} configuration={configuration}/>;
} }
/** 装修页面使用的动态页头。 */ /** 装修页面使用的动态页头。 */
function LiveHeader({ style }: { style: React.CSSProperties }) { function LiveHeader({ section, style }: { section: DecorationSection; style: React.CSSProperties }) {
const items = useNavigation("HEADER"); const items = useNavigation("HEADER");
const productCategories = useProductCategoryTree(); const productCategories = useProductCategoryTree();
const navigationItems = items.map((item) => productCategories.length > 0 && item.url.split("?")[0] === "/products" const navigationItems = items.map((item) => productCategories.length > 0 && item.url.split("?")[0] === "/products"
? { ...item, children: productCategoryNavigation(productCategories) } ? { ...item, children: productCategoryNavigation(productCategories) }
: item); : item);
return <header className="live-header" style={style}><a href="/" className="live-logo">SHOPLIX</a><nav><NavigationLinks items={navigationItems}/></nav><a className="live-quote" href="/contact-us">Get a quote</a></header>; return <header className="live-header" style={style}><a href="/" className="live-logo">{section.title||"Trimmer Head Sourcing"}</a><nav><NavigationLinks items={navigationItems}/></nav><a className="live-quote" href="/contact-us">Get a quote</a></header>;
} }
function LiveCollection({section}:{section:DecorationSection}) { function LiveCollection({section}:{section:DecorationSection}) {
const [items,setItems]=useState<Item[]>([]); const [items,setItems]=useState<Item[]>([]);
+998 -33
View File
File diff suppressed because it is too large. Load diff