better-staridc-MNBT
1<?php
2/**
3 * TDesign 主页主题(home scope)落地页入口
4 *
5 * 由 MPHX/frontend.php 的 mnbt_home_render() 渲染,注入 mnbt_home_data() 变量:
6 * $site_title / $site_logo / $site_primary / $site_hero / $site_footer / $favicon
7 * $notice / $show_notice / $show_plans / $logged_in / $has_shop / $has_user / $has_site / $has_docker
8 * $plans(套餐卡)/ $blocks(插件扩展区块)
9 * $url($path) 路由 URL / $coreUrl($path) 核心文件 URL
10 *
11 * 本入口加载 home SPA 构建产物(templates/tdesign/home/dist/),
12 * 售卖系统全部页面(商店/订单/资产/余额/账户)由 SPA 通过 API 渲染。
13 */
14if (!defined('IN_CRONLITE')) { exit('Access Denied'); }
15
16$td_dist = __DIR__ . '/dist';
17$td_js = $td_dist . '/assets/index.js';
18$td_css = $td_dist . '/assets/index.css';
19$td_ver = is_file($td_js) ? (string)@filemtime($td_js) : (string)time();
20
21$boot = [
22 'siteTitle' => $site_title ?? 'MNBT',
23 'siteLogo' => $site_logo ?? '',
24 'sitePrimary' => $site_primary ?? '#4f46e5',
25 'siteHero' => $site_hero ?? '',
26 'siteFooter' => $site_footer ?? '',
27 'beianInfo' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('beian_info', '') : ''),
28 'policeBeian' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('ps_beian', '') : ''),
29 // 页脚/联系方式/关于/首页 banner 文字(主题自定义设置,空值回退内置默认)
30 'footerAbout' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('footer_about', '致力于为客户提供稳定、安全、高性能的虚拟主机与云计算服务。') : ''),
31 'contactQq' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('contact_qq', '994752422') : ''),
32 'contactEmail' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('contact_email', 'support@mnbt.example') : ''),
33 'contactAddress' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('contact_address', '北京市朝阳区 · 数据中心园区') : ''),
34 'contactHours' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('contact_hours', '工作日 9:00 - 21:00 · 7×24 工单系统') : ''),
35 'aboutIntro' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('about_intro', '') : ''),
36 'aboutImage' => (function_exists('mnbt_home_asset') && function_exists('mnbt_home_theme_setting') ? mnbt_home_asset((string)mnbt_home_theme_setting('about_image', '')) : ''),
37 'bannerTexts' => [
38 [
39 'title' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_title_1', '高性能虚拟主机') : '高性能虚拟主机'),
40 'subtitle' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_subtitle_1', '即买即用 · 自动开通 · 秒级部署') : '即买即用 · 自动开通 · 秒级部署'),
41 'description' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_desc_1', '全 SSD 存储与 BGP 多线接入,支付完成后自动开通,分钟级上线,为企业和开发者打造稳定高效的主机平台。') : '全 SSD 存储与 BGP 多线接入,支付完成后自动开通,分钟级上线,为企业和开发者打造稳定高效的主机平台。'),
42 ],
43 [
44 'title' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_title_2', '专业团队支持') : '专业团队支持'),
45 'subtitle' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_subtitle_2', '7×24 小时全天候技术支持') : '7×24 小时全天候技术支持'),
46 'description' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_desc_2', '经验丰富的运维与开发团队随时待命,从建站到运维全程护航,让您专注于业务本身。') : '经验丰富的运维与开发团队随时待命,从建站到运维全程护航,让您专注于业务本身。'),
47 ],
48 [
49 'title' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_title_3', '企业级安全防护') : '企业级安全防护'),
50 'subtitle' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_subtitle_3', 'DDoS 清洗 · WAF 规则 · 每日备份') : 'DDoS 清洗 · WAF 规则 · 每日备份'),
51 'description' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('banner_desc_3', '内置安全防护体系与自动备份能力,SSL 一键签发,全面保障您的数据与业务安全。') : '内置安全防护体系与自动备份能力,SSL 一键签发,全面保障您的数据与业务安全。'),
52 ],
53 ],
54 'favicon' => $favicon ?? '',
55 'notice' => $notice ?? '',
56 'showNotice' => !empty($show_notice),
57 'showPlans' => !empty($show_plans),
58 'loggedIn' => !empty($logged_in),
59 'hasShop' => !empty($has_shop),
60 'hasBalance' => !empty($has_balance),
61 'hasUser' => !empty($has_user),
62 'hasSite' => !empty($has_site),
63 'hasDocker' => !empty($has_docker),
64 'hasZjmf' => function_exists('mnbt_plugin_enabled') ? mnbt_plugin_enabled('zjmfmanager_reserve') : false,
65 'plans' => $plans ?? [],
66 'blocks' => $blocks ?? [],
67 'base' => function_exists('mnbt_home_base') ? mnbt_home_base() : '',
68 'conf' => $conf ?? [],
69 'theme' => 'tdesign',
70 'version' => '0.3.0',
71 'entry' => 'landing',
72];
73
74// SPA 需要访问的 API 入口(index.php?_r=/xxx/api/xxx)
75$boot['routeBase'] = (function_exists('mnbt_home_base') ? mnbt_home_base() : '') . '/index.php?_r=';
76// 核心文件入口(如 user/、admin/)
77$boot['coreBase'] = function_exists('mnbt_home_core_url') ? mnbt_home_core_url('') : '/';
78?>
79<!DOCTYPE html>
80<html lang="zh-CN">
81<head>
82<meta charset="UTF-8" />
83<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
84<title><?= htmlspecialchars($site_title ?? 'MNBT', ENT_QUOTES, 'UTF-8') ?></title>
85<?php if (!empty($favicon)): ?><link rel="icon" href="<?= htmlspecialchars($favicon, ENT_QUOTES, 'UTF-8') ?>" /><?php endif; ?>
86<link rel="stylesheet" href="<?= htmlspecialchars(mnbt_asset_url('css/materialdesignicons.min.css'), ENT_QUOTES, 'UTF-8') ?>" />
87<?php if (is_file($td_css)): ?>
88<link rel="stylesheet" href="<?= htmlspecialchars(mnbt_theme_url('dist/assets/index.css', 'home'), ENT_QUOTES, 'UTF-8') ?>?v=<?= $td_ver ?>" />
89<?php endif; ?>
90<style>
91 html, body, #app { margin: 0; padding: 0; min-height: 100%; }
92 .td-boot-missing { max-width: 540px; margin: 12vh auto; padding: 32px; border-radius: 12px; background: #fff; border: 1px solid #e7e7e7; font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: #1a2e28; }
93 .td-boot-missing h2 { margin: 0 0 12px; font-size: 18px; color: #d54941; }
94 .td-boot-missing code { background: #f3f3f3; padding: 2px 8px; border-radius: 4px; font-size: 13px; }
95 .td-boot-missing p { margin: 10px 0; line-height: 1.7; font-size: 14px; }
96</style>
97</head>
98<body>
99<div id="app">
100<?php if (!is_file($td_js)): ?>
101 <div class="td-boot-missing">
102 <h2>TDesign 主页主题尚未构建</h2>
103 <p>请在服务器或本机执行:</p>
104 <p><code>cd templates/tdesign/spa && npm install && npm run build:home</code></p>
105 <p>构建产物应位于 <code>templates/tdesign/home/dist/</code></p>
106 </div>
107<?php endif; ?>
108</div>
109<script>
110window.__TD_BOOT__ = <?= json_encode($boot, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>;
111</script>
112<?php if (is_file($td_js)): ?>
113<script type="module" src="<?= htmlspecialchars(mnbt_theme_url('dist/assets/index.js', 'home'), ENT_QUOTES, 'UTF-8') ?>?v=<?= $td_ver ?>"></script>
114<?php endif; ?>
115</body>
116</html>