Skip to content

Commit

Permalink
修复消息提示无法即时更新的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryLee27501 committed Dec 18, 2024
1 parent dde8076 commit b8d1ff6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,7 @@ def notifications(request: HttpRequest):

done_list = notification2Display(done_notifications)
undone_list = notification2Display(undone_notifications)
notes_list = done_list + undone_list

# 新版侧边栏, 顶栏等的呈现,采用 bar_display, 必须放在render前最后一步
bar_display = utils.get_sidebar_and_navbar(request.user,
Expand Down
10 changes: 6 additions & 4 deletions templates/notifications.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ <h5><i class="fa fa-envelope-o"></i> 已处理</h5>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active show" id="home">
<div id="undone-empty" style="display: none; margin-top: 40px; margin-bottom: -40px;">
<p style="text-align: center;">您的信箱很干净!没有要处理的信息.</p>
<p style="text-align: center;">您的信箱很干净!没有要处理的信息</p>
</div>
<div class="bio-skill-box">
<div id="undone-list" class="row">
{% for note in undone_list %}
{% for note in notes_list %}
<div class="col-12 col-xl-6 col-lg-12 mb-xl-4 mb-4 " id="undone={{note.id}}" {% if not note.status == "待处理" %} hidden {%endif%}>

<div class=" b-skills">
Expand Down Expand Up @@ -122,11 +122,11 @@ <h5>
</div>
<div class="tab-pane fade" id="done">
<div id="done-empty" style="display: none; margin-top: 40px; margin-bottom: -40px;">
<p style="text-align: center;">没有已处理的消息记录.</p>
<p style="text-align: center;">没有已处理的消息记录</p>
</div>
<div class="bio-skill-box">
<div id="done-list" class="row">
{% for note in done_list %}
{% for note in notes_list %}
<div class="col-12 col-xl-6 col-lg-12 mb-xl-4 mb-4 " id="done={{note.id}}" {% if not note.status == "已处理" %} hidden {%endif%}>

<div class=" b-skills">
Expand Down Expand Up @@ -261,6 +261,7 @@ <h5>
if (success) {
document.getElementById("undone="+String(this.id)).hidden = true;
document.getElementById("done="+String(this.id)).hidden = false;
document.getElementById("done-list").prepend(document.getElementById("done="+String(this.id)));
document.getElementById("mail_num").innerHTML = String(Number(document.getElementById("mail_num").innerHTML) - 1);
refresh();
}
Expand All @@ -270,6 +271,7 @@ <h5>
if (success) {
document.getElementById("done="+String(this.id)).hidden = true;
document.getElementById("undone="+String(this.id)).hidden = false;
document.getElementById("undone-list").prepend(document.getElementById("undone="+String(this.id)));
document.getElementById("mail_num").innerHTML = String(Number(document.getElementById("mail_num").innerHTML) + 1);
refresh();
}
Expand Down

0 comments on commit b8d1ff6

Please sign in to comment.