From 9e3664421558a14486d75490a99bbb533f8b2e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=B9=B8?= <2567198082@qq.com> Date: Tue, 14 Jun 2022 15:56:12 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E7=AF=87=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 19542c1..253b544 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('artcleID') != Null %} +

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

下一篇 Next Article

阅读文章并回答问题

{{ today_article|safe }}
From 22775f979747e13b325bde2dbbbf62888240d9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=B9=B8?= <2567198082@qq.com> Date: Tue, 14 Jun 2022 15:58:21 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20'app'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/user_service.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/user_service.py b/app/user_service.py index 139c140..4e485f1 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): From 71cc627aadbf101a52dd5a7693460709daa7a3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=B9=B8?= <2567198082@qq.com> Date: Wed, 15 Jun 2022 11:42:46 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'app/templates/userpag?= =?UTF-8?q?e=5Fget.html'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 253b544..bf8379f 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -28,7 +28,7 @@

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

上一篇 Previous Article {% endif%} {% endif %} 下一篇 Next Article From e73c66edd3dc8d2dcbdfb8b2504a9d3e0fb6a882 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:12:35 +0800 Subject: [PATCH 4/7] Re-arrange button positions (put Next Article before Previous Article). --- app/templates/userpage_get.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index fea7b5b..9eecbd2 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -27,11 +27,13 @@ 重设密码

{{ flashed_messages|safe }} + + 下一篇 Next Article {% if session.get('articleID') != session.get('temp') %} {% if session.get('temp') != None %} -

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

阅读文章并回答问题

{{ today_article|safe }}
From 4513a80bddcbdf06fd19e92638b2fa4acdd4adb4 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:15:07 +0800 Subject: [PATCH 5/7] Remove unused code. --- app/user_service.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/app/user_service.py b/app/user_service.py index f9ecc58..f758f77 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -22,20 +22,6 @@ 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): ''' From 2a553e0f8f91f6d0b3d625edbc2a45afb8da806f Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:17:50 +0800 Subject: [PATCH 6/7] Use a better variable name. --- app/templates/userpage_get.html | 4 ++-- app/user_service.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 9eecbd2..be503e6 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -29,8 +29,8 @@ {{ flashed_messages|safe }} 下一篇 Next Article - {% if session.get('articleID') != session.get('temp') %} - {% if session.get('temp') != None %} + {% if session.get('articleID') != session.get('old_articleID') %} + {% if session.get('old_articleID') != None %} 上一篇 Previous Article {% endif%} {% endif %} diff --git a/app/user_service.py b/app/user_service.py index f758f77..7ae608a 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -29,7 +29,7 @@ def user_reset(username): :param username: 用户名 :return: 返回页面内容 ''' - session['temp'] = session.get('articleID') + session['old_artcileID'] = session.get('articleID') if request.method == 'GET': session['articleID'] = None return redirect(url_for('user_bp.userpage', username=username)) @@ -44,7 +44,7 @@ def user_back(username): :return: 返回页面内容 ''' if request.method == 'GET': - session['articleID'] = session.get('temp') + session['articleID'] = session.get('old_artcileID') return redirect(url_for('user_bp.userpage', username=username)) From 4fb1cad7457285da5a24ca152219df86a2447b57 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:28:22 +0800 Subject: [PATCH 7/7] Use a better variable name (fix session variable name error). --- app/user_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/user_service.py b/app/user_service.py index 7ae608a..5148a60 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -29,7 +29,7 @@ def user_reset(username): :param username: 用户名 :return: 返回页面内容 ''' - session['old_artcileID'] = session.get('articleID') + session['old_articleID'] = session.get('articleID') if request.method == 'GET': session['articleID'] = None return redirect(url_for('user_bp.userpage', username=username)) @@ -44,7 +44,7 @@ def user_back(username): :return: 返回页面内容 ''' if request.method == 'GET': - session['articleID'] = session.get('old_artcileID') + session['articleID'] = session.get('old_articleID') return redirect(url_for('user_bp.userpage', username=username))