This repository has been archived on 2026-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
Files
MetaLab/templates/MetaLab-2026/html/layout/nav.html
Victor_Jay 4ac4f64f33 feat: @提及功能优化 + 默认头像改用SVG图标
- 评论区有效@提及渲染为蓝色链接跳转/space/{uid},无效@保持纯文本
- 输入@触发悬浮窗,根据输入实时搜索用户(含头像+等级)
- 无匹配时显示未搜索到用户,选中后插入为@用户名 格式(尾部空格)
- 悬浮窗定位于输入光标上方,不遮挡输入内容
- 后端Comment新增Mentions字段,批量加载提及映射供前端判断
- SearchUsers/parseMentions 统一限制LV2+用户
- 所有默认头像由首字符文字改为统一SVG人形图标(nav/home/space/mention等7处)
2026-06-03 00:49:24 +08:00

76 lines
4.3 KiB
HTML

<header>
<div class="container nav-container">
<a href="/" class="logo">Meta<span>Lab</span></a>
<button class="mobile-menu-btn" id="mobileMenuBtn">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
</button>
<ul class="nav-links" id="navLinks">
<li><a href="/">首页</a></li>
{{if .IsLoggedIn}}
<li><a href="/studio/write" class="nav-contribute">
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>
投稿
</a></li>
<li>
<a href="/messages" class="nav-envelope" id="messagesEnvelope" title="消息中心">
<svg class="nav-envelope-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>
<span class="nav-envelope-badge" id="msgBadge" style="display:none">0</span>
</a>
</li>
<li class="nav-avatar-wrapper">
<a href="/space" class="nav-avatar-link">
{{if .Avatar}}
<img src="{{.Avatar}}" alt="" class="nav-avatar">
{{else}}
<span class="nav-avatar nav-avatar-default"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg></span>
{{end}}
</a>
<div class="nav-dropdown">
<div class="nav-dropdown-header">
<div class="nav-dropdown-avatar">
{{if .Avatar}}
<img src="{{.Avatar}}" alt="">
{{else}}
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
{{end}}
</div>
<div class="nav-dropdown-meta">
<div class="nav-dropdown-username">{{.Username}}</div>
{{if .IsLoggedIn}}
<div class="nav-dropdown-level">Lv{{.Level}}</div>
{{end}}
</div>
</div>
<a href="/settings/profile" class="nav-dropdown-item">
<svg class="nav-dropdown-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>
<span>个人中心</span>
</a>
<a href="#" class="nav-dropdown-item nav-logout" id="logoutBtn">
<svg class="nav-dropdown-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>
<span>退出登录</span>
</a>
</div>
</li>
{{else}}
<li><a href="/auth/login" class="nav-login">登录</a></li>
{{end}}
</ul>
</div>
</header>
{{if .IsMaintenance}}
<div class="maintenance-banner">
<span class="maintenance-banner-icon">&#9881;</span>
{{if .IsOwner}}
<span>社区正处于维护状态</span>
{{else}}
<span>社区正在维护中,仅站长可访问</span>
{{end}}
</div>
{{end}}
{{if .IsBanned}}
<div class="maintenance-banner banned-banner">
<span class="maintenance-banner-icon"></span>
<span>该账号已被封禁</span>
</div>
{{end}}