2b69686795
- 新增404页面,优化未找到页面体验,避免被搜索引擎索引 - 增加文件代理接口,隐藏真实文件服务器地址,支持文件请求代理 - 实现/article、/case、/product及/page动态路由兼容列表与详情展示 - 添加动态CMS页面兼容入口处理旧式路径,统一路由与SEO设置 - 新增模板1、模板7、模板2、模板3关于我们页面,实现多模板支持 - 模板增强支持CMS单页内容加载及SEO信息动态设置 - 配置环境变量及Git忽略文件规则辅助开发和构建环境管理
114 lines
6.3 KiB
Vue
114 lines
6.3 KiB
Vue
<template>
|
||
<!-- 顶部信息条 -->
|
||
<div class="bg-[#1E2A47] text-[#C7CEDB] text-xs">
|
||
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
|
||
<div class="flex items-center justify-between h-9">
|
||
<span class="truncate">{{ topWelcome }}</span>
|
||
<div class="flex items-center gap-3 flex-shrink-0">
|
||
<span class="hidden sm:inline">全国统一服务热线</span>
|
||
<a v-if="phone" :href="`tel:${phone}`" class="font-semibold text-white hover:text-[#FF6B6B] transition-colors">{{ phone }}</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<header class="sticky top-0 z-50 bg-white border-b border-[#E5E7EB]">
|
||
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
|
||
<div class="flex items-center justify-between h-20">
|
||
<!-- Logo -->
|
||
<SiteBrand
|
||
link-class="flex-shrink-0"
|
||
:logo="siteLogo"
|
||
:icon="siteIcon"
|
||
:name="siteName"
|
||
logo-class="h-12 w-auto max-w-[220px] object-contain"
|
||
icon-class="h-8 w-auto object-contain"
|
||
name-class="text-xl font-bold text-[#1E2A47] truncate max-w-[200px]"
|
||
>
|
||
<template #fallback-icon>
|
||
<div class="w-10 h-10 rounded-lg bg-[#1E2A47] flex items-center justify-center">
|
||
<svg class="w-6 h-6 text-white" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2L3 7v10l9 5 9-5V7l-9-5zm0 2.3L18.5 8 12 11.7 5.5 8 12 4.3zM5 9.6l6 3.3v6.8l-6-3.3V9.6zm14 0v6.8l-6 3.3V12.9l6-3.3z" /></svg>
|
||
</div>
|
||
</template>
|
||
</SiteBrand>
|
||
|
||
<!-- 搜索框(后台 setting.searchBtn 控制是否显示;提交带关键词跳转资讯列表) -->
|
||
<SiteSearchBox v-if="showHeaderSearch" variant="light" accent="#1E2A47" class="hidden lg:flex items-center ml-8" />
|
||
|
||
<!-- 桌面端导航 -->
|
||
<nav class="hidden lg:flex items-center gap-1 ml-auto">
|
||
<template v-for="item in navItems" :key="item.navigationId || item.path">
|
||
<div v-if="item.children && item.children.length > 0" class="relative group h-20 flex items-center">
|
||
<button class="flex items-center gap-1 px-3 text-base font-medium text-[#1E2A47] hover:text-[#CF1313] transition-colors">
|
||
{{ item.title }}
|
||
<svg class="w-4 h-4 transition-transform group-hover:rotate-180" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
|
||
</button>
|
||
<div class="absolute left-0 top-full pt-2 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200">
|
||
<div class="bg-white rounded-xl shadow-xl border border-[#E5E7EB] py-2 min-w-[200px]">
|
||
<NuxtLink
|
||
v-for="child in item.children" :key="child.navigationId" :to="getChildPath(child)"
|
||
class="block px-5 py-2.5 text-[15px] text-[#333333] hover:text-[#CF1313] hover:bg-[#F4F6FA] transition-colors whitespace-nowrap"
|
||
>
|
||
{{ child.title }}
|
||
</NuxtLink>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<NuxtLink
|
||
v-else :to="getNavLink(item)" :target="item.target === '_blank' ? '_blank' : undefined"
|
||
class="px-3 text-base font-medium text-[#1E2A47] hover:text-[#CF1313] transition-colors" active-class="text-[#CF1313]"
|
||
>
|
||
{{ item.title }}
|
||
</NuxtLink>
|
||
</template>
|
||
<NuxtLink to="/contact" class="ml-3 inline-flex items-center justify-center px-5 py-2.5 bg-[#CF1313] text-white text-base font-semibold rounded-full hover:bg-[#A60E0E] transition-colors shadow-sm">立即咨询</NuxtLink>
|
||
</nav>
|
||
|
||
<!-- 移动端汉堡 -->
|
||
<button class="lg:hidden ml-auto p-2 rounded-lg hover:bg-[#F4F6FA]" @click="mobileMenuOpen = !mobileMenuOpen" aria-label="菜单">
|
||
<svg v-if="!mobileMenuOpen" class="w-6 h-6 text-[#1E2A47]" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" /></svg>
|
||
<svg v-else class="w-6 h-6 text-[#1E2A47]" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /></svg>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 移动端展开菜单 -->
|
||
<div v-if="mobileMenuOpen" class="lg:hidden bg-white border-t border-[#E5E7EB]">
|
||
<div class="container mx-auto px-4 py-4 space-y-1">
|
||
<template v-for="item in navItems" :key="item.navigationId || item.path">
|
||
<div v-if="item.children && item.children.length > 0">
|
||
<div class="px-2 py-2.5 text-base font-semibold text-[#1E2A47]">{{ item.title }}</div>
|
||
<NuxtLink
|
||
v-for="child in item.children" :key="child.navigationId" :to="getChildPath(child)"
|
||
class="block px-6 py-2 text-sm text-[#666666] hover:text-[#CF1313] hover:bg-[#F4F6FA] rounded-lg transition-colors" @click="mobileMenuOpen = false"
|
||
>
|
||
{{ child.title }}
|
||
</NuxtLink>
|
||
</div>
|
||
<NuxtLink
|
||
v-else :to="getNavLink(item)" :target="item.target === '_blank' ? '_blank' : undefined"
|
||
class="block px-2 py-2.5 text-base font-medium text-[#1E2A47] hover:text-[#CF1313] hover:bg-[#F4F6FA] rounded-lg transition-colors"
|
||
active-class="text-[#CF1313] bg-[#F4F6FA]" @click="mobileMenuOpen = false"
|
||
>
|
||
{{ item.title }}
|
||
</NuxtLink>
|
||
</template>
|
||
<NuxtLink to="/contact" class="block px-2 py-2.5 mt-2 text-center bg-[#CF1313] text-white font-semibold rounded-lg hover:bg-[#A60E0E] transition-colors" @click="mobileMenuOpen = false">立即咨询</NuxtLink>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import type { CmsNavigation } from '~/types'
|
||
const { siteInfo, siteName, siteLogo, siteIcon, navigations, phone, showHeaderSearch, fetchSiteInfo } = useSite()
|
||
const mobileMenuOpen = ref(false)
|
||
|
||
const topWelcome = computed(() => siteInfo.value?.welcomeInfo || `${siteName.value || '我们'} · 专业的企业数字化服务提供商`)
|
||
|
||
function getChildPath(child: CmsNavigation): string { return getNavLink(child) }
|
||
|
||
await fetchSiteInfo()
|
||
const navItems = computed<CmsNavigation[]>(() => navigations.value || [])
|
||
</script>
|