mirror of
https://hub.gitmirror.com/https://github.com/ExamAware/ExamCloudSchedule
synced 2025-04-29 03:36:36 +00:00
feat: Material Design 3 样式
This commit is contained in:
parent
f57ffbf367
commit
b3039ef4fa
276
admin/edit.php
276
admin/edit.php
@ -3,168 +3,222 @@ require_once '../includes/auth.php';
|
|||||||
checkLogin();
|
checkLogin();
|
||||||
|
|
||||||
$id = $_GET['id'] ?? '';
|
$id = $_GET['id'] ?? '';
|
||||||
$config = ['examName' => '', 'message' => '', 'examInfos' => []];
|
$config = ['examName' => '', 'message' => '', 'room' => '', 'examInfos' => []];
|
||||||
|
|
||||||
|
// Debug: 输出POST数据
|
||||||
|
error_log('POST data: ' . print_r($_POST, true));
|
||||||
|
|
||||||
// 保存逻辑
|
// 保存逻辑
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$id = preg_replace('/[^a-zA-Z0-9]/', '', $_POST['id']);
|
$id = preg_replace('/[^a-zA-Z0-9]/', '', $_POST['id']);
|
||||||
|
|
||||||
$newConfig = [
|
$newConfig = [
|
||||||
'examName' => $_POST['examName'],
|
'examName' => $_POST['examName'] ?? '',
|
||||||
'message' => $_POST['message'],
|
'message' => $_POST['message'] ?? '',
|
||||||
'room' => $_POST['room'],
|
'room' => $_POST['room'] ?? '',
|
||||||
'examInfos' => []
|
'examInfos' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($_POST['subject'] as $index => $subject) {
|
// 验证并处理科目数据
|
||||||
$newConfig['examInfos'][] = [
|
if (isset($_POST['subject']) && is_array($_POST['subject'])) {
|
||||||
'name' => $subject,
|
foreach ($_POST['subject'] as $index => $subject) {
|
||||||
'start' => $_POST['start'][$index],
|
if (!empty($subject) && isset($_POST['start'][$index]) && isset($_POST['end'][$index])) {
|
||||||
'end' => $_POST['end'][$index]
|
// 格式化时间为标准格式
|
||||||
];
|
$startTime = date('Y-m-d\TH:i:s', strtotime($_POST['start'][$index]));
|
||||||
|
$endTime = date('Y-m-d\TH:i:s', strtotime($_POST['end'][$index]));
|
||||||
|
|
||||||
|
$newConfig['examInfos'][] = [
|
||||||
|
'name' => $subject,
|
||||||
|
'start' => $startTime,
|
||||||
|
'end' => $endTime
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents("../configs/{$id}.json", json_encode($newConfig, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
|
// Debug: 输出配置数据
|
||||||
header('Location: index.php');
|
error_log('Config to save: ' . print_r($newConfig, true));
|
||||||
exit;
|
|
||||||
|
// 保存配置
|
||||||
|
$jsonData = json_encode($newConfig, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
|
if ($jsonData === false) {
|
||||||
|
error_log('JSON encode error: ' . json_last_error_msg());
|
||||||
|
} else {
|
||||||
|
$saveResult = file_put_contents("../configs/{$id}.json", $jsonData);
|
||||||
|
if ($saveResult === false) {
|
||||||
|
error_log('File write failed for: ../configs/' . $id . '.json');
|
||||||
|
} else {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载现有配置
|
// 加载现有配置
|
||||||
if (!empty($id) && file_exists("../configs/{$id}.json")) {
|
if (!empty($id) && file_exists("../configs/{$id}.json")) {
|
||||||
$config = json_decode(file_get_contents("../configs/{$id}.json"), true);
|
$config = json_decode(file_get_contents("../configs/{$id}.json"), true);
|
||||||
|
if ($config === null) {
|
||||||
|
error_log('JSON decode error: ' . json_last_error_msg());
|
||||||
|
$config = ['examName' => '', 'message' => '', 'room' => '', 'examInfos' => []];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>编辑配置</title>
|
<title>编辑配置</title>
|
||||||
|
<link rel="stylesheet" href="/assets/css/md3.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
background: var(--md-surface);
|
||||||
background-color: #f2f2f2;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 24px;
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
background-color: #fff;
|
max-width: 1200px;
|
||||||
padding: 20px;
|
margin: 0 auto;
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
||||||
width: 500px;
|
|
||||||
}
|
}
|
||||||
.container h3 {
|
|
||||||
margin-top: 0;
|
.form-wrapper {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
}
|
}
|
||||||
.container div {
|
|
||||||
margin-bottom: 15px;
|
.form-basic {
|
||||||
|
width: 380px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
height: fit-content;
|
||||||
|
background: var(--md-surface);
|
||||||
|
padding: 24px;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: var(--md-elevation-1);
|
||||||
}
|
}
|
||||||
.container label {
|
|
||||||
display: block;
|
.form-basic .md3-text-field {
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.container input[type="text"],
|
|
||||||
.container input[type="datetime-local"] {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.container button {
|
|
||||||
padding: 10px 15px;
|
.form-basic .form-group {
|
||||||
background-color: #4CAF50;
|
display: flex;
|
||||||
color: white;
|
flex-direction: column;
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
.container button:hover {
|
|
||||||
background-color: #45a049;
|
.form-basic .md3-label {
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-subjects {
|
||||||
|
flex-grow: 1;
|
||||||
|
background: var(--md-surface);
|
||||||
|
padding: 24px;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: var(--md-elevation-1);
|
||||||
|
min-width: 0; /* 防止flex子项溢出 */
|
||||||
|
}
|
||||||
|
|
||||||
.subject {
|
.subject {
|
||||||
margin: 10px 0;
|
background: var(--md-surface-variant);
|
||||||
padding: 10px;
|
padding: 24px;
|
||||||
border: 1px solid #ccc;
|
border-radius: 16px;
|
||||||
border-radius: 4px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
.subject button {
|
|
||||||
background-color: #dc3545;
|
.form-group {
|
||||||
margin-top: 10px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
.subject button:hover {
|
|
||||||
background-color: #c82333;
|
.form-actions {
|
||||||
|
margin-top: 24px;
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin-top: 0;
|
||||||
|
color: var(--md-on-surface);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<form method="post" id="examForm" class="form-wrapper">
|
||||||
|
<div class="form-basic">
|
||||||
|
<h3>基本信息</h3>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">配置ID:</label>
|
||||||
|
<input type="text" name="id" class="md3-text-field" value="<?= htmlspecialchars($id) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">考试名称:</label>
|
||||||
|
<input type="text" name="examName" class="md3-text-field" value="<?= htmlspecialchars($config['examName']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">考试提示语:</label>
|
||||||
|
<input type="text" name="message" class="md3-text-field" value="<?= htmlspecialchars($config['message']) ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">考场号:</label>
|
||||||
|
<input type="text" name="room" class="md3-text-field" value="<?= htmlspecialchars($config['room'] ?? '') ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="submit" class="md3-button">保存配置</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-subjects">
|
||||||
|
<h3>考试科目安排</h3>
|
||||||
|
<div id="subjects">
|
||||||
|
<?php if (!empty($config['examInfos'])): ?>
|
||||||
|
<?php foreach ($config['examInfos'] as $subject): ?>
|
||||||
|
<div class="subject">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">科目名称:</label>
|
||||||
|
<input type="text" name="subject[]" class="md3-text-field" value="<?= htmlspecialchars($subject['name']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">开始时间:</label>
|
||||||
|
<input type="datetime-local" name="start[]" class="md3-text-field" value="<?= htmlspecialchars($subject['start']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="md3-label">结束时间:</label>
|
||||||
|
<input type="datetime-local" name="end[]" class="md3-text-field" value="<?= htmlspecialchars($subject['end']) ?>" required>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="md3-button delete-btn" onclick="this.parentElement.remove()">删除</button>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="button" class="md3-button" onclick="addSubject()">添加科目</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function addSubject() {
|
function addSubject() {
|
||||||
const container = document.getElementById('subjects');
|
const container = document.getElementById('subjects');
|
||||||
const index = Date.now();
|
|
||||||
const html = `
|
const html = `
|
||||||
<div class="subject">
|
<div class="subject">
|
||||||
<div>
|
<div class="form-group">
|
||||||
<label>科目名称:</label>
|
<label class="md3-label">科目名称:</label>
|
||||||
<input type="text" name="subject[]" required>
|
<input type="text" name="subject[]" class="md3-text-field" required>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-group">
|
||||||
<label>开始时间:</label>
|
<label class="md3-label">开始时间:</label>
|
||||||
<input type="datetime-local" name="start[]" required>
|
<input type="datetime-local" name="start[]" class="md3-text-field" required>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="form-group">
|
||||||
<label>结束时间:</label>
|
<label class="md3-label">结束时间:</label>
|
||||||
<input type="datetime-local" name="end[]" required>
|
<input type="datetime-local" name="end[]" class="md3-text-field" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" onclick="this.parentElement.remove()">删除</button>
|
<button type="button" class="md3-button delete-btn" onclick="this.parentElement.remove()">删除</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
container.insertAdjacentHTML('beforeend', html);
|
container.insertAdjacentHTML('beforeend', html);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<form method="post">
|
|
||||||
<div>
|
|
||||||
<label>配置ID:</label>
|
|
||||||
<input type="text" name="id" value="<?= htmlspecialchars($id) ?>" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>考试名称:</label>
|
|
||||||
<input type="text" name="examName" value="<?= htmlspecialchars($config['examName']) ?>" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>考试提示语:</label>
|
|
||||||
<input type="text" name="message" value="<?= htmlspecialchars($config['message']) ?>">
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>考场号:</label>
|
|
||||||
<input type="text" name="room" value="<?= htmlspecialchars($config['room'] ?? '') ?>" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>考试科目安排</h3>
|
|
||||||
<div id="subjects">
|
|
||||||
<?php foreach ($config['examInfos'] as $subject): ?>
|
|
||||||
<div class="subject">
|
|
||||||
<div>
|
|
||||||
<label>科目名称:</label>
|
|
||||||
<input type="text" name="subject[]" value="<?= htmlspecialchars($subject['name']) ?>" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>开始时间:</label>
|
|
||||||
<input type="datetime-local" name="start[]" value="<?= str_replace(' ', 'T', $subject['start']) ?>" required>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label>结束时间:</label>
|
|
||||||
<input type="datetime-local" name="end[]" value="<?= str_replace(' ', 'T', $subject['end']) ?>" required>
|
|
||||||
</div>
|
|
||||||
<button type="button" onclick="this.parentElement.remove()">删除</button>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</div>
|
|
||||||
<button type="button" onclick="addSubject()">添加科目</button>
|
|
||||||
<hr>
|
|
||||||
<button type="submit">保存配置</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
172
admin/index.php
172
admin/index.php
@ -24,109 +24,137 @@ uksort($configs, function($a, $b) {
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>配置管理后台</title>
|
<title>配置管理后台</title>
|
||||||
|
<link rel="stylesheet" href="/assets/css/md3.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Roboto, sans-serif;
|
||||||
background-color: #f2f2f2;
|
background: var(--md-surface);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
padding: 0 24px;
|
||||||
}
|
}
|
||||||
.header h1 {
|
|
||||||
margin: 0;
|
.content {
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0 24px;
|
||||||
}
|
}
|
||||||
.add-btn-container {
|
|
||||||
margin-bottom: 20px;
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||||
|
gap: 24px;
|
||||||
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
.card {
|
||||||
width: 100%;
|
background: var(--md-surface);
|
||||||
background-color: #fff;
|
border-radius: 16px;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
padding: 24px;
|
||||||
border-radius: 8px;
|
box-shadow: var(--md-elevation-1);
|
||||||
overflow: hidden;
|
transition: box-shadow 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
}
|
}
|
||||||
th, td {
|
|
||||||
padding: 12px;
|
.card:hover {
|
||||||
text-align: left;
|
box-shadow: var(--md-elevation-2);
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
}
|
}
|
||||||
th {
|
|
||||||
background-color: #f5f5f5;
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
.actions a {
|
|
||||||
margin-right: 10px;
|
.card-title {
|
||||||
color: #007bff;
|
font-size: 20px;
|
||||||
text-decoration: none;
|
font-weight: 500;
|
||||||
|
color: var(--md-on-surface);
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
.actions a:hover {
|
|
||||||
text-decoration: underline;
|
.card-meta {
|
||||||
|
color: var(--md-on-surface-variant);
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
.logout {
|
|
||||||
color: #dc3545;
|
.card-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid var(--md-outline);
|
||||||
}
|
}
|
||||||
.add-btn {
|
|
||||||
background: #28a745;
|
.card-actions a {
|
||||||
color: white;
|
text-decoration: none; /* 添加这一行 */
|
||||||
padding: 10px 15px;
|
|
||||||
border-radius: 4px;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
}
|
||||||
.add-btn:hover {
|
|
||||||
background: #218838;
|
.add-card {
|
||||||
|
border: 2px dashed var(--md-outline);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
min-height: 200px;
|
||||||
|
text-decoration: none; /* 添加这一行 */
|
||||||
}
|
}
|
||||||
.no-configs {
|
|
||||||
text-align: center;
|
.add-card:hover {
|
||||||
padding: 20px;
|
border-color: var(--md-primary);
|
||||||
color: #888;
|
background: var(--md-primary-container);
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-icon {
|
||||||
|
font-size: 48px;
|
||||||
|
color: var(--md-primary);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>考试配置管理 <small>当前用户:<?= $_SESSION['username'] ?></small></h1>
|
<h1>考试配置管理 <small>当前用户:<?= $_SESSION['username'] ?></small></h1>
|
||||||
<a href="login.php?action=logout" class="logout">退出登录</a>
|
<a href="login.php?action=logout" class="md3-button">退出登录</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="add-btn-container">
|
<div class="content">
|
||||||
<a href="edit.php" class="add-btn">新建配置</a>
|
<div class="grid">
|
||||||
</div>
|
<a href="edit.php" class="card add-card">
|
||||||
|
<div class="add-icon">+</div>
|
||||||
<table>
|
<span class="card-title">新建配置</span>
|
||||||
<thead>
|
</a>
|
||||||
<tr>
|
<?php if(!empty($configs)): ?>
|
||||||
<th>配置ID</th>
|
|
||||||
<th>最后修改时间</th>
|
|
||||||
<th>文件大小</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php if(empty($configs)): ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="4" class="no-configs">暂无配置文件</td>
|
|
||||||
</tr>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php foreach($configs as $config): ?>
|
<?php foreach($configs as $config): ?>
|
||||||
<tr>
|
<div class="card">
|
||||||
<td><?= htmlspecialchars($config['id']) ?></td>
|
<div class="card-header">
|
||||||
<td><?= $config['mtime'] ?></td>
|
<h3 class="card-title"><?= htmlspecialchars($config['id']) ?></h3>
|
||||||
<td><?= round($config['size']/1024, 2) ?> KB</td>
|
</div>
|
||||||
<td class="actions">
|
<div class="card-meta">
|
||||||
<a href="edit.php?id=<?= urlencode($config['id']) ?>">编辑</a>
|
最后修改:<?= $config['mtime'] ?><br>
|
||||||
<a href="#" onclick="confirmDelete('<?= $config['id'] ?>')">删除</a>
|
文件大小:<?= round($config['size']/1024, 2) ?> KB
|
||||||
<a href="../get_config.php?id=<?= urlencode($config['id']) ?>" target="_blank">预览</a>
|
</div>
|
||||||
</td>
|
<div class="card-actions">
|
||||||
</tr>
|
<a href="edit.php?id=<?= urlencode($config['id']) ?>" class="md3-button">编辑</a>
|
||||||
|
<a href="../get_config.php?id=<?= urlencode($config['id']) ?>" class="md3-button" target="_blank">查看</a>
|
||||||
|
<button class="md3-button" style="background:var(--md-error)" onclick="confirmDelete('<?= $config['id'] ?>')">删除</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function confirmDelete(id) {
|
function confirmDelete(id) {
|
||||||
|
@ -30,74 +30,73 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>登录</title>
|
<title>登录</title>
|
||||||
|
<link rel="stylesheet" href="/assets/css/md3.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
background: var(--md-surface);
|
||||||
background-color: #f2f2f2;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
min-height: 100vh;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-container {
|
.login-container {
|
||||||
background-color: #fff;
|
background: var(--md-surface);
|
||||||
padding: 20px;
|
padding: 32px;
|
||||||
border-radius: 8px;
|
border-radius: 28px;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
box-shadow: var(--md-elevation-1);
|
||||||
width: 300px;
|
width: 320px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-container form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container .md3-text-field {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-container .md3-button {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.login-container h2 {
|
.login-container h2 {
|
||||||
margin-top: 0;
|
color: var(--md-on-surface);
|
||||||
|
margin: 0 0 24px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.login-container div {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
.login-container label {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.login-container input {
|
.login-container input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px;
|
margin-bottom: 16px;
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.login-container button {
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
background-color: #4CAF50;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.login-container button:hover {
|
|
||||||
background-color: #45a049;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
color: red;
|
color: var(--md-error);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="login-container">
|
<div class="login-container md3-card">
|
||||||
<h2>登录</h2>
|
<h2>登录</h2>
|
||||||
<?php if (isset($error)): ?>
|
<?php if (isset($error)): ?>
|
||||||
<div class="error"><?= $error ?></div>
|
<div class="error"><?= $error ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div>
|
<label class="md3-label">用户名:</label>
|
||||||
<label>用户名:</label>
|
<input type="text" name="username" class="md3-text-field" required>
|
||||||
<input type="text" name="username" required>
|
|
||||||
</div>
|
<label class="md3-label">密码:</label>
|
||||||
<div>
|
<input type="password" name="password" class="md3-text-field" required>
|
||||||
<label>密码:</label>
|
|
||||||
<input type="password" name="password" required>
|
<button type="submit" class="md3-button">登录</button>
|
||||||
</div>
|
|
||||||
<button type="submit">登录</button>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
75
assets/css/md3.css
Normal file
75
assets/css/md3.css
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
:root {
|
||||||
|
/* MD3 Colors - Green Theme */
|
||||||
|
--md-primary: #2e7d32;
|
||||||
|
--md-on-primary: #FFFFFF;
|
||||||
|
--md-primary-container: #b8e6b9;
|
||||||
|
--md-on-primary-container: #005006;
|
||||||
|
--md-secondary: #466c48;
|
||||||
|
--md-on-secondary: #FFFFFF;
|
||||||
|
--md-surface: #fbfdf7;
|
||||||
|
--md-surface-variant: #dde5db;
|
||||||
|
--md-on-surface: #191c18;
|
||||||
|
--md-on-surface-variant: #414942;
|
||||||
|
--md-outline: #727971;
|
||||||
|
--md-error: #be3920;
|
||||||
|
|
||||||
|
/* Elevation */
|
||||||
|
--md-elevation-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.14);
|
||||||
|
--md-elevation-2: 0 3px 6px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-text-field {
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid var(--md-outline);
|
||||||
|
background: var(--md-surface);
|
||||||
|
color: var(--md-on-surface);
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
transition: border-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-text-field:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--md-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-button {
|
||||||
|
padding: 10px 24px;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: none;
|
||||||
|
background: var(--md-primary);
|
||||||
|
color: var(--md-on-primary);
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
text-decoration: none; /* 添加这一行 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-button:hover {
|
||||||
|
background: var(--md-primary-container);
|
||||||
|
color: var(--md-on-primary-container);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-card {
|
||||||
|
background: var(--md-surface);
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: var(--md-elevation-1);
|
||||||
|
transition: box-shadow 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-card:hover {
|
||||||
|
box-shadow: var(--md-elevation-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md3-label {
|
||||||
|
color: var(--md-on-surface-variant);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
166
index.php
166
index.php
@ -6,68 +6,74 @@ header('Content-Type: text/html; charset=utf-8');
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>考试看板配置查询</title>
|
<title>考试看板配置查询</title>
|
||||||
|
<link rel="stylesheet" href="/assets/css/md3.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: 'Roboto', Arial, sans-serif;
|
font-family: Roboto, sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: url('background.jpg') no-repeat center center fixed;
|
background: var(--md-surface);
|
||||||
background-size: cover;
|
color: var(--md-on-surface);
|
||||||
color: #333;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
min-height: 100vh;
|
||||||
transition: background-color 0.3s ease, color 0.3s ease;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
background-color: rgba(255, 255, 255, 0.9);
|
background: var(--md-surface);
|
||||||
padding: 20px;
|
padding: 32px;
|
||||||
border-radius: 8px;
|
border-radius: 28px;
|
||||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
|
box-shadow: var(--md-elevation-1);
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transition: background-color 0.3s ease, color 0.3s ease;
|
|
||||||
}
|
}
|
||||||
.form-group {
|
|
||||||
margin-bottom: 15px;
|
h1 {
|
||||||
}
|
color: var(--md-on-surface);
|
||||||
label {
|
font-size: 24px;
|
||||||
display: block;
|
margin-bottom: 24px;
|
||||||
margin-bottom: 5px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
input[type="text"] {
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
background: #6200ea;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 10px 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
button:hover {
|
|
||||||
background: #3700b3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#result {
|
#result {
|
||||||
margin-top: 20px;
|
margin-top: 24px;
|
||||||
white-space: pre-wrap;
|
padding: 16px;
|
||||||
color: #333;
|
background: var(--md-surface-variant);
|
||||||
|
border-radius: 16px;
|
||||||
|
max-height: 400px;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#result pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 定制滚动条样式 */
|
||||||
|
#result::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result::-webkit-scrollbar-track {
|
||||||
|
background: var(--md-surface-variant);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result::-webkit-scrollbar-thumb {
|
||||||
|
background: var(--md-outline);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#result::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: var(--md-primary);
|
||||||
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
color: red;
|
color: var(--md-error);
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
background: #f4f4f4;
|
background: var(--md-surface-variant);
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -77,50 +83,22 @@ header('Content-Type: text/html; charset=utf-8');
|
|||||||
.boolean { color: blue; }
|
.boolean { color: blue; }
|
||||||
.null { color: magenta; }
|
.null { color: magenta; }
|
||||||
.key { color: red; }
|
.key { color: red; }
|
||||||
.theme-toggle {
|
|
||||||
position: absolute;
|
|
||||||
top: 20px;
|
|
||||||
right: 20px;
|
|
||||||
background: #333;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 10px 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: background-color 0.3s ease, color 0.3s ease;
|
|
||||||
}
|
|
||||||
.dark-theme {
|
|
||||||
background: url('background-dark.jpg') no-repeat center center fixed !important;
|
|
||||||
background-size: cover !important;
|
|
||||||
color: #e0e0e0 !important;
|
|
||||||
}
|
|
||||||
.dark-theme .container {
|
|
||||||
background-color: rgba(50, 50, 50, 0.9) !important;
|
|
||||||
}
|
|
||||||
.dark-theme .theme-toggle {
|
|
||||||
background: #e0e0e0 !important;
|
|
||||||
color: #333 !important;
|
|
||||||
}
|
|
||||||
.dark-theme label {
|
|
||||||
color: #e0e0e0 !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button class="theme-toggle" onclick="toggleTheme()">切换主题</button>
|
<div class="container md3-card">
|
||||||
<div class="container">
|
|
||||||
<h1>考试看板配置查询</h1>
|
<h1>考试看板配置查询</h1>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="configId">输入配置ID:</label>
|
<label class="md3-label" for="configId">输入配置ID:</label>
|
||||||
<input type="text" id="configId" placeholder="例如:room301">
|
<input type="text" id="configId" class="md3-text-field" placeholder="例如:room301">
|
||||||
<button onclick="loadConfig()">获取配置</button>
|
<button class="md3-button" onclick="loadConfig()">获取配置</button>
|
||||||
<button id="enterButton" style="display:none;" onclick="enterSchedule()">进入</button>
|
<button id="enterButton" class="md3-button" style="display:none;" onclick="enterSchedule()">进入</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="result"></div>
|
<div id="result"></div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<p>管理员请前往 <a href="/admin/login.php">管理后台</a></p>
|
<p>管理员请前往 <a href="/admin/login.php" class="md3-button">管理后台</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -174,38 +152,6 @@ header('Content-Type: text/html; charset=utf-8');
|
|||||||
return '<span class="' + cls + '">' + match + '</span>';
|
return '<span class="' + cls + '">' + match + '</span>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleTheme() {
|
|
||||||
const body = document.body;
|
|
||||||
const container = document.querySelector('.container');
|
|
||||||
const themeToggle = document.querySelector('.theme-toggle');
|
|
||||||
if (body.classList.contains('dark-theme')) {
|
|
||||||
body.classList.remove('dark-theme');
|
|
||||||
container.classList.remove('dark-theme');
|
|
||||||
themeToggle.textContent = '切换主题';
|
|
||||||
} else {
|
|
||||||
body.classList.add('dark-theme');
|
|
||||||
container.classList.add('dark-theme');
|
|
||||||
themeToggle.textContent = '切换主题';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
|
||||||
.dark-theme {
|
|
||||||
background: url('background-dark.jpg') no-repeat center center fixed !important;
|
|
||||||
background-size: cover !important;
|
|
||||||
color: #e0e0e0 !important;
|
|
||||||
}
|
|
||||||
.dark-theme .container {
|
|
||||||
background-color: rgba(50, 50, 50, 0.9) !important;
|
|
||||||
}
|
|
||||||
.dark-theme .theme-toggle {
|
|
||||||
background: #e0e0e0 !important;
|
|
||||||
color: #333 !important;
|
|
||||||
}
|
|
||||||
.dark-theme label {
|
|
||||||
color: #e0e0e0 !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user