feat(app): 添加多模板关于我们页面及相关路由和404页面
- 新增404页面,优化未找到页面体验,避免被搜索引擎索引 - 增加文件代理接口,隐藏真实文件服务器地址,支持文件请求代理 - 实现/article、/case、/product及/page动态路由兼容列表与详情展示 - 添加动态CMS页面兼容入口处理旧式路径,统一路由与SEO设置 - 新增模板1、模板7、模板2、模板3关于我们页面,实现多模板支持 - 模板增强支持CMS单页内容加载及SEO信息动态设置 - 配置环境变量及Git忽略文件规则辅助开发和构建环境管理
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<footer class="bg-[var(--t10-footer-bg)] text-[var(--t10-footer-text)]">
|
||||
<div class="t10-container py-12 lg:py-16">
|
||||
<!-- 上排:Logo 联系信息 + 链接列 -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-10 lg:gap-8">
|
||||
<!-- 公司信息 -->
|
||||
<div class="lg:col-span-2">
|
||||
<SiteBrand
|
||||
link-class="inline-flex items-center gap-2 mb-5"
|
||||
:logo="siteLogo"
|
||||
:icon="siteIcon"
|
||||
:name="siteName"
|
||||
logo-class="h-[44px] w-auto max-w-[220px] object-contain brightness-0 invert"
|
||||
icon-class="h-8 w-auto object-contain brightness-0 invert"
|
||||
name-class="text-xl font-bold text-white truncate max-w-[220px]"
|
||||
>
|
||||
<template #fallback-icon>
|
||||
<span class="text-xl font-bold text-white">C-MVP</span>
|
||||
</template>
|
||||
</SiteBrand>
|
||||
<ul class="space-y-3 text-sm">
|
||||
<li v-if="phone" class="flex items-start gap-3">
|
||||
<svg class="w-4 h-4 mt-0.5 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
|
||||
</svg>
|
||||
<a :href="`tel:${phone}`" class="hover:text-white transition-colors">{{ phone }}</a>
|
||||
</li>
|
||||
<li v-if="email" class="flex items-start gap-3">
|
||||
<svg class="w-4 h-4 mt-0.5 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
|
||||
</svg>
|
||||
<a :href="`mailto:${email}`" class="hover:text-white transition-colors break-all">{{ email }}</a>
|
||||
</li>
|
||||
<li v-if="siteUrl" class="flex items-start gap-3">
|
||||
<svg class="w-4 h-4 mt-0.5 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
|
||||
</svg>
|
||||
<a :href="siteUrl" target="_blank" rel="noopener" class="hover:text-white transition-colors break-all">{{ siteUrl }}</a>
|
||||
</li>
|
||||
<li v-if="address" class="flex items-start gap-3">
|
||||
<svg class="w-4 h-4 mt-0.5 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
<span>{{ address }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 链接列 -->
|
||||
<div v-for="col in linkColumns" :key="col.title">
|
||||
<h3 class="text-white font-semibold mb-5">{{ col.title }}</h3>
|
||||
<ul class="space-y-2.5 text-sm">
|
||||
<li v-for="link in col.links" :key="link.navigationId || link.path">
|
||||
<NuxtLink
|
||||
:to="getNavLink(link)"
|
||||
:target="link.target === '_blank' ? '_blank' : undefined"
|
||||
class="hover:text-white transition-colors"
|
||||
>
|
||||
{{ link.title }}
|
||||
</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<div class="mt-12 pt-8 border-t border-white/15">
|
||||
<div class="flex flex-col md:flex-row items-center justify-between gap-4 text-xs text-center md:text-left">
|
||||
<span>{{ copyright || `Copyright © ${new Date().getFullYear()} ${siteName || ''} 版权所有` }}</span>
|
||||
<div class="flex flex-wrap items-center justify-center gap-x-4 gap-y-2">
|
||||
<a
|
||||
v-if="icpNo"
|
||||
href="https://beian.miit.gov.cn"
|
||||
target="_blank"
|
||||
rel="nofollow"
|
||||
class="hover:text-white transition-colors"
|
||||
>{{ icpNo }}</a>
|
||||
<a
|
||||
v-if="siteInfo?.policeNo"
|
||||
:href="policeUrl"
|
||||
target="_blank"
|
||||
rel="nofollow"
|
||||
class="hover:text-white transition-colors"
|
||||
>{{ siteInfo.policeNo }}</a>
|
||||
<a
|
||||
rel="nofollow"
|
||||
href="https://site.websoft.top"
|
||||
target="_blank"
|
||||
class="hover:text-white transition-colors"
|
||||
>Powered by 云·企业官网</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 模板 10 - Footer 组件(创芯存储科技蓝风格)
|
||||
* 科技蓝底 + 公司信息 + 四列链接 + 备案版权
|
||||
*/
|
||||
import type { CmsNavigation } from '~/types'
|
||||
|
||||
const {
|
||||
siteInfo, siteName, siteLogo, siteIcon,
|
||||
phone, email, address, copyright, icpNo,
|
||||
navigations, allNavigations, fetchSiteInfo
|
||||
} = useSite()
|
||||
|
||||
await fetchSiteInfo()
|
||||
|
||||
const siteUrl = computed(() => {
|
||||
const url = siteInfo.value?.domain || ''
|
||||
if (!url) return ''
|
||||
return url.startsWith('http') ? url : `https://${url}`
|
||||
})
|
||||
|
||||
const policeUrl = computed(() => {
|
||||
const no = String(siteInfo.value?.policeNo || '')
|
||||
const code = no.replace(/\D/g, '')
|
||||
return code
|
||||
? `https://beian.mps.gov.cn/#/query/webSearch?code=${code}`
|
||||
: 'https://beian.mps.gov.cn/'
|
||||
})
|
||||
|
||||
/** 按模型或标题智能分组链接 */
|
||||
const linkColumns = computed(() => {
|
||||
const navs = navigations.value || []
|
||||
const all = allNavigations.value || []
|
||||
const cols: { title: string, links: CmsNavigation[] }[] = []
|
||||
|
||||
const findByModel = (model: string) => all.filter((n) => n.model === model && (n.parentId || 0) === 0).slice(0, 6)
|
||||
const findByKeyword = (...keywords: string[]) => {
|
||||
return navs.filter((n) => keywords.some((k) => n.title.includes(k))).slice(0, 6)
|
||||
}
|
||||
|
||||
const products = findByModel('product')
|
||||
if (products.length) cols.push({ title: products[0]?.title || '产品中心', links: products[0]?.children?.slice(0, 6) || [products[0]].filter(Boolean) })
|
||||
|
||||
const cases = findByModel('case')
|
||||
if (cases.length) cols.push({ title: cases[0]?.title || '行业解决方案', links: cases[0]?.children?.slice(0, 6) || [cases[0]].filter(Boolean) })
|
||||
|
||||
const aboutLinks = findByKeyword('关于', '资讯', '联系', '加入')
|
||||
if (aboutLinks.length) cols.push({ title: '关于我们', links: aboutLinks })
|
||||
|
||||
const partnerLinks = findByKeyword('合作', '伙伴', '服务')
|
||||
if (partnerLinks.length) cols.push({ title: '合作伙伴', links: partnerLinks })
|
||||
|
||||
// 兜底:用底部导航补足列数
|
||||
if (cols.length < 3) {
|
||||
const bottom = (navs || []).filter((n) => n.model !== 'index').slice(0, 6)
|
||||
if (bottom.length) cols.push({ title: '快速链接', links: bottom })
|
||||
}
|
||||
|
||||
return cols
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<header class="sticky top-0 z-50 bg-white shadow-sm">
|
||||
<div class="t10-container flex items-center h-[72px]">
|
||||
<!-- Logo -->
|
||||
<SiteBrand
|
||||
link-class="flex-shrink-0 mr-8 lg:mr-12"
|
||||
:logo="siteLogo"
|
||||
:icon="siteIcon"
|
||||
:name="siteName"
|
||||
logo-class="h-[44px] w-auto max-w-[220px] object-contain"
|
||||
icon-class="h-8 w-auto object-contain"
|
||||
name-class="text-xl font-bold text-[var(--t10-primary)] truncate max-w-[220px]"
|
||||
>
|
||||
<template #fallback-icon>
|
||||
<span class="text-xl font-bold text-[var(--t10-primary)]">C-MVP</span>
|
||||
</template>
|
||||
</SiteBrand>
|
||||
|
||||
<!-- 桌面端导航 -->
|
||||
<nav class="hidden lg:flex items-center h-full flex-1 min-w-0">
|
||||
<template v-for="item in navItems" :key="item.navigationId || item.path">
|
||||
<!-- 有子菜单 -->
|
||||
<div v-if="item.children && item.children.length > 0" class="relative group h-full flex items-center">
|
||||
<button
|
||||
class="h-full px-4 text-[15px] text-[var(--t10-text)] hover:text-[var(--t10-primary)] transition-colors flex items-center gap-1 whitespace-nowrap"
|
||||
>
|
||||
{{ item.title }}
|
||||
<svg class="w-3.5 h-3.5" 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 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all">
|
||||
<div class="bg-white shadow-lg border border-[var(--t10-border)] py-2 min-w-[164px]">
|
||||
<NuxtLink
|
||||
v-for="child in item.children"
|
||||
:key="child.navigationId"
|
||||
:to="getChildPath(child)"
|
||||
class="block px-4 py-2 text-[15px] text-[var(--t10-text-secondary)] hover:text-[var(--t10-primary)] hover:bg-[var(--t10-primary-soft)] transition-colors whitespace-nowrap"
|
||||
>
|
||||
{{ child.title }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 无子菜单 -->
|
||||
<NuxtLink
|
||||
v-else
|
||||
:to="getNavLink(item)"
|
||||
:target="item.target === '_blank' ? '_blank' : undefined"
|
||||
class="h-full px-4 flex items-center text-[15px] text-[var(--t10-text)] hover:text-[var(--t10-primary)] transition-colors whitespace-nowrap relative"
|
||||
active-class="!text-[var(--t10-primary)] after:absolute after:left-4 after:right-4 after:bottom-0 after:h-[2px] after:bg-[var(--t10-primary)]"
|
||||
>
|
||||
{{ item.title }}
|
||||
</NuxtLink>
|
||||
</template>
|
||||
</nav>
|
||||
|
||||
<!-- 右侧:语言 + 搜索 -->
|
||||
<div class="hidden lg:flex items-center gap-4 flex-shrink-0 ml-4">
|
||||
<button class="text-sm text-[var(--t10-text-secondary)] hover:text-[var(--t10-primary)] transition-colors border border-[var(--t10-border)] rounded-full px-3 py-1">
|
||||
CN
|
||||
</button>
|
||||
<SiteSearchBox
|
||||
v-if="showHeaderSearch"
|
||||
variant="light"
|
||||
accent="var(--t10-primary)"
|
||||
placeholder="搜索"
|
||||
class="flex items-center"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 移动端菜单按钮 -->
|
||||
<button
|
||||
class="lg:hidden ml-auto p-2 text-[var(--t10-text)]"
|
||||
aria-label="菜单"
|
||||
@click="mobileMenuOpen = !mobileMenuOpen"
|
||||
>
|
||||
<svg v-if="!mobileMenuOpen" class="w-6 h-6" 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" 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 v-if="mobileMenuOpen" class="lg:hidden bg-white border-t border-[var(--t10-border)]">
|
||||
<div class="t10-container py-4 space-y-1">
|
||||
<SiteSearchBox
|
||||
v-if="showHeaderSearch"
|
||||
variant="light"
|
||||
accent="var(--t10-primary)"
|
||||
placeholder="搜索"
|
||||
class="mb-3"
|
||||
/>
|
||||
<template v-for="item in navItems" :key="item.navigationId || item.path">
|
||||
<div v-if="item.children && item.children.length > 0">
|
||||
<div class="px-4 py-3 text-base font-semibold text-[var(--t10-primary)]">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
<NuxtLink
|
||||
v-for="child in item.children"
|
||||
:key="child.navigationId"
|
||||
:to="getChildPath(child)"
|
||||
class="block px-8 py-2 text-sm text-[var(--t10-text-secondary)] hover:text-[var(--t10-primary)] hover:bg-[var(--t10-primary-soft)] transition-colors"
|
||||
@click="mobileMenuOpen = false"
|
||||
>
|
||||
{{ child.title }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
<NuxtLink
|
||||
v-else
|
||||
:to="getNavLink(item)"
|
||||
:target="item.target === '_blank' ? '_blank' : undefined"
|
||||
class="block px-4 py-3 text-base text-[var(--t10-text)] hover:text-[var(--t10-primary)] hover:bg-[var(--t10-primary-soft)] transition-colors"
|
||||
active-class="text-[var(--t10-primary)] bg-[var(--t10-primary-soft)]"
|
||||
@click="mobileMenuOpen = false"
|
||||
>
|
||||
{{ item.title }}
|
||||
</NuxtLink>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 模板 10 - Header 组件(创芯存储科技蓝风格)
|
||||
* 白底 72px,左 Logo + 水平菜单 + 右侧语言切换与搜索
|
||||
*/
|
||||
import type { CmsNavigation } from '~/types'
|
||||
|
||||
const { siteName, siteLogo, siteIcon, navigations, showHeaderSearch, fetchSiteInfo } = useSite()
|
||||
const mobileMenuOpen = ref(false)
|
||||
|
||||
function getChildPath(child: CmsNavigation): string {
|
||||
return getNavLink(child)
|
||||
}
|
||||
|
||||
await fetchSiteInfo()
|
||||
|
||||
const navItems = computed<CmsNavigation[]>(() => {
|
||||
return navigations.value || []
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<section class="relative overflow-hidden bg-[#050B1F]">
|
||||
<!-- 背景图 -->
|
||||
<div class="absolute inset-0">
|
||||
<img
|
||||
v-if="bannerMode && banners.length"
|
||||
:src="bannerImg(banners[currentBannerIndex])"
|
||||
:alt="banners[currentBannerIndex]?.title || siteName"
|
||||
class="w-full h-full object-cover"
|
||||
>
|
||||
<img
|
||||
v-else
|
||||
src="/images/template-10/hero-bg.jpg"
|
||||
alt=""
|
||||
class="w-full h-full object-cover"
|
||||
>
|
||||
<div class="absolute inset-0 bg-gradient-to-r from-[#050B1F]/85 via-[#050B1F]/50 to-transparent" />
|
||||
</div>
|
||||
|
||||
<!-- 内容 -->
|
||||
<div class="t10-container relative z-10 py-20 lg:py-28">
|
||||
<div class="max-w-2xl">
|
||||
<h1 class="text-3xl sm:text-4xl lg:text-5xl font-bold text-white leading-tight mb-5">
|
||||
{{ heroTitle }}
|
||||
</h1>
|
||||
<p class="text-base lg:text-lg text-white/85 leading-relaxed mb-8 max-w-xl">
|
||||
{{ heroSubtitle }}
|
||||
</p>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<NuxtLink v-if="productNav" :to="getNavLink(productNav)" class="t10-btn-primary">
|
||||
了解产品
|
||||
</NuxtLink>
|
||||
<NuxtLink v-if="contactNav" :to="getNavLink(contactNav)" class="t10-btn-outline border-white text-white hover:bg-white hover:text-[var(--t10-primary)]">
|
||||
联系我们
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 指示点 -->
|
||||
<div v-if="bannerMode && banners.length > 1" class="absolute bottom-5 left-0 right-0 flex items-center justify-center gap-2 z-20">
|
||||
<button
|
||||
v-for="(b, i) in banners"
|
||||
:key="'dot-' + (b.id || i)"
|
||||
type="button"
|
||||
:aria-label="'切换到第 ' + (i + 1) + ' 张'"
|
||||
class="w-2.5 h-2.5 rounded-full transition"
|
||||
:class="i === currentBannerIndex ? 'bg-white' : 'bg-white/40 hover:bg-white/70'"
|
||||
@click="goTo(i)"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 模板 10 - Hero 主视觉区(创芯存储科技蓝风格)
|
||||
* 全宽科技背景 + 左对齐大标题 + CTA 按钮
|
||||
*/
|
||||
import type { CmsBanner, CmsNavigation, ApiEnvelope, PageResult } from '~/types'
|
||||
import { ensureFullUrl } from '~/utils/image'
|
||||
|
||||
const { siteInfo, siteName, navigations, fetchSiteInfo } = useSite()
|
||||
await fetchSiteInfo()
|
||||
|
||||
const { data: bannerRes } = await useFetch<ApiEnvelope<PageResult<CmsBanner>> | PageResult<CmsBanner>>('/api/banner', {
|
||||
query: { position: 'home_slider' }
|
||||
})
|
||||
|
||||
const banners = computed<CmsBanner[]>(() => {
|
||||
const d = bannerRes.value as (ApiEnvelope<PageResult<CmsBanner>> | PageResult<CmsBanner>) | null
|
||||
if (!d) return []
|
||||
const list = ((d as ApiEnvelope<PageResult<CmsBanner>>)?.data?.list
|
||||
?? (d as PageResult<CmsBanner>)?.list
|
||||
?? []) as CmsBanner[]
|
||||
return list
|
||||
.filter((b) => hasImage(b) && b.deleted !== 1 && b.status !== 2)
|
||||
.sort((a, b) => (a.sortNum ?? 0) - (b.sortNum ?? 0))
|
||||
})
|
||||
|
||||
const bannerMode = computed(() => banners.value.length > 0)
|
||||
const currentBannerIndex = ref(0)
|
||||
let bannerTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
function startAuto() {
|
||||
if (banners.value.length > 1) {
|
||||
bannerTimer = setInterval(() => {
|
||||
currentBannerIndex.value = (currentBannerIndex.value + 1) % banners.value.length
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
function stopAuto() {
|
||||
if (bannerTimer) { clearInterval(bannerTimer); bannerTimer = null }
|
||||
}
|
||||
onMounted(() => { startAuto() })
|
||||
onBeforeUnmount(() => { stopAuto() })
|
||||
function goTo(i: number) {
|
||||
currentBannerIndex.value = i
|
||||
}
|
||||
|
||||
function bannerImg(b: CmsBanner): string {
|
||||
const raw = ensureFullUrl(b.image || b.imageUrl || b.pic || b.url || '')
|
||||
return raw.replace(/resize,w_\d+/, 'resize,w_1600')
|
||||
}
|
||||
|
||||
function hasImage(b: CmsBanner): boolean {
|
||||
return !!(b.image || b.imageUrl || b.pic || b.url)
|
||||
}
|
||||
|
||||
const heroTitle = computed(() => siteInfo.value?.slogan || '专注嵌入式存储解决方案')
|
||||
const heroSubtitle = computed(() => siteInfo.value?.comments || '为工控、物联网、消费电子、安防设备提供稳定可靠的存储配套,助力智能终端高效运行。')
|
||||
|
||||
const productNav = computed<CmsNavigation | undefined>(() => (navigations.value || []).find((n) => n.model === 'product'))
|
||||
const contactNav = computed<CmsNavigation | undefined>(() => (navigations.value || []).find((n) => n.model === 'contact' || n.title.includes('联系')))
|
||||
</script>
|
||||
Reference in New Issue
Block a user