更新了年份显示和统计周期的显示
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,101 +1,103 @@
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
{% load custom_filters %}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'huodong/output.css' %}">
|
||||
<title>分支机构活动管理</title>
|
||||
<script src="https://unpkg.com/alpinejs@3.14.1/dist/cdn.min.js" defer></script>
|
||||
</head>
|
||||
<body class="font-sans text-gray-900">
|
||||
|
||||
<!-- 顶部标题 -->
|
||||
<header class="bg-gray-50 dark:bg-gray-800 dark:border-gray-700 p-4 text-center text-xl font-bold">
|
||||
分支机构活动管理
|
||||
<br>
|
||||
2025年
|
||||
</header>
|
||||
|
||||
<!-- 主体内容:左右两侧栏布局 -->
|
||||
<div class="flex">
|
||||
<!-- 左侧边栏 -->
|
||||
<aside class="w-27 bg-gray-300 p-4 ">
|
||||
{% block sidebar %}
|
||||
<ul class="flex flex-col space-y-8 text-lg">
|
||||
{% if request.resolver_match.view_name != 'branch-all' %}
|
||||
<li>
|
||||
<a href="{% url 'branch-all' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
返回首页
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{% url 'branchinfo' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
系统类型
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'statistics' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
活动的统计数据
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'contact-list' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
联系人信息
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'equipment-images' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
设备间图片列表
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'public-screens' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
公共电子屏列表
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'video-terminals' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
视频设备终端
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/" class="bg-gradient-to-r from-gray-700 to-gray-900 hover:from-gray-800 hover:to-black text-white p-3 rounded-md font-medium shadow-lg transition-all duration-300 flex items-center justify-between border-l-4 border-amber-500" target="_blank">
|
||||
<div class="flex items-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-amber-400" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z" />
|
||||
</svg>
|
||||
<span>后台管理</span>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-amber-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
</aside>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<main class="flex-1 bg-white p-4">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
|
||||
<!-- 右侧边栏 -->
|
||||
<!-- 注意:如果需要右侧边栏,请取消下方注释,并相应调整主内容区域的宽度 -->
|
||||
<!-- <aside class="w-1/3 bg-gray-300 p-4">
|
||||
Right Sidebar
|
||||
</aside> -->
|
||||
</div>
|
||||
|
||||
<!-- 页脚 -->
|
||||
<footer class="bg-gray-200 p-4 text-center mt-4">
|
||||
© 2025 My Website. All rights reserved.
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
{% load custom_filters %}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'huodong/output.css' %}">
|
||||
<title>分支机构活动管理</title>
|
||||
<script src="https://unpkg.com/alpinejs@3.14.1/dist/cdn.min.js" defer></script>
|
||||
</head>
|
||||
<body class="font-sans text-gray-900">
|
||||
|
||||
<!-- 顶部标题 -->
|
||||
<header class="bg-gray-50 dark:bg-gray-800 dark:border-gray-700 p-4 text-center text-xl font-bold">
|
||||
分支机构活动管理
|
||||
<br>
|
||||
{{ ''|get_current_year }}年
|
||||
<br>
|
||||
统计周期:{{ ''|get_statistic_period }}
|
||||
</header>
|
||||
|
||||
<!-- 主体内容:左右两侧栏布局 -->
|
||||
<div class="flex">
|
||||
<!-- 左侧边栏 -->
|
||||
<aside class="w-27 bg-gray-300 p-4 ">
|
||||
{% block sidebar %}
|
||||
<ul class="flex flex-col space-y-8 text-lg">
|
||||
{% if request.resolver_match.view_name != 'branch-all' %}
|
||||
<li>
|
||||
<a href="{% url 'branch-all' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
返回首页
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{% url 'branchinfo' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
系统类型
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'statistics' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
活动的统计数据
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'contact-list' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
联系人信息
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'equipment-images' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
设备间图片列表
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'public-screens' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
公共电子屏列表
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{% url 'video-terminals' %}" class="bg-transparent hover:bg-blue-900 hover:text-white p-2 rounded-md">
|
||||
视频设备终端
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/admin/" class="bg-gradient-to-r from-gray-700 to-gray-900 hover:from-gray-800 hover:to-black text-white p-3 rounded-md font-medium shadow-lg transition-all duration-300 flex items-center justify-between border-l-4 border-amber-500" target="_blank">
|
||||
<div class="flex items-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-amber-400" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z" />
|
||||
</svg>
|
||||
<span>后台管理</span>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-amber-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
</aside>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<main class="flex-1 bg-white p-4">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
|
||||
<!-- 右侧边栏 -->
|
||||
<!-- 注意:如果需要右侧边栏,请取消下方注释,并相应调整主内容区域的宽度 -->
|
||||
<!-- <aside class="w-1/3 bg-gray-300 p-4">
|
||||
Right Sidebar
|
||||
</aside> -->
|
||||
</div>
|
||||
|
||||
<!-- 页脚 -->
|
||||
<footer class="bg-gray-200 p-4 text-center mt-4">
|
||||
© 2025 My Website. All rights reserved.
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -28,3 +28,39 @@ def format_chinese_full_date(value):
|
||||
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
weekday = weekdays[date_obj.weekday()]
|
||||
return f"{date_obj.year}年{date_obj.month}月{date_obj.day}日 {weekday}"
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_current_year(value=None):
|
||||
"""
|
||||
获取当前年份
|
||||
"""
|
||||
now = datetime.now() if value is None else value
|
||||
return now.year
|
||||
|
||||
|
||||
@register.filter
|
||||
def get_statistic_period(value=None):
|
||||
"""
|
||||
计算统计周期
|
||||
规则:
|
||||
- 在2026年1月,实际统计的是2025年11月至2026年1月
|
||||
- 在2026年2月,实际统计的是2025年12月至2026年2月
|
||||
- 以此类推
|
||||
"""
|
||||
now = datetime.now() if value is None else value
|
||||
current_year = now.year
|
||||
current_month = now.month
|
||||
|
||||
# 计算统计周期的开始月份和年份
|
||||
if current_month <= 2:
|
||||
start_year = current_year - 1
|
||||
start_month = 11 + current_month
|
||||
else:
|
||||
start_year = current_year
|
||||
start_month = current_month - 2
|
||||
|
||||
# 构建统计周期字符串
|
||||
period = f"{start_year}年{start_month}月至{current_year}年{current_month}月"
|
||||
|
||||
return period
|
||||
|
||||
Reference in New Issue
Block a user