改进事件的显示效果
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -149,6 +149,19 @@
|
|||||||
<div class="text-sm font-normal">
|
<div class="text-sm font-normal">
|
||||||
{{ event.description }}
|
{{ event.description }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-sm font-normal">
|
||||||
|
{% with branch_count=event.branches.count %}
|
||||||
|
{% if branch_count == all_branch_count %}
|
||||||
|
涉及分支机构:全辖分支机构
|
||||||
|
{% elif branch_count == 1 %}
|
||||||
|
涉及分支机构:{{ event.branches.first.name }}
|
||||||
|
{% elif branch_count > 1 %}
|
||||||
|
涉及分支机构:{{ event.branches.all.0.name }}、{{ event.branches.all.1.name }}等{{ branch_count }}个营业部
|
||||||
|
{% else %}
|
||||||
|
涉及分支机构:暂无
|
||||||
|
{% endif %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
<span class="inline-flex items-center text-xs font-normal text-gray-400 dark:text-gray-400">
|
<span class="inline-flex items-center text-xs font-normal text-gray-400 dark:text-gray-400">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||||
class="w-2.5 h-2.5 text-blue-800 dark:text-blue-300">
|
class="w-2.5 h-2.5 text-blue-800 dark:text-blue-300">
|
||||||
|
|||||||
@@ -35,7 +35,11 @@
|
|||||||
<div class="border-l-4 border-blue-500 pl-4 py-2 bg-blue-50 rounded">
|
<div class="border-l-4 border-blue-500 pl-4 py-2 bg-blue-50 rounded">
|
||||||
<h3 class="font-semibold text-lg">{{ event.name }}</h3>
|
<h3 class="font-semibold text-lg">{{ event.name }}</h3>
|
||||||
<p class="text-sm text-gray-600">
|
<p class="text-sm text-gray-600">
|
||||||
{{ event.start_time|date:"Y-m-d H:i" }} - {{ event.end_time|date:"Y-m-d H:i"|default:"进行中" }}
|
{% if event.end_time %}
|
||||||
|
开始日期{{ event.start_time|date:"Y年m月d日" }} 结束日期{{ event.end_time|date:"Y年m月d日" }}
|
||||||
|
{% else %}
|
||||||
|
开始日期{{ event.start_time|date:"Y年m月d日" }},现在进行中
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<p class="mt-1 text-gray-700">{{ event.description|truncatechars:100 }}</p>
|
<p class="mt-1 text-gray-700">{{ event.description|truncatechars:100 }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ def BranchAll(request):
|
|||||||
for branch in branches]
|
for branch in branches]
|
||||||
# 返回总数
|
# 返回总数
|
||||||
total_branch_count = len(branches_with_counts)
|
total_branch_count = len(branches_with_counts)
|
||||||
|
# 获取所有分支机构总数(包括没有活动的)
|
||||||
|
all_branch_count = Branch.objects.count()
|
||||||
# 比如说end_time()的year是2024年,但是now()是2025年的2月,fileter出来,但是如果now()是2025年3月,则不显示
|
# 比如说end_time()的year是2024年,但是now()是2025年的2月,fileter出来,但是如果now()是2025年3月,则不显示
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
print(f"当前月份是{now.month},年是{now.year}")
|
print(f"当前月份是{now.month},年是{now.year}")
|
||||||
@@ -154,6 +156,7 @@ def BranchAll(request):
|
|||||||
'earliest_act': earliest_act,
|
'earliest_act': earliest_act,
|
||||||
'latest_act': latest_act,
|
'latest_act': latest_act,
|
||||||
'total_branch_count':total_branch_count,
|
'total_branch_count':total_branch_count,
|
||||||
|
'all_branch_count': all_branch_count,
|
||||||
'branch_count': branch_count,
|
'branch_count': branch_count,
|
||||||
'ongoing_activities': ongoing_activities,
|
'ongoing_activities': ongoing_activities,
|
||||||
'total_activities': total_activities,
|
'total_activities': total_activities,
|
||||||
|
|||||||
Reference in New Issue
Block a user