113 lines
3.7 KiB
PHP
113 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* 班级操行分管理系统 - 家长端首页
|
|
*
|
|
* 开发者: Canglan
|
|
* 联系方式: admin@sea-studio.top
|
|
* 版权归属: Sea Network Technology Studio
|
|
* 许可证: MIT License
|
|
*
|
|
* 版权所有 © Sea Network Technology Studio
|
|
*/
|
|
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'parent') {
|
|
header('Location: /index.php');
|
|
exit();
|
|
}
|
|
|
|
$page_title = '首页';
|
|
include __DIR__ . '/../includes/header.php';
|
|
?>
|
|
|
|
<div class="nav">
|
|
<a href="/parent/dashboard.php" class="nav-item active">首页</a>
|
|
<a href="/parent/history.php" class="nav-item">历史记录</a>
|
|
<a href="/parent/attendance.php" class="nav-item">考勤记录</a>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="child-info">
|
|
<div class="child-name" id="childName">--</div>
|
|
<div class="child-no" id="childNo">--</div>
|
|
<div class="child-no" id="childDormitory" style="display:none;"></div>
|
|
</div>
|
|
<div class="stats-grid">
|
|
<div class="stat-card">
|
|
<div class="stat-label">当前操行分</div>
|
|
<div class="stat-value" id="totalPoints">--</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="stat-label">班级排名</div>
|
|
<div class="stat-value" id="studentRank">--</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="stat-label">缺交次数</div>
|
|
<div class="stat-value" id="homeworkMissing">--</div>
|
|
</div>
|
|
</div>
|
|
<div class="initial-points-hint" id="initialPointsHint"></div>
|
|
</div>
|
|
|
|
<style>
|
|
.child-info {
|
|
text-align: center;
|
|
padding: 20px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border-radius: 12px;
|
|
color: white;
|
|
margin-bottom: 20px;
|
|
}
|
|
.child-name { font-size: 24px; font-weight: bold; margin-bottom: 8px; }
|
|
.child-no { font-size: 14px; opacity: 0.9; }
|
|
.initial-points-hint {
|
|
text-align: center;
|
|
color: #999;
|
|
font-size: 13px;
|
|
margin-top: 8px;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
async function loadDashboard() {
|
|
const res = await apiGet('/api/parent/child/conduct');
|
|
if (res && res.success) {
|
|
document.getElementById('childName').textContent = res.data.student_name;
|
|
document.getElementById('childNo').textContent = res.data.student_no;
|
|
document.getElementById('totalPoints').textContent = res.data.total_points;
|
|
if (res.data.dormitory_number) {
|
|
document.getElementById('childDormitory').textContent = '宿舍号: ' + res.data.dormitory_number;
|
|
document.getElementById('childDormitory').style.display = '';
|
|
}
|
|
}
|
|
|
|
// 加载排名信息
|
|
const rankRes = await apiGet('/api/parent/child/ranking');
|
|
if (rankRes && rankRes.success) {
|
|
const rank = rankRes.data.rank;
|
|
if (rank) {
|
|
document.getElementById('studentRank').textContent = `第${rank}名`;
|
|
} else {
|
|
document.getElementById('studentRank').textContent = '--';
|
|
}
|
|
}
|
|
|
|
// 加载作业缺交次数
|
|
const hwRes = await apiGet('/api/parent/child/homework');
|
|
if (hwRes && hwRes.success && hwRes.data.homework) {
|
|
const homework = hwRes.data.homework;
|
|
const total = homework.length;
|
|
const notSubmitted = homework.filter(h => h.status === 'not_submitted' || h.status === 'late').length;
|
|
document.getElementById('homeworkMissing').textContent = `缺交 ${notSubmitted}/${total} 次`;
|
|
}
|
|
|
|
// 显示初始分提示
|
|
const initialPoints = window.STUDENT_INITIAL_POINTS || 60;
|
|
document.getElementById('initialPointsHint').textContent = `初始操行分为 ${initialPoints} 分`;
|
|
}
|
|
loadDashboard();
|
|
</script>
|
|
<script src="/assets/js/parent.js"></script>
|
|
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|