Files
mashangban/templates/base.html

76 lines
2.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<header>
<div class="container">
<h1>
<img src="{{ url_for('static', filename='logo.png') }}" alt="logo" class="header-logo">
<a href="{{ url_for('index') }}">人事共享服务中心"码"上办</a>
</h1>
<nav>
<ul>
<li><a href="{{ url_for('index') }}">需求汇总</a></li>
{% if current_user.is_authenticated %}
<li><a href="{{ url_for('new_demand') }}">提交新需求</a></li>
<li><a href="{{ url_for('my_demands') }}">我的需求</a></li>
{% if current_user.is_admin() %}
<li><a href="{{ url_for('admin_demands') }}">管理后台</a></li>
{% endif %}
<li class="user-name">{{ current_user.dingtalk_name or current_user.username }}</li>
<li><a href="{{ url_for('logout') }}">退出</a></li>
{% else %}
<li><a href="{{ url_for('login') }}">登录</a></li>
{% endif %}
</ul>
</nav>
</div>
</header>
<main class="container">
{% block content %}{% endblock %}
<div id="toast-container" class="toast-container"></div>
<script>
const toastIcons = {
success: '✓',
warning: '⚠',
error: '✕',
info: ''
};
function showToast(message, type = 'info') {
const container = document.getElementById('toast-container');
const toast = document.createElement('div');
toast.className = `toast toast-${type}`;
toast.innerHTML = `<span class="toast-icon">${toastIcons[type]}</span>${message}`;
container.appendChild(toast);
setTimeout(() => toast.classList.add('show'), 10);
setTimeout(() => {
toast.classList.remove('show');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
// 显示 Flask flash messages
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
showToast('{{ message }}', '{{ category }}');
{% endfor %}
{% endif %}
{% endwith %}
</script>
</main>
<footer>
<div class="container">
<p>© 2026 人事共享服务中心"码"上办</p>
</div>
</footer>
</body>
</html>