Skip to content

Commit

Permalink
公告
Browse files Browse the repository at this point in the history
  • Loading branch information
nick2wang committed Apr 17, 2024
1 parent 8ea184d commit 417be6b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions common/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ <h4 class="modal-title" id="myModalLabel2">扫码绑定</h4>
<div id="page-wrapper">
<div class="clearfix">
<br>
{% if announcement_content_enabled %}
<div class="alert alert-info h4" role="alert">{{announcement_content}}</div>
{% endif %}
{% 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 @@ -1016,6 +1016,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>
<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">ANNOUNCEMENT_CONTENT</label>
<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>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-10">
Expand Down
7 changes: 6 additions & 1 deletion common/utils/global_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ def global_info(request):
else:
todo = 0

watermark_enabled = SysConfig().get("watermark_enabled", False)
sys_config = SysConfig()
watermark_enabled = sys_config.get("watermark_enabled", False)
announcement_content_enabled = sys_config.get("announcement_content_enabled", False)
announcement_content = sys_config.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,
}

0 comments on commit 417be6b

Please sign in to comment.