feat(tdesign): 新增官网主题与主页三端SPA支持
60 个文件变更
+6753
-35
13172193298@163.com
| •MPHX/frontend.php | +2 -0 |
| •app_plugins/balance/bootstrap.php | +37 -0 |
| •app_plugins/hosting_shop/bootstrap.php | +96 -0 |
| •app_plugins/official_site/bootstrap.php | +164 -0 |
| •app_plugins/official_site/install.sql | +69 -0 |
| •app_plugins/official_site/lib/site.php | +324 -0 |
| •app_plugins/official_site/plugin.json | +10 -0 |
| •app_plugins/official_site/uninstall.sql | +4 -0 |
| •app_plugins/official_site/views/admin/messages.php | +163 -0 |
| •app_plugins/official_site/views/admin/news.php | +245 -0 |
| •app_plugins/official_site/views/admin/products.php | +235 -0 |
| •app_plugins/user_info/bootstrap.php | +20 -0 |
| •docs/development/official-site/prd.md | +146 -0 |
| •docs/development/theme/home.md | +7 -0 |
| •docs/development/theme/tdesign-php.md | +70 -3 |
| •docs/development/theme/tdesign.md | +85 -19 |
| •templates/tdesign/admin/_spa_boot.php | +1 -1 |
| •templates/tdesign/home/index.php | +89 -0 |
| •templates/tdesign/spa/admin.html | +1 -1 |
| •templates/tdesign/spa/home.html | +32 -0 |
| •templates/tdesign/spa/package-lock.json | +2 -2 |
| •templates/tdesign/spa/package.json | +3 -2 |
| •templates/tdesign/spa/src/App-home.vue | +6 -0 |
| •templates/tdesign/spa/src/home/api/account.js | +31 -0 |
| •templates/tdesign/spa/src/home/api/balance.js | +21 -0 |
| •templates/tdesign/spa/src/home/api/http.js | +123 -0 |
| •templates/tdesign/spa/src/home/api/shop.js | +36 -0 |
| •templates/tdesign/spa/src/home/api/site.js | +40 -0 |
| •templates/tdesign/spa/src/home/layouts/HomeLayout.vue | +126 -0 |
| •templates/tdesign/spa/src/home/router/index.js | +96 -0 |
| •templates/tdesign/spa/src/home/store/auth.js | +45 -0 |
| •templates/tdesign/spa/src/home/styles/home.scss | +1106 -0 |
| •templates/tdesign/spa/src/home/utils/format.js | +48 -0 |
| •templates/tdesign/spa/src/home/views/LandingView.vue | +274 -0 |
| •templates/tdesign/spa/src/home/views/auth/LoginView.vue | +76 -0 |
| •templates/tdesign/spa/src/home/views/auth/PasswordView.vue | +89 -0 |
| •templates/tdesign/spa/src/home/views/auth/ProfileView.vue | +83 -0 |
| •templates/tdesign/spa/src/home/views/auth/RegisterView.vue | +107 -0 |
| •templates/tdesign/spa/src/home/views/balance/BalanceView.vue | +103 -0 |
| •templates/tdesign/spa/src/home/views/balance/RechargeView.vue | +118 -0 |
| •templates/tdesign/spa/src/home/views/shop/AssetsView.vue | +61 -0 |
| •templates/tdesign/spa/src/home/views/shop/OrderView.vue | +171 -0 |
| •templates/tdesign/spa/src/home/views/shop/OrdersView.vue | +86 -0 |
| •templates/tdesign/spa/src/home/views/shop/ShopView.vue | +71 -0 |
| •templates/tdesign/spa/src/home/views/site/AboutView.vue | +359 -0 |
| •templates/tdesign/spa/src/home/views/site/ContactView.vue | +307 -0 |
| •templates/tdesign/spa/src/home/views/site/news/NewsDetailView.vue | +201 -0 |
| •templates/tdesign/spa/src/home/views/site/news/NewsView.vue | +521 -0 |
| •templates/tdesign/spa/src/home/views/site/products/ProductDetailView.vue | +281 -0 |
| •templates/tdesign/spa/src/home/views/site/products/ProductsView.vue | +278 -0 |
| •templates/tdesign/spa/src/main-home.js | +12 -0 |
| •templates/tdesign/spa/src/shared/assets/bg1.jpg | 二进制 |
| •templates/tdesign/spa/src/shared/assets/bg2.jpg | 二进制 |
| •templates/tdesign/spa/src/shared/assets/bg3.jpg | 二进制 |
| •templates/tdesign/spa/src/user/layouts/UserLayout.vue | +1 -1 |
| •templates/tdesign/spa/user.html | +1 -1 |
| •templates/tdesign/spa/vite.home.config.js | +43 -0 |
| •templates/tdesign/theme.json | +4 -4 |
| •templates/tdesign/theme.php | +22 -0 |
| •templates/tdesign/user/_spa_boot.php | +1 -1 |
变更内容
diff --git a/MPHX/frontend.php b/MPHX/frontend.php
index 6ae7387..6b5a8bf 100644
--- a/MPHX/frontend.php
+++ b/MPHX/frontend.php
@@ -112,7 +112,9 @@ function mnbt_home_data(): array
// 登录态与能力探测(不强依赖插件)
'logged_in' => isset($_COOKIE['user_token']) && $_COOKIE['user_token'] !== '',
'has_shop' => function_exists('mnbt_plugin_enabled') && mnbt_plugin_enabled('hosting_shop'),
+ 'has_balance' => function_exists('mnbt_plugin_enabled') && mnbt_plugin_enabled('balance'),
'has_user' => function_exists('mnbt_plugin_enabled') && mnbt_plugin_enabled('user_info'),
+ 'has_site' => function_exists('mnbt_plugin_enabled') && mnbt_plugin_enabled('official_site'),
// 业务数据
'plans' => [],
'blocks' => [],
diff --git a/app_plugins/balance/bootstrap.php b/app_plugins/balance/bootstrap.php
index 846cb44..8fb02b1 100644
--- a/app_plugins/balance/bootstrap.php
+++ b/app_plugins/balance/bootstrap.php
@@ -97,6 +97,43 @@ mnbt_register_route('GET', '/balance/recharge', function ($params, $ctx) {
* API 路由
* ============================================================ */
+// 余额信息 + 流水分页(SPA 数据接口)
+mnbt_register_route('GET', '/balance/api/info', function ($params, $ctx) {
+ $user = function_exists('user_info_auth_current') ? user_info_auth_current() : null;
+ if (!$user) {
+ balance_json('not_login', ['logged_in' => false]);
+ return;
+ }
+ $user_id = (int)$user['id'];
+ $page = isset($_GET['page']) ? max(1, (int)$_GET['page']) : 1;
+ $per = isset($_GET['per_page']) ? max(1, min(100, (int)$_GET['per_page'])) : 15;
+ $logs = balance_logs($user_id, $page, $per);
+ balance_json('ok', [
+ 'logged_in' => true,
+ 'balance_cents' => balance_get($user_id),
+ 'balance_yuan' => balance_format(balance_get($user_id)),
+ 'logs' => $logs,
+ ]);
+});
+
+// 可用支付方式(SPA 充值页数据接口,排除余额自身)
+mnbt_register_route('GET', '/balance/api/methods', function ($params, $ctx) {
+ if (!function_exists('user_info_auth_current') || !user_info_auth_current()) {
+ balance_json('not_login', ['logged_in' => false]);
+ return;
+ }
+ $methods = [];
+ if (function_exists('mnbt_get_enabled_payment_methods')) {
+ foreach (mnbt_get_enabled_payment_methods() as $m) {
+ if (($m['plugin'] ?? '') === 'balance') {
+ continue;
+ }
+ $methods[] = $m;
+ }
+ }
+ balance_json('ok', ['methods' => $methods]);
+});
+
// 创建充值订单 → 调用支付插件
mnbt_register_route('POST', '/balance/api/create_recharge', function ($params, $ctx) {
global $DB, $date, $siteurl;
diff --git a/app_plugins/hosting_shop/bootstrap.php b/app_plugins/hosting_shop/bootstrap.php
index 16f853f..570c8b1 100644
--- a/app_plugins/hosting_shop/bootstrap.php
+++ b/app_plugins/hosting_shop/bootstrap.php
@@ -126,6 +126,102 @@ mnbt_register_route('GET', '/shop/orders', function ($params, $ctx) {
* 用户端 API 路由
* ============================================================ */
+// 上架套餐列表(SPA 数据接口)
+mnbt_register_route('GET', '/shop/api/plans', function ($params, $ctx) {
+ if (!function_exists('hosting_plan_list_active')) {
+ hosting_json('ok', ['plans' => []]);
+ return;
+ }
+ $rows = hosting_plan_list_active();
+ $plans = [];
+ foreach ($rows as $p) {
+ $plans[] = [
+ 'id' => (int)$p['id'],
+ 'name' => (string)$p['name'],
+ 'description' => (string)($p['description'] ?? ''),
+ 'category' => (string)($p['category'] ?? ''),
+ 'node' => (string)($p['node'] ?? ''),
+ 'spec_web' => (int)($p['spec_web'] ?? 0),
+ 'spec_sql' => (int)($p['spec_sql'] ?? 0),
+ 'spec_flow' => (int)($p['spec_flow'] ?? 0),
+ 'spec_domain' => (int)($p['spec_domain'] ?? 0),
+ 'periods' => hosting_plan_enabled_periods($p),
+ 'prices' => [
+ 'month' => (int)($p['price_month_cents'] ?? 0),
+ 'quarter' => (int)($p['price_quarter_cents'] ?? 0),
+ 'half_year' => (int)($p['price_half_year_cents'] ?? 0),
+ 'year' => (int)($p['price_year_cents'] ?? 0),
+ 'two_year' => (int)($p['price_two_year_cents'] ?? 0),
+ 'three_year' => (int)($p['price_three_year_cents'] ?? 0),
+ ],
+ ];
+ }
+ hosting_json('ok', ['plans' => $plans]);
+});
+
+// 套餐详情(SPA 下单页数据接口)
+mnbt_register_route('GET', '/shop/api/plan/{plan_id}', function ($params, $ctx) {
+ $plan_id = (int)($params['plan_id'] ?? 0);
+ $plan = hosting_plan_get($plan_id);
+ if (!$plan || $plan['status'] !== 'active') {
+ hosting_json('套餐不存在或已下架');
+ return;
+ }
+ $methods = function_exists('mnbt_get_enabled_payment_methods') ? mnbt_get_enabled_payment_methods() : [];
+ hosting_json('ok', [
+ 'plan' => [
+ 'id' => (int)$plan['id'],
+ 'name' => (string)$plan['name'],
+ 'description' => (string)($plan['description'] ?? ''),
+ 'node' => (string)($plan['node'] ?? ''),
+ 'spec_web' => (int)($plan['spec_web'] ?? 0),
+ 'spec_sql' => (int)($plan['spec_sql'] ?? 0),
+ 'spec_flow' => (int)($plan['spec_flow'] ?? 0),
+ 'spec_domain' => (int)($plan['spec_domain'] ?? 0),
+ 'periods' => hosting_plan_enabled_periods($plan),
+ 'prices' => [
+ 'month' => (int)($plan['price_month_cents'] ?? 0),
+ 'quarter' => (int)($plan['price_quarter_cents'] ?? 0),
+ 'half_year' => (int)($plan['price_half_year_cents'] ?? 0),
+ 'year' => (int)($plan['price_year_cents'] ?? 0),
+ 'two_year' => (int)($plan['price_two_year_cents'] ?? 0),
+ 'three_year' => (int)($plan['price_three_year_cents'] ?? 0),
+ ],
+ ],
+ 'methods' => $methods,
+ ]);
+});
+
+// 我的资产(SPA 数据接口)
+mnbt_register_route('GET', '/shop/api/assets', function ($params, $ctx) {
+ $user = function_exists('user_info_auth_current') ? user_info_auth_current() : null;
+ if (!$user) {
+ hosting_json('not_login', ['logged_in' => false]);
+ return;
+ }
+ $assets = hosting_asset_list_by_user((int)$user['id']);
+ hosting_json('ok', ['logged_in' => true, 'assets' => $assets]);
+});
+
+// 我的订单(SPA 数据接口,分页)
+mnbt_register_route('GET', '/shop/api/orders', function ($params, $ctx) {
+ $user = function_exists('user_info_auth_current') ? user_info_auth_current() : null;
+ if (!$user) {
+ hosting_json('not_login', ['logged_in' => false]);
+ return;
+ }
+ $page = isset($_GET['page']) ? max(1, (int)$_GET['page']) : 1;
+ $per = isset($_GET['per_page']) ? max(1, min(100, (int)$_GET['per_page'])) : 15;
+ $orders = hosting_order_list_by_user((int)$user['id'], $page, $per);
+ hosting_json('ok', ['logged_in' => true, 'orders' => $orders]);
+});
+
+// 可用支付方式(SPA 下单页数据接口)
+mnbt_register_route('GET', '/shop/api/methods', function ($params, $ctx) {
+ $methods = function_exists('mnbt_get_enabled_payment_methods') ? mnbt_get_enabled_payment_methods() : [];
+ hosting_json('ok', ['methods' => $methods]);
+});
+
// 创建购买订单 → 调用支付插件
mnbt_register_route('POST', '/shop/api/create_order', function ($params, $ctx) {
global $DB, $date, $siteurl;
diff --git a/app_plugins/official_site/bootstrap.php b/app_plugins/official_site/bootstrap.php
new file mode 100644
index 0000000..5f7df54
--- /dev/null
+++ b/app_plugins/official_site/bootstrap.php
@@ -0,0 +1,164 @@
+<?php
+/**
+ * official_site 插件 - 主入口
+ *
+ * 功能:企业官网内容管理(产品展示、新闻资讯、联系留言)
+ * 架构:
+ * - 前台:通过 P2 路由注册 /site/api/* 数据接口,供 home SPA「产品/新闻/联系」页面使用
+ * - 管理员端:通过 mnbt_register_page('admin', ...) 注册到 admin/plugin.php,侧边栏「官网内容」菜单
+ * 能力探测:启用后 home 引擎注入 has_site=true,自动开启「关于/产品/新闻/联系」页面与导航
+ */
+
+if (!defined('IN_CRONLITE')) {
+ exit;
+}
+
+require_once __DIR__ . '/lib/site.php';
+
+mnbt_plugin_register('official_site', [
+ 'name' => '官网内容',
+ 'description' => '企业官网内容管理:产品展示、新闻资讯、联系留言',
+]);
+
+/* ============================================================
+ * 前台 API 路由(home SPA 数据接口)
+ * ============================================================ */
+
+// 产品列表(支持 ?category= 筛选,返回分类定义)
+mnbt_register_route('GET', '/site/api/products', function ($params, $ctx) {
+ $category = isset($_GET['category']) ? trim($_GET['category']) : '';
+ $rows = site_product_list('active', $category);
+ $cat = site_product_categories();
+ $products = [];
+ foreach ($rows as $p) {
+ $products[] = [
+ 'id' => (int)$p['id'],
+ 'name' => (string)$p['name'],
+ 'category' => (string)$p['category'],
+ 'category_name' => (string)($cat[$p['category']] ?? $p['category']),
+ 'description' => (string)$p['description'],
+ 'features' => $p['features_list'],
+ 'image' => (string)($p['image'] ?? ''),
+ ];
+ }
+ $cats = [];
+ foreach ($cat as $k => $v) {
+ $cats[] = ['id' => $k, 'name' => $v];
+ }
+ site_json('ok', ['products' => $products, 'categories' => $cats]);
+});
+
+// 产品详情
+mnbt_register_route('GET', '/site/api/products/{product_id}', function ($params, $ctx) {
+ $id = (int)($params['product_id'] ?? 0);
+ $p = site_product_get($id);
+ if (!$p || $p['status'] !== 'active') {
+ site_json('产品不存在');
+ return;
+ }
+ $cat = site_product_categories();
+ site_json('ok', ['product' => [
+ 'id' => (int)$p['id'],
+ 'name' => (string)$p['name'],
+ 'category' => (string)$p['category'],
+ 'category_name' => (string)($cat[$p['category']] ?? $p['category']),
+ 'description' => (string)$p['description'],
+ 'features' => $p['features_list'],
+ 'image' => (string)($p['image'] ?? ''),
+ 'created_at' => (string)($p['created_at'] ?? ''),
+ ]]);
+});
+
+// 新闻列表(分页 + 分类,返回分类统计)
+mnbt_register_route('GET', '/site/api/news', function ($params, $ctx) {
+ $page = isset($_GET['page']) ? max(1, (int)$_GET['page']) : 1;
+ $per = isset($_GET['per_page']) ? max(1, min(50, (int)$_GET['per_page'])) : 6;
+ $category = isset($_GET['category']) ? trim($_GET['category']) : '';
+ $data = site_news_list($page, $per, $category);
+ $list = [];
+ foreach ($data['list'] as $n) {
+ $list[] = [
+ 'id' => (int)$n['id'],
+ 'title' => (string)$n['title'],
+ 'category' => (string)$n['category'],
+ 'content' => (string)$n['content'],
+ 'views' => (int)$n['views'],
+ 'created_at' => (string)$n['created_at'],
+ ];
+ }
+ site_json('ok', [
+ 'news' => $list,
+ 'total' => (int)$data['total'],
+ 'page' => $page,
+ 'per_page' => $per,
+ 'categories' => site_news_categories(),
+ ]);
+});
+
+// 热门新闻(静态段需注册在 /news/{news_id} 之前,避免被参数路由吞掉)
+mnbt_register_route('GET', '/site/api/news/popular', function ($params, $ctx) {
+ $rows = site_news_popular(4);
+ $list = [];
+ foreach ($rows as $n) {
+ $list[] = [
+ 'id' => (int)$n['id'],
+ 'title' => (string)$n['title'],
+ 'views' => (int)$n['views'],
+ 'created_at' => (string)$n['created_at'],
+ ];
+ }
+ site_json('ok', ['popular' => $list]);
+});
+
+// 新闻详情(累计浏览量)
+mnbt_register_route('GET', '/site/api/news/{news_id}', function ($params, $ctx) {
+ $id = (int)($params['news_id'] ?? 0);
+ $n = site_news_get($id, true);
+ if (!$n || $n['status'] !== 'active') {
+ site_json('新闻不存在');
+ return;
+ }
+ site_json('ok', ['news' => [
+ 'id' => (int)$n['id'],
+ 'title' => (string)$n['title'],
+ 'category' => (string)$n['category'],
+ 'content' => (string)$n['content'],
+ 'views' => (int)$n['views'],
+ 'created_at' => (string)$n['created_at'],
+ ]]);
+});
+
+// 提交留言
+mnbt_register_route('POST', '/site/api/contact', function ($params, $ctx) {
+ $r = site_message_add([
+ 'name' => $_POST['name'] ?? '',
+ 'email' => $_POST['email'] ?? '',
+ 'phone' => $_POST['phone'] ?? '',
+ 'message' => $_POST['message'] ?? '',
+ ]);
+ if ($r !== true) {
+ site_json($r);
+ return;
+ }
+ site_json('ok');
+});
+
+/* ============================================================
+ * 管理员端页面注册
+ * ============================================================ */
+
+mnbt_register_page('admin', 'site_products', 'views/admin/products.php', '产品管理');
+mnbt_register_page('admin', 'site_news', 'views/admin/news.php', '新闻管理');
+mnbt_register_page('admin', 'site_messages', 'views/admin/messages.php', '留言管理');
+
+// 侧边栏菜单
+mnbt_register_menu('admin', [
+ 'title' => '官网内容',
+ 'icon' => 'mdi-web',
+ 'order' => 55,
+ 'children' => [
+ ['title' => '产品管理', 'page' => 'site_products', 'icon' => 'mdi-package-variant', 'multitabs' => true],
+ ['title' => '新闻管理', 'page' => 'site_news', 'icon' => 'mdi-newspaper', 'multitabs' => true],
+ ['title' => '留言管理', 'page' => 'site_messages', 'icon' => 'mdi-email-open', 'multitabs' => true],
+ ],
+]);
diff --git a/app_plugins/official_site/install.sql b/app_plugins/official_site/install.sql
new file mode 100644
index 0000000..30f30dc
--- /dev/null
+++ b/app_plugins/official_site/install.sql
@@ -0,0 +1,69 @@
+-- official_site 插件安装 SQL
+-- 企业官网内容管理:产品展示、新闻资讯、联系留言
+
+-- 产品表
+DROP TABLE IF EXISTS `MN_plugin_site_product`;
+CREATE TABLE `MN_plugin_site_product` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(120) NOT NULL DEFAULT '' COMMENT '产品名称',
+ `category` varchar(50) NOT NULL DEFAULT '' COMMENT '分类 ai/cloud/hosting/domain/security/service',
+ `description` text NOT NULL COMMENT '产品简介',
+ `features` text NOT NULL COMMENT '特性列表 JSON 数组',
+ `image` varchar(500) NOT NULL DEFAULT '' COMMENT '展示图片 URL',
+ `status` varchar(20) NOT NULL DEFAULT 'active' COMMENT 'active/inactive',
+ `sort` int(11) NOT NULL DEFAULT '50' COMMENT '排序(小到大)',
+ `created_at` varchar(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `idx_category` (`category`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- 新闻表
+DROP TABLE IF EXISTS `MN_plugin_site_news`;
+CREATE TABLE `MN_plugin_site_news` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) NOT NULL DEFAULT '' COMMENT '标题',
+ `category` varchar(50) NOT NULL DEFAULT '' COMMENT '分类 产品发布/优惠活动/行业动态/平台公告',
+ `content` mediumtext NOT NULL COMMENT '正文',
+ `views` int(11) NOT NULL DEFAULT '0' COMMENT '浏览量',
+ `status` varchar(20) NOT NULL DEFAULT 'active' COMMENT 'active/inactive',
+ `sort` int(11) NOT NULL DEFAULT '50' COMMENT '排序(小到大)',
+ `created_at` varchar(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `idx_category` (`category`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- 留言表
+DROP TABLE IF EXISTS `MN_plugin_site_message`;
+CREATE TABLE `MN_plugin_site_message` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(60) NOT NULL DEFAULT '' COMMENT '姓名',
+ `email` varchar(120) NOT NULL DEFAULT '' COMMENT '邮箱',
+ `phone` varchar(30) NOT NULL DEFAULT '' COMMENT '电话',
+ `message` text NOT NULL COMMENT '留言内容',
+ `is_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已读',
+ `created_at` varchar(50) NOT NULL DEFAULT '',
+ PRIMARY KEY (`id`),
+ KEY `idx_read` (`is_read`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- ============================================================
+-- 初始示例数据(适配 MNBT 业务语境)
+-- ============================================================
+
+INSERT INTO `MN_plugin_site_product` (`name`, `category`, `description`, `features`, `image`, `status`, `sort`, `created_at`) VALUES
+('AI 智能分析平台', 'ai', '基于深度学习的业务数据智能分析与预测平台,帮助企业洞察趋势、辅助决策。', '["多源数据接入与自动清洗","可视化报表与预测模型","异常检测与实时告警","支持私有化部署"]', '', 'active', 10, '2026-08-10 00:00:00'),
+('高性能云服务器', 'cloud', '弹性计算、秒级开通的企业级云服务器,按需选择配置,随时升级。', '["全 SSD 存储集群","BGP 多线接入低延迟","弹性升配秒级生效","快照与自动备份"]', '', 'active', 20, '2026-08-10 00:00:00'),
+('虚拟主机托管', 'hosting', '即开即用的一键托管虚拟主机,支付后自动开通,分钟级上线,含宝塔面板。', '["一键部署宝塔面板","网页/数据库/流量灵活配置","自动开通分钟级上线","每日自动备份数据"]', '', 'active', 30, '2026-08-10 00:00:00'),
+('域名注册', 'domain', '全球主流域名后缀注册与管理,免费智能解析,一键绑定主机。', '["主流后缀全覆盖","免费智能 DNS 解析","一键解析到主机","域名隐私保护"]', '', 'active', 40, '2026-08-10 00:00:00'),
+('SSL 证书', 'security', 'DV / OV 企业级 HTTPS 证书,全站加密,提升信任与安全。', '["免费 DV 证书快速签发","企业 OV 证书验证","到期自动续期","全站 HTTPS 加密"]', '', 'active', 50, '2026-08-10 00:00:00'),
+('网站安全防护', 'security', 'DDoS 流量清洗与 WAF 网站防火墙,为业务提供全方位安全防护。', '["DDoS 流量清洗","WAF 规则实时拦截","CC 攻击防护","安全监控与报表"]', '', 'active', 60, '2026-08-10 00:00:00');
+
+INSERT INTO `MN_plugin_site_news` (`title`, `category`, `content`, `views`, `status`, `sort`, `created_at`) VALUES
+('虚拟主机套餐全面升级:全系标配 SSD 与自动备份', '产品发布', '为进一步提升用户体验,我们完成了虚拟主机套餐的全线升级:\n\n全系更换 SSD 存储,磁盘读写性能大幅提升;所有套餐默认开启每日自动备份,数据安全更有保障;控制面板同步升级,操作更加流畅。\n\n已有用户无需任何操作,自动享受升级后的性能与容量。感谢大家的支持!', 128, 'active', 10, '2026-08-08 10:00:00'),
+('AI 智能分析平台正式上线', '产品发布', '我们很高兴地宣布,AI 智能分析平台正式上线!\n\n平台基于深度学习技术,提供多源数据接入、可视化报表、异常检测与预测分析能力,支持私有化部署,帮助企业低成本构建数据洞察能力。\n\n即日起开放预约试用,欢迎通过页面底部联系方式与我们取得联系。', 96, 'active', 20, '2026-07-30 14:00:00'),
+('周年庆全场 8 折,新老用户同享', '优惠活动', '周年庆活动正式开启!\n\n活动期间,全场虚拟主机、云服务器套餐均享 8 折优惠,新老用户同享,数量有限先到先得。\n\n参与方式:前往主机套餐页面选择心仪套餐下单即可,活动价格自动生效。', 220, 'active', 30, '2026-07-20 09:00:00'),
+('新用户注册即送余额礼包', '优惠活动', '欢迎新用户!\n\n即日起注册平台的用户,将自动获得余额礼包,可用于购买任意套餐或续费,无使用门槛。\n\n快来注册体验吧,开启您的建站之旅!', 310, 'active', 40, '2026-07-10 11:00:00'),
+('数据中心华东节点完成扩容', '行业动态', '为应对快速增长的业务需求,我们完成了华东地区数据中心的扩容升级。\n\n本次扩容新增多组高可用节点,网络带宽进一步提升,华东地区用户访问延迟显著降低。\n\n后续我们将持续优化全国节点布局,为用户提供更稳定、更快速的访问体验。', 75, 'active', 50, '2026-06-28 16:00:00'),
+('平台通过国家等级保护三级认证', '行业动态', '经过权威测评机构全面评估,平台正式通过国家信息安全等级保护三级认证。\n\n这标志着平台在信息安全技术与管理体系上达到业界先进水平,能够为用户业务提供更可靠的保障。', 60, 'active', 60, '2026-06-15 10:00:00'),
+('关于 ICP 备案信息更新的公告', '平台公告', '根据国家相关规定,平台官网 ICP 备案信息已完成更新,新版备案信息已同步至网站页脚。\n\n如您在访问过程中有任何疑问,欢迎通过联系我们页面反馈,我们将及时处理。', 45, 'active', 70, '2026-06-01 10:00:00'),
+('用户服务协议与隐私政策更新', '平台公告', '为更好地保障用户权益,我们对用户服务协议与隐私政策进行了修订更新。\n\n新版协议自发布之日起生效,涉及账号管理、服务条款、数据处理与隐私保护等内容,请广大用户知悉。\n\n如有疑问,可通过联系我们页面与我们沟通。', 52, 'active', 80, '2026-05-20 10:00:00');
diff --git a/app_plugins/official_site/lib/site.php b/app_plugins/official_site/lib/site.php
new file mode 100644
index 0000000..a906700
--- /dev/null
+++ b/app_plugins/official_site/lib/site.php
@@ -0,0 +1,324 @@
+<?php
+/**
+ * official_site 插件 - 核心函数库
+ *
+ * 提供:产品/新闻/留言的 CRUD 与前台数据查询,供 bootstrap.php 与 admin 视图使用。
+ */
+
+if (!defined('IN_CRONLITE')) {
+ exit;
+}
+
+/* ============================================================
+ * 辅助函数
+ * ============================================================ */
+
+/** 管理员端插件页面 URL。 */
+function site_admin_url($page, $extra = '')
+{
+ $base = 'plugin.php?p=official_site&page=' . rawurlencode($page);
+ if ($extra !== '') {
+ $base .= '&' . ltrim($extra, '&');
+ }
+ return $base;
+}
+
+/** 输出 JSON 并退出。 */
+function site_json($code, $extra = [])
+{
+ @header('Content-Type: application/json; charset=UTF-8');
+ $payload = ['code' => $code];
+ if (is_array($extra)) {
+ $payload = array_merge($payload, $extra);
+ }
+ echo json_encode($payload, JSON_UNESCAPED_UNICODE);
+ exit;
+}
+
+/** 产品分类定义(MNBT 业务语境)。 */
+function site_product_categories()
+{
+ return [
+ 'ai' => 'AI 智能',
+ 'cloud' => '云服务器',
+ 'hosting' => '虚拟主机',
+ 'domain' => '域名服务',
+ 'security' => '安全防护',
+ 'service' => '增值服务',
+ ];
+}
+
+/* ============================================================
+ * 产品
+ * ============================================================ */
+
+/** 解析产品特性(JSON 字符串 ↔ 数组)。 */
+function site_product_features_parse($row)
+{
+ $features = [];
+ $raw = trim((string)($row['features'] ?? ''));
+ if ($raw !== '') {
+ $decoded = json_decode($raw, true);
+ if (is_array($decoded)) {
+ $features = array_values(array_filter(array_map('trim', $decoded), function ($v) {
+ return $v !== '';
+ }));
+ }
+ }
+ return $features;
+}
+
+/**
+ * 产品列表。
+ * @param string $status ''=全部,'active'/'inactive'
+ * @param string $category ''=全部,或具体分类
+ */
+function site_product_list($status = '', $category = '')
+{
+ global $DB;
+ $sql = "SELECT * FROM MN_plugin_site_product";
+ $where = [];
+ $args = [];
+ if ($status !== '') {
+ $where[] = "status = ?";
+ $args[] = $status;
+ }
+ if ($category !== '' && $category !== 'all') {
+ $where[] = "category = ?";
+ $args[] = $category;
+ }
+ if (!empty($where)) {
+ $sql .= " WHERE " . implode(' AND ', $where);
+ }
+ $sql .= " ORDER BY sort ASC, id ASC";
+ $rows = $DB->get_all_prepare($sql, $args) ?: [];
+ $list = [];
+ foreach ($rows as $r) {
+ $r['features_list'] = site_product_features_parse($r);
+ $list[] = $r;
+ }
+ return $list;
+}
+
+/** 产品详情(含特性数组)。 */
+function site_product_get($id)
+{
+ global $DB;
+ $row = $DB->get_row_prepare("SELECT * FROM MN_plugin_site_product WHERE id=? LIMIT 1", [(int)$id]) ?: null;
+ if ($row) {
+ $row['features_list'] = site_product_features_parse($row);
+ }
+ return $row;
+}
+
+/** 保存产品(新增/更新),返回 true 或错误消息。 */
+function site_product_save($data)
+{
+ global $DB;
+ $now = date('Y-m-d H:i:s');
+ $features = isset($data['features']) && is_array($data['features']) ? $data['features'] : [];
+ $features = array_values(array_filter(array_map('trim', $features), function ($v) {
+ return $v !== '';
+ }));
+ $fields = [
+ 'name' => trim((string)($data['name'] ?? '')),
+ 'category' => trim((string)($data['category'] ?? '')),
+ 'description' => trim((string)($data['description'] ?? '')),
+ 'features' => json_encode($features, JSON_UNESCAPED_UNICODE),
+ 'image' => trim((string)($data['image'] ?? '')),
+ 'status' => ($data['status'] ?? 'active') === 'inactive' ? 'inactive' : 'active',
+ 'sort' => max(0, (int)($data['sort'] ?? 50)),
+ ];
+ if ($fields['name'] === '') {
+ return '产品名称不能为空';
+ }
+ if ($fields['category'] === '') {
+ return '请选择产品分类';
+ }
+
+ $id = (int)($data['id'] ?? 0);
+ if ($id > 0) {
+ $ok = $DB->query_prepare(
+ "UPDATE MN_plugin_site_product SET name=?, category=?, description=?, features=?, image=?, status=?, sort=? WHERE id=?",
+ [$fields['name'], $fields['category'], $fields['description'], $fields['features'], $fields['image'], $fields['status'], $fields['sort'], $id]
+ );
+ return $ok ? true : '更新失败';
+ }
+ $ok = $DB->query_prepare(
+ "INSERT INTO MN_plugin_site_product (name, category, description, features, image, status, sort, created_at) VALUES (?,?,?,?,?,?,?,?)",
+ [$fields['name'], $fields['category'], $fields['description'], $fields['features'], $fields['image'], $fields['status'], $fields['sort'], $now]
+ );
+ return $ok ? true : '新增失败';
+}
+
+/** 删除产品。 */
+function site_product_delete($id)
+{
+ global $DB;
+ return (bool)$DB->query_prepare("DELETE FROM MN_plugin_site_product WHERE id=? LIMIT 1", [(int)$id]);
+}
+
+/* ============================================================
+ * 新闻
+ * ============================================================ */
+
+/** 新闻分类统计(前台侧边栏)。 */
+function site_news_categories()
+{
+ global $DB;
+ return $DB->get_all_prepare(
+ "SELECT category, COUNT(*) AS cnt FROM MN_plugin_site_news WHERE status='active' AND category != '' GROUP BY category ORDER BY cnt DESC, category ASC"
+ ) ?: [];
+}
+
+/**
+ * 新闻分页列表。
+ * @param string $status 'active'=仅上架(默认,前台);''=全部(管理端)
+ */
+function site_news_list($page = 1, $per = 6, $category = '', $status = 'active')
+{
+ global $DB;
+ $page = max(1, (int)$page);
+ $per = max(1, min(100, (int)$per));
+ $where = [];
+ $args = [];
+ if ($status !== '') {
+ $where[] = "status = ?";
+ $args[] = $status;
+ }
+ if ($category !== '' && $category !== 'all') {
+ $where[] = "category = ?";
+ $args[] = $category;
+ }
+ $whereSql = $where === [] ? '' : (' WHERE ' . implode(' AND ', $where));
+ $total = (int)($DB->get_row_prepare("SELECT COUNT(*) AS c FROM MN_plugin_site_news" . $whereSql, $args)['c'] ?? 0);
+ $offset = ($page - 1) * $per;
+ $rows = $DB->get_all_prepare(
+ "SELECT * FROM MN_plugin_site_news" . $whereSql . " ORDER BY sort ASC, id DESC LIMIT {$offset},{$per}",
+ $args
+ ) ?: [];
+ return ['total' => $total, 'list' => $rows];
+}
+
+/** 新闻详情($incViews 为 true 时累计浏览量)。 */
+function site_news_get($id, $incViews = false)
+{
+ global $DB;
+ $id = (int)$id;
+ $row = $DB->get_row_prepare("SELECT * FROM MN_plugin_site_news WHERE id=? LIMIT 1", [$id]) ?: null;
+ if ($row && $incViews) {
+ $DB->query_prepare("UPDATE MN_plugin_site_news SET views = views + 1 WHERE id=?", [$id]);
+ $row['views'] = (int)$row['views'] + 1;
+ }
+ return $row;
+}
+
+/** 热门新闻(按浏览量)。 */
+function site_news_popular($limit = 4)
+{
+ global $DB;
+ $limit = max(1, min(20, (int)$limit));
+ return $DB->get_all_prepare(
+ "SELECT id, title, views, created_at FROM MN_plugin_site_news WHERE status='active' ORDER BY views DESC, id DESC LIMIT " . $limit
+ ) ?: [];
+}
+
+/** 保存新闻(新增/更新),返回 true 或错误消息。 */
+function site_news_save($data)
+{
+ global $DB;
+ $now = date('Y-m-d H:i:s');
+ $fields = [
+ 'title' => trim((string)($data['title'] ?? '')),
+ 'category' => trim((string)($data['category'] ?? '')),
+ 'content' => (string)($data['content'] ?? ''),
+ 'status' => ($data['status'] ?? 'active') === 'inactive' ? 'inactive' : 'active',
+ 'sort' => max(0, (int)($data['sort'] ?? 50)),
+ ];
+ if ($fields['title'] === '') {
+ return '新闻标题不能为空';
+ }
+ if ($fields['content'] === '') {
+ return '新闻内容不能为空';
+ }
+
+ $id = (int)($data['id'] ?? 0);
+ if ($id > 0) {
+ $ok = $DB->query_prepare(
+ "UPDATE MN_plugin_site_news SET title=?, category=?, content=?, status=?, sort=? WHERE id=?",
+ [$fields['title'], $fields['category'], $fields['content'], $fields['status'], $fields['sort'], $id]
+ );
+ return $ok ? true : '更新失败';
+ }
+ $ok = $DB->query_prepare(
+ "INSERT INTO MN_plugin_site_news (title, category, content, views, status, sort, created_at) VALUES (?,?,?,0,?,?,?)",
+ [$fields['title'], $fields['category'], $fields['content'], $fields['status'], $fields['sort'], $now]
+ );
+ return $ok ? true : '新增失败';
+}
+
+/** 删除新闻。 */
+function site_news_delete($id)
+{
+ global $DB;
+ return (bool)$DB->query_prepare("DELETE FROM MN_plugin_site_news WHERE id=? LIMIT 1", [(int)$id]);
+}
+
+/* ============================================================
+ * 留言
+ * ============================================================ */
+
+/** 新增留言(前台提交),返回 true 或错误消息。 */
+function site_message_add($data)
+{
+ global $DB;
+ $now = date('Y-m-d H:i:s');
+ $fields = [
+ 'name' => trim((string)($data['name'] ?? '')),
+ 'email' => trim((string)($data['email'] ?? '')),
+ 'phone' => trim((string)($data['phone'] ?? '')),
+ 'message' => trim((string)($data['message'] ?? '')),
+ ];
+ if ($fields['name'] === '') {
+ return '请输入姓名';
+ }
+ if ($fields['email'] === '' || !filter_var($fields['email'], FILTER_VALIDATE_EMAIL)) {
+ return '请输入有效的邮箱地址';
+ }
+ if ($fields['message'] === '') {
+ return '请输入留言内容';
+ }
+ $ok = $DB->query_prepare(
+ "INSERT INTO MN_plugin_site_message (name, email, phone, message, is_read, created_at) VALUES (?,?,?,?,0,?)",
+ [$fields['name'], $fields['email'], $fields['phone'], $fields['message'], $now]
+ );
+ return $ok ? true : '留言提交失败,请稍后重试';
+}
+
+/** 留言分页列表(管理端)。 */
+function site_message_list($page = 1, $per = 15)
+{
+ global $DB;
+ $page = max(1, (int)$page);
+ $per = max(1, min(100, (int)$per));
+ $total = (int)($DB->get_row_prepare("SELECT COUNT(*) AS c FROM MN_plugin_site_message")['c'] ?? 0);
+ $offset = ($page - 1) * $per;
+ $rows = $DB->get_all_prepare(
+ "SELECT * FROM MN_plugin_site_message ORDER BY id DESC LIMIT {$offset},{$per}"
+ ) ?: [];
+ return ['total' => $total, 'list' => $rows];
+}
+
+/** 删除留言。 */
+function site_message_delete($id)
+{
+ global $DB;
+ return (bool)$DB->query_prepare("DELETE FROM MN_plugin_site_message WHERE id=? LIMIT 1", [(int)$id]);
+}
+
+/** 标记留言已读/未读。 */
+function site_message_set_read($id, $read)
+{
+ global $DB;
+ return (bool)$DB->query_prepare("UPDATE MN_plugin_site_message SET is_read=? WHERE id=?", [$read ? 1 : 0, (int)$id]);
+}
diff --git a/app_plugins/official_site/plugin.json b/app_plugins/official_site/plugin.json
new file mode 100644
index 0000000..419778c
--- /dev/null
+++ b/app_plugins/official_site/plugin.json
@@ -0,0 +1,10 @@
+{
+ "id": "official_site",
+ "name": "官网内容",
+ "version": "1.0.0",
+ "author": "MNBT",
+ "description": "企业官网内容管理:产品展示、新闻资讯、联系留言。配套 tdesign home 主题「关于/产品/新闻/联系」页面与官网风格落地页。",
+ "requires_mnbt": "1.84",
+ "requires_plugins": [],
+ "type": ["business"]
+}
diff --git a/app_plugins/official_site/uninstall.sql b/app_plugins/official_site/uninstall.sql
new file mode 100644
index 0000000..132ce93
--- /dev/null
+++ b/app_plugins/official_site/uninstall.sql
@@ -0,0 +1,4 @@
+-- official_site 插件卸载 SQL
+DROP TABLE IF EXISTS `MN_plugin_site_message`;
+DROP TABLE IF EXISTS `MN_plugin_site_news`;
+DROP TABLE IF EXISTS `MN_plugin_site_product`;
diff --git a/app_plugins/official_site/views/admin/messages.php b/app_plugins/official_site/views/admin/messages.php
new file mode 100644
index 0000000..c3652df
--- /dev/null
+++ b/app_plugins/official_site/views/admin/messages.php
@@ -0,0 +1,163 @@
+<?php
+/**
+ * 管理员端 - 官网留言管理(列表分页 + 标记已读/删除)
+ */
+if (!defined('IN_CRONLITE')) {
+ exit;
+}
+
+// —— 处理 POST(成功后 redirect 到带提示参数的地址,避免刷新重复提交)——
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $act = $_POST['act'] ?? '';
+ $id = (int)($_POST['id'] ?? 0);
+
+ if ($act === 'set_read') {
+ $read = (int)($_POST['read'] ?? 0) === 1;
+ $ok = $id > 0 && site_message_set_read($id, $read);
+ header('Location: ' . site_admin_url('site_messages', ($ok ? 'saved=1&msg=' . urlencode($read ? '已标记为已读' : '已标记为未读') : 'msg=' . urlencode('操作失败'))));
+ exit;
+ } elseif ($act === 'delete') {
+ $ok = $id > 0 && site_message_delete($id);
+ header('Location: ' . site_admin_url('site_messages', ($ok ? 'saved=1&msg=' . urlencode('留言已删除') : 'msg=' . urlencode('删除失败'))));
+ exit;
+ }
+}
+
+// —— GET 参数处理(redirect 后的提示)——
+$saved = isset($_GET['saved']);
+$msg = $_GET['msg'] ?? ($msg ?? '');
+$msg_type = $saved ? 'success' : ($msg_type ?? 'danger');
+if ($saved && $msg === '') {
+ $msg = '保存成功';
+}
+
+$per = 15;
+$page = max(1, (int)($_GET['page'] ?? 1));
+$pageData = site_message_list($page, $per);
+$messages = $pageData['list'];
+$total = $pageData['total'];
+$pages = (int)ceil($total / $per);
+global $DB;
+$unread = (int)($DB->get_row_prepare("SELECT COUNT(*) AS c FROM MN_plugin_site_message WHERE is_read=0")['c'] ?? 0);
+
+$title = $title ?? '留言管理';
+mnbt_admin_include('head');
+?>
+<div class="container-fluid p-t-15">
+ <div class="card">
+ <div class="card-header">
+ <h4 style="display:inline-block">留言管理</h4>
+ <span class="float-right"><span class="badge badge-warning">未读 <?= (int)$unread ?> 条</span></span>
+ </div>
+ <div class="card-body">
+ <?php if (!empty($msg)): ?>
+ <div class="alert alert-<?= htmlspecialchars($msg_type ?? 'danger', ENT_QUOTES) ?>"><?= htmlspecialchars($msg) ?></div>
+ <?php endif; ?>
+
+ <?php if (empty($messages)): ?>
+ <p class="text-muted">还没有收到留言。</p>
+ <?php else: ?>
+ <div class="table-responsive">
+ <table class="table table-bordered table-hover">
+ <thead>
+ <tr>
+ <th style="width:60px">ID</th>
+ <th style="width:140px">姓名</th>
+ <th style="width:200px">联系方式</th>
+ <th>留言内容</th>
+ <th style="width:90px">状态</th>
+ <th style="width:140px">提交时间</th>
+ <th style="width:200px">操作</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($messages as $m): ?>
+ <tr class="<?= (int)$m['is_read'] === 0 ? 'table-warning' : '' ?>">
+ <td><?= (int)$m['id'] ?></td>
+ <td><?= htmlspecialchars($m['name'], ENT_QUOTES) ?></td>
+ <td>
+ <?php if ($m['email'] !== ''): ?><i class="mdi mdi-email-outline"></i> <?= htmlspecialchars($m['email'], ENT_QUOTES) ?><br><?php endif; ?>
+ <?php if ($m['phone'] !== ''): ?><i class="mdi mdi-phone-outline"></i> <?= htmlspecialchars($m['phone'], ENT_QUOTES) ?><?php endif; ?>
+ </td>
+ <td><?= htmlspecialchars(mb_substr($m['message'], 0, 60), ENT_QUOTES) ?><?= mb_strlen($m['message']) > 60 ? '…' : '' ?></td>
+ <td>
+ <?php if ((int)$m['is_read'] === 0): ?>
+ <span class="badge badge-warning">未读</span>
+ <?php else: ?>
+ <span class="badge badge-success">已读</span>
+ <?php endif; ?>
+ </td>
+ <td><?= htmlspecialchars($m['created_at'], ENT_QUOTES) ?></td>
+ <td>
+ <button type="button" class="btn btn-sm btn-outline-primary" onclick="viewMessage(<?= (int)$m['id'] ?>)">查看</button>
+ <form method="post" style="display:inline-block">
+ <input type="hidden" name="act" value="set_read">
+ <input type="hidden" name="id" value="<?= (int)$m['id'] ?>">
+ <input type="hidden" name="read" value="<?= (int)$m['is_read'] === 0 ? 1 : 0 ?>">
+ <button type="submit" class="btn btn-sm btn-outline-secondary"><?= (int)$m['is_read'] === 0 ? '标为已读' : '标为未读' ?></button>
+ </form>
+ <form method="post" style="display:inline-block" onsubmit="var b=this.querySelector('button');b.disabled=true;b.textContent='删除中...';return confirm('确定删除此留言?')">
+ <input type="hidden" name="act" value="delete">
+ <input type="hidden" name="id" value="<?= (int)$m['id'] ?>">
+ <button type="submit" class="btn btn-sm btn-outline-danger">删除</button>
+ </form>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ </div>
+
+ <?php if ($pages > 1): ?>
+ <nav aria-label="分页">
+ <ul class="pagination pagination-sm justify-content-end" style="margin-bottom:0">
+ <?php for ($i = 1; $i <= $pages; $i++): ?>
+ <li class="page-item<?= $i === $page ? ' active' : '' ?>">
+ <a class="page-link" href="<?= htmlspecialchars(site_admin_url('site_messages', 'page=' . $i), ENT_QUOTES) ?>"><?= $i ?></a>
+ </li>
+ <?php endfor; ?>
+ </ul>
+ </nav>
+ <?php endif; ?>
+ <?php endif; ?>
+ </div>
+ </div>
+</div>
+
+<!-- 留言详情模态框 -->
+<div class="modal fade" id="viewModal" tabindex="-1" role="dialog" aria-hidden="true">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title">留言详情</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ </div>
+ <div class="modal-body" id="viewBody"></div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+var __siteMessages = <?= json_encode($messages, JSON_UNESCAPED_UNICODE) ?>;
+function esc(s) {
+ return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) {
+ return { '&': '&', '<': '<', '>': '>', '"': '"' }[c];
+ });
+}
+function viewMessage(id) {
+ var m = __siteMessages.find(function (x) { return parseInt(x.id, 10) === parseInt(id, 10); });
+ if (!m) { return; }
+ var contact = [];
+ if (m.email) { contact.push('邮箱:' + esc(m.email)); }
+ if (m.phone) { contact.push('电话:' + esc(m.phone)); }
+ document.getElementById('viewBody').innerHTML =
+ '<p><strong>' + esc(m.name) + '</strong> <span class="text-muted">(' + esc(m.created_at) + ')</span></p>' +
+ (contact.length ? '<p class="text-muted">' + contact.join(' ') + '</p>' : '') +
+ '<hr><p style="white-space:pre-wrap;word-break:break-word;">' + esc(m.message) + '</p>';
+ $('#viewModal').modal('show');
+}
+</script>
+<?php mnbt_admin_include('foot'); ?>
diff --git a/app_plugins/official_site/views/admin/news.php b/app_plugins/official_site/views/admin/news.php
new file mode 100644
index 0000000..2349db5
--- /dev/null
+++ b/app_plugins/official_site/views/admin/news.php
@@ -0,0 +1,245 @@
+<?php
+/**
+ * 管理员端 - 官网新闻管理(列表分页 + 添加/编辑/删除)
+ */
+if (!defined('IN_CRONLITE')) {
+ exit;
+}
+
+// —— 处理 POST(成功后 redirect 到带提示参数的地址,避免刷新重复提交)——
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $act = $_POST['act'] ?? '';
+
+ if ($act === 'save') {
+ $data = [
+ 'id' => (int)($_POST['id'] ?? 0),
+ 'title' => $_POST['title'] ?? '',
+ 'category' => $_POST['category'] ?? '',
+ 'content' => $_POST['content'] ?? '',
+ 'status' => $_POST['status'] ?? 'active',
+ 'sort' => (int)($_POST['sort'] ?? 50),
+ ];
+ $r = site_news_save($data);
+ if ($r === true) {
+ header('Location: ' . site_admin_url('site_news', 'saved=1'));
+ exit;
+ }
+ $msg = $r;
+ $msg_type = 'danger';
+ $form = $data;
+ $show_modal = true;
+ } elseif ($act === 'delete') {
+ $id = (int)($_POST['id'] ?? 0);
+ $ok = $id > 0 && site_news_delete($id);
+ header('Location: ' . site_admin_url('site_news', ($ok ? 'saved=1&msg=' . urlencode('新闻已删除') : 'msg=' . urlencode('删除失败'))));
+ exit;
+ }
+}
+
+// —— GET 参数处理(redirect 后的提示)——
+$saved = isset($_GET['saved']);
+$msg = $_GET['msg'] ?? ($msg ?? '');
+$msg_type = $saved ? 'success' : ($msg_type ?? 'danger');
+if ($saved && $msg === '') {
+ $msg = '保存成功';
+}
+
+$per = 15;
+$page = max(1, (int)($_GET['page'] ?? 1));
+$pageData = site_news_list($page, $per, '', ''); // 管理端显示全部状态
+$newsList = $pageData['list'];
+$total = $pageData['total'];
+$pages = (int)ceil($total / $per);
+
+// 新闻分类(默认分类 + 数据库中已有的其他分类)
+$news_categories = ['产品发布', '优惠活动', '行业动态', '平台公告'];
+global $DB;
+$cat_rows = $DB->get_all_prepare("SELECT DISTINCT category FROM MN_plugin_site_news WHERE category != '' ORDER BY category ASC") ?: [];
+foreach ($cat_rows as $cr) {
+ if (!in_array($cr['category'], $news_categories, true)) {
+ $news_categories[] = $cr['category'];
+ }
+}
+
+$title = $title ?? '新闻管理';
+mnbt_admin_include('head');
+?>
+<div class="container-fluid p-t-15">
+ <div class="card">
+ <div class="card-header">
+ <h4 style="display:inline-block">新闻管理</h4>
+ <span class="float-right">
+ <button type="button" class="btn btn-primary btn-sm" onclick="openEdit(0)">
+ <i class="mdi mdi-plus"></i> 添加新闻
+ </button>
+ </span>
+ </div>
+ <div class="card-body">
+ <?php if (!empty($msg)): ?>
+ <div class="alert alert-<?= htmlspecialchars($msg_type ?? 'danger', ENT_QUOTES) ?>"><?= htmlspecialchars($msg) ?></div>
+ <?php endif; ?>
+
+ <?php if (empty($newsList)): ?>
+ <p class="text-muted">还没有新闻,点击右上角"添加新闻"发布第一篇。</p>
+ <?php else: ?>
+ <div class="table-responsive">
+ <table class="table table-bordered table-hover">
+ <thead>
+ <tr>
+ <th style="width:60px">ID</th>
+ <th>标题</th>
+ <th style="width:120px">分类</th>
+ <th style="width:80px">浏览</th>
+ <th style="width:80px">状态</th>
+ <th style="width:70px">排序</th>
+ <th style="width:140px">发布时间</th>
+ <th style="width:170px">操作</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($newsList as $n): ?>
+ <tr>
+ <td><?= (int)$n['id'] ?></td>
+ <td><?= htmlspecialchars(mb_substr($n['title'], 0, 40), ENT_QUOTES) ?><?= mb_strlen($n['title']) > 40 ? '…' : '' ?></td>
+ <td><?= htmlspecialchars($n['category'] ?: '—', ENT_QUOTES) ?></td>
+ <td><?= (int)$n['views'] ?></td>
+ <td>
+ <?php if ($n['status'] === 'active'): ?>
+ <span class="badge badge-success">上架</span>
+ <?php else: ?>
+ <span class="badge badge-secondary">下架</span>
+ <?php endif; ?>
+ </td>
+ <td><?= (int)$n['sort'] ?></td>
+ <td><?= htmlspecialchars($n['created_at'], ENT_QUOTES) ?></td>
+ <td>
+ <button type="button" class="btn btn-sm btn-outline-primary" onclick="openEdit(<?= (int)$n['id'] ?>)">编辑</button>
+ <form method="post" style="display:inline-block" onsubmit="var b=this.querySelector('button');b.disabled=true;b.textContent='删除中...';return confirm('确定删除此新闻?')">
+ <input type="hidden" name="act" value="delete">
+ <input type="hidden" name="id" value="<?= (int)$n['id'] ?>">
+ <button type="submit" class="btn btn-sm btn-outline-danger">删除</button>
+ </form>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ </div>
+
+ <?php if ($pages > 1): ?>
+ <nav aria-label="分页">
+ <ul class="pagination pagination-sm justify-content-end" style="margin-bottom:0">
+ <?php for ($i = 1; $i <= $pages; $i++): ?>
+ <li class="page-item<?= $i === $page ? ' active' : '' ?>">
+ <a class="page-link" href="<?= htmlspecialchars(site_admin_url('site_news', 'page=' . $i), ENT_QUOTES) ?>"><?= $i ?></a>
+ </li>
+ <?php endfor; ?>
+ </ul>
+ </nav>
+ <?php endif; ?>
+ <?php endif; ?>
+ </div>
+ </div>
+</div>
+
+<!-- 添加/编辑模态框 -->
+<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-hidden="true">
+ <div class="modal-dialog modal-lg" role="document">
+ <div class="modal-content">
+ <form method="post">
+ <input type="hidden" name="act" value="save">
+ <input type="hidden" name="id" id="f-id" value="0">
+ <div class="modal-header">
+ <h5 class="modal-title" id="modalTitle">添加新闻</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ </div>
+ <div class="modal-body">
+ <div class="form-group">
+ <label>新闻标题</label>
+ <input type="text" class="form-control" name="title" id="f-title" required>
+ </div>
+ <div class="form-row">
+ <div class="col-6">
+ <div class="form-group">
+ <label>新闻分类</label>
+ <select class="form-control" name="category" id="f-category">
+ <option value="">未分类</option>
+ <?php foreach ($news_categories as $cat): ?>
+ <option value="<?= htmlspecialchars($cat, ENT_QUOTES) ?>"><?= htmlspecialchars($cat) ?></option>
+ <?php endforeach; ?>
+ </select>
+ </div>
+ </div>
+ <div class="col-3">
+ <div class="form-group">
+ <label>状态</label>
+ <select class="form-control" name="status" id="f-status">
+ <option value="active">上架</option>
+ <option value="inactive">下架</option>
+ </select>
+ </div>
+ </div>
+ <div class="col-3">
+ <div class="form-group">
+ <label>排序(小到大)</label>
+ <input type="number" class="form-control" name="sort" id="f-sort" value="50" min="0">
+ </div>
+ </div>
+ </div>
+ <div class="form-group">
+ <label>正文内容</label>
+ <textarea class="form-control" name="content" id="f-content" rows="10" required></textarea>
+ <small class="form-text text-muted">支持纯文本与 HTML 标签,换行使用 <br> 或空段落。</small>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+ <button type="submit" class="btn btn-primary">保存</button>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+<script>
+var __siteNews = <?= json_encode($newsList, JSON_UNESCAPED_UNICODE) ?>;
+<?php if (!empty($show_modal)): ?>
+var __siteForm = <?= json_encode($form, JSON_UNESCAPED_UNICODE) ?>;
+<?php endif; ?>
+function openEdit(id) {
+ var el = function (k) { return document.getElementById('f-' + k); };
+ document.getElementById('modalTitle').textContent = id ? '编辑新闻' : '添加新闻';
+ el('id').value = id;
+ if (id > 0) {
+ var n = __siteNews.find(function (x) { return parseInt(x.id, 10) === parseInt(id, 10); });
+ if (n) {
+ el('title').value = n.title || '';
+ el('category').value = n.category || '';
+ el('content').value = n.content || '';
+ el('status').value = n.status || 'active';
+ el('sort').value = n.sort || 50;
+ }
+ } else {
+ el('title').value = '';
+ el('category').value = '';
+ el('content').value = '';
+ el('status').value = 'active';
+ el('sort').value = 50;
+ }
+ <?php if (!empty($show_modal)): ?>
+ // 提交失败回显:用服务端返回的表单数据覆盖字段
+ if (typeof __siteForm !== 'undefined') {
+ el('title').value = __siteForm.title || '';
+ el('category').value = __siteForm.category || '';
+ el('content').value = __siteForm.content || '';
+ el('status').value = __siteForm.status || 'active';
+ el('sort').value = __siteForm.sort || 50;
+ }
+ <?php endif; ?>
+ $('#editModal').modal('show');
+}
+<?php if (!empty($show_modal)): ?>
+ $(function () { openEdit(<?= (int)($form['id'] ?? 0) ?>); });
+<?php endif; ?>
+</script>
+<?php mnbt_admin_include('foot'); ?>
diff --git a/app_plugins/official_site/views/admin/products.php b/app_plugins/official_site/views/admin/products.php
new file mode 100644
index 0000000..c291eb5
--- /dev/null
+++ b/app_plugins/official_site/views/admin/products.php
@@ -0,0 +1,235 @@
+<?php
+/**
+ * 管理员端 - 官网产品管理(列表 + 添加/编辑/删除)
+ */
+if (!defined('IN_CRONLITE')) {
+ exit;
+}
+
+// —— 处理 POST(成功后 redirect 到带提示参数的地址,避免刷新重复提交)——
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+ $act = $_POST['act'] ?? '';
+
+ if ($act === 'save') {
+ $features = [];
+ foreach (preg_split('/[\r\n]+/', (string)($_POST['features'] ?? '')) as $line) {
+ $line = trim($line);
+ if ($line !== '') {
+ $features[] = $line;
+ }
+ }
+ $data = [
+ 'id' => (int)($_POST['id'] ?? 0),
+ 'name' => $_POST['name'] ?? '',
+ 'category' => $_POST['category'] ?? '',
+ 'description' => $_POST['description'] ?? '',
+ 'features' => $features,
+ 'image' => $_POST['image'] ?? '',
+ 'status' => $_POST['status'] ?? 'active',
+ 'sort' => (int)($_POST['sort'] ?? 50),
+ ];
+ $r = site_product_save($data);
+ if ($r === true) {
+ header('Location: ' . site_admin_url('site_products', 'saved=1'));
+ exit;
+ }
+ $msg = $r;
+ $msg_type = 'danger';
+ $form = $data;
+ $show_modal = true;
+ } elseif ($act === 'delete') {
+ $id = (int)($_POST['id'] ?? 0);
+ $ok = $id > 0 && site_product_delete($id);
+ header('Location: ' . site_admin_url('site_products', ($ok ? 'saved=1&msg=' . urlencode('产品已删除') : 'msg=' . urlencode('删除失败'))));
+ exit;
+ }
+}
+
+// —— GET 参数处理(redirect 后的提示)——
+$saved = isset($_GET['saved']);
+$msg = $_GET['msg'] ?? ($msg ?? '');
+$msg_type = $saved ? 'success' : ($msg_type ?? 'danger');
+if ($saved && $msg === '') {
+ $msg = '保存成功';
+}
+
+$products = site_product_list();
+$categories = site_product_categories();
+$title = $title ?? '产品管理';
+mnbt_admin_include('head');
+?>
+<div class="container-fluid p-t-15">
+ <div class="card">
+ <div class="card-header">
+ <h4 style="display:inline-block">产品管理</h4>
+ <span class="float-right">
+ <button type="button" class="btn btn-primary btn-sm" onclick="openEdit(0)">
+ <i class="mdi mdi-plus"></i> 添加产品
+ </button>
+ </span>
+ </div>
+ <div class="card-body">
+ <?php if (!empty($msg)): ?>
+ <div class="alert alert-<?= htmlspecialchars($msg_type ?? 'danger', ENT_QUOTES) ?>"><?= htmlspecialchars($msg) ?></div>
+ <?php endif; ?>
+
+ <?php if (empty($products)): ?>
+ <p class="text-muted">还没有产品,点击右上角"添加产品"创建第一个产品。</p>
+ <?php else: ?>
+ <div class="table-responsive">
+ <table class="table table-bordered table-hover">
+ <thead>
+ <tr>
+ <th style="width:60px">ID</th>
+ <th>产品名称</th>
+ <th style="width:120px">分类</th>
+ <th>简介</th>
+ <th style="width:80px">状态</th>
+ <th style="width:70px">排序</th>
+ <th style="width:170px">操作</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($products as $p): ?>
+ <tr>
+ <td><?= (int)$p['id'] ?></td>
+ <td><?= htmlspecialchars($p['name'], ENT_QUOTES) ?></td>
+ <td><?= htmlspecialchars($categories[$p['category']] ?? $p['category'], ENT_QUOTES) ?></td>
+ <td><?= htmlspecialchars(mb_substr($p['description'], 0, 40), ENT_QUOTES) ?><?= mb_strlen($p['description']) > 40 ? '…' : '' ?></td>
+ <td>
+ <?php if ($p['status'] === 'active'): ?>
+ <span class="badge badge-success">上架</span>
+ <?php else: ?>
+ <span class="badge badge-secondary">下架</span>
+ <?php endif; ?>
+ </td>
+ <td><?= (int)$p['sort'] ?></td>
+ <td>
+ <button type="button" class="btn btn-sm btn-outline-primary" onclick="openEdit(<?= (int)$p['id'] ?>)">编辑</button>
+ <form method="post" style="display:inline-block" onsubmit="var b=this.querySelector('button');b.disabled=true;b.textContent='删除中...';return confirm('确定删除此产品?')">
+ <input type="hidden" name="act" value="delete">
+ <input type="hidden" name="id" value="<?= (int)$p['id'] ?>">
+ <button type="submit" class="btn btn-sm btn-outline-danger">删除</button>
+ </form>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ </div>
+ <?php endif; ?>
+ </div>
+ </div>
+</div>
+
+<!-- 添加/编辑模态框 -->
+<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-hidden="true">
+ <div class="modal-dialog modal-lg" role="document">
+ <div class="modal-content">
+ <form method="post">
+ <input type="hidden" name="act" value="save">
+ <input type="hidden" name="id" id="f-id" value="0">
+ <div class="modal-header">
+ <h5 class="modal-title" id="modalTitle">添加产品</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ </div>
+ <div class="modal-body">
+ <div class="form-group">
+ <label>产品名称</label>
+ <input type="text" class="form-control" name="name" id="f-name" required>
+ </div>
+ <div class="form-group">
+ <label>产品分类</label>
+ <select class="form-control" name="category" id="f-category">
+ <?php foreach ($categories as $k => $v): ?>
+ <option value="<?= htmlspecialchars($k, ENT_QUOTES) ?>"><?= htmlspecialchars($v) ?></option>
+ <?php endforeach; ?>
+ </select>
+ </div>
+ <div class="form-group">
+ <label>产品简介</label>
+ <textarea class="form-control" name="description" id="f-description" rows="3" required></textarea>
+ </div>
+ <div class="form-group">
+ <label>产品特性(每行一条)</label>
+ <textarea class="form-control" name="features" id="f-features" rows="4" placeholder="高性能架构设计,确保系统稳定运行 易于集成和部署,降低实施成本"></textarea>
+ </div>
+ <div class="form-group">
+ <label>展示图片(URL,可选)</label>
+ <input type="text" class="form-control" name="image" id="f-image" placeholder="https://example.com/image.png">
+ </div>
+ <div class="form-row">
+ <div class="col-6">
+ <div class="form-group">
+ <label>状态</label>
+ <select class="form-control" name="status" id="f-status">
+ <option value="active">上架</option>
+ <option value="inactive">下架</option>
+ </select>
+ </div>
+ </div>
+ <div class="col-6">
+ <div class="form-group">
+ <label>排序(小到大)</label>
+ <input type="number" class="form-control" name="sort" id="f-sort" value="50" min="0">
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
+ <button type="submit" class="btn btn-primary">保存</button>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+<script>
+var __siteProducts = <?= json_encode($products, JSON_UNESCAPED_UNICODE) ?>;
+<?php if (!empty($show_modal)): ?>
+var __siteForm = <?= json_encode($form, JSON_UNESCAPED_UNICODE) ?>;
+<?php endif; ?>
+function openEdit(id) {
+ var el = function (k) { return document.getElementById('f-' + k); };
+ document.getElementById('modalTitle').textContent = id ? '编辑产品' : '添加产品';
+ el('id').value = id;
+ if (id > 0) {
+ var p = __siteProducts.find(function (x) { return parseInt(x.id, 10) === parseInt(id, 10); });
+ if (p) {
+ el('name').value = p.name || '';
+ el('category').value = p.category || 'hosting';
+ el('description').value = p.description || '';
+ el('features').value = (p.features_list || []).join('\n');
+ el('image').value = p.image || '';
+ el('status').value = p.status || 'active';
+ el('sort').value = p.sort || 50;
+ }
+ } else {
+ el('name').value = '';
+ el('category').value = 'hosting';
+ el('description').value = '';
+ el('features').value = '';
+ el('image').value = '';
+ el('status').value = 'active';
+ el('sort').value = 50;
+ }
+ <?php if (!empty($show_modal)): ?>
+ // 提交失败回显:用服务端返回的表单数据覆盖字段
+ if (typeof __siteForm !== 'undefined') {
+ el('name').value = __siteForm.name || '';
+ el('category').value = __siteForm.category || 'hosting';
+ el('description').value = __siteForm.description || '';
+ el('features').value = (__siteForm.features || []).join('\n');
+ el('image').value = __siteForm.image || '';
+ el('status').value = __siteForm.status || 'active';
+ el('sort').value = __siteForm.sort || 50;
+ }
+ <?php endif; ?>
+ $('#editModal').modal('show');
+}
+<?php if (!empty($show_modal)): ?>
+ $(function () { openEdit(<?= (int)($form['id'] ?? 0) ?>); });
+<?php endif; ?>
+</script>
+<?php mnbt_admin_include('foot'); ?>
diff --git a/app_plugins/user_info/bootstrap.php b/app_plugins/user_info/bootstrap.php
index 3757cc3..7d0a845 100644
--- a/app_plugins/user_info/bootstrap.php
+++ b/app_plugins/user_info/bootstrap.php
@@ -63,6 +63,26 @@ mnbt_register_route('GET', '/account/password', function ($params, $ctx) {
* API 路由
* ============================================================ */
+// 获取当前用户信息(登录态探测 + 资料展示)
+mnbt_register_route('GET', '/account/api/me', function ($params, $ctx) {
+ $user = user_info_auth_current();
+ if (!$user) {
+ user_info_json('not_login', ['logged_in' => false]);
+ return;
+ }
+ user_info_json('ok', [
+ 'logged_in' => true,
+ 'user' => [
+ 'id' => (int)$user['id'],
+ 'username' => (string)$user['username'],
+ 'email' => (string)($user['email'] ?? ''),
+ 'qq' => (string)($user['qq'] ?? ''),
+ 'status' => (int)($user['status'] ?? 1),
+ 'created_at' => (string)($user['created_at'] ?? ''),
+ ],
+ ]);
+});
+
// 登录 API
mnbt_register_route('POST', '/account/api/login', function ($params, $ctx) {
global $DB;
diff --git a/docs/development/official-site/prd.md b/docs/development/official-site/prd.md
new file mode 100644
index 0000000..2a77a07
--- /dev/null
+++ b/docs/development/official-site/prd.md
@@ -0,0 +1,146 @@
+# PRD:MNBT 官网(guanwang1 移植)
+
+> 版本:0.1 日期:2026-08-10 状态:已批准(已实施 M1~M4)
+
+## 1. 背景与目标
+
+`D:\documents\GitHub\guanwang1` 是一个独立部署的科技企业官网前端(Vue 3 + Vite + lucide 图标),包含前台 7 个页面与一套内容管理后台(产品/新闻/留言 CRUD),数据依赖独立后端 API(项目内未含)。
+
+本任务将该官网"照搬"进 MNBT 的 tdesign home 主题(SPA),并按用户决策补齐 MNBT 缺失的能力:
+
+- 新增**官网内容管理插件**(产品、新闻、留言的数据表 + 前台 API + 管理后台 CRUD)
+- home 前台新增 **关于我们 / 产品中心 / 新闻资讯 / 联系我们** 页面,改造落地页(轮播、新闻预览、客户评价)
+- **保留 guanwang1 绿色视觉**(#42b983),内容适配 **MNBT 业务语境**(虚拟主机售卖平台)
+
+## 2. 用户决策记录
+
+| 问题 | 决策 |
+| --- | --- |
+| 数据支撑方案 | 为缺失功能**编写插件**实现(`official_site`) |
+| 后台归属 | **尽可能用插件实现**,并入 MNBT admin scope(插件菜单 + iframe 页面) |
+| 视觉风格 | **保留 guanwang1 绿色风格**(#42b983) |
+| 内容语义 | **适配为 MNBT 业务语境**(平台介绍/主机产品/公告新闻/客服渠道) |
+
+## 3. 范围
+
+### 3.1 前台(tdesign home SPA,绿色风格)
+
+| 页面 | 路由 | 数据来源 | 说明 |
+| --- | --- | --- | --- |
+| 落地页(改造) | `/` | boot + 插件 API | 现有售卖落地页基础上,新增轮播区、新闻预览区、客户评价区;整体切换绿色主题变量 |
+| 关于我们 | `/about` | 静态 + site config | 平台简介 / 使命愿景 / 核心团队(MNBT 语境) |
+| 产品中心 | `/site/products` | 插件 API | 产品卡片 + 分类筛选(全部/AI/云主机/域名/安全/服务) |
+| 产品详情 | `/site/products/:id` | 插件 API | 大图 + 特性列表 + 联系我们 CTA |
+| 新闻资讯 | `/site/news` | 插件 API | 列表分页 + 侧边栏(热门标签/热门文章/关于我们) |
+| 新闻详情 | `/site/news/:id` | 插件 API | 标题/时间/分类/浏览量 + 正文 |
+| 联系我们 | `/site/contact` | 静态 + POST API | 联系信息 + 留言表单(提交到插件) |
+
+> 现有售卖相关页面(`/shop*`、`/balance*`、`/login` 等)保留不动,仅视觉变量随主题切换为绿色。
+
+### 3.2 官网内容管理插件 `official_site`
+
+- **数据表**(3 张):
+ - `MN_plugin_site_product`(产品):id / name / category / description / features(JSON) / image / sort / status / created_at
+ - `MN_plugin_site_news`(新闻):id / title / category / content / views / sort / status / created_at
+ - `MN_plugin_site_message`(留言):id / name / email / phone / message / is_read / created_at
+- **前台 API**(P2 路由,`/site/api/*`,前缀在 home 入口的 routeBase 下):
+ - `GET /site/api/products`:产品列表(支持 `?category=` 筛选)
+ - `GET /site/api/products/{id}`:产品详情
+ - `GET /site/api/news`:新闻分页列表(支持 `?page=`、`?category=`)
+ - `GET /site/api/news/{id}`:新闻详情(views +1)
+ - `GET /site/api/news/popular`:热门文章(按浏览量)
+ - `POST /site/api/contact`:提交留言(校验 + 入库)
+- **管理后台**(`mnbt_register_page('admin', ...)` + 侧边栏菜单「官网内容」):
+ - 产品管理 `views/admin/products.php`:列表 + 添加/编辑/删除(模态框)
+ - 新闻管理 `views/admin/news.php`:列表 + 添加/编辑/删除
+ - 留言管理 `views/admin/messages.php`:列表 + 标记已读 + 删除
+- **能力探测**:`has_site`(`mnbt_plugin_enabled('official_site')`)注入 home boot;未启用时自动禁用前台官网页面与导航(复用 hasShop 机制)
+
+### 3.3 初始数据
+
+安装时自动写入示例数据(适配 MNBT 语境):
+- 产品:AI 智能分析平台 / 云服务器 / 虚拟主机 / 域名注册 / SSL 证书 / 安全防护(分类:ai / cloud / hosting / domain / security)
+- 新闻:产品发布 / 优惠活动 / 行业动态 / 平台公告 各 2 条(共 8 条)
+
+## 4. 视觉规范(绿色风格)
+
+- 主色 `#42b983`(guanwang1 原色),hover 加深 `#359c6d`
+- 结合 MNBT 用户偏好:浅色背景 + 圆角卡片(8-14px)+ 轻阴影,保留 guanwang1 的扁平留白节奏
+- home.scss 引入 `--hd-brand: #42b983` 等绿色变量(覆盖现有品牌蓝),各页 scoped 样式照搬 guanwang1 后圆角化
+- 页面 header:图片背景 + 居中标题(照搬 guanwang1 的 page-header)
+- 管理后台 PHP 页面:维持 MNBT 后台简洁风格(不强制绿色),保证后台统一性
+
+## 5. 技术方案
+
+### 5.1 插件结构(参照 hosting_shop)
+
+```
+app_plugins/official_site/
+├── bootstrap.php # 插件注册、路由、admin 页面/菜单注册、安装数据
+├── install.sql # 3 张表
+├── uninstall.sql
+├── plugin.json
+├── lib/site.php # 数据访问层(list/get/save/delete)
+└── views/admin/
+ ├── products.php # 产品管理(列表+模态框 CRUD)
+ ├── news.php # 新闻管理
+ └── messages.php # 留言管理
+```
+
+### 5.2 home SPA 新增
+
+```
+src/home/views/site/
+├── AboutView.vue # 关于我们
+├── products/ProductsView.vue / ProductDetailView.vue
+├── news/NewsView.vue / NewsDetailView.vue
+└── ContactView.vue # 联系我们
+```
+
+- `router/index.js` 新增路由,`meta.cap: 'site'` 挂能力守卫
+- `api/site.js`:封装 5 个 API(复用 `routeRequest`)
+- `utils/format.js` 增加日期格式化(`formatDate`)
+- `HomeLayout.vue` 导航新增:关于我们 / 产品中心 / 新闻资讯 / 联系我们(`v-if="boot.hasSite"`)
+- `LandingView.vue` 改造:轮播 hero + 特性 + 新闻预览(插件 API)+ 客户评价 + 套餐区 + CTA
+- 背景图:`bg1/bg2/bg3.jpg` 从 guanwang1 复制到 home 静态资源(或使用主题背景图占位)
+
+### 5.3 能力禁用
+
+沿用已有机制(已实施):
+- `MPHX/frontend.php` `mnbt_home_data()` 增加 `'has_site' => function_exists('mnbt_plugin_enabled') && mnbt_plugin_enabled('official_site')`
+- `templates/tdesign/home/index.php` boot 数组注入 `'hasSite' => !empty($has_site)`(JS 端为 `boot.hasSite`)
+- home 路由守卫 `meta.cap: 'site'`:`boot.hasSite === false` 时 redirect 到首页
+- `HomeLayout.vue` 导航、`LandingView.vue` 新闻预览区均 `v-if="boot.hasSite"`
+
+## 6. 路由映射(guanwang1 → MNBT home)
+
+| guanwang1 | MNBT home |
+| --- | --- |
+| `/`(Home) | `/`(LandingView 改造) |
+| `/about` | `/about` |
+| `/products`、`/products/:id` | `/site/products`、`/site/products/:id` |
+| `/news`、`/news/:id` | `/site/news`、`/site/news/:id` |
+| `/contact` | `/site/contact` |
+| `/admin/*` | 并入 admin scope:插件菜单「官网内容」(iframe 加载 plugin.php) |
+
+## 7. 验收标准
+
+1. 启用 `official_site` 插件后,home 前台出现 4 个新导航,所有页面可访问、数据来自插件 API
+2. 留言表单提交成功入库,后台留言管理可见
+3. 后台可对产品/新闻增删改查,前台实时反映
+4. 停用插件后,官网页面/导航自动消失(hasSite 机制),不产生报错
+5. 全部页面为绿色风格(#42b983),与售卖区、账户区视觉统一
+6. `npm run build:home` 构建通过;插件无 PHP 语法错误
+
+## 8. 里程碑
+
+- M1:插件 `official_site`(表 + lib + admin CRUD 页面 + 前台 API + 初始数据)
+- M2:home SPA 新增 4 页面 + api 封装 + 路由/守卫 + 导航
+- M3:落地页改造(轮播/新闻预览/客户评价)+ 绿色变量切换
+- M4:构建验证 + 插件安装/停用验证 + 文档同步
+
+## 9. 风险与注意
+
+- 插件 admin PHP 页面在 iframe 中渲染,需自包含 HTML(参照 hosting_shop 写法)
+- guanwang1 使用 lucide 图标,home 使用 MDI(mdi-*)图标体系,移植时全部替换为 MDI
+- 绿色变量需同时覆盖 TDesign 主题色(`--td-brand` 由 boot.sitePrimary 控制,home 端按绿色注入)
diff --git a/docs/development/theme/home.md b/docs/development/theme/home.md
index 27e9ddd..8b8f16f 100644
--- a/docs/development/theme/home.md
+++ b/docs/development/theme/home.md
@@ -15,6 +15,11 @@ description: "主页主题(scope: home)开发说明:新建主题、自定义
- 内容配置:后台「前端模板」→ 主页内容(标题、Hero、主色、Logo 等通用设置)
- 自定义设置:主题通过 `theme.php` 声明字段,后台自动渲染并持久化
+> **tdesign 主题已支持 home scope**(v0.3.0):其主页为独立 SPA 售卖前端,
+> 通过插件 API 路由(`/index.php?_r=/shop/api/*` 等)驱动 `user_info` / `balance` / `hosting_shop` 页面,
+> 另含官网内容页面(关于我们/产品/新闻/联系我们,由 `official_site` 插件 `GET /site/api/*` 驱动,
+> `boot.hasSite` 能力字段控制导航与路由可见性),详见 [TDesign 三端主题](./tdesign.md) 与 [与 PHP 的对接](./tdesign-php.md#主页入口映射home-scope)。
+
## 15.2 新建主页主题
**目录结构**:
@@ -166,6 +171,8 @@ $footerMsg = function_exists('mnbt_home_theme_setting') ? mnbt_home_theme_settin
| `MPHX/theme.php` | `home` scope 注册(`mnbt_theme_name/list/set_active`) |
| `index.php` | 请求分发入口(`mnbt_home_dispatch` 调用点) |
| `templates/default/home/index.php` | 内置默认主页模板 |
+| `templates/tdesign/home/index.php` | tdesign 主页入口(加载 home SPA,注入 `__TD_BOOT__`) |
+| `templates/tdesign/spa/src/home/` | tdesign home SPA 源码(路由/API/视图/样式) |
| `templates/default/admin/set.php` | default 后台渲染器(`gn=theme`) |
| `templates/tdesign/spa/src/admin/views/settings/ThemeView.vue` | tdesign 后台渲染器 |
| `templates/tdesign/admin/_spa_boot.php` | tdesign boot 数据注入 |
diff --git a/docs/development/theme/tdesign-php.md b/docs/development/theme/tdesign-php.md
index 98e5505..05b9112 100644
--- a/docs/development/theme/tdesign-php.md
+++ b/docs/development/theme/tdesign-php.md
@@ -1,11 +1,11 @@
---
title: 与 PHP 的对接
-description: tdesign 主题与 PHP 的对接:双端入口映射、__TD_BOOT__ 启动数据、AJAX gn 列表与插件菜单
+description: tdesign 主题与 PHP 的对接:三端入口映射、__TD_BOOT__ 启动数据、AJAX gn 列表、插件菜单与主页 API 路由
---
# 与 PHP 的对接(tdesign)
-本文是 [TDesign 双端主题](./tdesign.md) 的对接细节:管理端 / 用户端入口映射、`window.__TD_BOOT__` 启动数据、AJAX 调用与插件菜单渲染。
+本文是 [TDesign 三端主题](./tdesign.md) 的对接细节:管理端 / 用户端 / 主页入口映射、`window.__TD_BOOT__` 启动数据、AJAX 调用与插件菜单渲染。
## 管理端入口映射
@@ -63,6 +63,53 @@ description: tdesign 主题与 PHP 的对接:双端入口映射、__TD_BOOT__
| `/user/ftp.php` | `#/ftp`(iframe 嵌入默认主题) |
| `/user/plugin.php?p=xxx&page=yyy` | `#/plugin?p=xxx&page=yyy`(iframe 在 layout 内加载) |
+## 主页入口映射(home scope)
+
+主页由 `MPHX/frontend.php` 的 `mnbt_home_dispatch()` 分发,站点根路径 `/` 渲染 `templates/tdesign/home/index.php`。
+该文件加载 home SPA 构建产物,全部页面走 Hash 路由,数据由插件 API 路由(`/index.php?_r=...`)提供:
+
+| 访问 | SPA 路由 | 说明 |
+|------|----------|------|
+| `/` | `#/` | 落地页(Hero + 公告 + 套餐卡 + 特性) |
+| `/index.php?_r=/account/login` | `#/login` | 登录 |
+| `/index.php?_r=/account/register` | `#/register` | 注册 |
+| `/`(SPA 内跳转) | `#/profile` | 个人信息 |
+| `/`(SPA 内跳转) | `#/password` | 修改密码 |
+| `/`(SPA 内跳转) | `#/shop` | 主机套餐 |
+| `/`(SPA 内跳转) | `#/shop/order/:planId` | 购买套餐 |
+| `/`(SPA 内跳转) | `#/shop/assets` | 我的主机 |
+| `/`(SPA 内跳转) | `#/shop/orders` | 我的订单 |
+| `/`(SPA 内跳转) | `#/balance` | 我的余额 |
+| `/`(SPA 内跳转) | `#/balance/recharge` | 余额充值 |
+
+### 主页插件 API 路由
+
+SPA 的 `home/api/http.js` 以 `routeRequest` 封装请求 `{routeBase} + path`,
+`routeBase` = `mnbt_home_base() . '/index.php?_r='`,由 `home/index.php` 注入 `__TD_BOOT__.routeBase`。
+请求自动附带 CSRF token(`X-CSRF-Token` 头 + `MNBT_CSRF_TOKEN` cookie),解析 `{code: 'ok', ...}` 格式。
+
+依赖三个插件(未启用时 `__TD_BOOT__.hasShop` / `hasUser` 为 false,菜单隐藏):
+
+| 插件 | API 路由 | 说明 |
+|------|----------|------|
+| user_info | `GET /account/api/me` | 当前用户信息(未登录返回 `code: 'not_login'`) |
+| user_info | `POST /account/api/login` | 登录(用户名/密码/验证码) |
+| user_info | `POST /account/api/register` | 注册 |
+| user_info | `POST /account/api/update_profile` | 更新个人信息 |
+| user_info | `POST /account/api/change_password` | 修改密码 |
+| balance | `GET /balance/api/info` | 余额 + 流水分页(`balance_cents` / `balance_yuan` / `logs`) |
+| balance | `GET /balance/api/methods` | 可用支付方式(排除 balance 自身) |
+| balance | `POST /balance/api/create_recharge` | 创建充值订单,返回支付 HTML |
+| hosting_shop | `GET /shop/api/plans` | 上架套餐列表(含 `periods` / `prices`) |
+| hosting_shop | `GET /shop/api/plan/{plan_id}` | 套餐详情 + 支付方式 |
+| hosting_shop | `GET /shop/api/assets` | 用户资产列表 |
+| hosting_shop | `GET /shop/api/orders` | 用户订单分页 |
+| hosting_shop | `GET /shop/api/methods` | 支付方式列表 |
+| hosting_shop | `POST /shop/api/create_order` | 创建购买订单,返回支付 HTML |
+
+支付流程:下单/充值 → 创建 `MN_dd` 订单 → `mnbt_pay_dispatch_gateway()` 返回支付 HTML,
+前端用 `document.open() / document.write() / document.close()` 整页跳转支付网关,回跳由支付插件负责。
+
## 启动数据 `window.__TD_BOOT__`
由 `_spa_boot.php` 注入,字段如下:
@@ -72,7 +119,7 @@ description: tdesign 主题与 PHP 的对接:双端入口映射、__TD_BOOT__
siteName, footer, user, adminUser, loggedIn, needCaptcha,
ajaxBase: './ajax.php', codeUrl: './code.php',
logo, logoHead, logoIndex, auther,
- theme: 'tdesign', version: '0.2.0',
+ theme: 'tdesign', version: '0.3.0',
entry, hash, // 当前 SPA 入口与目标 hash
pluginMenuHtml, // 主题渲染器输出的插件菜单 HTML
conf, // 站点配置(全部 $conf)
@@ -85,6 +132,26 @@ description: tdesign 主题与 PHP 的对接:双端入口映射、__TD_BOOT__
视图可在 `include '_spa_boot.php'` 前设置 `$td_inject` 数组,把页面级数据合并进 boot。
+### 主页 boot(home scope)
+
+由 `home/index.php` 直接注入(不走 `_spa_boot.php`),字段:
+
+```js
+{
+ siteTitle, siteLogo, sitePrimary, siteHero, siteFooter, favicon,
+ notice, showNotice, showPlans,
+ loggedIn, hasShop, hasUser, // 插件启用探测(frontend.php 注入)
+ plans, blocks, // 落地页套餐卡与插件扩展区块
+ base, conf, // 站点基址与配置
+ theme: 'tdesign', version: '0.3.0', entry: 'landing',
+ routeBase, // API 请求基址 = base + '/index.php?_r='
+ coreBase // 核心文件入口(user/、admin/ 等)
+}
+```
+
+`loggedIn` / `hasShop` / `hasUser` 来自 `MPHX/frontend.php` 的 `mnbt_home_data()`,
+仅作菜单显隐的初始值,真实登录态由 SPA 启动时 `GET /account/api/me` 重新探测。
+
## AJAX
仍请求 **`./ajax.php`**,`gn` 与官方一致。
diff --git a/docs/development/theme/tdesign.md b/docs/development/theme/tdesign.md
index 8331cc7..7a26706 100644
--- a/docs/development/theme/tdesign.md
+++ b/docs/development/theme/tdesign.md
@@ -1,11 +1,11 @@
---
-title: TDesign 双端主题
+title: TDesign 三端主题
description: tdesign 主题说明:特性、目录结构、编译、启用、设计规范、开发约定、已知限制与版本
---
-# TDesign 双端主题(tdesign)v0.2.0
+# TDesign 三端主题(tdesign)v0.3.0
-现代化 **双端** 主题:基于 TDesign 品牌蓝,覆盖**用户端 + 管理端**全部页面。卡片化布局、侧栏 + 顶栏、echarts 数据可视化、左侧背景图登录页。
+现代化 **三端** 主题:基于 TDesign 品牌蓝,覆盖**用户端 + 管理端 + 主页售卖**全部页面。卡片化布局、侧栏 + 顶栏、echarts 数据可视化、左侧背景图登录页、独立主页售卖前端。
技术栈:**Vue 3 + Vue Router (Hash) + TDesign Vue Next + Vite + ECharts**。
@@ -50,13 +50,26 @@ description: tdesign 主题说明:特性、目录结构、编译、启用、设
| 插件页面 | 通过 SPA 路由 + iframe 在 layout 内加载 |
| 路由 | Hash 模式,不改 PHP 控制器 URL |
+### 主页(home scope)
+
+完整售卖系统前端,通过**插件 API 路由**(`index.php?_r=/xxx/api/xxx`)驱动,不依赖 iframe。依赖 `user_info`(认证)、`balance`(余额)、`hosting_shop`(商店)插件;`official_site`(官网内容)插件可选,启用后展示官网页面。
+
+| 模块 | 说明 |
+|------|------|
+| 落地页 | Hero + 公告 + 套餐卡 + 特性区块(数据来自 `mnbt_home_data()` 注入的 `$plans` / `$blocks`) + 轮播 hero + 新闻预览 + 客户评价(绿色风格) |
+| 账户 | 登录 / 注册 / 个人信息 / 修改密码(`user_info` 插件 `GET /account/api/*`) |
+| 商店 | 套餐列表 / 下单(选周期 + 支付方式,支付 HTML 用 `document.write` 跳转) / 我的主机 / 我的订单(`hosting_shop` 插件 `GET /shop/api/*`) |
+| 余额 | 余额卡 + 流水表格 / 充值(`balance` 插件 `GET /balance/api/*`) |
+| 官网内容 | 关于我们 / 产品中心(列表+详情) / 新闻资讯(列表+详情) / 联系我们(留言表单)(`official_site` 插件 `GET /site/api/*`、`POST /site/api/contact`,`meta.cap: 'site'` 能力守卫) |
+| 登录态 | `auth.js` store 启动时探测 `/account/api/me`,路由守卫统一拦截,未登录访问受保护页自动跳登录 |
+
---
## 目录结构
```
templates/tdesign/
-├── theme.json # 主题元信息(scope: ["user", "admin"])
+├── theme.json # 主题元信息(scope: ["user", "admin", "home"])
├── theme.php # 注册双端菜单渲染器(插件菜单 → 侧栏 HTML)
├── README.md # 本说明(已迁移至 docs/development/theme/tdesign.md)
├── PLAN_USER_SCOPE.md # 双端改造计划文档(已迁移至 ../plan/tdesign-user-scope.md)
@@ -98,18 +111,35 @@ templates/tdesign/
│ ├── index.css
│ └── login-bg.webp
│
+├── home/ # 主页 PHP 主题入口(home scope)
+│ ├── index.php # 落地页入口,注入 __TD_BOOT__ + 加载 dist(未构建时给出提示)
+│ └── dist/ # ★ Vite 构建产物(需提交,勿 gitignore)
+│ ├── home.html
+│ └── assets/
+│ ├── index.js
+│ └── index.css
+│
└── spa/ # SPA 源码(开发用,按端分层)
- ├── package.json # 双入口构建脚本(build:admin / build:user)
+ ├── package.json # 构建脚本(build:admin / build:user / build:docker / build:home)
├── vite.admin.config.js # 管理端 Vite 配置
├── vite.user.config.js # 用户端 Vite 配置
+ ├── vite.docker.config.js # Docker 控制台 Vite 配置
+ ├── vite.home.config.js # 主页 Vite 配置
├── admin.html # 管理端 HTML 模板
├── user.html # 用户端 HTML 模板
+ ├── docker.html # Docker 控制台 HTML 模板
+ ├── home.html # 主页 HTML 模板
+ ├── public/ # 静态资源(验证码图等,构建时复制进 dist)
├── .gitignore # 仅忽略 node_modules 等,不忽略 dist
└── src/
├── App-admin.vue # 管理端根组件
├── App-user.vue # 用户端根组件
+ ├── App-docker.vue # Docker 控制台根组件
+ ├── App-home.vue # 主页根组件
├── main-admin.js # 管理端入口
├── main-user.js # 用户端入口
+ ├── main-docker.js # Docker 控制台入口
+ ├── main-home.js # 主页入口
│
├── admin/ # 管理端代码(全部集中于此)
│ ├── api/ # 13 个 API 文件(auth/baota/dashboard/host/...)
@@ -117,6 +147,7 @@ templates/tdesign/
│ ├── router/index.js
│ └── views/ # 按业务模块分目录
│ ├── baota/ # 宝塔(List/Add)
+ │ ├── docker/ # Docker(节点/套餐/用户)
│ ├── host/ # 主机(List/Add)
│ ├── node/ # 节点(List/Scan)
│ ├── program/ # 程序(List/Add/Import)
@@ -142,7 +173,27 @@ templates/tdesign/
│ ├── deploy/ # 一键部署
│ └── *.vue # 顶层 view(Login/Notice/Plugin)
│
- └── shared/ # 双端共用代码
+ ├── docker/ # Docker 控制台代码
+ │ ├── api/docker.js # Docker API 封装(CSRF + 登录态自动跳转)
+ │ ├── components/ # SliderCaptcha 滑块验证码
+ │ ├── layouts/DockerLayout.vue
+ │ ├── router/index.js
+ │ └── views/ # Console/Login/AppStore/Image/Volume/Compose/Proxy
+ │
+ ├── home/ # 主页售卖端代码(home scope)
+ │ ├── api/ # http.js(routeRequest+CSRF) / account / balance / shop
+ │ ├── layouts/HomeLayout.vue
+ │ ├── router/index.js # 路由 + 登录态守卫(initAuth 探测 /account/api/me)
+ │ ├── store/auth.js # 响应式登录态 store
+ │ ├── styles/home.scss
+ │ ├── utils/format.js # periodLabels/centsToYuan/orderStatusMap/...
+ │ └── views/ # 按业务模块分目录
+ │ ├── auth/ # 登录/注册/个人信息/修改密码
+ │ ├── shop/ # 套餐列表/下单/我的主机/我的订单
+ │ ├── balance/ # 余额/充值
+ │ └── LandingView.vue # 落地页
+ │
+ └── shared/ # 各端共用代码
├── api/http.js # apiGn/postGn/parseResult 统一请求封装
├── utils/echarts.js # echarts 按需引入(Gauge/Bar/Line + 组件)
├── assets/login-bg.webp # 登录页背景图
@@ -173,9 +224,15 @@ npm run dev:admin
# 用户端开发服务器
npm run dev:user
+
+# Docker 控制台开发服务器
+npm run dev:docker
+
+# 主页开发服务器(端口 5177)
+npm run dev:home
```
-开发配置见 `vite.admin.config.js` / `vite.user.config.js` 的 `server.proxy`。
+开发配置见各 `vite.*.config.js` 的 `server.proxy`。
开发模式 HTML 内置最小 `window.__TD_BOOT__`,可在无 PHP 环境下预览 UI。
### 生产构建
@@ -186,8 +243,10 @@ cd templates/tdesign/spa
# 单独构建
npm run build:admin # 输出到 ../admin/dist/
npm run build:user # 输出到 ../user/dist/
+npm run build:docker # 输出到 ../docker/dist/
+npm run build:home # 输出到 ../home/dist/
-# 双端一起构建
+# 四端一起构建
npm run build
```
@@ -197,11 +256,13 @@ npm run build
|----|----------|------|---------|
| 管理端 | `templates/tdesign/admin/dist/` | `admin.html` | `assets/index.js` |
| 用户端 | `templates/tdesign/user/dist/` | `user.html` | `assets/index.js` |
+| Docker 控制台 | `templates/tdesign/docker/dist/` | `docker.html` | `assets/index.js` |
+| 主页 | `templates/tdesign/home/dist/` | `home.html` | `assets/index.js` |
PHP 入口通过 `mnbt_theme_url('dist/assets/index.js')` 加载。
-**请将 `admin/dist` 和 `user/dist` 一并提交/部署**,服务器无需安装 Node 即可运行主题。
+**请将各端 `dist` 一并提交/部署**,服务器无需安装 Node 即可运行主题。
-构建配置要点(双端一致):
+构建配置要点(各端一致):
- `base: './'` —— 相对路径,适配 PHP 子目录部署
- `inlineDynamicImports: true` —— 打成单 JS 包,避免动态 chunk 相对路径错位
@@ -211,23 +272,24 @@ PHP 入口通过 `mnbt_theme_url('dist/assets/index.js')` 加载。
### 未构建时
-打开管理后台/用户端会显示「TDesign 主题尚未构建」提示与编译命令。
+打开管理后台/用户端/主页会显示「TDesign 主题尚未构建」提示与编译命令。
---
## 启用主题
-1. 确保已 `npm run build` 且存在 `admin/dist/assets/index.js` 和 `user/dist/assets/index.js`
+1. 确保已 `npm run build` 且存在各端 `dist/assets/index.js`(`admin` / `user` / `home`)
2. 管理后台 → **系统管理** → **前端模板**
-3. **管理端主题** 选择 **TDesign 双端主题** → 保存
-4. **用户端主题** 选择 **TDesign 双端主题** → 保存
- 或写入文件:`templates/active_admin_theme` 和 `templates/active_user_theme` 内容均为 `tdesign`
+3. **管理端主题** 选择 **TDesign 三端主题** → 保存
+4. **用户端主题** 选择 **TDesign 三端主题** → 保存
+5. **主页主题** 选择 **TDesign 三端主题** → 保存
+ 或写入文件:`templates/active_admin_theme` / `templates/active_user_theme` / `templates/active_home_theme` 内容均为 `tdesign`
---
## 与 PHP 的对接
-管理端 / 用户端入口映射、`__TD_BOOT__` 启动数据、AJAX gn 列表、插件菜单对接等,见 [与 PHP 的对接(tdesign-php.md)](./tdesign-php.md)。
+管理端 / 用户端入口映射、`__TD_BOOT__` 启动数据、AJAX gn 列表、插件菜单对接、主页 API 路由等,见 [与 PHP 的对接(tdesign-php.md)](./tdesign-php.md)。
---
@@ -271,21 +333,23 @@ CSS 变量定义在 `spa/src/shared/styles/theme.scss` 顶部 `:root`,修改后
## 开发约定
-1. **不要改** `admin/*.php` / `user/*.php` 控制器与 `ajax.php` 接口路径
+1. **不要改** `admin/*.php` / `user/*.php` / `home/*.php` 控制器与 `ajax.php` 接口路径
2. 新增纯前端页面:
- 管理端:`src/admin/views/` 添加 `.vue` + `src/admin/router/index.js` 注册路由
- 用户端:`src/user/views/` 添加 `.vue` + `src/user/router/index.js` 注册路由
+ - 主页:`src/home/views/` 添加 `.vue` + `src/home/router/index.js` 注册路由(需登录页加 `meta.auth`、访客页加 `meta.guest`)
3. import 路径统一使用 `@` alias:
- 管理端:`@/admin/api/xxx`、`@/admin/views/xxx`
- 用户端:`@/user/api/xxx`、`@/user/views/xxx`
+ - 主页:`@/home/api/xxx`、`@/home/views/xxx`、`@/home/store/auth`
- 共用:`@/shared/api/http`、`@/shared/utils/echarts`、`@/shared/styles/theme.scss`
4. 列表页统一服务端分页,前端只做查询条件与渲染
5. 表单/表格统一使用 `.td-form` / `.td-table-wrap` / `.td-toolbar` 等通用类,避免重复样式
6. 表格工具条 `.td-toolbar` 使用 `padding: 12px 16px` 确保与边框间距
7. `t-dialog` 组件必须使用 `v-model:visible` 而非 `v-model`(避免 Vue modelValue 错误)
-8. `spa/.gitignore` 忽略 `node_modules`,**不忽略** `admin/dist` 和 `user/dist`
+8. `spa/.gitignore` 忽略 `node_modules`,**不忽略** 各端 `dist`
9. 版本号同步:`theme.json` 与 `spa/package.json`
-10. 修改源码后必须 `npm run build:admin` / `npm run build:user`,否则线上不会生效
+10. 修改源码后必须重新构建对应端(`npm run build:admin` / `build:user` / `build:docker` / `build:home`),否则线上不会生效
---
@@ -293,11 +357,13 @@ CSS 变量定义在 `spa/src/shared/styles/theme.scss` 顶部 `:root`,修改后
- 文件管理页面(ftp)采用 iframe 嵌入默认主题 ftp.php(复用成熟的文件管理 UI,避免重写复杂组件)
- 插件自带页面仍由插件自行渲染,主题仅提供菜单入口与 iframe 容器
+- 主页售卖端依赖 `user_info` / `balance` / `hosting_shop` 三个插件;官网页面依赖 `official_site` 插件(`boot.hasSite` 为 false 时导航与页面自动隐藏)
- 部分旧接口字段因版本差异可能需在 `parseResult` 或视图层做兼容调整
---
## 版本
+- **0.3.0** 主页售卖端:新增 home scope(落地页/登录注册/个人信息/商店/下单/我的主机/订单/余额/充值),插件 API 路由(`index.php?_r=`)驱动 + 独立 Vite 入口(`build:home`),登录态由 `auth.js` store 统一探测
- **0.2.0** 双端主题:用户端全部页面原生化(仪表盘/设置/文件管理/SQL备份/监控/统计/部署/插件) + 按端分层目录重构(admin/user/shared) + 左侧背景图登录页 + echarts gauge 仪表盘 + 快捷操作平铺按钮 + 插件页面 iframe 内嵌
- **0.1.0** 首版:SPA 壳 + 登录 + 全部后台页面原生化(仪表盘 / 设置 / 主机 / 宝塔 / 节点 / 程序 / 订单 / 日志 / 插件 / 支付 / 主题切换 / 教程 / 更新 / 修复)
diff --git a/templates/tdesign/admin/_spa_boot.php b/templates/tdesign/admin/_spa_boot.php
index 36957f2..e09bbf5 100644
--- a/templates/tdesign/admin/_spa_boot.php
+++ b/templates/tdesign/admin/_spa_boot.php
@@ -25,7 +25,7 @@ $boot = [
'logoIndex' => mnbt_asset_url('admin_logo/logo.index.png'),
'auther' => $conf['auther'] ?? '',
'theme' => 'tdesign',
- 'version' => '0.2.0',
+ 'version' => '0.3.0',
'entry' => $td_entry ?? 'dashboard',
'hash' => $td_hash ?? '',
'pluginMenuHtml' => '',
diff --git a/templates/tdesign/home/index.php b/templates/tdesign/home/index.php
new file mode 100644
index 0000000..5fee2e8
--- /dev/null
+++ b/templates/tdesign/home/index.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * TDesign 主页主题(home scope)落地页入口
+ *
+ * 由 MPHX/frontend.php 的 mnbt_home_render() 渲染,注入 mnbt_home_data() 变量:
+ * $site_title / $site_logo / $site_primary / $site_hero / $site_footer / $favicon
+ * $notice / $show_notice / $show_plans / $logged_in / $has_shop / $has_user / $has_site
+ * $plans(套餐卡)/ $blocks(插件扩展区块)
+ * $url($path) 路由 URL / $coreUrl($path) 核心文件 URL
+ *
+ * 本入口加载 home SPA 构建产物(templates/tdesign/home/dist/),
+ * 售卖系统全部页面(商店/订单/资产/余额/账户)由 SPA 通过 API 渲染。
+ */
+if (!defined('IN_CRONLITE')) { exit('Access Denied'); }
+
+$td_dist = __DIR__ . '/dist';
+$td_js = $td_dist . '/assets/index.js';
+$td_css = $td_dist . '/assets/index.css';
+$td_ver = is_file($td_js) ? (string)@filemtime($td_js) : (string)time();
+
+$boot = [
+ 'siteTitle' => $site_title ?? 'MNBT',
+ 'siteLogo' => $site_logo ?? '',
+ 'sitePrimary' => $site_primary ?? '#4f46e5',
+ 'siteHero' => $site_hero ?? '',
+ 'siteFooter' => $site_footer ?? '',
+ 'beianInfo' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('beian_info', '') : ''),
+ 'policeBeian' => (function_exists('mnbt_home_theme_setting') ? (string)mnbt_home_theme_setting('ps_beian', '') : ''),
+ 'favicon' => $favicon ?? '',
+ 'notice' => $notice ?? '',
+ 'showNotice' => !empty($show_notice),
+ 'showPlans' => !empty($show_plans),
+ 'loggedIn' => !empty($logged_in),
+ 'hasShop' => !empty($has_shop),
+ 'hasBalance' => !empty($has_balance),
+ 'hasUser' => !empty($has_user),
+ 'hasSite' => !empty($has_site),
+ 'plans' => $plans ?? [],
+ 'blocks' => $blocks ?? [],
+ 'base' => function_exists('mnbt_home_base') ? mnbt_home_base() : '',
+ 'conf' => $conf ?? [],
+ 'theme' => 'tdesign',
+ 'version' => '0.3.0',
+ 'entry' => 'landing',
+];
+
+// SPA 需要访问的 API 入口(index.php?_r=/xxx/api/xxx)
+$boot['routeBase'] = (function_exists('mnbt_home_base') ? mnbt_home_base() : '') . '/index.php?_r=';
+// 核心文件入口(如 user/、admin/)
+$boot['coreBase'] = function_exists('mnbt_home_core_url') ? mnbt_home_core_url('') : '/';
+?>
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
+<title><?= htmlspecialchars($site_title ?? 'MNBT', ENT_QUOTES, 'UTF-8') ?></title>
+<?php if (!empty($favicon)): ?><link rel="icon" href="<?= htmlspecialchars($favicon, ENT_QUOTES, 'UTF-8') ?>" /><?php endif; ?>
+<link rel="stylesheet" href="<?= htmlspecialchars(mnbt_asset_url('css/materialdesignicons.min.css'), ENT_QUOTES, 'UTF-8') ?>" />
+<?php if (is_file($td_css)): ?>
+<link rel="stylesheet" href="<?= htmlspecialchars(mnbt_theme_url('dist/assets/index.css', 'home'), ENT_QUOTES, 'UTF-8') ?>?v=<?= $td_ver ?>" />
+<?php endif; ?>
+<style>
+ html, body, #app { margin: 0; padding: 0; min-height: 100%; }
+ .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; }
+ .td-boot-missing h2 { margin: 0 0 12px; font-size: 18px; color: #d54941; }
+ .td-boot-missing code { background: #f3f3f3; padding: 2px 8px; border-radius: 4px; font-size: 13px; }
+ .td-boot-missing p { margin: 10px 0; line-height: 1.7; font-size: 14px; }
+</style>
+</head>
+<body>
+<div id="app">
+<?php if (!is_file($td_js)): ?>
+ <div class="td-boot-missing">
+ <h2>TDesign 主页主题尚未构建</h2>
+ <p>请在服务器或本机执行:</p>
+ <p><code>cd templates/tdesign/spa && npm install && npm run build:home</code></p>
+ <p>构建产物应位于 <code>templates/tdesign/home/dist/</code></p>
+ </div>
+<?php endif; ?>
+</div>
+<script>
+window.__TD_BOOT__ = <?= json_encode($boot, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?>;
+</script>
+<?php if (is_file($td_js)): ?>
+<script type="module" src="<?= htmlspecialchars(mnbt_theme_url('dist/assets/index.js', 'home'), ENT_QUOTES, 'UTF-8') ?>?v=<?= $td_ver ?>"></script>
+<?php endif; ?>
+</body>
+</html>
diff --git a/templates/tdesign/spa/admin.html b/templates/tdesign/spa/admin.html
index d3130f3..f1502f9 100644
--- a/templates/tdesign/spa/admin.html
+++ b/templates/tdesign/spa/admin.html
@@ -22,7 +22,7 @@
logoIndex: '/imsetes/admin_logo/logo.index.png',
auther: '',
theme: 'tdesign',
- version: '0.2.0',
+ version: '0.3.0',
entry: 'dashboard',
hash: '#/dashboard',
pluginMenuHtml: '',
diff --git a/templates/tdesign/spa/home.html b/templates/tdesign/spa/home.html
new file mode 100644
index 0000000..61f49ec
--- /dev/null
+++ b/templates/tdesign/spa/home.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>MNBT · 开发模式</title>
+ </head>
+ <body>
+ <div id="app"></div>
+ <script>
+ // 开发模式注入最小 boot,真实字段由 PHP 入口注入
+ window.__TD_BOOT__ = {
+ siteTitle: 'MNBT(开发)',
+ sitePrimary: '#4f46e5',
+ siteHero: '高性能虚拟主机,即买即用',
+ siteFooter: '',
+ hasShop: true,
+ hasBalance: true,
+ hasUser: true,
+ hasSite: true,
+ loggedIn: false,
+ theme: 'tdesign',
+ version: '0.3.0',
+ entry: 'landing',
+ routeBase: '/index.php?_r=',
+ coreBase: '/',
+ plans: [],
+ }
+ </script>
+ <script type="module" src="/src/main-home.js"></script>
+ </body>
+</html>
diff --git a/templates/tdesign/spa/package-lock.json b/templates/tdesign/spa/package-lock.json
index 1d02b37..e32c5b4 100644
--- a/templates/tdesign/spa/package-lock.json
+++ b/templates/tdesign/spa/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "mnbt-tdesign",
- "version": "0.2.0",
+ "version": "0.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mnbt-tdesign",
- "version": "0.2.0",
+ "version": "0.3.0",
"dependencies": {
"axios": "^1.7.9",
"echarts": "^6.1.0",
diff --git a/templates/tdesign/spa/package.json b/templates/tdesign/spa/package.json
index 5a9c569..295783d 100644
--- a/templates/tdesign/spa/package.json
+++ b/templates/tdesign/spa/package.json
@@ -1,6 +1,6 @@
{
"name": "mnbt-tdesign",
- "version": "0.2.0",
+ "version": "0.3.0",
"private": true,
"type": "module",
"scripts": {
@@ -10,7 +10,8 @@
"build:admin": "vite build --config vite.admin.config.js",
"build:user": "vite build --config vite.user.config.js",
"build:docker": "vite build --config vite.docker.config.js",
- "build": "npm run build:admin && npm run build:user && npm run build:docker",
+ "build:home": "vite build --config vite.home.config.js",
+ "build": "npm run build:admin && npm run build:user && npm run build:docker && npm run build:home",
"preview": "vite preview"
},
"dependencies": {
diff --git a/templates/tdesign/spa/src/App-home.vue b/templates/tdesign/spa/src/App-home.vue
new file mode 100644
index 0000000..d372e96
--- /dev/null
+++ b/templates/tdesign/spa/src/App-home.vue
@@ -0,0 +1,6 @@
+<template>
+ <router-view />
+</template>
+
+<script setup>
+</script>
diff --git a/templates/tdesign/spa/src/home/api/account.js b/templates/tdesign/spa/src/home/api/account.js
new file mode 100644
index 0000000..92d4015
--- /dev/null
+++ b/templates/tdesign/spa/src/home/api/account.js
@@ -0,0 +1,31 @@
+import { apiGet, apiPost } from './http'
+
+/**
+ * user_info 插件 API(账户系统)
+ * 依赖插件启用:user_info
+ */
+
+/** 获取当前登录用户(未登录 code=not_login) */
+export function getMe() {
+ return apiGet('/account/api/me')
+}
+
+/** 登录 */
+export function login(username, password) {
+ return apiPost('/account/api/login', { username, password })
+}
+
+/** 注册 */
+export function register(payload) {
+ return apiPost('/account/api/register', payload)
+}
+
+/** 更新个人信息 */
+export function updateProfile(email, qq) {
+ return apiPost('/account/api/update_profile', { email, qq })
+}
+
+/** 修改密码 */
+export function changePassword(payload) {
+ return apiPost('/account/api/change_password', payload)
+}
diff --git a/templates/tdesign/spa/src/home/api/balance.js b/templates/tdesign/spa/src/home/api/balance.js
new file mode 100644
index 0000000..45921f8
--- /dev/null
+++ b/templates/tdesign/spa/src/home/api/balance.js
@@ -0,0 +1,21 @@
+import { apiGet, apiPost } from './http'
+
+/**
+ * balance 插件 API(余额系统)
+ * 依赖插件启用:balance
+ */
+
+/** 余额信息 + 流水分页 */
+export function getBalanceInfo(page = 1, perPage = 15) {
+ return apiGet('/balance/api/info', { page, per_page: perPage })
+}
+
+/** 可用支付方式(充值页,排除余额自身) */
+export function getBalanceMethods() {
+ return apiGet('/balance/api/methods')
+}
+
+/** 创建充值订单 → 返回支付 HTML */
+export function createRecharge(amount, type) {
+ return apiPost('/balance/api/create_recharge', { amount, type })
+}
diff --git a/templates/tdesign/spa/src/home/api/http.js b/templates/tdesign/spa/src/home/api/http.js
new file mode 100644
index 0000000..3094f24
--- /dev/null
+++ b/templates/tdesign/spa/src/home/api/http.js
@@ -0,0 +1,123 @@
+import axios from 'axios'
+import { MessagePlugin } from 'tdesign-vue-next'
+
+/**
+ * MNBT 主页/售卖 SPA 路由 API 封装
+ *
+ * 插件(user_info / balance / hosting_shop)通过 P2 通用路由暴露 JSON API:
+ * POST/GET {routeBase}/account/api/login 等
+ * routeBase 由 PHP 入口注入(index.php?_r=),响应为 { code, ...extra } 结构:
+ * - code === 'ok' → 成功,extra 为数据载荷
+ * - code === 'not_login' → 未登录(前端跳登录页)
+ * - 其他 code → 失败消息
+ */
+
+function getBoot() {
+ return window.__TD_BOOT__ || {}
+}
+
+/** 读取 CSRF token(meta 优先,回退 cookie) */
+export function getCsrfToken() {
+ const meta = document.querySelector('meta[name="csrf-token"]')
+ if (meta && meta.content) return meta.content
+ try {
+ const cookies = document.cookie.split('; ')
+ for (const c of cookies) {
+ const idx = c.indexOf('=')
+ if (idx > -1 && c.slice(0, idx) === 'MNBT_CSRF_TOKEN') {
+ return decodeURIComponent(c.slice(idx + 1))
+ }
+ }
+ } catch { /* ignore */ }
+ return ''
+}
+
+const http = axios.create({ timeout: 60000 })
+
+/** 构造完整 API URL */
+export function apiUrl(path) {
+ const boot = getBoot()
+ const base = boot.routeBase || '/index.php?_r='
+ return base + path.replace(/^\//, '')
+}
+
+/**
+ * 发送路由 API 请求
+ * @param {string} method GET|POST
+ * @param {string} path 路由路径(/account/api/me)
+ * @param {object} data POST 表单数据
+ * @param {{silent?:boolean}} opts
+ * @returns {Promise<{ok:boolean, code:string, message:string, data:object, raw:object}>}
+ */
+export async function routeRequest(method, path, data = {}, { silent = false } = {}) {
+ try {
+ let res
+ if (method === 'GET') {
+ res = await http.get(apiUrl(path), { params: data })
+ } else {
+ const body = new URLSearchParams()
+ Object.keys(data || {}).forEach((k) => {
+ const v = data[k]
+ if (v === undefined || v === null) return
+ body.append(k, String(v))
+ })
+ const token = getCsrfToken()
+ if (token && !body.get('_csrf')) body.append('_csrf', token)
+ res = await http.post(apiUrl(path), body, {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
+ })
+ }
+ const raw = res.data
+ if (raw && typeof raw === 'object' && typeof raw.code === 'string') {
+ if (raw.code === 'ok') {
+ return { ok: true, code: 'ok', message: 'ok', data: raw, raw }
+ }
+ if (raw.code === 'not_login') {
+ return { ok: false, code: 'not_login', message: '请先登录', data: raw, raw }
+ }
+ return { ok: false, code: raw.code, message: raw.code || '请求失败', data: raw, raw }
+ }
+ // 兼容 { success:true, ... } 风格
+ if (raw && typeof raw === 'object' && raw.success === true) {
+ return { ok: true, code: 'ok', message: raw.msg || 'ok', data: raw, raw }
+ }
+ if (raw && typeof raw === 'object' && raw.success === false) {
+ const msg = raw.msg || raw.code || raw.message || '请求失败'
+ return { ok: false, code: msg, message: msg, data: raw, raw }
+ }
+ return { ok: true, code: 'ok', message: 'ok', data: raw ?? {}, raw }
+ } catch (e) {
+ let msg = e.message || '网络错误'
+ const body = e?.response?.data
+ if (typeof body === 'string' && body.trim()) {
+ const plain = body.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
+ if (plain) msg = plain.slice(0, 160)
+ } else if (body && typeof body === 'object') {
+ msg = body.code || body.msg || body.message || msg
+ }
+ console.error(`[homeApi] ${method} ${path} 异常:`, e, body)
+ if (!silent) MessagePlugin.error(msg)
+ return { ok: false, code: msg, message: msg, data: null, raw: body ?? null }
+ }
+}
+
+/** GET 快捷方法 */
+export async function apiGet(path, params = {}, opts = {}) {
+ return routeRequest('GET', path, params, opts)
+}
+
+/** POST 快捷方法 */
+export async function apiPost(path, data = {}, opts = {}) {
+ return routeRequest('POST', path, data, opts)
+}
+
+/** 未登录统一处理:返回 true 表示已拦截跳转 */
+export function handleNotLogin(result) {
+ if (!result.ok && result.code === 'not_login') {
+ window.location.hash = '#/login'
+ return true
+ }
+ return false
+}
+
+export default http
diff --git a/templates/tdesign/spa/src/home/api/shop.js b/templates/tdesign/spa/src/home/api/shop.js
new file mode 100644
index 0000000..5eaea0f
--- /dev/null
+++ b/templates/tdesign/spa/src/home/api/shop.js
@@ -0,0 +1,36 @@
+import { apiGet, apiPost } from './http'
+
+/**
+ * hosting_shop 插件 API(主机售卖)
+ * 依赖插件启用:hosting_shop
+ */
+
+/** 上架套餐列表 */
+export function getPlans() {
+ return apiGet('/shop/api/plans')
+}
+
+/** 套餐详情(含支付方式) */
+export function getPlan(planId) {
+ return apiGet(`/shop/api/plan/${planId}`)
+}
+
+/** 我的主机资产 */
+export function getAssets() {
+ return apiGet('/shop/api/assets')
+}
+
+/** 我的订单(分页) */
+export function getOrders(page = 1, perPage = 15) {
+ return apiGet('/shop/api/orders', { page, per_page: perPage })
+}
+
+/** 可用支付方式 */
+export function getShopMethods() {
+ return apiGet('/shop/api/methods')
+}
+
+/** 创建购买订单 → 返回支付 HTML / redirect */
+export function createOrder(planId, period, type) {
+ return apiPost('/shop/api/create_order', { plan_id: planId, period, type })
+}
diff --git a/templates/tdesign/spa/src/home/api/site.js b/templates/tdesign/spa/src/home/api/site.js
new file mode 100644
index 0000000..50e0f3e
--- /dev/null
+++ b/templates/tdesign/spa/src/home/api/site.js
@@ -0,0 +1,40 @@
+import { apiGet, apiPost } from './http'
+
+/**
+ * official_site 插件 API(官网内容)
+ * 依赖插件启用:official_site
+ */
+
+/** 产品列表(可选 ?category= 筛选,返回 products + categories) */
+export function getSiteProducts(category = '') {
+ return apiGet('/site/api/products', category ? { category } : {})
+}
+
+/** 产品详情 */
+export function getSiteProduct(productId) {
+ return apiGet(`/site/api/products/${productId}`)
+}
+
+/** 新闻分页列表(page / per_page / category) */
+export function getSiteNews({ page = 1, perPage = 6, category = '' } = {}) {
+ return apiGet('/site/api/news', {
+ page,
+ per_page: perPage,
+ ...(category ? { category } : {}),
+ })
+}
+
+/** 热门新闻(按浏览量) */
+export function getSiteNewsPopular() {
+ return apiGet('/site/api/news/popular')
+}
+
+/** 新闻详情(累计浏览量) */
+export function getSiteNewsDetail(newsId) {
+ return apiGet(`/site/api/news/${newsId}`)
+}
+
+/** 提交联系留言 */
+export function submitSiteContact(form) {
+ return apiPost('/site/api/contact', form)
+}
diff --git a/templates/tdesign/spa/src/home/layouts/HomeLayout.vue b/templates/tdesign/spa/src/home/layouts/HomeLayout.vue
new file mode 100644
index 0000000..70b8e53
--- /dev/null
+++ b/templates/tdesign/spa/src/home/layouts/HomeLayout.vue
@@ -0,0 +1,126 @@
+<template>
+ <div class="hd-shell">
+ <!-- 顶部导航(guanwang1 风格:毛玻璃 sticky + 绿色 logo + 下划线动画导航) -->
+ <header class="hd-nav">
+ <div class="container hd-nav-inner">
+ <router-link to="/" class="hd-brand">
+ <img v-if="boot.siteLogo" :src="boot.siteLogo" alt="logo" class="hd-brand-logo" />
+ <h1>{{ boot.siteTitle || 'MNBT' }}</h1>
+ </router-link>
+ <nav class="hd-nav-right">
+ <ul class="hd-nav-list" :class="{ active: menuOpen }">
+ <li><router-link to="/" exact-active-class="active">首页</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/about" active-class="active">关于我们</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/site/products" active-class="active">产品中心</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/site/news" active-class="active">新闻资讯</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/site/contact" active-class="active">联系我们</router-link></li>
+ <li v-if="!boot.hasSite && boot.hasShop"><router-link to="/shop" active-class="active">主机套餐</router-link></li>
+ <li v-if="authState.loggedIn && boot.hasShop"><router-link to="/shop/assets" active-class="active">我的主机</router-link></li>
+ <li v-if="authState.loggedIn && boot.hasBalance"><router-link to="/balance" active-class="active">我的余额</router-link></li>
+ </ul>
+ <div class="hd-nav-actions">
+ <template v-if="authState.loggedIn">
+ <span class="hd-user-name">{{ authState.user?.username }}</span>
+ <t-button size="small" variant="outline" theme="default" @click="onLogout">退出</t-button>
+ </template>
+ <template v-else-if="boot.hasUser">
+ <router-link to="/login">
+ <t-button size="small" variant="outline" theme="default">登录</t-button>
+ </router-link>
+ <router-link to="/register">
+ <t-button size="small" theme="primary">免费注册</t-button>
+ </router-link>
+ </template>
+ </div>
+ <button class="hd-menu-toggle" :class="{ active: menuOpen }" @click="menuOpen = !menuOpen" :aria-label="menuOpen ? '关闭菜单' : '打开菜单'">
+ <span></span><span></span><span></span>
+ </button>
+ </nav>
+ </div>
+ </header>
+
+ <main class="hd-main">
+ <router-view />
+ </main>
+
+ <!-- 页脚(guanwang1 风格:三列信息 + 备案 + 返回顶部) -->
+ <footer class="hd-footer">
+ <div class="container">
+ <div class="hd-footer-content">
+ <div class="hd-footer-section hd-company-info">
+ <h3>{{ boot.siteTitle || 'MNBT' }}</h3>
+ <p>致力于为客户提供稳定、安全、高性能的虚拟主机与云计算服务。</p>
+ <div class="hd-social-links">
+ <a href="#" class="hd-social-link" aria-label="QQ 群" @click.prevent><i class="mdi mdi-qqchat"></i></a>
+ <a href="#" class="hd-social-link" aria-label="邮箱" @click.prevent><i class="mdi mdi-email-outline"></i></a>
+ <a href="#" class="hd-social-link" aria-label="GitHub" @click.prevent><i class="mdi mdi-github"></i></a>
+ </div>
+ </div>
+ <div class="hd-footer-section hd-quick-links">
+ <h4>快速链接</h4>
+ <ul>
+ <li><router-link to="/">首页</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/about">关于我们</router-link></li>
+ <li v-if="boot.hasShop"><router-link to="/shop">主机套餐</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/site/news">新闻资讯</router-link></li>
+ <li v-if="boot.hasSite"><router-link to="/site/contact">联系我们</router-link></li>
+ </ul>
+ </div>
+ <div class="hd-footer-section hd-contact-info">
+ <h4>联系方式</h4>
+ <div class="hd-contact-item">
+ <span class="icon"><i class="mdi mdi-qqchat"></i></span>
+ <span class="info">官方 QQ 群:994752422</span>
+ </div>
+ <div class="hd-contact-item">
+ <span class="icon"><i class="mdi mdi-email-outline"></i></span>
+ <span class="info">1181469655@qq.com</span>
+ </div>
+ <div class="hd-contact-item">
+ <span class="icon"><i class="mdi mdi-map-marker-outline"></i></span>
+ <span class="info">MNBT 虚拟主机平台</span>
+ </div>
+ </div>
+ </div>
+ <div class="hd-footer-bottom">
+ <p v-if="boot.siteFooter">{{ boot.siteFooter }}</p>
+ <p v-else>© {{ new Date().getFullYear() }} {{ boot.siteTitle || 'MNBT' }}. 保留所有权利.</p>
+ <div class="hd-footer-beians">
+ <a v-if="boot.beianInfo" href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">{{ boot.beianInfo }}</a>
+ <a v-if="boot.policeBeian" href="https://www.beian.gov.cn/" target="_blank" rel="noopener">{{ boot.policeBeian }}</a>
+ </div>
+ <div class="hd-back-to-top" @click="scrollToTop">
+ <i class="mdi mdi-arrow-up"></i>
+ <span>返回顶部</span>
+ </div>
+ </div>
+ </div>
+ </footer>
+ </div>
+</template>
+
+<script setup>
+import { ref, watch } from 'vue'
+import { useRoute } from 'vue-router'
+import { MessagePlugin } from 'tdesign-vue-next'
+import authState from '@/home/store/auth'
+
+const boot = window.__TD_BOOT__ || {}
+const menuOpen = ref(false)
+const route = useRoute()
+
+// 路由切换后自动收起移动端菜单
+watch(() => route.fullPath, () => {
+ menuOpen.value = false
+})
+
+function onLogout() {
+ // user_info 插件的退出路由(GET /account/logout)
+ window.location.href = (boot.routeBase || '/index.php?_r=') + 'account/logout'
+ MessagePlugin.success('已退出登录')
+}
+
+function scrollToTop() {
+ window.scrollTo({ top: 0, behavior: 'smooth' })
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/router/index.js b/templates/tdesign/spa/src/home/router/index.js
new file mode 100644
index 0000000..1ff61e2
--- /dev/null
+++ b/templates/tdesign/spa/src/home/router/index.js
@@ -0,0 +1,96 @@
+import { createRouter, createWebHashHistory } from 'vue-router'
+import authState, { initAuth } from '@/home/store/auth'
+
+const HomeLayout = () => import('@/home/layouts/HomeLayout.vue')
+const LandingView = () => import('@/home/views/LandingView.vue')
+const LoginView = () => import('@/home/views/auth/LoginView.vue')
+const RegisterView = () => import('@/home/views/auth/RegisterView.vue')
+const ProfileView = () => import('@/home/views/auth/ProfileView.vue')
+const PasswordView = () => import('@/home/views/auth/PasswordView.vue')
+const ShopView = () => import('@/home/views/shop/ShopView.vue')
+const OrderView = () => import('@/home/views/shop/OrderView.vue')
+const AssetsView = () => import('@/home/views/shop/AssetsView.vue')
+const OrdersView = () => import('@/home/views/shop/OrdersView.vue')
+const BalanceView = () => import('@/home/views/balance/BalanceView.vue')
+const RechargeView = () => import('@/home/views/balance/RechargeView.vue')
+// 官网内容(official_site 插件)
+const AboutView = () => import('@/home/views/site/AboutView.vue')
+const SiteProductsView = () => import('@/home/views/site/products/ProductsView.vue')
+const SiteProductDetailView = () => import('@/home/views/site/products/ProductDetailView.vue')
+const SiteNewsView = () => import('@/home/views/site/news/NewsView.vue')
+const SiteNewsDetailView = () => import('@/home/views/site/news/NewsDetailView.vue')
+const ContactView = () => import('@/home/views/site/ContactView.vue')
+
+const routes = [
+ {
+ path: '/',
+ component: HomeLayout,
+ children: [
+ { path: '', name: 'home-landing', component: LandingView, meta: { title: '' } },
+ { path: 'login', name: 'home-login', component: LoginView, meta: { title: '登录', guest: true, cap: 'user' } },
+ { path: 'register', name: 'home-register', component: RegisterView, meta: { title: '注册', guest: true, cap: 'user' } },
+ { path: 'profile', name: 'home-profile', component: ProfileView, meta: { title: '个人信息', auth: true, cap: 'user' } },
+ { path: 'password', name: 'home-password', component: PasswordView, meta: { title: '修改密码', auth: true, cap: 'user' } },
+ { path: 'shop', name: 'home-shop', component: ShopView, meta: { title: '主机套餐', cap: 'shop' } },
+ { path: 'shop/order/:planId', name: 'home-order', component: OrderView, meta: { title: '购买套餐', auth: true, cap: 'shop' } },
+ { path: 'shop/assets', name: 'home-assets', component: AssetsView, meta: { title: '我的主机', auth: true, cap: 'shop' } },
+ { path: 'shop/orders', name: 'home-orders', component: OrdersView, meta: { title: '我的订单', auth: true, cap: 'shop' } },
+ { path: 'balance', name: 'home-balance', component: BalanceView, meta: { title: '我的余额', auth: true, cap: 'balance' } },
+ { path: 'balance/recharge', name: 'home-recharge', component: RechargeView, meta: { title: '余额充值', auth: true, cap: 'balance' } },
+ // 官网内容(official_site 插件)
+ { path: 'about', name: 'home-about', component: AboutView, meta: { title: '关于我们', cap: 'site' } },
+ { path: 'site/products', name: 'home-site-products', component: SiteProductsView, meta: { title: '产品中心', cap: 'site' } },
+ { path: 'site/products/:id', name: 'home-site-product-detail', component: SiteProductDetailView, meta: { title: '产品详情', cap: 'site' } },
+ { path: 'site/news', name: 'home-site-news', component: SiteNewsView, meta: { title: '新闻资讯', cap: 'site' } },
+ { path: 'site/news/:id', name: 'home-site-news-detail', component: SiteNewsDetailView, meta: { title: '新闻详情', cap: 'site' } },
+ { path: 'site/contact', name: 'home-site-contact', component: ContactView, meta: { title: '联系我们', cap: 'site' } },
+ ],
+ },
+ { path: '/:pathMatch(.*)*', redirect: '/' },
+]
+
+const router = createRouter({
+ history: createWebHashHistory(),
+ routes,
+ scrollBehavior() {
+ return { top: 0 }
+ },
+})
+
+router.beforeEach(async (to, _from, next) => {
+ const boot = window.__TD_BOOT__ || {}
+ document.title = to.meta.title ? `${to.meta.title} · ${boot.siteTitle || 'MNBT'}` : boot.siteTitle || 'MNBT'
+
+ if (!authState.initialized) {
+ await initAuth()
+ }
+ if (to.meta.guest && authState.loggedIn) {
+ next('/')
+ return
+ }
+ if (to.meta.auth && !authState.loggedIn) {
+ next('/login')
+ return
+ }
+ // 插件能力校验:对应插件未启用时自动禁用(hasXxx 仅在明确 false 时拦截,兼容旧注入缺字段)
+ const cap = to.meta.cap
+ if (cap === 'shop' && boot.hasShop === false) {
+ next('/')
+ return
+ }
+ if (cap === 'balance' && boot.hasBalance === false) {
+ next('/')
+ return
+ }
+ if (cap === 'user' && boot.hasUser === false) {
+ next('/')
+ return
+ }
+ if (cap === 'site' && boot.hasSite === false) {
+ next('/')
+ return
+ }
+ next()
+})
+
+export default router
diff --git a/templates/tdesign/spa/src/home/store/auth.js b/templates/tdesign/spa/src/home/store/auth.js
new file mode 100644
index 0000000..922096a
--- /dev/null
+++ b/templates/tdesign/spa/src/home/store/auth.js
@@ -0,0 +1,45 @@
+import { reactive } from 'vue'
+import { getMe } from '@/home/api/account'
+
+/**
+ * 共享登录态 store
+ * user_info 插件认证(account_token cookie)
+ */
+export const authState = reactive({
+ loading: false,
+ loggedIn: false,
+ user: null,
+ initialized: false,
+})
+
+/** 探测当前登录态(不弹窗) */
+export async function initAuth() {
+ if (authState.loading) return authState
+ authState.loading = true
+ try {
+ const res = await getMe()
+ if (res.ok && res.data?.logged_in) {
+ authState.loggedIn = true
+ authState.user = res.data.user || null
+ } else {
+ authState.loggedIn = false
+ authState.user = null
+ }
+ } catch {
+ authState.loggedIn = false
+ authState.user = null
+ } finally {
+ authState.loading = false
+ authState.initialized = true
+ }
+ return authState
+}
+
+/** 清除本地登录态(退出/失效时调用) */
+export function resetAuth() {
+ authState.loggedIn = false
+ authState.user = null
+ authState.initialized = true
+}
+
+export default authState
diff --git a/templates/tdesign/spa/src/home/styles/home.scss b/templates/tdesign/spa/src/home/styles/home.scss
new file mode 100644
index 0000000..71cfec9
--- /dev/null
+++ b/templates/tdesign/spa/src/home/styles/home.scss
@@ -0,0 +1,1106 @@
+/**
+ * TDesign 主页/售卖前端全局样式
+ * 落地页 / 顶栏 / 页脚按 guanwang1(科技企业官网)风格移植:
+ * - 绿色主色 #42b983、浅色背景、圆角卡片、扁平留白
+ * - 轮播 hero、核心优势、新闻预览、客户评价区块
+ * 其余页面(套餐 / 余额 / 账户 / 官网内容)沿用 hd-* 通用类
+ */
+
+:root {
+ --hd-brand: #42b983;
+ --hd-brand-light: #e6f7f0;
+ --hd-brand-dark: #359c6d;
+ --hd-text: #181818;
+ --hd-text-2: #595959;
+ --hd-text-3: #8c8c8c;
+ --hd-border: #e7e7e7;
+ --hd-bg: #ffffff;
+ --hd-surface: #ffffff;
+ --hd-radius: 6px;
+ --hd-radius-lg: 10px;
+ --hd-radius-xl: 16px;
+ --hd-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
+ --hd-shadow-lg: 0 8px 28px rgba(15, 23, 42, 0.08);
+ --hd-ease: cubic-bezier(0.4, 0, 0.2, 1);
+ --hd-dur: 0.2s;
+
+ /* 覆盖 TDesign 品牌色为官网绿色(仅 home scope 生效) */
+ --td-brand: #42b983;
+ --td-brand-light: #e6f7f0;
+ --td-brand-dark: #359c6d;
+ --td-brand-hover: #359c6d;
+ --td-brand-active: #359c6d;
+ --td-brand-focus: rgba(66, 185, 131, 0.2);
+ --td-brand-color-hover: #359c6d;
+}
+
+/* ============ 布局容器 ============ */
+.hd-shell {
+ display: flex;
+ flex-direction: column;
+ min-height: 100vh;
+ background: #fff;
+}
+
+/* guanwang1 容器:1200px */
+.container {
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 0 20px;
+}
+
+/* 兼容旧页面容器(与 container 统一宽度) */
+.hd-container {
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 0 20px;
+}
+
+/* ============ 顶栏(guanwang1 Header 移植) ============ */
+.hd-nav {
+ background: rgba(255, 255, 255, 0.8);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
+ position: sticky;
+ top: 0;
+ z-index: 100;
+}
+
+.hd-nav-inner {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ height: 70px;
+ gap: 16px;
+}
+
+.hd-brand {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ text-decoration: none;
+}
+.hd-brand:hover { text-decoration: none; }
+
+.hd-brand h1 {
+ color: #42b983;
+ margin: 0;
+ font-size: 24px;
+ font-weight: 700;
+}
+
+.hd-brand-logo {
+ width: 28px;
+ height: 28px;
+ object-fit: contain;
+}
+
+.hd-nav-right {
+ display: flex;
+ align-items: center;
+ gap: 18px;
+}
+
+.hd-nav-list {
+ display: flex;
+ align-items: center;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ gap: 30px;
+}
+
+.hd-nav-list a {
+ text-decoration: none;
+ color: #333;
+ font-weight: 500;
+ font-size: 14px;
+ transition: color 0.3s;
+ position: relative;
+}
+
+.hd-nav-list a:hover,
+.hd-nav-list a.active {
+ color: #42b983;
+ text-decoration: none;
+}
+
+.hd-nav-list a::after {
+ content: '';
+ position: absolute;
+ bottom: -5px;
+ left: 0;
+ width: 0;
+ height: 2px;
+ background-color: #42b983;
+ transition: width 0.3s;
+}
+
+.hd-nav-list a:hover::after,
+.hd-nav-list a.active::after {
+ width: 100%;
+}
+
+.hd-nav-actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-shrink: 0;
+}
+
+.hd-user-name {
+ font-size: 13px;
+ color: #666;
+ margin-right: 2px;
+}
+
+.hd-menu-toggle {
+ display: none;
+ flex-direction: column;
+ cursor: pointer;
+ background: none;
+ border: none;
+ padding: 6px;
+}
+.hd-menu-toggle span {
+ width: 25px;
+ height: 3px;
+ background-color: #333;
+ margin: 3px 0;
+ transition: 0.3s;
+}
+.hd-menu-toggle.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
+.hd-menu-toggle.active span:nth-child(2) { opacity: 0; }
+.hd-menu-toggle.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }
+
+/* ============ 主内容 ============ */
+.hd-main {
+ flex: 1;
+}
+
+/* ============ 页脚(guanwang1 Footer 移植) ============ */
+.hd-footer {
+ background-color: #f8f9fa;
+ color: #333;
+ padding: 40px 0 20px;
+ margin-top: auto;
+}
+
+.hd-footer-content {
+ display: flex;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ margin-bottom: 40px;
+ gap: 30px;
+}
+
+.hd-footer-section {
+ flex: 1;
+ min-width: 250px;
+ margin-bottom: 20px;
+ padding: 20px;
+ background-color: #fff;
+ border: 1px solid #e9ecef;
+}
+
+.hd-footer-section h3,
+.hd-footer-section h4 {
+ color: #2c3e50;
+ margin-bottom: 15px;
+ padding-bottom: 10px;
+ border-bottom: 2px solid #42b983;
+}
+.hd-footer-section h3 { margin-top: 0; font-size: 20px; }
+.hd-footer-section h4 { margin-top: 0; font-size: 16px; }
+
+.hd-footer-section p,
+.hd-footer-section li {
+ color: #666;
+ line-height: 1.6;
+}
+
+.hd-footer-section ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+.hd-footer-section li {
+ margin-bottom: 8px;
+}
+
+.hd-footer-section a {
+ text-decoration: none;
+ color: #666;
+ transition: color 0.3s;
+ position: relative;
+}
+
+.hd-quick-links a {
+ color: #42b983;
+}
+
+.hd-footer-section a::after {
+ content: '';
+ position: absolute;
+ bottom: -2px;
+ left: 0;
+ width: 0;
+ height: 1px;
+ background: #42b983;
+ transition: width 0.3s ease;
+}
+
+.hd-footer-section a:hover {
+ color: #42b983;
+}
+.hd-footer-section a:hover::after {
+ width: 100%;
+}
+
+.hd-social-links {
+ display: flex;
+ gap: 15px;
+ margin-top: 20px;
+}
+
+.hd-social-link {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 36px;
+ height: 36px;
+ color: #666;
+ font-size: 18px;
+ transition: all 0.3s ease;
+ text-decoration: none;
+ border-radius: 4px;
+}
+.hd-social-link:hover {
+ color: #42b983;
+ transform: translateY(-2px);
+}
+
+.hd-contact-item {
+ display: flex;
+ align-items: center;
+ margin-bottom: 15px;
+}
+.hd-contact-item .icon {
+ font-size: 18px;
+ margin-right: 15px;
+ width: 24px;
+ text-align: center;
+ color: #42b983;
+}
+
+.hd-footer-bottom {
+ border-top: 1px solid #e9ecef;
+ padding-top: 20px;
+ text-align: center;
+ color: #666;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 10px;
+}
+
+.hd-footer-beians {
+ display: flex;
+ gap: 20px;
+ font-size: 14px;
+}
+.hd-footer-beians a {
+ color: #666;
+ text-decoration: none;
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ transition: color 0.3s ease;
+}
+.hd-footer-beians a:hover {
+ color: #42b983;
+}
+
+.hd-back-to-top {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ background-color: #e9ecef;
+ padding: 8px 15px;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ border: none;
+ font-size: 14px;
+}
+.hd-back-to-top:hover {
+ background-color: #42b983;
+ color: white;
+}
+
+/* ============ 落地页(guanwang1 Home 移植) ============ */
+.home {
+ flex: 1;
+}
+
+.section {
+ padding: 80px 0;
+}
+
+.section-header {
+ text-align: center;
+ margin-bottom: 50px;
+}
+
+.section-title {
+ font-size: 2rem;
+ margin-bottom: 20px;
+ color: #333;
+ position: relative;
+ padding-bottom: 15px;
+ font-weight: 700;
+}
+
+.section-title:after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 50px;
+ height: 3px;
+ background-color: #42b983;
+}
+
+.section-subtitle {
+ font-size: 1.1rem;
+ color: #666;
+ max-width: 700px;
+ margin: 0 auto;
+ line-height: 1.6;
+}
+
+/* ---- Hero 轮播 ---- */
+.hero {
+ position: relative;
+ color: white;
+ height: 500px;
+ animation: hdFadeIn 0.8s ease-out;
+}
+
+.carousel {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+}
+
+.carousel-inner {
+ position: relative;
+ width: 100%;
+ height: 100%;
+}
+
+.carousel-item {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0;
+ transition: opacity 1s ease-in-out;
+}
+.carousel-item.active {
+ opacity: 1;
+}
+
+.carousel-bg {
+ width: 100%;
+ height: 100%;
+ background-size: cover;
+ background-position: center;
+}
+
+.carousel-controls {
+ position: absolute;
+ top: 50%;
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ transform: translateY(-50%);
+ padding: 0 20px;
+ z-index: 10;
+}
+
+.carousel-btn {
+ background: rgba(0, 0, 0, 0.5);
+ color: white;
+ border: none;
+ width: 50px;
+ height: 50px;
+ border-radius: 50%;
+ font-size: 24px;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ line-height: 1;
+}
+.carousel-btn:hover {
+ background: rgba(0, 0, 0, 0.8);
+ transform: scale(1.1);
+}
+
+.carousel-indicators {
+ position: absolute;
+ bottom: 20px;
+ left: 50%;
+ transform: translateX(-50%);
+ display: flex;
+ gap: 10px;
+ z-index: 10;
+}
+.carousel-indicators span {
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+ background: rgba(255, 255, 255, 0.5);
+ cursor: pointer;
+ transition: all 0.3s ease;
+}
+.carousel-indicators span.active {
+ background: white;
+ transform: scale(1.2);
+}
+
+.carousel-caption {
+ position: absolute;
+ top: 40%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ text-align: center;
+ z-index: 2;
+ color: white;
+ width: 80%;
+ max-width: 800px;
+ padding: 20px;
+}
+
+.carousel-title {
+ font-size: 2.5rem;
+ font-weight: 700;
+ margin-bottom: 15px;
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
+}
+
+.carousel-subtitle {
+ font-size: 1.2rem;
+ margin-bottom: 10px;
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
+}
+
+.carousel-description {
+ font-size: 1rem;
+ margin-bottom: 30px;
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
+ line-height: 1.6;
+}
+
+.hero-buttons {
+ display: flex;
+ justify-content: center;
+ gap: 20px;
+ margin-top: 30px;
+}
+
+.btn {
+ display: inline-block;
+ padding: 12px 30px;
+ border-radius: 30px;
+ text-decoration: none;
+ font-weight: 500;
+ transition: all 0.4s ease;
+ border: none;
+ cursor: pointer;
+ font-size: 1rem;
+}
+.btn:hover { text-decoration: none; }
+
+.btn-primary {
+ background-color: #42b983;
+ color: white;
+}
+.btn-primary:hover {
+ background-color: #359c6d;
+ transform: translateY(-3px);
+ box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
+}
+
+.btn-secondary {
+ background-color: transparent;
+ color: white;
+ border: 2px solid white;
+}
+.btn-secondary:hover {
+ background-color: rgba(255, 255, 255, 0.1);
+ transform: translateY(-3px);
+ box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
+}
+
+.btn-light {
+ background-color: #fff;
+ color: #42b983;
+}
+.btn-light:hover {
+ transform: translateY(-3px);
+ box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
+}
+
+@keyframes hdFadeIn {
+ from { opacity: 0; }
+ to { opacity: 1; }
+}
+
+/* ---- 公告 ---- */
+.notice-strip {
+ padding: 24px 0 0;
+}
+
+.hd-notice {
+ display: flex;
+ gap: 12px;
+ align-items: flex-start;
+ padding: 14px 18px;
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ background: var(--hd-surface);
+ box-shadow: var(--hd-shadow);
+}
+
+.hd-notice i {
+ font-size: 20px;
+ line-height: 1.5;
+ flex-shrink: 0;
+ color: var(--hd-brand);
+}
+
+.hd-notice .txt {
+ color: var(--hd-text-2);
+ font-size: 14px;
+ white-space: pre-line;
+ word-break: break-word;
+}
+
+/* ---- 套餐区 ---- */
+.plans-section {
+ background: #fff;
+}
+
+.hd-plans {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 18px;
+}
+
+.hd-plan-card {
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ transition: box-shadow var(--hd-dur) var(--hd-ease), transform var(--hd-dur) var(--hd-ease);
+}
+.hd-plan-card:hover {
+ box-shadow: var(--hd-shadow-lg);
+ transform: translateY(-2px);
+}
+.hd-plan-card.pop {
+ border-color: var(--hd-brand);
+ box-shadow: 0 0 0 1px var(--hd-brand);
+}
+
+.hd-plan-top {
+ padding: 22px 22px 16px;
+ border-bottom: 1px solid var(--hd-border);
+}
+
+.hd-plan-chip {
+ display: inline-block;
+ padding: 3px 10px;
+ border-radius: 999px;
+ background: var(--hd-brand-light);
+ color: var(--hd-brand);
+ font-size: 12px;
+ font-weight: 700;
+ margin-bottom: 8px;
+}
+
+.hd-plan-top h3 {
+ font-size: 1.1rem;
+ letter-spacing: -0.02em;
+ margin: 0 0 4px;
+ color: var(--hd-text);
+}
+
+.hd-plan-desc {
+ color: var(--hd-text-3);
+ font-size: 13px;
+ min-height: 40px;
+ line-height: 1.6;
+}
+
+.hd-plan-body {
+ padding: 18px 22px 22px;
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+}
+
+.hd-plan-price { margin-bottom: 14px; }
+
+.hd-plan-price .num {
+ font-size: 1.7rem;
+ font-weight: 800;
+ letter-spacing: -0.03em;
+ color: var(--hd-text);
+}
+
+.hd-plan-price .sub {
+ color: var(--hd-text-3);
+ font-size: 12px;
+}
+
+.hd-plan-feats {
+ list-style: none;
+ margin: 0 0 18px;
+ padding: 0;
+ display: grid;
+ gap: 8px;
+ flex: 1;
+}
+.hd-plan-feats li {
+ display: flex;
+ gap: 8px;
+ font-size: 13px;
+ color: var(--hd-text-2);
+}
+.hd-plan-feats li .ok {
+ color: var(--hd-brand);
+ flex-shrink: 0;
+}
+.hd-plan-feats li .off {
+ color: #c2c7cf;
+ flex-shrink: 0;
+}
+
+.hd-plan-body .t-button {
+ height: 44px;
+ font-size: 15px;
+ border-radius: var(--hd-radius-lg);
+}
+
+/* ---- 核心优势 ---- */
+.features {
+ background-color: #f8f9fa;
+}
+
+.features-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 30px;
+}
+
+.feature-card {
+ background: rgba(255, 255, 255, 0.9);
+ border-radius: 10px;
+ padding: 30px;
+ text-align: center;
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
+ transition: all 0.4s ease;
+ border: 1px solid #eee;
+}
+.feature-card:hover {
+ transform: translateY(-10px);
+ box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
+}
+
+.feature-icon {
+ font-size: 3rem;
+ margin-bottom: 20px;
+ color: #42b983;
+ line-height: 1;
+}
+
+.feature-card h3 {
+ font-size: 1.5rem;
+ margin-bottom: 15px;
+ color: #333;
+ font-weight: 600;
+}
+
+.feature-card p {
+ color: #666;
+ line-height: 1.6;
+ margin: 0;
+}
+
+/* ---- 新闻预览 ---- */
+.news-preview {
+ background-color: #f8f9fa;
+}
+
+.news-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 30px;
+}
+
+.news-card {
+ background: white;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ border: 1px solid #e0e0e0;
+ padding: 20px;
+ box-shadow: none;
+ cursor: pointer;
+}
+.news-card:hover {
+ transform: translateY(-5px);
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
+ border-color: #42b983;
+}
+
+.news-date {
+ color: #42b983;
+ font-size: 0.85rem;
+ margin-bottom: 8px;
+ display: block;
+ font-weight: 600;
+ letter-spacing: 0.5px;
+}
+
+.news-card h3 {
+ font-size: 1.3rem;
+ margin-bottom: 12px;
+ color: #2c3e50;
+ line-height: 1.4;
+ font-weight: 600;
+}
+
+.news-excerpt {
+ color: #555;
+ line-height: 1.6;
+ margin-bottom: 16px;
+ font-size: 0.9rem;
+}
+
+.read-more {
+ color: #42b983;
+ text-decoration: none;
+ font-weight: 600;
+ transition: all 0.3s ease;
+ display: inline-block;
+ padding: 8px 0;
+ border-bottom: 1px solid transparent;
+ cursor: pointer;
+}
+.read-more:hover {
+ color: #359c6d;
+ border-bottom-color: #359c6d;
+}
+
+.more-news {
+ color: #42b983;
+ text-decoration: none;
+ font-weight: 500;
+ transition: color 0.3s ease;
+ display: inline-block;
+ margin-top: 20px;
+ font-size: 1.1rem;
+}
+.more-news:hover {
+ color: #359c6d;
+}
+
+/* ---- 客户评价 ---- */
+.testimonials {
+ background-color: #fff;
+}
+
+.testimonials-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 24px;
+}
+
+.testimonial-card {
+ background: #ffffff;
+ padding: 24px;
+ transition: all 0.3s ease;
+ border: 1px solid #e2e8f0;
+ position: relative;
+ border-radius: 8px;
+}
+.testimonial-card:hover {
+ transform: translateY(-4px);
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
+ border-color: #cbd5e0;
+}
+
+.testimonial-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 16px;
+}
+
+.client-avatar {
+ width: 50px;
+ height: 50px;
+ border-radius: 50%;
+ overflow: hidden;
+ flex-shrink: 0;
+ background: linear-gradient(135deg, #42b983, #64b5f6);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-right: 12px;
+}
+
+.avatar-placeholder {
+ font-size: 1.2rem;
+ font-weight: 600;
+ color: white;
+}
+
+.client-details {
+ flex: 1;
+}
+
+.client-name {
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 4px;
+ font-size: 1rem;
+}
+
+.client-title {
+ color: #64748b;
+ font-size: 0.85rem;
+}
+
+.testimonial-text {
+ color: #334155;
+ line-height: 1.6;
+ margin-bottom: 20px;
+ position: relative;
+ padding-top: 0;
+}
+.testimonial-text::before {
+ content: '"';
+ position: absolute;
+ top: -20px;
+ left: -10px;
+ font-size: 4rem;
+ color: rgba(66, 185, 131, 0.15);
+ font-family: Georgia, serif;
+ line-height: 1;
+}
+
+.quote-icon {
+ position: absolute;
+ bottom: 20px;
+ right: 20px;
+ color: rgba(66, 185, 131, 0.3);
+ font-size: 1.5rem;
+}
+
+/* ---- 底部 CTA ---- */
+.hd-cta {
+ text-align: center;
+ padding: 46px 28px;
+ background: linear-gradient(135deg, #42b983 0%, #67cfa2 100%);
+ border-radius: var(--hd-radius-xl);
+ color: #fff;
+ box-shadow: 0 6px 20px rgba(66, 185, 131, 0.25);
+}
+
+.hd-cta h3 {
+ margin: 0 0 8px;
+ font-size: 1.5rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+}
+
+.hd-cta p {
+ margin: 0 0 20px;
+ opacity: 0.9;
+ font-size: 14px;
+}
+
+.hd-cta .btn {
+ margin-top: 4px;
+}
+
+/* ---- 空状态 ---- */
+.hd-empty {
+ text-align: center;
+ padding: 48px 16px;
+ color: var(--hd-text-3);
+ font-size: 13px;
+}
+.hd-empty i {
+ font-size: 36px;
+ display: block;
+ margin-bottom: 8px;
+ color: #cbd5e1;
+}
+
+/* ============ 通用页面容器 ============ */
+.hd-page {
+ padding: 24px 0;
+}
+
+.hd-page-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 16px;
+ gap: 12px;
+ flex-wrap: wrap;
+}
+
+.hd-page-title {
+ font-size: 18px;
+ font-weight: 700;
+ margin: 0;
+ color: var(--hd-text);
+}
+
+.hd-page-subtitle {
+ font-size: 13px;
+ color: var(--hd-text-2);
+ margin: 2px 0 0;
+}
+
+/* 卡片 */
+.hd-card {
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-lg);
+ box-shadow: var(--hd-shadow);
+ overflow: hidden;
+}
+.hd-card-body { padding: 20px; }
+.hd-card-body--pad-lg { padding: 28px; }
+
+/* 登录/注册页 */
+.hd-auth-wrap {
+ max-width: 420px;
+ margin: 0 auto;
+ padding: 24px 0;
+}
+.hd-auth-title {
+ font-size: 20px;
+ font-weight: 700;
+ text-align: center;
+ margin: 0 0 4px;
+}
+.hd-auth-sub {
+ text-align: center;
+ color: var(--hd-text-3);
+ font-size: 13px;
+ margin: 0 0 22px;
+}
+.hd-auth-foot {
+ text-align: center;
+ margin-top: 16px;
+ font-size: 13px;
+ color: var(--hd-text-2);
+}
+
+/* 余额统计卡 */
+.hd-balance-card {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 26px 30px;
+ background: linear-gradient(135deg, #42b983 0%, #67cfa2 100%);
+ border-radius: var(--hd-radius-xl);
+ color: #fff;
+ box-shadow: 0 6px 20px rgba(66, 185, 131, 0.25);
+}
+.hd-balance-card .label {
+ font-size: 13px;
+ opacity: 0.85;
+}
+.hd-balance-card .value {
+ font-size: 2.2rem;
+ font-weight: 800;
+ margin-top: 4px;
+}
+.hd-balance-actions {
+ display: flex;
+ gap: 8px;
+}
+
+/* ============ 响应式 ============ */
+@media (max-width: 768px) {
+ .section { padding: 60px 0; }
+ .section-title { font-size: 1.7rem; }
+
+ .carousel-title { font-size: 1.8rem; }
+ .carousel-subtitle { font-size: 1rem; }
+ .carousel-caption { top: 50%; width: 90%; padding: 15px; }
+ .carousel-description { font-size: 0.9rem; margin-bottom: 20px; }
+ .hero { height: 50vh; min-height: 300px; }
+ .hero-buttons { flex-direction: column; gap: 15px; margin-top: 20px; }
+ .btn { width: 100%; max-width: 250px; margin: 0 auto; padding: 10px 20px; font-size: 0.9rem; }
+ .carousel-btn { width: 40px; height: 40px; font-size: 20px; }
+
+ .news-grid,
+ .testimonials-grid,
+ .features-grid { grid-template-columns: 1fr; }
+
+ .testimonial-card { text-align: center; }
+ .testimonial-header { flex-direction: column; }
+ .client-avatar { margin-right: 0; margin-bottom: 15px; }
+ .client-details { text-align: center; }
+ .quote-icon { left: 50%; right: auto; transform: translateX(-50%); }
+ .carousel-indicators { bottom: 15px; }
+
+ .container,
+ .hd-container { padding: 0 15px; }
+
+ /* 页脚单列 */
+ .hd-footer-content { flex-direction: column; gap: 20px; }
+ .hd-footer-section { min-width: 100%; }
+ .hd-social-links { justify-content: center; }
+
+ /* 移动端导航:全屏下拉 */
+ .hd-nav-list {
+ position: fixed;
+ top: 70px;
+ left: -100%;
+ width: 100%;
+ height: calc(100vh - 70px);
+ background: rgba(255, 255, 255, 0.9);
+ backdrop-filter: blur(10px);
+ -webkit-backdrop-filter: blur(10px);
+ flex-direction: column;
+ align-items: center;
+ padding-top: 40px;
+ transition: left 0.3s;
+ gap: 0;
+ z-index: 99;
+ }
+ .hd-nav-list.active { left: 0; }
+ .hd-nav-list li { margin: 15px 0; }
+ .hd-menu-toggle { display: flex; }
+}
+
+@media (max-width: 640px) {
+ .hd-plans { grid-template-columns: 1fr; }
+ .hd-balance-card { flex-direction: column; gap: 14px; align-items: flex-start; }
+}
diff --git a/templates/tdesign/spa/src/home/utils/format.js b/templates/tdesign/spa/src/home/utils/format.js
new file mode 100644
index 0000000..ecab0c6
--- /dev/null
+++ b/templates/tdesign/spa/src/home/utils/format.js
@@ -0,0 +1,48 @@
+/** 周期标签 */
+export const periodLabels = {
+ month: '月付',
+ quarter: '季付',
+ half_year: '半年付',
+ year: '年付',
+ two_year: '两年付',
+ three_year: '三年付',
+}
+
+/** 分→元 */
+export function centsToYuan(cents) {
+ return (cents / 100).toFixed(2)
+}
+
+/** 日期格式化(2026-08-10 → 2026年8月10日) */
+export function formatDate(dateString, { showYear = true } = {}) {
+ if (!dateString) return ''
+ const d = new Date(String(dateString).replace(/-/g, '/'))
+ if (isNaN(d.getTime())) return String(dateString)
+ const opts = { month: 'long', day: 'numeric' }
+ if (showYear) opts.year = 'numeric'
+ return d.toLocaleDateString('zh-CN', opts)
+}
+
+/** 订单状态标签 */
+export const orderStatusMap = {
+ pending: { label: '待支付', theme: 'warning' },
+ paid: { label: '已支付', theme: 'primary' },
+ opened: { label: '已开通', theme: 'success' },
+ failed: { label: '失败', theme: 'danger' },
+ cancelled: { label: '已取消', theme: 'default' },
+}
+
+/** 资产状态标签 */
+export const assetStatusMap = {
+ active: { label: '正常', theme: 'success' },
+ expired: { label: '已过期', theme: 'danger' },
+ suspended: { label: '已停用', theme: 'warning' },
+}
+
+/** 流水类型标签 */
+export const logTypeMap = {
+ recharge: { label: '充值', theme: 'success' },
+ consume: { label: '消费', theme: 'danger' },
+ refund: { label: '退款', theme: 'warning' },
+ adjust: { label: '调整', theme: 'primary' },
+}
diff --git a/templates/tdesign/spa/src/home/views/LandingView.vue b/templates/tdesign/spa/src/home/views/LandingView.vue
new file mode 100644
index 0000000..5219fd6
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/LandingView.vue
@@ -0,0 +1,274 @@
+<template>
+ <div class="home">
+ <!-- Hero 轮播(guanwang1 风格:全屏背景图 + 居中文案 + 双向箭头 + 指示器) -->
+ <section class="hero">
+ <div class="carousel">
+ <div class="carousel-inner">
+ <div
+ v-for="(item, index) in carouselItems"
+ :key="index"
+ class="carousel-item"
+ :class="{ active: index === currentSlide }"
+ >
+ <div class="carousel-bg" :style="{ 'background-image': 'url(' + item.image + ')' }"></div>
+ <div class="carousel-caption">
+ <h2 class="carousel-title">{{ item.title }}</h2>
+ <p class="carousel-subtitle">{{ item.subtitle }}</p>
+ <p class="carousel-description">{{ item.description }}</p>
+ <div class="hero-buttons">
+ <router-link :to="productsUrl" class="btn btn-primary">了解产品</router-link>
+ <router-link :to="aboutUrl" class="btn btn-secondary">关于我们</router-link>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="carousel-controls">
+ <button class="carousel-btn prev" @click="prevSlide">‹</button>
+ <button class="carousel-btn next" @click="nextSlide">›</button>
+ </div>
+ <div class="carousel-indicators">
+ <span
+ v-for="(item, index) in carouselItems"
+ :key="index"
+ :class="{ active: index === currentSlide }"
+ @click="goToSlide(index)"
+ ></span>
+ </div>
+ </div>
+ </section>
+
+ <!-- 公告 -->
+ <section v-if="boot.showNotice && boot.notice" class="notice-strip">
+ <div class="container">
+ <div class="hd-notice">
+ <i class="mdi mdi-bullhorn"></i>
+ <div class="txt">{{ boot.notice }}</div>
+ </div>
+ </div>
+ </section>
+
+ <!-- 套餐区(hosting_shop 插件) -->
+ <section v-if="boot.showPlans !== false && boot.hasShop" class="plans-section section">
+ <div class="container">
+ <div class="section-header">
+ <h2 class="section-title">选择适合的套餐</h2>
+ <p class="section-subtitle">按需选择,随时升级。价格透明,开通简单。</p>
+ </div>
+ <div v-if="plans.length === 0" class="hd-empty">
+ <i class="mdi mdi-package-variant"></i>
+ <p>暂无可购买套餐,请联系管理员</p>
+ </div>
+ <div v-else class="hd-plans">
+ <div
+ v-for="(plan, i) in plans.slice(0, 3)"
+ :key="plan.id"
+ class="hd-plan-card"
+ :class="{ pop: i === 1 }"
+ >
+ <div class="hd-plan-top">
+ <span v-if="i === 1" class="hd-plan-chip">推荐</span>
+ <h3>{{ plan.name }}</h3>
+ <div class="hd-plan-desc">{{ plan.desc || '适合中小站点快速上线' }}</div>
+ </div>
+ <div class="hd-plan-body">
+ <div class="hd-plan-price">
+ <div class="num">{{ plan.price }}</div>
+ <div class="sub">含基础资源与自动开通</div>
+ </div>
+ <ul class="hd-plan-feats">
+ <li v-for="feat in plan.feats" :key="feat"><span class="ok">✓</span>{{ feat }}</li>
+ <li v-if="!plan.feats || plan.feats.length === 0"><span class="ok">✓</span>高性能节点资源</li>
+ <li v-if="!plan.feats || plan.feats.length === 0"><span class="ok">✓</span>一键开通部署</li>
+ </ul>
+ <t-button block theme="primary" size="large" @click="$router.push('/shop/order/' + plan.id)">立即购买</t-button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <!-- 核心优势 -->
+ <section class="features section">
+ <div class="container">
+ <div class="section-header">
+ <h2 class="section-title">核心优势</h2>
+ <p class="section-subtitle">我们专注于为客户提供稳定可靠的虚拟主机与云计算服务</p>
+ </div>
+ <div class="features-grid">
+ <div v-for="f in features" :key="f.title" class="feature-card">
+ <div class="feature-icon"><i :class="'mdi ' + f.icon"></i></div>
+ <h3>{{ f.title }}</h3>
+ <p>{{ f.desc }}</p>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <!-- 新闻预览(official_site 插件) -->
+ <section v-if="boot.hasSite" class="news-preview section">
+ <div class="container">
+ <div class="section-header">
+ <h2 class="section-title">新闻资讯</h2>
+ <p class="section-subtitle">了解平台最新动态与发展历程</p>
+ <router-link to="/site/news" class="more-news">查看更多新闻 ›</router-link>
+ </div>
+ <div v-if="newsList.length === 0" class="hd-empty">
+ <i class="mdi mdi-newspaper-variant-outline"></i>
+ <p>暂无资讯</p>
+ </div>
+ <div v-else class="news-grid">
+ <div v-for="n in newsList" :key="n.id" class="news-card" @click="$router.push('/site/news/' + n.id)">
+ <div class="news-date">{{ formatDate(n.created_at) }}</div>
+ <h3 class="news-title">{{ n.title }}</h3>
+ <p class="news-excerpt">{{ excerpt(n.content) }}</p>
+ <span class="read-more">阅读更多</span>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <!-- 客户评价 -->
+ <section class="testimonials section">
+ <div class="container">
+ <div class="section-header">
+ <h2 class="section-title">客户评价</h2>
+ <p class="section-subtitle">听听我们的客户怎么说</p>
+ </div>
+ <div class="testimonials-grid">
+ <div v-for="t in testimonials" :key="t.name" class="testimonial-card">
+ <div class="testimonial-header">
+ <div class="client-avatar">
+ <div class="avatar-placeholder">{{ t.name.slice(0, 1) }}</div>
+ </div>
+ <div class="client-details">
+ <div class="client-name">{{ t.name }}</div>
+ <div class="client-title">{{ t.role }}</div>
+ </div>
+ </div>
+ <p class="testimonial-text">"{{ t.text }}"</p>
+ <i class="mdi mdi-format-quote-close quote-icon"></i>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <!-- 底部 CTA -->
+ <section v-if="!authState.loggedIn && boot.hasUser" class="section">
+ <div class="container">
+ <div class="hd-cta">
+ <h3>准备好开始了吗?</h3>
+ <p>注册账户,立即体验高性能虚拟主机。</p>
+ <router-link to="/register" class="btn btn-light">免费注册</router-link>
+ </div>
+ </div>
+ </section>
+
+ <!-- 扩展区块 -->
+ <section v-for="block in boot.blocks" :key="block.id" class="section">
+ <div class="container">
+ <div v-if="block.title" class="section-header">
+ <h2 class="section-title">{{ block.title }}</h2>
+ </div>
+ <div v-html="block.html"></div>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted, onUnmounted } from 'vue'
+import authState from '@/home/store/auth'
+import { getSiteNews } from '@/home/api/site'
+import { formatDate } from '@/home/utils/format'
+import bg1 from '@/shared/assets/bg1.jpg'
+import bg2 from '@/shared/assets/bg2.jpg'
+import bg3 from '@/shared/assets/bg3.jpg'
+
+const boot = window.__TD_BOOT__ || {}
+
+const plans = computed(() => boot.plans || [])
+
+// hero 按钮路由:优先官网产品页,无官网插件则回退套餐/登录
+const productsUrl = computed(() =>
+ boot.hasSite ? '/site/products' : (boot.hasShop ? '/shop' : '/')
+)
+const aboutUrl = computed(() =>
+ boot.hasSite ? '/about'
+ : (boot.hasUser ? (authState.loggedIn ? '/profile' : '/login') : '/')
+)
+
+const carouselItems = [
+ {
+ title: '高性能虚拟主机',
+ subtitle: '即买即用 · 自动开通 · 秒级部署',
+ description: '全 SSD 存储与 BGP 多线接入,支付完成后自动开通,分钟级上线,为企业和开发者打造稳定高效的主机平台。',
+ image: bg1,
+ },
+ {
+ title: '专业团队支持',
+ subtitle: '7×24 小时全天候技术支持',
+ description: '经验丰富的运维与开发团队随时待命,从建站到运维全程护航,让您专注于业务本身。',
+ image: bg2,
+ },
+ {
+ title: '企业级安全防护',
+ subtitle: 'DDoS 清洗 · WAF 规则 · 每日备份',
+ description: '内置安全防护体系与自动备份能力,SSL 一键签发,全面保障您的数据与业务安全。',
+ image: bg3,
+ },
+]
+
+const currentSlide = ref(0)
+let timer = null
+
+function nextSlide() {
+ currentSlide.value = (currentSlide.value + 1) % carouselItems.length
+}
+function prevSlide() {
+ currentSlide.value = (currentSlide.value - 1 + carouselItems.length) % carouselItems.length
+}
+function goToSlide(index) {
+ currentSlide.value = index
+}
+function startAutoPlay() {
+ stopAutoPlay()
+ timer = setInterval(nextSlide, 5000)
+}
+function stopAutoPlay() {
+ if (timer) {
+ clearInterval(timer)
+ timer = null
+ }
+}
+
+const features = [
+ { icon: 'mdi-shield-check', title: '稳定可靠', desc: '企业级硬件架构与 BGP 多线接入,SLA 99.9% 保障,网站始终在线。' },
+ { icon: 'mdi-rocket-launch-outline', title: '极速开通', desc: '支付成功自动开通主机,分钟级上线,无需等待人工处理。' },
+ { icon: 'mdi-headset', title: '专业服务', desc: '7×24 小时技术支持,从建站到运维全程护航,问题快速响应。' },
+]
+
+const newsList = ref([])
+
+function excerpt(html, len = 72) {
+ if (!html) return ''
+ const text = String(html).replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
+ return text.length > len ? text.slice(0, len) + '…' : text
+}
+
+const testimonials = [
+ { name: '张先生', role: '个人站长', text: '从下单到开通不到一分钟,面板操作也很顺手,续费两年了一直很稳定。' },
+ { name: '李女士', role: '电商创业者', text: '网站迁移过来后访问速度明显提升,客服响应很快,问题当天就解决了。' },
+ { name: '陈先生', role: '企业运维', text: '自动备份和 SSL 功能非常省心,售后工单处理专业,值得信赖。' },
+]
+
+onMounted(async () => {
+ startAutoPlay()
+ if (boot.hasSite) {
+ const res = await getSiteNews({ page: 1, perPage: 3 })
+ if (res.ok && res.data?.news) {
+ newsList.value = res.data.news
+ }
+ }
+})
+onUnmounted(stopAutoPlay)
+</script>
diff --git a/templates/tdesign/spa/src/home/views/auth/LoginView.vue b/templates/tdesign/spa/src/home/views/auth/LoginView.vue
new file mode 100644
index 0000000..542daee
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/auth/LoginView.vue
@@ -0,0 +1,76 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container">
+ <div class="hd-auth-wrap">
+ <h1 class="hd-auth-title">登录</h1>
+ <p class="hd-auth-sub">使用账号密码登录您的账户</p>
+
+ <div class="hd-card">
+ <div class="hd-card-body" style="padding:24px 28px;">
+
+ <t-alert v-if="errorMsg" theme="error" :message="errorMsg" style="margin-bottom:16px;" close @close="errorMsg=''" />
+
+ <t-form ref="formRef" :data="formData" :rules="rules" label-align="top" @submit="onSubmit">
+ <t-form-item label="用户名" name="username">
+ <t-input v-model="formData.username" size="large" placeholder="请输入用户名" clearable />
+ </t-form-item>
+ <t-form-item label="密码" name="password">
+ <t-input v-model="formData.password" size="large" type="password" placeholder="请输入密码" clearable />
+ </t-form-item>
+ <t-form-item>
+ <t-button block size="large" theme="primary" type="submit" :loading="loading">登录</t-button>
+ </t-form-item>
+ </t-form>
+
+ </div>
+ </div>
+
+ <div class="hd-auth-foot">
+ 还没有账户?
+ <router-link to="/register">立即注册</router-link>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive } from 'vue'
+import { useRouter } from 'vue-router'
+import { MessagePlugin } from 'tdesign-vue-next'
+import { login } from '@/home/api/account'
+import { initAuth } from '@/home/store/auth'
+
+const router = useRouter()
+const formRef = ref(null)
+const loading = ref(false)
+const errorMsg = ref('')
+
+const formData = reactive({
+ username: '',
+ password: '',
+})
+
+const rules = {
+ username: [{ required: true, message: '请输入用户名' }],
+ password: [{ required: true, message: '请输入密码' }],
+}
+
+async function onSubmit({ validateResult }) {
+ if (validateResult !== true) return
+ loading.value = true
+ errorMsg.value = ''
+ try {
+ const res = await login(formData.username, formData.password)
+ if (res.ok) {
+ MessagePlugin.success('登录成功')
+ await initAuth()
+ router.push('/')
+ } else {
+ errorMsg.value = res.message || '登录失败'
+ }
+ } finally {
+ loading.value = false
+ }
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/views/auth/PasswordView.vue b/templates/tdesign/spa/src/home/views/auth/PasswordView.vue
new file mode 100644
index 0000000..809fa4c
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/auth/PasswordView.vue
@@ -0,0 +1,89 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container" style="max-width:540px;">
+ <div class="hd-page-head">
+ <div>
+ <h1 class="hd-page-title">修改密码</h1>
+ <p class="hd-page-subtitle">修改后需要重新登录</p>
+ </div>
+ </div>
+
+ <t-alert v-if="errorMsg" theme="error" :message="errorMsg" style="margin-bottom:16px;" close @close="errorMsg=''" />
+
+ <div class="hd-card">
+ <div class="hd-card-body" style="padding:24px 28px;">
+ <t-form ref="formRef" :data="formData" :rules="rules" label-align="top" @submit="onSubmit">
+ <t-form-item label="原密码" name="old_password">
+ <t-input v-model="formData.old_password" size="large" type="password" placeholder="请输入原密码" clearable />
+ </t-form-item>
+ <t-form-item label="新密码" name="new_password">
+ <t-input v-model="formData.new_password" size="large" type="password" placeholder="至少 6 个字符" clearable />
+ </t-form-item>
+ <t-form-item label="确认新密码" name="new_password2">
+ <t-input v-model="formData.new_password2" size="large" type="password" placeholder="请再次输入新密码" clearable />
+ </t-form-item>
+ <t-form-item>
+ <t-button theme="primary" type="submit" :loading="loading">修改密码</t-button>
+ </t-form-item>
+ </t-form>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive } from 'vue'
+import { useRouter } from 'vue-router'
+import { MessagePlugin } from 'tdesign-vue-next'
+import { changePassword } from '@/home/api/account'
+import { resetAuth } from '@/home/store/auth'
+
+const router = useRouter()
+const formRef = ref(null)
+const loading = ref(false)
+const errorMsg = ref('')
+
+const formData = reactive({
+ old_password: '',
+ new_password: '',
+ new_password2: '',
+})
+
+const rules = {
+ old_password: [{ required: true, message: '请输入原密码' }],
+ new_password: [
+ { required: true, message: '请输入新密码' },
+ { min: 6, message: '新密码至少 6 个字符' },
+ ],
+ new_password2: [
+ { required: true, message: '请确认新密码' },
+ {
+ validator: (val) => val === formData.new_password,
+ message: '两次输入的新密码不一致',
+ },
+ ],
+}
+
+async function onSubmit({ validateResult }) {
+ if (validateResult !== true) return
+ loading.value = true
+ errorMsg.value = ''
+ try {
+ const res = await changePassword({
+ old_password: formData.old_password,
+ new_password: formData.new_password,
+ new_password2: formData.new_password2,
+ })
+ if (res.ok) {
+ MessagePlugin.success('密码修改成功,请重新登录')
+ resetAuth()
+ router.push('/login')
+ } else {
+ errorMsg.value = res.message || '修改失败'
+ }
+ } finally {
+ loading.value = false
+ }
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/views/auth/ProfileView.vue b/templates/tdesign/spa/src/home/views/auth/ProfileView.vue
new file mode 100644
index 0000000..22b52cd
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/auth/ProfileView.vue
@@ -0,0 +1,83 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container" style="max-width:680px;">
+ <div class="hd-page-head">
+ <div>
+ <h1 class="hd-page-title">个人信息</h1>
+ <p class="hd-page-subtitle">管理您的账户资料</p>
+ </div>
+ </div>
+
+ <t-alert v-if="errorMsg" theme="error" :message="errorMsg" style="margin-bottom:16px;" close @close="errorMsg=''" />
+
+ <div class="hd-card">
+ <div class="hd-card-body" style="padding:24px 28px;">
+ <t-form ref="formRef" :data="formData" :rules="rules" label-align="top" @submit="onSubmit">
+ <t-form-item label="用户名">
+ <t-input :value="user.username" size="large" disabled />
+ <template #help>用户名不可修改</template>
+ </t-form-item>
+ <t-form-item label="邮箱" name="email">
+ <t-input v-model="formData.email" size="large" placeholder="your@email.com" clearable />
+ </t-form-item>
+ <t-form-item label="QQ" name="qq">
+ <t-input v-model="formData.qq" size="large" placeholder="123456789" clearable />
+ </t-form-item>
+ <t-form-item label="注册时间">
+ <t-input :value="user.created_at || '-'" size="large" disabled />
+ </t-form-item>
+ <t-form-item>
+ <t-button theme="primary" type="submit" :loading="loading">保存</t-button>
+ <t-button variant="outline" theme="default" style="margin-left:10px;" @click="$router.push('/password')">修改密码</t-button>
+ </t-form-item>
+ </t-form>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive, computed } from 'vue'
+import { MessagePlugin } from 'tdesign-vue-next'
+import { updateProfile } from '@/home/api/account'
+import { initAuth } from '@/home/store/auth'
+import authState from '@/home/store/auth'
+
+const formRef = ref(null)
+const loading = ref(false)
+const errorMsg = ref('')
+
+const user = computed(() => authState.user || {})
+
+const formData = reactive({
+ email: user.value.email || '',
+ qq: user.value.qq || '',
+})
+
+const rules = {
+ email: [
+ { validator: (val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), message: '邮箱格式不正确' },
+ ],
+ qq: [
+ { validator: (val) => !val || /^[0-9]{5,12}$/.test(val), message: 'QQ 号格式不正确' },
+ ],
+}
+
+async function onSubmit({ validateResult }) {
+ if (validateResult !== true) return
+ loading.value = true
+ errorMsg.value = ''
+ try {
+ const res = await updateProfile(formData.email, formData.qq)
+ if (res.ok) {
+ MessagePlugin.success('保存成功')
+ await initAuth()
+ } else {
+ errorMsg.value = res.message || '保存失败'
+ }
+ } finally {
+ loading.value = false
+ }
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/views/auth/RegisterView.vue b/templates/tdesign/spa/src/home/views/auth/RegisterView.vue
new file mode 100644
index 0000000..86b1422
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/auth/RegisterView.vue
@@ -0,0 +1,107 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container">
+ <div class="hd-auth-wrap">
+ <h1 class="hd-auth-title">注册</h1>
+ <p class="hd-auth-sub">创建您的账户,开启主机之旅</p>
+
+ <div class="hd-card">
+ <div class="hd-card-body" style="padding:24px 28px;">
+
+ <t-alert v-if="errorMsg" theme="error" :message="errorMsg" style="margin-bottom:16px;" close @close="errorMsg=''" />
+
+ <t-form ref="formRef" :data="formData" :rules="rules" label-align="top" @submit="onSubmit">
+ <t-form-item label="用户名" name="username">
+ <t-input v-model="formData.username" size="large" placeholder="3~32 位字母、数字或下划线" clearable />
+ </t-form-item>
+ <t-form-item label="密码" name="password">
+ <t-input v-model="formData.password" size="large" type="password" placeholder="至少 6 个字符" clearable />
+ </t-form-item>
+ <t-form-item label="确认密码" name="password2">
+ <t-input v-model="formData.password2" size="large" type="password" placeholder="请再次输入密码" clearable />
+ </t-form-item>
+ <t-form-item label="邮箱(选填)" name="email">
+ <t-input v-model="formData.email" size="large" placeholder="your@email.com" clearable />
+ </t-form-item>
+ <t-form-item label="QQ(选填)" name="qq">
+ <t-input v-model="formData.qq" size="large" placeholder="123456789" clearable />
+ </t-form-item>
+ <t-form-item>
+ <t-button block size="large" theme="primary" type="submit" :loading="loading">注册</t-button>
+ </t-form-item>
+ </t-form>
+
+ </div>
+ </div>
+
+ <div class="hd-auth-foot">
+ 已有账户?
+ <router-link to="/login">立即登录</router-link>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive } from 'vue'
+import { useRouter } from 'vue-router'
+import { MessagePlugin } from 'tdesign-vue-next'
+import { register } from '@/home/api/account'
+import { initAuth } from '@/home/store/auth'
+
+const router = useRouter()
+const formRef = ref(null)
+const loading = ref(false)
+const errorMsg = ref('')
+
+const formData = reactive({
+ username: '',
+ password: '',
+ password2: '',
+ email: '',
+ qq: '',
+})
+
+const rules = {
+ username: [
+ { required: true, message: '请输入用户名' },
+ { pattern: /^[a-zA-Z0-9_]{3,32}$/, message: '3~32 位字母、数字或下划线' },
+ ],
+ password: [
+ { required: true, message: '请输入密码' },
+ { min: 6, message: '密码至少 6 个字符' },
+ ],
+ password2: [
+ { required: true, message: '请确认密码' },
+ {
+ validator: (val) => val === formData.password,
+ message: '两次输入的密码不一致',
+ },
+ ],
+}
+
+async function onSubmit({ validateResult }) {
+ if (validateResult !== true) return
+ loading.value = true
+ errorMsg.value = ''
+ try {
+ const res = await register({
+ username: formData.username,
+ password: formData.password,
+ password2: formData.password2,
+ email: formData.email,
+ qq: formData.qq,
+ })
+ if (res.ok) {
+ MessagePlugin.success('注册成功')
+ await initAuth()
+ router.push('/')
+ } else {
+ errorMsg.value = res.message || '注册失败'
+ }
+ } finally {
+ loading.value = false
+ }
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/views/balance/BalanceView.vue b/templates/tdesign/spa/src/home/views/balance/BalanceView.vue
new file mode 100644
index 0000000..758f51b
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/balance/BalanceView.vue
@@ -0,0 +1,103 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container" style="max-width:720px;">
+ <div class="hd-page-head">
+ <div>
+ <h1 class="hd-page-title">我的余额</h1>
+ <p class="hd-page-subtitle">查看余额和流水记录</p>
+ </div>
+ <t-button theme="primary" @click="$router.push('/balance/recharge')">
+ <i class="mdi mdi-plus"></i> 充值
+ </t-button>
+ </div>
+
+ <t-loading :loading="loading" size="large">
+ <div class="hd-balance-card" style="margin-bottom:20px;">
+ <div>
+ <div class="label">账户余额</div>
+ <div class="value">¥{{ balanceYuan }}</div>
+ </div>
+ <div class="hd-balance-actions">
+ <t-button theme="default" variant="outline" @click="$router.push('/balance/recharge')">
+ <i class="mdi mdi-plus"></i> 充值
+ </t-button>
+ </div>
+ </div>
+
+ <div class="hd-card">
+ <div class="hd-card-body" style="padding:0;">
+ <t-table
+ :data="logs"
+ :columns="columns"
+ row-key="id"
+ hover
+ size="medium"
+ />
+ </div>
+ </div>
+
+ <div v-if="logs.length === 0 && !loading" class="hd-empty" style="margin-top:16px;">
+ <i class="mdi mdi-history"></i>
+ <p>暂无流水记录</p>
+ </div>
+
+ <div style="display:flex;justify-content:center;margin-top:16px;">
+ <t-pagination
+ v-if="total > 0"
+ :current="page"
+ :total="total"
+ :page-size="perPage"
+ @change="onPageChange"
+ />
+ </div>
+ </t-loading>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted, h } from 'vue'
+import { getBalanceInfo } from '@/home/api/balance'
+import { centsToYuan, logTypeMap } from '@/home/utils/format'
+
+const loading = ref(true)
+const balanceYuan = ref('0.00')
+const logs = ref([])
+const total = ref(0)
+const page = ref(1)
+const perPage = ref(15)
+
+const columns = [
+ { colKey: 'type', title: '类型', width: 80, cell: (_h, { row }) => {
+ const s = logTypeMap[row.type] || { label: row.type, theme: 'default' }
+ return h('t-tag', { theme: s.theme, size: 'small' }, () => s.label)
+ } },
+ { colKey: 'amount', title: '金额', width: 110, cell: (_h, { row }) => {
+ const sign = (row.amount || 0) > 0 ? '+' : ''
+ return sign + '¥' + centsToYuan(row.amount || 0)
+ } },
+ { colKey: 'balance_after', title: '余额', width: 110, cell: (_h, { row }) => '¥' + centsToYuan(row.balance_after || 0) },
+ { colKey: 'remark', title: '备注', ellipsis: true, cell: (_h, { row }) => row.remark || '-' },
+ { colKey: 'created_at', title: '时间', width: 160 },
+]
+
+async function fetchData() {
+ loading.value = true
+ const res = await getBalanceInfo(page.value, perPage.value)
+ if (res.ok && res.data) {
+ balanceYuan.value = res.data.balance_yuan || '0.00'
+ if (res.data.logs) {
+ logs.value = res.data.logs.list || []
+ total.value = res.data.logs.total || 0
+ }
+ }
+ loading.value = false
+}
+
+function onPageChange(p) {
+ page.value = p
+ fetchData()
+}
+
+onMounted(fetchData)
+</script>
diff --git a/templates/tdesign/spa/src/home/views/balance/RechargeView.vue b/templates/tdesign/spa/src/home/views/balance/RechargeView.vue
new file mode 100644
index 0000000..13ea19c
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/balance/RechargeView.vue
@@ -0,0 +1,118 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container" style="max-width:560px;">
+ <t-button variant="text" style="margin-bottom:12px;" @click="$router.push('/balance')">
+ <i class="mdi mdi-arrow-left"></i> 返回余额页
+ </t-button>
+
+ <h1 class="hd-page-title" style="margin-bottom:4px;">余额充值</h1>
+ <p class="hd-page-subtitle" style="margin-bottom:18px;">选择支付方式并输入充值金额</p>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="methods.length === 0 && !loading" class="hd-empty">
+ <i class="mdi mdi-credit-card-outline"></i>
+ <p>暂无可用的支付方式,请联系管理员启用支付插件</p>
+ </div>
+
+ <div v-else class="hd-card">
+ <div class="hd-card-body" style="padding:24px 28px;">
+
+ <t-alert v-if="errorMsg" theme="error" :message="errorMsg" style="margin-bottom:16px;" close @close="errorMsg=''" />
+
+ <t-form ref="formRef" :data="formData" :rules="rules" label-align="top" @submit="onSubmit">
+ <t-form-item label="支付方式" name="type">
+ <t-radio-group v-model="formData.type" style="display:flex;flex-wrap:wrap;gap:8px;">
+ <t-radio-button v-for="m in methods" :key="m.plugin + '__' + m.method" :value="m.plugin + '__' + m.method">
+ <i v-if="m.icon" :class="'mdi ' + m.icon" style="margin-right:4px;"></i>
+ {{ m.display_name || (m.plugin + '/' + m.method) }}
+ </t-radio-button>
+ </t-radio-group>
+ </t-form-item>
+
+ <t-form-item label="充值金额(元)" name="amount">
+ <t-input-number
+ v-model="formData.amount"
+ size="large"
+ :min="1"
+ :max="50000"
+ :decimal-places="2"
+ placeholder="最低 1 元"
+ style="width:100%;"
+ />
+ </t-form-item>
+
+ <div style="display:flex;gap:8px;margin-bottom:20px;flex-wrap:wrap;">
+ <t-button v-for="v in quickAmounts" :key="v" size="small" variant="outline" @click="formData.amount = v">{{ v }} 元</t-button>
+ </div>
+
+ <t-form-item>
+ <t-button size="large" block theme="primary" type="submit" :loading="submitting">立即充值</t-button>
+ </t-form-item>
+ </t-form>
+
+ </div>
+ </div>
+ </t-loading>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive, onMounted } from 'vue'
+import { MessagePlugin } from 'tdesign-vue-next'
+import { getBalanceMethods, createRecharge } from '@/home/api/balance'
+
+const loading = ref(true)
+const submitting = ref(false)
+const errorMsg = ref('')
+const methods = ref([])
+const formRef = ref(null)
+const quickAmounts = [10, 50, 100, 500]
+
+const formData = reactive({
+ type: '',
+ amount: 10,
+})
+
+const rules = {
+ type: [{ required: true, message: '请选择支付方式' }],
+ amount: [
+ { required: true, message: '请输入充值金额' },
+ { validator: (val) => val >= 1, message: '充值金额至少 1 元' },
+ { validator: (val) => val <= 50000, message: '单次充值金额不能超过 50000 元' },
+ ],
+}
+
+onMounted(async () => {
+ const res = await getBalanceMethods()
+ if (res.ok && res.data?.methods) {
+ methods.value = res.data.methods
+ if (methods.value.length > 0) {
+ formData.type = methods.value[0].plugin + '__' + methods.value[0].method
+ }
+ }
+ loading.value = false
+})
+
+async function onSubmit({ validateResult }) {
+ if (validateResult !== true) return
+ submitting.value = true
+ errorMsg.value = ''
+ try {
+ const res = await createRecharge(formData.amount, formData.type)
+ if (res.ok) {
+ if (res.data?.html) {
+ document.open()
+ document.write(res.data.html)
+ document.close()
+ } else {
+ MessagePlugin.success('充值订单已创建')
+ }
+ } else {
+ errorMsg.value = res.message || '创建充值订单失败'
+ }
+ } finally {
+ submitting.value = false
+ }
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/views/shop/AssetsView.vue b/templates/tdesign/spa/src/home/views/shop/AssetsView.vue
new file mode 100644
index 0000000..a83ea68
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/shop/AssetsView.vue
@@ -0,0 +1,61 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container">
+ <div class="hd-page-head">
+ <div>
+ <h1 class="hd-page-title">我的主机</h1>
+ <p class="hd-page-subtitle">查看已开通的主机资产</p>
+ </div>
+ </div>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="assets.length === 0 && !loading" class="hd-empty">
+ <i class="mdi mdi-server"></i>
+ <p>暂无主机资产</p>
+ <t-button style="margin-top:12px;" theme="primary" variant="outline" @click="$router.push('/shop')">去购买</t-button>
+ </div>
+
+ <div v-else>
+ <div v-for="a in assets" :key="a.id" class="hd-card" style="margin-bottom:14px;">
+ <div class="hd-card-body" style="padding:18px 22px;">
+ <div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;">
+ <div>
+ <h4 style="margin:0 0 4px;font-size:15px;">{{ a.plan_name || '—' }}</h4>
+ <div style="font-size:13px;color:var(--hd-text-2);">
+ 账号:{{ a.host_user || '—' }}
+ </div>
+ </div>
+ <div style="display:flex;align-items:center;gap:10px;">
+ <t-tag :theme="(assetStatusMap[a.status] || {}).theme || 'default'" size="small">
+ {{ (assetStatusMap[a.status] || {}).label || a.status || '—' }}
+ </t-tag>
+ </div>
+ </div>
+ <div style="display:flex;gap:20px;margin-top:12px;flex-wrap:wrap;font-size:13px;color:var(--hd-text-3);">
+ <span>到期:{{ a.expire_at || '—' }}</span>
+ <span v-if="a.host_qk">状态:{{ a.host_qk }}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </t-loading>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue'
+import { getAssets } from '@/home/api/shop'
+import { assetStatusMap } from '@/home/utils/format'
+
+const loading = ref(true)
+const assets = ref([])
+
+onMounted(async () => {
+ const res = await getAssets()
+ if (res.ok && res.data?.assets) {
+ assets.value = res.data.assets
+ }
+ loading.value = false
+})
+</script>
diff --git a/templates/tdesign/spa/src/home/views/shop/OrderView.vue b/templates/tdesign/spa/src/home/views/shop/OrderView.vue
new file mode 100644
index 0000000..318cddf
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/shop/OrderView.vue
@@ -0,0 +1,171 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container" style="max-width:720px;">
+ <t-button variant="text" style="margin-bottom:12px;" @click="$router.push('/shop')">
+ <i class="mdi mdi-arrow-left"></i> 返回套餐列表
+ </t-button>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="plan">
+ <h1 class="hd-page-title" style="margin-bottom:4px;">购买:{{ plan.name }}</h1>
+ <p class="hd-page-subtitle" style="margin-bottom:18px;">选择周期和支付方式</p>
+
+ <div class="hd-card" style="margin-bottom:16px;">
+ <div class="hd-card-body" style="padding:20px 24px;">
+ <h4 style="margin:0 0 12px;font-size:14px;color:var(--hd-text-2);">套餐规格</h4>
+ <div style="display:grid;grid-template-columns:repeat(4,1fr);gap:12px;">
+ <div style="text-align:center;padding:10px;background:var(--hd-bg);border-radius:8px;">
+ <div style="font-size:12px;color:var(--hd-text-3);">网页空间</div>
+ <div style="font-weight:700;font-size:15px;">{{ plan.spec_web }} MB</div>
+ </div>
+ <div style="text-align:center;padding:10px;background:var(--hd-bg);border-radius:8px;">
+ <div style="font-size:12px;color:var(--hd-text-3);">数据库</div>
+ <div style="font-weight:700;font-size:15px;">{{ plan.spec_sql }} MB</div>
+ </div>
+ <div style="text-align:center;padding:10px;background:var(--hd-bg);border-radius:8px;">
+ <div style="font-size:12px;color:var(--hd-text-3);">流量</div>
+ <div style="font-weight:700;font-size:15px;">{{ plan.spec_flow > 0 ? plan.spec_flow + ' GB' : '不限' }}</div>
+ </div>
+ <div style="text-align:center;padding:10px;background:var(--hd-bg);border-radius:8px;">
+ <div style="font-size:12px;color:var(--hd-text-3);">域名</div>
+ <div style="font-weight:700;font-size:15px;">{{ plan.spec_domain }} 个</div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="hd-card">
+ <div class="hd-card-body" style="padding:24px;">
+
+ <t-alert v-if="errorMsg" theme="error" :message="errorMsg" style="margin-bottom:16px;" close @close="errorMsg=''" />
+
+ <t-form ref="formRef" :data="formData" :rules="rules" label-align="top" @submit="onSubmit">
+ <t-form-item label="购买周期" name="period">
+ <t-radio-group v-model="formData.period" style="display:flex;flex-wrap:wrap;gap:8px;">
+ <t-radio-button v-for="p in plan.periods" :key="p" :value="p">
+ {{ periodLabels[p] || p }}
+ <span style="margin-left:4px;font-weight:600;">
+ ¥{{ centsToYuan(plan.prices[p] || 0) }}
+ </span>
+ </t-radio-button>
+ </t-radio-group>
+ </t-form-item>
+
+ <t-form-item v-if="!isFreeSelected" label="支付方式" name="type">
+ <t-radio-group v-if="methods.length" v-model="formData.type" style="display:flex;flex-wrap:wrap;gap:8px;">
+ <t-radio-button v-for="m in methods" :key="m.plugin + '__' + m.method" :value="m.plugin + '__' + m.method">
+ <i v-if="m.icon" :class="'mdi ' + m.icon" style="margin-right:4px;"></i>
+ {{ m.display_name || (m.plugin + '/' + m.method) }}
+ </t-radio-button>
+ </t-radio-group>
+ <div v-else style="color:var(--hd-text-3);font-size:13px;">暂无可用的支付方式</div>
+ </t-form-item>
+
+ <t-form-item v-if="isFreeSelected">
+ <t-tag theme="success" size="medium">免费套餐,无需支付</t-tag>
+ </t-form-item>
+
+ <t-form-item>
+ <t-button size="large" theme="primary" type="submit" :loading="submitting" :disabled="!canSubmit">
+ {{ isFreeSelected ? '立即开通' : '确认购买' }}
+ </t-button>
+ </t-form-item>
+ </t-form>
+
+ </div>
+ </div>
+ </div>
+ </t-loading>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive, computed, onMounted } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import { MessagePlugin } from 'tdesign-vue-next'
+import { getPlan, createOrder } from '@/home/api/shop'
+import { centsToYuan, periodLabels } from '@/home/utils/format'
+
+const route = useRoute()
+const router = useRouter()
+const planId = computed(() => parseInt(route.params.planId) || 0)
+const loading = ref(true)
+const submitting = ref(false)
+const errorMsg = ref('')
+const plan = ref(null)
+const methods = ref([])
+const formRef = ref(null)
+
+const formData = reactive({
+ period: '',
+ type: '',
+})
+
+const rules = {
+ period: [{ required: true, message: '请选择购买周期' }],
+ type: [
+ {
+ validator: () => {
+ if (isFreeSelected.value) return true
+ return formData.type !== ''
+ },
+ message: '请选择支付方式',
+ },
+ ],
+}
+
+const isFreeSelected = computed(() => {
+ if (!plan.value || !formData.period) return false
+ const price = (plan.value.prices || {})[formData.period] || 0
+ return price === 0
+})
+
+const canSubmit = computed(() => {
+ if (!formData.period) return false
+ if (isFreeSelected.value) return true
+ return formData.type !== '' && methods.value.length > 0
+})
+
+onMounted(async () => {
+ if (!planId.value) return
+ const res = await getPlan(planId.value)
+ if (res.ok && res.data?.plan) {
+ plan.value = res.data.plan
+ methods.value = res.data.methods || []
+ if (plan.value.periods && plan.value.periods.length > 0) {
+ formData.period = plan.value.periods[0]
+ }
+ if (methods.value.length > 0) {
+ formData.type = methods.value[0].plugin + '__' + methods.value[0].method
+ }
+ }
+ loading.value = false
+})
+
+async function onSubmit({ validateResult }) {
+ if (validateResult !== true) return
+ submitting.value = true
+ errorMsg.value = ''
+ try {
+ const res = await createOrder(planId.value, formData.period, formData.type)
+ if (res.ok) {
+ // 支付跳转:有 html 则填页面跳转,有 redirect 则跳页面
+ if (res.data?.html) {
+ document.open()
+ document.write(res.data.html)
+ document.close()
+ } else if (res.data?.redirect) {
+ router.push(res.data.redirect)
+ } else {
+ MessagePlugin.success('操作成功')
+ router.push('/shop/assets')
+ }
+ } else {
+ errorMsg.value = res.message || '操作失败'
+ }
+ } finally {
+ submitting.value = false
+ }
+}
+</script>
diff --git a/templates/tdesign/spa/src/home/views/shop/OrdersView.vue b/templates/tdesign/spa/src/home/views/shop/OrdersView.vue
new file mode 100644
index 0000000..a146807
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/shop/OrdersView.vue
@@ -0,0 +1,86 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container">
+ <div class="hd-page-head">
+ <div>
+ <h1 class="hd-page-title">我的订单</h1>
+ <p class="hd-page-subtitle">查看购买记录和状态</p>
+ </div>
+ </div>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="orders.length === 0 && !loading" class="hd-empty">
+ <i class="mdi mdi-receipt"></i>
+ <p>暂无订单</p>
+ </div>
+
+ <template v-else>
+ <div class="hd-card">
+ <t-table
+ :data="orders"
+ :columns="columns"
+ row-key="id"
+ hover
+ size="medium"
+ />
+ </div>
+ <div style="display:flex;justify-content:center;margin-top:16px;">
+ <t-pagination
+ v-if="total > 0"
+ :current="page"
+ :total="total"
+ :page-size="perPage"
+ @change="onPageChange"
+ />
+ </div>
+ </template>
+ </t-loading>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted, h } from 'vue'
+import { useRouter } from 'vue-router'
+import { getOrders } from '@/home/api/shop'
+import { centsToYuan, orderStatusMap } from '@/home/utils/format'
+
+const router = useRouter()
+const loading = ref(true)
+const orders = ref([])
+const total = ref(0)
+const page = ref(1)
+const perPage = ref(15)
+
+const columns = [
+ { colKey: 'order_no', title: '订单号', width: 200, ellipsis: true },
+ { colKey: 'plan_name', title: '套餐', ellipsis: true },
+ { colKey: 'period', title: '周期', width: 100, cell: (_h, { row }) => {
+ const map = { month: '月付', quarter: '季付', half_year: '半年付', year: '年付', two_year: '两年付', three_year: '三年付' }
+ return map[row.period] || row.period || '-'
+ } },
+ { colKey: 'amount_cents', title: '金额', width: 100, cell: (_h, { row }) => '¥' + centsToYuan(row.amount_cents || 0) },
+ { colKey: 'status', title: '状态', width: 90, cell: (_h, { row }) => {
+ const s = orderStatusMap[row.status] || { label: row.status, theme: 'default' }
+ return h('t-tag', { theme: s.theme, size: 'small' }, () => s.label)
+ } },
+ { colKey: 'created_at', title: '时间', width: 160 },
+]
+
+async function fetchOrders() {
+ loading.value = true
+ const res = await getOrders(page.value, perPage.value)
+ if (res.ok && res.data?.orders) {
+ orders.value = res.data.orders.list || []
+ total.value = res.data.orders.total || 0
+ }
+ loading.value = false
+}
+
+function onPageChange(p) {
+ page.value = p
+ fetchOrders()
+}
+
+onMounted(fetchOrders)
+</script>
diff --git a/templates/tdesign/spa/src/home/views/shop/ShopView.vue b/templates/tdesign/spa/src/home/views/shop/ShopView.vue
new file mode 100644
index 0000000..fa01b87
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/shop/ShopView.vue
@@ -0,0 +1,71 @@
+<template>
+ <div class="hd-page">
+ <div class="hd-container">
+ <div class="hd-page-head">
+ <div>
+ <h1 class="hd-page-title">主机套餐</h1>
+ <p class="hd-page-subtitle">选择适合您的主机套餐,支付后自动开通</p>
+ </div>
+ </div>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="plans.length === 0 && !loading" class="hd-empty">
+ <i class="mdi mdi-package-variant"></i>
+ <p>暂无可购买套餐</p>
+ </div>
+ <div v-else class="hd-plans" style="grid-template-columns: repeat(3, 1fr);">
+ <div v-for="plan in plans" :key="plan.id" class="hd-plan-card">
+ <div class="hd-plan-top">
+ <h3>{{ plan.name }}</h3>
+ <div class="hd-plan-desc">{{ plan.description || '适合各类站点快速上线' }}</div>
+ </div>
+ <div class="hd-plan-body">
+ <div class="hd-plan-price">
+ <div class="num">{{ formatPrice(plan) }}</div>
+ <div class="sub">含基础资源与自动开通</div>
+ </div>
+ <ul class="hd-plan-feats">
+ <li v-if="plan.spec_web"><span class="ok">✓</span>网页空间 {{ plan.spec_web }} MB</li>
+ <li v-if="plan.spec_sql"><span class="ok">✓</span>数据库 {{ plan.spec_sql }} MB</li>
+ <li v-if="plan.spec_flow"><span class="ok">✓</span>月流量 {{ plan.spec_flow }} GB</li>
+ <li v-if="plan.spec_domain"><span class="ok">✓</span>可绑定 {{ plan.spec_domain }} 个域名</li>
+ </ul>
+ <t-button block theme="primary" @click="$router.push('/shop/order/' + plan.id)">立即购买</t-button>
+ </div>
+ </div>
+ </div>
+ </t-loading>
+ </div>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue'
+import { getPlans } from '@/home/api/shop'
+import { periodLabels } from '@/home/utils/format'
+
+const loading = ref(true)
+const plans = ref([])
+
+function formatPrice(plan) {
+ const minPrice = getMinPriceCents(plan)
+ return minPrice > 0 ? '¥' + (minPrice / 100).toFixed(2) + ' 起/月' : '免费'
+}
+
+function getMinPriceCents(plan) {
+ if (!plan.prices) return 0
+ let min = 0
+ for (const cents of Object.values(plan.prices)) {
+ if (cents > 0 && (min === 0 || cents < min)) min = cents
+ }
+ return min
+}
+
+onMounted(async () => {
+ const res = await getPlans()
+ if (res.ok && res.data?.plans) {
+ plans.value = res.data.plans
+ }
+ loading.value = false
+})
+</script>
diff --git a/templates/tdesign/spa/src/home/views/site/AboutView.vue b/templates/tdesign/spa/src/home/views/site/AboutView.vue
new file mode 100644
index 0000000..fd3479c
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/site/AboutView.vue
@@ -0,0 +1,359 @@
+<template>
+ <div class="site-about">
+ <section class="site-page-header" :style="{ backgroundImage: `url(${headerImage})` }">
+ <div class="hd-container">
+ <h1>关于我们</h1>
+ <p>了解 MNBT 的发展历程与使命愿景</p>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <div class="site-about-grid">
+ <div class="site-about-text">
+ <h2>平台简介</h2>
+ <p>
+ MNBT 是一家面向企业和开发者的云计算服务商,专注于虚拟主机、云服务器、域名与安全防护等基础设施服务。依托高性能节点与全自动化部署体系,帮助用户以极低的成本快速上线业务。
+ </p>
+ <p>我们坚持"稳定、安全、简单"的产品理念,通过持续的技术迭代和完善的售后服务,已为大量个人站长与中小企业提供可靠的托管服务。</p>
+ </div>
+ <div class="site-about-image">
+ <div class="site-ph">数据中心 · 高性能节点</div>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section class="site-sec site-sec--alt">
+ <div class="hd-container">
+ <div class="site-sec-head">
+ <div class="site-sec-tag">Mission & Vision</div>
+ <h2>使命与愿景</h2>
+ </div>
+ <div class="site-mv-grid">
+ <div class="site-mv-card">
+ <div class="site-mv-icon"><i class="mdi mdi-crosshairs-gps"></i></div>
+ <h3>我们的使命</h3>
+ <p>通过自动化的云基础设施与贴心的技术服务,让每一位用户都能低成本、高效率地构建和运营自己的网站与业务。</p>
+ <ul class="site-mv-list">
+ <li>提供开箱即用的一键部署能力</li>
+ <li>持续优化节点性能与稳定性</li>
+ <li>以用户价值为先,做长期可靠的伙伴</li>
+ </ul>
+ </div>
+ <div class="site-mv-card">
+ <div class="site-mv-icon"><i class="mdi mdi-rocket-launch-outline"></i></div>
+ <h3>我们的愿景</h3>
+ <p>成为国内领先的轻量云服务品牌,让建站与托管像水电一样简单可靠,助力数字世界的每个创意落地。</p>
+ <ul class="site-mv-list">
+ <li>打造普惠的云计算服务平台</li>
+ <li>建立覆盖全国的优质节点网络</li>
+ <li>构建开放、共赢的服务生态</li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <div class="site-sec-head">
+ <div class="site-sec-tag">Teams</div>
+ <h2>核心团队</h2>
+ <p>由基础设施专家、安全工程师与服务团队组成的多元化团队,全天候保障平台稳定运行。</p>
+ </div>
+ <div class="site-team-grid">
+ <div v-for="t in teams" :key="t.title" class="site-team-card">
+ <div class="site-team-avatar"><i :class="'mdi ' + t.icon"></i></div>
+ <h3>{{ t.title }}</h3>
+ <p class="site-team-role">{{ t.role }}</p>
+ <p class="site-team-bio">{{ t.bio }}</p>
+ </div>
+ </div>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import bg2 from '@/shared/assets/bg2.jpg'
+
+const headerImage = bg2
+
+const teams = [
+ { icon: 'mdi-server-network', title: '技术研发', role: '产品与架构', bio: '负责平台架构、自动化开通与功能迭代,持续打磨易用性。' },
+ { icon: 'mdi-shield-lock', title: '安全合规', role: '安全运维', bio: '保障数据中心与业务系统的安全,通过等保三级等权威认证。' },
+ { icon: 'mdi-headset', title: '客户服务', role: '7×24 支持', bio: '提供全天候技术支持与工单响应,快速解决用户问题。' },
+ { icon: 'mdi-account-group', title: '运营服务', role: '用户成功', bio: '关注用户体验与反馈,推动服务与产品持续改进。' },
+]
+</script>
+
+<style scoped>
+.site-about {
+ background: var(--hd-bg);
+}
+
+.site-page-header {
+ background-size: cover;
+ background-position: center;
+ padding: 72px 0;
+ text-align: center;
+}
+
+.site-page-header h1 {
+ margin: 0 0 10px;
+ font-size: 2.2rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #181818;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-page-header p {
+ margin: 0;
+ font-size: 1.05rem;
+ color: #444;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-sec {
+ padding: 56px 0;
+}
+
+.site-sec--alt {
+ background: #f8faf9;
+}
+
+.site-sec-head {
+ text-align: center;
+ margin-bottom: 36px;
+}
+
+.site-sec-tag {
+ display: inline-block;
+ margin-bottom: 10px;
+ padding: 4px 12px;
+ border-radius: 999px;
+ background: var(--hd-brand-light);
+ color: var(--hd-brand);
+ font-size: 12px;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+}
+
+.site-sec-head h2 {
+ margin: 0 0 8px;
+ font-size: 1.6rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: var(--hd-text);
+}
+
+.site-sec-head p {
+ margin: 0 auto;
+ max-width: 560px;
+ color: var(--hd-text-3);
+ font-size: 15px;
+ line-height: 1.7;
+}
+
+/* 平台简介 */
+.site-about-grid {
+ display: grid;
+ grid-template-columns: 1.6fr 1fr;
+ gap: 48px;
+ align-items: center;
+}
+
+.site-about-text h2 {
+ position: relative;
+ margin: 0 0 18px;
+ font-size: 1.5rem;
+ font-weight: 800;
+ color: var(--hd-text);
+ padding-bottom: 12px;
+}
+
+.site-about-text h2::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 40px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-about-text p {
+ margin: 0 0 14px;
+ color: var(--hd-text-2);
+ line-height: 1.9;
+ font-size: 15px;
+}
+
+.site-about-image .site-ph {
+ height: 260px;
+ display: grid;
+ place-items: center;
+ border-radius: var(--hd-radius-xl);
+ background: linear-gradient(135deg, var(--hd-brand-light), #f0faf5);
+ color: var(--hd-brand);
+ font-size: 15px;
+ font-weight: 600;
+ border: 1px solid var(--hd-border);
+}
+
+/* 使命愿景 */
+.site-mv-grid {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 20px;
+}
+
+.site-mv-card {
+ padding: 30px 26px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ box-shadow: var(--hd-shadow);
+ transition: box-shadow var(--hd-dur) var(--hd-ease), transform var(--hd-dur) var(--hd-ease);
+}
+
+.site-mv-card:hover {
+ box-shadow: var(--hd-shadow-lg);
+ transform: translateY(-2px);
+}
+
+.site-mv-icon {
+ width: 52px;
+ height: 52px;
+ display: grid;
+ place-items: center;
+ border-radius: 14px;
+ background: var(--hd-brand-light);
+ color: var(--hd-brand);
+ font-size: 26px;
+ margin-bottom: 16px;
+}
+
+.site-mv-card h3 {
+ position: relative;
+ margin: 0 0 14px;
+ font-size: 1.15rem;
+ font-weight: 700;
+ color: var(--hd-text);
+ padding-bottom: 10px;
+}
+
+.site-mv-card h3::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 34px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-mv-card p {
+ margin: 0 0 16px;
+ color: var(--hd-text-2);
+ line-height: 1.8;
+ font-size: 14px;
+}
+
+.site-mv-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+.site-mv-list li {
+ position: relative;
+ padding-left: 22px;
+ margin-bottom: 10px;
+ color: var(--hd-text-2);
+ font-size: 14px;
+ line-height: 1.6;
+}
+
+.site-mv-list li::before {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 7px;
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ background: var(--hd-brand);
+}
+
+/* 核心团队 */
+.site-team-grid {
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 18px;
+}
+
+.site-team-card {
+ text-align: center;
+ padding: 28px 18px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ box-shadow: var(--hd-shadow);
+ transition: box-shadow var(--hd-dur) var(--hd-ease), transform var(--hd-dur) var(--hd-ease);
+}
+
+.site-team-card:hover {
+ box-shadow: var(--hd-shadow-lg);
+ transform: translateY(-3px);
+}
+
+.site-team-avatar {
+ width: 68px;
+ height: 68px;
+ margin: 0 auto 14px;
+ display: grid;
+ place-items: center;
+ border-radius: 50%;
+ border: 3px solid var(--hd-brand);
+ background: var(--hd-brand-light);
+ color: var(--hd-brand);
+ font-size: 28px;
+}
+
+.site-team-card h3 {
+ margin: 0 0 4px;
+ font-size: 15px;
+ font-weight: 700;
+ color: var(--hd-text);
+}
+
+.site-team-role {
+ margin: 0 0 10px;
+ color: var(--hd-brand);
+ font-weight: 600;
+ font-size: 13px;
+}
+
+.site-team-bio {
+ margin: 0;
+ color: var(--hd-text-3);
+ font-size: 13px;
+ line-height: 1.7;
+}
+
+@media (max-width: 860px) {
+ .site-about-grid { grid-template-columns: 1fr; gap: 28px; }
+ .site-mv-grid { grid-template-columns: 1fr; }
+ .site-team-grid { grid-template-columns: repeat(2, 1fr); }
+}
+
+@media (max-width: 560px) {
+ .site-team-grid { grid-template-columns: 1fr; }
+}
+</style>
diff --git a/templates/tdesign/spa/src/home/views/site/ContactView.vue b/templates/tdesign/spa/src/home/views/site/ContactView.vue
new file mode 100644
index 0000000..bc5bc6b
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/site/ContactView.vue
@@ -0,0 +1,307 @@
+<template>
+ <div class="site-contact">
+ <section class="site-page-header" :style="{ backgroundImage: `url(${headerImage})` }">
+ <div class="hd-container">
+ <h1>联系我们</h1>
+ <p>我们随时准备为您提供帮助与支持</p>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <div class="site-contact-layout">
+ <div class="site-contact-info">
+ <h2>联系信息</h2>
+ <div class="site-contact-details">
+ <div class="site-contact-item">
+ <div class="site-contact-icon"><i class="mdi mdi-map-marker-outline"></i></div>
+ <div class="site-contact-text">
+ <h3>公司地址</h3>
+ <p>北京市朝阳区 · 数据中心园区</p>
+ </div>
+ </div>
+ <div class="site-contact-item">
+ <div class="site-contact-icon"><i class="mdi mdi-email-outline"></i></div>
+ <div class="site-contact-text">
+ <h3>服务邮箱</h3>
+ <p>support@mnbt.example</p>
+ </div>
+ </div>
+ <div class="site-contact-item">
+ <div class="site-contact-icon"><i class="mdi mdi-headset"></i></div>
+ <div class="site-contact-text">
+ <h3>客服支持</h3>
+ <p>工作日 9:00 - 21:00 · 7×24 工单系统</p>
+ </div>
+ </div>
+ </div>
+ <div class="site-contact-map">
+ <div class="site-ph"><i class="mdi mdi-map-outline"></i> 数据中心分布:华东 / 华北 / 华南</div>
+ </div>
+ </div>
+
+ <div class="site-contact-form">
+ <h2>发送消息</h2>
+ <form @submit.prevent="submitForm">
+ <div class="site-form-group">
+ <label>姓名</label>
+ <t-input v-model="form.name" placeholder="请输入您的姓名" :status="errors.name ? 'error' : undefined" />
+ <span v-if="errors.name" class="site-form-error">{{ errors.name }}</span>
+ </div>
+ <div class="site-form-group">
+ <label>邮箱</label>
+ <t-input v-model="form.email" placeholder="请输入联系邮箱" :status="errors.email ? 'error' : undefined" />
+ <span v-if="errors.email" class="site-form-error">{{ errors.email }}</span>
+ </div>
+ <div class="site-form-group">
+ <label>电话(选填)</label>
+ <t-input v-model="form.phone" placeholder="请输入联系电话" :status="errors.phone ? 'error' : undefined" />
+ <span v-if="errors.phone" class="site-form-error">{{ errors.phone }}</span>
+ </div>
+ <div class="site-form-group">
+ <label>留言内容</label>
+ <t-textarea v-model="form.message" placeholder="请描述您的需求或问题" :rows="5" :status="errors.message ? 'error' : undefined" />
+ <span v-if="errors.message" class="site-form-error">{{ errors.message }}</span>
+ </div>
+ <t-button block theme="primary" size="large" type="submit" :loading="submitting" style="height:44px">
+ {{ submitting ? '发送中...' : '发送消息' }}
+ </t-button>
+ <div v-if="submitStatus" class="site-submit-status" :class="submitStatus.type">
+ <i :class="submitStatus.type === 'success' ? 'mdi mdi-check-circle-outline' : 'mdi mdi-alert-circle-outline'"></i>
+ {{ submitStatus.message }}
+ </div>
+ </form>
+ </div>
+ </div>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import { ref, reactive } from 'vue'
+import { MessagePlugin } from 'tdesign-vue-next'
+import bg3 from '@/shared/assets/bg3.jpg'
+import { submitSiteContact } from '@/home/api/site'
+
+const headerImage = bg3
+
+const form = reactive({ name: '', email: '', phone: '', message: '' })
+const errors = reactive({})
+const submitting = ref(false)
+const submitStatus = ref(null)
+
+function validate() {
+ errors.name = ''
+ errors.email = ''
+ errors.phone = ''
+ errors.message = ''
+ if (!form.name.trim()) errors.name = '请输入姓名'
+ if (!form.email.trim()) {
+ errors.email = '请输入邮箱'
+ } else if (!/\S+@\S+\.\S+/.test(form.email)) {
+ errors.email = '邮箱格式不正确'
+ }
+ if (!form.message.trim()) errors.message = '请输入留言内容'
+ if (form.phone && !/^(\+?86)?1[3-9]\d{9}$/.test(form.phone)) {
+ errors.phone = '请输入有效的电话号码'
+ }
+ return !errors.name && !errors.email && !errors.phone && !errors.message
+}
+
+async function submitForm() {
+ if (!validate()) return
+ submitting.value = true
+ submitStatus.value = null
+ const res = await submitSiteContact({
+ name: form.name,
+ email: form.email,
+ phone: form.phone,
+ message: form.message,
+ })
+ submitting.value = false
+ if (res.ok) {
+ submitStatus.value = { type: 'success', message: '消息已发送!我们会尽快与您联系。' }
+ form.name = ''
+ form.email = ''
+ form.phone = ''
+ form.message = ''
+ } else {
+ submitStatus.value = { type: 'error', message: res.message || '发送失败,请稍后重试' }
+ }
+}
+</script>
+
+<style scoped>
+.site-contact {
+ background: var(--hd-bg);
+}
+
+.site-page-header {
+ background-size: cover;
+ background-position: center;
+ padding: 72px 0;
+ text-align: center;
+}
+
+.site-page-header h1 {
+ margin: 0 0 10px;
+ font-size: 2.2rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #181818;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-page-header p {
+ margin: 0;
+ font-size: 1.05rem;
+ color: #444;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-sec {
+ padding: 56px 0;
+}
+
+.site-contact-layout {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 40px;
+ align-items: start;
+}
+
+.site-contact-info h2,
+.site-contact-form h2 {
+ position: relative;
+ margin: 0 0 24px;
+ font-size: 1.4rem;
+ font-weight: 800;
+ color: var(--hd-text);
+ padding-bottom: 12px;
+}
+
+.site-contact-info h2::after,
+.site-contact-form h2::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 40px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-contact-details {
+ display: grid;
+ gap: 18px;
+ margin-bottom: 24px;
+}
+
+.site-contact-item {
+ display: flex;
+ gap: 14px;
+ align-items: flex-start;
+}
+
+.site-contact-icon {
+ width: 46px;
+ height: 46px;
+ flex-shrink: 0;
+ display: grid;
+ place-items: center;
+ border-radius: 14px;
+ background: var(--hd-brand-light);
+ color: var(--hd-brand);
+ font-size: 22px;
+}
+
+.site-contact-text h3 {
+ margin: 0 0 4px;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--hd-text);
+}
+
+.site-contact-text p {
+ margin: 0;
+ color: var(--hd-text-3);
+ font-size: 13px;
+ line-height: 1.6;
+}
+
+.site-contact-map .site-ph {
+ height: 160px;
+ display: grid;
+ place-items: center;
+ gap: 8px;
+ border-radius: var(--hd-radius-xl);
+ border: 1px solid var(--hd-border);
+ background: linear-gradient(135deg, var(--hd-brand-light), #f4fbf7);
+ color: var(--hd-brand);
+ font-size: 14px;
+ font-weight: 600;
+ text-align: center;
+ padding: 16px;
+}
+
+.site-contact-map .site-ph i {
+ font-size: 34px;
+ display: block;
+ margin-bottom: 6px;
+}
+
+.site-contact-form {
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ padding: 26px 28px;
+ box-shadow: var(--hd-shadow);
+}
+
+.site-form-group {
+ margin-bottom: 16px;
+}
+
+.site-form-group label {
+ display: block;
+ margin-bottom: 6px;
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--hd-text);
+}
+
+.site-form-error {
+ display: block;
+ margin-top: 4px;
+ font-size: 12px;
+ color: var(--hd-error, #d54941);
+}
+
+.site-submit-status {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-top: 14px;
+ padding: 10px 14px;
+ border-radius: var(--hd-radius-lg);
+ font-size: 13px;
+}
+
+.site-submit-status.success {
+ background: #e8f8f0;
+ color: #2ba471;
+ border: 1px solid #c5e8d4;
+}
+
+.site-submit-status.error {
+ background: #fdecee;
+ color: #d54941;
+ border: 1px solid #f7c5c8;
+}
+
+@media (max-width: 860px) {
+ .site-contact-layout { grid-template-columns: 1fr; gap: 28px; }
+}
+</style>
diff --git a/templates/tdesign/spa/src/home/views/site/news/NewsDetailView.vue b/templates/tdesign/spa/src/home/views/site/news/NewsDetailView.vue
new file mode 100644
index 0000000..0ed68a0
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/site/news/NewsDetailView.vue
@@ -0,0 +1,201 @@
+<template>
+ <div class="site-news-detail">
+ <section class="site-page-header" :style="{ backgroundImage: `url(${headerImage})` }">
+ <div class="hd-container">
+ <h1>新闻资讯</h1>
+ <p>了解平台最新动态与行业资讯</p>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <article v-if="news.id" class="site-article">
+ <header class="site-article-head">
+ <h1>{{ news.title }}</h1>
+ <div class="site-article-meta">
+ <span class="site-meta-chip"><i class="mdi mdi-calendar-month-outline"></i>{{ formatDate(news.created_at) }}</span>
+ <span v-if="news.category" class="site-meta-chip"><i class="mdi mdi-tag-outline"></i>{{ news.category }}</span>
+ <span class="site-meta-chip"><i class="mdi mdi-eye-outline"></i>{{ news.views }} 浏览</span>
+ </div>
+ </header>
+
+ <div class="site-article-content" v-html="renderedContent"></div>
+
+ <div class="site-article-foot">
+ <t-button theme="primary" @click="$router.push('/site/news')">
+ <template #prefix><i class="mdi mdi-arrow-left"></i></template>
+ 返回新闻列表
+ </t-button>
+ </div>
+ </article>
+
+ <div v-else-if="loading" class="site-empty">
+ <i class="mdi mdi-loading mdi-spin"></i>
+ <p>正在加载新闻内容...</p>
+ </div>
+
+ <div v-else-if="error" class="site-empty">
+ <i class="mdi mdi-alert-circle-outline"></i>
+ <p>{{ error }}</p>
+ <t-button theme="primary" style="margin-top:12px" @click="$router.push('/site/news')">返回新闻列表</t-button>
+ </div>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted } from 'vue'
+import { useRoute } from 'vue-router'
+import bg2 from '@/shared/assets/bg2.jpg'
+import { getSiteNewsDetail } from '@/home/api/site'
+import { formatDate } from '@/home/utils/format'
+
+const headerImage = bg2
+const route = useRoute()
+
+const news = ref({})
+const loading = ref(true)
+const error = ref('')
+
+// 将内容按空行分段渲染;单换行转 <br>,保留管理员录入的简单 HTML
+const renderedContent = computed(() => {
+ const raw = String(news.value.content || '')
+ const paragraphs = raw.split(/\n{2,}/).map((p) => p.replace(/\n/g, '<br>').trim()).filter((p) => p !== '')
+ return paragraphs.map((p) => `<p>${p}</p>`).join('')
+})
+
+onMounted(async () => {
+ const res = await getSiteNewsDetail(route.params.id)
+ if (res.ok && res.data?.news) {
+ news.value = res.data.news
+ } else {
+ error.value = res.message === '新闻不存在' ? '新闻不存在或已下架' : '获取新闻内容失败'
+ }
+ loading.value = false
+})
+</script>
+
+<style scoped>
+.site-news-detail {
+ background: var(--hd-bg);
+}
+
+.site-page-header {
+ background-size: cover;
+ background-position: center;
+ padding: 72px 0;
+ text-align: center;
+}
+
+.site-page-header h1 {
+ margin: 0 0 10px;
+ font-size: 2.2rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #181818;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-page-header p {
+ margin: 0;
+ font-size: 1.05rem;
+ color: #444;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-sec {
+ padding: 48px 0;
+}
+
+.site-article {
+ max-width: 820px;
+ margin: 0 auto;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ padding: 36px 40px;
+ box-shadow: var(--hd-shadow);
+}
+
+.site-article-head h1 {
+ position: relative;
+ margin: 0 0 18px;
+ font-size: 1.7rem;
+ font-weight: 800;
+ color: var(--hd-text);
+ line-height: 1.35;
+ padding-bottom: 16px;
+}
+
+.site-article-head h1::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 44px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-article-meta {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin-bottom: 28px;
+ padding-bottom: 20px;
+ border-bottom: 1px solid var(--hd-border);
+}
+
+.site-meta-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 4px 12px;
+ border-radius: 999px;
+ background: var(--hd-bg);
+ border: 1px solid var(--hd-border);
+ color: var(--hd-text-2);
+ font-size: 13px;
+}
+
+.site-article-content {
+ font-size: 15px;
+ line-height: 2;
+ color: var(--hd-text-2);
+}
+
+.site-article-content p {
+ margin: 0 0 18px;
+}
+
+.site-article-foot {
+ margin-top: 32px;
+ padding-top: 20px;
+ border-top: 1px solid var(--hd-border);
+ text-align: center;
+}
+
+.site-empty {
+ text-align: center;
+ padding: 60px 16px;
+ color: var(--hd-text-3);
+}
+
+.site-empty i {
+ font-size: 40px;
+ display: block;
+ margin-bottom: 10px;
+ color: #cbd5e1;
+}
+
+.site-empty p {
+ font-size: 15px;
+}
+
+@media (max-width: 640px) {
+ .site-article { padding: 24px 20px; }
+ .site-article-head h1 { font-size: 1.4rem; }
+}
+</style>
diff --git a/templates/tdesign/spa/src/home/views/site/news/NewsView.vue b/templates/tdesign/spa/src/home/views/site/news/NewsView.vue
new file mode 100644
index 0000000..801dfe5
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/site/news/NewsView.vue
@@ -0,0 +1,521 @@
+<template>
+ <div class="site-news">
+ <section class="site-page-header" :style="{ backgroundImage: `url(${headerImage})` }">
+ <div class="hd-container">
+ <h1>新闻资讯</h1>
+ <p>了解平台最新动态、优惠活动与行业资讯</p>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <div class="site-news-layout">
+ <main class="site-news-main">
+ <!-- 分类快捷筛选 -->
+ <div class="site-news-tabs">
+ <button class="site-news-tab" :class="{ active: category === '' }" @click="switchCategory('')">全部</button>
+ <button
+ v-for="cat in categories"
+ :key="cat.category"
+ class="site-news-tab"
+ :class="{ active: category === cat.category }"
+ @click="switchCategory(cat.category)"
+ >
+ {{ cat.category }}
+ </button>
+ </div>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="newsList.length === 0 && !loading" class="site-empty">
+ <i class="mdi mdi-newspaper-variant-outline"></i>
+ <p>暂无新闻</p>
+ </div>
+ <div v-else class="site-news-cards">
+ <div v-for="n in newsList" :key="n.id" class="site-news-card" @click="$router.push('/site/news/' + n.id)">
+ <div class="site-news-body">
+ <h2 class="site-news-title">{{ n.title }}</h2>
+ <p class="site-news-excerpt">{{ excerpt(n.content) }}</p>
+ <div class="site-news-meta">
+ <span class="site-news-chip"><i class="mdi mdi-calendar-month-outline"></i>{{ formatDate(n.created_at) }}</span>
+ <span v-if="n.category" class="site-news-chip"><i class="mdi mdi-tag-outline"></i>{{ n.category }}</span>
+ <span class="site-news-chip"><i class="mdi mdi-eye-outline"></i>{{ n.views }} 浏览</span>
+ </div>
+ <div class="site-news-more">阅读全文 <i class="mdi mdi-arrow-right"></i></div>
+ </div>
+ </div>
+ </div>
+ </t-loading>
+
+ <!-- 分页 -->
+ <div v-if="totalPages > 1" class="site-pagination">
+ <button class="site-page-btn" :disabled="page <= 1" @click="goToPage(page - 1)">
+ <i class="mdi mdi-chevron-left"></i>上一页
+ </button>
+ <div class="site-page-nums">
+ <button
+ v-for="p in visiblePages"
+ :key="p"
+ class="site-page-num"
+ :class="{ active: p === page }"
+ @click="goToPage(p)"
+ >
+ {{ p }}
+ </button>
+ </div>
+ <button class="site-page-btn" :disabled="page >= totalPages" @click="goToPage(page + 1)">
+ 下一页<i class="mdi mdi-chevron-right"></i>
+ </button>
+ </div>
+ </main>
+
+ <aside class="site-news-sidebar">
+ <div class="site-widget">
+ <h3><i class="mdi mdi-trending-up"></i>热门文章</h3>
+ <div v-for="(a, i) in popular" :key="a.id" class="site-popular" @click="$router.push('/site/news/' + a.id)">
+ <span class="site-popular-rank" :class="{ top: i < 3 }">{{ i + 1 }}</span>
+ <div class="site-popular-info">
+ <h4 class="site-popular-title">{{ a.title }}</h4>
+ <div class="site-popular-meta">
+ <span>{{ formatDate(a.created_at) }}</span>
+ <span>{{ a.views }} 浏览</span>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="site-widget">
+ <h3><i class="mdi mdi-information-outline"></i>关于我们</h3>
+ <div class="site-widget-about">
+ <p>MNBT 专注虚拟主机、云服务器与安全防护服务,支付即开、分钟级上线。</p>
+ <router-link to="/about" class="site-widget-link">了解更多 <i class="mdi mdi-arrow-right"></i></router-link>
+ </div>
+ </div>
+ </aside>
+ </div>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import { ref, computed, onMounted } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
+import bg3 from '@/shared/assets/bg3.jpg'
+import { getSiteNews, getSiteNewsPopular } from '@/home/api/site'
+import { formatDate } from '@/home/utils/format'
+
+const headerImage = bg3
+const route = useRoute()
+const router = useRouter()
+
+const perPage = 6
+const page = ref(1)
+const category = ref('')
+const total = ref(0)
+const newsList = ref([])
+const categories = ref([])
+const popular = ref([])
+const loading = ref(true)
+
+const totalPages = computed(() => Math.max(1, Math.ceil(total.value / perPage)))
+
+const visiblePages = computed(() => {
+ const maxVisible = 5
+ const half = Math.floor(maxVisible / 2)
+ let start = Math.max(1, page.value - half)
+ let end = Math.min(totalPages.value, start + maxVisible - 1)
+ if (end - start + 1 < maxVisible) {
+ start = Math.max(1, end - maxVisible + 1)
+ }
+ const pages = []
+ for (let i = start; i <= end; i++) pages.push(i)
+ return pages
+})
+
+function excerpt(html, len = 96) {
+ if (!html) return ''
+ const text = String(html).replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
+ return text.length > len ? text.slice(0, len) + '…' : text
+}
+
+async function fetchNews() {
+ loading.value = true
+ const res = await getSiteNews({ page: page.value, perPage, category: category.value })
+ if (res.ok && res.data) {
+ newsList.value = res.data.news || []
+ total.value = res.data.total || 0
+ if (res.data.categories && Array.isArray(res.data.categories)) {
+ categories.value = res.data.categories
+ }
+ } else {
+ newsList.value = []
+ total.value = 0
+ }
+ loading.value = false
+}
+
+function switchCategory(cat) {
+ category.value = cat
+ page.value = 1
+ fetchNews()
+}
+
+function goToPage(p) {
+ if (p < 1 || p > totalPages.value) return
+ page.value = p
+ fetchNews()
+ window.scrollTo({ top: 0, behavior: 'smooth' })
+}
+
+onMounted(async () => {
+ const p = parseInt(route.query.page, 10)
+ if (p > 0) page.value = p
+ const popularRes = await getSiteNewsPopular()
+ if (popularRes.ok && popularRes.data?.popular) {
+ popular.value = popularRes.data.popular
+ }
+ fetchNews()
+})
+</script>
+
+<style scoped>
+.site-news {
+ background: var(--hd-bg);
+}
+
+.site-page-header {
+ background-size: cover;
+ background-position: center;
+ padding: 72px 0;
+ text-align: center;
+}
+
+.site-page-header h1 {
+ margin: 0 0 10px;
+ font-size: 2.2rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #181818;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-page-header p {
+ margin: 0;
+ font-size: 1.05rem;
+ color: #444;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-sec {
+ padding: 48px 0;
+}
+
+.site-news-layout {
+ display: grid;
+ grid-template-columns: 2fr 1fr;
+ gap: 32px;
+ align-items: start;
+}
+
+/* 分类 tabs */
+.site-news-tabs {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin-bottom: 20px;
+}
+
+.site-news-tab {
+ padding: 6px 16px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: 999px;
+ font-size: 13px;
+ color: var(--hd-text-2);
+ cursor: pointer;
+ transition: all var(--hd-dur) var(--hd-ease);
+}
+
+.site-news-tab:hover,
+.site-news-tab.active {
+ background: var(--hd-brand);
+ border-color: var(--hd-brand);
+ color: #fff;
+}
+
+/* 新闻卡片 */
+.site-news-cards {
+ display: grid;
+ gap: 16px;
+}
+
+.site-news-card {
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ padding: 20px 22px;
+ cursor: pointer;
+ transition: box-shadow var(--hd-dur) var(--hd-ease), transform var(--hd-dur) var(--hd-ease);
+}
+
+.site-news-card:hover {
+ box-shadow: var(--hd-shadow-lg);
+ transform: translateY(-2px);
+}
+
+.site-news-title {
+ position: relative;
+ margin: 0 0 10px;
+ font-size: 1.15rem;
+ font-weight: 700;
+ color: var(--hd-text);
+ padding-bottom: 10px;
+ line-height: 1.4;
+}
+
+.site-news-title::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 34px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-news-excerpt {
+ margin: 0 0 14px;
+ color: var(--hd-text-2);
+ font-size: 14px;
+ line-height: 1.7;
+}
+
+.site-news-meta {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin-bottom: 12px;
+}
+
+.site-news-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 3px 12px;
+ border-radius: 999px;
+ background: var(--hd-bg);
+ border: 1px solid var(--hd-border);
+ color: var(--hd-text-2);
+ font-size: 12px;
+}
+
+.site-news-more {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ color: var(--hd-brand);
+ font-size: 13px;
+ font-weight: 600;
+ transition: gap var(--hd-dur) var(--hd-ease);
+}
+
+.site-news-card:hover .site-news-more {
+ gap: 8px;
+}
+
+/* 分页 */
+.site-pagination {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 10px;
+ margin-top: 28px;
+ flex-wrap: wrap;
+}
+
+.site-page-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 8px 14px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-lg);
+ font-size: 13px;
+ color: var(--hd-text-2);
+ cursor: pointer;
+ transition: all var(--hd-dur) var(--hd-ease);
+}
+
+.site-page-btn:hover:not(:disabled) {
+ color: var(--hd-brand);
+ border-color: var(--hd-brand);
+}
+
+.site-page-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
+.site-page-nums {
+ display: flex;
+ gap: 6px;
+}
+
+.site-page-num {
+ width: 34px;
+ height: 34px;
+ display: grid;
+ place-items: center;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-lg);
+ font-size: 13px;
+ color: var(--hd-text-2);
+ cursor: pointer;
+ transition: all var(--hd-dur) var(--hd-ease);
+}
+
+.site-page-num:hover,
+.site-page-num.active {
+ background: var(--hd-brand);
+ border-color: var(--hd-brand);
+ color: #fff;
+}
+
+/* 侧边栏 */
+.site-news-sidebar {
+ position: sticky;
+ top: 76px;
+ display: grid;
+ gap: 16px;
+}
+
+.site-widget {
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ padding: 20px;
+ box-shadow: var(--hd-shadow);
+}
+
+.site-widget h3 {
+ position: relative;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin: 0 0 16px;
+ font-size: 15px;
+ font-weight: 700;
+ color: var(--hd-text);
+ padding-bottom: 12px;
+ border-bottom: 1px solid var(--hd-border);
+}
+
+.site-widget h3::after {
+ content: '';
+ position: absolute;
+ bottom: -1px;
+ left: 0;
+ width: 30px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-popular {
+ display: flex;
+ gap: 12px;
+ padding: 10px 6px;
+ border-radius: var(--hd-radius-lg);
+ cursor: pointer;
+ transition: background var(--hd-dur) var(--hd-ease);
+}
+
+.site-popular:hover {
+ background: var(--hd-brand-light);
+}
+
+.site-popular-rank {
+ width: 24px;
+ height: 24px;
+ flex-shrink: 0;
+ display: grid;
+ place-items: center;
+ border-radius: 50%;
+ background: var(--hd-bg);
+ color: var(--hd-text-3);
+ font-size: 12px;
+ font-weight: 700;
+ margin-top: 2px;
+}
+
+.site-popular-rank.top {
+ background: var(--hd-brand);
+ color: #fff;
+}
+
+.site-popular-title {
+ margin: 0 0 6px;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--hd-text);
+ line-height: 1.5;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+
+.site-popular:hover .site-popular-title {
+ color: var(--hd-brand);
+}
+
+.site-popular-meta {
+ display: flex;
+ gap: 12px;
+ font-size: 12px;
+ color: var(--hd-text-3);
+}
+
+.site-widget-about p {
+ margin: 0 0 12px;
+ color: var(--hd-text-2);
+ font-size: 13px;
+ line-height: 1.8;
+}
+
+.site-widget-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ color: var(--hd-brand);
+ font-size: 13px;
+ font-weight: 600;
+ text-decoration: none;
+}
+
+.site-widget-link:hover {
+ text-decoration: none;
+ gap: 8px;
+}
+
+.site-empty {
+ text-align: center;
+ padding: 60px 16px;
+ color: var(--hd-text-3);
+}
+
+.site-empty i {
+ font-size: 40px;
+ display: block;
+ margin-bottom: 10px;
+ color: #cbd5e1;
+}
+
+@media (max-width: 860px) {
+ .site-news-layout { grid-template-columns: 1fr; }
+ .site-news-sidebar { position: static; }
+}
+</style>
diff --git a/templates/tdesign/spa/src/home/views/site/products/ProductDetailView.vue b/templates/tdesign/spa/src/home/views/site/products/ProductDetailView.vue
new file mode 100644
index 0000000..862e95c
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/site/products/ProductDetailView.vue
@@ -0,0 +1,281 @@
+<template>
+ <div class="site-product-detail">
+ <section class="site-page-header" :style="{ backgroundImage: `url(${headerImage})` }">
+ <div class="hd-container">
+ <h1>{{ product.name || '产品详情' }}</h1>
+ <p>了解产品详细信息与核心能力</p>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <div v-if="product.id" class="site-detail-layout">
+ <div class="site-detail-img">
+ <img v-if="product.image" :src="product.image" :alt="product.name" />
+ <div v-else class="site-ph"><i class="mdi mdi-package-variant"></i></div>
+ </div>
+
+ <div class="site-detail-info">
+ <h2>{{ product.name }}</h2>
+ <div class="site-detail-meta">
+ <span class="site-detail-cat">{{ product.category_name }}</span>
+ <span class="site-detail-date">更新于 {{ formatDate(product.created_at) }}</span>
+ </div>
+ <p class="site-detail-desc">{{ product.description }}</p>
+
+ <div class="site-detail-feats">
+ <h3>产品特性</h3>
+ <ul class="site-feat-list">
+ <li v-for="(feat, i) in product.features" :key="i">
+ <span class="site-feat-icon"><i class="mdi mdi-check"></i></span>
+ {{ feat }}
+ </li>
+ </ul>
+ </div>
+
+ <div class="site-detail-actions">
+ <t-button theme="primary" size="large" @click="$router.push('/site/contact')">
+ 联系我们 <template #suffix><i class="mdi mdi-send"></i></template>
+ </t-button>
+ <t-button variant="outline" size="large" @click="$router.push('/site/products')">返回产品中心</t-button>
+ </div>
+ </div>
+ </div>
+
+ <div v-else-if="loading" class="site-empty">
+ <i class="mdi mdi-loading mdi-spin"></i>
+ <p>正在加载产品信息...</p>
+ </div>
+
+ <div v-else-if="error" class="site-empty">
+ <i class="mdi mdi-alert-circle-outline"></i>
+ <p>{{ error }}</p>
+ <t-button theme="primary" style="margin-top:12px" @click="$router.push('/site/products')">返回产品中心</t-button>
+ </div>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue'
+import { useRoute } from 'vue-router'
+import bg2 from '@/shared/assets/bg2.jpg'
+import { getSiteProduct } from '@/home/api/site'
+import { formatDate } from '@/home/utils/format'
+
+const headerImage = bg2
+const route = useRoute()
+
+const product = ref({})
+const loading = ref(true)
+const error = ref('')
+
+onMounted(async () => {
+ const res = await getSiteProduct(route.params.id)
+ if (res.ok && res.data?.product) {
+ product.value = res.data.product
+ } else {
+ error.value = res.message === '产品不存在' ? '产品不存在或已下架' : '获取产品信息失败'
+ }
+ loading.value = false
+})
+</script>
+
+<style scoped>
+.site-product-detail {
+ background: var(--hd-bg);
+}
+
+.site-page-header {
+ background-size: cover;
+ background-position: center;
+ padding: 72px 0;
+ text-align: center;
+}
+
+.site-page-header h1 {
+ margin: 0 0 10px;
+ font-size: 2.2rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #181818;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-page-header p {
+ margin: 0;
+ font-size: 1.05rem;
+ color: #444;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-sec {
+ padding: 56px 0;
+}
+
+.site-detail-layout {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 48px;
+}
+
+.site-detail-img {
+ border-radius: var(--hd-radius-xl);
+ overflow: hidden;
+ background: linear-gradient(135deg, var(--hd-brand-light), #f4fbf7);
+ min-height: 320px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: 1px solid var(--hd-border);
+}
+
+.site-detail-img img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.site-detail-img .site-ph {
+ color: var(--hd-brand);
+ font-size: 64px;
+}
+
+.site-detail-info h2 {
+ position: relative;
+ margin: 0 0 16px;
+ font-size: 1.7rem;
+ font-weight: 800;
+ color: var(--hd-text);
+ padding-bottom: 12px;
+}
+
+.site-detail-info h2::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 40px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-detail-meta {
+ display: flex;
+ gap: 10px;
+ margin-bottom: 18px;
+ flex-wrap: wrap;
+}
+
+.site-detail-cat,
+.site-detail-date {
+ display: inline-flex;
+ align-items: center;
+ padding: 4px 12px;
+ border-radius: 999px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ color: var(--hd-text-2);
+ font-size: 13px;
+}
+
+.site-detail-cat {
+ background: var(--hd-brand-light);
+ border-color: transparent;
+ color: var(--hd-brand);
+ font-weight: 600;
+}
+
+.site-detail-desc {
+ margin: 0 0 24px;
+ padding: 16px 18px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-left: 4px solid var(--hd-brand);
+ border-radius: var(--hd-radius-lg);
+ color: var(--hd-text-2);
+ line-height: 1.8;
+ font-size: 15px;
+}
+
+.site-detail-feats h3 {
+ position: relative;
+ margin: 0 0 16px;
+ font-size: 1.1rem;
+ font-weight: 700;
+ color: var(--hd-text);
+ padding-bottom: 10px;
+}
+
+.site-detail-feats h3::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 30px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-feat-list {
+ list-style: none;
+ margin: 0 0 28px;
+ padding: 0;
+}
+
+.site-feat-list li {
+ position: relative;
+ display: flex;
+ align-items: flex-start;
+ gap: 10px;
+ padding: 10px 0;
+ margin-bottom: 6px;
+ color: var(--hd-text-2);
+ font-size: 14px;
+ line-height: 1.6;
+ border-bottom: 1px dashed var(--hd-border);
+}
+
+.site-feat-icon {
+ width: 20px;
+ height: 20px;
+ margin-top: 2px;
+ flex-shrink: 0;
+ display: grid;
+ place-items: center;
+ border-radius: 50%;
+ background: var(--hd-brand);
+ color: #fff;
+ font-size: 13px;
+}
+
+.site-detail-actions {
+ display: flex;
+ gap: 12px;
+ flex-wrap: wrap;
+}
+
+.site-empty {
+ text-align: center;
+ padding: 60px 16px;
+ color: var(--hd-text-3);
+}
+
+.site-empty i {
+ font-size: 40px;
+ display: block;
+ margin-bottom: 10px;
+ color: #cbd5e1;
+}
+
+.site-empty p {
+ font-size: 15px;
+}
+
+@media (max-width: 860px) {
+ .site-detail-layout { grid-template-columns: 1fr; gap: 28px; }
+}
+</style>
diff --git a/templates/tdesign/spa/src/home/views/site/products/ProductsView.vue b/templates/tdesign/spa/src/home/views/site/products/ProductsView.vue
new file mode 100644
index 0000000..e3d9ca1
--- /dev/null
+++ b/templates/tdesign/spa/src/home/views/site/products/ProductsView.vue
@@ -0,0 +1,278 @@
+<template>
+ <div class="site-products">
+ <section class="site-page-header" :style="{ backgroundImage: `url(${headerImage})` }">
+ <div class="hd-container">
+ <h1>产品中心</h1>
+ <p>从建站托管到安全防护,一站式云基础设施服务</p>
+ </div>
+ </section>
+
+ <section class="site-sec">
+ <div class="hd-container">
+ <div class="site-cat-filter">
+ <button
+ v-for="cat in categories"
+ :key="cat.id"
+ class="site-cat-btn"
+ :class="{ active: activeCategory === cat.id }"
+ @click="switchCategory(cat.id)"
+ >
+ {{ cat.name }}
+ </button>
+ </div>
+
+ <t-loading :loading="loading" size="large">
+ <div v-if="products.length === 0 && !loading" class="site-empty">
+ <i class="mdi mdi-package-variant"></i>
+ <p>暂无相关产品</p>
+ </div>
+ <div v-else class="site-products-grid">
+ <div
+ v-for="p in products"
+ :key="p.id"
+ class="site-product-card"
+ @click="$router.push('/site/products/' + p.id)"
+ >
+ <div class="site-product-img">
+ <img v-if="p.image" :src="p.image" :alt="p.name" />
+ <div v-else class="site-ph"><i class="mdi mdi-package-variant"></i></div>
+ </div>
+ <div class="site-product-info">
+ <h3 class="site-product-title">{{ p.name }}</h3>
+ <p class="site-product-desc">{{ p.description }}</p>
+ <div class="site-product-foot">
+ <span class="site-product-cat">{{ p.category_name }}</span>
+ <span class="site-product-more">了解更多 <i class="mdi mdi-arrow-right"></i></span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </t-loading>
+ </div>
+ </section>
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue'
+import { useRouter } from 'vue-router'
+import bg2 from '@/shared/assets/bg2.jpg'
+import { getSiteProducts } from '@/home/api/site'
+
+const headerImage = bg2
+const router = useRouter()
+
+const categories = ref([{ id: 'all', name: '全部产品' }])
+const activeCategory = ref('all')
+const products = ref([])
+const loading = ref(true)
+
+async function fetchProducts(category) {
+ loading.value = true
+ const res = await getSiteProducts(category === 'all' ? '' : category)
+ if (res.ok && res.data?.products) {
+ products.value = res.data.products
+ if (res.data.categories && categories.value.length <= 1) {
+ categories.value = [{ id: 'all', name: '全部产品' }, ...res.data.categories]
+ }
+ } else {
+ products.value = []
+ }
+ loading.value = false
+}
+
+function switchCategory(id) {
+ activeCategory.value = id
+ fetchProducts(id)
+}
+
+onMounted(() => fetchProducts('all'))
+</script>
+
+<style scoped>
+.site-products {
+ background: var(--hd-bg);
+}
+
+.site-page-header {
+ background-size: cover;
+ background-position: center;
+ padding: 72px 0;
+ text-align: center;
+}
+
+.site-page-header h1 {
+ margin: 0 0 10px;
+ font-size: 2.2rem;
+ font-weight: 800;
+ letter-spacing: -0.02em;
+ color: #181818;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-page-header p {
+ margin: 0;
+ font-size: 1.05rem;
+ color: #444;
+ text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
+}
+
+.site-sec {
+ padding: 48px 0;
+}
+
+/* 分类筛选 */
+.site-cat-filter {
+ display: flex;
+ justify-content: center;
+ flex-wrap: wrap;
+ gap: 10px;
+ margin-bottom: 32px;
+}
+
+.site-cat-btn {
+ padding: 8px 20px;
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: 999px;
+ cursor: pointer;
+ transition: all var(--hd-dur) var(--hd-ease);
+ font-size: 14px;
+ color: var(--hd-text-2);
+}
+
+.site-cat-btn:hover,
+.site-cat-btn.active {
+ background: var(--hd-brand);
+ color: #fff;
+ border-color: var(--hd-brand);
+}
+
+/* 产品卡片 */
+.site-products-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
+ gap: 20px;
+}
+
+.site-product-card {
+ background: var(--hd-surface);
+ border: 1px solid var(--hd-border);
+ border-radius: var(--hd-radius-xl);
+ overflow: hidden;
+ cursor: pointer;
+ transition: box-shadow var(--hd-dur) var(--hd-ease), transform var(--hd-dur) var(--hd-ease);
+}
+
+.site-product-card:hover {
+ box-shadow: var(--hd-shadow-lg);
+ transform: translateY(-3px);
+}
+
+.site-product-img {
+ height: 160px;
+ background: linear-gradient(135deg, var(--hd-brand-light), #f4fbf7);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.site-product-img img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.site-product-img .site-ph {
+ color: var(--hd-brand);
+ font-size: 40px;
+}
+
+.site-product-info {
+ padding: 18px 20px 20px;
+}
+
+.site-product-title {
+ position: relative;
+ margin: 0 0 10px;
+ font-size: 1.15rem;
+ font-weight: 700;
+ color: var(--hd-text);
+ padding-bottom: 10px;
+}
+
+.site-product-title::after {
+ content: '';
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 30px;
+ height: 3px;
+ border-radius: 3px;
+ background: var(--hd-brand);
+}
+
+.site-product-desc {
+ margin: 0 0 16px;
+ color: var(--hd-text-2);
+ font-size: 14px;
+ line-height: 1.7;
+ min-height: 48px;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+
+.site-product-foot {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+}
+
+.site-product-cat {
+ display: inline-block;
+ padding: 3px 12px;
+ border-radius: 999px;
+ background: var(--hd-brand-light);
+ color: var(--hd-brand);
+ font-size: 12px;
+ font-weight: 600;
+}
+
+.site-product-more {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ color: var(--hd-brand);
+ font-size: 13px;
+ font-weight: 600;
+ transition: gap var(--hd-dur) var(--hd-ease);
+}
+
+.site-product-card:hover .site-product-more {
+ gap: 8px;
+}
+
+.site-empty {
+ text-align: center;
+ padding: 60px 16px;
+ color: var(--hd-text-3);
+}
+
+.site-empty i {
+ font-size: 40px;
+ display: block;
+ margin-bottom: 10px;
+ color: #cbd5e1;
+}
+
+@media (max-width: 860px) {
+ .site-products-grid { grid-template-columns: repeat(2, 1fr); }
+}
+
+@media (max-width: 560px) {
+ .site-products-grid { grid-template-columns: 1fr; }
+}
+</style>
diff --git a/templates/tdesign/spa/src/main-home.js b/templates/tdesign/spa/src/main-home.js
new file mode 100644
index 0000000..531bb12
--- /dev/null
+++ b/templates/tdesign/spa/src/main-home.js
@@ -0,0 +1,12 @@
+import { createApp } from 'vue'
+import TDesign from 'tdesign-vue-next'
+import 'tdesign-vue-next/es/style/index.css'
+import App from './App-home.vue'
+import router from './home/router'
+import './shared/styles/theme.scss'
+import './home/styles/home.scss'
+
+const app = createApp(App)
+app.use(TDesign)
+app.use(router)
+app.mount('#app')
diff --git a/templates/tdesign/spa/src/shared/assets/bg1.jpg b/templates/tdesign/spa/src/shared/assets/bg1.jpg
new file mode 100644
index 0000000..df42deb
Binary files /dev/null and b/templates/tdesign/spa/src/shared/assets/bg1.jpg differ
diff --git a/templates/tdesign/spa/src/shared/assets/bg2.jpg b/templates/tdesign/spa/src/shared/assets/bg2.jpg
new file mode 100644
index 0000000..3ea36e8
Binary files /dev/null and b/templates/tdesign/spa/src/shared/assets/bg2.jpg differ
diff --git a/templates/tdesign/spa/src/shared/assets/bg3.jpg b/templates/tdesign/spa/src/shared/assets/bg3.jpg
new file mode 100644
index 0000000..83ca8f5
Binary files /dev/null and b/templates/tdesign/spa/src/shared/assets/bg3.jpg differ
diff --git a/templates/tdesign/spa/src/user/layouts/UserLayout.vue b/templates/tdesign/spa/src/user/layouts/UserLayout.vue
index 0ebdc81..1ab3723 100644
--- a/templates/tdesign/spa/src/user/layouts/UserLayout.vue
+++ b/templates/tdesign/spa/src/user/layouts/UserLayout.vue
@@ -151,7 +151,7 @@
</div>
<div class="td-side-user-info">
<strong>{{ userName }}</strong>
- <span>v{{ boot.version || '0.2.0' }}</span>
+ <span>v{{ boot.version || '0.3.0' }}</span>
</div>
<button class="td-side-user-logout" title="退出登录" @click="onLogout">
<i class="mdi mdi-logout-variant"></i>
diff --git a/templates/tdesign/spa/user.html b/templates/tdesign/spa/user.html
index c91c93a..4f6f94f 100644
--- a/templates/tdesign/spa/user.html
+++ b/templates/tdesign/spa/user.html
@@ -21,7 +21,7 @@
ssbt: 'bt001',
yhc: {},
theme: 'tdesign',
- version: '0.2.0',
+ version: '0.3.0',
entry: 'dashboard',
hash: '#/dashboard',
pluginMenuHtml: '',
diff --git a/templates/tdesign/spa/vite.home.config.js b/templates/tdesign/spa/vite.home.config.js
new file mode 100644
index 0000000..17e19f8
--- /dev/null
+++ b/templates/tdesign/spa/vite.home.config.js
@@ -0,0 +1,43 @@
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import { resolve } from 'path'
+
+// 主页/售卖前端构建配置(home scope)
+export default defineConfig({
+ plugins: [vue()],
+ base: './',
+ resolve: {
+ alias: {
+ '@': resolve(__dirname, 'src'),
+ },
+ },
+ build: {
+ outDir: resolve(__dirname, '../home/dist'),
+ emptyOutDir: true,
+ assetsDir: 'assets',
+ cssCodeSplit: false,
+ chunkSizeWarningLimit: 3000,
+ rollupOptions: {
+ input: resolve(__dirname, 'home.html'),
+ output: {
+ entryFileNames: 'assets/index.js',
+ chunkFileNames: 'assets/[name].js',
+ assetFileNames: (info) => {
+ const n = info.name || ''
+ if (n.endsWith('.css')) return 'assets/index.css'
+ return 'assets/[name][extname]'
+ },
+ inlineDynamicImports: true,
+ },
+ },
+ },
+ server: {
+ port: 5177,
+ proxy: {
+ '/index.php': {
+ target: 'http://127.0.0.1',
+ changeOrigin: true,
+ },
+ },
+ },
+})
diff --git a/templates/tdesign/theme.json b/templates/tdesign/theme.json
index ef1a00f..30956fe 100644
--- a/templates/tdesign/theme.json
+++ b/templates/tdesign/theme.json
@@ -1,8 +1,8 @@
{
"name": "tdesign",
- "title": "TDesign 双端主题",
- "version": "0.2.0",
- "description": "基于 Vue 3 + TDesign Vue Next 的双端 SPA 主题,覆盖用户端与管理端全部页面",
+ "title": "TDesign 三端主题",
+ "version": "0.3.0",
+ "description": "基于 Vue 3 + TDesign Vue Next 的三端 SPA 主题,覆盖用户端、管理端与主页售卖全部页面",
"author": "MNBT",
- "scope": ["user", "admin"]
+ "scope": ["user", "admin", "home"]
}
diff --git a/templates/tdesign/theme.php b/templates/tdesign/theme.php
index c027712..8143c19 100644
--- a/templates/tdesign/theme.php
+++ b/templates/tdesign/theme.php
@@ -19,3 +19,25 @@ if (function_exists('mnbt_register_theme_menu_renderer')) {
return '';
});
}
+
+// 主页自定义设置字段(后台「前端模板 → 主页内容」自动渲染)
+// 底部备案信息:显示在主页页脚,自动链接到工信部/公安备案查询
+if (function_exists('mnbt_register_home_setting')) {
+ mnbt_register_home_setting([
+ 'key' => 'beian_info',
+ 'label' => 'ICP 备案信息',
+ 'type' => 'text',
+ 'default' => '',
+ 'placeholder' => '如:京ICP备12345678号',
+ 'hint' => '显示在主页页脚,自动添加工信部备案查询链接',
+ ]);
+
+ mnbt_register_home_setting([
+ 'key' => 'ps_beian',
+ 'label' => '公安备案信息',
+ 'type' => 'text',
+ 'default' => '',
+ 'placeholder' => '如:京公网安备11010802020266号',
+ 'hint' => '显示在主页页脚(可选),自动添加全国公安网站备案查询链接',
+ ]);
+}
diff --git a/templates/tdesign/user/_spa_boot.php b/templates/tdesign/user/_spa_boot.php
index 5d34fd6..9c73b60 100644
--- a/templates/tdesign/user/_spa_boot.php
+++ b/templates/tdesign/user/_spa_boot.php
@@ -24,7 +24,7 @@ $boot = [
'logoIndex' => mnbt_asset_url('upload_logo/logo.index.png'),
'auther' => $conf['auther'] ?? '',
'theme' => 'tdesign',
- 'version' => '0.2.0',
+ 'version' => '0.3.0',
'entry' => $td_entry ?? 'dashboard',
'hash' => $td_hash ?? '',
'pluginMenuHtml' => '',