feat: 多班级版班级管理系统 v2.0
技术栈:Go (Gin + GORM) + PHP + MySQL 5.7 + Redis 主要功能: - 多班级完全隔离(class_id 贯穿全系统) - 后端 Go Gin(端口 56789),Nginx 反代 - 超级管理员独立登录(env 配置,默认账密 admin/Admin123) - bcrypt 密码加密(无 PASSWORD_SALT) - 科任老师/课代表新角色 - 课代表作业管理页面 - 排行榜分项排行(操行分/考勤/作业) - 角色加减分上下限由班主任配置 - 家长改密功能(可开关) - 班级角色按需开关 - 宿舍号格式:南0-000 - 周度/月度重置功能 - MySQL 5.7 兼容 - 43 轮代码审查 + 全部修复 开发者: Canglan 版权归属: Sea Network Technology Studio 许可证: Apache License 2.0
This commit is contained in:
6
frontend/includes/footer.php
Normal file
6
frontend/includes/footer.php
Normal file
@@ -0,0 +1,6 @@
|
||||
</div><!-- /.container —— 依赖页面包含 <div class="container"> -->
|
||||
<footer class="footer">
|
||||
<p>© <?php echo date('Y'); ?> <?php echo htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8'); ?> · <span class="footer-dev">Powered by Canglan / Sea Network Technology Studio</span></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
92
frontend/includes/header.php
Normal file
92
frontend/includes/header.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* 多班级版班级管理系统 - 公共头部
|
||||
*
|
||||
* 开发者: Canglan
|
||||
* 联系方式: admin@sea-studio.top
|
||||
* 版权归属: Sea Network Technology Studio
|
||||
* 许可证: Apache License 2.0
|
||||
*
|
||||
* 版权所有 © Sea Network Technology Studio
|
||||
*/
|
||||
|
||||
if (!isset($_SESSION)) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$current_page = basename($_SERVER['PHP_SELF'], '.php');
|
||||
$user_type = $_SESSION['user_type'] ?? '';
|
||||
$role = $_SESSION['role'] ?? '';
|
||||
$class_id = $_SESSION['class_id'] ?? null;
|
||||
$class_name = $_SESSION['class_name'] ?? '';
|
||||
$page_title = $page_title ?? '首页';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<title><?php echo htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8'); ?> - <?php echo htmlspecialchars($page_title); ?></title>
|
||||
<link rel="stylesheet" href="/assets/css/style.css">
|
||||
<?php if ($user_type === 'admin'): ?>
|
||||
<link rel="stylesheet" href="/assets/css/admin.css">
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1><?php echo htmlspecialchars(SITE_NAME, ENT_QUOTES, 'UTF-8'); ?></h1>
|
||||
<div class="header-info">
|
||||
<?php if ($class_name): ?>
|
||||
<span class="class-name" id="className"><?php echo htmlspecialchars($class_name); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="user-name" id="userName"><?php echo htmlspecialchars($_SESSION['real_name'] ?? ''); ?></span>
|
||||
<?php if ($role): ?>
|
||||
<span class="user-role">(<?php echo htmlspecialchars($role); ?>)</span>
|
||||
<?php endif; ?>
|
||||
<button class="btn-logout" id="logoutBtn">退出登录</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
window.API_BASE_URL = <?php echo json_encode(API_BASE_URL); ?>;
|
||||
window.JWT_STORAGE_KEY = <?php echo json_encode(JWT_STORAGE_KEY); ?>;
|
||||
window.USER_STORAGE_KEY = <?php echo json_encode(USER_STORAGE_KEY); ?>;
|
||||
window.CLASS_ID = <?php echo $class_id ? $class_id : 'null'; ?>;
|
||||
window.CLASS_NAME = <?php echo json_encode($class_name); ?>;
|
||||
</script>
|
||||
<script>
|
||||
// 从后端API异步加载扣分规则配置(优先加载班级级配置)
|
||||
(function() {
|
||||
// 先设置默认值,避免异步加载期间其他脚本读取到 undefined
|
||||
window.DEDUCTION_HOMEWORK_NOT_SUBMIT = 2;
|
||||
window.DEDUCTION_HOMEWORK_LATE = 1;
|
||||
window.DEDUCTION_ATTENDANCE_ABSENT = 3;
|
||||
window.DEDUCTION_ATTENDANCE_LATE = 1;
|
||||
window.DEDUCTION_ATTENDANCE_LEAVE = 0;
|
||||
window.STUDENT_INITIAL_POINTS = 60;
|
||||
|
||||
var token = localStorage.getItem(window.JWT_STORAGE_KEY) || '';
|
||||
var apiUrl = window.API_BASE_URL + '/api/config/deduction-rules';
|
||||
if (window.CLASS_ID) {
|
||||
apiUrl += '?class_id=' + window.CLASS_ID;
|
||||
}
|
||||
fetch(apiUrl, {
|
||||
headers: token ? { 'Authorization': 'Bearer ' + token } : {}
|
||||
}).then(function(resp) {
|
||||
return resp.json();
|
||||
}).then(function(data) {
|
||||
if (data.success && data.data) {
|
||||
window.DEDUCTION_HOMEWORK_NOT_SUBMIT = data.data.DEDUCTION_HOMEWORK_NOT_SUBMIT;
|
||||
window.DEDUCTION_HOMEWORK_LATE = data.data.DEDUCTION_HOMEWORK_LATE;
|
||||
window.DEDUCTION_ATTENDANCE_ABSENT = data.data.DEDUCTION_ATTENDANCE_ABSENT;
|
||||
window.DEDUCTION_ATTENDANCE_LATE = data.data.DEDUCTION_ATTENDANCE_LATE;
|
||||
window.DEDUCTION_ATTENDANCE_LEAVE = data.data.DEDUCTION_ATTENDANCE_LEAVE;
|
||||
window.STUDENT_INITIAL_POINTS = data.data.STUDENT_INITIAL_POINTS;
|
||||
}
|
||||
}).catch(function() {
|
||||
// API加载失败时保留默认值
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/assets/js/common.js"></script>
|
||||
<script src="/assets/js/modules/utils.js"></script>
|
||||
<div class="container">
|
||||
31
frontend/includes/nav.php
Normal file
31
frontend/includes/nav.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<div class="nav">
|
||||
<a href="/admin/dashboard.php" class="nav-item<?php echo $current_page === 'dashboard' ? ' active' : ''; ?>">首页</a>
|
||||
<?php if ($user_type === 'super_admin'): ?>
|
||||
<a href="/admin/classes.php" class="nav-item<?php echo $current_page === 'classes' ? ' active' : ''; ?>">班级管理</a>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array($role, ['班主任', '系统管理员'])): ?>
|
||||
<a href="/admin/students.php" class="nav-item<?php echo $current_page === 'students' ? ' active' : ''; ?>">学生管理</a>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array($role, ['班主任', '班长', '学习委员', '考勤委员', '劳动委员', '志愿委员', '科任老师', '系统管理员'])): ?>
|
||||
<a href="/admin/conduct.php" class="nav-item<?php echo $current_page === 'conduct' ? ' active' : ''; ?>">操行分管理</a>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array($role, ['班主任', '学习委员', '科任老师', '系统管理员'])): ?>
|
||||
<a href="/admin/homework.php" class="nav-item<?php echo $current_page === 'homework' ? ' active' : ''; ?>">作业扣分</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($role === '课代表'): ?>
|
||||
<a href="/admin/cadre_homework.php" class="nav-item<?php echo $current_page === 'cadre_homework' ? ' active' : ''; ?>">作业管理</a>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array($role, ['班主任', '考勤委员', '系统管理员'])): ?>
|
||||
<a href="/admin/attendance.php" class="nav-item<?php echo $current_page === 'attendance' ? ' active' : ''; ?>">考勤管理</a>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array($role, ['班主任', '系统管理员'])): ?>
|
||||
<a href="/admin/admins.php" class="nav-item<?php echo $current_page === 'admins' ? ' active' : ''; ?>">管理员管理</a>
|
||||
<a href="/admin/semesters.php" class="nav-item<?php echo $current_page === 'semesters' ? ' active' : ''; ?>">学期管理</a>
|
||||
<a href="/admin/class_settings.php" class="nav-item<?php echo $current_page === 'class_settings' ? ' active' : ''; ?>">班级设置</a>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array($role, ['班主任', '系统管理员'])): ?>
|
||||
<a href="/admin/rankings.php" class="nav-item<?php echo $current_page === 'rankings' ? ' active' : ''; ?>">排行榜</a>
|
||||
<?php endif; ?>
|
||||
<a href="/admin/history.php" class="nav-item<?php echo $current_page === 'history' ? ' active' : ''; ?>">历史记录</a>
|
||||
<a href="/admin/password.php" class="nav-item<?php echo $current_page === 'password' ? ' active' : ''; ?>">修改密码</a>
|
||||
</div>
|
||||
Reference in New Issue
Block a user