|
- <header class="top-header">
- <div class="header-left">
- <div class="breadcrumb">
- {% if currentPage == 'dashboard' %}
- <span class="current">控制台</span>
- {% else %}
- <a href="/admin/dashboard.html">控制台</a>
- {% if breadcrumb %}
- {% for item in breadcrumb %}
- <span class="sep">/</span>
- {% if loop.last %}
- <span class="current">{{ item.name }}</span>
- {% else %}
- <a href="{{ item.url }}">{{ item.name }}</a>
- {% endif %}
- {% endfor %}
- {% elif pageTitle or (columnInfo and columnInfo.name) %}
- <span class="sep">/</span>
- <span class="current">{{ pageTitle or columnInfo.name }}</span>
- {% endif %}
- {% endif %}
- </div>
- </div>
- <div class="header-right">
- <button class="header-btn" title="刷新" onclick="location.reload()">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
- </button>
- <button class="header-btn" title="全屏" onclick="toggleFullscreen()">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/></svg>
- </button>
- <div class="header-user" id="userDropdown">
- <div class="header-avatar" onclick="document.getElementById('userDropdown').classList.toggle('open')">
- <div class="avatar-placeholder">{{ adminUser.nickname[0] if adminUser.nickname else '管' }}</div>
- <span>{{ adminUser.nickname or adminUser.username or '管理员' }}</span>
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" style="margin-left:4px;"><polyline points="6 9 12 15 18 9"/></svg>
- </div>
- <div class="user-dropdown-menu">
- <a href="javascript:void(0)" class="dropdown-item dropdown-item-danger" onclick="confirmLogout()">
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2"><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>
- 退出登录
- </a>
- </div>
- </div>
- </div>
- </header>
- <script>
- function toggleFullscreen() {
- if (!document.fullscreenElement) {
- document.documentElement.requestFullscreen();
- } else {
- document.exitFullscreen();
- }
- }
- function confirmLogout() {
- ElementPlus.ElMessageBox.confirm('确定要退出登录吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(function() {
- window.location.href = '/admin/logout.html';
- }).catch(function() {});
- }
- // 点击外部关闭下拉
- document.addEventListener('click', function(e) {
- var dd = document.getElementById('userDropdown');
- if (dd && !dd.contains(e.target)) {
- dd.classList.remove('open');
- }
- });
- </script>
|