133 lines
6.0 KiB
JavaScript
133 lines
6.0 KiB
JavaScript
document.addEventListener('DOMContentLoaded', function () {
|
||
const langData = {
|
||
zh: {
|
||
btn: "English",
|
||
logo: "../imgs/svg/logo.svg",
|
||
title: "深圳汉晶电子信息有限公司",
|
||
// 顶部
|
||
topBannerTitle: "未来发展与技术趋势",
|
||
// 列表
|
||
futureList: [
|
||
{
|
||
imgAlt: "AI加速芯片",
|
||
title: "持续迭代与优化",
|
||
desc: "聚焦AI加速芯片的高效能、低延迟与低功耗优化,支持智能终端、边缘计算和行业应用的多场景落地。持续推进自研IP核、算子优化和软硬件协同设计,提升芯片整体性能与能效比。",
|
||
circle: "应用领域"
|
||
},
|
||
{
|
||
imgAlt: "量子计算芯片",
|
||
title: "从架构到后端全面升级",
|
||
desc: "面向更极致能效目标,系统性优化芯片架构设计,探索异构计算、任务调度、功耗感知等关键技术。结合后端版图设计与工艺优化,打造具备竞争力的低功耗解决方案,助力智能设备与数据中心应用。",
|
||
circle: "技术方向"
|
||
},
|
||
{
|
||
imgAlt: "低功耗量子计算芯片",
|
||
title: "面向量产的工程化突破",
|
||
desc: "设计出功耗性能更优秀的定制化计算芯片。",
|
||
circle: "未来规划"
|
||
}
|
||
],
|
||
emailLeftTitle: "我们准备好了",
|
||
emailLeftText: "如果您有更多的需求,请联系我们",
|
||
},
|
||
en: {
|
||
btn: "简体中文",
|
||
logo: "../imgs/svg/logo_en.svg",
|
||
title: "SZHJ Electronic Information Co., Ltd",
|
||
// 顶部
|
||
topBannerTitle: "Future Development & Technology Trends",
|
||
// 列表
|
||
futureList: [
|
||
{
|
||
imgAlt: "AI Acceleration Chip",
|
||
title: "Continuous Iteration & Optimization",
|
||
desc: "Focus on high performance, low latency, and low power optimization of AI acceleration chips, supporting multi-scenario applications in smart terminals, edge computing, and industries. Continuously promote self-developed IP cores, operator optimization, and hardware-software co-design to improve overall chip performance and energy efficiency.",
|
||
circle: "Application Field"
|
||
},
|
||
{
|
||
imgAlt: "Quantum Computing Chip",
|
||
title: "Comprehensive Upgrade from Architecture to Backend",
|
||
desc: "Aiming for ultimate energy efficiency, systematically optimize chip architecture, explore key technologies such as heterogeneous computing, task scheduling, and power awareness. Combine backend layout design and process optimization to create competitive low-power solutions for smart devices and data centers.",
|
||
circle: "Technology Direction"
|
||
},
|
||
{
|
||
imgAlt: "Low Power Quantum Computing Chip",
|
||
title: "Engineering Breakthroughs for Mass Production",
|
||
desc: "Design customized computing chips with better power and performance.",
|
||
circle: "Future Plan"
|
||
}
|
||
],
|
||
emailLeftTitle: "We're ready.",
|
||
emailLeftText: "If you have more needs, please contact us!",
|
||
}
|
||
};
|
||
|
||
let currentLang = localStorage.getItem('siteLang') || "zh";
|
||
|
||
function applyLang(lang) {
|
||
const data = langData[lang];
|
||
|
||
// logo
|
||
|
||
document.getElementById("footerLogo").src = data.logo;
|
||
|
||
// 页面标题
|
||
document.title = data.title;
|
||
|
||
// 顶部标题
|
||
document.querySelector('.topBannerLeftTitle p').textContent = data.topBannerTitle;
|
||
document.querySelector('.footerBoxRightTitle').textContent = data.title;
|
||
// 列表内容
|
||
const futureList = document.querySelectorAll('.futureList > li');
|
||
data.futureList.forEach((item, idx) => {
|
||
if (futureList[idx]) {
|
||
// 图片alt
|
||
const img = futureList[idx].querySelector('.futureImg');
|
||
if (img) img.alt = item.imgAlt;
|
||
// 标题
|
||
const ps = futureList[idx].querySelectorAll('.futureContent p');
|
||
if (ps[0]) ps[0].textContent = item.title;
|
||
if (ps[1]) ps[1].textContent = item.desc;
|
||
// 圆圈
|
||
const circle = futureList[idx].querySelector('.futureCircleInner');
|
||
if (circle) circle.textContent = item.circle;
|
||
}
|
||
});
|
||
// 英文样式切换
|
||
const futureList2 = document.querySelector('.futureList');
|
||
if (lang === 'en') {
|
||
futureList2.classList.add('en');
|
||
} else {
|
||
futureList2.classList.remove('en');
|
||
}
|
||
|
||
// 邮箱区
|
||
document.querySelector(".emailLeftTitle").textContent = data.emailLeftTitle;
|
||
document.querySelector(".emailLeftText").textContent = data.emailLeftText;
|
||
|
||
// 按钮文本
|
||
document.getElementById("lang-toggle").textContent = data.btn;
|
||
|
||
// 英文样式调整(如有需要可扩展)
|
||
if (lang === 'en') {
|
||
document.querySelector('.topBannerLeftTitle p').classList.add('en');
|
||
} else {
|
||
document.querySelector('.topBannerLeftTitle p').classList.remove('en');
|
||
}
|
||
}
|
||
|
||
function handleLangToggle() {
|
||
currentLang = currentLang === "zh" ? "en" : "zh";
|
||
localStorage.setItem('siteLang', currentLang);
|
||
applyLang(currentLang);
|
||
}
|
||
|
||
// 初始化
|
||
applyLang(currentLang);
|
||
|
||
// 事件绑定
|
||
document.getElementById("lang-toggle").addEventListener("click", handleLangToggle);
|
||
document.getElementById("lang-toggle").addEventListener("keydown", e => {
|
||
if (e.key === "Enter" || e.key === " ") handleLangToggle();
|
||
});
|
||
}); |