forked from mrlan/EnglishPal
修复Bug(没找到文章后立即上一篇会回到上上篇文章) & 标签添加id方便测试
parent
84affaeb69
commit
da13e5bbd5
|
@ -44,9 +44,9 @@
|
||||||
{# <div class="alert alert-warning" role="alert">Congratulations! {{ message }}</div>#}
|
{# <div class="alert alert-warning" role="alert">Congratulations! {{ message }}</div>#}
|
||||||
{# {% endfor %}#}
|
{# {% endfor %}#}
|
||||||
|
|
||||||
<a class="btn btn-success" href="/{{ username }}/reset" role="button"> 下一篇 Next Article </a>
|
<a id="next_btn" class="btn btn-success" href="/{{ username }}/reset" role="button"> 下一篇 Next Article </a>
|
||||||
{% if session.get('had_read_articles') != None and session.get('had_read_articles')["index"] !=0 %}
|
{% if session.get('had_read_articles') != None and session.get('had_read_articles')["index"] !=0 %}
|
||||||
<a class="btn btn-success" href="/{{ username }}/back" role="button"> 上一篇 Previous Article </a>
|
<a id="pre_btn" class="btn btn-success" href="/{{ username }}/back" role="button"> 上一篇 Previous Article </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p><b>阅读文章并回答问题</b></p>
|
<p><b>阅读文章并回答问题</b></p>
|
||||||
|
|
|
@ -45,9 +45,10 @@ def user_back(username):
|
||||||
:return: 返回页面内容
|
:return: 返回页面内容
|
||||||
'''
|
'''
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
had_read_articles = session.get("had_read_articles")
|
if session.get("found_article"):
|
||||||
had_read_articles["index"] -= 1
|
had_read_articles = session.get("had_read_articles")
|
||||||
session["had_read_articles"] = had_read_articles
|
had_read_articles["index"] -= 1
|
||||||
|
session["had_read_articles"] = had_read_articles
|
||||||
return redirect(url_for('user_bp.userpage', username=username))
|
return redirect(url_for('user_bp.userpage', username=username))
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +106,6 @@ def userpage(username):
|
||||||
:return: 返回用户界面
|
:return: 返回用户界面
|
||||||
'''
|
'''
|
||||||
# 未登录,跳转到未登录界面
|
# 未登录,跳转到未登录界面
|
||||||
print("123123")
|
|
||||||
if not session.get('logged_in'):
|
if not session.get('logged_in'):
|
||||||
return render_template('not_login.html')
|
return render_template('not_login.html')
|
||||||
|
|
||||||
|
@ -137,6 +137,10 @@ def userpage(username):
|
||||||
words += x[0] + ' '
|
words += x[0] + ' '
|
||||||
had_read_articles, today_article = get_today_article(user_freq_record, session.get('had_read_articles'))
|
had_read_articles, today_article = get_today_article(user_freq_record, session.get('had_read_articles'))
|
||||||
session['had_read_articles'] = had_read_articles
|
session['had_read_articles'] = had_read_articles
|
||||||
|
if today_article is None:
|
||||||
|
session["found_article"] = False
|
||||||
|
else:
|
||||||
|
session["found_article"] = True
|
||||||
# 通过 today_article,加载前端的显示页面
|
# 通过 today_article,加载前端的显示页面
|
||||||
return render_template('userpage_get.html',
|
return render_template('userpage_get.html',
|
||||||
username=username,
|
username=username,
|
||||||
|
|
Loading…
Reference in New Issue