修改登录和基础功能样式,目前已经支持钉钉登录和自定义登录注册
This commit is contained in:
@@ -23,20 +23,48 @@
|
||||
<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">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% 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 message in messages %}
|
||||
<div class="flash">{{ message }}</div>
|
||||
{% for category, message in messages %}
|
||||
showToast('{{ message }}', '{{ category }}');
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% block content %}{% endblock %}
|
||||
</script>
|
||||
</main>
|
||||
<footer>
|
||||
<div class="container">
|
||||
|
||||
Reference in New Issue
Block a user