feat(public): 首页增加「热门网址」分类(访问量 TOP12)
跨分类聚合:按 NavClick 总点击数倒序,取前 12 个有效 nav。 实现要点: - applications/view/public/nav.py: 新增 _top_navs(limit=12), 复用 get_nav_visit_counts() 的 60s 进程内缓存;同点击数按 id asc 稳定排序; 0 点击返回空列表(前端整段不渲染) - _render_index() 注入 top_navs 到模板 - templates/public/index.html: 在 groups 循环前渲染 .section-hot,标题「🔥 热门网址」, meta 显示「近期访问量最大的 N 个」;卡片复用 .card,新增 .card-top 类 - templates/public/base.html: - .card-top:左侧 3px 品牌色边框 + 浅色背景渐变 + hover 增强阴影 - .section-hot h2 图标用 brand-orange #ff6b35 - .cat-nav-inner a.cat-nav-hot 顶部导航热门入口用品牌色 - 抽屉:首页 top_navs 非空时插入「🔥 热门」区段,链接到 #cat-top 边界: - 没有任何点击时整段隐藏(包括抽屉和顶部 nav),不出现「0 个」空标题 - 同一 nav 不会重复(按 nav.id 维度聚合) - Nav.enable=0 的不会进 TOP12 验证: - 15 个 nav 各灌入 20..6 次点击,前 12 个按降序显示访问数 20..9 - 清空所有 NavClick 后首页 section-hot / #cat-top / .cat-drawer-hot 三处全不渲染 - 测试数据已清理
This commit is contained in:
@@ -396,6 +396,32 @@
|
||||
border-color: var(--brand);
|
||||
}
|
||||
.card:active { transform: translateY(0); }
|
||||
|
||||
/* ===== 热门网址卡片:与普通卡片区分 ===== */
|
||||
.section-hot { margin-top: 8px; }
|
||||
.section-hot .section-header h2 i { color: #ff6b35; margin-right: 2px; }
|
||||
.card-top {
|
||||
border-color: rgba(22, 186, 170, 0.35);
|
||||
background: linear-gradient(135deg, var(--card-bg) 0%, rgba(22, 186, 170, 0.05) 100%);
|
||||
position: relative;
|
||||
}
|
||||
.card-top::before {
|
||||
content: '';
|
||||
position: absolute; top: 0; left: 0;
|
||||
width: 3px; height: 100%;
|
||||
background: var(--brand);
|
||||
border-radius: 10px 0 0 10px;
|
||||
}
|
||||
.card-top:hover {
|
||||
border-color: var(--brand);
|
||||
box-shadow: 0 6px 20px rgba(22, 186, 170, 0.18);
|
||||
}
|
||||
|
||||
.cat-nav-inner a.cat-nav-hot {
|
||||
color: #ff6b35;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.card .icon-wrap {
|
||||
width: 42px; height: 42px;
|
||||
background: rgba(22, 186, 170, 0.1);
|
||||
@@ -770,6 +796,22 @@
|
||||
<button type="button" class="close" id="cat-drawer-close" aria-label="关闭">×</button>
|
||||
</div>
|
||||
|
||||
{# 热门网址入口(仅首页,且首页必须传 top_navs 才渲染)#}
|
||||
{% if top_navs is defined and top_navs %}
|
||||
<div class="cat-drawer-section">
|
||||
<div class="cat-drawer-title"><i class="layui-icon layui-icon-fire"></i> 热门</div>
|
||||
<ul class="cat-drawer-list">
|
||||
<li>
|
||||
<a href="#cat-top" class="cat-drawer-hot">
|
||||
<i class="layui-icon cat-icon layui-icon-fire"></i>
|
||||
<span>热门网址</span>
|
||||
<span class="arrow">→</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# 分类区 #}
|
||||
{% if cat_meta is defined %}
|
||||
<div class="cat-drawer-section">
|
||||
|
||||
Reference in New Issue
Block a user