feat: 统一文件上传接口 + 模板图片展示 + 导航页 + 侧边栏调整

This commit is contained in:
admin
2026-07-10 20:43:02 +08:00
parent cbd0430452
commit ce6823e282
25 changed files with 933 additions and 166 deletions

View File

@@ -839,6 +839,14 @@ function renderHero(company){
document.getElementById('heroDesc').textContent=truncate(company.description,100);
document.getElementById('heroBadge').textContent=company.name||'全球领先的智能科技企业';
document.title=(company.name||'Nexus 科技集团')+(company.slogan?(' - '+company.slogan):'');
/* 企业 Logo 图片注入 */
if(company.logo){
document.querySelectorAll('.logo-mark').forEach(function(lm){
lm.style.position='relative';
lm.style.overflow='hidden';
lm.insertAdjacentHTML('beforeend','<img src="'+esc(company.logo)+'" alt="logo" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover" onerror="this.remove()">');
});
}
}
function renderStats(company){
@@ -865,7 +873,7 @@ function renderServices(services){
const feats=safeParse(sv.features,[]);
const featHtml=feats.map(f=>`<li><span class="chk">${icon('check')}</span><span>${esc(f)}</span></li>`).join('');
return `<div class="service-card glass reveal d${(i%3)+1}">
<div class="service-icon">${icon(sv.icon)}</div>
<div class="service-icon" style="position:relative;overflow:hidden">${icon(sv.icon)}${sv.image?`<img src="${esc(sv.image)}" alt="${esc(sv.title)}" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover" onerror="this.remove()">`:''}</div>
<h3>${esc(sv.title)}</h3>
<p class="desc">${esc(sv.description)}</p>
<ul class="features">${featHtml}</ul>
@@ -882,8 +890,9 @@ function renderNews(news){
const date=formatDate(nw.created_at);
return `<article class="news-card glass reveal d${(i%3)+1}">
<div class="news-thumb">
${nw.image?`<img src="${esc(nw.image)}" alt="${esc(nw.title)}" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0" onerror="this.style.display='none';this.nextElementSibling.style.display=''">`:''}
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="${nw.image?'display:none':''}"><path d="M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2"/><path d="M18 14h-8M15 18h-5M10 6h8v4h-8V6z"/></svg>
<span class="news-cat cat-${esc(nw.category)}">${esc(cat)}</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2"/><path d="M18 14h-8M15 18h-5M10 6h8v4h-8V6z"/></svg>
</div>
<div class="news-body">
<div class="news-meta">
@@ -903,7 +912,7 @@ function renderTeam(team){
if(!team||!team.length){grid.innerHTML='<p style="grid-column:1/-1;text-align:center;color:var(--text-muted)">暂无团队数据</p>';return;}
grid.innerHTML=team.map((m,i)=>{
return `<div class="team-card glass reveal d${(i%3)+1}">
<div class="team-avatar" style="background:${avatarColor(i)}">${esc(firstChar(m.name))}</div>
<div class="team-avatar" style="background:${avatarColor(i)};position:relative;overflow:hidden">${esc(firstChar(m.name))}${m.avatar?`<img src="${esc(m.avatar)}" alt="${esc(m.name)}" style="position:absolute;inset:0;width:100%;height:100%;border-radius:50%;object-fit:cover" onerror="this.remove()">`:''}</div>
<h3>${esc(m.name)}</h3>
<div class="team-role">${esc(m.position)}</div>
<p class="team-bio">${esc(m.bio)}</p>