培训管理子系统开发7

整个项目预期的任务量 (任务量 = 所有工作的预期时间10天)和 目前已经花的时间 (所有记录的 ‘已经花费的时间’7天),还剩余的时间(所有工作的 ‘剩余时间’3天)


实现了员工成绩查看功能开发

    // 成绩查看增强
    @GetMapping("/results")
    public String viewResults(HttpSession session, Model model) {
        User employee = getCurrentEmployee(session);
        List<ExamSubmission> submissions = employeeService.getSubmissions(employee.getId());
        model.addAttribute("submissions", submissions);
        return "employee/results";
    }
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>考试成绩</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        /* 统一基础样式 */
        body {
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            margin: 0;
            min-height: 100vh;
        }

        .admin-container {
            background: rgba(255, 255, 255, 0.98);
            border-radius: 16px;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
            padding: 2.5rem;
            max-width: 1200px;
            margin: 2rem auto;
            backdrop-filter: blur(8px);
        }

        h2 {
            color: #1e3c72;
            margin: 0 0 2rem;
            padding-bottom: 1rem;
            border-bottom: 3px solid #1e3c72;
            font-size: 2rem;
            letter-spacing: -0.5px;
        }

        /* 返回链接样式 */
        .back-link {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            color: #2a5298;
            padding: 0.8rem 1.2rem;
            border-radius: 6px;
            background: rgba(42,82,152,0.1);
            transition: all 0.2s ease;
            text-decoration: none;
            margin-bottom: 2rem;
        }
        .back-link:hover {
            background: rgba(42,82,152,0.2);
            transform: translateX(-3px);
        }

        /* 卡片样式 */
        .result-card {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            margin-bottom: 1.5rem;
            box-shadow: 0 2px 6px rgba(0,0,0,0.05);
            transition: transform 0.2s ease;
        }
        .result-card:hover {
            transform: translateY(-3px);
        }

        h3 {
            color: #1e3c72 !important;
            margin: 0 0 1rem !important;
            font-size: 1.4rem;
            border-left: 4px solid #2a5298;
            padding-left: 1rem;
        }

        /* 时间显示 */
        .submit-time {
            color: #7f8c8d;
            font-size: 0.9rem;
            margin: 0.5rem 0 1.5rem;
        }

        /* 答案区域 */
        .answer-section {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 1.5rem;
            margin: 1.5rem 0;
            border: 1px solid #e0e0e0;
        }
        pre {
            white-space: pre-wrap;
            font-family: 'Courier New', Courier, monospace;
            line-height: 1.6;
            margin: 0;
            color: #4a5568;
        }

        /* 状态标识 */
        .status-badge {
            padding: 12px 20px;
            border-radius: 20px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-top: 1rem;
        }
        .graded {
            background: #e8f6ef;
            color: #2e7d32;
            border: 1px solid #a5d6a7;
        }
        .ungraded {
            background: #fff3e0;
            color: #c62828;
            border: 1px solid #ffcdd2;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .admin-container {
                padding: 1.5rem;
                margin: 1rem;
            }
            .result-card {
                padding: 1.5rem;
            }
        }

        /* 提示信息 */
        .alert-container {
            position: fixed;
            top: 80px;
            right: 20px;
            z-index: 1000;
            max-width: 400px;
        }
        .alert {
            padding: 1rem 1.5rem;
            border-radius: 8px;
            margin-bottom: 1rem;
            font-weight: 500;
            transition: opacity 0.5s ease;
        }
        .alert.success {
            background: #e8f6ef;
            color: #2e7d32;
            border: 1px solid #a5d6a7;
        }
        .alert.error {
            background: #ffebee;
            color: #c62828;
            border: 1px solid #ffcdd2;
        }
    </style>
</head>
<body>
<div class="alert-container">
    <div th:if="${success}" class="alert success" th:text="${success}"></div>
    <div th:if="${error}" class="alert error" th:text="${error}"></div>
</div>

<div class="admin-container">

    <h2>考试成绩查询</h2>
    <h3>试卷成绩列表</h3>
    <div th:each="sub : ${submissions}" class="result-card">
        <h3 th:text="${sub.paper.name} + ' 考试结果'"></h3>
        <p class="submit-time">
            [[${#temporals.format(sub.submitTime, 'yyyy-MM-dd HH:mm')}]]
        </p>

        <div class="answer-section">
            <h4>我的答案:</h4>
            <pre th:text="${sub.answer}"></pre>
        </div>

        <div th:if="${sub.score != null}" class="status-badge graded">
            <i class="fas fa-check-circle"></i>
            <span>最终得分:[[${sub.score}]]</span>
        </div>

        <div th:unless="${sub.score != null}" class="status-badge ungraded">
            <i class="fas fa-hourglass-half"></i>
            <span>状态:等待批阅</span>
        </div>
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function() {
        const alerts = document.querySelectorAll('.alert');
        alerts.forEach(alert => {
            setTimeout(() => {
                alert.style.opacity = '0';
                setTimeout(() => alert.remove(), 1000);
            }, 3000);
        });
    });
</script>
</body>
</html>
posted @ 2025-04-23 18:02  霸王鸡  阅读(21)  评论(0)    收藏  举报