Files
BlackFruit-UI/header.html
yiqiu b90b24a0d7
All checks were successful
continuous-integration/drone/push Build is passing
三级导航菜单系统实现
2026-01-10 16:45:20 +08:00

129 lines
5.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en" theme-color="default" theme-mode id="addons_js" addons_js='{:json_encode($addons)}'>
<head>
{php}
// 在渲染阶段从主题配置插件读取配置,并覆盖 $data 与 SEO 变量,实现 SSR
if (class_exists('\\addon\\theme_configurator\\model\\ThemeConfigModel')) {
$cfgModel = new \addon\theme_configurator\model\ThemeConfigModel();
$themeCfg = $cfgModel->getConfig();
if (is_array($themeCfg)) {
$site = isset($themeCfg['site_config']) && is_array($themeCfg['site_config'])
? $themeCfg['site_config']
: [];
if (!isset($data) || !is_array($data)) {
$data = [];
}
// 覆盖 / 补充首页相关结构数据
if (isset($themeCfg['banner'])) {
$data['banner'] = $themeCfg['banner'];
}
if (isset($themeCfg['honor'])) {
$data['honor'] = $themeCfg['honor'];
}
if (isset($themeCfg['friendly_link'])) {
$data['friendly_link'] = $themeCfg['friendly_link'];
}
if (isset($themeCfg['header_nav'])) {
$data['header_nav'] = $themeCfg['header_nav'];
}
if (isset($themeCfg['footer_nav'])) {
$data['footer_nav'] = $themeCfg['footer_nav'];
}
if (isset($themeCfg['side'])) {
$data['side_floating_window'] = $themeCfg['side'];
}
// 站点基础信息,供 header/footer 与其他模板直接使用
$data['enterprise_name'] = $site['enterprise_name'] ?? ($data['enterprise_name'] ?? '');
$data['enterprise_telephone'] = $site['enterprise_telephone'] ?? ($data['enterprise_telephone'] ?? '');
$data['enterprise_mailbox'] = $site['enterprise_mailbox'] ?? ($data['enterprise_mailbox'] ?? '');
$data['enterprise_qrcode'] = $site['enterprise_qrcode'] ?? ($data['enterprise_qrcode'] ?? '');
$data['official_website_logo']= $site['official_website_logo']?? ($data['official_website_logo']?? '');
$data['online_customer_service_link'] =
$site['online_customer_service_link'] ?? ($data['online_customer_service_link'] ?? '');
$data['icp_info'] = $site['icp_info'] ?? ($data['icp_info'] ?? '');
$data['icp_info_link'] = $site['icp_info_link'] ?? ($data['icp_info_link'] ?? '');
$data['public_security_network_preparation'] =
$site['public_security_network_preparation'] ??
($data['public_security_network_preparation'] ?? '');
$data['public_security_network_preparation_link'] =
$site['public_security_network_preparation_link'] ??
($data['public_security_network_preparation_link'] ?? '');
$data['telecom_appreciation'] = $site['telecom_appreciation'] ?? ($data['telecom_appreciation'] ?? '');
$data['copyright_info'] = $site['copyright_info'] ?? ($data['copyright_info'] ?? '');
$data['terms_service_url'] = $site['terms_service_url'] ?? ($data['terms_service_url'] ?? '');
$data['terms_privacy_url'] = $site['terms_privacy_url'] ?? ($data['terms_privacy_url'] ?? '');
$data['cloud_product_link'] = $site['cloud_product_link'] ?? ($data['cloud_product_link'] ?? '');
$data['dcim_product_link'] = $site['dcim_product_link'] ?? ($data['dcim_product_link'] ?? '');
// SEO如插件配置了 SEO则覆盖控制器传入的标题/关键词/描述
if (!empty($themeCfg['seo']['title'])) {
$title = $themeCfg['seo']['title'];
}
if (!empty($themeCfg['seo']['keywords'])) {
$keywords = $themeCfg['seo']['keywords'];
}
if (!empty($themeCfg['seo']['description'])) {
$description = $themeCfg['seo']['description'];
}
}
}
{/php}
<meta charset="UTF-8">
<title>{$title}</title>
<meta name="keywords" content="{$keywords}" />
<meta name="description" content="{$description}" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Language" content="zh-cn">
<!-- 公共区域 -->
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="/web/BlackFruit-web/assets/font/iconfont.css">
<link rel="stylesheet" href="/web/BlackFruit-web/common/reset.css">
<link rel="stylesheet" href="/web/BlackFruit-web/common/style.css">
<link rel="stylesheet" href="/web/BlackFruit-web/common/theme.css">
<link rel="stylesheet" href="/web/BlackFruit-web/common/common.css">
<!-- Modular header/footer/nav styles -->
<link rel="stylesheet" href="/web/BlackFruit-web/css/common.css">
<link rel="stylesheet" href="/web/BlackFruit-web/css/nav-mega-menu.css">
<link rel="stylesheet" href="/web/BlackFruit-web/vender/animate/animate.css">
<script src="/web/BlackFruit-web/vender/jQuery/jquery-3.5.1.min.js"></script>
<!-- bootstrap -->
<link rel="stylesheet" href="/web/BlackFruit-web/vender/bootstrap/css/bootstrap.min.css">
<script src="/web/BlackFruit-web/vender/bootstrap/js/bootstrap.min.js"></script>
<!-- swiper -->
<link rel="stylesheet" href="/web/BlackFruit-web/vender/swiper/swiper-bundle.min.css">
<script src="/web/BlackFruit-web/vender/swiper/swiper-bundle.min.js"></script>
<script src="/web/BlackFruit-web/common/common.js"></script>
<script src="/web/BlackFruit-web/js/ai.js"></script>
<link rel="alternate" hreflang="zh-Hans" href="{$url}">
<link rel="canonical" href="{$url}">
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{$url}",
"title": "{$title}",
"description": "{$description}",
"pubDate": "{$pub_date}",
"upDate": "{$up_date}"
}
</script>
<script>
// 将后端注入的配置映射到前端变量,供旧脚本兼容使用,避免再次通过接口请求主题配置
window.__themeCommon = {: json_encode(isset($data) ? $data : [])};
try {
if (!sessionStorage.commentData) {
sessionStorage.commentData = JSON.stringify(window.__themeCommon || {});
}
} catch (e) { }
</script>