Files
2025-01-05 10:45:32 +08:00

58 lines
2.6 KiB
HTML

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Share System</title>
<link href="{% static 'css/output.css' %}" rel="stylesheet">
</head>
<body class="bg-gray-100">
<nav class="bg-white shadow">
<div class="max-w-6xl mx-auto px-4">
<div class="flex justify-between">
<div class="flex space-x-4">
<div>
<a href="{% url 'home' %}" class="flex items-center py-5 px-2 text-gray-700 hover:text-gray-900">
首页
</a>
</div>
{% if user.is_authenticated %}
<div>
<a href="{% url 'search' %}" class="flex items-center py-5 px-2 text-gray-700 hover:text-gray-900">
搜索
</a>
</div>
{% endif %}
</div>
<div class="flex items-center space-x-1">
{% if user.is_authenticated %}
<a href="{% url 'dashboard' %}" class="py-5 px-3 text-gray-700 hover:text-gray-900">仪表盘</a>
<a href="{% url 'upload' %}" class="py-5 px-3 text-gray-700 hover:text-gray-900">上传文件</a>
{% if user.is_authenticated %}
<a href="{% url 'admin:index' %}" class="py-5 px-3 text-gray-700 hover:text-gray-900">管理后台</a>
{% endif %}
<span class="py-5 px-3 text-gray-700">{{ user.username }}</span>
<form action="{% url 'logout' %}" method="post" class="inline" onsubmit="return confirmLogout()">
{% csrf_token %}
<button type="submit" class="py-5 px-3 text-gray-700 hover:text-gray-900">退出</button>
</form>
<script>
function confirmLogout() {
return confirm('确定要退出登录吗?');
}
</script>
{% else %}
<a href="{% url 'login' %}" class="py-5 px-3 text-gray-700 hover:text-gray-900">登录</a>
<a href="{% url 'register' %}" class="py-5 px-3 text-gray-700 hover:text-gray-900">注册</a>
{% endif %}
</div>
</div>
</div>
</nav>
{% block content %}
{% endblock %}
</body>
</html>