|
- <aside class="sidebar" id="sidebarApp">
- <div class="sidebar-logo">
- <img src="/static/images/logo.png" alt="维康基金会">
- </div>
- <nav class="sidebar-menu">
- {# 控制台 #}
- <div class="menu-group">
- <a class="menu-item {% if currentPage == 'dashboard' %}active{% endif %}" href="/admin/dashboard.html">
- <span class="menu-icon"><svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" fill="currentColor"/><path d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" fill="currentColor"/></svg></span>
- <span>控制台</span>
- </a>
- </div>
-
- {# 内容管理 - 动态栏目菜单 #}
- {% if columnMenus and columnMenus.length %}
- <div class="menu-group">
- <div class="menu-group-title">内容管理</div>
- {% for menu in columnMenus %}
- {% if menu.children and menu.children.length %}
- <div class="menu-parent {% if menuGroup == menu.key %}open{% endif %}">
- <div class="menu-item">
- <span class="menu-icon" data-icon="{{ menu.icon }}"></span>
- <span>{{ menu.name }}</span>
- <i class="arrow"><svg viewBox="0 0 640 640"><path d="M300.3 440.8C312.9 451 331.4 450.3 343.1 438.6L471.1 310.6C480.3 301.4 483 287.7 478 275.7C473 263.7 461.4 256 448.5 256L192.5 256C179.6 256 167.9 263.8 162.9 275.8C157.9 287.8 160.7 301.5 169.9 310.6L297.9 438.6L300.3 440.8z" fill="currentColor"/></svg></i>
- </div>
- <div class="submenu-items">
- {% for child in menu.children %}
- <a class="menu-item {% if currentPage == child.key %}active{% endif %}" href="{{ child.url }}"><span>{{ child.name }}</span></a>
- {% endfor %}
- </div>
- </div>
- {% endif %}
- {% endfor %}
- </div>
- {% endif %}
-
- {# 数据管理 #}
- <div class="menu-group">
- <div class="menu-group-title">数据管理</div>
- <a class="menu-item {% if currentPage == 'medicine' %}active{% endif %}" href="/admin/data/medicine.html">
- <span class="menu-icon"><svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M839.2 295.2l-110.4-110.4c-12.8-12.8-33.6-12.8-46.4 0L574.4 292.8l-46.4-46.4c-12.8-12.8-33.6-12.8-46.4 0l-296 296c-12.8 12.8-12.8 33.6 0 46.4l110.4 110.4c12.8 12.8 33.6 12.8 46.4 0l108-108 46.4 46.4c12.8 12.8 33.6 12.8 46.4 0l296-296c12.8-12.8 12.8-33.6 0-46.4zM319.2 652.8l-64-64 249.6-249.6 64 64-249.6 249.6z" fill="currentColor"/></svg></span>
- <span>药品援助记录</span>
- </a>
- </div>
-
- {# 系统设置 #}
- <div class="menu-group">
- <div class="menu-group-title">系统设置</div>
- <a class="menu-item {% if currentPage == 'column' %}active{% endif %}" href="/admin/system/column.html">
- <span class="menu-icon"><svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M128 128h256v256H128V128zm0 512h256v256H128V640zm512-512h256v256H640V128zm0 512h256v256H640V640z" fill="currentColor"/></svg></span>
- <span>栏目管理</span>
- </a>
- <a class="menu-item {% if currentPage == 'config' %}active{% endif %}" href="/admin/system/config.html">
- <span class="menu-icon"><svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M512 682.7c-94.3 0-170.7-76.4-170.7-170.7S417.7 341.3 512 341.3 682.7 417.7 682.7 512 606.3 682.7 512 682.7zm0-277.4c-58.8 0-106.7 47.9-106.7 106.7s47.9 106.7 106.7 106.7 106.7-47.9 106.7-106.7-47.9-106.7-106.7-106.7z" fill="currentColor"/><path d="M924.4 405.3l-67.8-11.3c-7.1-26.8-17.4-52.4-30.6-76.3l40.3-55.4c10.5-14.4 8.8-34.3-4-46.9l-54.2-54.2c-12.6-12.8-32.5-14.5-46.9-4l-55.4 40.3c-23.9-13.2-49.5-23.5-76.3-30.6l-11.3-67.8c-2.9-17.6-18.2-30.5-36-30.5h-76.6c-17.8 0-33.1 12.9-36 30.5l-11.3 67.8c-26.8 7.1-52.4 17.4-76.3 30.6l-55.4-40.3c-14.4-10.5-34.3-8.8-46.9 4l-54.2 54.2c-12.8 12.6-14.5 32.5-4 46.9l40.3 55.4c-13.2 23.9-23.5 49.5-30.6 76.3l-67.8 11.3c-17.6 2.9-30.5 18.2-30.5 36v76.6c0 17.8 12.9 33.1 30.5 36l67.8 11.3c7.1 26.8 17.4 52.4 30.6 76.3l-40.3 55.4c-10.5 14.4-8.8 34.3 4 46.9l54.2 54.2c12.6 12.8 32.5 14.5 46.9 4l55.4-40.3c23.9 13.2 49.5 23.5 76.3 30.6l11.3 67.8c2.9 17.6 18.2 30.5 36 30.5h76.6c17.8 0 33.1-12.9 36-30.5l11.3-67.8c26.8-7.1 52.4-17.4 76.3-30.6l55.4 40.3c14.4 10.5 34.3 8.8 46.9-4l54.2-54.2c12.8-12.6 14.5-32.5 4-46.9l-40.3-55.4c13.2-23.9 23.5-49.5 30.6-76.3l67.8-11.3c17.6-2.9 30.5-18.2 30.5-36v-76.6c0-17.8-12.9-33.1-30.5-36z" fill="currentColor"/></svg></span>
- <span>网站配置</span>
- </a>
- <div class="menu-parent {% if currentPage in ['sys-user','sys-role','sys-log'] %}open{% endif %}">
- <div class="menu-item">
- <span class="menu-icon"><svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M832 464H192c-17.7 0-32 14.3-32 32v352c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zm-40 344H232V536h560v272z" fill="currentColor"/><path d="M512 624c-35.3 0-64 28.7-64 64s28.7 64 64 64 64-28.7 64-64-28.7-64-64-64z" fill="currentColor"/><path d="M736 464V288c0-123.7-100.3-224-224-224S288 164.3 288 288v176h64V288c0-88.2 71.8-160 160-160s160 71.8 160 160v176h64z" fill="currentColor"/></svg></span>
- <span>系统管理</span>
- <i class="arrow"><svg viewBox="0 0 640 640"><path d="M300.3 440.8C312.9 451 331.4 450.3 343.1 438.6L471.1 310.6C480.3 301.4 483 287.7 478 275.7C473 263.7 461.4 256 448.5 256L192.5 256C179.6 256 167.9 263.8 162.9 275.8C157.9 287.8 160.7 301.5 169.9 310.6L297.9 438.6L300.3 440.8z" fill="currentColor"/></svg></i>
- </div>
- <div class="submenu-items">
- <a class="menu-item {% if currentPage == 'sys-user' %}active{% endif %}" href="/admin/system/user.html"><span>用户管理</span></a>
- <a class="menu-item {% if currentPage == 'sys-role' %}active{% endif %}" href="/admin/system/role.html"><span>角色权限</span></a>
- <a class="menu-item {% if currentPage == 'sys-log' %}active{% endif %}" href="/admin/system/log.html"><span>操作日志</span></a>
- </div>
- </div>
- </div>
- </nav>
- </aside>
-
- <script>
- // 渲染动态图标 - 使用临时Vue实例渲染图标
- document.addEventListener('DOMContentLoaded', function() {
- if (!window.ElementPlusIconsVue || !window.Vue) return;
-
- document.querySelectorAll('.menu-icon[data-icon]').forEach(function(el) {
- var iconName = el.getAttribute('data-icon');
- if (!iconName) {
- el.innerHTML = '<svg viewBox="0 0 1024 1024" width="18" height="18"><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" fill="currentColor"/></svg>';
- return;
- }
-
- var iconComp = window.ElementPlusIconsVue[iconName];
- if (iconComp) {
- // 创建临时容器
- var tempDiv = document.createElement('div');
- tempDiv.style.display = 'none';
- document.body.appendChild(tempDiv);
-
- // 创建临时Vue应用渲染图标
- var tempApp = Vue.createApp({
- template: '<el-icon :size="18"><component :is="icon"></component></el-icon>',
- data: function() { return { icon: iconComp }; }
- });
- tempApp.use(ElementPlus);
- tempApp.mount(tempDiv);
-
- // 提取渲染后的SVG
- var svg = tempDiv.querySelector('svg');
- if (svg) {
- svg.setAttribute('width', '18');
- svg.setAttribute('height', '18');
- svg.querySelectorAll('path').forEach(function(p) {
- p.setAttribute('fill', 'currentColor');
- });
- el.innerHTML = svg.outerHTML;
- }
-
- // 清理
- tempApp.unmount();
- document.body.removeChild(tempDiv);
- }
- });
- });
- </script>
|