更新完善网页逻辑,工具迁移至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

+28 -4
View File
@@ -9,6 +9,15 @@ require_once __DIR__ . '/includes/layout.php';
$siteName = setting_get('site_name', '知识导航站');
$siteSlogan = setting_get('site_slogan', '');
$heroBg = setting_get('hero_bg', ''); // 后台自定义顶部背景(纯色 / CSS 渐变)
// 首页顶部组件模式:weather=天气(默认) / info=访客信息 / blank=空白精简
$heroMode = setting_get('hero_mode', 'weather');
if (!in_array($heroMode, ['weather', 'info', 'blank'], true)) {
$heroMode = 'weather';
}
$visitor = [];
if ($heroMode === 'info') {
$visitor = visitor_brief();
}
$lastUpdated = setting_get('last_updated', '');
if ($lastUpdated === '') {
$lastUpdated = '暂无更新记录';
@@ -60,7 +69,7 @@ $catHint = [
layout_head('');
?>
<!-- Hero 顶部展示栏 -->
<header class="hero"<?php if ($heroBg !== ''): ?> style="background:<?= he($heroBg) ?>"<?php endif; ?>>
<header class="hero<?= $heroMode === 'blank' ? ' hero-slim' : '' ?>"<?php if ($heroBg !== ''): ?> style="background:<?= he($heroBg) ?>"<?php endif; ?>>
<div class="wrap hero-inner">
<div class="hero-top">
<div class="brand">
@@ -77,9 +86,24 @@ layout_head('');
<div class="hm-row"><span>上次更新&nbsp;</span><span class="val"><?= he($lastUpdated) ?></span></div>
</div>
</div>
<div class="weather-box">
<iframe width="800" height="150" src="https://i.tianqi.com/?c=code&a=getcode&id=48&num=6&icon=1" frameborder="0"></iframe>
</div>
<?php if ($heroMode === 'weather'): ?>
<!-- 天气模式(默认):第三方天气条 -->
<div class="weather-box">
<iframe width="800" height="150" src="https://i.tianqi.com/?c=code&a=getcode&id=48&num=6&icon=1" frameborder="0"></iframe>
</div>
<?php elseif ($heroMode === 'info'): ?>
<!-- 访客信息模式:IP / 浏览器 / 系统 / 内核 / 屏幕 / 语言 -->
<div class="visitor-box js-visitor-box">
<div class="vb-grid">
<div class="vb-cell"><span>访问者 IP</span><b><?= he((string)($visitor['ip'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>浏览器</span><b><?= he((string)($visitor['browser'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>操作系统</span><b><?= he((string)($visitor['os'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>内核 / 渲染引擎</span><b><?= he((string)($visitor['kernel'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>屏幕分辨率</span><b class="js-vscreen">--</b></div>
<div class="vb-cell"><span>系统语言</span><b class="js-vlang">--</b></div>
</div>
</div>
<?php endif; ?>
</div>
</header>