左侧菜单的错误
项目中出现的问题及其解决
1.对于bootstrap左侧菜单,如果发生 访问下一个界面时菜单选中状态消失 的情况,这是因为模板继承,每次会刷新界面。解决方式为在base.html界面中使用模板语言if语句+url判断,然后其他界面继承此界面
<ul class="nav nav-list tabBox">
<li class="{% if request.path == '/AdminIndex/' %} active {% endif %}">
<a href="{% url "admin_index" %} ">
<i class="fa fa-home fa-lg"></i>
<span class="menu-text">首页</span>
</a>
<b class="arrow"></b>
</li>
<li class="{% if request.path == '/eval_obj_manage/' or request.path == '/edit_eval_obj/' %} active {% endif %}" >
<a href="{% url "eval_obj_manage" %} ">
<i class="fa fa-pencil fa-lg"></i>
<span class="menu-text">评估对象管理</span>
</a>
<b class="arrow"></b>
</li>
<li class="{% if request.path == '/expert_manage/' or request.path == '/edit_expert/' %} active {% endif %}" >
<a href="{% url "expert_manage" %} ">
<i class="fa fa-user fa-lg"></i>
<span class="menu-text">专家管理</span>
</a>
<b class="arrow"></b>
</li>
<li class="{% if request.path == '/eval_num_manage/' or request.path == '/edit_eval_num/' %} active {% endif %}" >
<a href="{% url "eval_num_manage" %}">
<i class="fa fa-tasks fa-lg"></i>
<span class="menu-text">评审任务信息管理</span>
</a>
<b class="arrow"></b>
</li>
<li class="{% if request.path == '/score_task_manage/' or request.path == '/edit_eval_task/' %} active {% endif %}" >
<a href="{% url "score_task_manage" %}">
<i class="fa fa-tag fa-lg"></i>
<span class="menu-text">专家打分任务分配</span>
</a>
<b class="arrow"></b>
</li>
<li class="{% if request.path == '/admin_score_result/' or request.path == '/score_details/' %} active {% endif %}" >
<a href="{% url "admin_score_result" %} ">
<i class="fa fa-list fa-lg"></i>
<span class="menu-text">评分结果</span>
</a>
<b class="arrow"></b>
</li>
</ul>