路由更新

This commit is contained in:
2025-10-16 18:03:46 +08:00
parent 1199cbc176
commit 0811af6d03
94 changed files with 9511 additions and 667 deletions

View File

@@ -1,126 +0,0 @@
@echo off
chcp 65001 >nul
echo =====================================================
echo 校园思政新闻平台数据库初始化脚本
echo =====================================================
echo.
REM 设置MySQL连接信息请根据实际情况修改
set MYSQL_HOST=localhost
set MYSQL_PORT=3306
set MYSQL_USER=root
set MYSQL_PASSWORD=
echo 请输入MySQL连接信息:
echo.
set /p MYSQL_HOST=MySQL主机地址 [默认: localhost]:
if "%MYSQL_HOST%"=="" set MYSQL_HOST=localhost
set /p MYSQL_PORT=MySQL端口 [默认: 3306]:
if "%MYSQL_PORT%"=="" set MYSQL_PORT=3306
set /p MYSQL_USER=MySQL用户名 [默认: root]:
if "%MYSQL_USER%"=="" set MYSQL_USER=root
set /p MYSQL_PASSWORD=MySQL密码:
echo.
echo 连接信息:
echo 主机: %MYSQL_HOST%
echo 端口: %MYSQL_PORT%
echo 用户: %MYSQL_USER%
echo.
echo 开始执行数据库初始化...
echo.
REM 切换到sql目录
cd sql
REM 执行SQL文件
echo [1/9] 创建数据库...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createDB.sql
if errorlevel 1 (
echo 错误: 创建数据库失败!
pause
exit /b 1
)
echo [2/9] 创建用户相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableUser.sql
if errorlevel 1 (
echo 错误: 创建用户表失败!
pause
exit /b 1
)
echo [3/9] 创建权限相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTablePermission.sql
if errorlevel 1 (
echo 错误: 创建权限表失败!
pause
exit /b 1
)
echo [4/9] 创建资源管理相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableResource.sql
if errorlevel 1 (
echo 错误: 创建资源表失败!
pause
exit /b 1
)
echo [5/9] 创建课程管理相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableCourse.sql
if errorlevel 1 (
echo 错误: 创建课程表失败!
pause
exit /b 1
)
echo [6/9] 创建学习管理相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableLearning.sql
if errorlevel 1 (
echo 错误: 创建学习表失败!
pause
exit /b 1
)
echo [7/9] 创建个人中心相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableUserCenter.sql
if errorlevel 1 (
echo 错误: 创建个人中心表失败!
pause
exit /b 1
)
echo [8/9] 创建智能体相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableAI.sql
if errorlevel 1 (
echo 错误: 创建智能体表失败!
pause
exit /b 1
)
echo [9/9] 创建系统配置和日志相关表...
mysql -h %MYSQL_HOST% -P %MYSQL_PORT% -u %MYSQL_USER% -p%MYSQL_PASSWORD% < createTableSystem.sql
if errorlevel 1 (
echo 错误: 创建系统表失败!
pause
exit /b 1
)
cd ..
echo.
echo =====================================================
echo 数据库初始化完成!
echo =====================================================
echo 数据库名: school_news
echo 默认用户: admin
echo 默认密码: 详见 createTableUser.sql
echo =====================================================
echo.
pause

View File

@@ -9,7 +9,7 @@ echo ""
MYSQL_HOST="localhost"
MYSQL_PORT="3306"
MYSQL_USER="root"
MYSQL_PASSWORD=""
MYSQL_PASSWORD="123456"
# 读取用户输入
read -p "MySQL主机地址 [默认: localhost]: " input_host
@@ -21,17 +21,8 @@ MYSQL_PORT=${input_port:-$MYSQL_PORT}
read -p "MySQL用户名 [默认: root]: " input_user
MYSQL_USER=${input_user:-$MYSQL_USER}
read -sp "MySQL密码: " MYSQL_PASSWORD
echo ""
echo ""
echo "连接信息:"
echo "主机: $MYSQL_HOST"
echo "端口: $MYSQL_PORT"
echo "用户: $MYSQL_USER"
echo ""
echo "开始执行数据库初始化..."
read -sp "MySQL密码[默认: 123456]: " input_password
MYSQL_PASSWORD=${input_password:-$MYSQL_PASSWORD}
echo ""
# 切换到sql目录

View File

@@ -1,2 +1,16 @@
-- MySQL Script to create the database
CREATE DATABASE IF NOT EXISTS `school_news` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
-- 修复字符编码问题
-- 删除现有数据库(如果存在)
DROP DATABASE IF EXISTS `school_news`;
-- 创建数据库使用utf8mb4字符集
CREATE DATABASE `school_news` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 使用数据库
USE `school_news`;
-- 设置会话字符集
SET NAMES utf8mb4;
SET CHARACTER SET utf8mb4;
SET character_set_client = utf8mb4;
SET character_set_connection = utf8mb4;
SET character_set_results = utf8mb4;

View File

@@ -21,9 +21,6 @@ CREATE TABLE `tb_ai_agent_config` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='智能体配置表';
-- 插入默认配置
INSERT INTO `tb_ai_agent_config` (id, name, system_prompt, model_name, temperature, max_tokens, status, creator, create_time) VALUES
('1', '思政小帮手', '你是一个专业的思政学习助手,致力于帮助用户学习思想政治理论知识。请基于提供的知识库内容,为用户提供准确、简洁的回答。', 'gpt-3.5-turbo', 0.7, 2000, 1, '1', now());
-- 知识库表
DROP TABLE IF EXISTS `tb_ai_knowledge`;

View File

