Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加公告支持 #2578

Merged
merged 14 commits into from
Apr 11, 2024
3 changes: 3 additions & 0 deletions common/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ <h4 class="modal-title" id="myModalLabel2">扫码绑定</h4>
<!-- Page Content -->
<div id="page-wrapper">
<div class="clearfix">
{% if announcement_content_enabled %}
<span style="font-size:20px;color:red;padding-left:0px;display:block;"><br>{{announcement_content}}</span>
LeoQuote marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
<br>
{% block content %}
{% endblock content %}
Expand Down
25 changes: 25 additions & 0 deletions common/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,31 @@ <h4 style="color: darkgrey"><b>其他配置</b></h4>
</div>
</div>
</div>
<div class="form-group">
<label for="announcement_content_enabled"
class="col-sm-4 control-label">Announcement_Content_Enabled</label>
feiazifeiazi marked this conversation as resolved.
Show resolved Hide resolved
<div class="col-sm-8">
<div class="switch switch-small">
<label>
<input id="announcement_content_enabled" key="announcement_content_enabled"
value="{{ config.announcement_content_enabled }}"
type="checkbox"> 是否开启公告
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="announcement_content"
class="col-sm-4 control-label">公告内容</label>
feiazifeiazi marked this conversation as resolved.
Show resolved Hide resolved
<div class="col-sm-5">
<input type="text" class="form-control"
id="announcement_content"
key="announcement_content"
value="{{ config.announcement_content }}"
placeholder="公告内容">

</div>
</div>
</div>
<hr />
<div class="form-group">
Expand Down
9 changes: 9 additions & 0 deletions common/utils/global_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ def global_info(request):
todo = 0

watermark_enabled = SysConfig().get("watermark_enabled", False)
LeoQuote marked this conversation as resolved.
Show resolved Hide resolved
# 添加公告
announcement_content_enabled = SysConfig().get(
"announcement_content_enabled", False
)
announcement_content = ""
if announcement_content_enabled:
LeoQuote marked this conversation as resolved.
Show resolved Hide resolved
announcement_content = SysConfig().get("announcement_content", "")

return {
"todo": todo,
"archery_version": display_version,
"watermark_enabled": watermark_enabled,
"announcement_content_enabled": announcement_content_enabled,
"announcement_content": announcement_content,
"twofa_type": twofa_type,
}
Loading