1
0
Fork 0

Merge branch 'Bug422-XuXing' into Bug422-XuXing

Bug422-XuXing
Lan Hui 2022-07-21 22:05:48 +08:00
commit 69835c7f8d
2 changed files with 32 additions and 1 deletions

View File

@ -27,8 +27,12 @@
<a class="btn btn-secondary" href="/reset" role="button">重设密码</a>
</p>
{{ flashed_messages|safe }}
{% if session.get('articleID') != session.get('temp') %}
{% if session.get('temp') != None %}
<p><a class="btn btn-success" href="/{{ username }}/back" role="button"> 上一篇 Previous Article </a>
{% endif%}
{% endif %}<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></p>
<p><b>阅读文章并回答问题</b></p>
<div id="text-content">{{ today_article|safe }}</div>

View File

@ -22,6 +22,20 @@ path_prefix = '/var/www/wordfreq/wordfreq/'
path_prefix = './' # comment this line in deployment
#@userService.route("/<username>/reset", methods=['GET', 'POST'])
#def user_reset(username):
#'''
#用户界面
#:param username: 用户名
#:return: 返回页面内容
#'''
# if request.method == 'GET':
# session['articleID'] = None
# return redirect(url_for('user_bp.userpage', username=username))
# else:
# return 'Under construction'
@userService.route("/<username>/reset", methods=['GET', 'POST'])
def user_reset(username):
'''
@ -29,12 +43,25 @@ def user_reset(username):
:param username: 用户名
:return: 返回页面内容
'''
session['temp'] = session.get('articleID')
if request.method == 'GET':
session['articleID'] = None
return redirect(url_for('user_bp.userpage', username=username))
else:
return 'Under construction'
@userService.route("/<username>/back", methods=['GET'])
def user_back(username):
'''
用户界面
:param username: 用户名
:return: 返回页面内容
'''
if request.method == 'GET':
session['articleID'] = session.get('temp')
return redirect(url_for('user_bp.userpage', username=username))
@userService.route("/<username>/<word>/unfamiliar", methods=['GET', 'POST'])
def unfamiliar(username, word):