@@ -18,8 +18,6 @@ CREATE TABLE `tb_sys_dept` (
KEY `idx_dept_parent` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_dept` (id,dept_id,name, description) VALUES ('1','root_department', '超级部门', '系统超级部门');
INSERT INTO `tb_sys_dept` (id,dept_id,name, parent_id, description) VALUES ('2','default_department', '默认部门', 'root_department', '系统默认创建的部门');
-- 角色表
DROP TABLE IF EXISTS `tb_sys_role`;
@@ -38,8 +36,6 @@ CREATE TABLE `tb_sys_role` (
UNIQUE KEY `uk_role_id` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_role` (id,role_id, name, description) VALUES ('1','admin', '管理员', '系统管理员角色');
INSERT INTO `tb_sys_role` (id,role_id, name, description) VALUES ('2','freedom', '自由角色', '自由角色');
-- 部门-角色关联
DROP TABLE IF EXISTS `tb_sys_dept_role`;
@@ -57,9 +53,6 @@ CREATE TABLE `tb_sys_dept_role` (
UNIQUE KEY `uk_dept_role` (`dept_id`, `role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_dept_role` (id, dept_id, role_id, creator, create_time) VALUES
('1', 'root_department', 'admin', '1', now()),
('2', 'default_department', 'freedom', '1', now());
-- 用户-角色关联
DROP TABLE IF EXISTS `tb_sys_user_dept_role`;
@@ -78,7 +71,28 @@ CREATE TABLE `tb_sys_user_dept_role` (
UNIQUE KEY `uk_user_dept_role` (`user_id`, `dept_id`, `role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_user_dept_role` (id, user_id, dept_id, role_id, creator, create_time) VALUES ('1', '1', 'root_department', 'admin', '1', now());
-- 模块表
DROP TABLE IF EXISTS `tb_sys_module`;
CREATE TABLE `tb_sys_module` (
`id` VARCHAR(50) NOT NULL COMMENT 'id',
`module_id` VARCHAR(50) NOT NULL COMMENT '模块ID',
`name` VARCHAR(100) NOT NULL COMMENT '模块名称',
`code` VARCHAR(100) NOT NULL COMMENT '模块代码',
`description` VARCHAR(255) DEFAULT NULL COMMENT '模块描述',
`icon` VARCHAR(100) DEFAULT NULL COMMENT '模块图标',
`order_num` INT(4) DEFAULT 0 COMMENT '模块排序号',
`status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '模块状态0禁用 1启用',
`creator` VARCHAR(50) DEFAULT NULL COMMENT '创建者',
`updater` VARCHAR(50) DEFAULT NULL COMMENT '更新者',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_module_id` (`module_id`),
UNIQUE KEY `uk_module_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- 权限表
DROP TABLE IF EXISTS `tb_sys_permission`;
@@ -88,6 +102,7 @@ CREATE TABLE `tb_sys_permission` (
`name` VARCHAR(100) NOT NULL COMMENT '权限名称',
`code` VARCHAR(100) NOT NULL COMMENT '权限代码',
`description` VARCHAR(255) DEFAULT NULL COMMENT '权限描述',
`module_id` VARCHAR(50) DEFAULT NULL COMMENT '所属模块ID',
`creator` VARCHAR(50) DEFAULT NULL COMMENT '创建者',
`updater` VARCHAR(50) DEFAULT NULL COMMENT '更新者',
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -95,21 +110,10 @@ CREATE TABLE `tb_sys_permission` (
`delete_time` TIMESTAMP NULL DEFAULT NULL COMMENT '删除时间',
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_permission_id` (`permission_id`)
UNIQUE KEY `uk_permission_id` (`permission_id`),
KEY `idx_permission_module` (`module_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_permission` (id,permission_id, name, code, description, creator, create_time) VALUES
('0','perm_default', '默认权限', 'default', '默认权限', '1', now()),
('1','perm_system_manage', '系统管理', 'system:manage', '系统管理权限', '1', now()),
('2','perm_system_dept_manage', '系统部门查看', 'system:dept:manage', '系统部门查看权限', '1', now()),
('3','perm_system_menu_manage', '系统菜单查看', 'system:menu:manage', '系统菜单查看权限', '1', now()),
('4','perm_system_permission_manage', '系统权限查看', 'system:permission:manage', '系统权限查看权限', '1', now()),
('5','perm_system_role_manage', '系统角色查看', 'system:role:manage', '系统角色查看权限', '1', now()),
('6','perm_system_user_manage', '系统用户查看', 'system:user:manage', '系统用户查看权限', '1', now()),
('7','perm_news_manage', '新闻管理', 'news:manage', '新闻管理权限', '1', now()),
('8','perm_study_manage', '学习管理', 'study:manage', '学习管理权限', '1', now()),
('9','perm_ai_manage', 'AI管理', 'ai:manage', 'AI管理权限', '1', now()),
('10','perm_usercenter_manage', '用户中心管理', 'usercenter:manage', '用户中心管理权限', '1', now());
-- 角色-权限关联
DROP TABLE IF EXISTS `tb_sys_role_permission`;
@@ -127,19 +131,6 @@ CREATE TABLE `tb_sys_role_permission` (
UNIQUE KEY `uk_role_permission` (`role_id`, `permission_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_role_permission` (id, role_id, permission_id, creator, create_time) VALUES
('0', 'admin', 'perm_default', '1', now()),
('1', 'admin', 'perm_system_manage', '1', now()),
('2', 'admin', 'perm_system_dept_manage', '1', now()),
('3', 'admin', 'perm_system_menu_manage', '1', now()),
('4', 'admin', 'perm_system_permission_manage', '1', now()),
('5', 'admin', 'perm_system_role_manage', '1', now()),
('6', 'admin', 'perm_system_user_manage', '1', now()),
('7', 'admin', 'perm_news_manage', '1', now()),
('8', 'admin', 'perm_study_manage', '1', now()),
('9', 'admin', 'perm_ai_manage', '1', now()),
('10', 'admin', 'perm_usercenter_manage', '1', now()),
('11', 'freedom', 'perm_default', '1', now());
-- 菜单表
DROP TABLE IF EXISTS `tb_sys_menu`;
@@ -165,31 +156,6 @@ CREATE TABLE `tb_sys_menu` (
KEY `idx_menu_parent` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- Insert default menus
INSERT INTO `tb_sys_menu` (id,menu_id, name, parent_id, url, component, icon, order_num, type, layout, creator, create_time) VALUES
('1','menu_system_manage', '系统管理', NULL, '', '', 'el-icon-setting', 1, 1, '', '1', now()),
('2','menu_system_dept', '部门管理', 'menu_system_manage', '/manage/system/dept', 'manage/system/DeptManageView', 'el-icon-office-building', 2, 1, 'NavigationLayout', '1', now()),
('3','menu_system_menu', '菜单管理', 'menu_system_manage', '/manage/system/menu', 'manage/system/MenuManageView', 'el-icon-menu', 2, 1, 'NavigationLayout', '1', now()),
('4','menu_system_permission', '权限管理', 'menu_system_manage', '/manage/system/permission', 'manage/system/PermissionManageView', 'el-icon-key', 3, 1, 'NavigationLayout', '1', now()),
('5','menu_system_role', '角色管理', 'menu_system_manage', '/manage/system/role', 'manage/system/RoleManageView', 'el-icon-user', 4, 1, 'NavigationLayout', '1', now()),
('6','menu_system_user', '用户管理', 'menu_system_manage', '/manage/system/user', 'manage/system/UserManageView', 'el-icon-user', 5, 1, 'NavigationLayout', '1', now());
-- ('7','menu_news_manage', '新闻管理', NULL, '', '', 'el-icon-document', 2, 1, '', '1', now()),
-- ('8','menu_news_resource', '资源管理', 'menu_news_manage', '/manage/news/resource', 'manage/news/ResourceManageView', 'el-icon-folder', 1, 1, 'NavigationLayout', '1', now()),
-- ('9','menu_news_category', '分类管理', 'menu_news_manage', '/manage/news/category', 'manage/news/CategoryManageView', 'el-icon-menu', 2, 1, 'NavigationLayout', '1', now()),
-- ('10','menu_news_tag', '标签管理', 'menu_news_manage', '/manage/news/tag', 'manage/news/TagManageView', 'el-icon-price-tag', 3, 1, 'NavigationLayout', '1', now()),
-- ('11','menu_news_banner', '横幅管理', 'menu_news_manage', '/manage/news/banner', 'manage/news/BannerManageView', 'el-icon-picture', 4, 1, 'NavigationLayout', '1', now()),
-- ('12','menu_study_manage', '学习管理', NULL, '', '', 'el-icon-reading', 3, 1, '', '1', now()),
-- ('13','menu_study_course', '课程管理', 'menu_study_manage', '/manage/study/course', 'manage/study/CourseManageView', 'el-icon-video-play', 1, 1, 'NavigationLayout', '1', now()),
-- ('14','menu_study_task', '任务管理', 'menu_study_manage', '/manage/study/task', 'manage/study/TaskManageView', 'el-icon-s-order', 2, 1, 'NavigationLayout', '1', now()),
-- ('15','menu_study_record', '学习记录', 'menu_study_manage', '/manage/study/record', 'manage/study/RecordManageView', 'el-icon-document', 3, 1, 'NavigationLayout', '1', now()),
-- ('16','menu_ai_manage', 'AI管理', NULL, '', '', 'el-icon-cpu', 4, 1, '', '1', now()),
-- ('17','menu_ai_agent', 'AI代理', 'menu_ai_manage', '/manage/ai/agent', 'manage/ai/AgentManageView', 'el-icon-robot', 1, 1, 'NavigationLayout', '1', now()),
-- ('18','menu_ai_conversation', '对话管理', 'menu_ai_manage', '/manage/ai/conversation', 'manage/ai/ConversationManageView', 'el-icon-chat-line-round', 2, 1, 'NavigationLayout', '1', now()),
-- ('19','menu_ai_knowledge', '知识库', 'menu_ai_manage', '/manage/ai/knowledge', 'manage/ai/KnowledgeManageView', 'el-icon-collection', 3, 1, 'NavigationLayout', '1', now()),
-- ('20','menu_usercenter_manage', '用户中心', NULL, '', '', 'el-icon-user', 5, 1, '', '1', now()),
-- ('21','menu_usercenter_points', '积分管理', 'menu_usercenter_manage', '/manage/usercenter/points', 'manage/usercenter/PointsManageView', 'el-icon-coin', 1, 1, 'NavigationLayout', '1', now()),
-- ('22','menu_usercenter_achievement', '成就管理', 'menu_usercenter_manage', '/manage/usercenter/achievement', 'manage/usercenter/AchievementManageView', 'el-icon-trophy', 2, 1, 'NavigationLayout', '1', now()),
-- ('23','menu_usercenter_collection', '收藏管理', 'menu_usercenter_manage', '/manage/usercenter/collection', 'manage/usercenter/CollectionManageView', 'el-icon-star-on', 3, 1, 'NavigationLayout', '1', now());
DROP TABLE IF EXISTS `tb_sys_menu_permission`;
CREATE TABLE `tb_sys_menu_permission` (
@@ -204,12 +170,4 @@ CREATE TABLE `tb_sys_menu_permission` (
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_menu_permission` (`menu_id`, `permission_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- Insert menu-permission associations
INSERT INTO `tb_sys_menu_permission` (id, permission_id, menu_id, creator, create_time) VALUES
('1', 'perm_system_manage', 'menu_system_manage', '1', now()),
('2', 'perm_system_dept_manage', 'menu_system_dept', '1', now()),
('3', 'perm_system_menu_manage', 'menu_system_menu', '1', now()),
('4', 'perm_system_permission_manage', 'menu_system_permission', '1', now()),
('5', 'perm_system_role_manage', 'menu_system_role', '1', now()),
('6', 'perm_system_user_manage', 'menu_system_user', '1', now());
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

View File

@@ -52,14 +52,6 @@ CREATE TABLE `tb_resource_category` (
KEY `idx_parent` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='资源分类表';
-- 插入默认分类(党史学习、领导讲话、政策解读、红色经典、专题报告、思政案例)
INSERT INTO `tb_resource_category` (id, category_id, name, description, order_num, creator, create_time) VALUES
('1', 'party_history', '党史学习', '党史学习相关资源', 1, '1', now()),
('2', 'leader_speech', '领导讲话', '领导讲话相关资源', 2, '1', now()),
('3', 'policy_interpretation', '政策解读', '政策解读相关资源', 3, '1', now()),
('4', 'red_classic', '红色经典', '红色经典相关资源', 4, '1', now()),
('5', 'special_report', '专题报告', '专题报告相关资源', 5, '1', now()),
('6', 'ideological_case', '思政案例', '思政案例相关资源', 6, '1', now());
-- Banner管理表
DROP TABLE IF EXISTS `tb_banner`;

View File

@@ -48,21 +48,6 @@ CREATE TABLE `tb_sys_config` (
KEY `idx_group` (`config_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统配置表';
-- 插入默认系统配置
INSERT INTO `tb_sys_config` (id, config_key, config_value, config_type, config_group, description, is_system, creator, create_time) VALUES
('1', 'system.platform.name', '思政学习平台', 'string', 'platform', '平台名称', 1, '1', now()),
('2', 'system.platform.logo', '/assets/logo.png', 'string', 'platform', '平台Logo', 1, '1', now()),
('3', 'system.platform.school_badge', '/assets/school_badge.png', 'string', 'platform', '学校校徽', 1, '1', now()),
('4', 'system.menu.home', '首页', 'string', 'menu', '首页菜单名称', 0, '1', now()),
('5', 'system.menu.resource', '资源中心', 'string', 'menu', '资源中心菜单名称', 0, '1', now()),
('6', 'system.menu.learning', '学习计划', 'string', 'menu', '学习计划菜单名称', 0, '1', now()),
('7', 'system.menu.activity', '专题活动', 'string', 'menu', '专题活动菜单名称', 0, '1', now()),
('8', 'system.menu.culture', '红色常信', 'string', 'menu', '红色常信菜单名称', 0, '1', now()),
('9', 'system.banner.auto_play', 'true', 'boolean', 'banner', 'Banner自动播放', 0, '1', now()),
('10', 'system.banner.interval', '5000', 'number', 'banner', 'Banner切换间隔毫秒', 0, '1', now()),
('11', 'system.resource.auto_publish', 'false', 'boolean', 'resource', '资源自动发布', 0, '1', now()),
('12', 'system.resource.auto_publish_time', '08:00', 'string', 'resource', '自动发布时间', 0, '1', now()),
('13', 'system.ai.enabled', 'true', 'boolean', 'ai', '是否启用智能体', 0, '1', now());
-- 系统访问统计表
DROP TABLE IF EXISTS `tb_sys_visit_statistics`;

View File

@@ -20,8 +20,6 @@ CREATE TABLE `tb_sys_user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- 推荐:把默认 admin 密码替换为已哈希的值
INSERT INTO `tb_sys_user` (id, username, password, email, status) VALUES
('1', 'admin', '$2a$10$/Bo2SXboVUpYfR6EA.y8puYQaMGBcuNYFY/EkQRY3w27IH56EuEcS', '3223905473@qq.com', 0);
-- 用户信息表
DROP TABLE IF EXISTS `tb_sys_user_info`;
@@ -43,7 +41,6 @@ CREATE TABLE `tb_sys_user_info` (
UNIQUE KEY `uk_user_info_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `tb_sys_user_info` (id, user_id, full_name, avatar) VALUES ('1', '1', '管理员', 'default');
DROP TABLE IF EXISTS `tb_sys_login_log`;
CREATE TABLE `tb_sys_login_log` (

View File

@@ -38,11 +38,33 @@ SOURCE createTableSystem.sql;
-- 11. 创建文件系统相关表
SOURCE createTableFile.sql;
-- =====================================================
-- 插入初始数据
-- =====================================================
-- 12. 插入菜单和权限相关数据
SOURCE initMenuData.sql;
SOURCE initAllData.sql;
-- -- 13. 插入资源相关初始数据
-- SOURCE initResourceData.sql;
-- -- 14. 插入AI相关初始数据
-- SOURCE initAIData.sql;
-- -- 15. 插入系统相关初始数据
-- SOURCE initSystemData.sql;
-- -- 16. 插入用户相关初始数据
-- SOURCE initUserData.sql;
-- =====================================================
-- 初始化完成
-- =====================================================
-- 数据库: school_news
-- 表数量: 50+ 张表
-- 默认用户: admin (密码需要查看 createTableUser.sql)
-- 默认用户: admin (密码: admin123)
-- 默认角色: admin (管理员), freedom (自由角色)
-- 默认部门: root_department (超级部门), default_department (默认部门)
-- =====================================================

View File

@@ -0,0 +1,39 @@
use school_news;
-- 插入AI智能体配置数据
INSERT INTO `tb_ai_agent_config` (id, name, system_prompt, model_name, temperature, max_tokens, status, creator, create_time) VALUES
('1', '思政小帮手', '你是一个专业的思政学习助手,致力于帮助用户学习思想政治理论知识。请基于提供的知识库内容,为用户提供准确、简洁的回答。', 'gpt-3.5-turbo', 0.7, 2000, 1, '1', now());
-- 插入资源分类数据
INSERT INTO `tb_resource_category` (id, category_id, name, description, order_num, creator, create_time) VALUES
('1', 'party_history', '党史学习', '党史学习相关资源', 1, '1', now()),
('2', 'leader_speech', '领导讲话', '领导讲话相关资源', 2, '1', now()),
('3', 'policy_interpretation', '政策解读', '政策解读相关资源', 3, '1', now()),
('4', 'red_classic', '红色经典', '红色经典相关资源', 4, '1', now()),
('5', 'special_report', '专题报告', '专题报告相关资源', 5, '1', now()),
('6', 'world_case', '思政案例', '思政案例相关资源', 6, '1', now());
-- 插入系统配置数据
INSERT INTO `tb_sys_config` (id, config_key, config_value, config_type, config_group, description, is_system, creator, create_time) VALUES
('1', 'system.platform.name', '思政学习平台', 'string', 'platform', '平台名称', 1, '1', now()),
('2', 'system.platform.logo', '/assets/logo.png', 'string', 'platform', '平台Logo', 1, '1', now()),
('3', 'system.platform.school_badge', '/assets/school_badge.png', 'string', 'platform', '学校校徽', 1, '1', now()),
('4', 'system.menu.home', '首页', 'string', 'menu', '首页菜单名称', 0, '1', now()),
('5', 'system.menu.resource', '资源中心', 'string', 'menu', '资源中心菜单名称', 0, '1', now()),
('6', 'system.menu.learning', '学习计划', 'string', 'menu', '学习计划菜单名称', 0, '1', now()),
('7', 'system.menu.activity', '专题活动', 'string', 'menu', '专题活动菜单名称', 0, '1', now()),
('8', 'system.menu.culture', '红色常信', 'string', 'menu', '红色常信菜单名称', 0, '1', now()),
('9', 'system.banner.auto_play', 'true', 'boolean', 'banner', 'Banner自动播放', 0, '1', now()),
('10', 'system.banner.interval', '5000', 'number', 'banner', 'Banner切换间隔毫秒', 0, '1', now()),
('11', 'system.resource.auto_publish', 'false', 'boolean', 'resource', '资源自动发布', 0, '1', now()),
('12', 'system.resource.auto_publish_time', '08:00', 'string', 'resource', '自动发布时间', 0, '1', now()),
('13', 'system.ai.enabled', 'true', 'boolean', 'ai', '是否启用智能体', 0, '1', now());
-- 插入默认用户数据
INSERT INTO `tb_sys_user` (id, username, password, email, status) VALUES
('1', 'superadmin', '$2a$10$/Bo2SXboVUpYfR6EA.y8puYQaMGBcuNYFY/EkQRY3w27IH56EuEcS', '3223905473@qq.com', 0);
-- 插入默认用户信息数据
INSERT INTO `tb_sys_user_info` (id, user_id, full_name, avatar) VALUES
('1', '1', '管理员', 'default');

View File

@@ -0,0 +1,192 @@
use school_news;
-- 插入部门数据
INSERT INTO `tb_sys_dept` (id,dept_id,name, description) VALUES ('1','root_department', '超级部门', '系统超级部门');
INSERT INTO `tb_sys_dept` (id,dept_id,name, parent_id, description) VALUES ('2','default_department', '默认部门', 'root_department', '系统默认创建的部门');
-- 插入角色数据
INSERT INTO `tb_sys_role` (id,role_id, name, description) VALUES ('1','superadmin', '管理员', '系统管理员角色');
INSERT INTO `tb_sys_role` (id,role_id, name, description) VALUES ('2','freedom', '自由角色', '自由角色');
-- 插入部门-角色关联数据
INSERT INTO `tb_sys_dept_role` (id, dept_id, role_id, creator, create_time) VALUES
('1', 'root_department', 'superadmin', '1', now()),
('2', 'default_department', 'freedom', '1', now());
-- 插入用户-角色关联数据
INSERT INTO `tb_sys_user_dept_role` (id, user_id, dept_id, role_id, creator, create_time) VALUES ('1', '1', 'root_department', 'superadmin', '1', now());
-- 插入模块数据
INSERT INTO `tb_sys_module` (id, module_id, name, code, description, icon, order_num, status, creator, create_time) VALUES
('1', 'module_system', '系统管理', 'system', '系统管理模块', 'el-icon-setting', 1, 1, '1', now()),
('2', 'module_news', '新闻管理', 'news', '新闻管理模块', 'el-icon-document', 2, 1, '1', now()),
('3', 'module_study', '学习管理', 'study', '学习管理模块', 'el-icon-reading', 3, 1, '1', now()),
('4', 'module_ai', 'AI管理', 'ai', 'AI管理模块', 'el-icon-cpu', 4, 1, '1', now()),
('5', 'module_usercenter', '用户中心', 'usercenter', '用户中心模块', 'el-icon-user', 5, 1, '1', now()),
('6', 'module_file', '文件管理', 'file', '文件管理模块', 'el-icon-folder', 6, 1, '1', now());
-- 插入权限数据
INSERT INTO `tb_sys_permission` (id,permission_id, name, code, description, module_id, creator, create_time) VALUES
('0','perm_default', '默认权限', 'default', '默认权限', 'module_system', '1', now()),
('1','perm_system_manage', '系统管理', 'system:manage', '系统管理权限', 'module_system', '1', now()),
('2','perm_system_dept_manage', '系统部门查看', 'system:dept:manage', '系统部门查看权限', 'module_system', '1', now()),
('3','perm_system_menu_manage', '系统菜单查看', 'system:menu:manage', '系统菜单查看权限', 'module_system', '1', now()),
('4','perm_system_permission_manage', '系统权限查看', 'system:permission:manage', '系统权限查看权限', 'module_system', '1', now()),
('5','perm_system_role_manage', '系统角色查看', 'system:role:manage', '系统角色查看权限', 'module_system', '1', now()),
('6','perm_system_user_manage', '系统用户查看', 'system:user:manage', '系统用户查看权限', 'module_system', '1', now()),
('7','perm_system_module_manage', '系统模块查看', 'system:module:manage', '系统模块查看权限', 'module_system', '1', now()),
('8','perm_news_manage', '新闻管理', 'news:manage', '新闻管理权限', 'module_news', '1', now()),
('9','perm_study_manage', '学习管理', 'study:manage', '学习管理权限', 'module_study', '1', now()),
('10','perm_ai_manage', 'AI管理', 'ai:manage', 'AI管理权限', 'module_ai', '1', now()),
('11','perm_usercenter_manage', '用户中心管理', 'usercenter:manage', '用户中心管理权限', 'module_usercenter', '1', now()),
('12','perm_file_manage', '文件管理', 'file:manage', '文件管理权限', 'module_file', '1', now());
-- 插入角色-权限关联数据
INSERT INTO `tb_sys_role_permission` (id, role_id, permission_id, creator, create_time) VALUES
('0', 'superadmin', 'perm_default', '1', now()),
('1', 'superadmin', 'perm_system_manage', '1', now()),
('2', 'superadmin', 'perm_system_dept_manage', '1', now()),
('3', 'superadmin', 'perm_system_menu_manage', '1', now()),
('4', 'superadmin', 'perm_system_permission_manage', '1', now()),
('5', 'superadmin', 'perm_system_role_manage', '1', now()),
('6', 'superadmin', 'perm_system_user_manage', '1', now()),
('7', 'superadmin', 'perm_system_module_manage', '1', now()),
('8', 'superadmin', 'perm_news_manage', '1', now()),
('9', 'superadmin', 'perm_study_manage', '1', now()),
('10', 'superadmin', 'perm_ai_manage', '1', now()),
('11', 'superadmin', 'perm_usercenter_manage', '1', now()),
('12', 'superadmin', 'perm_file_manage', '1', now()),
('13', 'freedom', 'perm_default', '1', now());
-- 插入前端菜单数据
INSERT INTO `tb_sys_menu` (id, menu_id, name, parent_id, url, component, icon, order_num, type, layout, creator, create_time) VALUES
-- 资源中心
('200', 'menu_resource_center', '资源中心', NULL, '/resource-center', 'resource-center/ResourceCenterView', 'el-icon-folder-opened', 2, 1, 'BasicLayout', '1', now()),
('201', 'menu_party_history', '党史学习', 'menu_resource_center', '/resource-center/party-history', 'resource-center/PartyHistoryView', 'el-icon-trophy', 1, 1, 'BasicLayout', '1', now()),
('202', 'menu_leader_speech', '领导讲话', 'menu_resource_center', '/resource-center/leader-speech', 'resource-center/LeaderSpeechView', 'el-icon-microphone', 2, 1, 'BasicLayout', '1', now()),
('203', 'menu_policy_interpretation', '政策解读', 'menu_resource_center', '/resource-center/policy-interpretation', 'resource-center/PolicyInterpretationView', 'el-icon-document', 3, 1, 'BasicLayout', '1', now()),
('204', 'menu_red_classic', '红色经典', 'menu_resource_center', '/resource-center/red-classic', 'resource-center/RedClassicView', 'el-icon-star-on', 4, 1, 'BasicLayout', '1', now()),
('205', 'menu_special_report', '专题报告', 'menu_resource_center', '/resource-center/special-report', 'resource-center/SpecialReportView', 'el-icon-document-copy', 5, 1, 'BasicLayout', '1', now()),
('206', 'menu_world_case', '思政案例', 'menu_resource_center', '/resource-center/world-case', 'resource-center/WorldCaseView', 'el-icon-collection', 6, 1, 'BasicLayout', '1', now()),
-- 学习计划
('300', 'menu_study_plan', '学习计划', NULL, '/study-plan', 'study-plan/StudyPlanView', 'el-icon-reading', 3, 1, 'BasicLayout', '1', now()),
('301', 'menu_study_tasks', '学习任务', 'menu_study_plan', '/study-plan/tasks', 'study-plan/StudyTasksView', 'el-icon-s-order', 1, 1, 'BasicLayout', '1', now()),
('302', 'menu_course_center', '课程中心', 'menu_study_plan', '/study-plan/course', 'study-plan/CourseCenterView', 'el-icon-video-play', 2, 1, 'BasicLayout', '1', now()),
-- 个人中心
('400', 'menu_user_center', '个人中心', NULL, '/user-center', 'user-center/UserCenterView', 'el-icon-user', 4, 1, 'BasicLayout', '1', now()),
('401', 'menu_learning_records', '学习记录', 'menu_user_center', '/user-center/learning-records', 'user-center/LearningRecordsView', 'el-icon-document', 1, 1, 'BasicLayout', '1', now()),
('402', 'menu_my_favorites', '我的收藏', 'menu_user_center', '/user-center/favorites', 'user-center/MyFavoritesView', 'el-icon-star-on', 2, 1, 'BasicLayout', '1', now()),
('403', 'menu_my_achievements', '我的成就', 'menu_user_center', '/user-center/achievements', 'user-center/MyAchievementsView', 'el-icon-trophy', 3, 1, 'BasicLayout', '1', now()),
-- 账号中心
('500', 'menu_profile', '账号中心', NULL, '/profile', 'profile/ProfileView', 'el-icon-user-solid', 5, 1, 'BasicLayout', '1', now()),
('501', 'menu_personal_info', '个人信息', 'menu_profile', '/profile/personal-info', 'profile/PersonalInfoView', 'el-icon-user', 1, 1, 'BasicLayout', '1', now()),
('502', 'menu_account_settings', '账号设置', 'menu_profile', '/profile/account-settings', 'profile/AccountSettingsView', 'el-icon-setting', 2, 1, 'BasicLayout', '1', now()),
-- 智能体模块
('600', 'menu_ai_assistant', '智能体模块', NULL, '/ai-assistant', 'ai-assistant/AIAssistantView', 'el-icon-cpu', 6, 1, 'BasicLayout', '1', now());
-- 插入后端管理菜单数据
INSERT INTO `tb_sys_menu` (id, menu_id, name, parent_id, url, component, icon, order_num, type, layout, creator, create_time) VALUES
-- 系统总览
('1000', 'menu_admin_overview', '系统总览', NULL, '/admin/overview', 'admin/overview/SystemOverviewView', 'el-icon-data-analysis', 1, 1, 'NavigationLayout', '1', now()),
-- 用户管理
('2000', 'menu_sys_manage', '系统管理', NULL, '', '', 'el-icon-user', 2, 1, '', '1', now()),
('2001', 'menu_admin_user', '用户管理', 'menu_sys_manage', '/admin/manage/system/user', 'admin/manage/system/UserManageView', 'el-icon-user', 1, 1, 'NavigationLayout', '1', now()),
('2002', 'menu_admin_dept', '部门管理', 'menu_sys_manage', '/admin/manage/system/dept', 'admin/manage/system/DeptManageView', 'el-icon-office-building', 2, 1, 'NavigationLayout', '1', now()),
('2003', 'menu_admin_role', '角色管理', 'menu_sys_manage', '/admin/manage/system/role', 'admin/manage/system/RoleManageView', 'el-icon-user-solid', 3, 1, 'NavigationLayout', '1', now()),
('2004', 'menu_admin_permission', '权限管理', 'menu_sys_manage', '/admin/manage/system/permission', 'admin/manage/system/PermissionManageView', 'el-icon-key', 4, 1, 'NavigationLayout', '1', now()),
('2005', 'menu_admin_menu', '菜单管理', 'menu_sys_manage', '/admin/manage/system/menu', 'admin/manage/system/MenuManageView', 'el-icon-menu', 5, 1, 'NavigationLayout', '1', now()),
('2006', 'menu_admin_module', '模块管理', 'menu_sys_manage', '/admin/manage/system/module', 'admin/manage/system/ModuleManageView', 'el-icon-s-grid', 6, 1, 'NavigationLayout', '1', now()),
-- 资源管理
('3000', 'menu_admin_resource_manage', '资源管理', NULL, '', '', 'el-icon-folder', 3, 1, '', '1', now()),
('3001', 'menu_admin_resource', '资源管理', 'menu_admin_resource_manage', '/admin/manage/resource/resource', 'admin/manage/resource/ResourceManagementView', 'el-icon-folder', 1, 1, 'NavigationLayout', '1', now()),
('3002', 'menu_admin_article', '文章管理', 'menu_admin_resource_manage', '/admin/manage/resource/article', 'admin/manage/resource/ArticleManagementView', 'el-icon-document', 2, 1, 'NavigationLayout', '1', now()),
('3003', 'menu_admin_data_records', '数据记录', 'menu_admin_resource_manage', '/admin/manage/resource/data-records', 'admin/manage/resource/DataRecordsView', 'el-icon-data-line', 3, 1, 'NavigationLayout', '1', now()),
-- 运营管理
('4000', 'menu_admin_content_manage', '运营管理', NULL, '', '', 'el-icon-s-operation', 4, 1, '', '1', now()),
('4001', 'menu_admin_banner', 'Banner管理', 'menu_admin_content_manage', '/admin/manage/content/banner', 'admin/manage/content/BannerManagementView', 'el-icon-picture', 1, 1, 'NavigationLayout', '1', now()),
('4002', 'menu_admin_tag', '标签管理', 'menu_admin_content_manage', '/admin/manage/content/tag', 'admin/manage/content/TagManagementView', 'el-icon-price-tag', 2, 1, 'NavigationLayout', '1', now()),
('4003', 'menu_admin_column', '栏目管理', 'menu_admin_content_manage', '/admin/manage/content/column', 'admin/manage/content/ColumnManagementView', 'el-icon-menu', 3, 1, 'NavigationLayout', '1', now()),
('4004', 'menu_admin_content', '内容管理', 'menu_admin_content_manage', '/admin/manage/content/content', 'admin/manage/content/ContentManagementView', 'el-icon-document', 4, 1, 'NavigationLayout', '1', now()),
-- 学习管理
('5000', 'menu_admin_study_manage', '学习管理', NULL, '', '', 'el-icon-reading', 5, 1, '', '1', now()),
('5001', 'menu_admin_study', '学习管理', 'menu_admin_study_manage', '/admin/manage/study/study', 'admin/manage/study/StudyManagementView', 'el-icon-reading', 1, 1, 'NavigationLayout', '1', now()),
('5002', 'menu_admin_task_publish', '任务发布', 'menu_admin_study_manage', '/admin/manage/study/task-publish', 'admin/manage/study/TaskPublishView', 'el-icon-s-order', 2, 1, 'NavigationLayout', '1', now()),
('5003', 'menu_admin_study_records', '学习记录', 'menu_admin_study_manage', '/admin/manage/study/study-records', 'admin/manage/study/StudyRecordsView', 'el-icon-document', 3, 1, 'NavigationLayout', '1', now()),
-- 智能体管理
('6000', 'menu_admin_ai_manage', '智能体管理', NULL, '', '', 'el-icon-cpu', 6, 1, '', '1', now()),
('6001', 'menu_admin_ai', 'AI管理', 'menu_admin_ai_manage', '/admin/manage/ai/ai', 'admin/manage/ai/AIManagementView', 'el-icon-cpu', 1, 1, 'NavigationLayout', '1', now()),
('6002', 'menu_admin_ai_config', 'AI配置', 'menu_admin_ai_manage', '/admin/manage/ai/config', 'admin/manage/ai/AIConfigView', 'el-icon-setting', 2, 1, 'NavigationLayout', '1', now()),
('6003', 'menu_admin_knowledge', '知识库管理', 'menu_admin_ai_manage', '/admin/manage/ai/knowledge', 'admin/manage/ai/KnowledgeManagementView', 'el-icon-collection', 3, 1, 'NavigationLayout', '1', now()),
-- 系统日志
('7000', 'menu_admin_logs_manage', '系统日志', NULL, '', '', 'el-icon-document', 7, 1, '', '1', now()),
('7001', 'menu_admin_system_logs', '系统日志', 'menu_admin_logs_manage', '/admin/manage/logs/system', 'admin/manage/logs/SystemLogsView', 'el-icon-document', 1, 1, 'NavigationLayout', '1', now()),
('7002', 'menu_admin_login_logs', '登录日志', 'menu_admin_logs_manage', '/admin/manage/logs/login', 'admin/manage/logs/LoginLogsView', 'el-icon-key', 2, 1, 'NavigationLayout', '1', now()),
('7003', 'menu_admin_operation_logs', '操作日志', 'menu_admin_logs_manage', '/admin/manage/logs/operation', 'admin/manage/logs/OperationLogsView', 'el-icon-s-operation', 3, 1, 'NavigationLayout', '1', now()),
('7004', 'menu_admin_system_config', '系统配置', 'menu_admin_logs_manage', '/admin/manage/logs/config', 'admin/manage/logs/SystemConfigView', 'el-icon-setting', 4, 1, 'NavigationLayout', '1', now());
-- 插入菜单权限关联数据
INSERT INTO `tb_sys_menu_permission` (id, permission_id, menu_id, creator, create_time) VALUES
-- 前端菜单权限关联
('100', 'perm_default', 'menu_home', '1', now()),
('101', 'perm_default', 'menu_resource_center', '1', now()),
('102', 'perm_default', 'menu_party_history', '1', now()),
('103', 'perm_default', 'menu_leader_speech', '1', now()),
('104', 'perm_default', 'menu_policy_interpretation', '1', now()),
('105', 'perm_default', 'menu_red_classic', '1', now()),
('106', 'perm_default', 'menu_special_report', '1', now()),
('107', 'perm_default', 'menu_world_case', '1', now()),
('108', 'perm_default', 'menu_study_plan', '1', now()),
('109', 'perm_default', 'menu_study_tasks', '1', now()),
('110', 'perm_default', 'menu_course_center', '1', now()),
('111', 'perm_default', 'menu_user_center', '1', now()),
('112', 'perm_default', 'menu_learning_records', '1', now()),
('113', 'perm_default', 'menu_my_favorites', '1', now()),
('114', 'perm_default', 'menu_my_achievements', '1', now()),
('115', 'perm_default', 'menu_profile', '1', now()),
('116', 'perm_default', 'menu_personal_info', '1', now()),
('117', 'perm_default', 'menu_account_settings', '1', now()),
('118', 'perm_ai_manage', 'menu_ai_assistant', '1', now()),
-- 后端管理菜单权限关联
('200', 'perm_system_manage', 'menu_admin_overview', '1', now()),
('201', 'perm_system_manage', 'menu_sys_manage', '1', now()),
('202', 'perm_system_user_manage', 'menu_admin_user_manage', '1', now()),
('203', 'perm_system_user_manage', 'menu_admin_user', '1', now()),
('204', 'perm_system_dept_manage', 'menu_admin_dept', '1', now()),
('205', 'perm_system_role_manage', 'menu_admin_role', '1', now()),
('206', 'perm_system_permission_manage', 'menu_admin_permission', '1', now()),
('207', 'perm_system_menu_manage', 'menu_admin_menu', '1', now()),
('208', 'perm_system_module_manage', 'menu_admin_module', '1', now()),
('209', 'perm_news_manage', 'menu_admin_resource_manage', '1', now()),
('210', 'perm_news_manage', 'menu_admin_resource', '1', now()),
('211', 'perm_news_manage', 'menu_admin_article', '1', now()),
('212', 'perm_news_manage', 'menu_admin_data_records', '1', now()),
('213', 'perm_news_manage', 'menu_admin_content_manage', '1', now()),
('214', 'perm_news_manage', 'menu_admin_banner', '1', now()),
('215', 'perm_news_manage', 'menu_admin_tag', '1', now()),
('216', 'perm_news_manage', 'menu_admin_column', '1', now()),
('217', 'perm_news_manage', 'menu_admin_content', '1', now()),
('218', 'perm_study_manage', 'menu_admin_study_manage', '1', now()),
('219', 'perm_study_manage', 'menu_admin_study', '1', now()),
('220', 'perm_study_manage', 'menu_admin_task_publish', '1', now()),
('221', 'perm_study_manage', 'menu_admin_study_records', '1', now()),
('222', 'perm_ai_manage', 'menu_admin_ai_manage', '1', now()),
('223', 'perm_ai_manage', 'menu_admin_ai', '1', now()),
('224', 'perm_ai_manage', 'menu_admin_ai_config', '1', now()),
('225', 'perm_ai_manage', 'menu_admin_knowledge', '1', now()),
('226', 'perm_system_manage', 'menu_admin_logs_manage', '1', now()),
('227', 'perm_system_manage', 'menu_admin_system_logs', '1', now()),
('228', 'perm_system_manage', 'menu_admin_login_logs', '1', now()),
('229', 'perm_system_manage', 'menu_admin_operation_logs', '1', now()),
('230', 'perm_system_manage', 'menu_admin_system_config', '1', now());

View File

@@ -0,0 +1,184 @@
#!/bin/bash
# =====================================================
# 校园思政新闻平台数据库重新初始化脚本
# 版本: 1.0.0
# 说明: 该脚本会删除现有数据库,重新创建并初始化所有数据
# 注意: 执行前请确保MySQL服务已启动并且有足够的权限
# =====================================================
# 设置颜色输出
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# 数据库配置
DB_HOST="localhost"
DB_PORT="3306"
DB_USER="root"
DB_PASSWORD="123456"
DB_NAME="school_news"
# 脚本目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 日志文件
LOG_FILE="$SCRIPT_DIR/reInit.log"
# 打印带颜色的消息
print_message() {
local color=$1
local message=$2
echo -e "${color}${message}${NC}"
echo "$(date '+%Y-%m-%d %H:%M:%S') - $message" >> "$LOG_FILE"
}
# 检查MySQL连接
check_mysql_connection() {
print_message $BLUE "检查MySQL连接..."
if command -v mysql &> /dev/null; then
if mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" -e "SELECT 1;" &> /dev/null; then
print_message $GREEN "MySQL连接成功"
return 0
else
print_message $RED "MySQL连接失败请检查配置"
return 1
fi
else
print_message $RED "MySQL客户端未安装或不在PATH中"
return 1
fi
}
# 备份现有数据库(如果存在)
backup_database() {
if mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" -e "USE $DB_NAME;" &> /dev/null; then
print_message $YELLOW "发现现有数据库,正在备份..."
local backup_file="$SCRIPT_DIR/backup_${DB_NAME}_$(date +%Y%m%d_%H%M%S).sql"
mysqldump -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" > "$backup_file"
if [ $? -eq 0 ]; then
print_message $GREEN "数据库备份成功: $backup_file"
else
print_message $YELLOW "数据库备份失败,继续执行..."
fi
fi
}
# 删除现有数据库
drop_database() {
print_message $YELLOW "删除现有数据库..."
mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" -e "DROP DATABASE IF EXISTS $DB_NAME;"
if [ $? -eq 0 ]; then
print_message $GREEN "数据库删除成功"
else
print_message $RED "数据库删除失败"
exit 1
fi
}
# 执行初始化脚本
execute_init_script() {
print_message $BLUE "开始执行数据库初始化..."
# 切换到脚本目录
cd "$SCRIPT_DIR"
# 执行initAll.sql
mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" < initAll.sql
if [ $? -eq 0 ]; then
print_message $GREEN "数据库初始化成功"
else
print_message $RED "数据库初始化失败"
exit 1
fi
}
# 验证初始化结果
verify_initialization() {
print_message $BLUE "验证初始化结果..."
# 检查数据库是否存在
if mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" -e "USE $DB_NAME;" &> /dev/null; then
print_message $GREEN "数据库创建成功"
else
print_message $RED "数据库创建失败"
exit 1
fi
# 检查表数量
local table_count=$(mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" -D"$DB_NAME" -e "SHOW TABLES;" | wc -l)
print_message $GREEN "创建了 $table_count 张表"
# 检查默认用户
local user_count=$(mysql -h"$DB_HOST" -P"$DB_PORT" -u"$DB_USER" -p"$DB_PASSWORD" -D"$DB_NAME" -e "SELECT COUNT(*) FROM tb_sys_user WHERE username='admin';" | tail -n 1)
if [ "$user_count" -gt 0 ]; then
print_message $GREEN "默认用户创建成功"
else
print_message $YELLOW "默认用户创建失败"
fi
}
# 显示初始化信息
show_initialization_info() {
print_message $BLUE "====================================================="
print_message $GREEN "数据库初始化完成!"
print_message $BLUE "====================================================="
print_message $YELLOW "数据库信息:"
print_message $YELLOW " 数据库名: $DB_NAME"
print_message $YELLOW " 主机: $DB_HOST"
print_message $YELLOW " 端口: $DB_PORT"
print_message $YELLOW " 用户: $DB_USER"
print_message $BLUE "====================================================="
print_message $YELLOW "默认账户信息:"
print_message $YELLOW " 用户名: admin"
print_message $YELLOW " 密码: admin123"
print_message $YELLOW " 角色: 管理员"
print_message $BLUE "====================================================="
print_message $YELLOW "系统功能:"
print_message $YELLOW " - 用户管理"
print_message $YELLOW " - 权限管理"
print_message $YELLOW " - 资源管理"
print_message $YELLOW " - 学习管理"
print_message $YELLOW " - AI智能体"
print_message $YELLOW " - 系统配置"
print_message $BLUE "====================================================="
}
# 主函数
main() {
print_message $BLUE "====================================================="
print_message $BLUE "校园思政新闻平台数据库重新初始化脚本"
print_message $BLUE "版本: 1.0.0"
print_message $BLUE "====================================================="
# 检查MySQL连接
if ! check_mysql_connection; then
exit 1
fi
# 备份现有数据库
# backup_database
# 删除现有数据库
# drop_database
# 执行初始化脚本
execute_init_script
# 验证初始化结果
verify_initialization
# 显示初始化信息
show_initialization_info
print_message $GREEN "初始化完成!"
}
# 脚本入口
if [ "${BASH_SOURCE[0]}" == "${0}" ]; then
main "$@"
fi

View File

@@ -0,0 +1,186 @@
package org.xyzh.api.system.module;
import org.xyzh.common.core.page.PageParam;
import org.xyzh.common.dto.system.TbSysModule;
import org.xyzh.common.core.domain.ResultDomain;
import java.util.List;
/**
* @description 系统模块服务接口
* @filename ModuleService.java
* @author yslg
* @copyright xyzh
* @since 2025-10-16
*/
public interface ModuleService {
/**
* @description 查询模块列表
* @param filter 过滤条件
* @return ResultDomain<TbSysModule> 模块列表
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> getModuleList(TbSysModule filter);
/**
* @description 根据模块ID查询模块信息
* @param moduleID 模块ID
* @return ResultDomain<TbSysModule> 模块信息
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> getModuleById(String moduleID);
/**
* @description 根据模块代码查询模块信息
* @param code 模块代码
* @return ResultDomain<TbSysModule> 模块信息
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> getModuleByCode(String code);
/**
* @description 查询启用的模块列表
* @return ResultDomain<TbSysModule> 启用的模块列表
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> getActiveModules();
/**
* @description 创建模块
* @param module 模块信息
* @return ResultDomain<TbSysModule> 创建结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> createModule(TbSysModule module);
/**
* @description 更新模块
* @param module 模块信息
* @return ResultDomain<TbSysModule> 更新结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> updateModule(TbSysModule module);
/**
* @description 删除模块
* @param moduleID 模块ID
* @return ResultDomain<Boolean> 删除结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> deleteModule(String moduleID);
/**
* @description 批量删除模块
* @param moduleIDs 模块ID列表
* @return ResultDomain<Boolean> 删除结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> batchDeleteModules(List<String> moduleIDs);
/**
* @description 更新模块状态
* @param moduleID 模块ID
* @param status 状态
* @return ResultDomain<Boolean> 更新结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> updateModuleStatus(String moduleID, Integer status);
/**
* @description 更新模块排序
* @param moduleID 模块ID
* @param orderNum 排序号
* @return ResultDomain<Boolean> 更新结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> updateModuleOrder(String moduleID, Integer orderNum);
/**
* @description 分页查询模块列表
* @param filter 过滤条件
* @param pageParam 分页参数
* @return ResultDomain<TbSysModule> 模块列表
* @author yslg
* @since 2025-10-16
*/
ResultDomain<TbSysModule> getModuleListPage(TbSysModule filter, PageParam pageParam);
/**
* @description 统计模块数量
* @param filter 过滤条件
* @return ResultDomain<Long> 模块数量
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Long> countModules(TbSysModule filter);
/**
* @description 检查模块代码是否存在
* @param code 模块代码
* @param excludeID 排除的模块ID
* @return ResultDomain<Boolean> 是否存在
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> checkModuleCodeExists(String code, String excludeID);
/**
* @description 绑定权限到模块
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 绑定结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> bindPermissionsToModule(String moduleID, List<String> permissionIds);
/**
* @description 解绑模块的权限
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 解绑结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> unbindPermissionsFromModule(String moduleID, List<String> permissionIds);
/**
* @description 获取模块的权限列表
* @param moduleID 模块ID
* @return ResultDomain<List<String>> 权限ID列表
* @author yslg
* @since 2025-10-16
*/
ResultDomain<List<String>> getModulePermissions(String moduleID);
/**
* @description 批量绑定权限到模块
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 绑定结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> batchBindPermissionsToModule(String moduleID, List<String> permissionIds);
/**
* @description 批量解绑模块的权限
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 解绑结果
* @author yslg
* @since 2025-10-16
*/
ResultDomain<Boolean> batchUnbindPermissionsFromModule(String moduleID, List<String> permissionIds);
}

View File

@@ -54,6 +54,13 @@ public class TbSysPermission extends BaseDTO{
*/
private String updater;
/**
* @description 所属模块ID
* @author yslg
* @since 2025-10-16
*/
private String moduleID;
public String getPermissionID() {
return permissionID;
}
@@ -102,6 +109,14 @@ public class TbSysPermission extends BaseDTO{
this.updater = updater;
}
public String getModuleID() {
return moduleID;
}
public void setModuleID(String moduleID) {
this.moduleID = moduleID;
}
@Override
public String toString() {
return "TbSysPermission{" +
@@ -110,6 +125,7 @@ public class TbSysPermission extends BaseDTO{
", name='" + name + '\'' +
", description='" + description + '\'' +
", code='" + code + '\'' +
", moduleID='" + moduleID + '\'' +
", creator='" + creator + '\'' +
", updater='" + updater + '\'' +
", createTime=" + getCreateTime() +

View File

@@ -0,0 +1,146 @@
package org.xyzh.common.dto.system;
import org.xyzh.common.dto.BaseDTO;
/**
* @description 系统模块表
* @filename TbSysModule.java
* @author yslg
* @copyright xyzh
* @since 2025-10-16
*/
public class TbSysModule extends BaseDTO {
private static final long serialVersionUID = 1L;
/**
* @description 模块ID
*/
private String moduleID;
/**
* @description 模块名称
*/
private String name;
/**
* @description 模块代码
*/
private String code;
/**
* @description 模块描述
*/
private String description;
/**
* @description 模块图标
*/
private String icon;
/**
* @description 模块排序号
*/
private Integer orderNum;
/**
* @description 模块状态0禁用 1启用
*/
private Integer status;
/**
* @description 创建者
*/
private String creator;
/**
* @description 更新者
*/
private String updater;
public String getModuleID() {
return moduleID;
}
public void setModuleID(String moduleID) {
this.moduleID = moduleID;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getUpdater() {
return updater;
}
public void setUpdater(String updater) {
this.updater = updater;
}
@Override
public String toString() {
return "TbSysModule{" +
"id=" + getID() +
", moduleID='" + moduleID + '\'' +
", name='" + name + '\'' +
", code='" + code + '\'' +
", description='" + description + '\'' +
", icon='" + icon + '\'' +
", orderNum=" + orderNum +
", status=" + status +
'}';
}
}

View File

@@ -0,0 +1,257 @@
package org.xyzh.system.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xyzh.api.system.module.ModuleService;
import org.xyzh.common.core.page.PageParam;
import org.xyzh.common.dto.system.TbSysModule;
import org.xyzh.common.core.domain.ResultDomain;
import java.util.List;
/**
* @description 系统模块控制器
* @filename ModuleController.java
* @author yslg
* @copyright xyzh
* @since 2025-10-16
*/
@RestController
@RequestMapping("/system/module")
@CrossOrigin(origins = "*")
public class ModuleController {
@Autowired
private ModuleService moduleService;
/**
* @description 查询模块列表
* @param filter 过滤条件
* @return ResultDomain<TbSysModule> 模块列表
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/list")
public ResultDomain<TbSysModule> getModuleList(@RequestBody(required = false) TbSysModule filter) {
return moduleService.getModuleList(filter);
}
/**
* @description 根据模块ID查询模块信息
* @param moduleID 模块ID
* @return ResultDomain<TbSysModule> 模块信息
* @author yslg
* @since 2025-10-16
*/
@GetMapping("/{moduleID}")
public ResultDomain<TbSysModule> getModuleById(@PathVariable String moduleID) {
return moduleService.getModuleById(moduleID);
}
/**
* @description 根据模块代码查询模块信息
* @param code 模块代码
* @return ResultDomain<TbSysModule> 模块信息
* @author yslg
* @since 2025-10-16
*/
@GetMapping("/code/{code}")
public ResultDomain<TbSysModule> getModuleByCode(@PathVariable String code) {
return moduleService.getModuleByCode(code);
}
/**
* @description 查询启用的模块列表
* @return ResultDomain<TbSysModule> 启用的模块列表
* @author yslg
* @since 2025-10-16
*/
@GetMapping("/active")
public ResultDomain<TbSysModule> getActiveModules() {
return moduleService.getActiveModules();
}
/**
* @description 创建模块
* @param module 模块信息
* @return ResultDomain<TbSysModule> 创建结果
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/create")
public ResultDomain<TbSysModule> createModule(@RequestBody TbSysModule module) {
return moduleService.createModule(module);
}
/**
* @description 更新模块
* @param module 模块信息
* @return ResultDomain<TbSysModule> 更新结果
* @author yslg
* @since 2025-10-16
*/
@PutMapping("/update")
public ResultDomain<TbSysModule> updateModule(@RequestBody TbSysModule module) {
return moduleService.updateModule(module);
}
/**
* @description 删除模块
* @param moduleID 模块ID
* @return ResultDomain<Boolean> 删除结果
* @author yslg
* @since 2025-10-16
*/
@DeleteMapping("/{moduleID}")
public ResultDomain<Boolean> deleteModule(@PathVariable String moduleID) {
return moduleService.deleteModule(moduleID);
}
/**
* @description 批量删除模块
* @param moduleIDs 模块ID列表
* @return ResultDomain<Boolean> 删除结果
* @author yslg
* @since 2025-10-16
*/
@DeleteMapping("/batch")
public ResultDomain<Boolean> batchDeleteModules(@RequestBody List<String> moduleIDs) {
return moduleService.batchDeleteModules(moduleIDs);
}
/**
* @description 更新模块状态
* @param moduleID 模块ID
* @param status 状态
* @return ResultDomain<Boolean> 更新结果
* @author yslg
* @since 2025-10-16
*/
@PutMapping("/{moduleID}/status/{status}")
public ResultDomain<Boolean> updateModuleStatus(@PathVariable String moduleID, @PathVariable Integer status) {
return moduleService.updateModuleStatus(moduleID, status);
}
/**
* @description 更新模块排序
* @param moduleID 模块ID
* @param orderNum 排序号
* @return ResultDomain<Boolean> 更新结果
* @author yslg
* @since 2025-10-16
*/
@PutMapping("/{moduleID}/order/{orderNum}")
public ResultDomain<Boolean> updateModuleOrder(@PathVariable String moduleID, @PathVariable Integer orderNum) {
return moduleService.updateModuleOrder(moduleID, orderNum);
}
/**
* @description 分页查询模块列表
* @param filter 过滤条件
* @param pageParam 分页参数
* @return ResultDomain<TbSysModule> 模块列表
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/page")
public ResultDomain<TbSysModule> getModuleListPage(@RequestBody(required = false) TbSysModule filter,
@RequestParam(defaultValue = "1") int pageNumber,
@RequestParam(defaultValue = "10") int pageSize) {
PageParam pageParam = new PageParam(pageNumber, pageSize);
return moduleService.getModuleListPage(filter, pageParam);
}
/**
* @description 统计模块数量
* @param filter 过滤条件
* @return ResultDomain<Long> 模块数量
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/count")
public ResultDomain<Long> countModules(@RequestBody(required = false) TbSysModule filter) {
return moduleService.countModules(filter);
}
/**
* @description 检查模块代码是否存在
* @param code 模块代码
* @param excludeID 排除的模块ID
* @return ResultDomain<Boolean> 是否存在
* @author yslg
* @since 2025-10-16
*/
@GetMapping("/check-code")
public ResultDomain<Boolean> checkModuleCodeExists(@RequestParam String code,
@RequestParam(required = false) String excludeID) {
return moduleService.checkModuleCodeExists(code, excludeID);
}
/**
* @description 绑定权限到模块
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 绑定结果
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/{moduleID}/bind-permissions")
public ResultDomain<Boolean> bindPermissionsToModule(@PathVariable String moduleID,
@RequestBody List<String> permissionIds) {
return moduleService.bindPermissionsToModule(moduleID, permissionIds);
}
/**
* @description 解绑模块的权限
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 解绑结果
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/{moduleID}/unbind-permissions")
public ResultDomain<Boolean> unbindPermissionsFromModule(@PathVariable String moduleID,
@RequestBody List<String> permissionIds) {
return moduleService.unbindPermissionsFromModule(moduleID, permissionIds);
}
/**
* @description 获取模块的权限列表
* @param moduleID 模块ID
* @return ResultDomain<List<String>> 权限ID列表
* @author yslg
* @since 2025-10-16
*/
@GetMapping("/{moduleID}/permissions")
public ResultDomain<List<String>> getModulePermissions(@PathVariable String moduleID) {
return moduleService.getModulePermissions(moduleID);
}
/**
* @description 批量绑定权限到模块
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 绑定结果
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/{moduleID}/batch-bind-permissions")
public ResultDomain<Boolean> batchBindPermissionsToModule(@PathVariable String moduleID,
@RequestBody List<String> permissionIds) {
return moduleService.batchBindPermissionsToModule(moduleID, permissionIds);
}
/**
* @description 批量解绑模块的权限
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return ResultDomain<Boolean> 解绑结果
* @author yslg
* @since 2025-10-16
*/
@PostMapping("/{moduleID}/batch-unbind-permissions")
public ResultDomain<Boolean> batchUnbindPermissionsFromModule(@PathVariable String moduleID,
@RequestBody List<String> permissionIds) {
return moduleService.batchUnbindPermissionsFromModule(moduleID, permissionIds);
}
}

View File

@@ -0,0 +1,149 @@
package org.xyzh.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.xyzh.common.core.page.PageParam;
import org.xyzh.common.dto.system.TbSysModule;
import java.util.List;
/**
* @description 系统模块数据访问层
* @filename ModuleMapper.java
* @author yslg
* @copyright xyzh
* @since 2025-10-16
*/
@Mapper
public interface ModuleMapper extends BaseMapper<TbSysModule> {
/**
* @description 查询模块列表
* @param filter 过滤条件
* @return List<TbSysModule> 模块列表
* @author yslg
* @since 2025-10-16
*/
List<TbSysModule> selectModules(TbSysModule filter);
/**
* @description 根据模块ID查询模块信息
* @param moduleID 模块ID
* @return TbSysModule 模块信息
* @author yslg
* @since 2025-10-16
*/
TbSysModule selectByModuleID(@Param("moduleID") String moduleID);
/**
* @description 根据模块代码查询模块信息
* @param code 模块代码
* @return TbSysModule 模块信息
* @author yslg
* @since 2025-10-16
*/
TbSysModule selectByCode(@Param("code") String code);
/**
* @description 查询启用的模块列表
* @return List<TbSysModule> 启用的模块列表
* @author yslg
* @since 2025-10-16
*/
List<TbSysModule> selectActiveModules();
/**
* @description 检查模块代码是否存在
* @param code 模块代码
* @param excludeID 排除的模块ID
* @return int 存在的数量
* @author yslg
* @since 2025-10-16
*/
int countByCode(@Param("code") String code, @Param("excludeID") String excludeID);
/**
* @description 插入模块
* @param module 模块信息
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int insertModule(TbSysModule module);
/**
* @description 更新模块
* @param module 模块信息
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int updateModule(TbSysModule module);
/**
* @description 删除模块
* @param module 模块信息
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int deleteModule(TbSysModule module);
/**
* @description 批量插入模块
* @param moduleList 模块列表
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int batchInsertModules(@Param("moduleList") List<TbSysModule> moduleList);
/**
* @description 批量删除模块
* @param moduleIDs 模块ID列表
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int batchDeleteModules(@Param("moduleIDs") List<String> moduleIDs);
/**
* @description 分页查询模块列表
* @param filter 过滤条件
* @param pageParam 分页参数
* @return List<TbSysModule> 模块列表
* @author yslg
* @since 2025-10-16
*/
List<TbSysModule> selectModulesPage(@Param("filter") TbSysModule filter, @Param("pageParam") PageParam pageParam);
/**
* @description 统计模块数量
* @param filter 过滤条件
* @return long 模块数量
* @author yslg
* @since 2025-10-16
*/
long countModules(@Param("filter") TbSysModule filter);
/**
* @description 更新模块状态
* @param moduleID 模块ID
* @param status 状态
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int updateModuleStatus(@Param("moduleID") String moduleID, @Param("status") Integer status);
/**
* @description 更新模块排序
* @param moduleID 模块ID
* @param orderNum 排序号
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int updateModuleOrder(@Param("moduleID") String moduleID, @Param("orderNum") Integer orderNum);
}

View File

@@ -58,12 +58,12 @@ public interface PermissionMapper extends BaseMapper<TbSysPermission> {
/**
* @description 根据角色ID查询权限列表
* @param roleId 角色ID
* @param roleID 角色ID
* @return List<TbSysPermission> 权限列表
* @author yslg
* @since 2025-09-28
*/
List<TbSysPermission> selectPermissionsByRoleId(@Param("roleId") String roleId);
List<TbSysPermission> selectPermissionsByRoleID(@Param("roleID") String roleID);
/**
* @description 根据权限编码查询权限
@@ -77,22 +77,22 @@ public interface PermissionMapper extends BaseMapper<TbSysPermission> {
/**
* @description 检查权限名称是否存在
* @param permissionName 权限名称
* @param excludeId 排除的权限ID
* @param excludeID 排除的权限ID
* @return int 存在数量
* @author yslg
* @since 2025-09-28
*/
int countByPermissionName(@Param("permissionName") String permissionName, @Param("excludeId") String excludeId);
int countByPermissionName(@Param("permissionName") String permissionName, @Param("excludeID") String excludeID);
/**
* @description 检查权限编码是否存在
* @param permissionCode 权限编码
* @param excludeId 排除的权限ID
* @param excludeID 排除的权限ID
* @return int 存在数量
* @author yslg
* @since 2025-09-28
*/
int countByPermissionCode(@Param("permissionCode") String permissionCode, @Param("excludeId") String excludeId);
int countByPermissionCode(@Param("permissionCode") String permissionCode, @Param("excludeID") String excludeID);
/**
* @description 批量删除权限(逻辑删除)
@@ -157,4 +157,42 @@ public interface PermissionMapper extends BaseMapper<TbSysPermission> {
* @since 2025-10-08
*/
List<TbSysRole> selectPermissionBindRole(@Param("permission") PermissionVO permission);
/**
* @description 根据模块ID查询权限列表
* @param moduleID 模块ID
* @return List<TbSysPermission> 权限列表
* @author yslg
* @since 2025-10-16
*/
List<TbSysPermission> selectPermissionsByModuleID(@Param("moduleID") String moduleID);
/**
* @description 绑定权限到模块
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int bindPermissionsToModule(@Param("moduleID") String moduleID, @Param("permissionIds") List<String> permissionIds);
/**
* @description 解绑模块的权限
* @param moduleID 模块ID
* @param permissionIds 权限ID列表
* @return int 影响行数
* @author yslg
* @since 2025-10-16
*/
int unbindPermissionsFromModule(@Param("moduleID") String moduleID, @Param("permissionIds") List<String> permissionIds);
/**
* @description 获取模块的权限ID列表
* @param moduleID 模块ID
* @return List<String> 权限ID列表
* @author yslg
* @since 2025-10-16
*/
List<String> getModulePermissionIds(@Param("moduleID") String moduleID);
}

View File

@@ -0,0 +1,14 @@
package org.xyzh.system.module;
import org.xyzh.api.system.module.ModuleService;
/**
* @description 系统模块服务接口
* @filename SysModuleService.java
* @author yslg
* @copyright xyzh
* @since 2025-10-16
*/
public interface SysModuleService extends ModuleService{
}

View File

@@ -0,0 +1,407 @@
package org.xyzh.system.module.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.xyzh.common.core.page.PageParam;
import org.xyzh.common.dto.system.TbSysModule;
import org.xyzh.common.utils.IDUtils;
import org.xyzh.common.core.domain.ResultDomain;
import org.xyzh.system.mapper.ModuleMapper;
import org.xyzh.system.mapper.PermissionMapper;
import org.xyzh.api.system.module.ModuleService;
import java.util.Date;
import java.util.List;
/**
* @description 系统模块服务实现类
* @filename ModuleServiceImpl.java
* @author yslg
* @copyright xyzh
* @since 2025-10-16
*/
@Service
public class ModuleServiceImpl implements ModuleService {
@Autowired
private ModuleMapper moduleMapper;
@Autowired
private PermissionMapper permissionMapper;
@Override
public ResultDomain<TbSysModule> getModuleList(TbSysModule filter) {
try {
List<TbSysModule> modules = moduleMapper.selectModules(filter);
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.success("查询成功", modules);
return result;
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("查询模块列表失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<TbSysModule> getModuleById(String moduleID) {
try {
TbSysModule module = moduleMapper.selectByModuleID(moduleID);
if (module == null) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("模块不存在");
return result;
}
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.success("查询成功", module);
return result;
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("查询模块信息失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<TbSysModule> getModuleByCode(String code) {
try {
TbSysModule module = moduleMapper.selectByCode(code);
if (module == null) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("模块不存在");
return result;
}
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.success("查询成功", module);
return result;
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("查询模块信息失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<TbSysModule> getActiveModules() {
try {
List<TbSysModule> modules = moduleMapper.selectActiveModules();
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.success("查询成功", modules);
return result;
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("查询启用模块列表失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<TbSysModule> createModule(TbSysModule module) {
try {
// 检查模块代码是否已存在
int count = moduleMapper.countByCode(module.getCode(), null);
if (count > 0) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("模块代码已存在");
return result;
}
// 设置ID和创建时间
module.setID(IDUtils.generateID());
module.setModuleID(IDUtils.generateID());
module.setCreateTime(new Date());
module.setUpdateTime(new Date());
module.setDeleted(false);
int result = moduleMapper.insertModule(module);
if (result > 0) {
ResultDomain<TbSysModule> resultDomain = new ResultDomain<>();
resultDomain.success("创建成功", module);
return resultDomain;
} else {
ResultDomain<TbSysModule> resultDomain = new ResultDomain<>();
resultDomain.fail("创建模块失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("创建模块失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<TbSysModule> updateModule(TbSysModule module) {
try {
// 检查模块是否存在
TbSysModule existingModule = moduleMapper.selectByModuleID(module.getModuleID());
if (existingModule == null) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("模块不存在");
return result;
}
// 检查模块代码是否已存在(排除自身)
int count = moduleMapper.countByCode(module.getCode(), existingModule.getID());
if (count > 0) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("模块代码已存在");
return result;
}
// 设置更新时间和ID
module.setID(existingModule.getID());
module.setUpdateTime(new Date());
int result = moduleMapper.updateModule(module);
if (result > 0) {
ResultDomain<TbSysModule> resultDomain = new ResultDomain<>();
resultDomain.success("更新成功", module);
return resultDomain;
} else {
ResultDomain<TbSysModule> resultDomain = new ResultDomain<>();
resultDomain.fail("更新模块失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("更新模块失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> deleteModule(String moduleID) {
try {
TbSysModule module = moduleMapper.selectByModuleID(moduleID);
if (module == null) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("模块不存在");
return result;
}
module.setDeleteTime(new Date());
int result = moduleMapper.deleteModule(module);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("删除成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("删除模块失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("删除模块失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> batchDeleteModules(List<String> moduleIDs) {
try {
int result = moduleMapper.batchDeleteModules(moduleIDs);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("批量删除成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("批量删除模块失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("批量删除模块失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> updateModuleStatus(String moduleID, Integer status) {
try {
int result = moduleMapper.updateModuleStatus(moduleID, status);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("更新状态成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("更新模块状态失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("更新模块状态失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> updateModuleOrder(String moduleID, Integer orderNum) {
try {
int result = moduleMapper.updateModuleOrder(moduleID, orderNum);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("更新排序成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("更新模块排序失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("更新模块排序失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<TbSysModule> getModuleListPage(TbSysModule filter, PageParam pageParam) {
try {
List<TbSysModule> modules = moduleMapper.selectModulesPage(filter, pageParam);
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.success("查询成功", modules);
return result;
} catch (Exception e) {
ResultDomain<TbSysModule> result = new ResultDomain<>();
result.fail("分页查询模块列表失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<Long> countModules(TbSysModule filter) {
try {
long count = moduleMapper.countModules(filter);
ResultDomain<Long> result = new ResultDomain<>();
result.success("统计成功", count);
return result;
} catch (Exception e) {
ResultDomain<Long> result = new ResultDomain<>();
result.fail("统计模块数量失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<Boolean> checkModuleCodeExists(String code, String excludeID) {
try {
int count = moduleMapper.countByCode(code, excludeID);
ResultDomain<Boolean> result = new ResultDomain<>();
result.success("检查成功", count > 0);
return result;
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("检查模块代码失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> bindPermissionsToModule(String moduleID, List<String> permissionIds) {
try {
int result = permissionMapper.bindPermissionsToModule(moduleID, permissionIds);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("绑定成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("绑定权限到模块失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("绑定权限到模块失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> unbindPermissionsFromModule(String moduleID, List<String> permissionIds) {
try {
int result = permissionMapper.unbindPermissionsFromModule(moduleID, permissionIds);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("解绑成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("解绑模块权限失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("解绑模块权限失败:" + e.getMessage());
return result;
}
}
@Override
public ResultDomain<List<String>> getModulePermissions(String moduleID) {
try {
List<String> permissionIds = permissionMapper.getModulePermissionIds(moduleID);
ResultDomain<List<String>> result = new ResultDomain<>();
result.success("查询成功", permissionIds);
return result;
} catch (Exception e) {
ResultDomain<List<String>> result = new ResultDomain<>();
result.fail("获取模块权限失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> batchBindPermissionsToModule(String moduleID, List<String> permissionIds) {
try {
int result = permissionMapper.bindPermissionsToModule(moduleID, permissionIds);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("批量绑定成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("批量绑定权限到模块失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("批量绑定权限到模块失败:" + e.getMessage());
return result;
}
}
@Override
@Transactional
public ResultDomain<Boolean> batchUnbindPermissionsFromModule(String moduleID, List<String> permissionIds) {
try {
int result = permissionMapper.unbindPermissionsFromModule(moduleID, permissionIds);
if (result > 0) {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.success("批量解绑成功", true);
return resultDomain;
} else {
ResultDomain<Boolean> resultDomain = new ResultDomain<>();
resultDomain.fail("批量解绑模块权限失败");
return resultDomain;
}
} catch (Exception e) {
ResultDomain<Boolean> result = new ResultDomain<>();
result.fail("批量解绑模块权限失败:" + e.getMessage());
return result;
}
}
}

View File

@@ -888,7 +888,7 @@ public class SysPermissionServiceImpl implements SysPermissionService {
return resultDomain;
}
List<TbSysPermission> permissions = permissionMapper.selectPermissionsByRoleId(roleId);
List<TbSysPermission> permissions = permissionMapper.selectPermissionsByRoleID(roleId);
logger.info("根据角色ID查询权限列表完成共找到{}个权限", permissions.size());
resultDomain.success("查询成功", permissions);

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.xyzh.system.mapper.ModuleMapper">
<!-- 基础结果映射 -->
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.system.TbSysModule">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="module_id" property="moduleID" jdbcType="VARCHAR"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="icon" property="icon" jdbcType="VARCHAR"/>
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="creator" property="creator" jdbcType="VARCHAR"/>
<result column="updater" property="updater" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
<result column="deleted" property="deleted" jdbcType="BOOLEAN"/>
</resultMap>
<!-- 基础列列表 -->
<sql id="Base_Column_List">
id, module_id, name, code, description, icon, order_num, status, creator, updater,
create_time, update_time, delete_time, deleted
</sql>
<!-- 基础WHERE条件 -->
<sql id="Base_Where_Clause">
<where>
<if test="filter != null">
<if test="filter.id != null and filter.id != ''">
AND id = #{filter.id}
</if>
<if test="filter.moduleID != null and filter.moduleID != ''">
AND module_id = #{filter.moduleID}
</if>
<if test="filter.name != null and filter.name != ''">
AND name LIKE CONCAT('%', #{filter.name}, '%')
</if>
<if test="filter.code != null and filter.code != ''">
AND code = #{filter.code}
</if>
<if test="filter.status != null">
AND status = #{filter.status}
</if>
<if test="filter.deleted != null">
AND deleted = #{filter.deleted}
</if>
</if>
AND deleted = 0
</where>
</sql>
<!-- 查询模块列表 -->
<select id="selectModules" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_sys_module
<include refid="Base_Where_Clause" />
ORDER BY order_num ASC, create_time DESC
</select>
<!-- 根据模块ID查询模块信息 -->
<select id="selectByModuleID" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_sys_module
WHERE module_id = #{moduleID} AND deleted = 0
</select>
<!-- 根据模块代码查询模块信息 -->
<select id="selectByCode" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_sys_module
WHERE code = #{code} AND deleted = 0
</select>
<!-- 查询启用的模块列表 -->
<select id="selectActiveModules" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_sys_module
WHERE status = 1 AND deleted = 0
ORDER BY order_num ASC, create_time DESC
</select>
<!-- 检查模块代码是否存在 -->
<select id="countByCode" resultType="int">
SELECT COUNT(1)
FROM tb_sys_module
WHERE code = #{code} AND deleted = 0
<if test="excludeID != null and excludeID != ''">
AND id != #{excludeID}
</if>
</select>
<!-- 插入模块 -->
<insert id="insertModule" parameterType="org.xyzh.common.dto.system.TbSysModule">
INSERT INTO tb_sys_module (
id, module_id, name, code, description, icon, order_num, status,
creator, updater, create_time, update_time, deleted
) VALUES (
#{id}, #{moduleID}, #{name}, #{code}, #{description}, #{icon}, #{orderNum}, #{status},
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleted}
)
</insert>
<!-- 更新模块 -->
<update id="updateModule" parameterType="org.xyzh.common.dto.system.TbSysModule">
UPDATE tb_sys_module
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="description != null">
description = #{description},
</if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="orderNum != null">
order_num = #{orderNum},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="updater != null and updater != ''">
updater = #{updater},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
WHERE id = #{id} AND deleted = 0
</update>
<!-- 删除模块 -->
<update id="deleteModule" parameterType="org.xyzh.common.dto.system.TbSysModule">
UPDATE tb_sys_module
SET deleted = 1, delete_time = #{deleteTime}
WHERE id = #{id} AND deleted = 0
</update>
<!-- 批量插入模块 -->
<insert id="batchInsertModules" parameterType="java.util.List">
INSERT INTO tb_sys_module (
id, module_id, name, code, description, icon, order_num, status,
creator, updater, create_time, update_time, deleted
) VALUES
<foreach collection="moduleList" item="module" separator=",">
(
#{module.id}, #{module.moduleID}, #{module.name}, #{module.code}, #{module.description},
#{module.icon}, #{module.orderNum}, #{module.status}, #{module.creator}, #{module.updater},
#{module.createTime}, #{module.updateTime}, #{module.deleted}
)
</foreach>
</insert>
<!-- 批量删除模块 -->
<update id="batchDeleteModules">
UPDATE tb_sys_module
SET deleted = 1, delete_time = NOW()
WHERE id IN
<foreach collection="moduleIDs" item="moduleID" open="(" separator="," close=")">
#{moduleID}
</foreach>
AND deleted = 0
</update>
<!-- 分页查询模块列表 -->
<select id="selectModulesPage" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_sys_module
<include refid="Base_Where_Clause" />
ORDER BY order_num ASC, create_time DESC
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
</select>
<!-- 统计模块数量 -->
<select id="countModules" resultType="long">
SELECT COUNT(1)
FROM tb_sys_module
<include refid="Base_Where_Clause" />
</select>
<!-- 更新模块状态 -->
<update id="updateModuleStatus">
UPDATE tb_sys_module
SET status = #{status}, update_time = NOW()
WHERE module_id = #{moduleID} AND deleted = 0
</update>
<!-- 更新模块排序 -->
<update id="updateModuleOrder">
UPDATE tb_sys_module
SET order_num = #{orderNum}, update_time = NOW()
WHERE module_id = #{moduleID} AND deleted = 0
</update>
</mapper>

View File

@@ -9,6 +9,7 @@
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="module_id" property="moduleID" jdbcType="VARCHAR"/>
<result column="creator" property="creator" jdbcType="VARCHAR"/>
<result column="updater" property="updater" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
@@ -48,7 +49,7 @@
<!-- 基础字段 -->
<sql id="Base_Column_List">
id, permission_id, name, code, description, creator, updater,
id, permission_id, name, code, description, module_id, creator, updater,
create_time, update_time, delete_time, deleted
</sql>
@@ -82,7 +83,7 @@
</select>
<!-- 根据角色ID查询权限列表 -->
<select id="selectPermissionsByRoleId" resultMap="BaseResultMap">
<select id="selectPermissionsByRoleID" resultMap="BaseResultMap">
SELECT
p.id, p.permission_id, p.name, p.code, p.description,
p.creator, p.updater,
@@ -91,7 +92,7 @@
INNER JOIN tb_sys_permission p ON p.permission_id = rp.permission_id
WHERE p.deleted = 0
AND rp.deleted = 0
AND rp.role_id = #{roleId}
AND rp.role_id = #{roleID}
ORDER BY p.create_time ASC
</select>
@@ -111,8 +112,8 @@
FROM tb_sys_permission
WHERE deleted = 0
AND name = #{permissionName}
<if test="excludeId != null and excludeId != ''">
AND id != #{excludeId}
<if test="excludeID != null and excludeID != ''">
AND id != #{excludeID}
</if>
</select>
@@ -122,8 +123,8 @@
FROM tb_sys_permission
WHERE deleted = 0
AND code = #{permissionCode}
<if test="excludeId != null and excludeId != ''">
AND id != #{excludeId}
<if test="excludeID != null and excludeID != ''">
AND id != #{excludeID}
</if>
</select>
@@ -287,4 +288,44 @@
AND tsrp.permission_id = #{permission.permissionID}
ORDER BY tsr.role_id, tsr.create_time ASC
</select>
<!-- 根据模块ID查询权限列表 -->
<select id="selectPermissionsByModuleID" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_sys_permission
WHERE module_id = #{moduleID} AND deleted = 0
ORDER BY create_time DESC
</select>
<!-- 绑定权限到模块 -->
<update id="bindPermissionsToModule">
UPDATE tb_sys_permission
SET module_id = #{moduleID}, update_time = NOW()
WHERE permission_id IN
<foreach collection="permissionIds" item="permissionId" open="(" separator="," close=")">
#{permissionId}
</foreach>
AND deleted = 0
</update>
<!-- 解绑模块的权限 -->
<update id="unbindPermissionsFromModule">
UPDATE tb_sys_permission
SET module_id = NULL, update_time = NOW()
WHERE permission_id IN
<foreach collection="permissionIds" item="permissionId" open="(" separator="," close=")">
#{permissionId}
</foreach>
AND module_id = #{moduleID}
AND deleted = 0
</update>
<!-- 获取模块的权限ID列表 -->
<select id="getModulePermissionIds" resultType="String">
SELECT permission_id
FROM tb_sys_permission
WHERE module_id = #{moduleID} AND deleted = 0
ORDER BY create_time DESC
</select>
</mapper>

View File

@@ -0,0 +1,283 @@
# 校园新闻管理系统 - 项目结构说明
## 概述
根据提供的结构图已创建完整的前端页面层级和Vue组件文件。本文档详细说明了创建的所有文件和目录结构。
## 目录结构
```
src/views/
├── home/ # 首页模块
│ ├── HomePage.vue # 首页主组件
│ └── components/ # 首页子组件
│ ├── LearningDataOverview.vue # 个人学习数据概览
│ ├── BookHallSection.vue # 书报馆件
│ ├── TopMusicRecommend.vue # TOP音乐推荐
│ ├── NewsOverview.vue # 新闻概览
│ ├── NavigationBar.vue # 导航栏
│ └── SearchIndex.vue # 搜索索引
├── resource-center/ # 资源中心模块
│ ├── ResourceCenterPage.vue # 资源中心主组件
│ └── components/ # 资源中心子组件
│ ├── MediaArchive.vue # 媒体档案
│ ├── PartyHistoryLearning.vue # 党史学习
│ ├── PolicySpeech.vue # 政策讲话
│ ├── PolicyInterpretation.vue # 政策解读
│ ├── RedClassic.vue # 红色经典
│ ├── SpecialReport.vue # 专题报告
│ └── WorldCase.vue # 世界案例
├── study-plan/ # 学习计划模块
│ ├── StudyPlanPage.vue # 学习计划主组件
│ └── components/ # 学习计划子组件
│ ├── StudyTasks.vue # 学习任务(包含任务列表、任务进度)
│ └── CourseCenter.vue # 课程中心(富文本课程)
├── user-center/ # 个人中心模块
│ ├── UserCenterPage.vue # 个人中心主组件
│ └── components/ # 个人中心子组件
│ ├── LearningRecords.vue # 学习记录
│ ├── MyFavorites.vue # 我的收藏
│ └── MyAchievements.vue # 我的成就
├── profile/ # 我导中心模块(头像进入)
│ ├── ProfilePage.vue # 我导中心主组件
│ └── components/ # 我导中心子组件
│ ├── PersonalInfo.vue # 个人信息
│ └── AccountSettings.vue # 账号设置
├── ai-assistant/ # 智能体模块
│ ├── AIAssistantPage.vue # AI助手主组件包含悬浮球
│ └── components/ # AI助手子组件
│ ├── ChatInterface.vue # 对话功能
│ ├── KnowledgeBase.vue # 知识库
│ ├── DialogHistory.vue # 历史对话记录加载
│ └── FileInterpretation.vue # 文件解读与记录(文件上传、历史文件加载)
└── admin/ # 后端管理模块
├── SystemOverview.vue # 系统总览(总用户数、总资源数、今日访问量、用户活跃度折线图、资源分类统计饼图)
├── ResourceManagement.vue # 资源管理主组件
├── LanguageManagement.vue # 语言管理主组件
├── StudyManagement.vue # 学习管理主组件
├── AIManagement.vue # 智能体管理主组件
├── SystemLogs.vue # 系统日志主组件
└── components/ # 后端管理子组件
├── ArticleManagement.vue # 文章储备(数据采集、新增文章、课程文章)
├── DataRecords.vue # 数据记录(菜单管理)
├── BannerManagement.vue # Banner管理
├── ColumnManagement.vue # 资源栏目管理
├── TagManagement.vue # 标签管理
├── TaskPublish.vue # 学习任务发布(任务名称、描述、周期、关联资源、接受对象)
├── StudyRecords.vue # 学习记录
├── AIConfig.vue # AI基础配置
├── KnowledgeManagement.vue # 知识库管理
├── LoginLogs.vue # 登录日志
├── OperationLogs.vue # 操作日志
└── SystemConfig.vue # 系统配置
```
## 已存在的管理模块
以下管理功能已在 `src/views/manage/system/` 中实现:
- `UserManageView.vue` - 用户管理
- `RoleManageView.vue` - 角色管理
- `PermissionManageView.vue` - 权限管理
- `DeptManageView.vue` - 部门管理(组织结构管理)
- `MenuManageView.vue` - 菜单管理
## 功能模块详细说明
### 前端功能
#### 1. 首页模块
- **个人学习数据概览**: 展示用户学习统计数据
- **书报馆件**: 图书资源展示
- **TOP音乐推荐**: 红色音乐推荐列表
- **新闻概览**: 最新思政新闻展示
- **导航栏**: 快速导航入口
- **搜索索引**: 热门标签和搜索功能
#### 2. 资源中心模块
- **媒体档案**: 视频、音频等媒体资源管理
- **党史学习**: 党史教育文章和资料(支持资源详情,二级文章向读者展示)
- **政策讲话**: 重要政策讲话内容
- **政策解读**: 政策文件解读说明
- **红色经典**: 红色经典作品展示
- **专题报告**: 各类专题报告内容
- **世界案例**: 国际案例学习资料
#### 3. 学习计划模块
- **学习任务**:
- 任务列表展示
- 任务进度跟踪
- 任务状态管理(未开始、进行中、已完成)
- **课程中心**: 富文本课程内容展示
#### 4. 个人中心模块
- **学习记录**: 个人学习历史记录
- **我的收藏**: 收藏的资源管理
- **我的成就**: 获得的成就展示
#### 5. 我导中心模块(头像入口)
- **个人信息**: 用户基本信息管理
- **账号设置**: 密码修改、安全设置
#### 6. 智能体模块
- **悬浮球**: 快速唤起AI助手
- **对话功能**: 智能问答交互
- **知识库**: AI知识库浏览
- **历史对话记录**: 对话历史加载
- **文件解读与记录**:
- 文件上传
- 历史文件加载
- AI文件解读
### 后端管理功能
#### 1. 系统总览
- **统计卡片**: 总用户数、总资源数、今日访问量、活跃用户
- **用户活跃度折线图**: 用户活跃度趋势分析
- **资源分类统计饼图**: 资源分类分布展示
- **今日访问量详情**: UV、PV、平均访问时长、跳出率
#### 2. 用户管理(已存在)
- 组织结构管理
- 用户管理
- 权限配置管理
#### 3. 资源管理
- **文章储备**:
- 数据采集功能
- 新增文章
- 课程文章管理
- **数据记录**: 菜单管理(已在系统管理中实现)
#### 4. 语言管理
- **Banner管理**: 首页轮播图管理
- **资源栏目管理**: 资源分类栏目配置
- **标签管理**: 资源标签维护
#### 5. 学习管理
- **学习任务发布**:
- 任务名称
- 任务描述
- 任务周期
- 关联资源/选择
- 任务接受对象(按部门/按权限/选人员)
- **学习记录**: 用户学习数据查看和导出
#### 6. 智能体管理
- **基础配置**: AI模型、API配置、对话参数设置
- **知识库管理**: AI知识库内容维护
#### 7. 系统日志
- **登录日志**: 用户登录记录
- **操作日志**: 系统操作审计
- **系统配置**: 系统参数设置
## 技术特点
### 1. 组件化设计
- 每个功能模块都有独立的主组件
- 复杂功能拆分为多个子组件
- 组件可复用性高
### 2. 标准化结构
- 统一的目录命名规范
- 一致的文件命名方式
- 清晰的层级关系
### 3. 功能完整性
- 覆盖所有结构图要求的功能点
- 包含完整的CRUD操作
- 支持数据筛选、分页、导出等常用功能
### 4. UI/UX设计
- 使用Element Plus组件库
- 响应式布局设计
- 现代化的UI风格
- 良好的交互体验
## 后续开发建议
### 1. API集成
所有组件中标记了 `TODO` 的地方需要接入实际的后端API
- 数据加载函数
- 表单提交处理
- 文件上传功能
- 实时数据更新
### 2. 状态管理
建议使用Vuex进行全局状态管理
- 用户信息状态
- 权限数据缓存
- 菜单树结构
- AI对话上下文
### 3. 路由配置
需要在 `src/router/` 中配置所有页面的路由:
- 路由路径定义
- 路由守卫配置
- 动态路由加载
- 权限路由过滤
### 4. 权限控制
实现完整的权限控制系统:
- 页面级权限
- 按钮级权限
- 数据级权限
- 角色权限映射
### 5. 数据可视化
系统总览页面需要集成ECharts
- 用户活跃度折线图
- 资源分类饼图
- 其他统计图表
### 6. 富文本编辑器
课程内容需要集成富文本编辑器:
- 推荐使用 TinyMCE 或 Quill
- 支持图片、视频上传
- 支持代码高亮
- 支持数学公式
### 7. 文件管理
完善文件上传和管理功能:
- 文件分片上传
- 断点续传
- 文件预览
- 批量操作
### 8. AI功能增强
智能体模块需要接入AI服务
- 对话流式输出
- 文件解读API
- 知识库检索
- 上下文管理
## 开发注意事项
1. **类型安全**: 所有组件都使用TypeScript需要定义完整的类型接口
2. **错误处理**: 添加适当的错误提示和异常处理
3. **加载状态**: 为异步操作添加loading状态
4. **数据验证**: 表单提交前进行数据验证
5. **性能优化**:
- 列表虚拟滚动
- 图片懒加载
- 组件按需加载
- 路由懒加载
6. **用户体验**:
- 添加骨架屏
- 优化加载动画
- 提供操作反馈
- 支持键盘快捷键
## 文件数量统计
- **主页面组件**: 10个
- **子组件**: 40+个
- **总计Vue文件**: 50+个
所有文件都已创建并包含基础的结构、样式和功能框架可以直接在此基础上进行API集成和功能完善。

200
schoolNewsWeb/README.md Normal file
View File

@@ -0,0 +1,200 @@
# 校园新闻管理系统
这是一个基于 Vue 3 + TypeScript + Vite 构建的现代化校园新闻管理系统前端项目。该系统提供了新闻管理、用户中心、AI 对话、学习计划等功能模块。
## 技术栈
- **框架**: Vue 3.5.22
- **构建工具**: Vite 5.0.0
- **语言**: TypeScript 4.5.5
- **UI 组件库**: Element Plus 2.11.4
- **状态管理**: Vuex 4.1.0
- **路由管理**: Vue Router 4.5.1
- **HTTP 客户端**: Axios 1.7.9
- **PWA 支持**: vite-plugin-pwa
## 功能模块
### 首页模块
- 横幅管理
- 菜单导航
- 新闻展示
- 推荐内容
- 搜索功能
- 统计数据
### 系统管理模块
- 用户管理
- 角色管理
- 权限管理
- 部门管理
- 菜单管理
- 文件管理
### 学习模块
- 课程管理
- 学习计划
- 学习任务
- 学习记录
### 用户中心模块
- 个人资料
- 浏览记录
- 收藏管理
- 成就系统
- 积分系统
### AI 助手模块
- 智能对话
- 知识库管理
- 消息管理
- 文件上传
- Agent 配置
## 项目结构
```
schoolNewsWeb/
├── src/
│ ├── apis/ # API 接口定义
│ │ ├── ai/ # AI 相关接口
│ │ ├── homepage/ # 首页相关接口
│ │ ├── study/ # 学习模块接口
│ │ ├── system/ # 系统管理接口
│ │ └── usercenter/ # 用户中心接口
│ ├── components/ # 公共组件
│ ├── directives/ # 自定义指令
│ ├── layouts/ # 布局组件
│ ├── router/ # 路由配置
│ ├── store/ # 状态管理
│ ├── types/ # TypeScript 类型定义
│ ├── utils/ # 工具函数
│ └── views/ # 页面组件
├── public/ # 静态资源
└── dist/ # 构建输出目录
```
## 环境要求
- Node.js >= 14.0.0
- npm >= 6.0.0 或 yarn >= 1.22.0
## 如何运行
### 1. 安装依赖
```bash
npm install
```
或者使用 yarn
```bash
yarn install
```
### 2. 启动开发服务器
```bash
npm run dev
```
或者:
```bash
npm run serve
```
开发服务器将在 `http://localhost:8080` 启动,并自动打开浏览器。
### 3. 后端API配置
项目默认将 `/api` 路径代理到 `http://127.0.0.1:8081/schoolNewsServ`
如需修改后端地址,请编辑 `vite.config.js` 文件中的 proxy 配置:
```javascript
proxy: {
'/api': {
target: 'http://your-backend-url',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
```
## 如何构建
### 构建生产版本
```bash
npm run build
```
构建产物将输出到 `dist/` 目录。
### 预览构建结果
```bash
npm run preview
```
## 代码规范
### 运行代码检查
```bash
npm run lint
```
项目使用 ESLint 进行代码检查,配置了 TypeScript 和 Vue 相关的规则。
## 功能特性
### PWA 支持
项目已配置 PWA 支持,可以作为渐进式 Web 应用安装到设备上。
### 权限系统
- 基于角色的权限控制RBAC
- 自定义指令进行权限校验
- 动态路由生成
### 响应式设计
- 适配桌面端和移动端
- 现代化的 UI 设计
- 优秀的用户体验
## 开发说明
### 路径别名
项目配置了 `@` 作为 `src` 目录的别名,可以这样导入模块:
```typescript
import { someFunction } from '@/utils/helper'
import MyComponent from '@/components/MyComponent.vue'
```
### 环境变量
项目定义了以下环境变量:
- `process.env.BASE_URL`: `/schoolNewsWeb/`
- `process.env.VITE_API_BASE_URL`: `/api`
- `process.env.VITE_APP_TITLE`: `校园新闻管理系统`
## 浏览器支持
支持所有现代浏览器的最新两个版本:
- Chrome
- Firefox
- Safari
- Edge
## 许可证
私有项目
## 联系方式
如有问题或建议,请联系项目维护团队。

View File

@@ -10,6 +10,7 @@
"dependencies": {
"axios": "^1.7.9",
"core-js": "^3.8.3",
"echarts": "^6.0.0",
"element-plus": "^2.11.4",
"register-service-worker": "^1.7.2",
"vue": "^3.5.22",
@@ -17,6 +18,7 @@
"vuex": "^4.1.0"
},
"devDependencies": {
"@types/echarts": "^4.9.22",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vitejs/plugin-vue": "^5.0.0",
@@ -2787,6 +2789,16 @@
"string.prototype.matchall": "^4.0.6"
}
},
"node_modules/@types/echarts": {
"version": "4.9.22",
"resolved": "https://registry.npmmirror.com/@types/echarts/-/echarts-4.9.22.tgz",
"integrity": "sha512-7Fo6XdWpoi8jxkwP7BARUOM7riq8bMhmsCtSG8gzUcJmFhLo387tihoBYS/y5j7jl3PENT5RxeWZdN9RiwO7HQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/zrender": "*"
}
},
"node_modules/@types/estree": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.8.tgz",
@@ -2848,6 +2860,13 @@
"integrity": "sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==",
"license": "MIT"
},
"node_modules/@types/zrender": {
"version": "4.0.6",
"resolved": "https://registry.npmmirror.com/@types/zrender/-/zrender-4.0.6.tgz",
"integrity": "sha512-1jZ9bJn2BsfmYFPBHtl5o3uV+ILejAtGrDcYSpT4qaVKEI/0YY+arw3XHU04Ebd8Nca3SQ7uNcLaqiL+tTFVMg==",
"dev": true,
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.62.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz",
@@ -4067,6 +4086,16 @@
"node": ">= 0.4"
}
},
"node_modules/echarts": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-6.0.0.tgz",
"integrity": "sha512-Tte/grDQRiETQP4xz3iZWSvoHrkCQtwqd6hs+mifXcjrCuo2iKWbajFObuLJVBlDIJlOzgQPd1hsaKt/3+OMkQ==",
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.3.0",
"zrender": "6.0.0"
}
},
"node_modules/ejs": {
"version": "3.1.10",
"resolved": "https://registry.npmmirror.com/ejs/-/ejs-3.1.10.tgz",
@@ -7281,6 +7310,12 @@
"node": ">=8.0"
}
},
"node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
"license": "0BSD"
},
"node_modules/tsutils": {
"version": "3.21.0",
"resolved": "https://registry.npmmirror.com/tsutils/-/tsutils-3.21.0.tgz",
@@ -8341,6 +8376,15 @@
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true,
"license": "ISC"
},
"node_modules/zrender": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-6.0.0.tgz",
"integrity": "sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg==",
"license": "BSD-3-Clause",
"dependencies": {
"tslib": "2.3.0"
}
}
}
}

View File

@@ -13,6 +13,7 @@
"dependencies": {
"axios": "^1.7.9",
"core-js": "^3.8.3",
"echarts": "^6.0.0",
"element-plus": "^2.11.4",
"register-service-worker": "^1.7.2",
"vue": "^3.5.22",
@@ -20,6 +21,7 @@
"vuex": "^4.1.0"
},
"devDependencies": {
"@types/echarts": "^4.9.22",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vitejs/plugin-vue": "^5.0.0",

View File

@@ -0,0 +1,4 @@
<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.00002 8.70713L12.2999 5.40727L13.2427 6.35009L9.00002 10.5927L4.75742 6.35009L5.70022 5.40727L9.00002 8.70713Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 MiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,3 @@
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.5 0C11.642 0 15 3.358 15 7.5C15 9.2 14.4 10.8 13.4 12L16.7 15.3C17.1 15.7 17.1 16.3 16.7 16.7C16.3 17.1 15.7 17.1 15.3 16.7L12 13.4C10.8 14.4 9.2 15 7.5 15C3.358 15 0 11.642 0 7.5C0 3.358 3.358 0 7.5 0ZM7.5 2C4.462 2 2 4.462 2 7.5C2 10.538 4.462 13 7.5 13C10.538 13 13 10.538 13 7.5C13 4.462 10.538 2 7.5 2Z" fill="#ffffff"/>
</svg>

After

Width:  |  Height:  |  Size: 443 B

View File

@@ -3,8 +3,8 @@
<div class="nav-container">
<!-- Logo区域 -->
<div class="nav-logo">
<img src="@/assets/logo.png" alt="Logo" />
<span class="logo-text">校园新闻</span>
<img src="@/assets/imgs/logo-icon.svg" alt="Logo" class="logo-icon" />
<span class="logo-text">红色思政学习平台</span>
</div>
<!-- 导航菜单 -->
@@ -14,37 +14,54 @@
:key="menu.menuID"
class="nav-item"
:class="{ active: isActive(menu) }"
@mouseenter="handleMouseEnter(menu)"
@mouseenter="(e) => handleMouseEnter(menu, e)"
@mouseleave="handleMouseLeave"
>
<div class="nav-link" @click="handleNavClick(menu)">
<i v-if="menu.icon" :class="menu.icon" class="nav-icon"></i>
<span>{{ menu.name }}</span>
<i v-if="hasNavigationChildren(menu)" class="arrow-down"></i>
<img v-if="hasNavigationChildren(menu)" class="arrow-down" src="@/assets/imgs/arrow-down.svg" alt="arrow" />
</div>
<!-- 下拉菜单 -->
<div
v-if="hasNavigationChildren(menu)"
class="dropdown-menu"
:class="{ show: activeDropdown === menu.menuID }"
>
<Teleport to="body">
<div
v-for="child in getNavigationChildren(menu)"
:key="child.menuID"
class="dropdown-item"
:class="{ active: isActive(child) }"
@click="handleNavClick(child)"
v-if="hasNavigationChildren(menu)"
class="dropdown-menu"
:class="{ show: activeDropdown === menu.menuID }"
:style="getDropdownPosition(menu)"
@mouseenter="handleMouseEnter(menu)"
@mouseleave="handleMouseLeave"
>
<i v-if="child.icon" :class="child.icon" class="dropdown-icon"></i>
<span>{{ child.name }}</span>
<div
v-for="child in getNavigationChildren(menu)"
:key="child.menuID"
class="dropdown-item"
:class="{ active: isActive(child) }"
@click="handleNavClick(child)"
>
<span>{{ child.name }}</span>
</div>
</div>
</Teleport>
</div>
</div>
<!-- 右侧用户区域 -->
<div class="nav-right">
<!-- 搜索框 -->
<div class="nav-search">
<div class="search-box">
<input
type="text"
placeholder="搜索思政资源"
class="search-input"
v-model="searchKeyword"
@keyup.enter="handleSearch"
/>
<div class="search-icon">
<img src="@/assets/imgs/search-icon.svg" alt="搜索" />
</div>
</div>
</div>
</div>
<!-- 右侧用户区域 -->
<div class="nav-right">
<UserDropdown :user="userInfo" @logout="handleLogout" />
</div>
</div>
@@ -65,6 +82,8 @@ const route = useRoute();
const store = useStore();
const activeDropdown = ref<string | null>(null);
const searchKeyword = ref('');
const dropdownPositions = ref<Record<string, { left: number; top: number; width: number }>>({});
// 获取所有菜单
const allMenus = computed(() => store.getters['auth/menuTree']);
@@ -72,7 +91,17 @@ const userInfo = computed(() => store.getters['auth/userInfo']);
// 获取第一层的导航菜单MenuType.NAVIGATION
const navigationMenus = computed(() => {
return allMenus.value.filter((menu: SysMenu) => menu.type === MenuType.NAVIGATION);
const menus = allMenus.value.filter((menu: SysMenu) => menu.type === MenuType.NAVIGATION);
console.log('导航菜单数据:', menus);
menus.forEach((menu: SysMenu) => {
console.log(`菜单 ${menu.name}:`, {
menuID: menu.menuID,
parentID: menu.parentID,
children: menu.children,
childrenCount: menu.children?.length || 0
});
});
return menus;
});
// 检查菜单是否有导航类型的子菜单
@@ -82,8 +111,13 @@ function hasNavigationChildren(menu: SysMenu): boolean {
// 获取导航类型的子菜单
function getNavigationChildren(menu: SysMenu): SysMenu[] {
if (!menu.children) return [];
return menu.children.filter(child => child.type === MenuType.NAVIGATION);
if (!menu.children) {
console.log(`菜单 ${menu.name} 没有子菜单`);
return [];
}
const children = menu.children.filter(child => child.type === MenuType.NAVIGATION);
console.log(`菜单 ${menu.name} 的子菜单:`, children);
return children;
}
// 判断菜单是否激活
@@ -113,12 +147,39 @@ function isMenuOrChildActive(menu: SysMenu): boolean {
}
// 处理鼠标进入
function handleMouseEnter(menu: SysMenu) {
function handleMouseEnter(menu: SysMenu, event?: MouseEvent) {
if (hasNavigationChildren(menu)) {
activeDropdown.value = menu.menuID || null;
// 计算下拉菜单位置
const target = event?.currentTarget as HTMLElement;
if (target && menu.menuID) {
const rect = target.getBoundingClientRect();
dropdownPositions.value[menu.menuID] = {
left: rect.left,
top: rect.bottom,
width: rect.width
};
}
}
}
// 获取下拉菜单位置样式
function getDropdownPosition(menu: SysMenu) {
const menuID = menu.menuID;
if (!menuID || !dropdownPositions.value[menuID]) {
return {};
}
const pos = dropdownPositions.value[menuID];
return {
position: 'fixed' as const,
left: `${pos.left}px`,
top: `${pos.top}px`,
width: `${pos.width}px`
};
}
// 处理鼠标离开
function handleMouseLeave() {
activeDropdown.value = null;
@@ -139,6 +200,14 @@ function handleNavClick(menu: SysMenu) {
}
}
// 处理搜索
function handleSearch() {
if (searchKeyword.value.trim()) {
// 这里可以跳转到搜索页面或触发搜索功能
router.push(`/search?keyword=${encodeURIComponent(searchKeyword.value.trim())}`);
}
}
// 处理登出
function handleLogout() {
store.dispatch('auth/logout');
@@ -147,9 +216,9 @@ function handleLogout() {
<style lang="scss" scoped>
.top-navigation {
height: 64px;
background: #001529;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
height: 76px;
background: #ffffff;
border-bottom: 1px solid rgba(72, 72, 72, 0.1);
position: sticky;
top: 0;
z-index: 1000;
@@ -159,49 +228,91 @@ function handleLogout() {
height: 100%;
display: flex;
align-items: center;
padding: 0 24px;
max-width: 1920px;
padding: 0 50px;
margin: 0 auto;
gap: 20px;
width: 100%;
position: relative;
}
.nav-logo {
display: flex;
align-items: center;
margin-right: 48px;
gap: 8px;
cursor: pointer;
img {
width: 32px;
height: 32px;
margin-right: 12px;
.logo-icon {
width: 28px;
height: 28px;
display: block;
}
.logo-text {
font-size: 20px;
font-weight: 600;
color: white;
font-family: 'PingFang SC', sans-serif;
font-weight: 700;
font-size: 20.6px;
line-height: 1.31;
color: #C62828;
white-space: nowrap;
}
}
.nav-menu {
flex: 1;
display: flex;
align-items: center;
gap: 8px;
gap: 0;
flex: 1;
overflow-x: auto;
overflow-y: hidden;
scroll-behavior: smooth;
padding-bottom: 2px; /* 为滚动条留出空间 */
/* 自定义滚动条样式 */
scrollbar-width: thin;
scrollbar-color: #C62828 #f5f5f5;
&::-webkit-scrollbar {
height: 6px;
}
&::-webkit-scrollbar-track {
background: #f5f5f5;
border-radius: 3px;
}
&::-webkit-scrollbar-thumb {
background: #C62828;
border-radius: 3px;
&:hover {
background: #B71C1C;
}
}
/* 当内容可以滚动时显示滚动条 */
&:hover::-webkit-scrollbar-thumb {
background: #C62828;
}
}
.nav-item {
position: relative;
height: 64px;
height: 76px;
display: flex;
align-items: center;
flex-shrink: 0; /* 防止菜单项被压缩 */
&:hover {
.nav-link {
background: #f5f5f5;
font-weight: 600;
}
}
&:hover,
&.active {
.nav-link {
background: rgba(255, 255, 255, 0.1);
color: #fff;
color: #C62828;
font-weight: 600;
}
}
}
@@ -210,27 +321,27 @@ function handleLogout() {
height: 100%;
display: flex;
align-items: center;
gap: 8px;
padding: 0 20px;
color: rgba(255, 255, 255, 0.85);
justify-content: center;
gap: 2px;
padding: 26px 21px;
color: #141F38;
font-family: 'PingFang SC', sans-serif;
font-weight: 500;
font-size: 16px;
line-height: 1.5;
cursor: pointer;
transition: all 0.3s;
white-space: nowrap;
user-select: none;
min-width: 106px;
&:hover {
background: rgba(255, 255, 255, 0.1);
color: #fff;
}
.nav-icon {
font-size: 18px;
color: #C62828;
}
.arrow-down {
font-size: 10px;
margin-left: 4px;
font-size: 8px;
margin-left: 2px;
transition: transform 0.3s;
}
@@ -240,10 +351,6 @@ function handleLogout() {
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
min-width: 180px;
background: white;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
@@ -251,42 +358,166 @@ function handleLogout() {
visibility: hidden;
transform: translateY(-10px);
transition: all 0.3s;
z-index: 1001;
z-index: 10000;
pointer-events: none;
&.show {
opacity: 1;
visibility: visible;
transform: translateY(0);
pointer-events: auto;
}
}
.dropdown-item {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 20px;
padding: 12px 16px;
color: #333;
font-family: 'PingFang SC', sans-serif;
font-weight: 400;
font-size: 14px;
line-height: 1.5;
cursor: pointer;
transition: all 0.3s;
white-space: nowrap;
&:hover {
background: #f5f5f5;
color: #1890ff;
color: #C62828;
}
&.active {
background: #e6f7ff;
color: #1890ff;
background: #ffe6e6;
color: #C62828;
font-weight: 500;
}
}
.nav-search {
margin-left: auto;
margin-right: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.search-box {
position: relative;
width: 221px;
height: 36px;
border: 1px solid #BAC0CC;
border-radius: 30px;
background: white;
display: flex;
align-items: center;
overflow: hidden;
.search-input {
flex: 1;
height: 100%;
border: none;
outline: none;
padding: 7px 20px;
font-family: 'PingFang SC', sans-serif;
font-weight: 400;
font-size: 14px;
line-height: 1.57;
color: #333;
&::placeholder {
color: rgba(0, 0, 0, 0.3);
}
}
.dropdown-icon {
font-size: 16px;
.search-icon {
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
width: 17px;
height: 17px;
display: flex;
align-items: center;
justify-content: center;
background: #C62828;
border-radius: 50%;
padding: 2px;
img {
width: 14px;
height: 14px;
}
}
}
.nav-right {
margin-left: auto;
display: flex;
flex-shrink: 0; /* 防止右侧区域被压缩 */
}
/* 响应式设计 */
@media (max-width: 1200px) {
.nav-container {
padding: 0 30px;
gap: 15px;
}
.nav-link {
min-width: 90px;
padding: 26px 15px;
font-size: 15px;
}
.nav-menu {
/* 在小屏幕上确保滚动条可见 */
scrollbar-width: auto;
}
}
@media (max-width: 768px) {
.nav-container {
padding: 0 20px;
gap: 10px;
}
.nav-logo .logo-text {
font-size: 18px;
}
.nav-link {
min-width: 80px;
padding: 26px 12px;
font-size: 14px;
}
.search-box {
width: 180px;
}
}
@media (max-width: 480px) {
.nav-container {
padding: 0 15px;
gap: 8px;
}
.nav-logo .logo-text {
font-size: 16px;
}
.nav-link {
min-width: 70px;
padding: 26px 10px;
font-size: 13px;
}
.search-box {
width: 150px;
}
}
</style>

View File

@@ -64,7 +64,7 @@ export const routes: Array<RouteRecordRaw> = [
{
path: "",
name: "Home",
component: () => import("@/views/Home.vue"),
component: () => import("@/views/HomeView.vue"),
meta: {
title: "首页",
requiresAuth: false,

View File

@@ -183,8 +183,11 @@ const authModule: Module<AuthState, any> = {
// 登录
async login({ commit, dispatch, state }, loginParam) {
try {
const loginDomain = await authApi.login(loginParam);
const result = await authApi.login(loginParam);
if(result.code !== 200) {
return Promise.reject(result.message);
}
const loginDomain = result.data;
// 保存登录信息
commit('SET_LOGIN_DOMAIN', loginDomain);

View File

@@ -0,0 +1,123 @@
<template>
<div class="ai-config">
<el-form :model="configForm" label-width="150px" class="config-form">
<el-divider content-position="left">模型配置</el-divider>
<el-form-item label="AI模型">
<el-select v-model="configForm.model" placeholder="选择AI模型">
<el-option label="GPT-3.5" value="gpt-3.5" />
<el-option label="GPT-4" value="gpt-4" />
<el-option label="Claude" value="claude" />
</el-select>
</el-form-item>
<el-form-item label="API Key">
<el-input v-model="configForm.apiKey" type="password" show-password />
</el-form-item>
<el-form-item label="API地址">
<el-input v-model="configForm.apiUrl" />
</el-form-item>
<el-divider content-position="left">对话配置</el-divider>
<el-form-item label="温度值">
<el-slider v-model="configForm.temperature" :min="0" :max="2" :step="0.1" show-input />
<span class="help-text">控制回答的随机性值越大回答越随机</span>
</el-form-item>
<el-form-item label="最大token数">
<el-input-number v-model="configForm.maxTokens" :min="100" :max="4000" />
</el-form-item>
<el-form-item label="历史对话轮数">
<el-input-number v-model="configForm.historyTurns" :min="1" :max="20" />
</el-form-item>
<el-divider content-position="left">功能配置</el-divider>
<el-form-item label="启用流式输出">
<el-switch v-model="configForm.enableStreaming" />
</el-form-item>
<el-form-item label="启用文件解读">
<el-switch v-model="configForm.enableFileInterpretation" />
</el-form-item>
<el-form-item label="启用知识库检索">
<el-switch v-model="configForm.enableKnowledgeRetrieval" />
</el-form-item>
<el-form-item label="系统提示词">
<el-input
v-model="configForm.systemPrompt"
type="textarea"
:rows="6"
placeholder="设置AI助手的角色和行为..."
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSave">保存配置</el-button>
<el-button @click="handleTest">测试连接</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElForm, ElFormItem, ElSelect, ElOption, ElInput, ElSlider, ElInputNumber, ElSwitch, ElButton, ElDivider, ElMessage } from 'element-plus';
const configForm = ref({
model: 'gpt-3.5',
apiKey: '',
apiUrl: '',
temperature: 0.7,
maxTokens: 2000,
historyTurns: 5,
enableStreaming: true,
enableFileInterpretation: true,
enableKnowledgeRetrieval: true,
systemPrompt: ''
});
onMounted(() => {
loadConfig();
});
function loadConfig() {
// TODO: 加载AI配置
}
function handleSave() {
// TODO: 保存配置
ElMessage.success('配置保存成功');
}
function handleTest() {
// TODO: 测试API连接
ElMessage.info('正在测试连接...');
}
function handleReset() {
// TODO: 重置配置
}
</script>
<style lang="scss" scoped>
.ai-config {
padding: 20px;
max-width: 800px;
}
.config-form {
.help-text {
font-size: 12px;
color: #999;
margin-left: 12px;
}
}
</style>

View File

@@ -0,0 +1,37 @@
<template>
<div class="ai-management">
<h1 class="page-title">智能体管理</h1>
<el-tabs v-model="activeTab">
<el-tab-pane label="基础配置" name="config">
<AIConfig />
</el-tab-pane>
<el-tab-pane label="知识库管理" name="knowledge">
<KnowledgeManagement />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElTabs, ElTabPane } from 'element-plus';
import AIConfig from './components/AIConfig.vue';
import KnowledgeManagement from './components/KnowledgeManagement.vue';
const activeTab = ref('config');
</script>
<style lang="scss" scoped>
.ai-management {
padding: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
</style>

View File

@@ -0,0 +1,119 @@
<template>
<div class="knowledge-management">
<div class="action-bar">
<el-button type="primary" @click="showCreateDialog">+ 新增知识</el-button>
<el-button @click="handleImport">批量导入</el-button>
<el-input
v-model="searchKeyword"
placeholder="搜索知识..."
style="width: 300px"
clearable
/>
</div>
<el-table :data="knowledgeList" style="width: 100%">
<el-table-column prop="title" label="标题" min-width="200" />
<el-table-column prop="category" label="分类" width="120" />
<el-table-column prop="tags" label="标签" width="200">
<template #default="{ row }">
<el-tag v-for="tag in row.tags" :key="tag" size="small" style="margin-right: 4px;">
{{ tag }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-switch
v-model="row.status"
@change="toggleStatus(row)"
/>
</template>
</el-table-column>
<el-table-column prop="updateDate" label="更新时间" width="150" />
<el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="editKnowledge(row)">编辑</el-button>
<el-button size="small" type="danger" @click="deleteKnowledge(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElSwitch, ElPagination, ElMessage } from 'element-plus';
const searchKeyword = ref('');
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const knowledgeList = ref<any[]>([]);
onMounted(() => {
loadKnowledge();
});
function loadKnowledge() {
// TODO: 加载知识库数据
}
function showCreateDialog() {
// TODO: 显示创建知识对话框
}
function handleImport() {
// TODO: 批量导入
ElMessage.info('批量导入功能开发中');
}
function editKnowledge(row: any) {
// TODO: 编辑知识
}
function deleteKnowledge(row: any) {
// TODO: 删除知识
ElMessage.success('删除成功');
}
function toggleStatus(row: any) {
// TODO: 切换状态
}
function handleSizeChange(val: number) {
pageSize.value = val;
loadKnowledge();
}
function handleCurrentChange(val: number) {
currentPage.value = val;
loadKnowledge();
}
</script>
<style lang="scss" scoped>
.knowledge-management {
padding: 20px;
}
.action-bar {
display: flex;
gap: 16px;
margin-bottom: 20px;
align-items: center;
}
.el-table {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,82 @@
<template>
<div class="banner-management">
<div class="action-bar">
<el-button type="primary" @click="showCreateDialog">+ 新增Banner</el-button>
</div>
<el-table :data="banners" style="width: 100%">
<el-table-column label="预览" width="200">
<template #default="{ row }">
<img :src="row.image" class="banner-preview" />
</template>
</el-table-column>
<el-table-column prop="title" label="标题" min-width="150" />
<el-table-column prop="linkUrl" label="链接地址" min-width="200" />
<el-table-column prop="sort" label="排序" width="80" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-switch
v-model="row.status"
@change="toggleStatus(row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="editBanner(row)">编辑</el-button>
<el-button size="small" type="danger" @click="deleteBanner(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElButton, ElTable, ElTableColumn, ElSwitch, ElMessage } from 'element-plus';
const banners = ref<any[]>([]);
onMounted(() => {
loadBanners();
});
function loadBanners() {
// TODO: 加载Banner数据
}
function showCreateDialog() {
// TODO: 显示创建Banner对话框
}
function editBanner(row: any) {
// TODO: 编辑Banner
}
function deleteBanner(row: any) {
// TODO: 删除Banner
ElMessage.success('删除成功');
}
function toggleStatus(row: any) {
// TODO: 切换Banner状态
}
</script>
<style lang="scss" scoped>
.banner-management {
padding: 20px;
}
.action-bar {
margin-bottom: 20px;
}
.banner-preview {
width: 100%;
height: 80px;
object-fit: cover;
border-radius: 4px;
}
</style>

View File

@@ -0,0 +1,65 @@
<template>
<div class="column-management">
<div class="action-bar">
<el-button type="primary" @click="showCreateDialog">+ 新增栏目</el-button>
</div>
<el-table :data="columns" style="width: 100%" row-key="id" :tree-props="{children: 'children'}">
<el-table-column prop="name" label="栏目名称" min-width="200" />
<el-table-column prop="code" label="栏目编码" width="150" />
<el-table-column prop="sort" label="排序" width="80" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="row.status ? 'success' : 'info'">
{{ row.status ? '启用' : '禁用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="editColumn(row)">编辑</el-button>
<el-button size="small" type="danger" @click="deleteColumn(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElButton, ElTable, ElTableColumn, ElTag, ElMessage } from 'element-plus';
const columns = ref<any[]>([]);
onMounted(() => {
loadColumns();
});
function loadColumns() {
// TODO: 加载栏目数据
}
function showCreateDialog() {
// TODO: 显示创建栏目对话框
}
function editColumn(row: any) {
// TODO: 编辑栏目
}
function deleteColumn(row: any) {
// TODO: 删除栏目
ElMessage.success('删除成功');
}
</script>
<style lang="scss" scoped>
.column-management {
padding: 20px;
}
.action-bar {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,41 @@
<template>
<div class="language-management">
<h1 class="page-title">语言管理</h1>
<el-tabs v-model="activeTab">
<el-tab-pane label="Banner管理" name="banner">
<BannerManagement />
</el-tab-pane>
<el-tab-pane label="资源栏目管理" name="column">
<ColumnManagement />
</el-tab-pane>
<el-tab-pane label="标签管理" name="tag">
<TagManagement />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElTabs, ElTabPane } from 'element-plus';
import BannerManagement from './components/BannerManagement.vue';
import ColumnManagement from './components/ColumnManagement.vue';
import TagManagement from './components/TagManagement.vue';
const activeTab = ref('banner');
</script>
<style lang="scss" scoped>
.language-management {
padding: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
</style>

View File

@@ -0,0 +1,81 @@
<template>
<div class="tag-management">
<div class="action-bar">
<el-button type="primary" @click="showCreateDialog">+ 新增标签</el-button>
<el-input
v-model="searchKeyword"
placeholder="搜索标签..."
style="width: 300px"
clearable
/>
</div>
<el-table :data="tags" style="width: 100%">
<el-table-column prop="name" label="标签名称" min-width="150" />
<el-table-column prop="category" label="标签分类" width="120" />
<el-table-column prop="color" label="颜色" width="100">
<template #default="{ row }">
<div class="color-preview" :style="{ background: row.color }"></div>
</template>
</el-table-column>
<el-table-column prop="usageCount" label="使用次数" width="100" />
<el-table-column prop="createDate" label="创建时间" width="150" />
<el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="editTag(row)">编辑</el-button>
<el-button size="small" type="danger" @click="deleteTag(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElButton, ElInput, ElTable, ElTableColumn, ElMessage } from 'element-plus';
const searchKeyword = ref('');
const tags = ref<any[]>([]);
onMounted(() => {
loadTags();
});
function loadTags() {
// TODO: 加载标签数据
}
function showCreateDialog() {
// TODO: 显示创建标签对话框
}
function editTag(row: any) {
// TODO: 编辑标签
}
function deleteTag(row: any) {
// TODO: 删除标签
ElMessage.success('删除成功');
}
</script>
<style lang="scss" scoped>
.tag-management {
padding: 20px;
}
.action-bar {
display: flex;
gap: 16px;
margin-bottom: 20px;
align-items: center;
}
.color-preview {
width: 40px;
height: 24px;
border-radius: 4px;
border: 1px solid #e0e0e0;
}
</style>

View File

@@ -0,0 +1,123 @@
<template>
<div class="login-logs">
<div class="filter-bar">
<el-input
v-model="searchKeyword"
placeholder="搜索用户名..."
style="width: 200px"
clearable
/>
<el-select v-model="loginStatus" placeholder="登录状态" style="width: 150px" clearable>
<el-option label="成功" value="success" />
<el-option label="失败" value="failed" />
</el-select>
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleExport">导出</el-button>
<el-button type="danger" @click="handleClear">清空日志</el-button>
</div>
<el-table :data="logs" style="width: 100%">
<el-table-column prop="username" label="用户名" width="120" />
<el-table-column prop="ipAddress" label="IP地址" width="140" />
<el-table-column prop="location" label="登录地点" width="150" />
<el-table-column prop="browser" label="浏览器" width="120" />
<el-table-column prop="os" label="操作系统" width="120" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="row.status === 'success' ? 'success' : 'danger'">
{{ row.status === 'success' ? '成功' : '失败' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="message" label="信息" min-width="150" />
<el-table-column prop="loginTime" label="登录时间" width="180" />
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElInput, ElSelect, ElOption, ElDatePicker, ElButton, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage, ElMessageBox } from 'element-plus';
const searchKeyword = ref('');
const loginStatus = ref('');
const dateRange = ref<[Date, Date] | null>(null);
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const logs = ref<any[]>([]);
onMounted(() => {
loadLogs();
});
function loadLogs() {
// TODO: 加载登录日志
}
function handleSearch() {
currentPage.value = 1;
loadLogs();
}
function handleExport() {
// TODO: 导出日志
ElMessage.info('导出功能开发中');
}
async function handleClear() {
try {
await ElMessageBox.confirm('确定要清空所有登录日志吗?此操作不可恢复!', '警告', {
type: 'warning'
});
// TODO: 清空日志
ElMessage.success('日志已清空');
} catch {
// 取消操作
}
}
function handleSizeChange(val: number) {
pageSize.value = val;
loadLogs();
}
function handleCurrentChange(val: number) {
currentPage.value = val;
loadLogs();
}
</script>
<style lang="scss" scoped>
.login-logs {
padding: 20px;
}
.filter-bar {
display: flex;
gap: 16px;
margin-bottom: 20px;
align-items: center;
}
.el-table {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,147 @@
<template>
<div class="operation-logs">
<div class="filter-bar">
<el-input
v-model="searchKeyword"
placeholder="搜索用户名或操作..."
style="width: 250px"
clearable
/>
<el-select v-model="operationType" placeholder="操作类型" style="width: 150px" clearable>
<el-option label="新增" value="create" />
<el-option label="修改" value="update" />
<el-option label="删除" value="delete" />
<el-option label="查询" value="read" />
</el-select>
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleExport">导出</el-button>
</div>
<el-table :data="logs" style="width: 100%">
<el-table-column prop="username" label="操作人" width="120" />
<el-table-column prop="module" label="操作模块" width="120" />
<el-table-column prop="operation" label="操作类型" width="100">
<template #default="{ row }">
<el-tag :type="getOperationType(row.operation)">
{{ getOperationText(row.operation) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="description" label="操作描述" min-width="200" />
<el-table-column prop="ipAddress" label="IP地址" width="140" />
<el-table-column prop="duration" label="耗时(ms)" width="100" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="row.status === 'success' ? 'success' : 'danger'">
{{ row.status === 'success' ? '成功' : '失败' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="operationTime" label="操作时间" width="180" />
<el-table-column label="操作" width="100" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="viewDetail(row)">详情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElInput, ElSelect, ElOption, ElDatePicker, ElButton, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage } from 'element-plus';
const searchKeyword = ref('');
const operationType = ref('');
const dateRange = ref<[Date, Date] | null>(null);
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const logs = ref<any[]>([]);
onMounted(() => {
loadLogs();
});
function loadLogs() {
// TODO: 加载操作日志
}
function handleSearch() {
currentPage.value = 1;
loadLogs();
}
function handleExport() {
// TODO: 导出日志
ElMessage.info('导出功能开发中');
}
function getOperationType(type: string) {
const typeMap: Record<string, any> = {
'create': 'success',
'update': 'warning',
'delete': 'danger',
'read': 'info'
};
return typeMap[type] || 'info';
}
function getOperationText(type: string) {
const textMap: Record<string, string> = {
'create': '新增',
'update': '修改',
'delete': '删除',
'read': '查询'
};
return textMap[type] || type;
}
function viewDetail(row: any) {
// TODO: 查看操作详情
}
function handleSizeChange(val: number) {
pageSize.value = val;
loadLogs();
}
function handleCurrentChange(val: number) {
currentPage.value = val;
loadLogs();
}
</script>
<style lang="scss" scoped>
.operation-logs {
padding: 20px;
}
.filter-bar {
display: flex;
gap: 16px;
margin-bottom: 20px;
align-items: center;
}
.el-table {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,190 @@
<template>
<div class="system-config">
<el-form :model="configForm" label-width="150px" class="config-form">
<el-divider content-position="left">基本设置</el-divider>
<el-form-item label="系统名称">
<el-input v-model="configForm.systemName" />
</el-form-item>
<el-form-item label="系统Logo">
<el-upload
class="logo-uploader"
action="#"
:show-file-list="false"
:before-upload="beforeLogoUpload"
>
<img v-if="configForm.logo" :src="configForm.logo" class="logo-preview" />
<el-icon v-else class="logo-uploader-icon">+</el-icon>
</el-upload>
</el-form-item>
<el-form-item label="版权信息">
<el-input v-model="configForm.copyright" />
</el-form-item>
<el-divider content-position="left">安全设置</el-divider>
<el-form-item label="启用验证码">
<el-switch v-model="configForm.enableCaptcha" />
</el-form-item>
<el-form-item label="密码最小长度">
<el-input-number v-model="configForm.minPasswordLength" :min="6" :max="20" />
</el-form-item>
<el-form-item label="会话超时(分钟)">
<el-input-number v-model="configForm.sessionTimeout" :min="5" :max="1440" />
</el-form-item>
<el-form-item label="登录失败锁定">
<el-switch v-model="configForm.enableLoginLock" />
</el-form-item>
<el-form-item label="锁定阈值(次)" v-if="configForm.enableLoginLock">
<el-input-number v-model="configForm.loginLockThreshold" :min="3" :max="10" />
</el-form-item>
<el-divider content-position="left">功能设置</el-divider>
<el-form-item label="启用用户注册">
<el-switch v-model="configForm.enableRegister" />
</el-form-item>
<el-form-item label="启用评论功能">
<el-switch v-model="configForm.enableComment" />
</el-form-item>
<el-form-item label="启用文件上传">
<el-switch v-model="configForm.enableFileUpload" />
</el-form-item>
<el-form-item label="文件上传大小限制(MB)">
<el-input-number v-model="configForm.maxFileSize" :min="1" :max="100" />
</el-form-item>
<el-divider content-position="left">邮件设置</el-divider>
<el-form-item label="启用邮件通知">
<el-switch v-model="configForm.enableEmail" />
</el-form-item>
<el-form-item label="SMTP服务器" v-if="configForm.enableEmail">
<el-input v-model="configForm.smtpHost" />
</el-form-item>
<el-form-item label="SMTP端口" v-if="configForm.enableEmail">
<el-input-number v-model="configForm.smtpPort" :min="1" :max="65535" />
</el-form-item>
<el-form-item label="发件人邮箱" v-if="configForm.enableEmail">
<el-input v-model="configForm.senderEmail" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSave">保存配置</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElForm, ElFormItem, ElInput, ElInputNumber, ElSwitch, ElButton, ElDivider, ElUpload, ElIcon, ElMessage } from 'element-plus';
const configForm = ref({
systemName: '红色思政学习平台',
logo: '',
copyright: 'Copyright ©红色思政智能体平台',
enableCaptcha: false,
minPasswordLength: 6,
sessionTimeout: 30,
enableLoginLock: true,
loginLockThreshold: 5,
enableRegister: true,
enableComment: true,
enableFileUpload: true,
maxFileSize: 10,
enableEmail: false,
smtpHost: '',
smtpPort: 587,
senderEmail: ''
});
onMounted(() => {
loadConfig();
});
function loadConfig() {
// TODO: 加载系统配置
}
function beforeLogoUpload(file: File) {
const isImage = file.type.startsWith('image/');
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isImage) {
ElMessage.error('只能上传图片文件');
return false;
}
if (!isLt2M) {
ElMessage.error('图片大小不能超过 2MB');
return false;
}
return true;
}
function handleSave() {
// TODO: 保存配置
ElMessage.success('配置保存成功');
}
function handleReset() {
// TODO: 重置配置
loadConfig();
}
</script>
<style lang="scss" scoped>
.system-config {
padding: 20px;
max-width: 800px;
}
.config-form {
padding: 20px 0;
}
.logo-uploader {
:deep(.el-upload) {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: all 0.3s;
&:hover {
border-color: #C62828;
}
}
}
.logo-preview {
width: 178px;
height: 178px;
display: block;
object-fit: contain;
}
.logo-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
text-align: center;
line-height: 178px;
}
</style>

View File

@@ -0,0 +1,41 @@
<template>
<div class="system-logs">
<h1 class="page-title">系统日志</h1>
<el-tabs v-model="activeTab">
<el-tab-pane label="登录日志" name="login">
<LoginLogs />
</el-tab-pane>
<el-tab-pane label="操作日志" name="operation">
<OperationLogs />
</el-tab-pane>
<el-tab-pane label="系统配置" name="config">
<SystemConfig />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElTabs, ElTabPane } from 'element-plus';
import LoginLogs from './components/LoginLogs.vue';
import OperationLogs from './components/OperationLogs.vue';
import SystemConfig from './components/SystemConfig.vue';
const activeTab = ref('login');
</script>
<style lang="scss" scoped>
.system-logs {
padding: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
</style>

View File

@@ -0,0 +1,126 @@
<template>
<div class="article-management">
<div class="action-bar">
<el-button type="primary" @click="showCreateDialog">+ 新增文章</el-button>
<el-button @click="handleDataCollection">数据采集</el-button>
<el-input
v-model="searchKeyword"
placeholder="搜索文章..."
style="width: 300px"
clearable
/>
</div>
<el-table :data="articles" style="width: 100%">
<el-table-column prop="title" label="文章标题" min-width="200" />
<el-table-column prop="category" label="分类" width="120" />
<el-table-column prop="author" label="作者" width="120" />
<el-table-column prop="publishDate" label="发布日期" width="120" />
<el-table-column prop="views" label="阅读量" width="100" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="getStatusType(row.status)">
{{ getStatusText(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="editArticle(row)">编辑</el-button>
<el-button size="small" type="danger" @click="deleteArticle(row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage } from 'element-plus';
const searchKeyword = ref('');
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const articles = ref<any[]>([]);
onMounted(() => {
loadArticles();
});
function loadArticles() {
// TODO: 加载文章数据
}
function showCreateDialog() {
// TODO: 显示创建文章对话框
}
function handleDataCollection() {
// TODO: 数据采集功能
ElMessage.info('数据采集功能开发中');
}
function editArticle(row: any) {
// TODO: 编辑文章
}
function deleteArticle(row: any) {
// TODO: 删除文章
}
function getStatusType(status: string) {
const typeMap: Record<string, any> = {
'published': 'success',
'draft': 'info',
'pending': 'warning'
};
return typeMap[status] || 'info';
}
function getStatusText(status: string) {
const textMap: Record<string, string> = {
'published': '已发布',
'draft': '草稿',
'pending': '待审核'
};
return textMap[status] || status;
}
function handleSizeChange(val: number) {
pageSize.value = val;
loadArticles();
}
function handleCurrentChange(val: number) {
currentPage.value = val;
loadArticles();
}
</script>
<style lang="scss" scoped>
.article-management {
padding: 20px;
}
.action-bar {
display: flex;
gap: 16px;
margin-bottom: 20px;
align-items: center;
}
.el-table {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,44 @@
<template>
<div class="data-records">
<el-tabs v-model="activeTab">
<el-tab-pane label="菜单管理" name="menu">
<!-- 菜单管理已在manage/system中实现这里可以引用或重新实现 -->
<div class="redirect-info">
<p>菜单管理功能已在系统管理模块中实现</p>
<el-button type="primary" @click="goToMenuManage">前往菜单管理</el-button>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { ElTabs, ElTabPane, ElButton } from 'element-plus';
const router = useRouter();
const activeTab = ref('menu');
function goToMenuManage() {
router.push('/admin/system/menu');
}
</script>
<style lang="scss" scoped>
.data-records {
padding: 20px;
}
.redirect-info {
padding: 40px;
text-align: center;
p {
font-size: 16px;
color: #666;
margin-bottom: 20px;
}
}
</style>

View File

@@ -0,0 +1,37 @@
<template>
<div class="resource-management">
<h1 class="page-title">资源管理</h1>
<el-tabs v-model="activeTab" class="resource-tabs">
<el-tab-pane label="文章储备" name="articles">
<ArticleManagement />
</el-tab-pane>
<el-tab-pane label="数据记录" name="data">
<DataRecords />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElTabs, ElTabPane } from 'element-plus';
import ArticleManagement from './components/ArticleManagement.vue';
import DataRecords from './components/DataRecords.vue';
const activeTab = ref('articles');
</script>
<style lang="scss" scoped>
.resource-management {
padding: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
</style>

View File

@@ -0,0 +1,37 @@
<template>
<div class="study-management">
<h1 class="page-title">学习管理</h1>
<el-tabs v-model="activeTab">
<el-tab-pane label="学习任务发布" name="task-publish">
<TaskPublish />
</el-tab-pane>
<el-tab-pane label="学习记录" name="task-records">
<StudyRecords />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElTabs, ElTabPane } from 'element-plus';
import TaskPublish from './components/TaskPublish.vue';
import StudyRecords from './components/StudyRecords.vue';
const activeTab = ref('task-publish');
</script>
<style lang="scss" scoped>
.study-management {
padding: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
</style>

View File

@@ -0,0 +1,149 @@
<template>
<div class="study-records">
<div class="filter-bar">
<el-input
v-model="searchKeyword"
placeholder="搜索用户..."
style="width: 200px"
clearable
/>
<el-select v-model="selectedTask" placeholder="选择任务" style="width: 200px" clearable>
<el-option
v-for="task in tasks"
:key="task.id"
:label="task.name"
:value="task.id"
/>
</el-select>
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleExport">导出</el-button>
</div>
<el-table :data="records" style="width: 100%">
<el-table-column prop="userName" label="用户" width="120" />
<el-table-column prop="taskName" label="任务名称" min-width="180" />
<el-table-column prop="progress" label="完成进度" width="120">
<template #default="{ row }">
<el-progress :percentage="row.progress" />
</template>
</el-table-column>
<el-table-column prop="duration" label="学习时长" width="120" />
<el-table-column prop="startDate" label="开始时间" width="150" />
<el-table-column prop="status" label="状态" width="100">
<template #default="{ row }">
<el-tag :type="getStatusType(row.status)">
{{ getStatusText(row.status) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button size="small" @click="viewDetail(row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElInput, ElSelect, ElOption, ElDatePicker, ElButton, ElTable, ElTableColumn, ElTag, ElProgress, ElPagination, ElMessage } from 'element-plus';
const searchKeyword = ref('');
const selectedTask = ref('');
const dateRange = ref<[Date, Date] | null>(null);
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const records = ref<any[]>([]);
const tasks = ref<any[]>([]);
onMounted(() => {
loadTasks();
loadRecords();
});
function loadTasks() {
// TODO: 加载任务列表
}
function loadRecords() {
// TODO: 加载学习记录
}
function handleSearch() {
currentPage.value = 1;
loadRecords();
}
function handleExport() {
// TODO: 导出学习记录
ElMessage.info('导出功能开发中');
}
function getStatusType(status: string) {
const typeMap: Record<string, any> = {
'completed': 'success',
'in-progress': 'warning',
'not-started': 'info'
};
return typeMap[status] || 'info';
}
function getStatusText(status: string) {
const textMap: Record<string, string> = {
'completed': '已完成',
'in-progress': '进行中',
'not-started': '未开始'
};
return textMap[status] || status;
}
function viewDetail(row: any) {
// TODO: 查看学习记录详情
}
function handleSizeChange(val: number) {
pageSize.value = val;
loadRecords();
}
function handleCurrentChange(val: number) {
currentPage.value = val;
loadRecords();
}
</script>
<style lang="scss" scoped>
.study-records {
padding: 20px;
}
.filter-bar {
display: flex;
gap: 16px;
margin-bottom: 20px;
align-items: center;
}
.el-table {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,135 @@
<template>
<div class="task-publish">
<el-form :model="taskForm" :rules="taskRules" ref="taskFormRef" label-width="120px">
<el-form-item label="任务名称" prop="name">
<el-input v-model="taskForm.name" placeholder="请输入任务名称" />
</el-form-item>
<el-form-item label="任务描述" prop="description">
<el-input
v-model="taskForm.description"
type="textarea"
:rows="4"
placeholder="请输入任务描述"
/>
</el-form-item>
<el-form-item label="任务周期" prop="period">
<el-date-picker
v-model="taskForm.period"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="关联资源" prop="resources">
<el-button @click="showResourceSelector">选择资源</el-button>
<div class="selected-resources" v-if="taskForm.resources.length">
<el-tag
v-for="resource in taskForm.resources"
:key="resource.id"
closable
@close="removeResource(resource)"
>
{{ resource.name }}
</el-tag>
</div>
</el-form-item>
<el-form-item label="任务接受对象" prop="targets">
<el-radio-group v-model="taskForm.targetType">
<el-radio label="dept">按部门</el-radio>
<el-radio label="role">按权限</el-radio>
<el-radio label="user">选人员</el-radio>
</el-radio-group>
<el-button @click="showTargetSelector" style="margin-left: 16px;">
选择对象
</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handlePublish">发布任务</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElForm, ElFormItem, ElInput, ElDatePicker, ElButton, ElRadioGroup, ElRadio, ElTag, ElMessage, type FormInstance, type FormRules } from 'element-plus';
const taskFormRef = ref<FormInstance>();
const taskForm = ref({
name: '',
description: '',
period: null as [Date, Date] | null,
resources: [] as any[],
targetType: 'dept',
targets: [] as any[]
});
const taskRules: FormRules = {
name: [
{ required: true, message: '请输入任务名称', trigger: 'blur' }
],
description: [
{ required: true, message: '请输入任务描述', trigger: 'blur' }
],
period: [
{ required: true, message: '请选择任务周期', trigger: 'change' }
]
};
function showResourceSelector() {
// TODO: 显示资源选择器
}
function removeResource(resource: any) {
const index = taskForm.value.resources.indexOf(resource);
if (index > -1) {
taskForm.value.resources.splice(index, 1);
}
}
function showTargetSelector() {
// TODO: 显示对象选择器
}
async function handlePublish() {
if (!taskFormRef.value) return;
try {
await taskFormRef.value.validate();
// TODO: 调用发布任务API
ElMessage.success('任务发布成功');
handleReset();
} catch (error) {
console.error('表单验证失败', error);
}
}
function handleReset() {
taskFormRef.value?.resetFields();
taskForm.value.resources = [];
taskForm.value.targets = [];
}
</script>
<style lang="scss" scoped>
.task-publish {
padding: 20px;
max-width: 800px;
}
.selected-resources {
margin-top: 12px;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
</style>

View File

@@ -0,0 +1,304 @@
<template>
<div class="system-overview">
<h1 class="page-title">系统总览</h1>
<!-- 统计卡片 -->
<div class="stats-grid">
<div class="stat-card" v-for="stat in statistics" :key="stat.label">
<div class="stat-icon" :style="{ background: stat.color }">
<i>{{ stat.icon }}</i>
</div>
<div class="stat-content">
<h3>{{ stat.value }}</h3>
<p>{{ stat.label }}</p>
<span class="stat-change" :class="stat.trend">
{{ stat.change }}
</span>
</div>
</div>
</div>
<!-- 图表区域 -->
<el-row :gutter="20" class="charts-row">
<el-col :span="16">
<el-card class="chart-card">
<template #header>
<div class="card-header">
<span>用户活跃度折线图</span>
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small"
/>
</div>
</template>
<div class="chart-container" ref="activityChart"></div>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="chart-card">
<template #header>
<span>资源分类统计(饼图)</span>
</template>
<div class="chart-container" ref="resourcePieChart"></div>
</el-card>
</el-col>
</el-row>
<!-- 今日访问量详情 -->
<el-card class="visit-card">
<template #header>
<span>今日访问量</span>
</template>
<div class="visit-stats">
<div class="visit-item" v-for="item in visitStats" :key="item.label">
<div class="visit-label">{{ item.label }}</div>
<div class="visit-value">{{ item.value }}</div>
</div>
</div>
</el-card>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue';
import { ElRow, ElCol, ElCard, ElDatePicker } from 'element-plus';
import * as echarts from 'echarts';
const dateRange = ref<[Date, Date] | null>(null);
const activityChart = ref<HTMLElement | null>(null);
const resourcePieChart = ref<HTMLElement | null>(null);
let activityChartInstance: echarts.ECharts | null = null;
let pieChartInstance: echarts.ECharts | null = null;
const statistics = ref([
{
icon: '👥',
label: '总用户数',
value: '1,234',
change: '+12%',
trend: 'up',
color: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'
},
{
icon: '📚',
label: '总资源数',
value: '5,678',
change: '+8%',
trend: 'up',
color: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'
},
{
icon: '👁',
label: '今日访问量',
value: '892',
change: '+15%',
trend: 'up',
color: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'
},
{
icon: '✅',
label: '活跃用户',
value: '456',
change: '+5%',
trend: 'up',
color: 'linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)'
}
]);
const visitStats = ref([
{ label: 'UV(独立访客)', value: '892' },
{ label: 'PV(页面浏览量)', value: '3,456' },
{ label: '平均访问时长', value: '5分32秒' },
{ label: '跳出率', value: '35.6%' }
]);
onMounted(() => {
initCharts();
// TODO: 加载实际数据
});
onUnmounted(() => {
if (activityChartInstance) {
activityChartInstance.dispose();
}
if (pieChartInstance) {
pieChartInstance.dispose();
}
});
function initCharts() {
if (activityChart.value) {
activityChartInstance = echarts.init(activityChart.value);
const activityOption = {
tooltip: {
trigger: 'axis'
},
xAxis: {
type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis: {
type: 'value'
},
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'line',
smooth: true,
areaStyle: {}
}]
};
activityChartInstance.setOption(activityOption);
}
if (resourcePieChart.value) {
pieChartInstance = echarts.init(resourcePieChart.value);
const pieOption = {
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
left: 'left'
},
series: [{
type: 'pie',
radius: '50%',
data: [
{ value: 1048, name: '文章' },
{ value: 735, name: '视频' },
{ value: 580, name: '音频' },
{ value: 484, name: '课程' },
{ value: 300, name: '其他' }
]
}]
};
pieChartInstance.setOption(pieOption);
}
}
</script>
<style lang="scss" scoped>
.system-overview {
padding: 20px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 20px;
}
.stat-card {
background: white;
padding: 24px;
border-radius: 8px;
display: flex;
gap: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.stat-icon {
width: 64px;
height: 64px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
flex-shrink: 0;
}
.stat-content {
flex: 1;
h3 {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 4px;
}
p {
font-size: 14px;
color: #666;
margin-bottom: 4px;
}
}
.stat-change {
font-size: 13px;
&.up {
color: #4caf50;
}
&.down {
color: #f44336;
}
}
.charts-row {
margin-bottom: 20px;
}
.chart-card {
:deep(.el-card__body) {
padding: 20px;
}
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.chart-container {
height: 300px;
}
.visit-card {
:deep(.el-card__body) {
padding: 20px;
}
}
.visit-stats {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
.visit-item {
text-align: center;
padding: 20px;
background: #f9f9f9;
border-radius: 8px;
}
.visit-label {
font-size: 14px;
color: #666;
margin-bottom: 8px;
}
.visit-value {
font-size: 24px;
font-weight: 600;
color: #C62828;
}
</style>

View File

@@ -0,0 +1,202 @@
<template>
<div class="ai-assistant-page">
<!-- 悬浮球入口可以通过props控制显示/隐藏 -->
<div class="floating-button" @click="togglePanel" v-if="!isPanelVisible">
<img src="@/assets/imgs/ai-icon.svg" alt="AI助手" />
</div>
<!-- AI助手面板 -->
<transition name="slide">
<div class="assistant-panel" v-if="isPanelVisible">
<div class="panel-header">
<h2>AI思政助手</h2>
<div class="header-actions">
<el-button size="small" @click="handleFileUpload">📎 上传文件</el-button>
<el-button size="small" @click="showHistory">📜 历史记录</el-button>
<el-button size="small" @click="togglePanel"></el-button>
</div>
</div>
<div class="panel-tabs">
<div
class="panel-tab"
v-for="tab in tabs"
:key="tab.key"
:class="{ active: activeTab === tab.key }"
@click="activeTab = tab.key"
>
{{ tab.label }}
</div>
</div>
<div class="panel-content">
<component :is="currentComponent" />
</div>
</div>
</transition>
<!-- 历史对话记录弹窗 -->
<el-dialog v-model="historyVisible" title="历史对话记录" width="600px">
<DialogHistory @load-conversation="loadConversation" />
</el-dialog>
<!-- 文件解读与记录弹窗 -->
<el-dialog v-model="fileDialogVisible" title="文件解读与记录" width="800px">
<FileInterpretation />
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { ElButton, ElDialog } from 'element-plus';
import ChatInterface from './components/ChatInterface.vue';
import KnowledgeBase from './components/KnowledgeBase.vue';
import DialogHistory from './components/DialogHistory.vue';
import FileInterpretation from './components/FileInterpretation.vue';
const isPanelVisible = ref(false);
const activeTab = ref('chat');
const historyVisible = ref(false);
const fileDialogVisible = ref(false);
const tabs = [
{ key: 'chat', label: '对话' },
{ key: 'knowledge', label: '知识库' }
];
const componentMap: Record<string, any> = {
'chat': ChatInterface,
'knowledge': KnowledgeBase
};
const currentComponent = computed(() => componentMap[activeTab.value]);
function togglePanel() {
isPanelVisible.value = !isPanelVisible.value;
}
function showHistory() {
historyVisible.value = true;
}
function handleFileUpload() {
fileDialogVisible.value = true;
}
function loadConversation(conversation: any) {
// TODO: 加载历史对话
historyVisible.value = false;
}
</script>
<style lang="scss" scoped>
.ai-assistant-page {
position: relative;
}
.floating-button {
position: fixed;
bottom: 40px;
right: 40px;
width: 64px;
height: 64px;
background: linear-gradient(135deg, #C62828, #E53935);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 12px rgba(198, 40, 40, 0.4);
transition: all 0.3s;
z-index: 1000;
&:hover {
transform: scale(1.1);
box-shadow: 0 6px 16px rgba(198, 40, 40, 0.5);
}
img {
width: 36px;
height: 36px;
}
}
.assistant-panel {
position: fixed;
bottom: 20px;
right: 20px;
width: 450px;
height: 650px;
background: white;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
display: flex;
flex-direction: column;
z-index: 1000;
overflow: hidden;
}
.panel-header {
padding: 20px;
border-bottom: 1px solid #e0e0e0;
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(135deg, #C62828, #E53935);
color: white;
h2 {
font-size: 18px;
font-weight: 600;
}
}
.header-actions {
display: flex;
gap: 8px;
}
.panel-tabs {
display: flex;
background: #f5f5f5;
padding: 0 16px;
}
.panel-tab {
padding: 12px 20px;
cursor: pointer;
font-size: 14px;
color: #666;
position: relative;
transition: all 0.3s;
&:hover {
color: #C62828;
}
&.active {
color: #C62828;
font-weight: 600;
background: white;
border-radius: 8px 8px 0 0;
}
}
.panel-content {
flex: 1;
overflow: hidden;
}
.slide-enter-active,
.slide-leave-active {
transition: all 0.3s ease;
}
.slide-enter-from,
.slide-leave-to {
transform: translateY(100%);
opacity: 0;
}
</style>

View File

@@ -0,0 +1,250 @@
<template>
<div class="chat-interface">
<!-- 消息列表 -->
<div class="messages-container" ref="messagesContainer">
<div
class="message"
v-for="message in messages"
:key="message.id"
:class="message.role"
>
<div class="message-avatar">
<img :src="getAvatar(message.role)" :alt="message.role" />
</div>
<div class="message-content">
<div class="message-text" v-html="message.content"></div>
<div class="message-time">{{ message.timestamp }}</div>
</div>
</div>
<!-- 加载中动画 -->
<div class="message assistant" v-if="isLoading">
<div class="message-avatar">
<img src="@/assets/imgs/ai-avatar.svg" alt="AI" />
</div>
<div class="message-content">
<div class="typing-indicator">
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
</div>
<!-- 输入框 -->
<div class="input-container">
<el-input
v-model="inputMessage"
type="textarea"
:rows="3"
placeholder="输入您的问题..."
@keydown.enter.prevent="handleSend"
:disabled="isLoading"
/>
<el-button
type="primary"
@click="handleSend"
:loading="isLoading"
:disabled="!inputMessage.trim()"
>
发送
</el-button>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, nextTick, onMounted } from 'vue';
import { ElInput, ElButton } from 'element-plus';
const messagesContainer = ref<HTMLElement | null>(null);
const inputMessage = ref('');
const isLoading = ref(false);
const messages = ref<any[]>([
{
id: 1,
role: 'assistant',
content: '您好我是AI思政助手请问有什么可以帮助您的吗',
timestamp: new Date().toLocaleTimeString()
}
]);
onMounted(() => {
// TODO: 加载历史消息
});
async function handleSend() {
if (!inputMessage.value.trim() || isLoading.value) return;
const userMessage = {
id: Date.now(),
role: 'user',
content: inputMessage.value,
timestamp: new Date().toLocaleTimeString()
};
messages.value.push(userMessage);
const question = inputMessage.value;
inputMessage.value = '';
await nextTick();
scrollToBottom();
// 模拟AI回复
isLoading.value = true;
// TODO: 调用AI API
setTimeout(() => {
const aiMessage = {
id: Date.now(),
role: 'assistant',
content: `关于"${question}",我来为您解答...`,
timestamp: new Date().toLocaleTimeString()
};
messages.value.push(aiMessage);
isLoading.value = false;
nextTick(() => {
scrollToBottom();
});
}, 1500);
}
function getAvatar(role: string) {
return role === 'user'
? '@/assets/imgs/user-avatar.svg'
: '@/assets/imgs/ai-avatar.svg';
}
function scrollToBottom() {
if (messagesContainer.value) {
messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight;
}
}
</script>
<style lang="scss" scoped>
.chat-interface {
height: 100%;
display: flex;
flex-direction: column;
}
.messages-container {
flex: 1;
overflow-y: auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 16px;
}
.message {
display: flex;
gap: 12px;
&.user {
flex-direction: row-reverse;
.message-content {
align-items: flex-end;
}
.message-text {
background: #C62828;
color: white;
}
}
&.assistant {
.message-text {
background: #f5f5f5;
color: #333;
}
}
}
.message-avatar {
width: 36px;
height: 36px;
flex-shrink: 0;
border-radius: 50%;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.message-content {
flex: 1;
display: flex;
flex-direction: column;
gap: 4px;
}
.message-text {
padding: 12px 16px;
border-radius: 12px;
font-size: 14px;
line-height: 1.6;
max-width: 80%;
word-wrap: break-word;
}
.message-time {
font-size: 12px;
color: #999;
padding: 0 4px;
}
.typing-indicator {
display: flex;
gap: 4px;
padding: 12px 16px;
background: #f5f5f5;
border-radius: 12px;
span {
width: 8px;
height: 8px;
background: #999;
border-radius: 50%;
animation: typing 1.4s infinite;
&:nth-child(2) {
animation-delay: 0.2s;
}
&:nth-child(3) {
animation-delay: 0.4s;
}
}
}
@keyframes typing {
0%, 60%, 100% {
transform: translateY(0);
}
30% {
transform: translateY(-10px);
}
}
.input-container {
padding: 16px;
border-top: 1px solid #e0e0e0;
display: flex;
gap: 12px;
:deep(.el-textarea) {
flex: 1;
}
}
</style>

View File

@@ -0,0 +1,110 @@
<template>
<div class="dialog-history">
<div class="history-list">
<div
class="history-item"
v-for="conversation in conversations"
:key="conversation.id"
@click="$emit('load-conversation', conversation)"
>
<div class="item-header">
<h4>{{ conversation.title }}</h4>
<span class="item-date">{{ conversation.date }}</span>
</div>
<p class="item-preview">{{ conversation.preview }}</p>
<div class="item-footer">
<span class="item-count">{{ conversation.messageCount }} 条消息</span>
<el-button size="small" type="danger" @click.stop="deleteConversation(conversation)">
删除
</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElButton, ElMessage } from 'element-plus';
const conversations = ref<any[]>([]);
defineEmits(['load-conversation']);
onMounted(() => {
// TODO: 加载历史对话列表
});
function deleteConversation(conversation: any) {
// TODO: 删除对话
ElMessage.success('已删除对话');
}
</script>
<style lang="scss" scoped>
.dialog-history {
max-height: 500px;
overflow-y: auto;
}
.history-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.history-item {
padding: 16px;
border: 1px solid #e0e0e0;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #C62828;
background: #fff5f5;
}
}
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
h4 {
font-size: 16px;
font-weight: 600;
color: #141F38;
}
}
.item-date {
font-size: 12px;
color: #999;
}
.item-preview {
font-size: 14px;
color: #666;
margin-bottom: 12px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 12px;
border-top: 1px solid #f0f0f0;
}
.item-count {
font-size: 13px;
color: #999;
}
</style>

View File

@@ -0,0 +1,205 @@
<template>
<div class="file-interpretation">
<el-tabs v-model="activeTab">
<el-tab-pane label="文件上传" name="upload">
<div class="upload-section">
<el-upload
drag
action="#"
:before-upload="beforeUpload"
:on-success="handleUploadSuccess"
multiple
>
<div class="upload-icon">📁</div>
<div class="upload-text">
<p>点击或拖拽文件到此处上传</p>
<p class="upload-hint">支持 PDFWordTXT 格式</p>
</div>
</el-upload>
<!-- 已上传文件列表 -->
<div class="uploaded-files" v-if="uploadedFiles.length">
<h4>已上传文件</h4>
<div class="file-list">
<div class="file-item" v-for="file in uploadedFiles" :key="file.id">
<div class="file-icon">📄</div>
<div class="file-info">
<h5>{{ file.name }}</h5>
<p>{{ file.size }} · {{ file.uploadDate }}</p>
</div>
<el-button size="small" @click="analyzeFile(file)">解读</el-button>
</div>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="历史文件" name="history">
<div class="history-files">
<div class="file-item" v-for="file in historyFiles" :key="file.id">
<div class="file-icon">📄</div>
<div class="file-info">
<h5>{{ file.name }}</h5>
<p>上传时间{{ file.uploadDate }}</p>
<p class="file-summary">{{ file.summary }}</p>
</div>
<div class="file-actions">
<el-button size="small" @click="viewAnalysis(file)">查看解读</el-button>
<el-button size="small" type="danger" @click="deleteFile(file)">删除</el-button>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElTabs, ElTabPane, ElUpload, ElButton, ElMessage } from 'element-plus';
const activeTab = ref('upload');
const uploadedFiles = ref<any[]>([]);
const historyFiles = ref<any[]>([]);
onMounted(() => {
// TODO: 加载历史文件
});
function beforeUpload(file: File) {
const allowedTypes = ['application/pdf', 'application/msword', 'text/plain',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
if (!allowedTypes.includes(file.type)) {
ElMessage.error('只支持 PDF、Word、TXT 格式');
return false;
}
if (file.size > 10 * 1024 * 1024) {
ElMessage.error('文件大小不能超过 10MB');
return false;
}
return true;
}
function handleUploadSuccess(response: any, file: any) {
uploadedFiles.value.push({
id: Date.now(),
name: file.name,
size: formatFileSize(file.size),
uploadDate: new Date().toLocaleString()
});
ElMessage.success('文件上传成功');
}
function formatFileSize(bytes: number): string {
if (bytes < 1024) return bytes + ' B';
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + ' KB';
return (bytes / (1024 * 1024)).toFixed(2) + ' MB';
}
function analyzeFile(file: any) {
// TODO: 调用文件解读API
ElMessage.info('正在解读文件...');
}
function viewAnalysis(file: any) {
// TODO: 查看文件解读结果
}
function deleteFile(file: any) {
// TODO: 删除文件
ElMessage.success('文件已删除');
}
</script>
<style lang="scss" scoped>
.file-interpretation {
min-height: 400px;
}
.upload-section {
padding: 20px;
}
.upload-icon {
font-size: 64px;
margin-bottom: 16px;
}
.upload-text {
p {
margin: 8px 0;
font-size: 14px;
color: #666;
}
}
.upload-hint {
font-size: 12px;
color: #999;
}
.uploaded-files {
margin-top: 32px;
h4 {
font-size: 16px;
font-weight: 600;
color: #141F38;
margin-bottom: 16px;
}
}
.file-list,
.history-files {
display: flex;
flex-direction: column;
gap: 12px;
}
.file-item {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
background: #f9f9f9;
border-radius: 8px;
}
.file-icon {
font-size: 32px;
flex-shrink: 0;
}
.file-info {
flex: 1;
h5 {
font-size: 15px;
font-weight: 600;
color: #141F38;
margin-bottom: 4px;
}
p {
font-size: 13px;
color: #666;
margin: 2px 0;
}
}
.file-summary {
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid #e0e0e0;
}
.file-actions {
display: flex;
gap: 8px;
flex-shrink: 0;
}
</style>

View File

@@ -0,0 +1,147 @@
<template>
<div class="knowledge-base">
<div class="knowledge-header">
<el-input
v-model="searchKeyword"
placeholder="搜索知识库..."
prefix-icon="Search"
clearable
/>
</div>
<div class="knowledge-list">
<div
class="knowledge-item"
v-for="item in filteredKnowledge"
:key="item.id"
@click="viewKnowledge(item)"
>
<div class="item-icon">{{ item.icon }}</div>
<div class="item-info">
<h4>{{ item.title }}</h4>
<p>{{ item.description }}</p>
<div class="item-meta">
<span class="item-category">{{ item.category }}</span>
<span class="item-date">{{ item.updateDate }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { ElInput } from 'element-plus';
const searchKeyword = ref('');
const knowledgeList = ref<any[]>([]);
const filteredKnowledge = computed(() => {
if (!searchKeyword.value) return knowledgeList.value;
return knowledgeList.value.filter(item =>
item.title.includes(searchKeyword.value) ||
item.description.includes(searchKeyword.value)
);
});
onMounted(() => {
// TODO: 加载知识库数据
knowledgeList.value = [
{
id: 1,
icon: '📚',
title: '党的二十大精神',
description: '深入学习党的二十大精神要点',
category: '党史学习',
updateDate: '2024-01-15'
},
{
id: 2,
icon: '🎯',
title: '社会主义核心价值观',
description: '践行社会主义核心价值观',
category: '理论学习',
updateDate: '2024-01-10'
}
];
});
function viewKnowledge(item: any) {
// TODO: 查看知识详情
}
</script>
<style lang="scss" scoped>
.knowledge-base {
height: 100%;
display: flex;
flex-direction: column;
}
.knowledge-header {
padding: 16px;
border-bottom: 1px solid #e0e0e0;
}
.knowledge-list {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 12px;
}
.knowledge-item {
display: flex;
gap: 12px;
padding: 16px;
background: #f9f9f9;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #ffe6e6;
transform: translateX(4px);
}
}
.item-icon {
font-size: 32px;
flex-shrink: 0;
}
.item-info {
flex: 1;
h4 {
font-size: 15px;
font-weight: 600;
color: #141F38;
margin-bottom: 6px;
}
p {
font-size: 13px;
color: #666;
margin-bottom: 8px;
}
}
.item-meta {
display: flex;
gap: 12px;
font-size: 12px;
}
.item-category {
color: #C62828;
}
.item-date {
color: #999;
}
</style>

View File

@@ -0,0 +1,39 @@
<template>
<div class="home-page">
<!-- 个人学习数据概览 -->
<LearningDataOverview />
<!-- 书报馆件 -->
<BookHallSection />
<!-- TOP音乐推荐 -->
<TopMusicRecommend />
<!-- 新闻概览 -->
<NewsOverview />
<!-- 导航栏 -->
<NavigationBar />
<!-- 破破栏索 -->
<SearchIndex />
</div>
</template>
<script setup lang="ts">
import LearningDataOverview from './components/LearningDataOverview.vue';
import BookHallSection from './components/BookHallSection.vue';
import TopMusicRecommend from './components/TopMusicRecommend.vue';
import NewsOverview from './components/NewsOverview.vue';
import NavigationBar from './components/NavigationBar.vue';
import SearchIndex from './components/SearchIndex.vue';
</script>
<style lang="scss" scoped>
.home-page {
width: 100%;
min-height: 100vh;
background: #f5f5f5;
}
</style>

View File

@@ -0,0 +1,88 @@
<template>
<div class="book-hall-section">
<h2 class="section-title">书报馆件</h2>
<div class="book-list">
<div class="book-item" v-for="book in books" :key="book.id">
<div class="book-cover">
<img :src="book.cover" :alt="book.title" />
</div>
<div class="book-info">
<h3>{{ book.title }}</h3>
<p>{{ book.author }}</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
const books = ref<any[]>([]);
onMounted(() => {
// TODO: 加载书籍数据
});
</script>
<style lang="scss" scoped>
.book-hall-section {
padding: 40px;
background: white;
border-radius: 8px;
margin: 20px;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
.book-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
}
.book-item {
cursor: pointer;
transition: transform 0.3s;
&:hover {
transform: translateY(-5px);
}
}
.book-cover {
width: 100%;
height: 280px;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.book-info {
margin-top: 12px;
h3 {
font-size: 16px;
font-weight: 500;
color: #141F38;
margin-bottom: 4px;
}
p {
font-size: 14px;
color: #666;
}
}
</style>

View File

@@ -0,0 +1,77 @@
<template>
<div class="learning-data-overview">
<h2 class="section-title">个人学习数据概览</h2>
<div class="data-cards">
<div class="data-card" v-for="item in dataItems" :key="item.label">
<div class="card-icon">{{ item.icon }}</div>
<div class="card-content">
<div class="card-value">{{ item.value }}</div>
<div class="card-label">{{ item.label }}</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
const dataItems = ref([
{ icon: '📚', label: '学习时长', value: '0小时' },
{ icon: '✅', label: '完成任务', value: '0个' },
{ icon: '⭐', label: '获得成就', value: '0个' },
{ icon: '📖', label: '阅读文章', value: '0篇' }
]);
onMounted(() => {
// TODO: 加载用户学习数据
});
</script>
<style lang="scss" scoped>
.learning-data-overview {
padding: 40px;
background: white;
border-radius: 8px;
margin: 20px;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
.data-cards {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
.data-card {
display: flex;
align-items: center;
padding: 20px;
background: #f5f5f5;
border-radius: 8px;
gap: 16px;
}
.card-icon {
font-size: 32px;
}
.card-value {
font-size: 28px;
font-weight: 600;
color: #C62828;
}
.card-label {
font-size: 14px;
color: #666;
margin-top: 4px;
}
</style>

View File

@@ -0,0 +1,69 @@
<template>
<div class="navigation-bar">
<div class="nav-item" v-for="item in navItems" :key="item.id" @click="navigate(item)">
<div class="nav-icon">{{ item.icon }}</div>
<div class="nav-label">{{ item.label }}</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const navItems = ref([
{ id: 1, icon: '📚', label: '资源中心', path: '/resource-center' },
{ id: 2, icon: '📝', label: '学习计划', path: '/study-plan' },
{ id: 3, icon: '👤', label: '个人中心', path: '/user-center' },
{ id: 4, icon: '🤖', label: 'AI助手', path: '/ai-assistant' }
]);
function navigate(item: any) {
router.push(item.path);
}
</script>
<style lang="scss" scoped>
.navigation-bar {
display: flex;
justify-content: center;
gap: 40px;
padding: 40px;
background: white;
border-radius: 8px;
margin: 20px;
}
.nav-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
cursor: pointer;
transition: transform 0.3s;
&:hover {
transform: translateY(-5px);
}
}
.nav-icon {
width: 64px;
height: 64px;
background: linear-gradient(135deg, #C62828, #E53935);
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
}
.nav-label {
font-size: 16px;
font-weight: 500;
color: #141F38;
}
</style>

View File

@@ -0,0 +1,115 @@
<template>
<div class="news-overview">
<h2 class="section-title">新闻概览</h2>
<div class="news-list">
<div class="news-item" v-for="news in newsList" :key="news.id" @click="goToDetail(news)">
<div class="news-image">
<img :src="news.image" :alt="news.title" />
</div>
<div class="news-content">
<h3>{{ news.title }}</h3>
<p class="news-summary">{{ news.summary }}</p>
<div class="news-meta">
<span class="news-date">{{ news.publishDate }}</span>
<span class="news-views">{{ news.views }} 阅读</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const newsList = ref<any[]>([]);
onMounted(() => {
// TODO: 加载新闻数据
});
function goToDetail(news: any) {
router.push(`/news/${news.id}`);
}
</script>
<style lang="scss" scoped>
.news-overview {
padding: 40px;
background: white;
border-radius: 8px;
margin: 20px;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
.news-list {
display: flex;
flex-direction: column;
gap: 16px;
}
.news-item {
display: flex;
gap: 16px;
padding: 16px;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s;
&:hover {
background: #f5f5f5;
}
}
.news-image {
width: 200px;
height: 140px;
flex-shrink: 0;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.news-content {
flex: 1;
display: flex;
flex-direction: column;
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.news-summary {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: auto;
}
.news-meta {
display: flex;
gap: 16px;
font-size: 12px;
color: #999;
margin-top: 12px;
}
</style>

View File

@@ -0,0 +1,69 @@
<template>
<div class="search-index">
<h2 class="section-title">搜索索引</h2>
<div class="search-tags">
<span
class="tag"
v-for="tag in popularTags"
:key="tag"
@click="handleTagClick(tag)"
>
{{ tag }}
</span>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const popularTags = ref([
'红色思政', '党史学习', '新时代精神', '爱国主义',
'社会主义核心价值观', '中国梦', '改革开放', '脱贫攻坚'
]);
function handleTagClick(tag: string) {
router.push(`/search?keyword=${encodeURIComponent(tag)}`);
}
</script>
<style lang="scss" scoped>
.search-index {
padding: 40px;
background: white;
border-radius: 8px;
margin: 20px;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
.search-tags {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.tag {
padding: 8px 16px;
background: #f5f5f5;
border-radius: 20px;
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #C62828;
color: white;
}
}
</style>

View File

@@ -0,0 +1,106 @@
<template>
<div class="top-music-recommend">
<h2 class="section-title">TOP音乐推荐</h2>
<div class="music-list">
<div class="music-item" v-for="music in musicList" :key="music.id">
<div class="music-cover">
<img :src="music.cover" :alt="music.title" />
<div class="play-btn"></div>
</div>
<div class="music-info">
<h3>{{ music.title }}</h3>
<p>{{ music.artist }}</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
const musicList = ref<any[]>([]);
onMounted(() => {
// TODO: 加载音乐推荐数据
});
</script>
<style lang="scss" scoped>
.top-music-recommend {
padding: 40px;
background: white;
border-radius: 8px;
margin: 20px;
}
.section-title {
font-size: 24px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
.music-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 20px;
}
.music-item {
cursor: pointer;
}
.music-cover {
position: relative;
width: 100%;
aspect-ratio: 1;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.play-btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 48px;
height: 48px;
background: rgba(198, 40, 40, 0.9);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
opacity: 0;
transition: opacity 0.3s;
}
&:hover .play-btn {
opacity: 1;
}
}
.music-info {
margin-top: 12px;
h3 {
font-size: 16px;
font-weight: 500;
color: #141F38;
margin-bottom: 4px;
}
p {
font-size: 14px;
color: #666;
}
}
</style>

View File

@@ -1,85 +1,94 @@
<template>
<div class="login-container">
<div class="login-box">
<div class="login-header">
<div class="logo">
<img src="@/assets/logo.png" alt="Logo" />
<!-- 左侧励志区域 -->
<div class="login-left">
<div class="left-content">
<div class="quote-text">
<span class="quote-mark"></span>
<div class="quote-content">
<p>不负时代韶华</p>
<p>争做时代新人</p>
</div>
</div>
<h1 class="title">校园新闻管理系统</h1>
<p class="subtitle">登录您的账户</p>
</div>
<el-form
ref="loginFormRef"
:model="loginForm"
:rules="loginRules"
class="login-form"
size="large"
@submit.prevent="handleLogin"
>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
placeholder="请输入用户名"
prefix-icon="User"
clearable
/>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
placeholder="请输入密码"
prefix-icon="Lock"
show-password
clearable
/>
</el-form-item>
<!-- <el-form-item prop="captcha" v-if="showCaptcha">
<div class="captcha-input">
<el-input
v-model="loginForm.captcha"
placeholder="请输入验证码"
prefix-icon="PictureRounded"
clearable
/>
<div class="captcha-image" @click="refreshCaptcha">
<img :src="captchaImage" alt="验证码" v-if="captchaImage" />
<div class="captcha-loading" v-else>加载中...</div>
</div>
<!-- 右侧登录表单区域 -->
<div class="login-right">
<div class="login-form-container">
<!-- Logo和标题区域 -->
<div class="login-header">
<div class="logo-section">
<div class="logo">
<img src="@/assets/imgs/logo-icon.svg" alt="Logo" />
</div>
<h1 class="platform-title">红色思政学习平台</h1>
</div>
</el-form-item> -->
<h2 class="login-title">账号登陆</h2>
</div>
<el-form-item>
<div class="login-options">
<el-checkbox v-model="loginForm.rememberMe">
记住我
</el-checkbox>
<el-link type="primary" @click="goToForgotPassword">
忘记密码
</el-link>
</div>
</el-form-item>
<!-- 登录表单 -->
<el-form
ref="loginFormRef"
:model="loginForm"
:rules="loginRules"
class="login-form"
@submit.prevent="handleLogin"
>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
placeholder="请输入学号"
class="form-input"
/>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
placeholder="请输入密码"
show-password
class="form-input"
/>
</el-form-item>
<el-form-item>
<div class="login-options">
<div class="remember-me">
<el-checkbox v-model="loginForm.rememberMe">
自动登录
</el-checkbox>
</div>
<el-link type="primary" @click="goToForgotPassword" class="forgot-password">
忘记密码
</el-link>
</div>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:loading="loginLoading"
@click="handleLogin"
class="login-button"
>
登录
</el-button>
<p class="agreement-text">
登录即为同意<span class="agreement-link" style="color: red">红色思政智能体平台</span>
</p>
</el-form-item>
</el-form>
<el-form-item>
<el-button
type="primary"
size="large"
:loading="loginLoading"
@click="handleLogin"
class="login-button"
>
登录
</el-button>
</el-form-item>
</el-form>
</div>
<!-- 底部信息 -->
<div class="login-footer">
<p>
没有账
<el-link type="primary" @click="goToRegister">立即注册</el-link>
<p class="register-link">
没有账<span class="register-link-text" @click="goToRegister">现在就注册</span>
</p>
<p class="copyright">
Copyright ©红色思政智能体平台
</p>
</div>
</div>
@@ -163,9 +172,11 @@ const handleLogin = async () => {
const refreshCaptcha = async () => {
try {
const captchaData = await authApi.getCaptcha();
captchaImage.value = captchaData.captchaImage;
loginForm.captchaId = captchaData.captchaId;
const result = await authApi.getCaptcha();
if (result.data) {
captchaImage.value = result.data.captchaImage;
loginForm.captchaId = result.data.captchaId;
}
} catch (error) {
console.error('获取验证码失败:', error);
ElMessage.error('获取验证码失败');
@@ -189,75 +200,146 @@ onMounted(() => {
<style lang="scss" scoped>
.login-container {
min-height: 100vh;
display: flex;
align-items: center;
width: 100%;
height: 80%;
max-width: 1142px;
margin: auto auto;
box-shadow: 0px 4px 30px 0px rgba(176, 196, 225, 0.25);
border-radius: 30px;
overflow: hidden;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
align-items: center;
}
.login-box {
width: 100%;
max-width: 400px;
background: white;
border-radius: 12px;
padding: 40px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
.login-left {
height: 100%;
flex: 1;
display: flex;
/* min-height: 671px; */
padding: 113px 120px;
border-radius: 30px 0 0 30px;
overflow: hidden;
background: url(/schoolNewsWeb/src/assets/imgs/login-bg.png);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
.left-content {
width: 100%;
max-width: 350px;
}
.quote-text {
color: #FFF2D3;
.quote-mark {
font-family: 'Arial Black', sans-serif;
font-weight: 900;
font-size: 71.096px;
line-height: 0.74;
display: block;
margin-left: 1.48px;
}
.quote-content {
margin-top: 46.66px;
p {
font-family: 'Taipei Sans TC Beta', 'PingFang SC', sans-serif;
font-weight: 700;
font-size: 50px;
line-height: 1.42;
margin: 0;
}
}
}
}
.login-right {
flex: 1;
background: #FFFFFF;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
border-radius: 0 30px 30px 0;
padding: 40px 0;
}
.login-form-container {
width: 287px;
padding: 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.login-header {
text-align: center;
margin-bottom: 32px;
margin-bottom: 24px;
.logo img {
width: 64px;
height: 64px;
.logo-section {
display: flex;
align-items: center;
gap: 11px;
margin-bottom: 16px;
.logo {
width: 36px;
height: 36px;
background: #C62828;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
padding: 3px;
img {
width: 30px;
height: 30px;
}
}
.platform-title {
font-family: 'Taipei Sans TC Beta', sans-serif;
font-weight: 700;
font-size: 26px;
line-height: 1.31;
color: #141F38;
margin: 0;
}
}
.title {
font-size: 24px;
.login-title {
font-family: 'PingFang SC', sans-serif;
font-weight: 600;
color: #333;
margin: 0 0 8px 0;
}
.subtitle {
color: #666;
font-size: 14px;
font-size: 16px;
line-height: 1.5;
color: #141F38;
margin: 0;
}
}
.login-form {
.captcha-input {
display: flex;
gap: 12px;
.form-input {
width: 100%;
height: 48px;
background: #F2F3F5;
border: none;
border-radius: 12px;
font-size: 14px;
color: rgba(0, 0, 0, 0.3);
.el-input {
flex: 1;
&::placeholder {
color: rgba(0, 0, 0, 0.3);
}
.captcha-image {
width: 100px;
height: 40px;
border: 1px solid #dcdfe6;
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
img {
max-width: 100%;
max-height: 100%;
}
.captcha-loading {
font-size: 12px;
color: #999;
}
&:focus {
outline: none;
background: #FFFFFF;
border: 1px solid #C62828;
}
}
@@ -266,21 +348,130 @@ onMounted(() => {
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 16px;
.remember-me {
display: flex;
align-items: center;
gap: 4px;
.el-checkbox {
font-size: 12px;
color: rgba(0, 0, 0, 0.3);
.el-checkbox__label {
font-size: 12px;
line-height: 1.67;
}
}
}
.forgot-password {
font-size: 12px;
color: rgba(0, 0, 0, 0.3);
text-decoration: none;
&:hover {
color: #C62828;
}
}
}
.login-button {
width: 100%;
height: 46px;
background: #C62828;
border: none;
border-radius: 12px;
color: #FFFFFF;
font-family: 'PingFang SC', sans-serif;
font-weight: 500;
font-size: 16px;
line-height: 1.4;
margin-bottom: 8px;
&:hover {
background: #B71C1C;
}
}
.agreement-text {
font-family: 'PingFang SC', sans-serif;
font-weight: 400;
font-size: 10px;
line-height: 1.8;
color: rgba(0, 0, 0, 0.3);
text-align: center;
margin: 0;
}
}
.login-footer {
text-align: center;
margin-top: 24px;
width: 100%;
p {
color: #666;
font-size: 14px;
margin: 0;
.register-link {
font-family: 'PingFang SC', sans-serif;
font-weight: 600;
font-size: 12px;
line-height: 1.83;
color: #141F38;
text-align: center;
margin: 0 0 16px 0;
.register-link-text {
cursor: pointer;
color: #ff0000;
&:hover {
color: #C62828;
}
}
}
.copyright {
font-family: 'PingFang SC', sans-serif;
font-size: 12px;
line-height: 2;
color: #D9D9D9;
text-align: center;
padding-bottom: 0;
}
}
// 响应式设计
@media (max-width: 768px) {
.login-container {
flex-direction: column;
border-radius: 0;
min-height: 100vh;
}
.login-left {
min-height: 300px;
padding: 40px;
.left-content {
max-width: 100%;
}
.quote-text {
.quote-mark {
font-size: 50px;
}
.quote-content p {
font-size: 36px;
}
}
}
.login-right {
min-height: auto;
padding: 20px;
}
.login-form-container {
width: 100%;
max-width: 400px;
}
}
</style>

View File

@@ -0,0 +1,160 @@
<template>
<div class="account-settings">
<div class="settings-section">
<h3>修改密码</h3>
<el-form :model="passwordForm" :rules="passwordRules" ref="passwordFormRef" label-width="120px">
<el-form-item label="当前密码" prop="oldPassword">
<el-input v-model="passwordForm.oldPassword" type="password" show-password />
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input v-model="passwordForm.newPassword" type="password" show-password />
</el-form-item>
<el-form-item label="确认密码" prop="confirmPassword">
<el-input v-model="passwordForm.confirmPassword" type="password" show-password />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleChangePassword">修改密码</el-button>
</el-form-item>
</el-form>
</div>
<div class="settings-section">
<h3>账号安全</h3>
<div class="security-items">
<div class="security-item">
<div class="item-info">
<i class="icon">📱</i>
<div>
<h4>手机绑定</h4>
<p>已绑定手机138****8888</p>
</div>
</div>
<el-button size="small">修改</el-button>
</div>
<div class="security-item">
<div class="item-info">
<i class="icon"></i>
<div>
<h4>邮箱绑定</h4>
<p>已绑定邮箱user@example.com</p>
</div>
</div>
<el-button size="small">修改</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElForm, ElFormItem, ElInput, ElButton, ElMessage, type FormInstance, type FormRules } from 'element-plus';
const passwordFormRef = ref<FormInstance>();
const passwordForm = ref({
oldPassword: '',
newPassword: '',
confirmPassword: ''
});
const passwordRules: FormRules = {
oldPassword: [
{ required: true, message: '请输入当前密码', trigger: 'blur' }
],
newPassword: [
{ required: true, message: '请输入新密码', trigger: 'blur' },
{ min: 6, message: '密码至少6个字符', trigger: 'blur' }
],
confirmPassword: [
{ required: true, message: '请确认新密码', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (value !== passwordForm.value.newPassword) {
callback(new Error('两次输入的密码不一致'));
} else {
callback();
}
},
trigger: 'blur'
}
]
};
async function handleChangePassword() {
if (!passwordFormRef.value) return;
try {
await passwordFormRef.value.validate();
// TODO: 调用修改密码API
ElMessage.success('密码修改成功');
passwordFormRef.value.resetFields();
} catch (error) {
console.error('表单验证失败', error);
}
}
</script>
<style lang="scss" scoped>
.account-settings {
max-width: 600px;
}
.settings-section {
padding: 24px 0;
border-bottom: 1px solid #e0e0e0;
&:last-child {
border-bottom: none;
}
h3 {
font-size: 20px;
font-weight: 600;
color: #141F38;
margin-bottom: 24px;
}
}
.security-items {
display: flex;
flex-direction: column;
gap: 16px;
}
.security-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background: #f9f9f9;
border-radius: 8px;
}
.item-info {
display: flex;
align-items: center;
gap: 16px;
.icon {
font-size: 32px;
}
h4 {
font-size: 16px;
font-weight: 600;
color: #141F38;
margin-bottom: 4px;
}
p {
font-size: 14px;
color: #666;
}
}
</style>

View File

@@ -0,0 +1,112 @@
<template>
<div class="personal-info">
<el-form :model="userForm" label-width="120px" class="info-form">
<el-form-item label="头像">
<div class="avatar-upload">
<img :src="userForm.avatar" alt="头像" class="avatar-preview" />
<el-button size="small" @click="handleAvatarUpload">更换头像</el-button>
</div>
</el-form-item>
<el-form-item label="用户名">
<el-input v-model="userForm.username" disabled />
</el-form-item>
<el-form-item label="姓名">
<el-input v-model="userForm.realName" />
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="userForm.gender">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="手机号">
<el-input v-model="userForm.phone" />
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="userForm.email" />
</el-form-item>
<el-form-item label="部门">
<el-input v-model="userForm.deptName" disabled />
</el-form-item>
<el-form-item label="个人简介">
<el-input
v-model="userForm.bio"
type="textarea"
:rows="4"
placeholder="介绍一下自己吧..."
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSave">保存</el-button>
<el-button @click="handleCancel">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElForm, ElFormItem, ElInput, ElButton, ElRadio, ElRadioGroup, ElMessage } from 'element-plus';
const userForm = ref({
avatar: '',
username: '',
realName: '',
gender: 1,
phone: '',
email: '',
deptName: '',
bio: ''
});
onMounted(() => {
// TODO: 加载用户信息
});
function handleAvatarUpload() {
// TODO: 上传头像
ElMessage.info('上传头像功能开发中');
}
function handleSave() {
// TODO: 保存用户信息
ElMessage.success('保存成功');
}
function handleCancel() {
// TODO: 重置表单
}
</script>
<style lang="scss" scoped>
.personal-info {
max-width: 600px;
}
.info-form {
padding: 20px 0;
}
.avatar-upload {
display: flex;
align-items: center;
gap: 20px;
}
.avatar-preview {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #e0e0e0;
}
</style>

View File

@@ -0,0 +1,55 @@
<template>
<div class="profile-page">
<div class="profile-container">
<h1 class="page-title">我导中心</h1>
<el-tabs v-model="activeTab" class="profile-tabs">
<el-tab-pane label="个人信息" name="info">
<PersonalInfo />
</el-tab-pane>
<el-tab-pane label="账号设置" name="settings">
<AccountSettings />
</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ElTabs, ElTabPane } from 'element-plus';
import PersonalInfo from './PersonalInfoView.vue';
import AccountSettings from './AccountSettingsView.vue';
const activeTab = ref('info');
</script>
<style lang="scss" scoped>
.profile-page {
min-height: 100vh;
background: #f5f5f5;
padding: 20px;
}
.profile-container {
max-width: 1200px;
margin: 0 auto;
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 32px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.profile-tabs {
:deep(.el-tabs__nav-wrap) {
margin-bottom: 24px;
}
}
</style>

View File

@@ -0,0 +1,167 @@
<template>
<div class="party-history-learning">
<h2 class="page-title">党史学习</h2>
<!-- 分类标签 -->
<div class="category-tabs">
<div
class="category-tab"
v-for="category in categories"
:key="category.id"
:class="{ active: activeCategory === category.id }"
@click="activeCategory = category.id"
>
{{ category.name }}
</div>
</div>
<!-- 文章列表 -->
<div class="article-list">
<div class="article-item" v-for="article in articles" :key="article.id" @click="viewArticle(article)">
<div class="article-image">
<img :src="article.image" :alt="article.title" />
</div>
<div class="article-content">
<h3>{{ article.title }}</h3>
<p class="article-summary">{{ article.summary }}</p>
<div class="article-meta">
<span class="author">{{ article.author }}</span>
<span class="date">{{ article.publishDate }}</span>
<span class="views">{{ article.views }} 阅读</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const activeCategory = ref(1);
const articles = ref<any[]>([]);
const categories = [
{ id: 1, name: '新民主主义革命时期' },
{ id: 2, name: '社会主义革命和建设时期' },
{ id: 3, name: '改革开放和社会主义现代化建设新时期' },
{ id: 4, name: '新时代中国特色社会主义' }
];
onMounted(() => {
// TODO: 加载党史学习文章
});
function viewArticle(article: any) {
router.push(`/resource/article/${article.id}`);
}
</script>
<style lang="scss" scoped>
.party-history-learning {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.category-tabs {
display: flex;
gap: 12px;
margin-bottom: 32px;
flex-wrap: wrap;
}
.category-tab {
padding: 8px 20px;
background: #f5f5f5;
border-radius: 20px;
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #ffe6e6;
color: #C62828;
}
&.active {
background: #C62828;
color: white;
}
}
.article-list {
display: flex;
flex-direction: column;
gap: 20px;
}
.article-item {
display: flex;
gap: 20px;
padding: 20px;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s;
border: 1px solid #e0e0e0;
&:hover {
background: #f9f9f9;
}
}
.article-image {
width: 240px;
height: 160px;
flex-shrink: 0;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.article-content {
flex: 1;
display: flex;
flex-direction: column;
h3 {
font-size: 20px;
font-weight: 600;
color: #141F38;
margin-bottom: 12px;
}
}
.article-summary {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: auto;
}
.article-meta {
display: flex;
gap: 20px;
font-size: 13px;
color: #999;
margin-top: 16px;
}
</style>

View File

@@ -0,0 +1,101 @@
<template>
<div class="policy-interpretation">
<h2 class="page-title">政策解读</h2>
<div class="interpretation-grid">
<div class="interpretation-item" v-for="item in interpretations" :key="item.id" @click="viewInterpretation(item)">
<div class="item-badge">{{ item.category }}</div>
<h3>{{ item.title }}</h3>
<p class="item-summary">{{ item.summary }}</p>
<div class="item-footer">
<span class="item-date">{{ item.publishDate }}</span>
<span class="item-views">{{ item.views }} 阅读</span>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const interpretations = ref<any[]>([]);
onMounted(() => {
// TODO: 加载政策解读数据
});
function viewInterpretation(item: any) {
router.push(`/resource/interpretation/${item.id}`);
}
</script>
<style lang="scss" scoped>
.policy-interpretation {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.interpretation-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 24px;
}
.interpretation-item {
padding: 24px;
border: 1px solid #e0e0e0;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
}
.item-badge {
display: inline-block;
padding: 4px 12px;
background: #ffe6e6;
color: #C62828;
border-radius: 4px;
font-size: 12px;
margin-bottom: 12px;
}
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
margin-bottom: 12px;
line-height: 1.4;
}
.item-summary {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: 16px;
}
.item-footer {
display: flex;
justify-content: space-between;
font-size: 12px;
color: #999;
padding-top: 16px;
border-top: 1px solid #f0f0f0;
}
</style>

View File

@@ -0,0 +1,119 @@
<template>
<div class="red-classic">
<h2 class="page-title">红色经典</h2>
<div class="classic-grid">
<div class="classic-item" v-for="item in classics" :key="item.id" @click="viewClassic(item)">
<div class="classic-cover">
<img :src="item.cover" :alt="item.title" />
<div class="classic-type">{{ item.type }}</div>
</div>
<div class="classic-info">
<h3>{{ item.title }}</h3>
<p class="classic-author">{{ item.author }}</p>
<p class="classic-description">{{ item.description }}</p>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const classics = ref<any[]>([]);
onMounted(() => {
// TODO: 加载红色经典数据
});
function viewClassic(item: any) {
router.push(`/resource/classic/${item.id}`);
}
</script>
<style lang="scss" scoped>
.red-classic {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.classic-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 24px;
}
.classic-item {
cursor: pointer;
transition: transform 0.3s;
&:hover {
transform: translateY(-8px);
}
}
.classic-cover {
position: relative;
width: 100%;
height: 300px;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.classic-type {
position: absolute;
top: 12px;
left: 12px;
padding: 4px 12px;
background: rgba(198, 40, 40, 0.9);
color: white;
border-radius: 4px;
font-size: 12px;
}
.classic-info {
margin-top: 12px;
h3 {
font-size: 16px;
font-weight: 600;
color: #141F38;
margin-bottom: 4px;
}
}
.classic-author {
font-size: 14px;
color: #999;
margin-bottom: 8px;
}
.classic-description {
font-size: 13px;
color: #666;
line-height: 1.5;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
</style>

View File

@@ -0,0 +1,104 @@
<template>
<div class="resource-center-page">
<!-- 导航栏 -->
<div class="resource-nav">
<div
class="nav-tab"
v-for="tab in tabs"
:key="tab.key"
:class="{ active: activeTab === tab.key }"
@click="activeTab = tab.key"
>
{{ tab.label }}
</div>
</div>
<!-- 内容区域 -->
<div class="resource-content">
<component :is="currentComponent" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import MediaArchive from './components/MediaArchive.vue';
import PartyHistoryLearning from './PartyHistoryLearningView.vue';
import PolicySpeech from './components/PolicySpeech.vue';
import PolicyInterpretation from './PolicyInterpretationView.vue';
import RedClassic from './RedClassicView.vue';
import SpecialReport from './SpecialReportView.vue';
import WorldCase from './WorldCaseView.vue';
const activeTab = ref('media');
const tabs = [
{ key: 'media', label: '媒体档案' },
{ key: 'party-history', label: '党史学习' },
{ key: 'policy-speech', label: '政策讲话' },
{ key: 'policy-interpretation', label: '政策解读' },
{ key: 'red-classic', label: '红色经典' },
{ key: 'special-report', label: '专题报告' },
{ key: 'world-case', label: '世界案例' }
];
const componentMap: Record<string, any> = {
'media': MediaArchive,
'party-history': PartyHistoryLearning,
'policy-speech': PolicySpeech,
'policy-interpretation': PolicyInterpretation,
'red-classic': RedClassic,
'special-report': SpecialReport,
'world-case': WorldCase
};
const currentComponent = computed(() => componentMap[activeTab.value]);
</script>
<style lang="scss" scoped>
.resource-center-page {
min-height: 100vh;
background: #f5f5f5;
}
.resource-nav {
background: white;
padding: 0 40px;
display: flex;
gap: 8px;
border-bottom: 1px solid #e0e0e0;
}
.nav-tab {
padding: 16px 24px;
cursor: pointer;
font-size: 16px;
color: #666;
position: relative;
transition: all 0.3s;
&:hover {
color: #C62828;
}
&.active {
color: #C62828;
font-weight: 600;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background: #C62828;
}
}
}
.resource-content {
padding: 20px;
}
</style>

View File

@@ -0,0 +1,135 @@
<template>
<div class="special-report">
<h2 class="page-title">专题报告</h2>
<div class="report-list">
<div class="report-item" v-for="report in reports" :key="report.id" @click="viewReport(report)">
<div class="report-banner">
<img :src="report.banner" :alt="report.title" />
</div>
<div class="report-content">
<h3>{{ report.title }}</h3>
<div class="report-tags">
<span class="tag" v-for="tag in report.tags" :key="tag">{{ tag }}</span>
</div>
<p class="report-summary">{{ report.summary }}</p>
<div class="report-footer">
<span class="report-speaker">主讲人{{ report.speaker }}</span>
<span class="report-date">{{ report.date }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const reports = ref<any[]>([]);
onMounted(() => {
// TODO: 加载专题报告数据
});
function viewReport(report: any) {
router.push(`/resource/report/${report.id}`);
}
</script>
<style lang="scss" scoped>
.special-report {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.report-list {
display: flex;
flex-direction: column;
gap: 24px;
}
.report-item {
display: flex;
gap: 24px;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
}
.report-banner {
width: 320px;
height: 200px;
flex-shrink: 0;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.report-content {
flex: 1;
display: flex;
flex-direction: column;
h3 {
font-size: 22px;
font-weight: 600;
color: #141F38;
margin-bottom: 12px;
}
}
.report-tags {
display: flex;
gap: 8px;
margin-bottom: 12px;
}
.tag {
padding: 4px 12px;
background: #f5f5f5;
border-radius: 4px;
font-size: 12px;
color: #666;
}
.report-summary {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: auto;
}
.report-footer {
display: flex;
justify-content: space-between;
padding-top: 16px;
margin-top: 16px;
border-top: 1px solid #f0f0f0;
font-size: 14px;
color: #999;
}
</style>

View File

@@ -0,0 +1,181 @@
<template>
<div class="world-case">
<h2 class="page-title">世界案例</h2>
<!-- 地区筛选 -->
<div class="region-filter">
<div
class="region-tab"
v-for="region in regions"
:key="region.id"
:class="{ active: activeRegion === region.id }"
@click="activeRegion = region.id"
>
{{ region.name }}
</div>
</div>
<!-- 案例列表 -->
<div class="case-grid">
<div class="case-item" v-for="caseItem in cases" :key="caseItem.id" @click="viewCase(caseItem)">
<div class="case-image">
<img :src="caseItem.image" :alt="caseItem.title" />
<div class="case-country">{{ caseItem.country }}</div>
</div>
<div class="case-content">
<h3>{{ caseItem.title }}</h3>
<p class="case-summary">{{ caseItem.summary }}</p>
<div class="case-footer">
<span class="case-category">{{ caseItem.category }}</span>
<span class="case-date">{{ caseItem.publishDate }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const activeRegion = ref('all');
const cases = ref<any[]>([]);
const regions = [
{ id: 'all', name: '全部' },
{ id: 'asia', name: '亚洲' },
{ id: 'europe', name: '欧洲' },
{ id: 'americas', name: '美洲' },
{ id: 'africa', name: '非洲' },
{ id: 'oceania', name: '大洋洲' }
];
onMounted(() => {
// TODO: 加载世界案例数据
});
function viewCase(caseItem: any) {
router.push(`/resource/case/${caseItem.id}`);
}
</script>
<style lang="scss" scoped>
.world-case {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.region-filter {
display: flex;
gap: 12px;
margin-bottom: 32px;
}
.region-tab {
padding: 8px 20px;
background: #f5f5f5;
border-radius: 20px;
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #ffe6e6;
color: #C62828;
}
&.active {
background: #C62828;
color: white;
}
}
.case-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 24px;
}
.case-item {
border: 1px solid #e0e0e0;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
}
.case-image {
position: relative;
width: 100%;
height: 200px;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.case-country {
position: absolute;
bottom: 12px;
right: 12px;
padding: 4px 12px;
background: rgba(198, 40, 40, 0.9);
color: white;
border-radius: 4px;
font-size: 12px;
}
.case-content {
padding: 20px;
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
margin-bottom: 12px;
}
}
.case-summary {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: 16px;
}
.case-footer {
display: flex;
justify-content: space-between;
padding-top: 12px;
border-top: 1px solid #f0f0f0;
font-size: 13px;
}
.case-category {
color: #C62828;
}
.case-date {
color: #999;
}
</style>

View File

@@ -0,0 +1,119 @@
<template>
<div class="media-archive">
<h2 class="page-title">媒体档案</h2>
<div class="media-grid">
<div class="media-item" v-for="item in mediaList" :key="item.id" @click="viewMedia(item)">
<div class="media-thumbnail">
<img :src="item.thumbnail" :alt="item.title" />
<div class="media-type">{{ item.type }}</div>
</div>
<div class="media-info">
<h3>{{ item.title }}</h3>
<p class="media-description">{{ item.description }}</p>
<div class="media-meta">
<span>{{ item.publishDate }}</span>
<span>{{ item.views }} 观看</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const mediaList = ref<any[]>([]);
onMounted(() => {
// TODO: 加载媒体档案数据
});
function viewMedia(item: any) {
router.push(`/resource/media/${item.id}`);
}
</script>
<style lang="scss" scoped>
.media-archive {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.media-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
}
.media-item {
cursor: pointer;
transition: transform 0.3s;
&:hover {
transform: translateY(-5px);
}
}
.media-thumbnail {
position: relative;
width: 100%;
height: 200px;
background: #f5f5f5;
border-radius: 8px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.media-type {
position: absolute;
top: 12px;
right: 12px;
padding: 4px 12px;
background: rgba(198, 40, 40, 0.9);
color: white;
border-radius: 4px;
font-size: 12px;
}
.media-info {
margin-top: 12px;
h3 {
font-size: 16px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.media-description {
font-size: 14px;
color: #666;
line-height: 1.5;
margin-bottom: 12px;
}
.media-meta {
display: flex;
gap: 16px;
font-size: 12px;
color: #999;
}
</style>

View File

@@ -0,0 +1,101 @@
<template>
<div class="policy-speech">
<h2 class="page-title">政策讲话</h2>
<div class="speech-list">
<div class="speech-item" v-for="speech in speeches" :key="speech.id" @click="viewSpeech(speech)">
<div class="speech-header">
<h3>{{ speech.title }}</h3>
<span class="speech-date">{{ speech.date }}</span>
</div>
<div class="speech-info">
<span class="speaker">讲话人{{ speech.speaker }}</span>
<span class="occasion">场合{{ speech.occasion }}</span>
</div>
<p class="speech-summary">{{ speech.summary }}</p>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
const speeches = ref<any[]>([]);
onMounted(() => {
// TODO: 加载政策讲话数据
});
function viewSpeech(speech: any) {
router.push(`/resource/speech/${speech.id}`);
}
</script>
<style lang="scss" scoped>
.policy-speech {
background: white;
padding: 40px;
border-radius: 8px;
}
.page-title {
font-size: 28px;
font-weight: 600;
color: #141F38;
margin-bottom: 32px;
}
.speech-list {
display: flex;
flex-direction: column;
gap: 16px;
}
.speech-item {
padding: 24px;
border: 1px solid #e0e0e0;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 2px 8px rgba(198, 40, 40, 0.1);
}
}
.speech-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
}
}
.speech-date {
font-size: 14px;
color: #999;
}
.speech-info {
display: flex;
gap: 24px;
margin-bottom: 12px;
font-size: 14px;
color: #666;
}
.speech-summary {
font-size: 14px;
color: #666;
line-height: 1.6;
}
</style>

View File

@@ -0,0 +1,227 @@
<template>
<div class="course-center">
<div class="course-header">
<h2>课程中心</h2>
<div class="course-categories">
<div
class="category-tab"
v-for="category in categories"
:key="category.id"
:class="{ active: activeCategory === category.id }"
@click="activeCategory = category.id"
>
{{ category.name }}
</div>
</div>
</div>
<div class="course-grid">
<div class="course-card" v-for="course in filteredCourses" :key="course.id" @click="viewCourse(course)">
<div class="course-cover">
<img :src="course.cover" :alt="course.title" />
<div class="course-duration">{{ course.duration }}</div>
</div>
<div class="course-info">
<h3>{{ course.title }}</h3>
<p class="course-description">{{ course.description }}</p>
<div class="course-meta">
<span class="course-teacher">
<i class="icon">👨🏫</i>
{{ course.teacher }}
</span>
<span class="course-students">
<i class="icon">👥</i>
{{ course.students }} 人学习
</span>
</div>
<div class="course-footer">
<div class="course-rating">
<span class="rating-stars"></span>
<span class="rating-score">{{ course.rating }}</span>
</div>
<el-button type="primary" size="small">开始学习</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { ElButton } from 'element-plus';
const router = useRouter();
const activeCategory = ref('all');
const courses = ref<any[]>([]);
const categories = [
{ id: 'all', name: '全部课程' },
{ id: 'party-history', name: '党史教育' },
{ id: 'theory', name: '理论学习' },
{ id: 'policy', name: '政策解读' },
{ id: 'ethics', name: '道德修养' }
];
const filteredCourses = computed(() => {
if (activeCategory.value === 'all') return courses.value;
return courses.value.filter(course => course.category === activeCategory.value);
});
onMounted(() => {
// TODO: 加载课程数据
});
function viewCourse(course: any) {
router.push(`/study/course/${course.id}`);
}
</script>
<style lang="scss" scoped>
.course-center {
padding: 40px;
}
.course-header {
margin-bottom: 32px;
h2 {
font-size: 24px;
font-weight: 600;
color: #141F38;
margin-bottom: 20px;
}
}
.course-categories {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
.category-tab {
padding: 8px 20px;
background: #f5f5f5;
border-radius: 20px;
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #ffe6e6;
color: #C62828;
}
&.active {
background: #C62828;
color: white;
}
}
.course-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 24px;
}
.course-card {
border: 1px solid #e0e0e0;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transform: translateY(-4px);
}
}
.course-cover {
position: relative;
width: 100%;
height: 200px;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.course-duration {
position: absolute;
bottom: 12px;
right: 12px;
padding: 4px 12px;
background: rgba(0, 0, 0, 0.7);
color: white;
border-radius: 4px;
font-size: 12px;
}
.course-info {
padding: 20px;
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
margin-bottom: 12px;
line-height: 1.4;
}
}
.course-description {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: 16px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.course-meta {
display: flex;
gap: 20px;
margin-bottom: 16px;
font-size: 13px;
color: #999;
.icon {
margin-right: 4px;
}
}
.course-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 16px;
border-top: 1px solid #f0f0f0;
}
.course-rating {
display: flex;
align-items: center;
gap: 8px;
}
.rating-stars {
color: #FFB400;
font-size: 14px;
}
.rating-score {
font-size: 14px;
font-weight: 600;
color: #141F38;
}
</style>

View File

@@ -0,0 +1,113 @@
<template>
<div class="study-plan-page">
<div class="page-header">
<h1>学习计划</h1>
<p class="page-description">制定学习计划完成学习任务提升思政素养</p>
</div>
<div class="plan-tabs">
<div
class="plan-tab"
v-for="tab in tabs"
:key="tab.key"
:class="{ active: activeTab === tab.key }"
@click="activeTab = tab.key"
>
{{ tab.label }}
</div>
</div>
<div class="plan-content">
<component :is="currentComponent" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import StudyTasks from './components/StudyTasks.vue';
import CourseCenter from './components/CourseCenter.vue';
const activeTab = ref('tasks');
const tabs = [
{ key: 'tasks', label: '学习任务' },
{ key: 'courses', label: '课程中心' }
];
const componentMap: Record<string, any> = {
'tasks': StudyTasks,
'courses': CourseCenter
};
const currentComponent = computed(() => componentMap[activeTab.value]);
</script>
<style lang="scss" scoped>
.study-plan-page {
min-height: 100vh;
background: #f5f5f5;
padding: 20px;
}
.page-header {
background: white;
padding: 40px;
border-radius: 8px;
margin-bottom: 20px;
h1 {
font-size: 32px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.page-description {
font-size: 16px;
color: #666;
}
.plan-tabs {
background: white;
padding: 0 40px;
display: flex;
gap: 8px;
border-radius: 8px 8px 0 0;
}
.plan-tab {
padding: 16px 24px;
cursor: pointer;
font-size: 16px;
color: #666;
position: relative;
transition: all 0.3s;
&:hover {
color: #C62828;
}
&.active {
color: #C62828;
font-weight: 600;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background: #C62828;
}
}
}
.plan-content {
background: white;
border-radius: 0 0 8px 8px;
}
</style>

View File

@@ -0,0 +1,297 @@
<template>
<div class="study-tasks">
<!-- 任务统计 -->
<div class="task-statistics">
<div class="stat-card" v-for="stat in statistics" :key="stat.label">
<div class="stat-value">{{ stat.value }}</div>
<div class="stat-label">{{ stat.label }}</div>
</div>
</div>
<!-- 任务列表 -->
<div class="task-section">
<div class="section-header">
<h2>任务列表</h2>
<div class="filter-tabs">
<div
class="filter-tab"
v-for="filter in filters"
:key="filter.key"
:class="{ active: activeFilter === filter.key }"
@click="activeFilter = filter.key"
>
{{ filter.label }}
</div>
</div>
</div>
<div class="task-list">
<div class="task-item" v-for="task in filteredTasks" :key="task.id">
<div class="task-icon" :class="`status-${task.status}`">
<i :class="getTaskIcon(task.status)"></i>
</div>
<div class="task-content">
<h3>{{ task.title }}</h3>
<p class="task-description">{{ task.description }}</p>
<div class="task-meta">
<span class="task-type">{{ task.type }}</span>
<span class="task-deadline">截止时间{{ task.deadline }}</span>
</div>
</div>
<div class="task-progress">
<div class="progress-bar">
<div class="progress-fill" :style="{ width: task.progress + '%' }"></div>
</div>
<span class="progress-text">{{ task.progress }}%</span>
</div>
<div class="task-actions">
<el-button
type="primary"
size="small"
@click="goToTask(task)"
v-if="task.status !== 'completed'"
>
{{ task.status === 'not-started' ? '开始学习' : '继续学习' }}
</el-button>
<el-button
size="small"
@click="viewTaskDetail(task)"
>
查看详情
</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { ElButton } from 'element-plus';
const router = useRouter();
const activeFilter = ref('all');
const tasks = ref<any[]>([]);
const statistics = ref([
{ label: '总任务数', value: 0 },
{ label: '进行中', value: 0 },
{ label: '已完成', value: 0 },
{ label: '完成率', value: '0%' }
]);
const filters = [
{ key: 'all', label: '全部任务' },
{ key: 'not-started', label: '未开始' },
{ key: 'in-progress', label: '进行中' },
{ key: 'completed', label: '已完成' }
];
const filteredTasks = computed(() => {
if (activeFilter.value === 'all') return tasks.value;
return tasks.value.filter(task => task.status === activeFilter.value);
});
onMounted(() => {
// TODO: 加载学习任务数据
});
function getTaskIcon(status: string) {
const iconMap: Record<string, string> = {
'not-started': '⭕',
'in-progress': '⏳',
'completed': '✅'
};
return iconMap[status] || '⭕';
}
function goToTask(task: any) {
router.push(`/study/task/${task.id}`);
}
function viewTaskDetail(task: any) {
router.push(`/study/task/${task.id}/detail`);
}
</script>
<style lang="scss" scoped>
.study-tasks {
padding: 40px;
}
.task-statistics {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 40px;
}
.stat-card {
padding: 24px;
background: linear-gradient(135deg, #C62828, #E53935);
border-radius: 8px;
color: white;
text-align: center;
}
.stat-value {
font-size: 32px;
font-weight: 600;
margin-bottom: 8px;
}
.stat-label {
font-size: 14px;
opacity: 0.9;
}
.task-section {
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
h2 {
font-size: 24px;
font-weight: 600;
color: #141F38;
}
}
}
.filter-tabs {
display: flex;
gap: 8px;
}
.filter-tab {
padding: 8px 16px;
background: #f5f5f5;
border-radius: 20px;
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #ffe6e6;
color: #C62828;
}
&.active {
background: #C62828;
color: white;
}
}
.task-list {
display: flex;
flex-direction: column;
gap: 16px;
}
.task-item {
display: flex;
align-items: center;
gap: 20px;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
}
.task-icon {
width: 48px;
height: 48px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
flex-shrink: 0;
&.status-not-started {
background: #f5f5f5;
}
&.status-in-progress {
background: #fff3e0;
}
&.status-completed {
background: #e8f5e9;
}
}
.task-content {
flex: 1;
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.task-description {
font-size: 14px;
color: #666;
margin-bottom: 12px;
}
.task-meta {
display: flex;
gap: 16px;
font-size: 13px;
}
.task-type {
color: #C62828;
font-weight: 500;
}
.task-deadline {
color: #999;
}
.task-progress {
width: 150px;
flex-shrink: 0;
.progress-bar {
width: 100%;
height: 8px;
background: #f5f5f5;
border-radius: 4px;
overflow: hidden;
margin-bottom: 4px;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #C62828, #E53935);
transition: width 0.3s;
}
.progress-text {
font-size: 12px;
color: #666;
}
}
.task-actions {
display: flex;
gap: 8px;
flex-shrink: 0;
}
</style>

View File

@@ -0,0 +1,177 @@
<template>
<div class="learning-records">
<div class="records-header">
<h2>学习记录</h2>
<el-date-picker
v-model="dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleDateChange"
/>
</div>
<div class="records-list">
<div class="record-item" v-for="record in records" :key="record.id">
<div class="record-icon">
<i :class="getRecordIcon(record.type)"></i>
</div>
<div class="record-content">
<h3>{{ record.title }}</h3>
<p class="record-description">{{ record.description }}</p>
<div class="record-meta">
<span class="record-type">{{ record.typeName }}</span>
<span class="record-duration">学习时长{{ record.duration }}分钟</span>
<span class="record-date">{{ record.learnDate }}</span>
</div>
</div>
<div class="record-progress">
<div class="progress-circle" :class="`progress-${record.status}`">
<span>{{ record.progress }}%</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ElDatePicker } from 'element-plus';
const dateRange = ref<[Date, Date] | null>(null);
const records = ref<any[]>([]);
onMounted(() => {
// TODO: 加载学习记录
});
function handleDateChange() {
// TODO: 根据日期筛选记录
}
function getRecordIcon(type: string) {
const iconMap: Record<string, string> = {
'article': '📄',
'video': '🎥',
'audio': '🎵',
'course': '📚'
};
return iconMap[type] || '📄';
}
</script>
<style lang="scss" scoped>
.learning-records {
.records-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
h2 {
font-size: 24px;
font-weight: 600;
color: #141F38;
}
}
}
.records-list {
display: flex;
flex-direction: column;
gap: 16px;
}
.record-item {
display: flex;
align-items: center;
gap: 20px;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
}
.record-icon {
width: 48px;
height: 48px;
background: #f5f5f5;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
flex-shrink: 0;
}
.record-content {
flex: 1;
h3 {
font-size: 18px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.record-description {
font-size: 14px;
color: #666;
margin-bottom: 12px;
}
.record-meta {
display: flex;
gap: 16px;
font-size: 13px;
}
.record-type {
color: #C62828;
font-weight: 500;
}
.record-duration,
.record-date {
color: #999;
}
.record-progress {
flex-shrink: 0;
}
.progress-circle {
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 600;
&.progress-completed {
background: #e8f5e9;
color: #4caf50;
}
&.progress-in-progress {
background: #fff3e0;
color: #ff9800;
}
&.progress-not-started {
background: #f5f5f5;
color: #999;
}
}
</style>

View File

@@ -0,0 +1,200 @@
<template>
<div class="my-achievements">
<div class="achievements-header">
<h2>我的成就</h2>
<div class="achievement-stats">
<span>已获得 <strong>{{ earnedCount }}</strong> / {{ totalCount }} 个成就</span>
</div>
</div>
<div class="achievements-grid">
<div
class="achievement-item"
v-for="achievement in achievements"
:key="achievement.id"
:class="{ earned: achievement.earned, locked: !achievement.earned }"
>
<div class="achievement-icon">
<img :src="achievement.icon" :alt="achievement.name" />
<div class="achievement-badge" v-if="achievement.earned"></div>
</div>
<div class="achievement-info">
<h3>{{ achievement.name }}</h3>
<p class="achievement-description">{{ achievement.description }}</p>
<div class="achievement-progress" v-if="!achievement.earned && achievement.progress">
<div class="progress-bar">
<div class="progress-fill" :style="{ width: achievement.progress + '%' }"></div>
</div>
<span class="progress-text">{{ achievement.progress }}%</span>
</div>
<div class="achievement-date" v-if="achievement.earned">
获得时间{{ achievement.earnedDate }}
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
const achievements = ref<any[]>([]);
const earnedCount = computed(() => {
return achievements.value.filter(a => a.earned).length;
});
const totalCount = computed(() => {
return achievements.value.length;
});
onMounted(() => {
// TODO: 加载成就数据
});
</script>
<style lang="scss" scoped>
.my-achievements {
.achievements-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
h2 {
font-size: 24px;
font-weight: 600;
color: #141F38;
}
}
}
.achievement-stats {
font-size: 16px;
color: #666;
strong {
color: #C62828;
font-size: 20px;
}
}
.achievements-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
}
.achievement-item {
display: flex;
gap: 16px;
padding: 20px;
border: 2px solid #e0e0e0;
border-radius: 8px;
transition: all 0.3s;
&.earned {
border-color: #C62828;
background: linear-gradient(135deg, #fff5f5, #ffffff);
.achievement-icon {
img {
filter: none;
}
}
}
&.locked {
opacity: 0.6;
.achievement-icon {
img {
filter: grayscale(100%);
}
}
}
&:hover.earned {
box-shadow: 0 4px 12px rgba(198, 40, 40, 0.2);
}
}
.achievement-icon {
position: relative;
width: 64px;
height: 64px;
flex-shrink: 0;
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
.achievement-badge {
position: absolute;
bottom: -4px;
right: -4px;
width: 24px;
height: 24px;
background: #4caf50;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 600;
border: 2px solid white;
}
.achievement-info {
flex: 1;
h3 {
font-size: 16px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.achievement-description {
font-size: 14px;
color: #666;
line-height: 1.5;
margin-bottom: 12px;
}
.achievement-progress {
margin-bottom: 8px;
.progress-bar {
width: 100%;
height: 6px;
background: #f5f5f5;
border-radius: 3px;
overflow: hidden;
margin-bottom: 4px;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #C62828, #E53935);
transition: width 0.3s;
}
.progress-text {
font-size: 12px;
color: #999;
}
}
.achievement-date {
font-size: 12px;
color: #999;
}
</style>

View File

@@ -0,0 +1,197 @@
<template>
<div class="my-favorites">
<div class="favorites-header">
<h2>我的收藏</h2>
<div class="filter-tabs">
<div
class="filter-tab"
v-for="filter in filters"
:key="filter.key"
:class="{ active: activeFilter === filter.key }"
@click="activeFilter = filter.key"
>
{{ filter.label }}
</div>
</div>
</div>
<div class="favorites-grid">
<div class="favorite-item" v-for="item in filteredFavorites" :key="item.id">
<div class="item-thumbnail">
<img :src="item.thumbnail" :alt="item.title" />
<div class="item-type">{{ item.typeName }}</div>
</div>
<div class="item-info">
<h3>{{ item.title }}</h3>
<p class="item-summary">{{ item.summary }}</p>
<div class="item-footer">
<span class="item-date">收藏于 {{ item.favoriteDate }}</span>
<div class="item-actions">
<el-button size="small" @click="viewItem(item)">查看</el-button>
<el-button size="small" type="danger" @click="removeFavorite(item)">取消收藏</el-button>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { ElButton, ElMessage } from 'element-plus';
const activeFilter = ref('all');
const favorites = ref<any[]>([]);
const filters = [
{ key: 'all', label: '全部' },
{ key: 'article', label: '文章' },
{ key: 'video', label: '视频' },
{ key: 'audio', label: '音频' },
{ key: 'course', label: '课程' }
];
const filteredFavorites = computed(() => {
if (activeFilter.value === 'all') return favorites.value;
return favorites.value.filter(item => item.type === activeFilter.value);
});
onMounted(() => {
// TODO: 加载收藏数据
});
function viewItem(item: any) {
// TODO: 跳转到详情页
}
function removeFavorite(item: any) {
// TODO: 取消收藏
ElMessage.success('已取消收藏');
}
</script>
<style lang="scss" scoped>
.my-favorites {
.favorites-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32px;
h2 {
font-size: 24px;
font-weight: 600;
color: #141F38;
}
}
}
.filter-tabs {
display: flex;
gap: 8px;
}
.filter-tab {
padding: 8px 16px;
background: #f5f5f5;
border-radius: 20px;
font-size: 14px;
color: #666;
cursor: pointer;
transition: all 0.3s;
&:hover {
background: #ffe6e6;
color: #C62828;
}
&.active {
background: #C62828;
color: white;
}
}
.favorites-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
}
.favorite-item {
border: 1px solid #e0e0e0;
border-radius: 8px;
overflow: hidden;
transition: all 0.3s;
&:hover {
border-color: #C62828;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
}
.item-thumbnail {
position: relative;
width: 100%;
height: 180px;
background: #f5f5f5;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.item-type {
position: absolute;
top: 12px;
left: 12px;
padding: 4px 12px;
background: rgba(198, 40, 40, 0.9);
color: white;
border-radius: 4px;
font-size: 12px;
}
.item-info {
padding: 16px;
h3 {
font-size: 16px;
font-weight: 600;
color: #141F38;
margin-bottom: 8px;
}
}
.item-summary {
font-size: 14px;
color: #666;
line-height: 1.5;
margin-bottom: 16px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 12px;
border-top: 1px solid #f0f0f0;
}
.item-date {
font-size: 12px;
color: #999;
}
.item-actions {
display: flex;
gap: 8px;
}
</style>

View File

@@ -0,0 +1,185 @@
<template>
<div class="user-center-page">
<div class="user-banner">
<div class="user-avatar">
<img :src="userInfo.avatar" alt="用户头像" />
</div>
<div class="user-basic">
<h2>{{ userInfo.name }}</h2>
<p>{{ userInfo.bio }}</p>
</div>
<div class="user-stats">
<div class="stat-item" v-for="stat in stats" :key="stat.label">
<div class="stat-value">{{ stat.value }}</div>
<div class="stat-label">{{ stat.label }}</div>
</div>
</div>
</div>
<div class="center-tabs">
<div
class="center-tab"
v-for="tab in tabs"
:key="tab.key"
:class="{ active: activeTab === tab.key }"
@click="activeTab = tab.key"
>
{{ tab.label }}
</div>
</div>
<div class="center-content">
<component :is="currentComponent" />
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { useStore } from 'vuex';
import LearningRecords from './components/LearningRecords.vue';
import MyFavorites from './components/MyFavorites.vue';
import MyAchievements from './components/MyAchievements.vue';
const store = useStore();
const activeTab = ref('records');
const userInfo = computed(() => store.getters['auth/userInfo']);
const stats = ref([
{ label: '学习天数', value: 0 },
{ label: '学习时长', value: '0h' },
{ label: '完成任务', value: 0 },
{ label: '获得成就', value: 0 }
]);
const tabs = [
{ key: 'records', label: '学习记录' },
{ key: 'favorites', label: '我的收藏' },
{ key: 'achievements', label: '我的成就' }
];
const componentMap: Record<string, any> = {
'records': LearningRecords,
'favorites': MyFavorites,
'achievements': MyAchievements
};
const currentComponent = computed(() => componentMap[activeTab.value]);
onMounted(() => {
// TODO: 加载用户统计数据
});
</script>
<style lang="scss" scoped>
.user-center-page {
min-height: 100vh;
background: #f5f5f5;
padding: 20px;
}
.user-banner {
background: linear-gradient(135deg, #C62828, #E53935);
padding: 40px;
border-radius: 8px;
display: flex;
align-items: center;
gap: 32px;
margin-bottom: 20px;
color: white;
}
.user-avatar {
width: 100px;
height: 100px;
border-radius: 50%;
overflow: hidden;
border: 4px solid white;
flex-shrink: 0;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.user-basic {
flex: 1;
h2 {
font-size: 28px;
font-weight: 600;
margin-bottom: 8px;
}
p {
font-size: 14px;
opacity: 0.9;
}
}
.user-stats {
display: flex;
gap: 40px;
}
.stat-item {
text-align: center;
.stat-value {
font-size: 28px;
font-weight: 600;
margin-bottom: 4px;
}
.stat-label {
font-size: 14px;
opacity: 0.9;
}
}
.center-tabs {
background: white;
padding: 0 40px;
display: flex;
gap: 8px;
border-radius: 8px 8px 0 0;
}
.center-tab {
padding: 16px 24px;
cursor: pointer;
font-size: 16px;
color: #666;
position: relative;
transition: all 0.3s;
&:hover {
color: #C62828;
}
&.active {
color: #C62828;
font-weight: 600;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 3px;
background: #C62828;
}
}
}
.center-content {
background: white;
border-radius: 0 0 8px 8px;
padding: 40px;
}
</style>

View File

@@ -825,116 +825,6 @@
resolved "https://registry.npmmirror.com/@element-plus/icons-vue/-/icons-vue-2.3.2.tgz"
integrity sha512-OzIuTaIfC8QXEPmJvB4Y4kw34rSXdCJzxcD1kFStBvr8bK6X1zQAYDo0CNMjojnfTqRQCJ0I7prlErcoRiET2A==
"@esbuild/aix-ppc64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz"
integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==
"@esbuild/android-arm@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz"
integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==
"@esbuild/android-arm64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz"
integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==
"@esbuild/android-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz"
integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==
"@esbuild/darwin-arm64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz"
integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==
"@esbuild/darwin-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz"
integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==
"@esbuild/freebsd-arm64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz"
integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==
"@esbuild/freebsd-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz"
integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==
"@esbuild/linux-arm@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz"
integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==
"@esbuild/linux-arm64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz"
integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==
"@esbuild/linux-ia32@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz"
integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==
"@esbuild/linux-loong64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz"
integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==
"@esbuild/linux-mips64el@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz"
integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==
"@esbuild/linux-ppc64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz"
integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==
"@esbuild/linux-riscv64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz"
integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==
"@esbuild/linux-s390x@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz"
integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==
"@esbuild/linux-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz"
integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==
"@esbuild/netbsd-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz"
integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==
"@esbuild/openbsd-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz"
integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==
"@esbuild/sunos-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz"
integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==
"@esbuild/win32-arm64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz"
integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==
"@esbuild/win32-ia32@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz"
integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==
"@esbuild/win32-x64@0.21.5":
version "0.21.5"
resolved "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz"
@@ -1152,106 +1042,6 @@
estree-walker "^2.0.2"
picomatch "^4.0.2"
"@rollup/rollup-android-arm-eabi@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.4.tgz"
integrity sha512-BTm2qKNnWIQ5auf4deoetINJm2JzvihvGb9R6K/ETwKLql/Bb3Eg2H1FBp1gUb4YGbydMA3jcmQTR73q7J+GAA==
"@rollup/rollup-android-arm64@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.4.tgz"
integrity sha512-P9LDQiC5vpgGFgz7GSM6dKPCiqR3XYN1WwJKA4/BUVDjHpYsf3iBEmVz62uyq20NGYbiGPR5cNHI7T1HqxNs2w==
"@rollup/rollup-darwin-arm64@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.4.tgz"
integrity sha512-QRWSW+bVccAvZF6cbNZBJwAehmvG9NwfWHwMy4GbWi/BQIA/laTIktebT2ipVjNncqE6GLPxOok5hsECgAxGZg==
"@rollup/rollup-darwin-x64@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.4.tgz"
integrity sha512-hZgP05pResAkRJxL1b+7yxCnXPGsXU0fG9Yfd6dUaoGk+FhdPKCJ5L1Sumyxn8kvw8Qi5PvQ8ulenUbRjzeCTw==
"@rollup/rollup-freebsd-arm64@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.4.tgz"
integrity sha512-xmc30VshuBNUd58Xk4TKAEcRZHaXlV+tCxIXELiE9sQuK3kG8ZFgSPi57UBJt8/ogfhAF5Oz4ZSUBN77weM+mQ==
"@rollup/rollup-freebsd-x64@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.4.tgz"
integrity sha512-WdSLpZFjOEqNZGmHflxyifolwAiZmDQzuOzIq9L27ButpCVpD7KzTRtEG1I0wMPFyiyUdOO+4t8GvrnBLQSwpw==
"@rollup/rollup-linux-arm-gnueabihf@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.4.tgz"
integrity sha512-xRiOu9Of1FZ4SxVbB0iEDXc4ddIcjCv2aj03dmW8UrZIW7aIQ9jVJdLBIhxBI+MaTnGAKyvMwPwQnoOEvP7FgQ==
"@rollup/rollup-linux-arm-musleabihf@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.4.tgz"
integrity sha512-FbhM2p9TJAmEIEhIgzR4soUcsW49e9veAQCziwbR+XWB2zqJ12b4i/+hel9yLiD8pLncDH4fKIPIbt5238341Q==
"@rollup/rollup-linux-arm64-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.4.tgz"
integrity sha512-4n4gVwhPHR9q/g8lKCyz0yuaD0MvDf7dV4f9tHt0C73Mp8h38UCtSCSE6R9iBlTbXlmA8CjpsZoujhszefqueg==
"@rollup/rollup-linux-arm64-musl@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.4.tgz"
integrity sha512-u0n17nGA0nvi/11gcZKsjkLj1QIpAuPFQbR48Subo7SmZJnGxDpspyw2kbpuoQnyK+9pwf3pAoEXerJs/8Mi9g==
"@rollup/rollup-linux-loong64-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.4.tgz"
integrity sha512-0G2c2lpYtbTuXo8KEJkDkClE/+/2AFPdPAbmaHoE870foRFs4pBrDehilMcrSScrN/fB/1HTaWO4bqw+ewBzMQ==
"@rollup/rollup-linux-ppc64-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.4.tgz"
integrity sha512-teSACug1GyZHmPDv14VNbvZFX779UqWTsd7KtTM9JIZRDI5NUwYSIS30kzI8m06gOPB//jtpqlhmraQ68b5X2g==
"@rollup/rollup-linux-riscv64-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.4.tgz"
integrity sha512-/MOEW3aHjjs1p4Pw1Xk4+3egRevx8Ji9N6HUIA1Ifh8Q+cg9dremvFCUbOX2Zebz80BwJIgCBUemjqhU5XI5Eg==
"@rollup/rollup-linux-riscv64-musl@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.4.tgz"
integrity sha512-1HHmsRyh845QDpEWzOFtMCph5Ts+9+yllCrREuBR/vg2RogAQGGBRC8lDPrPOMnrdOJ+mt1WLMOC2Kao/UwcvA==
"@rollup/rollup-linux-s390x-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.4.tgz"
integrity sha512-seoeZp4L/6D1MUyjWkOMRU6/iLmCU2EjbMTyAG4oIOs1/I82Y5lTeaxW0KBfkUdHAWN7j25bpkt0rjnOgAcQcA==
"@rollup/rollup-linux-x64-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.4.tgz"
integrity sha512-Wi6AXf0k0L7E2gteNsNHUs7UMwCIhsCTs6+tqQ5GPwVRWMaflqGec4Sd8n6+FNFDw9vGcReqk2KzBDhCa1DLYg==
"@rollup/rollup-linux-x64-musl@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.4.tgz"
integrity sha512-dtBZYjDmCQ9hW+WgEkaffvRRCKm767wWhxsFW3Lw86VXz/uJRuD438/XvbZT//B96Vs8oTA8Q4A0AfHbrxP9zw==
"@rollup/rollup-openharmony-arm64@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.4.tgz"
integrity sha512-1ox+GqgRWqaB1RnyZXL8PD6E5f7YyRUJYnCqKpNzxzP0TkaUh112NDrR9Tt+C8rJ4x5G9Mk8PQR3o7Ku2RKqKA==
"@rollup/rollup-win32-arm64-msvc@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.4.tgz"
integrity sha512-8GKr640PdFNXwzIE0IrkMWUNUomILLkfeHjXBi/nUvFlpZP+FA8BKGKpacjW6OUUHaNI6sUURxR2U2g78FOHWQ==
"@rollup/rollup-win32-ia32-msvc@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.4.tgz"
integrity sha512-AIy/jdJ7WtJ/F6EcfOb2GjR9UweO0n43jNObQMb6oGxkYTfLcnN7vYYpG+CN3lLxrQkzWnMOoNSHTW54pgbVxw==
"@rollup/rollup-win32-x64-gnu@4.52.4":
version "4.52.4"
resolved "https://registry.npmmirror.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.4.tgz"
@@ -1272,6 +1062,13 @@
magic-string "^0.25.0"
string.prototype.matchall "^4.0.6"
"@types/echarts@^4.9.22":
version "4.9.22"
resolved "https://registry.npmmirror.com/@types/echarts/-/echarts-4.9.22.tgz"
integrity sha512-7Fo6XdWpoi8jxkwP7BARUOM7riq8bMhmsCtSG8gzUcJmFhLo387tihoBYS/y5j7jl3PENT5RxeWZdN9RiwO7HQ==
dependencies:
"@types/zrender" "*"
"@types/estree@^1.0.0", "@types/estree@1.0.8":
version "1.0.8"
resolved "https://registry.npmmirror.com/@types/estree/-/estree-1.0.8.tgz"
@@ -1326,6 +1123,11 @@
resolved "https://registry.npmmirror.com/@types/web-bluetooth/-/web-bluetooth-0.0.16.tgz"
integrity sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==
"@types/zrender@*":
version "4.0.6"
resolved "https://registry.npmmirror.com/@types/zrender/-/zrender-4.0.6.tgz"
integrity sha512-1jZ9bJn2BsfmYFPBHtl5o3uV+ILejAtGrDcYSpT4qaVKEI/0YY+arw3XHU04Ebd8Nca3SQ7uNcLaqiL+tTFVMg==
"@typescript-eslint/eslint-plugin@^5.0.0", "@typescript-eslint/eslint-plugin@^5.4.0":
version "5.62.0"
resolved "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz"
@@ -2001,6 +1803,14 @@ dunder-proto@^1.0.0, dunder-proto@^1.0.1:
es-errors "^1.3.0"
gopd "^1.2.0"
echarts@^6.0.0:
version "6.0.0"
resolved "https://registry.npmmirror.com/echarts/-/echarts-6.0.0.tgz"
integrity sha512-Tte/grDQRiETQP4xz3iZWSvoHrkCQtwqd6hs+mifXcjrCuo2iKWbajFObuLJVBlDIJlOzgQPd1hsaKt/3+OMkQ==
dependencies:
tslib "2.3.0"
zrender "6.0.0"
ejs@^3.1.6:
version "3.1.10"
resolved "https://registry.npmmirror.com/ejs/-/ejs-3.1.10.tgz"
@@ -2478,11 +2288,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmmirror.com/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
fsevents@~2.3.2, fsevents@~2.3.3:
version "2.3.3"
resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz"
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
function-bind@^1.1.2:
version "1.1.2"
resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz"
@@ -3852,6 +3657,11 @@ tslib@^1.8.1:
resolved "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@2.3.0:
version "2.3.0"
resolved "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz"
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==
tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.npmmirror.com/tsutils/-/tsutils-3.21.0.tgz"
@@ -4317,3 +4127,10 @@ yallist@^3.0.2:
version "3.1.1"
resolved "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz"
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
zrender@6.0.0:
version "6.0.0"
resolved "https://registry.npmmirror.com/zrender/-/zrender-6.0.0.tgz"
integrity sha512-41dFXEEXuJpNecuUQq6JlbybmnHaqqpGlbH1yxnA5V9MMP4SbohSVZsJIwz+zdjQXSSlR1Vc34EgH1zxyTDvhg==
dependencies:
tslib "2.3.0"

246
视图结构树.md Normal file
View File

@@ -0,0 +1,246 @@
# 学校新闻系统 - 视图结构树
## 前端视图结构
### 1. 首页 (Home)
- **路径**: `/`
- **视图**: `Home.vue`
- **子组件**:
- `NavigationBar.vue` - 导航栏
- `SearchIndex.vue` - 模糊检索
- `LearningDataOverview.vue` - 个人学习数据记录
- `TopMusicRecommend.vue` - TOP资源推荐
- `NewsOverview.vue` - 新闻概览
- `BookHallSection.vue` - 轮播组件
### 2. 资源中心 (Resource Center)
- **路径**: `/resource-center`
- **视图**: `ResourceCenterPage.vue`
- **子组件**:
- `NavigationBar.vue` - 导航栏
- `SearchIndex.vue` - 模糊检索
- `PartyHistoryLearning.vue` - 党史学习组件
- `PolicySpeech.vue` - 领导讲话组件
- `PolicyInterpretation.vue` - 政策解读组件
- `RedClassic.vue` - 红色经典组件
- `SpecialReport.vue` - 专题报告组件
- `WorldCase.vue` - 思政案例组件
- `MediaArchive.vue` - 资源详情组件(二级文章阅读页面)
### 3. 学习计划 (Study Plan)
- **路径**: `/study-plan`
- **视图**: `StudyPlanPage.vue`
- **子组件**:
- `StudyTasks.vue` - 学习任务组件
- 任务列表
- 任务进度
- `CourseCenter.vue` - 课程中心组件
- 富文本课程
### 4. 个人中心 (Personal Center)
- **路径**: `/user-center`
- **视图**: `UserCenterPage.vue`
- **子组件**:
- `LearningRecords.vue` - 学习记录组件
- `MyFavorites.vue` - 我的收藏组件
- `MyAchievements.vue` - 我的成就组件
### 5. 账号中心 (Account Center)
- **路径**: `/profile`
- **视图**: `ProfilePage.vue`
- **子组件**:
- `PersonalInfo.vue` - 个人信息组件
- `AccountSettings.vue` - 账号设置组件
### 6. 智能体模块 (AI Assistant)
- **路径**: `/ai-assistant`
- **视图**: `AIAssistantPage.vue`
- **子组件**:
- `ChatInterface.vue` - 对话功能组件
- `DialogHistory.vue` - 对话记录组件
- `FileInterpretation.vue` - 文件解读与记录组件
- `KnowledgeBase.vue` - 知识库管理组件
- **状态**: 悬浮球
### 7. 工作台 (Dashboard)
- **路径**: `/dashboard`
- **视图**: `Workplace.vue`
### 8. 登录模块 (Login)
- **路径**: `/login`
- **视图**: `Login.vue`
- **路径**: `/register`
- **视图**: `Register.vue`
- **路径**: `/forgot-password`
- **视图**: `ForgotPassword.vue`
### 9. 错误页面 (Error)
- **路径**: `/error/403`
- **视图**: `403.vue`
- **路径**: `/error/404`
- **视图**: `404.vue`
- **路径**: `/error/500`
- **视图**: `500.vue`
## 后端管理视图结构
### 1. 系统总览 (System Overview)
- **路径**: `/admin/overview`
- **视图**: `SystemOverview.vue`
- **功能组件**:
- 总用户数统计组件
- 总资源数统计组件
- 今日访问量统计组件
- 用户活跃度折线图组件
- 资源分类统计占比饼图组件
### 2. 用户管理 (User Management)
- **路径**: `/admin/manage/system/user`
- **视图**: `UserManageView.vue`
- **路径**: `/admin/manage/system/dept`
- **视图**: `DeptManageView.vue` - 组织结构管理
- **路径**: `/admin/manage/system/role`
- **视图**: `RoleManageView.vue` - 角色管理
- **路径**: `/admin/manage/system/permission`
- **视图**: `PermissionManageView.vue` - 权限配置管理
- **路径**: `/admin/manage/system/menu`
- **视图**: `MenuManageView.vue` - 菜单管理
### 3. 资源管理 (Resource Management)
- **路径**: `/admin/manage/resource/resource`
- **视图**: `ResourceManagement.vue` - 资源管理
- **路径**: `/admin/manage/resource/article`
- **视图**: `ArticleManagement.vue` - 新闻文章管理
- **路径**: `/admin/manage/resource/data-records`
- **视图**: `DataRecords.vue` - 数据记录
### 4. 运营管理 (Operations Management)
- **路径**: `/admin/manage/content/banner`
- **视图**: `BannerManagement.vue` - Banner管理
- **路径**: `/admin/manage/content/tag`
- **视图**: `TagManagement.vue` - 标签管理
- **路径**: `/admin/manage/content/column`
- **视图**: `ColumnManagement.vue` - 栏目管理
- **路径**: `/admin/manage/content/content`
- **视图**: `ContentManagement.vue` - 内容管理
### 5. 学习管理 (Learning Management)
- **路径**: `/admin/manage/study/study`
- **视图**: `StudyManagement.vue` - 学习管理
- **路径**: `/admin/manage/study/task-publish`
- **视图**: `TaskPublish.vue` - 学习任务发布
- **路径**: `/admin/manage/study/study-records`
- **视图**: `StudyRecords.vue` - 学习记录
### 6. 智能体管理 (AI Management)
- **路径**: `/admin/manage/ai/ai`
- **视图**: `AIManagement.vue` - AI管理
- **路径**: `/admin/manage/ai/config`
- **视图**: `AIConfig.vue` - 基础配置
- **路径**: `/admin/manage/ai/knowledge`
- **视图**: `KnowledgeManagement.vue` - 知识库管理
### 7. 系统日志 (System Logs)
- **路径**: `/admin/manage/logs/system`
- **视图**: `SystemLogs.vue` - 系统日志
- **路径**: `/admin/manage/logs/login`
- **视图**: `LoginLogs.vue` - 登录日志
- **路径**: `/admin/manage/logs/operation`
- **视图**: `OperationLogs.vue` - 操作日志
- **路径**: `/admin/manage/logs/config`
- **视图**: `SystemConfig.vue` - 系统配置
## 路由结构
### 前端路由
```
/ (首页)
├── /resource-center (资源中心)
├── /study-plan (学习计划)
├── /user-center (个人中心)
├── /profile (账号中心)
├── /ai-assistant (智能体模块)
├── /dashboard (工作台)
├── /login (登录)
├── /register (注册)
├── /forgot-password (忘记密码)
└── /error (错误页面)
├── /error/403
├── /error/404
└── /error/500
```
### 后端管理路由
```
/admin
├── /overview (系统总览)
└── /manage
├── /system (系统管理)
│ ├── /user (用户管理)
│ ├── /dept (部门管理)
│ ├── /role (角色管理)
│ ├── /permission (权限管理)
│ └── /menu (菜单管理)
├── /resource (资源管理)
│ ├── /resource (资源管理)
│ ├── /article (文章管理)
│ └── /data-records (数据记录)
├── /content (运营管理)
│ ├── /banner (Banner管理)
│ ├── /tag (标签管理)
│ ├── /column (栏目管理)
│ └── /content (内容管理)
├── /study (学习管理)
│ ├── /study (学习管理)
│ ├── /task-publish (任务发布)
│ └── /study-records (学习记录)
├── /ai (智能体管理)
│ ├── /ai (AI管理)
│ ├── /config (AI配置)
│ └── /knowledge (知识库管理)
└── /logs (系统日志)
├── /system (系统日志)
├── /login (登录日志)
├── /operation (操作日志)
└── /config (系统配置)
```
## 组件层级关系
### 布局组件
- `BasicLayout` - 基础布局
- `NavigationLayout` - 导航布局
- `BlankLayout` - 空白布局
- `PageLayout` - 页面布局
### 通用组件
- `NavigationBar` - 导航栏组件
- `SearchIndex` - 搜索组件
- `DialogHistory` - 对话历史组件
- `FileInterpretation` - 文件解读组件
## 视图与组件区别
### 视图 (Views)
- 有独立的URL路径
- 可以直接通过路由访问
- 通常包含完整的页面功能
- 使用布局组件进行包装
### 组件 (Components)
- 没有独立的URL路径
- 只能被其他视图或组件引用
- 通常实现特定的功能模块
- 可复用的UI单元
## 权限控制
### 前端权限
- 根据用户角色显示不同的菜单和功能
- 路由级别的权限控制
- 组件级别的权限控制
### 后端权限
- 基于RBAC的权限模型
- 部门-角色-权限关联
- 菜单-权限关联