仰望星辰工作室

better-staridc-MNBT

better-staridc-MNBT/ templates/default/home/index.php 11.2 KB · 275 行 原始文件
Z zfhsh first commit 2 个月前
1<?php
2/**
3 * MNBT 默认主页落地页(内置,不依赖插件)
4 * 数据由 MPHX/frontend.php 的 mnbt_home_data() 注入:
5 * $site_title / $site_logo / $site_primary / $site_hero / $site_footer / $favicon
6 * $notice / $show_notice / $show_plans / $logged_in / $has_shop / $has_user
7 * $plans(套餐卡)/ $blocks(插件扩展区块)
8 * $url($path) 路由 URL / $coreUrl($path) 核心文件 URL
9 * 主题可提供 templates/{theme}/home/index.php 覆盖本文件。
10 */
11if (!defined('IN_CRONLITE')) { exit('Access Denied'); }
12?>
13<!DOCTYPE html>
14<html lang="zh-CN">
15<head>
16<meta charset="UTF-8">
17<meta name="viewport" content="width=device-width, initial-scale=1.0">
18<title><?= htmlspecialchars($site_title) ?></title>
19<?php if ($favicon): ?><link rel="icon" href="<?= htmlspecialchars($favicon) ?>"><?php endif; ?>
20<style>
21:root {
22 --brand: <?= htmlspecialchars($site_primary ?: '#4f46e5') ?>;
23 --brand-soft: color-mix(in srgb, var(--brand) 7%, #fff);
24 --brand-light: color-mix(in srgb, var(--brand) 92%, #fff);
25 --text: #111827;
26 --text-2: #4b5563;
27 --text-3: #9ca3af;
28 --border: #e5e7eb;
29 --bg: #f9fafb;
30 --white: #fff;
31 --r: 16px;
32 --rs: 10px;
33}
34*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
35html{scroll-behavior:smooth}
36body{
37 font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
38 color:var(--text);background:var(--white);line-height:1.6;
39 -webkit-font-smoothing:antialiased;font-size:15px;
40}
41a{text-decoration:none;color:inherit}
42img{max-width:100%;display:block}
43.w{width:min(1120px,calc(100% - 48px));margin:0 auto}
44
45/* ── 顶栏 ── */
46.nav{
47 position:sticky;top:0;z-index:50;
48 background:rgba(255,255,255,.88);backdrop-filter:blur(8px);
49 border-bottom:1px solid var(--border);
50}
51.nav .w{display:flex;align-items:center;justify-content:space-between;height:64px}
52.nav .brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:17px;letter-spacing:-.01em}
53.nav .brand img{width:28px;height:28px;object-fit:contain}
54.nav .actions{display:flex;gap:10px;align-items:center}
55
56/* ── 按钮 ── */
57.btn{
58 display:inline-flex;align-items:center;justify-content:center;gap:7px;
59 padding:9px 18px;border-radius:var(--rs);font-weight:600;font-size:14px;
60 border:1px solid transparent;transition:.15s;cursor:pointer;white-space:nowrap;
61}
62.btn-fill{background:var(--brand);color:#fff}
63.btn-fill:hover{background:var(--brand-light)}
64.btn-outline{border:1px solid var(--border);color:var(--text);background:var(--white)}
65.btn-outline:hover{background:var(--bg)}
66.btn-lg{padding:13px 26px;font-size:15px;border-radius:12px}
67
68/* ── Hero ── */
69.hero{text-align:center;padding:92px 0 84px}
70.hero .badge{
71 display:inline-flex;align-items:center;gap:6px;margin-bottom:20px;
72 padding:6px 14px;border-radius:999px;border:1px solid var(--border);
73 background:var(--brand-soft);color:var(--brand);font-size:13px;font-weight:600;
74}
75.hero h1{
76 font-size:clamp(2.2rem, 5.5vw, 3.8rem);
77 font-weight:800;letter-spacing:-.04em;line-height:1.12;
78 max-width:18ch;margin:0 auto 16px;
79}
80.hero h1 span{color:var(--brand)}
81.hero .sub{
82 font-size:1.08rem;color:var(--text-2);max-width:52ch;margin:0 auto 32px;line-height:1.75;
83}
84.hero .btns{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-bottom:40px}
85.hero .stats-row{
86 display:inline-flex;gap:36px;flex-wrap:wrap;justify-content:center;
87 padding:14px 26px;border:1px solid var(--border);border-radius:var(--r);background:var(--bg);
88}
89.hero .stat{text-align:center}
90.hero .stat .num{display:block;font-size:1.2rem;font-weight:700}
91.hero .stat .label{font-size:12px;color:var(--text-3);margin-top:2px}
92
93/* ── 区块 ── */
94.sec{padding:72px 0}
95.sec.dim{background:var(--bg);border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
96.sec-head{text-align:center;max-width:560px;margin:0 auto 44px}
97.sec-head .tag{
98 display:inline-block;margin-bottom:10px;padding:5px 12px;border-radius:999px;
99 background:var(--brand-soft);color:var(--brand);font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
100}
101.sec-head h2{font-size:1.8rem;font-weight:800;letter-spacing:-.02em;line-height:1.25;margin-bottom:10px}
102.sec-head p{color:var(--text-3);font-size:15px}
103
104/* ── 公告 ── */
105.notice-box{
106 display:flex;gap:12px;align-items:flex-start;
107 padding:16px 20px;border:1px solid var(--border);border-radius:var(--r);background:var(--white);
108}
109.notice-box .mdi{
110 font-size:20px;line-height:1.5;flex-shrink:0;
111}
112.notice-box .txt{color:var(--text-2);font-size:14px;white-space:pre-line;word-break:break-word}
113
114/* ── 套餐卡 ── */
115.g-plan{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
116.g-plan .card{
117 background:var(--white);border:1px solid var(--border);border-radius:var(--r);
118 display:flex;flex-direction:column;transition:.18s;
119}
120.g-plan .card:hover{border-color:#cbd5e1;box-shadow:0 6px 24px rgba(17,24,39,.05)}
121.g-plan .card.pop{border-color:var(--brand);box-shadow:0 0 0 1px var(--brand)}
122.g-plan .card-top{padding:26px 24px;border-bottom:1px solid var(--border)}
123.g-plan .card-top .chip{
124 display:inline-block;padding:4px 10px;border-radius:999px;
125 background:var(--brand-soft);color:var(--brand);font-size:12px;font-weight:700;margin-bottom:10px;
126}
127.g-plan .card-top h3{font-size:1.15rem;letter-spacing:-.02em;margin-bottom:4px}
128.g-plan .card-top .desc{color:var(--text-3);font-size:14px;min-height:40px}
129.g-plan .card-body{padding:22px 24px;display:flex;flex-direction:column;flex:1}
130.g-plan .price{margin-bottom:18px}
131.g-plan .price .num{font-size:1.9rem;font-weight:800;letter-spacing:-.03em}
132.g-plan .price .sub{color:var(--text-3);font-size:13px}
133.g-plan ul{list-style:none;display:grid;gap:9px;margin-bottom:22px;flex:1}
134.g-plan ul li{display:flex;gap:9px;font-size:14px;color:var(--text-2)}
135.g-plan ul li .ok{color:var(--brand);flex-shrink:0}
136.g-plan .card .btn{width:100%}
137.empty{
138 text-align:center;padding:56px 20px;border:1px dashed var(--border);border-radius:var(--r);color:var(--text-3);
139}
140
141/* ── 页脚 ── */
142.footer{
143 padding:32px 0;border-top:1px solid var(--border);
144 text-align:center;color:var(--text-3);font-size:13px;
145}
146
147@media(max-width:860px){
148 .g-plan{grid-template-columns:1fr}
149 .hero{padding:64px 0 56px}
150}
151@media(max-width:540px){
152 .hero .btns{flex-direction:column;align-items:center}
153 .nav .brand .site-name{display:none}
154}
155</style>
156</head>
157<body>
158
159<nav class="nav">
160 <div class="w">
161 <a class="brand" href="<?= htmlspecialchars($coreUrl('')) ?>">
162 <?php if ($site_logo): ?><img src="<?= htmlspecialchars($site_logo) ?>" alt="logo"><?php endif; ?>
163 <span class="site-name"><?= htmlspecialchars($site_title) ?></span>
164 </a>
165 <div class="actions">
166 <?php if ($has_shop): ?>
167 <a class="btn btn-outline" href="<?= htmlspecialchars($url('/shop')) ?>">主机套餐</a>
168 <?php endif; ?>
169 <?php if ($logged_in): ?>
170 <a class="btn btn-outline" href="<?= htmlspecialchars($has_user ? $url('/account/profile') : $coreUrl('user/index.php')) ?>">控制台</a>
171 <?php else: ?>
172 <a class="btn btn-outline" href="<?= htmlspecialchars($has_user ? $url('/account/login') : $coreUrl('user/login.php')) ?>">登录</a>
173 <?php if ($has_user): ?>
174 <a class="btn btn-fill" href="<?= htmlspecialchars($url('/account/register')) ?>">免费注册</a>
175 <?php endif; ?>
176 <?php endif; ?>
177 </div>
178 </div>
179</nav>
180
181<section class="hero">
182 <div class="w">
183 <div class="badge">高性能 · 即开即用 · 自动部署</div>
184 <h1><?= htmlspecialchars($site_hero ?: $site_title) ?></h1>
185 <p class="sub">全 SSD 存储、BGP 多线接入——支付完成后自动开通,分钟级上线,为企业和开发者打造的虚拟主机平台。</p>
186 <div class="btns">
187 <?php if ($has_shop): ?>
188 <a class="btn btn-fill btn-lg" href="<?= htmlspecialchars($url('/shop')) ?>">查看全部套餐</a>
189 <?php endif; ?>
190 <a class="btn btn-outline btn-lg" href="<?= htmlspecialchars($logged_in ? ($has_shop ? $url('/shop/assets') : $coreUrl('user/index.php')) : ($has_user ? $url('/account/register') : $coreUrl('user/login.php'))) ?>">
191 <?= $logged_in ? '我的主机' : ($has_user ? '免费注册' : '用户登录') ?>
192 </a>
193 </div>
194 <div class="stats-row">
195 <div class="stat"><span class="num">99.9%</span><span class="label">服务可用性</span></div>
196 <div class="stat"><span class="num">&lt; 1 min</span><span class="label">平均开通时间</span></div>
197 <div class="stat"><span class="num">7×24</span><span class="label">技术支持</span></div>
198 </div>
199 </div>
200</section>
201
202<?php if ($show_notice && $notice !== ''): ?>
203<section class="sec" style="padding:0 0 72px">
204 <div class="w">
205 <div class="notice-box">
206 <span class="mdi mdi-bullhorn" style="color:<?= htmlspecialchars($site_primary) ?>"></span>
207 <div class="txt"><?= htmlspecialchars($notice) ?></div>
208 </div>
209 </div>
210</section>
211<?php endif; ?>
212
213<?php if ($show_plans): ?>
214<section class="sec dim">
215 <div class="w">
216 <div class="sec-head">
217 <div class="tag">Pricing</div>
218 <h2>选择适合的套餐</h2>
219 <p>按需选择,随时升级。价格透明,开通简单。</p>
220 </div>
221 <?php if (empty($plans)): ?>
222 <div class="empty">暂无可购买套餐,请联系管理员</div>
223 <?php else: ?>
224 <div class="g-plan">
225 <?php foreach (array_slice($plans, 0, 3) as $i => $plan): ?>
226 <div class="card<?= $i === 1 ? ' pop' : '' ?>">
227 <div class="card-top">
228 <?php if ($i === 1): ?><span class="chip">推荐</span><?php endif; ?>
229 <h3><?= htmlspecialchars($plan['name']) ?></h3>
230 <div class="desc"><?= htmlspecialchars($plan['desc'] ?: '适合中小站点快速上线') ?></div>
231 </div>
232 <div class="card-body">
233 <div class="price">
234 <div class="num"><?= htmlspecialchars($plan['price']) ?></div>
235 <div class="sub">含基础资源与自动开通</div>
236 </div>
237 <ul>
238 <?php foreach ($plan['feats'] as $feat): ?>
239 <li><span class="ok">✓</span><?= htmlspecialchars($feat) ?></li>
240 <?php endforeach; ?>
241 <?php if (empty($plan['feats'])): ?>
242 <li><span class="ok">✓</span>高性能节点资源</li>
243 <li><span class="ok">✓</span>一键开通部署</li>
244 <?php endif; ?>
245 </ul>
246 <a class="btn btn-fill" href="<?= htmlspecialchars($url('/shop/order/' . $plan['id'])) ?>">立即购买</a>
247 </div>
248 </div>
249 <?php endforeach; ?>
250 </div>
251 <?php endif; ?>
252 </div>
253</section>
254<?php endif; ?>
255
256<?php foreach ($blocks as $block): ?>
257<section class="sec<?= !empty($block['order']) && ($block['order'] % 2) === 0 ? ' dim' : '' ?>">
258 <div class="w">
259 <?php if (!empty($block['title'])): ?>
260 <div class="sec-head">
261 <div class="tag">Extras</div>
262 <h2><?= htmlspecialchars($block['title']) ?></h2>
263 </div>
264 <?php endif; ?>
265 <?= $block['html'] ?>
266 </div>
267</section>
268<?php endforeach; ?>
269
270<footer class="footer">
271 <div class="w"><?= htmlspecialchars($site_footer ?: ('© ' . date('Y') . ' ' . $site_title . '. All rights reserved.')) ?></div>
272</footer>
273
274</body>
275</html>