修复了userpage_get.html 使其在ratio和today_article为空时 不报错
parent
d9512c929b
commit
d53231f58a
|
@ -145,7 +145,7 @@ if __name__ == '__main__':
|
||||||
'''
|
'''
|
||||||
# app.secret_key = os.urandom(16)
|
# app.secret_key = os.urandom(16)
|
||||||
# app.run(debug=False, port='6000')
|
# app.run(debug=False, port='6000')
|
||||||
app.run(debug=True)
|
app.run(host='127.0.0.1', port=5000, debug=True)
|
||||||
# app.run(debug=True, port='6000')
|
# app.run(debug=True, port='6000')
|
||||||
# app.run(host='0.0.0.0', debug=True, port='6000')
|
# app.run(host='0.0.0.0', debug=True, port='6000')
|
||||||
# print(mod5('123'))
|
# print(mod5('123'))
|
||||||
|
|
|
@ -87,7 +87,18 @@
|
||||||
|
|
||||||
<div id="text-content">
|
<div id="text-content">
|
||||||
<div id="found">
|
<div id="found">
|
||||||
<div class="alert alert-success" role="alert">According to your word list, your level is <span class="text-decoration-underline" id="user_level">{{ today_article["user_level"] }}</span> and we have chosen an article with a difficulty level of <span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span> for you. The Oxford word coverage is <span class="text-decoration-underline" id="ratio">{{ (today_article["ratio"] * 100) | int }}%.</span></div>
|
{% if today_article and today_article["ratio"] is not none %}
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
According to your word list, your level is
|
||||||
|
<span class="text-decoration-underline" id="user_level">{{ today_article["user_level"] }}</span>
|
||||||
|
and we have chosen an article with a difficulty level of
|
||||||
|
<span class="text-decoration-underline" id="text_level">{{ today_article["text_level"] }}</span>
|
||||||
|
for you. The Oxford word coverage is
|
||||||
|
<span class="text-decoration-underline" id="ratio">{{ (today_article["ratio"] * 100) | int }}%.</span>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-warning">No article or article is incomplete.</div>
|
||||||
|
{% endif %}
|
||||||
<p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/>
|
<p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/>
|
||||||
|
|
||||||
<button onclick="saveArticle()" >标记文章</button>
|
<button onclick="saveArticle()" >标记文章</button>
|
||||||
|
@ -114,11 +125,13 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<button onclick="toggle_visibility('answer');">ANSWER</button>
|
<button onclick="toggle_visibility('answer');">ANSWER</button>
|
||||||
<div id="answer" style="display:none;">{{ today_article['answer'] }}</div><br/>
|
<div id="answer" style="display:none;">
|
||||||
|
{{ today_article['answer'] }}
|
||||||
|
</div><br/>
|
||||||
</div>
|
</div>
|
||||||
<div id="tooltip"></div>
|
<div id="tooltip"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-success" role="alert" id="not_found" style="display:none;">
|
<div class="alert alert-success" role="alert" id="not_found" style="display:none;" >
|
||||||
<p class="text-muted"><span class="badge bg-success">Notes:</span><br>No article is currently available for you. You can try again a few times or mark new words in the passage to improve your level.</p>
|
<p class="text-muted"><span class="badge bg-success">Notes:</span><br>No article is currently available for you. You can try again a few times or mark new words in the passage to improve your level.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-success" role="alert" id="read_all" style="display:none;">
|
<div class="alert alert-success" role="alert" id="read_all" style="display:none;">
|
||||||
|
@ -367,7 +380,7 @@
|
||||||
savedArticlesDropdown.appendChild(option);
|
savedArticlesDropdown.appendChild(option);
|
||||||
localStorage.setItem(articleTitle, articleJSON); // 以文章标题为键,序列化的JSON字符串为值存储
|
localStorage.setItem(articleTitle, articleJSON); // 以文章标题为键,序列化的JSON字符串为值存储
|
||||||
}
|
}
|
||||||
function loadSelectedArticle() {
|
function loadSelectedArticle() {
|
||||||
const selectedOption = document.getElementById('saved_articles_dropdown');
|
const selectedOption = document.getElementById('saved_articles_dropdown');
|
||||||
const selectedTitle = selectedOption.options[selectedOption.selectedIndex].text;
|
const selectedTitle = selectedOption.options[selectedOption.selectedIndex].text;
|
||||||
const articleJSON = localStorage.getItem(selectedTitle);
|
const articleJSON = localStorage.getItem(selectedTitle);
|
||||||
|
@ -378,7 +391,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
const savedArticlesDropdown = document.getElementById('saved_articles_dropdown');
|
const savedArticlesDropdown = document.getElementById('saved_articles_dropdown');
|
||||||
savedArticlesDropdown.addEventListener('change', loadSelectedArticle);
|
savedArticlesDropdown.addEventListener('change', loadSelectedArticle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue