277b13eaae
优化内容: 1. 表格布局: - 使用 calc(100vw - 160px) 确保表格不超出视口 - 操作列 fixed='right' 固定在右侧,宽度 300px - 按钮 3 个后自动换行 (max-width: 200px) - 恢复合理列宽,不再过度压缩 2. 批量操作区域: - 容器改为 inline-block,宽度自适应按钮内容 - 背景宽度与按钮总宽度匹配 3. 分类标签: - 显示数量 (如 '待处理 (20)') - 点击切换筛选,去掉误导的 'X' 图标 4. 删除功能: - 操作列增加删除按钮 - 删除前弹出确认对话框 5. 系统日志: - 修复后端日志路径 (parents[4]) - 404 时显示友好提示 6. 其他: - 左侧菜单宽度 160px - 所有功能保留 (登录、用户管理、批量操作等)
181 lines
4.7 KiB
HTML
181 lines
4.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>宇之然内容创作平台 - 登录</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script src="/static/vue.global.prod.js?v=20260421-0830"></script>
|
|
<link rel="stylesheet" href="/static/element-plus.css?v=20260421-0830" />
|
|
<script src="/static/element-plus.full.js?v=20260421-0830"></script>
|
|
<style>
|
|
.login-container {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
}
|
|
.login-card {
|
|
width: 100%;
|
|
max-width: 400px;
|
|
padding: 32px;
|
|
background: white;
|
|
border-radius: 16px;
|
|
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
}
|
|
.login-title {
|
|
text-align: center;
|
|
font-size: 28px;
|
|
font-weight: bold;
|
|
color: #1f2937;
|
|
margin-bottom: 32px;
|
|
}
|
|
.login-input {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
font-size: 16px;
|
|
margin-bottom: 16px;
|
|
outline: none;
|
|
transition: border-color 0.2s;
|
|
}
|
|
.login-input:focus {
|
|
border-color: #3b82f6;
|
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
}
|
|
.login-button {
|
|
width: 100%;
|
|
padding: 12px;
|
|
background: #3b82f6;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
.login-button:hover {
|
|
background: #2563eb;
|
|
}
|
|
.login-button:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
.login-footer {
|
|
text-align: center;
|
|
margin-top: 24px;
|
|
color: #6b7280;
|
|
font-size: 14px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-container">
|
|
<div class="login-card">
|
|
<h1 class="login-title">宇之然内容创作平台</h1>
|
|
|
|
<form @submit.prevent="handleLogin">
|
|
<input
|
|
v-model="username"
|
|
class="login-input"
|
|
type="text"
|
|
placeholder="请输入用户名"
|
|
required
|
|
autocomplete="username"
|
|
/>
|
|
<input
|
|
v-model="password"
|
|
class="login-input"
|
|
type="password"
|
|
placeholder="请输入密码"
|
|
required
|
|
autocomplete="current-password"
|
|
/>
|
|
<button
|
|
class="login-button"
|
|
type="submit"
|
|
:disabled="loading"
|
|
:class="{'opacity-60 cursor-not-allowed': loading}"
|
|
>
|
|
{{ loading ? '登录中...' : '登录' }}
|
|
</button>
|
|
</form>
|
|
|
|
<p class="login-footer">
|
|
只有管理员用户可登录访问系统
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const { ref } = Vue;
|
|
const { ElMessage } = ElementPlus;
|
|
|
|
const app = Vue.createApp({
|
|
name: 'LoginPage',
|
|
setup() {
|
|
const username = ref('');
|
|
const password = ref('');
|
|
const loading = ref(false);
|
|
|
|
const handleLogin = async () => {
|
|
if (!username.value.trim() || !password.value) {
|
|
ElMessage.warning('请输入用户名和密码');
|
|
return;
|
|
}
|
|
|
|
loading.value = true;
|
|
|
|
try {
|
|
const response = await fetch('/api/auth/login', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
username: username.value.trim(),
|
|
password: password.value
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (response.ok && data.token) {
|
|
// 保存认证信息
|
|
localStorage.setItem('auth_token', data.token);
|
|
localStorage.setItem('user_role', data.role || 'admin');
|
|
|
|
ElMessage.success('登录成功!正在跳转...');
|
|
|
|
// 延迟跳转,让用户看到成功消息
|
|
setTimeout(() => {
|
|
window.location.href = '/';
|
|
}, 1000);
|
|
} else {
|
|
ElMessage.error(data.message || data.error || '登录失败,请检查用户名和密码');
|
|
}
|
|
} catch (error) {
|
|
console.error('登录请求失败:', error);
|
|
ElMessage.error('网络连接失败,请检查服务是否正常运行');
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
|
|
return {
|
|
username,
|
|
password,
|
|
loading,
|
|
handleLogin
|
|
};
|
|
}
|
|
});
|
|
|
|
app.use(ElementPlus);
|
|
app.mount('#app');
|
|
</script>
|
|
</body>
|
|
</html> |