update. 完善基础信息配置以及页面链接处理
This commit is contained in:
+3
-3
@@ -1,7 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
|
||||
from base.models import MainMenu, FooterLink, LinkCategory, FriendLink
|
||||
from base.models import MainMenu, BaseInfo, LinkCategory, FriendLink
|
||||
|
||||
|
||||
# —————— 主菜单 ——————
|
||||
@@ -61,7 +61,7 @@ class FriendLinkAdmin(ImportExportModelAdmin):
|
||||
|
||||
|
||||
# —————— 页脚链接 ——————
|
||||
@admin.register(FooterLink)
|
||||
class FooterLinkAdmin(ImportExportModelAdmin):
|
||||
@admin.register(BaseInfo)
|
||||
class BaseInfoAdmin(ImportExportModelAdmin):
|
||||
list_display = ('title', 'address', 'unit', 'postal', 'telephone', 'fax', 'filing')
|
||||
list_editable = ('postal', 'telephone', 'fax', 'unit', 'filing',)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from base.models import BaseInfo, LinkCategory, MainMenu
|
||||
|
||||
|
||||
def site_info(request):
|
||||
"""
|
||||
为所有模板提供站点信息
|
||||
"""
|
||||
site_info_obj = BaseInfo.objects.filter(is_active=True).first()
|
||||
link_categories = LinkCategory.objects.filter(is_active=True).prefetch_related('links')
|
||||
menus = MainMenu.objects.filter(visible=True, parent__isnull=True).order_by('order')
|
||||
|
||||
return {
|
||||
'site_info': site_info_obj,
|
||||
'link_categories': link_categories,
|
||||
'menus': menus,
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
# Generated by Django 6.0.3 on 2026-04-01 14:41
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('base', '0002_alter_friendlink_options_alter_linkcategory_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='BaseInfo',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
|
||||
('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
|
||||
('title', models.CharField(max_length=128, verbose_name='单位名称')),
|
||||
('e_title', models.CharField(max_length=256, verbose_name='英文名称')),
|
||||
('address', models.CharField(max_length=200, verbose_name='单位地址')),
|
||||
('postal', models.CharField(default='', verbose_name='邮编')),
|
||||
('telephone', models.CharField(default='', verbose_name='服务热线')),
|
||||
('fax', models.CharField(default='', verbose_name='传真')),
|
||||
('unit', models.CharField(default='', verbose_name='版权单位')),
|
||||
('filing', models.CharField(default='', verbose_name='备案号')),
|
||||
('official_account', models.ImageField(default='', upload_to='carousel/', verbose_name='公众号二维码')),
|
||||
('weibo', models.ImageField(default='', upload_to='carousel/', verbose_name='微博二维码')),
|
||||
('is_active', models.BooleanField(default=False, verbose_name='生效')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '单位信息',
|
||||
'verbose_name_plural': '单位信息',
|
||||
},
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='FooterLink',
|
||||
),
|
||||
]
|
||||
+6
-5
@@ -114,8 +114,9 @@ class MainMenu(BaseEntity):
|
||||
return self.children.filter(visible=True)
|
||||
|
||||
|
||||
class FooterLink(BaseEntity):
|
||||
title = models.CharField("页脚信息", max_length=50)
|
||||
class BaseInfo(BaseEntity):
|
||||
title = models.CharField("单位名称", max_length=128)
|
||||
e_title = models.CharField("英文名称", max_length=256)
|
||||
address = models.CharField("单位地址", max_length=200)
|
||||
postal = models.CharField("邮编", default="")
|
||||
telephone = models.CharField("服务热线", default="")
|
||||
@@ -127,8 +128,8 @@ class FooterLink(BaseEntity):
|
||||
is_active = models.BooleanField("生效", default=False)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "页脚信息"
|
||||
verbose_name_plural = "页脚管理"
|
||||
verbose_name = "单位信息"
|
||||
verbose_name_plural = "单位信息"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title} - 状态:{'使用中' if self.is_active else '已停用'}"
|
||||
@@ -138,7 +139,7 @@ class FooterLink(BaseEntity):
|
||||
if self.is_active:
|
||||
# 2. 将数据库中【除了当前这条】以外的所有 FooterLink 都更新为“不生效”
|
||||
# self.pk 是当前对象的唯一标识
|
||||
FooterLink.objects.exclude(pk=self.pk).update(is_active=False)
|
||||
BaseInfo.objects.exclude(pk=self.pk).update(is_active=False)
|
||||
|
||||
# 3. 执行正常的保存操作
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
from django import template
|
||||
from loguru import logger
|
||||
|
||||
from ..models import FooterLink, LinkCategory, MainMenu # 假设你的模型在当前目录的上一级 models.py 中
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
# inclusion_tag 装饰器会自动帮你渲染指定的模板
|
||||
@register.inclusion_tag('components/footer.html')
|
||||
def show_footer():
|
||||
# 1. 获取当前生效的那一条页脚数据
|
||||
# 根据你之前的模型,is_active=True 的只有一条
|
||||
footer = FooterLink.objects.filter(is_active=True).first()
|
||||
link_categories = LinkCategory.objects.filter(is_active=True)
|
||||
logger.info(footer)
|
||||
logger.info(link_categories)
|
||||
|
||||
# 3. 将数据传递给模板
|
||||
return {
|
||||
'footer': footer,
|
||||
'categories': link_categories
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('components/main_menu.html', takes_context=True)
|
||||
def show_main_menu(context):
|
||||
request = context['request']
|
||||
# 1. 获取当前生效的那一条页脚数据
|
||||
# 根据你之前的模型,is_active=True 的只有一条
|
||||
menus = MainMenu.objects.filter(visible=True, parent__isnull=True).order_by('order')
|
||||
logger.info(menus)
|
||||
|
||||
# 3. 将数据传递给模板
|
||||
return {
|
||||
'menus': menus,
|
||||
'request': request,
|
||||
}
|
||||
+8
-7
@@ -1,4 +1,4 @@
|
||||
from django.urls import path, include
|
||||
from django.urls import path, include, re_path
|
||||
|
||||
from front import views
|
||||
|
||||
@@ -7,11 +7,12 @@ app_name = 'front' # 可选,用于命名空间(如 {% url 'main:index' %}
|
||||
urlpatterns = [
|
||||
path('', views.index, name='index'),
|
||||
path('<str:main>.html', views.section, name='section'),
|
||||
path('<str:main>/list.html', views.main_article_list, name='main_list'),
|
||||
path('<str:main>/list/<str:sub>.html', views.sub_article_list, name='sub_list'),
|
||||
path('about/', views.about, name='about'),
|
||||
path('news/', views.news, name='news'),
|
||||
path('list/news.html', views.main_news_list, name='news_main'),
|
||||
path('list/<str:main>.html', views.main_article_list, name='main_list'),
|
||||
path('list/<str:main>/<str:sub>.html', views.sub_article_list, name='sub_list'),
|
||||
path('news/<int:pk>.html', views.news_detail, name='news_detail'),
|
||||
path('about', views.about, name='about'),
|
||||
path('news/<str:sub>.html', views.sub_news_list, name='news_list'),
|
||||
path('article/<int:pk>.html/', views.article_detail, name='article_detail'),
|
||||
path('news/<int:pk>.html/', views.news_detail, name='news_detail'),
|
||||
re_path('news$', views.news, name='news'),
|
||||
path('article/<int:pk>.html', views.article_detail, name='article_detail'),
|
||||
]
|
||||
|
||||
+9
-8
@@ -121,12 +121,12 @@ def news(request):
|
||||
sections = NewsSection.objects.filter(visible=True).all().order_by('order')
|
||||
section_data = [
|
||||
{
|
||||
"key": section.code,
|
||||
"key": sec.code,
|
||||
"data": {
|
||||
section.title: section.news_set.filter(is_published=True)[:7],
|
||||
sec.title: sec.news_set.filter(is_published=True)[:7],
|
||||
}
|
||||
}
|
||||
for section in sections
|
||||
for sec in sections
|
||||
]
|
||||
|
||||
context = {
|
||||
@@ -161,19 +161,20 @@ def section(request, main):
|
||||
|
||||
def main_news_list(request):
|
||||
logger.info("正在访问新闻中心")
|
||||
news_list = News.objects.all()
|
||||
news_sections = NewsSection.objects.all()
|
||||
news_list = News.objects.filter(is_published=True).all()
|
||||
news_sections = NewsSection.objects.filter(visible=True).all()
|
||||
# 分页参数
|
||||
news_list = custom_pagination(news_list, request)
|
||||
|
||||
return render(request, 'front/list.html', {
|
||||
context = {
|
||||
'main_section': {
|
||||
'title': '新闻中心',
|
||||
'code': 'news'
|
||||
},
|
||||
'articles': news_list,
|
||||
'sections': news_sections,
|
||||
})
|
||||
}
|
||||
return render(request, 'front/list.html', context)
|
||||
|
||||
|
||||
def custom_pagination(news_list, request):
|
||||
@@ -195,7 +196,7 @@ def custom_pagination(news_list, request):
|
||||
|
||||
def sub_news_list(request, sub: str):
|
||||
logger.info(f"正在访问 {sub}")
|
||||
sections = NewsSection.objects.all().order_by('order')
|
||||
sections = NewsSection.objects.filter(visible=True).order_by('order')
|
||||
logger.info(f"新闻板块: {sections}")
|
||||
main_section = {
|
||||
'title': '新闻中心',
|
||||
|
||||
@@ -109,6 +109,7 @@ TEMPLATES = [
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'base.context_processors.site_info',
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
+106
-97
@@ -1,26 +1,22 @@
|
||||
{% load static %}
|
||||
{% load footer_tags %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}{% endblock %}XXXXXXX官网</title>
|
||||
|
||||
|
||||
<title>{% block title %}{% endblock %}{{ site_info.title }}</title>
|
||||
<link rel="stylesheet" href="{% static 'css/style.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- 顶部 -->
|
||||
<header class="top-header">
|
||||
<span></span>
|
||||
<div class="header-container flex">
|
||||
<img src="{% static 'images/logo.png' %}" class="logo" alt="">
|
||||
<div>
|
||||
<h1>XXXXXXX官网</h1>
|
||||
<p>CHANGBAI MOUNTAIN FIRE AND RESCUE BRIGADE</p>
|
||||
<h1>{{ site_info.title }}</h1>
|
||||
<p>{{ site_info.e_title }}</p>
|
||||
<p>CHANGBAI MOUNTAIN FIRE AND RESCUE BRIGADE</p>
|
||||
</div>
|
||||
</div>
|
||||
<div></div>
|
||||
@@ -45,29 +41,13 @@
|
||||
<li class="{% if request.resolver_match.url_name == 'news' %}active{% endif %}">
|
||||
<a href="{% url 'front:news' %}">新闻中心</a>
|
||||
</li>
|
||||
{% show_main_menu %}
|
||||
{% for menu in menus %}
|
||||
<!-- 新闻中心 -->
|
||||
|
||||
{##}
|
||||
{# <!-- 信息公开 -->#}
|
||||
{# <li class="{% if request.resolver_match.url_name == 'info' %}active{% endif %}">#}
|
||||
{# <a href="{% url 'front:info' %}">信息公开</a>#}
|
||||
{# </li>#}
|
||||
{# <!-- 党建引领 -->#}
|
||||
{# <li class="{% if request.resolver_match.url_name == 'party' %}active{% endif %}">#}
|
||||
{# <a href="{% url 'front:party' %}">党建引领</a>#}
|
||||
{# </li>#}
|
||||
{# <!-- 办事服务 -->#}
|
||||
{# <li class="{% if request.resolver_match.url_name == 'service' %}active{% endif %}">#}
|
||||
{# <a href="{% url 'front:service' %}">办事服务</a>#}
|
||||
{# </li>#}
|
||||
{# <!-- 互动交流 -->#}
|
||||
{# <li class="{% if request.resolver_match.url_name == 'interaction' %}active{% endif %}">#}
|
||||
{# <a href="{% url 'front:interaction' %}">互动交流</a>#}
|
||||
{# </li>#}
|
||||
{# <!-- 消防科普 -->#}
|
||||
{# <li class="{% if request.resolver_match.url_name == 'science' %}active{% endif %}">#}
|
||||
{# <a href="{% url 'front:science' %}">消防科普</a>#}
|
||||
{# </li>#}
|
||||
<li class="{% if menu.code in request.path %}active{% endif %}">
|
||||
<a href="{% url 'front:section' main=menu.code %}">{{ menu.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<span></span>
|
||||
@@ -86,75 +66,104 @@
|
||||
</main>
|
||||
<!-- 底部页脚:只需要写这一行,全站生效! -->
|
||||
|
||||
{% show_footer %}
|
||||
<!-- 底部 -->
|
||||
{#<footer class="footer">#}
|
||||
{# <div class=" d-none d-md-block">#}
|
||||
{# <div class="row"#}
|
||||
{# style="align-items: center;justify-content: space-evenly;padding: 15px 0;background-color: #F5F5F5;width: 100%!important;margin-left: 0 !important;gap: 10px;">#}
|
||||
{# <div style="display: flex;align-items: center;">#}
|
||||
{# <img src="{% static "icons/link.svg" %}" alt="" style="width: 13px; height: 13px; object-fit: contain;">#}
|
||||
{# <a href="#"#}
|
||||
{# style="margin-left: 6px; text-decoration: none; color: #13227a; font-size: 14px; white-space: nowrap;">#}
|
||||
{# 友情链接#}
|
||||
{# </a>#}
|
||||
{# </div>#}
|
||||
{# <div style="width: 280px;">#}
|
||||
{# <select class="form-control" id="exampleFormControlSelect1"#}
|
||||
{# x-placement="市政府网站"#}
|
||||
{# >#}
|
||||
{# <option>市政府网站</option>#}
|
||||
{# <option>1</option>#}
|
||||
{# <option>2</option>#}
|
||||
{# <option>3</option>#}
|
||||
{# <option>4</option>#}
|
||||
{# <option>5</option>#}
|
||||
{# </select>#}
|
||||
{# </div>#}
|
||||
{# <div style="display: block;width: 280px;">#}
|
||||
{# <select class="form-control" id="exampleFormControlSelect1"#}
|
||||
{# x-placement="国内消防站点"#}
|
||||
{# >#}
|
||||
{# <option>国内消防站点</option>#}
|
||||
{# <option>1</option>#}
|
||||
{# <option>2</option>#}
|
||||
{# <option>3</option>#}
|
||||
{# <option>4</option>#}
|
||||
{# <option>5</option>#}
|
||||
{# </select>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# <div class="footer-info">#}
|
||||
{# <div class="row">#}
|
||||
{# <div class="col-lg-3 col-md-6 text-center">#}
|
||||
{# <img src="{% static 'images/red.png' %}">#}
|
||||
{# <img class="footerImg" src="{% static 'images/jiucuo.png' %}">#}
|
||||
{# </div>#}
|
||||
{# <div class="col-lg-6 d-none d-xl-block">#}
|
||||
{# <p class="margin-top-20 font-size-14 line-height-2 footerColor">#}
|
||||
{# 地址:某某市某某东路锦海·某某区大厦B栋14楼 邮编:xxxxxx#}
|
||||
{# </p>#}
|
||||
{# <p class="font-size-14 line-height-2 footerColor">#}
|
||||
{# 服务热线:0791-00000000 传真:0791-00000000#}
|
||||
{# </p>#}
|
||||
{# </div>#}
|
||||
{# <div class="col-lg-3 col-md-6 text-center">#}
|
||||
{# <img src="/media/upload/images/2026/03/25/wechat.png" alt="">#}
|
||||
{# <img class="footerImg" src="/media/upload/images/2026/03/25/weibo.png" alt="">#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{# <div class="copyright text-center line-height-2 padding-bottom-20 padding-top-20">#}
|
||||
{# <p class="margin-top-20 font-size-14 line-height-2 footerColor">#}
|
||||
{# 版权所有:长白山消防救援支队 备案证号:<a href="http://beian.miit.gov.cn/"#}
|
||||
{# target="_blank">辽ICP备xxxxxxxx号</a>#}
|
||||
{# </p>#}
|
||||
{# </div>#}
|
||||
{# </div>#}
|
||||
{#</footer>#}
|
||||
<footer class="footer">
|
||||
<!-- 友情链接区域 -->
|
||||
<div class=" d-none d-md-block">
|
||||
<div class="row"
|
||||
style="align-items: center;justify-content: space-evenly;padding: 15px 0;background-color: #F5F5F5;width: 100%!important;margin-left: 0 !important;gap: 10px;">
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<img src="{% static "icons/link.svg" %}" alt=""
|
||||
style="width: 13px; height: 13px; object-fit: contain;">
|
||||
<a href="#"
|
||||
style="margin-left: 6px; text-decoration: none; color: #13227a; font-size: 14px; white-space: nowrap;">
|
||||
友情链接
|
||||
</a>
|
||||
</div>
|
||||
{% for category in categories %}
|
||||
<!-- 市政府网站下拉框 -->
|
||||
|
||||
<div style="width: 280px;">
|
||||
<select class="form-control"
|
||||
onchange="if(this.value) window.open(this.value)">
|
||||
<option>{{ category.name }}</option>
|
||||
{% for link in category.links.all %}
|
||||
{% if link.is_active %}
|
||||
<!-- 这里可以动态循环 FooterLink 关联的友情链接对象 -->
|
||||
<option value="{{ link.url }}">{{ link.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{% empty %}
|
||||
<!-- 如果后台没配置分类,显示默认占位 -->
|
||||
<div style="width: 280px;">
|
||||
<select class="form-control">
|
||||
<option>暂无链接</option>
|
||||
</select>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 页脚主体信息区域 -->
|
||||
<div class="footer-info">
|
||||
<div class="row">
|
||||
|
||||
<!-- 左侧:Logo 图标 -->
|
||||
<div class="col-lg-3 col-md-6 text-center">
|
||||
<img src="{% static 'images/red.png' %}" alt="政府标识">
|
||||
<img class="footerImg" src="{% static 'images/jiucuo.png' %}" alt="找错">
|
||||
</div>
|
||||
|
||||
<!-- 中间:文字信息 -->
|
||||
<div class="col-lg-6 d-none d-xl-block">
|
||||
<!-- 地址与邮编 -->
|
||||
<p class="margin-top-20 font-size-14 line-height-2 footerColor">
|
||||
地址:{{ base_info.address }} 邮编:{{ base_info.postal }}
|
||||
</p>
|
||||
<!-- 电话与传真 -->
|
||||
<p class="font-size-14 line-height-2 footerColor">
|
||||
服务热线:{{ base_info.telephone }} 传真:{{ base_info.fax }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:公众号/微博二维码 -->
|
||||
<div class="col-lg-3 col-md-6 text-center">
|
||||
<!-- 微信二维码 -->
|
||||
{% if base_info.official_account %}
|
||||
<img src="{{ base_info.official_account.url }}" alt="微信公众号"
|
||||
style="width: 50px; height: 50px; margin-right: 10px;">
|
||||
{% else %}
|
||||
<span>暂无二维码</span>
|
||||
{% endif %}
|
||||
|
||||
<!-- 微博二维码 -->
|
||||
{% if base_info.weibo %}
|
||||
<img class="footerImg" src="{{ base_info.weibo.url }}" alt="政务微博"
|
||||
style="width: 50px; height: 50px;">
|
||||
{% else %}
|
||||
<span>暂无微博</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 版权备案信息 -->
|
||||
<div class="copyright text-center line-height-2 padding-bottom-20 padding-top-20">
|
||||
<p class="margin-top-20 font-size-14 line-height-2 footerColor">
|
||||
版权所有:{{ base_info.unit }} 备案证号:
|
||||
<a href="http://beian.miit.gov.cn/" target="_blank">
|
||||
{{ base_info.filing }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
|
||||
<script src="{% static 'js/bootstrap.bundle.min.js' %}"></script>
|
||||
|
||||
|
||||
<!-- 页面底部脚本 -->
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
{% load static %}
|
||||
|
||||
<footer class="footer">
|
||||
<!-- 友情链接区域 -->
|
||||
<div class=" d-none d-md-block">
|
||||
<div class="row"
|
||||
style="align-items: center;justify-content: space-evenly;padding: 15px 0;background-color: #F5F5F5;width: 100%!important;margin-left: 0 !important;gap: 10px;">
|
||||
|
||||
<div style="display: flex;align-items: center;">
|
||||
<img src="{% static "icons/link.svg" %}" alt=""
|
||||
style="width: 13px; height: 13px; object-fit: contain;">
|
||||
<a href="#"
|
||||
style="margin-left: 6px; text-decoration: none; color: #13227a; font-size: 14px; white-space: nowrap;">
|
||||
友情链接
|
||||
</a>
|
||||
</div>
|
||||
{% for category in categories %}
|
||||
<!-- 市政府网站下拉框 -->
|
||||
|
||||
<div style="width: 280px;">
|
||||
<select class="form-control"
|
||||
onchange="if(this.value) window.open(this.value)">
|
||||
<option>{{ category.name }}</option>
|
||||
{% for link in category.links.all %}
|
||||
{% if link.is_active %}
|
||||
<!-- 这里可以动态循环 FooterLink 关联的友情链接对象 -->
|
||||
<option value="{{ link.url }}">{{ link.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{% empty %}
|
||||
<!-- 如果后台没配置分类,显示默认占位 -->
|
||||
<div style="width: 280px;">
|
||||
<select class="form-control">
|
||||
<option>暂无链接</option>
|
||||
</select>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<!-- 页脚主体信息区域 -->
|
||||
<div class="footer-info">
|
||||
<div class="row">
|
||||
|
||||
<!-- 左侧:Logo 图标 -->
|
||||
<div class="col-lg-3 col-md-6 text-center">
|
||||
<img src="{% static 'images/red.png' %}" alt="政府标识">
|
||||
<img class="footerImg" src="{% static 'images/jiucuo.png' %}" alt="找错">
|
||||
</div>
|
||||
|
||||
<!-- 中间:文字信息 -->
|
||||
<div class="col-lg-6 d-none d-xl-block">
|
||||
<!-- 地址与邮编 -->
|
||||
<p class="margin-top-20 font-size-14 line-height-2 footerColor">
|
||||
地址:{{ footer.address }} 邮编:{{ footer.postal }}
|
||||
</p>
|
||||
<!-- 电话与传真 -->
|
||||
<p class="font-size-14 line-height-2 footerColor">
|
||||
服务热线:{{ footer.telephone }} 传真:{{ footer.fax }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:公众号/微博二维码 -->
|
||||
<div class="col-lg-3 col-md-6 text-center">
|
||||
<!-- 微信二维码 -->
|
||||
{% if footer.official_account %}
|
||||
<img src="{{ footer.official_account.url }}" alt="微信公众号"
|
||||
style="width: 50px; height: 50px; margin-right: 10px;">
|
||||
{% else %}
|
||||
<span>暂无二维码</span>
|
||||
{% endif %}
|
||||
|
||||
<!-- 微博二维码 -->
|
||||
{% if footer.weibo %}
|
||||
<img class="footerImg" src="{{ footer.weibo.url }}" alt="政务微博"
|
||||
style="width: 50px; height: 50px;">
|
||||
{% else %}
|
||||
<span>暂无微博</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 版权备案信息 -->
|
||||
<div class="copyright text-center line-height-2 padding-bottom-20 padding-top-20">
|
||||
<p class="margin-top-20 font-size-14 line-height-2 footerColor">
|
||||
版权所有:{{ footer.unit }} 备案证号:
|
||||
<a href="http://beian.miit.gov.cn/" target="_blank">
|
||||
{{ footer.filing }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -1,10 +0,0 @@
|
||||
{% load static %}
|
||||
|
||||
{% for menu in menus %}
|
||||
<!-- 新闻中心 -->
|
||||
|
||||
<li class="{% if menu.code in request.path %}active{% endif %}">
|
||||
<a href="{% url 'front:section' main=menu.code %}">{{ menu.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
<ol class="breadcrumb" style="background-color: transparent !important; padding-bottom: 0;">
|
||||
<li class="breadcrumb-item"><a href="/">网站首页</a></li>
|
||||
<!-- 动态显示所属板块 -->
|
||||
<li class="breadcrumb-item"><a href="#">{{ article.section.parent.title }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="#">{{ article.section.title }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url "front:news_main" %}">{{ article.section.parent.title }}</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a
|
||||
href="{% url "front:news_list" article.section.code %}">{{ article.section.title }}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">文章详情</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
{% include 'components/_carousel.html' with carousel_id=carousel.key slides=carousel.data height="300px" %}
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
{% url "front:news" as more_url %}
|
||||
{% url "front:news_main" as more_url %}
|
||||
{% include 'components/_news_card.html' with data=news_data.data unique_id=news_data.key more_url=more_url route="front:news_detail" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" style="margin-left: -10px;">
|
||||
<ol class="breadcrumb" style="background-color: transparent !important;padding-bottom: 0;">
|
||||
<li class="breadcrumb-item"><a href="#">网站首页</a></li>
|
||||
<li class="breadcrumb-item"><a href="/">网站首页</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ main_section.title }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
@@ -4,17 +4,24 @@
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" style="margin-left: -10px;">
|
||||
<ol class="breadcrumb" style="background-color: transparent !important;padding-bottom: 0;">
|
||||
<li class="breadcrumb-item"><a href="/">网站首页</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ main_section.title }}</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ sub_section.title }}</li>
|
||||
<li class="breadcrumb-item"><a href="/" style="color: #23408A; text-decoration: none;">网站首页</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
<a href="{% url "front:main_list" main=main_section.code %}"
|
||||
style="color: #23408A; text-decoration: none;"
|
||||
>
|
||||
{{ main_section.title }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">
|
||||
{{ sub_section.title }}
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="row" style="height: 100%;margin: 15px auto;margin-right: 0 !important;">
|
||||
<div class="col-3">
|
||||
<ul class="list-group">
|
||||
|
||||
{% if request.path|slice:":6" == '/news/' %}
|
||||
{% if '/news' in request.path %}
|
||||
<li class="list-group-item" style="background: #23418A; color: #f5f5f5">
|
||||
<a href="{% url "front:news" %}"
|
||||
style="color: #F5F5F5;text-decoration: none;">
|
||||
@@ -23,7 +30,7 @@
|
||||
</li>
|
||||
{% for sec in sections %}
|
||||
<!-- 核心修改:判断当前路径是否包含该子栏目的 code -->
|
||||
{% if request.path|slice:":6" == '/news/' and sec.code in request.path %}
|
||||
{% if '/news' in request.path and sec.code in request.path %}
|
||||
<li class="list-group-item" style="background: #e9ecef;"> <!-- 选中样式:灰色背景 -->
|
||||
<a href="{% url "front:news_list" sub=sec.code %}"
|
||||
style="color: #23418A; text-decoration: none; font-weight: bold;"> {{ sec.title }}</a>
|
||||
@@ -82,12 +89,21 @@
|
||||
{% if articles %}
|
||||
{% for item in articles %}
|
||||
<li class="news-item">
|
||||
{% if '/news' in request.path %}
|
||||
<a href="{% url "front:news_detail" pk=item.id %}"
|
||||
style="text-decoration: none;color: black;">
|
||||
{% else %}
|
||||
<a href="{% url "front:article_detail" pk=item.id %}"
|
||||
style="text-decoration: none;color: black;">
|
||||
{% endif %}
|
||||
|
||||
<div class="news-title-wrapper">
|
||||
<span class="bullet-point"></span>
|
||||
<span class="news-title-text"
|
||||
title="{{ item.title }}">{{ item.title|truncatechars:30 }}</span>
|
||||
</div>
|
||||
<span class="news-date">{{ item.created_at }}</span>
|
||||
</a>
|
||||
<span class="news-date">{{ item.created_at|date:"Y-m-d" }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{% for section in sections %}
|
||||
<div class="row" style="margin: auto auto 15px;">
|
||||
{% url "front:news_list" sub=section.key as more_url %}
|
||||
{% include 'components/_news_card.html' with data=section.data unique_id=section.key more_url=more_url route="front:news_detail" %}
|
||||
{% include 'components/_news_card.html' with data=section.data unique_id=section.key more_url=more_url route="front:news_detail" %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user