From c92afa94367cb6ac5835a8c12a88d4eb77f876eb Mon Sep 17 00:00:00 2001 From: John Xina Date: Thu, 13 Jul 2023 20:24:28 +0800 Subject: [PATCH] fix paging issue, bring back the popularity sort --- app.py | 5 +++-- templates/bar.html | 11 +++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app.py b/app.py index fd546cb..3e849a2 100644 --- a/app.py +++ b/app.py @@ -133,7 +133,7 @@ async def thread_view(tid): async def forum_view(): fname = request.args['kw'] pn = int(request.args.get('pn') or 1) - sort = int(request.args.get('sort') or 5) + sort = int(request.args.get('sort') or 0) async with aiotieba.Client() as tieba: forum_info, threads = await asyncio.gather(awaitify(find_tieba_info)(fname), @@ -142,7 +142,8 @@ async def forum_view(): return await render_template('error.html', msg = \ f'请求越界,本贴吧共有 { threads.page.total_page } 页' f'而您查询了第 { threads.page.current_page} 页') - return await render_template('bar.html', info=forum_info, threads=threads, sort=sort) + return await render_template('bar.html', info=forum_info, threads=threads, sort=sort, + tp = ((115 if threads.page.total_page > 115 else threads.page.total_page) if sort == 0 else threads.page.total_page)) @app.route('/home/main') async def user_view(): diff --git a/templates/bar.html b/templates/bar.html index 9d70aa7..0cf5b98 100644 --- a/templates/bar.html +++ b/templates/bar.html @@ -23,9 +23,8 @@
- - +
时下热门
最新回复
{{ np }} {% endif %} {% endfor %} - {% if threads.page.current_page < threads.page.total_page %} - 尾页 + {% if threads.page.current_page < tp %} + 尾页 {% endif %}