feat: 添加热门工具排行榜功能
v2.5.0 - 新增首页热门工具展示 新增功能: - 在首页顶部展示按浏览量排序的前10个热门工具 - 响应式网格布局(桌面5列、平板3列、手机2列) - 视觉突出的排行榜徽章和排名标识(前三名金银铜色) - 仅在首页显示,筛选和搜索时隐藏 技术实现: - app.py: 添加popular_sites查询逻辑 - templates/index_new.html: 新增热门工具展示区域和样式 用户体验提升: - 帮助用户快速发现最受欢迎的AI工具 - 视觉层级清晰,排名一目了然 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
7
app.py
7
app.py
@@ -130,9 +130,14 @@ def create_app(config_name='default'):
|
||||
pagination = query.paginate(page=page, per_page=per_page, error_out=False)
|
||||
sites = pagination.items
|
||||
|
||||
# 获取热门工具(按浏览次数排序,最多10个)
|
||||
popular_sites = Site.query.filter_by(is_active=True)\
|
||||
.order_by(Site.view_count.desc()).limit(10).all()
|
||||
|
||||
return render_template('index_new.html', sites=sites, tags=tags,
|
||||
selected_tag=selected_tag, search_query=search_query,
|
||||
pagination=pagination, tag_counts=tag_counts)
|
||||
pagination=pagination, tag_counts=tag_counts,
|
||||
popular_sites=popular_sites)
|
||||
|
||||
@app.route('/site/<code>')
|
||||
def site_detail(code):
|
||||
|
||||
Reference in New Issue
Block a user