feat: 全站20个模板添加国际化(i18n)支持 - 简体中文/繁体中文/英文三语切换
- 所有18套前端模板 + 管理后台共20个HTML文件添加i18n引擎 - 前端JavaScript方案:I18N_LOCALES翻译字典 + data-i18n属性 + t()函数调用 - 语言切换器UI:下拉菜单选择,匹配各模板主题风格 - 语言持久化:localStorage存储 + URL参数覆盖 + 浏览器语言自动检测 - onLangChange回调:语言切换时动态重新渲染所有内容 - 支持语言:zh-CN(简体中文) / zh-TW(繁体中文) / en(English)
This commit is contained in:
484
web/dist/site2/index.html
vendored
484
web/dist/site2/index.html
vendored
@@ -144,6 +144,34 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
.nav-toggle.open span:nth-child(2){opacity:0}
|
||||
.nav-toggle.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
|
||||
|
||||
/* ===================== 语言切换器 ===================== */
|
||||
.lang-switcher{position:relative;margin-left:8px}
|
||||
.lang-btn{
|
||||
display:flex;align-items:center;gap:6px;padding:8px 14px;border-radius:var(--radius);
|
||||
font-size:13px;font-weight:600;color:var(--warm);cursor:pointer;
|
||||
background:rgba(255,255,255,.05);border:1px solid var(--line-2);
|
||||
transition:all .25s ease;
|
||||
}
|
||||
.lang-btn:hover{color:var(--accent);background:rgba(255,107,53,.08);border-color:var(--accent-line)}
|
||||
.lang-btn svg{width:16px;height:16px}
|
||||
.lang-dropdown{
|
||||
position:absolute;top:calc(100% + 8px);right:0;min-width:160px;
|
||||
background:rgba(22,22,42,.96);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);
|
||||
border:1px solid var(--line-2);border-radius:var(--radius-lg);
|
||||
box-shadow:0 12px 40px rgba(0,0,0,.5);overflow:hidden;
|
||||
opacity:0;transform:translateY(-8px);pointer-events:none;
|
||||
transition:all .25s ease;z-index:1001;
|
||||
}
|
||||
.lang-dropdown.open{opacity:1;transform:none;pointer-events:auto}
|
||||
.lang-option{
|
||||
display:flex;align-items:center;gap:10px;padding:12px 16px;
|
||||
font-size:14px;color:var(--warm);cursor:pointer;transition:all .2s;
|
||||
}
|
||||
.lang-option:hover{background:rgba(255,107,53,.1);color:var(--text)}
|
||||
.lang-option.active{color:var(--accent);font-weight:600}
|
||||
.lang-option .check{width:16px;height:16px;opacity:0;transition:opacity .2s}
|
||||
.lang-option.active .check{opacity:1}
|
||||
|
||||
/* ===================== Hero ===================== */
|
||||
.hero{
|
||||
position:relative;min-height:100vh;display:flex;align-items:center;
|
||||
@@ -423,6 +451,8 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
.section-head{margin-bottom:40px}
|
||||
.vision-card{padding:36px 26px}
|
||||
.cap-visual-card{height:240px}
|
||||
.lang-switcher{position:static;margin-left:0}
|
||||
.lang-dropdown{right:auto;left:0}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -438,7 +468,7 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
</svg>
|
||||
</div>
|
||||
<div class="loader-bar"><span></span></div>
|
||||
<div class="loader-text">系统加载中</div>
|
||||
<div class="loader-text" data-i18n="loading">系统加载中</div>
|
||||
</div>
|
||||
|
||||
<!-- 导航栏 -->
|
||||
@@ -446,16 +476,37 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container nav-inner">
|
||||
<a href="#hero" class="logo">
|
||||
<div class="logo-mark"><span>M</span></div>
|
||||
<div class="logo-txt"><span id="navName">MANUFACT</span><small>智能制造</small></div>
|
||||
<div class="logo-txt"><span id="navName">MANUFACT</span><small data-i18n="logo_subtitle">智能制造</small></div>
|
||||
</a>
|
||||
<ul class="nav-menu" id="navMenu">
|
||||
<li><a href="#hero" class="nav-link active">首页</a></li>
|
||||
<li><a href="#capabilities" class="nav-link">能力</a></li>
|
||||
<li><a href="#stats" class="nav-link">资质</a></li>
|
||||
<li><a href="#news" class="nav-link">新闻</a></li>
|
||||
<li><a href="#contact" class="nav-link">联系</a></li>
|
||||
<li><a href="#contact" class="nav-cta">立即咨询</a></li>
|
||||
<li><a href="#hero" class="nav-link active" data-i18n="nav_home">首页</a></li>
|
||||
<li><a href="#capabilities" class="nav-link" data-i18n="nav_capabilities">能力</a></li>
|
||||
<li><a href="#stats" class="nav-link" data-i18n="nav_stats">资质</a></li>
|
||||
<li><a href="#news" class="nav-link" data-i18n="nav_news">新闻</a></li>
|
||||
<li><a href="#contact" class="nav-link" data-i18n="nav_contact">联系</a></li>
|
||||
<li><a href="#contact" class="nav-cta" data-i18n="nav_cta">立即咨询</a></li>
|
||||
</ul>
|
||||
<div class="lang-switcher" id="langSwitcher">
|
||||
<button class="lang-btn" id="langBtn" onclick="toggleLangDropdown()">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20M12 2a15 15 0 0 1 0 20 15 15 0 0 1 0-20z"/></svg>
|
||||
<span id="langLabel">中文</span>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="width:12px;height:12px"><polyline points="6 9 12 15 18 9"/></svg>
|
||||
</button>
|
||||
<div class="lang-dropdown" id="langDropdown">
|
||||
<div class="lang-option" data-lang="zh-CN" onclick="switchLang('zh-CN')">
|
||||
<svg class="check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
|
||||
<span>简体中文</span>
|
||||
</div>
|
||||
<div class="lang-option" data-lang="zh-TW" onclick="switchLang('zh-TW')">
|
||||
<svg class="check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
|
||||
<span>繁體中文</span>
|
||||
</div>
|
||||
<div class="lang-option" data-lang="en" onclick="switchLang('en')">
|
||||
<svg class="check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
|
||||
<span>English</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="nav-toggle" id="navToggle" aria-label="菜单"><span></span><span></span><span></span></button>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -467,23 +518,23 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="hero-shape s2"></div>
|
||||
<div class="hero-shape s3"></div>
|
||||
<div class="container hero-inner">
|
||||
<div class="hero-tag"><span class="dot"></span><span id="heroTag">智能制造 · 工业自动化解决方案</span></div>
|
||||
<div class="hero-tag"><span class="dot"></span><span id="heroTag" data-i18n="hero_tag">智能制造 · 工业自动化解决方案</span></div>
|
||||
<h1 id="heroTitle">用精密制造<br><span class="accent">驱动工业未来</span></h1>
|
||||
<p class="hero-slogan" id="heroSlogan">载入中...</p>
|
||||
<p class="hero-slogan" id="heroSlogan" data-i18n="hero_slogan">载入中...</p>
|
||||
<div class="hero-actions">
|
||||
<a href="#capabilities" class="btn btn-primary">
|
||||
探索核心能力
|
||||
<span data-i18n="hero_cta1">探索核心能力</span>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
|
||||
</a>
|
||||
<a href="#contact" class="btn btn-ghost">联系我们</a>
|
||||
<a href="#contact" class="btn btn-ghost" data-i18n="hero_cta2">联系我们</a>
|
||||
</div>
|
||||
<div class="hero-meta" id="heroMeta">
|
||||
<div class="item"><div class="num" id="metaYear">2010</div><div class="lbl">成立年份</div></div>
|
||||
<div class="item"><div class="num" id="metaEmp">2000+</div><div class="lbl">团队规模</div></div>
|
||||
<div class="item"><div class="num" id="metaService">5000+</div><div class="lbl">服务客户</div></div>
|
||||
<div class="item"><div class="num" id="metaYear">2010</div><div class="lbl" data-i18n="meta_founded">成立年份</div></div>
|
||||
<div class="item"><div class="num" id="metaEmp">2000+</div><div class="lbl" data-i18n="meta_scale">团队规模</div></div>
|
||||
<div class="item"><div class="num" id="metaService">5000+</div><div class="lbl" data-i18n="meta_service">服务客户</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="scroll-hint"><div class="mouse"></div><span>向下滚动</span></div>
|
||||
<div class="scroll-hint"><div class="mouse"></div><span data-i18n="scroll_hint">向下滚动</span></div>
|
||||
</header>
|
||||
|
||||
<!-- 核心能力 -->
|
||||
@@ -491,11 +542,10 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container">
|
||||
<div class="section-head reveal">
|
||||
<div class="eyebrow">Core Capabilities</div>
|
||||
<h2 class="section-title">核心<span class="hl">能力</span>体系</h2>
|
||||
<p class="section-sub">从智能装备到工业互联网,我们构建覆盖全产业链的制造能力矩阵,以技术深度定义行业标准。</p>
|
||||
<h2 class="section-title" data-i18n="cap_title">核心<span class="hl">能力</span>体系</h2>
|
||||
<p class="section-sub" data-i18n="cap_sub">从智能装备到工业互联网,我们构建覆盖全产业链的制造能力矩阵,以技术深度定义行业标准。</p>
|
||||
</div>
|
||||
<div id="capWrap">
|
||||
<!-- 骨架屏 -->
|
||||
<div class="cap-item">
|
||||
<div class="cap-visual"><div class="cap-visual-card skeleton"></div></div>
|
||||
<div class="cap-body"><div class="skeleton sk-line w30"></div><div class="skeleton sk-line w80" style="height:28px"></div><div class="skeleton sk-line w60"></div><div class="skeleton sk-line"></div></div>
|
||||
@@ -509,8 +559,8 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container">
|
||||
<div class="section-head reveal">
|
||||
<div class="eyebrow">Qualifications & Data</div>
|
||||
<h2 class="section-title">资质<span class="hl">实力</span>印证</h2>
|
||||
<p class="section-sub">数字背后是十余年深耕制造业的沉淀,每一项指标都印证着我们对卓越的持续追求。</p>
|
||||
<h2 class="section-title" data-i18n="stats_title">资质<span class="hl">实力</span>印证</h2>
|
||||
<p class="section-sub" data-i18n="stats_sub">数字背后是十余年深耕制造业的沉淀,每一项指标都印证着我们对卓越的持续追求。</p>
|
||||
</div>
|
||||
<div class="stats-grid" id="statsGrid">
|
||||
<div class="stat-card"><div class="skeleton sk-block" style="height:80px"></div></div>
|
||||
@@ -526,8 +576,8 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container">
|
||||
<div class="section-head reveal">
|
||||
<div class="eyebrow">News & Updates</div>
|
||||
<h2 class="section-title">新闻<span class="hl">动态</span></h2>
|
||||
<p class="section-sub">关注我们的最新进展、技术突破与行业洞察,见证智能制造的每一步演进。</p>
|
||||
<h2 class="section-title" data-i18n="news_title">新闻<span class="hl">动态</span></h2>
|
||||
<p class="section-sub" data-i18n="news_sub">关注我们的最新进展、技术突破与行业洞察,见证智能制造的每一步演进。</p>
|
||||
</div>
|
||||
<div class="news-list" id="newsList">
|
||||
<div class="news-item"><div class="skeleton sk-line w40" style="height:28px"></div><div><div class="skeleton sk-line w80" style="height:20px"></div><div class="skeleton sk-line"></div><div class="skeleton sk-line w60"></div></div></div>
|
||||
@@ -541,8 +591,8 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container">
|
||||
<div class="section-head reveal">
|
||||
<div class="eyebrow">Our Team</div>
|
||||
<h2 class="section-title">核心<span class="hl">团队</span></h2>
|
||||
<p class="section-sub">汇聚行业顶尖人才,以深厚的技术积淀与前瞻视野,引领企业持续创新。</p>
|
||||
<h2 class="section-title" data-i18n="team_title">核心<span class="hl">团队</span></h2>
|
||||
<p class="section-sub" data-i18n="team_sub">汇聚行业顶尖人才,以深厚的技术积淀与前瞻视野,引领企业持续创新。</p>
|
||||
</div>
|
||||
<div class="team-grid" id="teamGrid">
|
||||
<div class="team-card"><div class="skeleton sk-card"></div></div>
|
||||
@@ -557,18 +607,18 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container">
|
||||
<div class="section-head reveal" style="text-align:center;max-width:none">
|
||||
<div class="eyebrow" style="justify-content:center">Vision & Mission</div>
|
||||
<h2 class="section-title">愿景与<span class="hl">使命</span></h2>
|
||||
<h2 class="section-title" data-i18n="vision_title">愿景与<span class="hl">使命</span></h2>
|
||||
</div>
|
||||
<div class="vision-grid">
|
||||
<div class="vision-card reveal">
|
||||
<span class="quote">“</span>
|
||||
<div class="vlabel">企业愿景 / Vision</div>
|
||||
<p class="vtext" id="visionText">载入中...</p>
|
||||
<div class="vlabel" data-i18n="vision_label">企业愿景</div>
|
||||
<p class="vtext" id="visionText" data-i18n="loading">载入中...</p>
|
||||
</div>
|
||||
<div class="vision-card reveal d2">
|
||||
<span class="quote">“</span>
|
||||
<div class="vlabel">企业使命 / Mission</div>
|
||||
<p class="vtext" id="missionText">载入中...</p>
|
||||
<div class="vlabel" data-i18n="mission_label">企业使命</div>
|
||||
<p class="vtext" id="missionText" data-i18n="loading">载入中...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -579,36 +629,36 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="container">
|
||||
<div class="section-head reveal">
|
||||
<div class="eyebrow">Contact Us</div>
|
||||
<h2 class="section-title">联系<span class="hl">我们</span></h2>
|
||||
<p class="section-sub">无论您有何种需求,我们都期待与您建立连接,共同探索智能制造的无限可能。</p>
|
||||
<h2 class="section-title" data-i18n="contact_title">联系<span class="hl">我们</span></h2>
|
||||
<p class="section-sub" data-i18n="contact_sub">无论您有何种需求,我们都期待与您建立连接,共同探索智能制造的无限可能。</p>
|
||||
</div>
|
||||
<div class="contact-grid" id="contactGrid">
|
||||
<div class="contact-info">
|
||||
<div class="contact-card">
|
||||
<div class="contact-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.36 1.9.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0122 16.92z"/></svg></div>
|
||||
<div><div class="ct-lbl">联系电话</div><div class="ct-val" id="ctPhone">--</div></div>
|
||||
<div><div class="ct-lbl" data-i18n="ct_phone">联系电话</div><div class="ct-val" id="ctPhone">--</div></div>
|
||||
</div>
|
||||
<div class="contact-card">
|
||||
<div class="contact-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2z"/><path d="M22 6l-10 7L2 6"/></svg></div>
|
||||
<div><div class="ct-lbl">电子邮箱</div><div class="ct-val" id="ctEmail">--</div></div>
|
||||
<div><div class="ct-lbl" data-i18n="ct_email">电子邮箱</div><div class="ct-val" id="ctEmail">--</div></div>
|
||||
</div>
|
||||
<div class="contact-card">
|
||||
<div class="contact-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg></div>
|
||||
<div><div class="ct-lbl">官方网站</div><div class="ct-val" id="ctWeb">--</div></div>
|
||||
<div><div class="ct-lbl" data-i18n="ct_web">官方网站</div><div class="ct-val" id="ctWeb">--</div></div>
|
||||
</div>
|
||||
<div class="contact-card">
|
||||
<div class="contact-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg></div>
|
||||
<div><div class="ct-lbl">公司地址</div><div class="ct-val" id="ctAddr">--</div></div>
|
||||
<div><div class="ct-lbl" data-i18n="ct_addr">公司地址</div><div class="ct-val" id="ctAddr">--</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-map">
|
||||
<div class="contact-map-inner">
|
||||
<div class="map-tag">Headquarters</div>
|
||||
<div class="map-addr" id="mapAddr">--</div>
|
||||
<p class="map-desc" id="mapDesc">载入中...</p>
|
||||
<p class="map-desc" id="mapDesc" data-i18n="loading">载入中...</p>
|
||||
</div>
|
||||
<a href="#hero" class="map-cta">
|
||||
返回顶部
|
||||
<span data-i18n="back_to_top">返回顶部</span>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
|
||||
</a>
|
||||
</div>
|
||||
@@ -623,58 +673,287 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;color:inhe
|
||||
<div class="footer-brand">
|
||||
<a href="#hero" class="logo">
|
||||
<div class="logo-mark"><span>M</span></div>
|
||||
<div class="logo-txt"><span id="footName">MANUFACT</span><small>智能制造</small></div>
|
||||
<div class="logo-txt"><span id="footName">MANUFACT</span><small data-i18n="logo_subtitle">智能制造</small></div>
|
||||
</a>
|
||||
<p id="footDesc">致力于为全球客户提供智能制造与工业自动化解决方案,以技术创新驱动产业升级。</p>
|
||||
<p id="footDesc" data-i18n="footer_desc">致力于为全球客户提供智能制造与工业自动化解决方案,以技术创新驱动产业升级。</p>
|
||||
</div>
|
||||
<div class="footer-col">
|
||||
<h4>导航</h4>
|
||||
<h4 data-i18n="footer_nav_title">导航</h4>
|
||||
<ul>
|
||||
<li><a href="#hero">首页</a></li>
|
||||
<li><a href="#capabilities">核心能力</a></li>
|
||||
<li><a href="#stats">资质实力</a></li>
|
||||
<li><a href="#news">新闻动态</a></li>
|
||||
<li><a href="#hero" data-i18n="nav_home">首页</a></li>
|
||||
<li><a href="#capabilities" data-i18n="footer_cap">核心能力</a></li>
|
||||
<li><a href="#stats" data-i18n="footer_stats">资质实力</a></li>
|
||||
<li><a href="#news" data-i18n="nav_news">新闻动态</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer-col">
|
||||
<h4>关于</h4>
|
||||
<h4 data-i18n="footer_about_title">关于</h4>
|
||||
<ul>
|
||||
<li><a href="#team">团队介绍</a></li>
|
||||
<li><a href="#vision">企业愿景</a></li>
|
||||
<li><a href="#contact">联系我们</a></li>
|
||||
<li><a href="#team" data-i18n="footer_team">团队介绍</a></li>
|
||||
<li><a href="#vision" data-i18n="footer_vision">企业愿景</a></li>
|
||||
<li><a href="#contact" data-i18n="nav_contact">联系我们</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer-col">
|
||||
<h4>联系方式</h4>
|
||||
<h4 data-i18n="footer_contact_title">联系方式</h4>
|
||||
<ul>
|
||||
<li><a href="tel:" id="footPhone">--</a></li>
|
||||
<li><a href="mailto:" id="footEmail">--</a></li>
|
||||
<li><a href="#contact">公司地址</a></li>
|
||||
<li><a href="#contact" data-i18n="ct_addr">公司地址</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-bottom">
|
||||
<p id="footCopy">© 2026 智能制造企业. 保留所有权利.</p>
|
||||
<div class="links">
|
||||
<a href="#hero">隐私政策</a>
|
||||
<a href="#hero">服务条款</a>
|
||||
<a href="#hero">网站地图</a>
|
||||
<a href="#hero" data-i18n="footer_privacy">隐私政策</a>
|
||||
<a href="#hero" data-i18n="footer_terms">服务条款</a>
|
||||
<a href="#hero" data-i18n="footer_sitemap">网站地图</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
/* =========================================================
|
||||
i18n 国际化引擎
|
||||
========================================================= */
|
||||
const I18N_LOCALES = {
|
||||
'zh-CN': {
|
||||
loading: '系统加载中',
|
||||
logo_subtitle: '智能制造',
|
||||
nav_home: '首页',
|
||||
nav_capabilities: '能力',
|
||||
nav_stats: '资质',
|
||||
nav_news: '新闻',
|
||||
nav_contact: '联系',
|
||||
nav_cta: '立即咨询',
|
||||
hero_tag: '智能制造 · 工业自动化解决方案',
|
||||
hero_slogan: '致力于智能制造与工业自动化解决方案',
|
||||
hero_cta1: '探索核心能力',
|
||||
hero_cta2: '联系我们',
|
||||
meta_founded: '成立年份',
|
||||
meta_scale: '团队规模',
|
||||
meta_service: '服务客户',
|
||||
scroll_hint: '向下滚动',
|
||||
cap_title: '核心能力体系',
|
||||
cap_sub: '从智能装备到工业互联网,我们构建覆盖全产业链的制造能力矩阵,以技术深度定义行业标准。',
|
||||
cap_no_data: '暂无能力数据',
|
||||
stats_title: '资质实力印证',
|
||||
stats_sub: '数字背后是十余年深耕制造业的沉淀,每一项指标都印证着我们对卓越的持续追求。',
|
||||
stats_no_data: '暂无统计数据',
|
||||
news_title: '新闻动态',
|
||||
news_sub: '关注我们的最新进展、技术突破与行业洞察,见证智能制造的每一步演进。',
|
||||
news_no_data: '暂无新闻动态',
|
||||
team_title: '核心团队',
|
||||
team_sub: '汇聚行业顶尖人才,以深厚的技术积淀与前瞻视野,引领企业持续创新。',
|
||||
team_no_data: '暂无团队信息',
|
||||
vision_title: '愿景与使命',
|
||||
vision_label: '企业愿景',
|
||||
mission_label: '企业使命',
|
||||
contact_title: '联系我们',
|
||||
contact_sub: '无论您有何种需求,我们都期待与您建立连接,共同探索智能制造的无限可能。',
|
||||
ct_phone: '联系电话',
|
||||
ct_email: '电子邮箱',
|
||||
ct_web: '官方网站',
|
||||
ct_addr: '公司地址',
|
||||
back_to_top: '返回顶部',
|
||||
footer_desc: '致力于为全球客户提供智能制造与工业自动化解决方案,以技术创新驱动产业升级。',
|
||||
footer_nav_title: '导航',
|
||||
footer_cap: '核心能力',
|
||||
footer_stats: '资质实力',
|
||||
footer_about_title: '关于',
|
||||
footer_team: '团队介绍',
|
||||
footer_vision: '企业愿景',
|
||||
footer_contact_title: '联系方式',
|
||||
footer_privacy: '隐私政策',
|
||||
footer_terms: '服务条款',
|
||||
footer_sitemap: '网站地图',
|
||||
error_title: '数据加载失败',
|
||||
error_reload: '重新加载',
|
||||
error_unknown: '未知错误,请稍后重试',
|
||||
cat_company: '企业动态',
|
||||
cat_industry: '行业资讯',
|
||||
cat_product: '产品发布',
|
||||
cat_tech: '技术前沿',
|
||||
cat_default: '企业动态',
|
||||
copyright_suffix: '保留所有权利.'
|
||||
},
|
||||
'en': {
|
||||
loading: 'Loading…',
|
||||
logo_subtitle: 'SMART MFG',
|
||||
nav_home: 'Home',
|
||||
nav_capabilities: 'Capabilities',
|
||||
nav_stats: 'Qualifications',
|
||||
nav_news: 'News',
|
||||
nav_contact: 'Contact',
|
||||
nav_cta: 'Get a Quote',
|
||||
hero_tag: 'Smart Manufacturing · Industrial Automation Solutions',
|
||||
hero_slogan: 'Committed to smart manufacturing and industrial automation solutions',
|
||||
hero_cta1: 'Explore Capabilities',
|
||||
hero_cta2: 'Contact Us',
|
||||
meta_founded: 'FOUNDED',
|
||||
meta_scale: 'TEAM SIZE',
|
||||
meta_service: 'CLIENTS SERVED',
|
||||
scroll_hint: 'SCROLL DOWN',
|
||||
cap_title: 'Core Capabilities',
|
||||
cap_sub: 'From smart equipment to the Industrial Internet, we build a manufacturing capability matrix covering the entire industry chain, defining industry standards with technological depth.',
|
||||
cap_no_data: 'No capability data available',
|
||||
stats_title: 'Qualifications & Strength',
|
||||
stats_sub: 'Behind the numbers lies over a decade of manufacturing expertise. Every metric reflects our relentless pursuit of excellence.',
|
||||
stats_no_data: 'No statistics available',
|
||||
news_title: 'News & Updates',
|
||||
news_sub: 'Follow our latest developments, technological breakthroughs, and industry insights — witnessing every step of smart manufacturing evolution.',
|
||||
news_no_data: 'No news available',
|
||||
team_title: 'Core Team',
|
||||
team_sub: 'Bringing together top talent in the industry, leading continuous innovation with deep technical expertise and forward-thinking vision.',
|
||||
team_no_data: 'No team data available',
|
||||
vision_title: 'Vision & Mission',
|
||||
vision_label: 'VISION',
|
||||
mission_label: 'MISSION',
|
||||
contact_title: 'Contact Us',
|
||||
contact_sub: 'Whatever your needs, we look forward to connecting with you and exploring the limitless possibilities of smart manufacturing together.',
|
||||
ct_phone: 'PHONE',
|
||||
ct_email: 'EMAIL',
|
||||
ct_web: 'WEBSITE',
|
||||
ct_addr: 'ADDRESS',
|
||||
back_to_top: 'Back to Top',
|
||||
footer_desc: 'Committed to providing global clients with smart manufacturing and industrial automation solutions, driving industrial upgrades through technological innovation.',
|
||||
footer_nav_title: 'Navigation',
|
||||
footer_cap: 'Capabilities',
|
||||
footer_stats: 'Qualifications',
|
||||
footer_about_title: 'About',
|
||||
footer_team: 'Our Team',
|
||||
footer_vision: 'Vision',
|
||||
footer_contact_title: 'Contact',
|
||||
footer_privacy: 'Privacy Policy',
|
||||
footer_terms: 'Terms of Service',
|
||||
footer_sitemap: 'Sitemap',
|
||||
error_title: 'Failed to Load Data',
|
||||
error_reload: 'Reload',
|
||||
error_unknown: 'Unknown error, please try again later',
|
||||
cat_company: 'Company',
|
||||
cat_industry: 'Industry',
|
||||
cat_product: 'Product',
|
||||
cat_tech: 'Technology',
|
||||
cat_default: 'Company',
|
||||
copyright_suffix: 'All rights reserved.'
|
||||
},
|
||||
'zh-TW': {
|
||||
loading: '系統載入中',
|
||||
logo_subtitle: '智慧製造',
|
||||
nav_home: '首頁',
|
||||
nav_capabilities: '能力',
|
||||
nav_stats: '資質',
|
||||
nav_news: '新聞',
|
||||
nav_contact: '聯繫',
|
||||
nav_cta: '立即諮詢',
|
||||
hero_tag: '智慧製造 · 工業自動化解決方案',
|
||||
hero_slogan: '致力於智慧製造與工業自動化解決方案',
|
||||
hero_cta1: '探索核心能力',
|
||||
hero_cta2: '聯繫我們',
|
||||
meta_founded: '成立年份',
|
||||
meta_scale: '團隊規模',
|
||||
meta_service: '服務客戶',
|
||||
scroll_hint: '向下捲動',
|
||||
cap_title: '核心能力體系',
|
||||
cap_sub: '從智慧裝備到工業互聯網,我們構建覆蓋全產業鏈的製造能力矩陣,以技術深度定義行業標準。',
|
||||
cap_no_data: '暫無能力資料',
|
||||
stats_title: '資質實力印證',
|
||||
stats_sub: '數字背後是十餘年深耕製造業的沉澱,每一項指標都印證著我們對卓越的持續追求。',
|
||||
stats_no_data: '暫無統計資料',
|
||||
news_title: '新聞動態',
|
||||
news_sub: '關注我們的最新進展、技術突破與行業洞察,見證智慧製造的每一步演進。',
|
||||
news_no_data: '暫無新聞動態',
|
||||
team_title: '核心團隊',
|
||||
team_sub: '匯聚行業頂尖人才,以深厚的技術積澱與前瞻視野,引領企業持續創新。',
|
||||
team_no_data: '暫無團隊資訊',
|
||||
vision_title: '願景與使命',
|
||||
vision_label: '企業願景',
|
||||
mission_label: '企業使命',
|
||||
contact_title: '聯繫我們',
|
||||
contact_sub: '無論您有何種需求,我們都期待與您建立連接,共同探索智慧製造的無限可能。',
|
||||
ct_phone: '聯繫電話',
|
||||
ct_email: '電子信箱',
|
||||
ct_web: '官方網站',
|
||||
ct_addr: '公司地址',
|
||||
back_to_top: '返回頂部',
|
||||
footer_desc: '致力於為全球客戶提供智慧製造與工業自動化解決方案,以技術創新驅動產業升級。',
|
||||
footer_nav_title: '導航',
|
||||
footer_cap: '核心能力',
|
||||
footer_stats: '資質實力',
|
||||
footer_about_title: '關於',
|
||||
footer_team: '團隊介紹',
|
||||
footer_vision: '企業願景',
|
||||
footer_contact_title: '聯繫方式',
|
||||
footer_privacy: '隱私政策',
|
||||
footer_terms: '服務條款',
|
||||
footer_sitemap: '網站地圖',
|
||||
error_title: '資料載入失敗',
|
||||
error_reload: '重新載入',
|
||||
error_unknown: '未知錯誤,請稍後重試',
|
||||
cat_company: '企業動態',
|
||||
cat_industry: '行業資訊',
|
||||
cat_product: '產品發布',
|
||||
cat_tech: '技術前沿',
|
||||
cat_default: '企業動態',
|
||||
copyright_suffix: '保留所有權利.'
|
||||
}
|
||||
};
|
||||
|
||||
const LANG_LABELS = {'zh-CN':'中文','en':'EN','zh-TW':'繁中'};
|
||||
|
||||
let currentLang = (function(){
|
||||
try{
|
||||
var u=new URLSearchParams(location.search).get('lang');
|
||||
if(u&&I18N_LOCALES[u]) return u;
|
||||
}catch(e){}
|
||||
try{var s=localStorage.getItem('lang');if(s&&I18N_LOCALES[s]) return s;}catch(e){}
|
||||
var b=navigator.language||navigator.userLanguage||'';
|
||||
if(b.startsWith('zh-TW')||b.startsWith('zh-Hant')) return 'zh-TW';
|
||||
if(b.startsWith('zh')) return 'zh-CN';
|
||||
return 'en';
|
||||
})();
|
||||
|
||||
function t(key){return (I18N_LOCALES[currentLang]&&I18N_LOCALES[currentLang][key])||(I18N_LOCALES['zh-CN'][key])||key;}
|
||||
|
||||
function applyI18n(){
|
||||
document.querySelectorAll('[data-i18n]').forEach(function(el){
|
||||
var key=el.getAttribute('data-i18n');
|
||||
el.textContent=t(key);
|
||||
});
|
||||
document.documentElement.lang=currentLang==='zh-TW'?'zh-TW':currentLang==='zh-CN'?'zh-CN':'en';
|
||||
document.getElementById('langLabel').textContent=LANG_LABELS[currentLang]||currentLang;
|
||||
document.querySelectorAll('.lang-option').forEach(function(opt){
|
||||
opt.classList.toggle('active',opt.getAttribute('data-lang')===currentLang);
|
||||
});
|
||||
}
|
||||
|
||||
function switchLang(lang){
|
||||
if(!I18N_LOCALES[lang]) return;
|
||||
currentLang=lang;
|
||||
try{localStorage.setItem('lang',lang);}catch(e){}
|
||||
applyI18n();
|
||||
if(typeof onLangChange==='function') onLangChange(lang);
|
||||
document.getElementById('langDropdown').classList.remove('open');
|
||||
}
|
||||
|
||||
function toggleLangDropdown(){
|
||||
document.getElementById('langDropdown').classList.toggle('open');
|
||||
}
|
||||
document.addEventListener('click',function(e){
|
||||
var sw=document.getElementById('langSwitcher');
|
||||
if(sw&&!sw.contains(e.target)) document.getElementById('langDropdown').classList.remove('open');
|
||||
});
|
||||
|
||||
/* ===================== SVG 图标库 ===================== */
|
||||
const ICONS = {
|
||||
// 服务图标
|
||||
ai:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="4" y="4" width="16" height="16" rx="2"/><circle cx="9" cy="9" r="1.5" fill="currentColor"/><circle cx="15" cy="9" r="1.5" fill="currentColor"/><path d="M9 15h6M12 9v6"/></svg>',
|
||||
cloud:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17.5 19a4.5 4.5 0 100-9 5.5 5.5 0 00-10.83-1.5A4 4 0 006.5 19h11z"/></svg>',
|
||||
iot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="3"/><path d="M12 2v4M12 18v4M2 12h4M18 12h4M4.9 4.9l2.8 2.8M16.3 16.3l2.8 2.8M4.9 19.1l2.8-2.8M16.3 7.7l2.8-2.8"/></svg>',
|
||||
data:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5v6c0 1.66 4 3 9 3s9-1.34 9-3V5M3 11v6c0 1.66 4 3 9 3s9-1.34 9-3v-6"/></svg>',
|
||||
security:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2l8 4v6c0 5-3.5 9-8 10-4.5-1-8-5-8-10V6l8-4z"/><path d="M9 12l2 2 4-4"/></svg>',
|
||||
consulting:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/><path d="M8 10h.01M12 10h.01M16 10h.01"/></svg>',
|
||||
// 统计图标
|
||||
users:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75"/></svg>',
|
||||
patent:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 2l2.4 7.4H22l-6 4.5 2.3 7.1-6.3-4.6L5.7 21l2.3-7.1-6-4.5h7.6z"/></svg>',
|
||||
globe:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><path d="M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>',
|
||||
@@ -704,7 +983,6 @@ function escapeHtml(s){
|
||||
if(s==null)return'';
|
||||
return String(s).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
}
|
||||
// 从 stats value 中提取数字与后缀用于计数
|
||||
function splitNum(val){
|
||||
const m=String(val).match(/^([\d.]+)(.*)$/);
|
||||
if(m)return{num:parseFloat(m[1]),suffix:m[2]||''};
|
||||
@@ -714,58 +992,49 @@ function splitNum(val){
|
||||
/* ===================== 数据获取 ===================== */
|
||||
async function fetchData(){
|
||||
const res=await fetch('/api/v1/enterprise/all',{headers:{'Accept':'application/json'}});
|
||||
if(!res.ok)throw new Error('网络响应异常 ('+res.status+')');
|
||||
if(!res.ok)throw new Error('Network error ('+res.status+')');
|
||||
const json=await res.json();
|
||||
if(json.code!==0)throw new Error(json.message||'数据获取失败');
|
||||
if(json.code!==0)throw new Error(json.message||'API error');
|
||||
return json.data;
|
||||
}
|
||||
|
||||
/* ===================== 渲染:Hero / 通用信息 ===================== */
|
||||
function renderCompany(c){
|
||||
if(!c)return;
|
||||
const name=c.name||'智能制造企业';
|
||||
document.title=name+' | 智能制造官网';
|
||||
// 导航与页脚名称:取英文风格缩写
|
||||
const name=c.name||'';
|
||||
document.title=name+' | '+t('logo_subtitle');
|
||||
const shortName=name.replace(/科技集团|集团|科技|有限公司|股份有限公司/g,'').slice(0,8).toUpperCase()||'MANUFACT';
|
||||
document.getElementById('navName').textContent=shortName;
|
||||
document.getElementById('footName').textContent=shortName;
|
||||
// Hero
|
||||
document.getElementById('heroTitle').innerHTML=escapeHtml(c.name||'用精密制造驱动工业未来').replace(/(.{0,6})$/,'<span class="accent">$1</span>');
|
||||
// 若 slogan 过短则用标题拆分;否则直接展示
|
||||
document.getElementById('heroTitle').innerHTML=escapeHtml(c.name||t('hero_slogan')).replace(/(.{0,6})$/,'<span class="accent">$1</span>');
|
||||
if(c.slogan){
|
||||
document.getElementById('heroTitle').innerHTML=
|
||||
escapeHtml(c.name||'')+'<br><span class="accent">'+escapeHtml(c.slogan)+'</span>';
|
||||
}
|
||||
document.getElementById('heroSlogan').textContent=c.description?c.description.slice(0,120)+(c.description.length>120?'...':''):'致力于智能制造与工业自动化解决方案';
|
||||
// Hero meta
|
||||
document.getElementById('heroSlogan').textContent=c.description?c.description.slice(0,120)+(c.description.length>120?'...':''):t('hero_slogan');
|
||||
document.getElementById('metaYear').textContent=c.founded_year||'2010';
|
||||
document.getElementById('metaEmp').textContent=c.employee_count||'2000+';
|
||||
// 联系方式
|
||||
document.getElementById('ctPhone').textContent=c.phone||'--';
|
||||
document.getElementById('ctEmail').textContent=c.email||'--';
|
||||
document.getElementById('ctWeb').textContent=c.website||'--';
|
||||
document.getElementById('ctAddr').textContent=c.address||'--';
|
||||
document.getElementById('mapAddr').textContent=c.address||'--';
|
||||
document.getElementById('mapDesc').textContent=c.description||'欢迎莅临我司总部,共商合作。';
|
||||
/* 企业 Logo 图片注入 */
|
||||
document.getElementById('mapDesc').textContent=c.description||'';
|
||||
if(c.logo){
|
||||
document.querySelectorAll('.logo-mark').forEach(function(lm){
|
||||
lm.style.overflow='hidden';
|
||||
lm.insertAdjacentHTML('beforeend','<img src="'+escapeHtml(c.logo)+'" alt="logo" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover" onerror="this.remove()">');
|
||||
});
|
||||
}
|
||||
// 页脚
|
||||
document.getElementById('footDesc').textContent=c.description?c.description.slice(0,90)+'...':'致力于为全球客户提供智能制造与工业自动化解决方案。';
|
||||
document.getElementById('footDesc').textContent=c.description?c.description.slice(0,90)+'...':'';
|
||||
document.getElementById('footPhone').textContent=c.phone||'--';
|
||||
document.getElementById('footEmail').textContent=c.email||'--';
|
||||
document.getElementById('footCopy').innerHTML='© '+(new Date().getFullYear())+' '+escapeHtml(name)+'. 保留所有权利.';
|
||||
// 愿景使命
|
||||
document.getElementById('footCopy').innerHTML='© '+(new Date().getFullYear())+' '+escapeHtml(name)+'. '+t('copyright_suffix');
|
||||
const vt=document.getElementById('visionText');
|
||||
vt.innerHTML=highlight(escapeHtml(c.vision||''));
|
||||
const mt=document.getElementById('missionText');
|
||||
mt.innerHTML=highlight(escapeHtml(c.mission||''));
|
||||
}
|
||||
// 简单高亮:将关键短语用橙色包裹
|
||||
function highlight(text){
|
||||
return text
|
||||
.replace(/(全球领先|创新技术|核心驱动力|创造价值|承担责任|提供平台|智能制造|工业)/g,'<span class="hl">$1</span>');
|
||||
@@ -774,7 +1043,7 @@ function highlight(text){
|
||||
/* ===================== 渲染:核心能力 ===================== */
|
||||
function renderServices(services){
|
||||
const wrap=document.getElementById('capWrap');
|
||||
if(!services||!services.length){wrap.innerHTML='<p style="color:var(--warm)">暂无能力数据</p>';return}
|
||||
if(!services||!services.length){wrap.innerHTML='<p style="color:var(--warm)">'+t('cap_no_data')+'</p>';return}
|
||||
wrap.innerHTML=services.map((s,i)=>{
|
||||
const idx=pad(i+1);
|
||||
const flip=i%2===1?'flip':'';
|
||||
@@ -794,7 +1063,7 @@ function renderServices(services){
|
||||
</div>
|
||||
</div>
|
||||
<div class="cap-body">
|
||||
<span class="cap-cat">能力 ${idx}</span>
|
||||
<span class="cap-cat">CAP ${idx}</span>
|
||||
<h3 class="cap-title">${escapeHtml(s.title)}</h3>
|
||||
<p class="cap-desc">${escapeHtml(s.description||'')}</p>
|
||||
<div class="cap-features">${featHtml}</div>
|
||||
@@ -809,10 +1078,9 @@ function renderStats(c){
|
||||
const grid=document.getElementById('statsGrid');
|
||||
const stats=safeParse(c&&c.stats,[]);
|
||||
if(!stats.length){
|
||||
grid.innerHTML='<p style="color:var(--warm);grid-column:1/-1;text-align:center">暂无统计数据</p>';
|
||||
grid.innerHTML='<p style="color:var(--warm);grid-column:1/-1;text-align:center">'+t('stats_no_data')+'</p>';
|
||||
return;
|
||||
}
|
||||
// 同时更新 hero meta 的服务客户数
|
||||
const clientStat=stats.find(s=>/客户|customer/i.test(s.label));
|
||||
if(clientStat){document.getElementById('metaService').textContent=clientStat.value}
|
||||
grid.innerHTML=stats.map((s,i)=>{
|
||||
@@ -826,7 +1094,6 @@ function renderStats(c){
|
||||
</div>`;
|
||||
}).join('');
|
||||
observeReveal();
|
||||
// 启动计数与进度条
|
||||
animateStats();
|
||||
}
|
||||
function animateStats(){
|
||||
@@ -847,7 +1114,6 @@ function animateStats(){
|
||||
});
|
||||
},{threshold:.4});
|
||||
els.forEach(el=>io.observe(el));
|
||||
// 进度条
|
||||
const bars=document.querySelectorAll('.stat-bar span');
|
||||
const io2=new IntersectionObserver((entries)=>{
|
||||
entries.forEach(en=>{
|
||||
@@ -875,13 +1141,14 @@ function countUp(el,target,suffix,dur){
|
||||
}
|
||||
|
||||
/* ===================== 渲染:新闻动态 ===================== */
|
||||
const CAT_MAP={company:'企业动态',industry:'行业资讯',product:'产品发布',tech:'技术前沿',default:'企业动态'};
|
||||
const CAT_MAP_KEY={company:'cat_company',industry:'cat_industry',product:'cat_product',tech:'cat_tech'};
|
||||
function renderNews(news){
|
||||
const list=document.getElementById('newsList');
|
||||
if(!news||!news.length){list.innerHTML='<p style="color:var(--warm)">暂无新闻动态</p>';return}
|
||||
if(!news||!news.length){list.innerHTML='<p style="color:var(--warm)">'+t('news_no_data')+'</p>';return}
|
||||
list.innerHTML=news.map((n,i)=>{
|
||||
const dt=formatDate(n.created_at);
|
||||
const cat=CAT_MAP[n.category]||CAT_MAP.default;
|
||||
const catKey=CAT_MAP_KEY[n.category];
|
||||
const cat=catKey?t(catKey):t('cat_default');
|
||||
return `
|
||||
<div class="news-item reveal d${(i%3)}">
|
||||
<div class="news-date">
|
||||
@@ -895,7 +1162,7 @@ function renderNews(news){
|
||||
<p>${escapeHtml(n.summary||'')}</p>
|
||||
<div class="news-meta">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></svg>
|
||||
<span>${escapeHtml(n.author||'编辑部')}</span>
|
||||
<span>${escapeHtml(n.author||'')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -914,7 +1181,7 @@ const GRADIENTS=[
|
||||
];
|
||||
function renderTeam(team){
|
||||
const grid=document.getElementById('teamGrid');
|
||||
if(!team||!team.length){grid.innerHTML='<p style="color:var(--warm)">暂无团队信息</p>';return}
|
||||
if(!team||!team.length){grid.innerHTML='<p style="color:var(--warm)">'+t('team_no_data')+'</p>';return}
|
||||
grid.innerHTML=team.map((m,i)=>{
|
||||
const initial=(m.name||'?').charAt(0);
|
||||
const grad=GRADIENTS[i%GRADIENTS.length];
|
||||
@@ -952,11 +1219,9 @@ function initNav(){
|
||||
const toggle=document.getElementById('navToggle');
|
||||
const menu=document.getElementById('navMenu');
|
||||
const links=document.querySelectorAll('.nav-link');
|
||||
// 滚动效果
|
||||
window.addEventListener('scroll',()=>{
|
||||
if(window.scrollY>40)nav.classList.add('scrolled');
|
||||
else nav.classList.remove('scrolled');
|
||||
// 高亮当前锚点
|
||||
const sections=['hero','capabilities','stats','news','contact'];
|
||||
let current='hero';
|
||||
for(const id of sections){
|
||||
@@ -968,7 +1233,6 @@ function initNav(){
|
||||
l.classList.toggle('active',href==='#'+current);
|
||||
});
|
||||
},{passive:true});
|
||||
// 移动端菜单
|
||||
toggle.addEventListener('click',()=>{
|
||||
toggle.classList.toggle('open');
|
||||
menu.classList.toggle('open');
|
||||
@@ -985,31 +1249,53 @@ function showError(msg){
|
||||
loader.innerHTML=`
|
||||
<div style="text-align:center;max-width:420px;padding:24px">
|
||||
<div style="font-size:48px;margin-bottom:16px;color:var(--accent)">⚠</div>
|
||||
<h3 style="color:#fff;font-size:20px;margin-bottom:10px">数据加载失败</h3>
|
||||
<p style="color:var(--warm);font-size:14px;margin-bottom:24px">${escapeHtml(msg)}</p>
|
||||
<button onclick="location.reload()" style="padding:12px 28px;background:var(--accent);color:#fff;border-radius:4px;font-weight:700;cursor:pointer">重新加载</button>
|
||||
<h3 style="color:#fff;font-size:20px;margin-bottom:10px">${t('error_title')}</h3>
|
||||
<p style="color:var(--warm);font-size:14px;margin-bottom:24px">${escapeHtml(msg||t('error_unknown'))}</p>
|
||||
<button onclick="location.reload()" style="padding:12px 28px;background:var(--accent);color:#fff;border-radius:4px;font-weight:700;cursor:pointer">${t('error_reload')}</button>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
/* =========================================================
|
||||
语言切换回调:重新渲染动态内容
|
||||
========================================================= */
|
||||
var lastData={};
|
||||
function onLangChange(){
|
||||
applyI18n();
|
||||
if(lastData.company){
|
||||
renderCompany(lastData.company);
|
||||
renderServices(lastData.services||[]);
|
||||
renderStats(lastData.company);
|
||||
renderNews(lastData.news||[]);
|
||||
renderTeam(lastData.team||[]);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===================== 入口 ===================== */
|
||||
async function init(){
|
||||
initNav();
|
||||
observeReveal();
|
||||
applyI18n();
|
||||
try{
|
||||
const data=await fetchData();
|
||||
renderCompany(data.company);
|
||||
renderServices(data.services);
|
||||
renderStats(data.company);
|
||||
renderNews(data.news);
|
||||
renderTeam(data.team);
|
||||
// 隐藏加载遮罩
|
||||
lastData={
|
||||
company:data.company||{},
|
||||
services:data.services||[],
|
||||
news:data.news||[],
|
||||
team:data.team||[]
|
||||
};
|
||||
renderCompany(lastData.company);
|
||||
renderServices(lastData.services);
|
||||
renderStats(lastData.company);
|
||||
renderNews(lastData.news);
|
||||
renderTeam(lastData.team);
|
||||
setTimeout(()=>{
|
||||
document.getElementById('loader').classList.add('hide');
|
||||
observeReveal();
|
||||
},300);
|
||||
}catch(err){
|
||||
console.error('[Site2] 数据加载失败:',err);
|
||||
showError(err.message||'未知错误,请稍后重试');
|
||||
document.getElementById('loader').classList.add('hide');
|
||||
showError(err.message||t('error_unknown'));
|
||||
}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded',init);
|
||||
|
||||
Reference in New Issue
Block a user