forked from mrlan/EnglishPal
Bug422-XuXing (#46)
增加了返回上一篇的按钮及相关功能的实现,当点击下一篇文章跳转至下一篇时,页面中会增加一个返回上一篇按钮,点击返回上一篇按钮后可以回到上一篇。 Co-authored-by: Lan Hui <1348141770@qq.com> Reviewed-on: http://121.4.94.30:3000/mrlan/EnglishPal/pulls/46 Co-authored-by: 徐幸 <2567198082@qq.com> Co-committed-by: 徐幸 <2567198082@qq.com>Hui-EscapeUserInput
parent
9a89510f4e
commit
2c1bc98833
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue