修复了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'))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport"
|
<meta name="viewport"
|
||||||
content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes"/>
|
content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes"/>
|
||||||
<meta name="format-detection" content="telephone=no"/>
|
<meta name="format-detection" content="telephone=no"/>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||||
|
@ -25,34 +25,34 @@
|
||||||
<title>EnglishPal Study Room for {{ username }}</title>
|
<title>EnglishPal Study Room for {{ username }}</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.shaking {
|
.shaking {
|
||||||
animation: shakes 1600ms ease-in-out;
|
animation: shakes 1600ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes shakes {
|
@keyframes shakes {
|
||||||
10%, 90% { transform: translate3d(-1px, 0, 0); }
|
10%, 90% { transform: translate3d(-1px, 0, 0); }
|
||||||
20%, 50% { transform: translate3d(+2px, 0, 0); }
|
20%, 50% { transform: translate3d(+2px, 0, 0); }
|
||||||
30%, 70% { transform: translate3d(-4px, 0, 0); }
|
30%, 70% { transform: translate3d(-4px, 0, 0); }
|
||||||
40%, 60% { transform: translate3d(+4px, 0, 0); }
|
40%, 60% { transform: translate3d(+4px, 0, 0); }
|
||||||
50% { transform: translate3d(-4px, 0, 0); }
|
50% { transform: translate3d(-4px, 0, 0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.lead{
|
.lead{
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
font-family: Helvetica, sans-serif;
|
font-family: Helvetica, sans-serif;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
line-height: 21px;
|
line-height: 21px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow:hover {
|
.arrow:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -69,32 +69,43 @@
|
||||||
</p>
|
</p>
|
||||||
{% for message in get_flashed_messages() %}
|
{% for message in get_flashed_messages() %}
|
||||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||||
{{ message }}
|
{{ message }}
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<button class="arrow" id="load_pre_article" onclick="load_pre_article();Reader.stopRead()" title="Previous Article">
|
<button class="arrow" id="load_pre_article" onclick="load_pre_article();Reader.stopRead()" title="Previous Article">
|
||||||
<i class="fas fa-chevron-left"></i> 上一篇
|
<i class="fas fa-chevron-left"></i> 上一篇
|
||||||
</button>
|
</button>
|
||||||
<button class="arrow" id="load_next_article" onclick="load_next_article();Reader.stopRead()" title="Next Article">
|
<button class="arrow" id="load_next_article" onclick="load_next_article();Reader.stopRead()" title="Next Article">
|
||||||
下一篇 <i class="fas fa-chevron-right"></i>
|
下一篇 <i class="fas fa-chevron-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><b>阅读文章并回答问题</b></p>
|
<p><b>阅读文章并回答问题</b></p>
|
||||||
|
|
||||||
<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 %}
|
||||||
<p class="text-muted" id="date">Article added on: {{ today_article["date"] }}</p><br/>
|
<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/>
|
||||||
|
|
||||||
<button onclick="saveArticle()" >标记文章</button>
|
<button onclick="saveArticle()" >标记文章</button>
|
||||||
<select id="saved_articles_dropdown">
|
<select id="saved_articles_dropdown">
|
||||||
<!-- 这里将显示已经保存的文章 -->
|
<!-- 这里将显示已经保存的文章 -->
|
||||||
<option></option>
|
<option></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<div class="p-3 mb-2 bg-light text-dark" style="margin: 0 0.5%;"><br/>
|
<div class="p-3 mb-2 bg-light text-dark" style="margin: 0 0.5%;"><br/>
|
||||||
<p class="display-6" id="article_title">{{ today_article["article_title"] }}</p><br/>
|
<p class="display-6" id="article_title">{{ today_article["article_title"] }}</p><br/>
|
||||||
|
@ -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;">
|
||||||
|
@ -163,7 +176,7 @@
|
||||||
允许动态调整顺序
|
允许动态调整顺序
|
||||||
</label>
|
</label>
|
||||||
<br>
|
<br>
|
||||||
<a class="btn btn-primary btn-lg" onclick="random_select_word('{{ word }}')" role="button">随机选取10个</a>
|
<a class="btn btn-primary btn-lg" onclick="random_select_word('{{ word }}')" role="button">随机选取10个</a>
|
||||||
<a class="btn btn-primary btn-lg" onclick="location.reload();" role="button">显示所有生词</a>
|
<a class="btn btn-primary btn-lg" onclick="location.reload();" role="button">显示所有生词</a>
|
||||||
</p>
|
</p>
|
||||||
<!--添加导出按钮-->
|
<!--添加导出按钮-->
|
||||||
|
@ -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,9 +391,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
// 先清空dropdown,以防有多余的选项或重新加载页面时出现重复
|
// 先清空dropdown,以防有多余的选项或重新加载页面时出现重复
|
||||||
savedArticlesDropdown.innerHTML = '';
|
savedArticlesDropdown.innerHTML = '';
|
||||||
|
|
Loading…
Reference in New Issue