feat: 管理员页面整合与侧边栏导航优化
- 完成系统管理页面与导航整合 - 在 users.html/topics.html/logs.html 侧边栏与移动导航添加系统管理入口 - 创建 admin.html 管理页面(案例/任务日志/LLM配置/系统配置) - 新增核心模块:collector.py(数据采集器)、scheduler.py(任务调度器) - 新增脚本:collector_db_integration.py(采集器数据库整合) - 更新项目文档并验证路由注册
This commit is contained in:
@@ -255,6 +255,7 @@ const app = createApp({
|
||||
|
||||
const activeTab = ref('cases');
|
||||
const currentUser = ref({ username: '' });
|
||||
const redirectToPage = (page) => { window.location.href = '/' + page; }; const currentUser = ref({ username: '' });
|
||||
const isAdmin = ref(false);
|
||||
const isLoggedIn = ref(false);
|
||||
|
||||
@@ -262,8 +263,9 @@ const app = createApp({
|
||||
fetch('/api/auth/me', { headers: { 'Authorization': 'Bearer ' + token } })
|
||||
.then(response => response.ok ? response.json() : Promise.reject())
|
||||
.then(data => {
|
||||
currentUser.value = data.user;
|
||||
isAdmin.value = data.user.role === 'admin';
|
||||
const user = data.user || { username: '', role: 'user' };
|
||||
currentUser.value = user;
|
||||
isAdmin.value = user.role === 'admin';
|
||||
isLoggedIn.value = true;
|
||||
if (!isAdmin.value) {
|
||||
ElMessage.warning('需要管理员权限');
|
||||
@@ -275,6 +277,11 @@ const app = createApp({
|
||||
window.location.href = 'login.html';
|
||||
});
|
||||
|
||||
// 页面跳转
|
||||
const redirectToPage = (page) => {
|
||||
window.location.href = '/' + page;
|
||||
};
|
||||
|
||||
// Cases
|
||||
const cases = ref([]);
|
||||
const caseDialogVisible = ref(false);
|
||||
|
||||
Reference in New Issue
Block a user