v0.6测试

This commit is contained in:
2026-04-14 19:18:11 +08:00
parent fd3535f884
commit a60ba8352f
23 changed files with 157 additions and 40 deletions

View File

@@ -20,7 +20,7 @@ if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'admin') {
$page_title = '操行分管理';
$role = $_SESSION['role'] ?? '';
if (!in_array($role, ['班主任', '班长'])) {
if (!in_array($role, ['班主任', '班长', '劳动委员'])) {
header('Location: /admin/dashboard.php');
exit();
}
@@ -112,7 +112,11 @@ loadStudents();
<div class="form-group">
<label>分数变动</label>
<input type="number" id="pointsChange" required placeholder="正数为加分,负数为扣分">
<small><?php echo $role === '班长' ? '班长单次±5分以内' : '班主任无限制'; ?></small>
<small><?php
if ($role === '班长') echo '班长单次±5分以内';
elseif ($role === '劳动委员') echo '劳动委员仅限±1分';
else echo '班主任无限制';
?></small>
</div>
<div class="form-group">
<label>原因</label>

View File

@@ -58,7 +58,7 @@ async function loadDashboard() {
}
let quickActions = '';
if ('<?php echo $role; ?>' === '班主任' || '<?php echo $role; ?>' === '班长') {
if ('<?php echo $role; ?>' === '班主任' || '<?php echo $role; ?>' === '班长' || '<?php echo $role; ?>' === '劳动委员') {
quickActions += '<button class="btn btn-primary" onclick="location.href=\'/admin/conduct.php\'">操行分管理</button>';
}
if ('<?php echo $role; ?>' === '班主任') {

View File

@@ -66,8 +66,8 @@ include __DIR__ . '/../includes/header.php';
</div>
<script>
let currentHistoryPage = 1;
let totalHistoryPages = 1;
var currentHistoryPage = 1;
var totalHistoryPages = 1;
async function loadStudentsForSelect() {
const res = await apiGet('/api/admin/students');
@@ -86,12 +86,14 @@ async function loadHistory(page = 1) {
const endDate = document.getElementById('historyEndDate').value;
const studentId = document.getElementById('historyStudentId').value;
const res = await apiGet('/api/admin/conduct/history', {
const params = {
page, page_size: 20,
start_date: startDate,
end_date: endDate,
student_id: studentId
});
end_date: endDate
};
if (studentId) params.student_id = studentId;
const res = await apiGet('/api/admin/conduct/history', params);
if (res && res.success) {
let html = '';

View File

@@ -172,7 +172,6 @@ function handleSubmitPoints() {
submitBatchPoints();
}
loadStudents();
loadStudents();
</script>
<script src="/assets/js/admin.js"></script>

View File

@@ -112,8 +112,8 @@ include __DIR__ . '/../includes/header.php';
<script>
const userRole = '<?php echo $role; ?>';
let currentPage = 1;
let totalPages = 1;
var currentPage = 1;
var totalPages = 1;
async function loadStudents(page = 1) {
currentPage = page;