更新完善网页逻辑,工具迁移至html逻辑

This commit is contained in:
MasonLiu committed 2026-09-10 00:22:40 +08:00
1 parent c3bfce7afb
commit 646754c04d
26 files changed
+1606 -167

No files matched your search

+31 -1
View File
@@ -31,7 +31,8 @@ function remove_old_logo(): void
function alert_html(string $kind, string $msg): void
{
echo '<div class="' . ($kind === 'ok' ? 'ok-msg' : 'err-msg') . '">' . he($msg) . '</div>';
// 改为右下角 Toast:注入 hpToastMsg,由 common.js 在页面加载后自动弹出
echo '<script>window.hpToastMsg = ' . json_encode(['kind' => $kind === 'ok' ? 'ok' : 'err', 'text' => $msg], JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP) . ';</script>';
}
$msgKind = '';
@@ -152,6 +153,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$msgKind = 'ok';
$msgText = '首页顶部标识栏背景已保存。';
break;
case 'hero_mode':
$mode = (string)($_POST['hero_mode'] ?? 'weather');
if (!in_array($mode, ['weather', 'info', 'blank'], true)) {
$mode = 'weather';
}
settings_set('hero_mode', $mode);
touch_last_updated();
$modeText = ['weather' => '天气模式', 'info' => '访客信息模式', 'blank' => '空白精简模式'][$mode];
$msgKind = 'ok';
$msgText = '首页顶部组件模式已保存:' . $modeText . '。';
break;
case 'cdn':
settings_set('cdn_ranges', trim((string)($_POST['cdn_ranges'] ?? '')));
touch_last_updated();
@@ -401,6 +413,24 @@ admin_topbar('content');
</form>
</div>
<!-- 首页顶部组件模式(Hero 下方横幅:天气 / 访客信息 / 空白) -->
<div class="fieldset-card">
<div class="fs-title">首页顶部组件(Hero 下方横幅区)</div>
<?php $hm = (string)($all['hero_mode'] ?? 'weather'); ?>
<form method="post">
<?= csrf_field() ?><input type="hidden" name="act" value="hero_mode">
<div class="field-row" style="align-items:center">
<label class="seg-check"><input type="radio" name="hero_mode" value="weather"<?= $hm === 'weather' ? ' checked' : '' ?>> 🌤️ 天气模式(默认)</label>
<label class="seg-check"><input type="radio" name="hero_mode" value="info"<?= $hm === 'info' ? ' checked' : '' ?>> 🖥️ 访客信息模式</label>
<label class="seg-check"><input type="radio" name="hero_mode" value="blank"<?= $hm === 'blank' ? ' checked' : '' ?>> ⬜ 空白模式</label>
</div>
<div style="margin-top:12px"><button type="submit" class="btn btn-primary">保存顶部组件模式</button></div>
</form>
<p class="tip" style="margin:10px 0 0">
天气模式(默认):横幅展示第三方天气条;访客信息模式:横幅显示当前访问者 IP、浏览器、操作系统、内核、屏幕分辨率与系统语言;空白模式:隐藏横幅,仅保留站点信息与时间信息,顶部高度自动缩减。
</p>
</div>
<!-- 底部信息 -->
<div class="fieldset-card">
<div class="fs-title">底部信息</div>