|
|
<!DOCTYPE html>
|
|
|
<html lang="zh-CN">
|
|
|
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>{% block title %}管理页面{% endblock %}</title>
|
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
|
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css" rel="stylesheet">
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/javascript/javascript.min.js"></script>
|
|
|
<link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.png') }}">
|
|
|
{% block extra_css %}{% endblock %}
|
|
|
</head>
|
|
|
|
|
|
<body class="bg-gray-100 min-h-screen flex flex-col">
|
|
|
|
|
|
<nav class="bg-white shadow-lg">
|
|
|
<div class="max-w-7xl mx-auto px-4">
|
|
|
<div class="flex justify-between h-16">
|
|
|
|
|
|
<div class="flex">
|
|
|
<div class="flex-shrink-0 flex items-center">
|
|
|
<span class="text-xl font-bold text-gray-800">后台管理</span>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="hidden md:ml-6 md:flex md:space-x-4">
|
|
|
{% if session.get('role') == 'admin' %}
|
|
|
<a href="{{ url_for('chatgpt') }}"
|
|
|
class="{% if request.endpoint == 'chatgpt' %}bg-gray-900 text-white{% else %}text-gray-900 hover:bg-gray-700 hover:text-white{% endif %} px-3 py-2 rounded-md text-sm font-medium flex items-center">
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-1" viewBox="0 0 20 20"
|
|
|
fill="currentColor">
|
|
|
<path
|
|
|
d="M10.394 2.08a1 1 0 00-.788 0l-7 3a1 1 0 000 1.84L5.25 8.051a.999.999 0 01.356-.257l4-1.714a1 1 0 11.788 1.838L7.667 9.088l1.94.831a1 1 0 00.787 0l7-3a1 1 0 000-1.838l-7-3zM3.31 9.397L5 10.12v4.102a8.969 8.969 0 00-1.05-.174 1 1 0 01-.89-.89 11.115 11.115 0 01.25-3.762zM9.3 16.573A9.026 9.026 0 007 14.935v-3.957l1.818.78a3 3 0 002.364 0l5.508-2.361a11.026 11.026 0 01.25 3.762 1 1 0 01-.89.89 8.968 8.968 0 00-5.35 2.524 1 1 0 01-1.4 0zM6 18a1 1 0 001-1v-2.065a8.935 8.935 0 00-2-.712V17a1 1 0 001 1z" />
|
|
|
</svg>
|
|
|
ChatGPT
|
|
|
</a>
|
|
|
<a href="{{ url_for('claude') }}"
|
|
|
class="{% if request.endpoint == 'claude' %}bg-gray-900 text-white{% else %}text-gray-900 hover:bg-gray-700 hover:text-white{% endif %} px-3 py-2 rounded-md text-sm font-medium flex items-center">
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-1" viewBox="0 0 20 20"
|
|
|
fill="currentColor">
|
|
|
<path
|
|
|
d="M10.394 2.08a1 1 0 00-.788 0l-7 3a1 1 0 000 1.84L5.25 8.051a.999.999 0 01.356-.257l4-1.714a1 1 0 11.788 1.838L7.667 9.088l1.94.831a1 1 0 00.787 0l7-3a1 1 0 000-1.838l-7-3zM3.31 9.397L5 10.12v4.102a8.969 8.969 0 00-1.05-.174 1 1 0 01-.89-.89 11.115 11.115 0 01.25-3.762zM9.3 16.573A9.026 9.026 0 007 14.935v-3.957l1.818.78a3 3 0 002.364 0l5.508-2.361a11.026 11.026 0 01.25 3.762 1 1 0 01-.89.89 8.968 8.968 0 00-5.35 2.524 1 1 0 01-1.4 0zM6 18a1 1 0 001-1v-2.065a8.935 8.935 0 00-2-.712V17a1 1 0 001 1z" />
|
|
|
</svg>
|
|
|
Claude
|
|
|
</a>
|
|
|
<a href="{{ url_for('user_management') }}"
|
|
|
class="{% if request.endpoint == 'user_management' %}bg-gray-900 text-white{% else %}text-gray-900 hover:bg-gray-700 hover:text-white{% endif %} px-3 py-2 rounded-md text-sm font-medium flex items-center">
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-1" viewBox="0 0 20 20"
|
|
|
fill="currentColor">
|
|
|
<path
|
|
|
d="M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z" />
|
|
|
</svg>
|
|
|
用户管理
|
|
|
</a>
|
|
|
|
|
|
{% endif %}
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="flex items-center">
|
|
|
{% if session.get('logged_in') %}
|
|
|
<div class="flex items-center">
|
|
|
<span class="text-gray-700 mr-4">
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 inline-block mr-1"
|
|
|
viewBox="0 0 20 20" fill="currentColor">
|
|
|
<path fill-rule="evenodd"
|
|
|
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 0 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 0010 16a5.986 5.986 0 004.546-2.084A5 5 0 0010 11z"
|
|
|
clip-rule="evenodd" />
|
|
|
</svg>
|
|
|
{{ session.get('username') }}
|
|
|
{% if session.get('role') == 'admin' %}
|
|
|
<span
|
|
|
class="bg-blue-100 text-blue-800 text-xs font-medium mr-2 px-2 py-0.5 rounded">管理员</span>
|
|
|
{% endif %}
|
|
|
</span>
|
|
|
<a href="{{ url_for('logout') }}"
|
|
|
class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded flex items-center">
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-1" viewBox="0 0 20 20"
|
|
|
fill="currentColor">
|
|
|
<path fill-rule="evenodd"
|
|
|
d="M3 3a1 1 0 011 1v12a1 1 0 11-2 0V4a1 1 0 011-1zm7.707 3.293a1 1 0 010 1.414L9.414 9H17a1 1 0 110 2H9.414l1.293 1.293a1 1 0 01-1.414 1.414l-3-3a1 1 0 010-1.414l3-3a1 1 0 011.414 0z"
|
|
|
clip-rule="evenodd" />
|
|
|
</svg>
|
|
|
退出
|
|
|
</a>
|
|
|
</div>
|
|
|
{% endif %}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="md:hidden">
|
|
|
<button type="button"
|
|
|
class="mobile-menu-button inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500"
|
|
|
aria-expanded="false">
|
|
|
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
|
|
stroke="currentColor">
|
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
|
|
</svg>
|
|
|
</button>
|
|
|
</div>
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
<div class="mobile-menu hidden md:hidden">
|
|
|
<div class="px-2 pt-2 pb-3 space-y-1">
|
|
|
{% if session.get('role') == 'admin' %}
|
|
|
<a href="{{ url_for('chatgpt') }}"
|
|
|
class="{% if request.endpoint == 'chatgpt' %}bg-gray-900 text-white{% else %}text-gray-900 hover:bg-gray-700 hover:text-white{% endif %} block px-3 py-2 rounded-md text-base font-medium">
|
|
|
ChatGPT
|
|
|
</a>
|
|
|
<a href="{{ url_for('claude') }}"
|
|
|
class="{% if request.endpoint == 'claude' %}bg-gray-900 text-white{% else %}text-gray-900 hover:bg-gray-700 hover:text-white{% endif %} block px-3 py-2 rounded-md text-base font-medium">
|
|
|
Claude
|
|
|
</a>
|
|
|
<a href="{{ url_for('user_management') }}"
|
|
|
class="{% if request.endpoint == 'user_management' %}bg-gray-900 text-white{% else %}text-gray-900 hover:bg-gray-700 hover:text-white{% endif %} block px-3 py-2 rounded-md text-base font-medium">
|
|
|
用户管理
|
|
|
</a>
|
|
|
{% endif %}
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<main class="flex-grow container mx-auto px-4 py-8">
|
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
|
{% if messages %}
|
|
|
{% for category, message in messages %}
|
|
|
<div class="mb-4 p-4 rounded
|
|
|
{% if category == 'success' %}bg-green-100 text-green-700
|
|
|
{% elif category == 'danger' %}bg-red-100 text-red-700
|
|
|
{% else %}bg-blue-100 text-blue-700{% endif %}">
|
|
|
{{ message }}
|
|
|
</div>
|
|
|
{% endfor %}
|
|
|
{% endif %}
|
|
|
{% endwith %}
|
|
|
|
|
|
{% block content %}{% endblock %}
|
|
|
</main>
|
|
|
|
|
|
{% block extra_js %}{% endblock %}
|
|
|
|
|
|
<script>
|
|
|
|
|
|
document.querySelector('.mobile-menu-button').addEventListener('click', function () {
|
|
|
document.querySelector('.mobile-menu').classList.toggle('hidden');
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|
|
|
|
|
|
</html> |