修改了初始化系统菜单

main
mula.liu 2025-12-24 11:16:39 +08:00
parent fa59dcc05d
commit 535350fd6f
4 changed files with 24 additions and 29 deletions

View File

@ -41,6 +41,6 @@ STORAGE_PATH=./storage
# ==================== 管理员账号配置 ====================
# 初始管理员账号信息
ADMIN_USERNAME=admin
ADMIN_PASSWORD=Admin@123456
ADMIN_EMAIL=admin@example.com
ADMIN_PASSWORD=admin@123
ADMIN_EMAIL=admin@unisspace.com
ADMIN_NICKNAME=系统管理员

View File

@ -1,5 +0,0 @@
-- 为projects表添加access_pass字段访问密码
-- 执行时间2025-12-20
ALTER TABLE projects
ADD COLUMN access_pass VARCHAR(100) NULL COMMENT '访问密码(用于分享链接)' AFTER visit_count;

View File

@ -174,22 +174,22 @@ INSERT INTO `roles` (`role_name`, `role_code`, `description`, `is_system`) VALUE
-- 插入初始菜单数据
INSERT INTO `system_menus` (`id`, `parent_id`, `menu_name`, `menu_code`, `menu_type`, `path`, `icon`, `sort_order`, `permission`) VALUES
(1, 0, '项目管理', 'project', 1, '/projects', 'FolderOutlined', 1, NULL),
(2, 1, '我的项目', 'my_projects', 2, '/projects/my', NULL, 1, 'project:view'),
(3, 1, '创建项目', 'create_project', 3, NULL, NULL, 2, 'project:create'),
(4, 1, '编辑项目', 'edit_project', 3, NULL, NULL, 3, 'project:edit'),
(5, 1, '删除项目', 'delete_project', 3, NULL, NULL, 4, 'project:delete'),
(10, 0, '文档管理', 'document', 1, '/documents', 'FileTextOutlined', 2, NULL),
(11, 10, '查看文档', 'view_document', 3, NULL, NULL, 1, 'document:view'),
(12, 10, '编辑文档', 'edit_document', 3, NULL, NULL, 2, 'document:edit'),
(13, 10, '删除文档', 'delete_document', 3, NULL, NULL, 3, 'document:delete'),
(1, 0, '项目管理', 'project', 1, NULL, 'FolderOutlined', 1, NULL),
(2, 1, '我的项目', 'projects:my', 2, '/projects', NULL, 1, 'project:view'),
(3, 1, '创建项目', 'project', 3, NULL, NULL, 2, 'project:create'),
(4, 1, '编辑项目', 'project:edit', 3, NULL, NULL, 3, 'project:edit'),
(5, 1, '删除项目', 'project:delete', 3, NULL, NULL, 4, 'project:delete'),
(10, 0, '知识库管理', 'knowledge', 1, NULL, 'FileTextOutlined', 2, NULL),
(11, 10, '我的知识库', 'knowledge:view', 3, '/knowledges', NULL, 1, 'knowledge:view'),
(12, 10, '编辑知识库', 'knowledge:edit', 3, NULL, NULL, 2, 'knowledge:edit'),
(13, 10, '删除知识库', 'knowledge:delete', 3, NULL, NULL, 3, 'knowledge:delete'),
(20, 0, '系统管理', 'system', 1, '/system', 'SettingOutlined', 3, NULL),
(21, 20, '用户管理', 'user_manage', 2, '/system/users', NULL, 1, 'system:user:view'),
(22, 20, '角色管理', 'role_manage', 2, '/system/roles', NULL, 2, 'system:role:view');
-- 创建默认管理员用户(密码: admin@123
INSERT INTO `users` (`username`, `password_hash`, `nickname`, `is_superuser`, `status`) VALUES
('admin', '$2b$12$TkyjVycb8PHk/835Py4Kz.r.us7YqPAbF.89NQ7TrU5/r/lTqVAUu', '系统管理员', 1, 1);
('admin', '$2b$12$gQlTcKxyQKRYQtTT0Db.mexAsAYTJre9G8OSlzl3H3gMNTfXijiZy', '系统管理员', 1, 1);
-- 将管理员用户分配超级管理员角色
INSERT INTO `user_roles` (`user_id`, `role_id`) VALUES (1, 1);

View File

@ -107,11 +107,11 @@ async def init_menus():
id=8,
parent_id=0,
menu_name="个人桌面",
menu_code="dashboard",
menu_code="desktop",
menu_type=1,
path="/dashboard",
component="Dashboard",
icon="DashboardOutlined",
path="/desktop",
component="Desktop",
icon="DesktopOutlined",
sort_order=1,
visible=1,
status=1
@ -120,11 +120,11 @@ async def init_menus():
id=9,
parent_id=0,
menu_name="管理面板",
menu_code="admin_panel",
menu_code="dashboard",
menu_type=1,
path="/admin",
component="AdminPanel",
icon="ControlOutlined",
path="/dashboard",
component="Dashboard",
icon="DashboardOutlined",
sort_order=2,
visible=1,
status=1
@ -161,7 +161,7 @@ async def init_menus():
menu_name="我的项目",
menu_code="projects:my",
menu_type=1,
path="/projects/my",
path="/projects",
component="MyProjects",
icon="FolderOutlined",
sort_order=1,
@ -211,7 +211,7 @@ async def init_menus():
menu_name="我的知识库",
menu_code="knowledge:my",
menu_type=1,
path="/knowledge/my",
path="/knowledge",
component="MyKnowledge",
icon="ReadOutlined",
sort_order=1,
@ -298,8 +298,8 @@ async def init_admin_user():
# 从环境变量获取管理员信息
admin_username = os.getenv("ADMIN_USERNAME", "admin")
admin_password = os.getenv("ADMIN_PASSWORD", "Admin@123456")
admin_email = os.getenv("ADMIN_EMAIL", "admin@example.com")
admin_password = os.getenv("ADMIN_PASSWORD", "admin@123")
admin_email = os.getenv("ADMIN_EMAIL", "admin@unisspace.com")
admin_nickname = os.getenv("ADMIN_NICKNAME", "系统管理员")
async with async_session() as session: