diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 8b11365..fea7b5b 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -27,8 +27,12 @@ 重设密码

{{ flashed_messages|safe }} + {% if session.get('articleID') != session.get('temp') %} + {% if session.get('temp') != None %} +

上一篇 Previous Article + {% endif%} + {% endif %} 下一篇 Next Article -

下一篇 Next Article

阅读文章并回答问题

{{ today_article|safe }}
diff --git a/app/user_service.py b/app/user_service.py index c8ac8a1..f9ecc58 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -22,6 +22,20 @@ path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment + +#@userService.route("//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("//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("//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("///unfamiliar", methods=['GET', 'POST']) def unfamiliar(username, word):