Compare commits

...

8 Commits

Author SHA1 Message Date
Lan Hui 4fb1cad745 Use a better variable name (fix session variable name error). 2022-07-21 22:28:22 +08:00
Lan Hui 2a553e0f8f Use a better variable name. 2022-07-21 22:17:50 +08:00
Lan Hui 4513a80bdd Remove unused code. 2022-07-21 22:15:07 +08:00
Lan Hui e73c66edd3 Re-arrange button positions (put Next Article before Previous Article). 2022-07-21 22:12:35 +08:00
Lan Hui 69835c7f8d Merge branch 'Bug422-XuXing' into Bug422-XuXing 2022-07-21 22:05:48 +08:00
徐幸 71cc627aad 更新 'app/templates/userpage_get.html' 2022-06-15 11:42:46 +08:00
徐幸 22775f9797 上传文件至 'app' 2022-06-14 15:58:21 +08:00
徐幸 9e36644215 增加返回上一篇按钮 2022-06-14 15:56:12 +08:00
2 changed files with 20 additions and 1 deletions

View File

@ -28,7 +28,13 @@
</p> </p>
{{ flashed_messages|safe }} {{ flashed_messages|safe }}
<p><a class="btn btn-success" href="/{{ username }}/reset" role="button"> 下一篇 Next Article </a></p> <a class="btn btn-success" href="/{{ username }}/reset" role="button"> 下一篇 Next Article </a>
{% if session.get('articleID') != session.get('old_articleID') %}
{% if session.get('old_articleID') != None %}
<a class="btn btn-success" href="/{{ username }}/back" role="button"> 上一篇 Previous Article </a>
{% endif%}
{% endif %}
<p><b>阅读文章并回答问题</b></p> <p><b>阅读文章并回答问题</b></p>
<div id="text-content">{{ today_article|safe }}</div> <div id="text-content">{{ today_article|safe }}</div>

View File

@ -29,12 +29,25 @@ def user_reset(username):
:param username: 用户名 :param username: 用户名
:return: 返回页面内容 :return: 返回页面内容
''' '''
session['old_articleID'] = session.get('articleID')
if request.method == 'GET': if request.method == 'GET':
session['articleID'] = None session['articleID'] = None
return redirect(url_for('user_bp.userpage', username=username)) return redirect(url_for('user_bp.userpage', username=username))
else: else:
return 'Under construction' return 'Under construction'
@userService.route("/<username>/back", methods=['GET'])
def user_back(username):
'''
用户界面
:param username: 用户名
:return: 返回页面内容
'''
if request.method == 'GET':
session['articleID'] = session.get('old_articleID')
return redirect(url_for('user_bp.userpage', username=username))
@userService.route("/<username>/<word>/unfamiliar", methods=['GET', 'POST']) @userService.route("/<username>/<word>/unfamiliar", methods=['GET', 'POST'])
def unfamiliar(username, word): def unfamiliar(username, word):