$conf['name'] ?? 'MNBT',
'footer' => $conf['hxp'] ?? '',
'loggedIn' => isset($islogins) && (int)$islogins === 1,
'needCaptcha' => isset($conf['yzm']) && $conf['yzm'] === 'true',
'ajaxBase' => './ajax.php',
'codeUrl' => './code.php',
'logo' => mnbt_asset_url('upload_logo/logo.login.png'),
'logoHead' => mnbt_asset_url('upload_logo/logo.head.png'),
'logoIndex' => mnbt_asset_url('upload_logo/logo.index.png'),
'auther' => $conf['auther'] ?? '',
'theme' => 'tdesign',
'version' => '0.3.0',
'entry' => $td_entry ?? 'dashboard',
'hash' => $td_hash ?? '',
'pluginMenuHtml' => '',
'conf' => $conf ?? [],
'user' => $user ?? '',
'zjid' => $zjid ?? 0,
'ssbt' => $ssbt ?? '',
'yhc' => $yhc ?? [],
'serverHost' => $_SERVER['HTTP_HOST'] ?? '',
'serverProto' => (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || ($_SERVER['SERVER_PORT'] ?? '') == '443' ? 'https://' : 'http://',
'pluginSettingsTabs' => function_exists('mnbt_plugin_settings_tabs') ? array_map(function ($tab) {
if (empty($tab['icon']) && !empty($tab['plugin'])) {
$meta = $GLOBALS['mnbt_plugin_meta'][$tab['plugin']] ?? [];
$tab['icon'] = !empty($meta['icon']) ? $meta['icon'] : 'mdi-cog-outline';
}
return $tab;
}, mnbt_plugin_settings_tabs()) : [],
];
// 视图可在 include 前设置 $td_inject(数组),把页面级数据注入 boot
if (isset($td_inject) && is_array($td_inject)) {
foreach ($td_inject as $k => $v) {
$boot[$k] = $v;
}
}
// 插件菜单 HTML(独立"扩展与工具"分组,所有插件项通过 SPA 路由在 layout 内打开)
$boot['pluginMenuHtml'] = _tdboot_render_plugin_menu_html(function_exists('mnbt_plugin_menus') ? mnbt_plugin_menus('user') : []);
/**
* 渲染插件菜单区 HTML
* 输出形如:
*
...扩展与工具...
*
* 独立叶子项(带 data-td-route)
*/
function _tdboot_render_plugin_menu_html($items)
{
if (empty($items)) {
return '';
}
$groups = [];
$leafs = [];
$html = '';
foreach ($items as $it) {
if (!empty($it['children'])) {
$groups[] = $it;
} else {
$leafs[] = $it;
}
}
foreach ($groups as $g) {
$html .= _tdboot_render_plugin_group($g);
}
foreach ($leafs as $lf) {
// 独立叶子项直接作为顶层菜单项,与其它业务项视觉一致
$html .= _tdboot_render_plugin_leaf_item($lf);
}
return $html;
}
function _tdboot_render_plugin_group($it)
{
$title = htmlspecialchars($it['title'] ?? '', ENT_QUOTES, 'UTF-8');
$icon = !empty($it['icon']) ? htmlspecialchars($it['icon'], ENT_QUOTES, 'UTF-8') : 'mdi-puzzle';
$childrenHtml = '';
foreach ($it['children'] as $child) {
$childrenHtml .= _tdboot_render_plugin_menu_child($child);
}
return '';
}
function _tdboot_render_plugin_menu_child($it)
{
$title = htmlspecialchars($it['title'] ?? '', ENT_QUOTES, 'UTF-8');
$icon = !empty($it['icon']) ? htmlspecialchars($it['icon'], ENT_QUOTES, 'UTF-8') : 'mdi-puzzle';
if (!empty($it['children'])) {
$childrenHtml = '';
foreach ($it['children'] as $child) {
$childrenHtml .= _tdboot_render_plugin_menu_child($child);
}
return '';
}
return _tdboot_render_plugin_leaf_item($it);
}
/**
* 渲染插件叶子菜单项
* 为 plugin.php 链接生成 data-td-route 属性,由 SPA 拦截并在 layout 内通过 iframe 加载
*/
function _tdboot_render_plugin_leaf_item($it)
{
$title = htmlspecialchars($it['title'] ?? '', ENT_QUOTES, 'UTF-8');
$icon = !empty($it['icon']) ? htmlspecialchars($it['icon'], ENT_QUOTES, 'UTF-8') : 'mdi-puzzle';
$url = $it['url'] ?? 'javascript:void(0)';
$urlH = htmlspecialchars($url, ENT_QUOTES, 'UTF-8');
$routeAttr = '';
if (strpos($url, 'plugin.php') !== false) {
// 解析 query,生成 SPA 路由路径
$query = parse_url($url, PHP_URL_QUERY) ?? '';
$routeAttr = ' data-td-route="/plugin?' . $query . '"';
}
return ''
. ''
. '' . $title . '';
}
?>
= htmlspecialchars(($title ?? '控制面板') . ' · ' . ($conf['name'] ?? 'MNBT'), ENT_QUOTES, 'UTF-8') ?>
TDesign 用户端尚未构建
请在服务器或本机执行:
cd templates/tdesign/spa && npm install && npm run build:user
构建产物应位于 templates/tdesign/user/dist/