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.
buffer_platform/app/static/role_select.html

216 lines
6.2 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>选择入口 - 期货智析系统</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
text-align: center;
max-width: 800px;
width: 100%;
}
.header {
color: white;
margin-bottom: 50px;
}
.header h1 {
font-size: 36px;
font-weight: 700;
margin-bottom: 10px;
}
.header p {
font-size: 16px;
opacity: 0.9;
}
.user-info {
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 12px 24px;
display: inline-block;
margin-top: 15px;
color: white;
font-size: 14px;
}
.cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
margin-bottom: 40px;
}
.card {
background: white;
border-radius: 20px;
padding: 40px 30px;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
text-decoration: none;
color: inherit;
display: block;
}
.card:hover {
transform: translateY(-10px);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.card-icon {
font-size: 64px;
margin-bottom: 20px;
}
.card-title {
font-size: 24px;
font-weight: 700;
color: #1D1D1F;
margin-bottom: 12px;
}
.card-description {
font-size: 14px;
color: #86868B;
line-height: 1.6;
}
.card-badge {
display: inline-block;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 6px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-top: 15px;
}
.logout-btn {
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
border: 2px solid rgba(255, 255, 255, 0.3);
color: white;
padding: 12px 32px;
border-radius: 12px;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.logout-btn:hover {
background: rgba(255, 255, 255, 0.3);
transform: translateY(-2px);
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>◈ 欢迎使用期货智析系统</h1>
<p>请选择您要进入的模块</p>
<div class="user-info">
👤 <span id="username">管理员</span> · 管理员权限
</div>
</div>
<div class="cards">
<a href="/futures-analysis" class="card">
<div class="card-icon">📊</div>
<div class="card-title">品种分析</div>
<div class="card-description">
智能期货品种分析工具提供K线图表、技术指标、AI智能分析等功能帮助您做出更明智的交易决策。
</div>
<div class="card-badge">进入分析 →</div>
</a>
<a href="/ui" class="card">
<div class="card-icon">⚙️</div>
<div class="card-title">系统管理</div>
<div class="card-description">
管理系统配置、品种设置、定时任务、数据源配置等后台管理功能。
</div>
<div class="card-badge">进入管理 →</div>
</a>
</div>
<button class="logout-btn" onclick="logout()">退出登录</button>
</div>
<script>
// 验证登录状态
window.addEventListener('DOMContentLoaded', async () => {
const token = localStorage.getItem('auth_token');
if (!token) {
window.location.href = '/login';
return;
}
try {
const response = await fetch('/api/v1/auth/verify', {
headers: {
'Authorization': `Bearer ${token}`
}
});
if (!response.ok) {
window.location.href = '/login';
return;
}
const data = await response.json();
document.getElementById('username').textContent = data.user.username;
if (data.user.role !== 'admin') {
window.location.href = '/futures-analysis';
}
} catch (error) {
window.location.href = '/login';
}
});
async function logout() {
const token = localStorage.getItem('auth_token');
if (token) {
try {
await fetch('/api/v1/auth/logout', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`
}
});
} catch (error) {
console.error('登出失败:', error);
}
}
localStorage.removeItem('auth_token');
localStorage.removeItem('user_info');
window.location.href = '/login';
}
</script>
</body>
</html>