You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.8 KiB
43 lines
1.8 KiB
<!-- 定义导航栏 -->
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
|
<div class="container">
|
|
<!-- 导航栏商标 -->
|
|
<a class="navbar-brand" href="#">在线考试</a>
|
|
<!-- 导航入口 -->
|
|
<div>
|
|
<ul class="navbar-nav">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/index/">首页</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/examinfo/">考试记录</a>
|
|
</li>
|
|
<!-- Django的 if 模板语句 -->
|
|
{% if request.session.username %}
|
|
<!-- 如果用户已经登录,则显示用户名下拉框 -->
|
|
<li class="nav-item dropdown">
|
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
{{ request.session.username }}
|
|
</a>
|
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
|
<a class="dropdown-item" href="/userfile/">个人信息</a>
|
|
<a class="dropdown-item" href="/stulogout/">退出登录</a>
|
|
</div>
|
|
</li>
|
|
<!-- 如果用户未登录,则显示 “登录” -->
|
|
{% else %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/studentLogin/">登录</a>
|
|
</li>
|
|
<!-- if 语句在这里结束 -->
|
|
{% endif %}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/admin">管理员</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
|