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,114 @@
|
||||
<template>
|
||||
<div class="min-h-screen py-16 bg-[#1a1a1a]">
|
||||
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div v-if="product" class="max-w-5xl mx-auto">
|
||||
<div class="mb-8">
|
||||
<NuxtLink :to="`/product${product?.navigationId ? '?navId=' + product.navigationId : ''}`" class="text-sm text-[#a89f8f] hover:text-[#d4af37]">← 返回产品列表</NuxtLink>
|
||||
</div>
|
||||
|
||||
<div class="grid lg:grid-cols-2 gap-10 mb-12">
|
||||
<div class="aspect-video bg-[#2e2e2e] rounded-3xl overflow-hidden">
|
||||
<img
|
||||
v-if="product.cover"
|
||||
:src="fileUrl(product.cover)"
|
||||
:alt="product.productName"
|
||||
class="w-full h-full object-cover"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-[#f5f0e6] mb-4">{{ product.productName }}</h1>
|
||||
<p v-if="product.subtitle" class="text-lg text-[#a89f8f] mb-6">{{ product.subtitle }}</p>
|
||||
<p class="text-[#a89f8f] leading-relaxed mb-6">{{ stripHtml(product.description) }}</p>
|
||||
<div v-if="product.price" class="text-2xl font-bold text-[#d4af37] mb-6">
|
||||
{{ product.price }}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center justify-center px-8 py-3 bg-[#d4af37] text-[#1a1a1a] font-semibold rounded-full hover:bg-[#c19b2e] transition-colors"
|
||||
@click="openConsult({ need: `咨询产品:${product.productName}`, source: 'product-detail' })"
|
||||
>
|
||||
立即咨询
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-[#333333] pt-10">
|
||||
<h2 class="text-2xl font-bold text-[#f5f0e6] mb-6">产品详情</h2>
|
||||
<div class="cms-content">
|
||||
<RichText :content="product.content" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="text-center py-20">
|
||||
<h1 class="text-2xl font-bold text-[#f5f0e6] mb-4">产品不存在或已下架</h1>
|
||||
<NuxtLink :to="`/product${product?.navigationId ? '?navId=' + product.navigationId : ''}`" class="text-[#d4af37] hover:underline">返回产品列表</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Product } from '~/types'
|
||||
|
||||
/**
|
||||
* 模板 4 - 产品详情页(暗金商务风)
|
||||
*/
|
||||
const route = useRoute()
|
||||
const id = route.params.id as string
|
||||
const { fileUrl } = useFileUrl()
|
||||
const { openConsult } = useConsult()
|
||||
|
||||
const { data: product } = await useFetch<Product | null>(`/api/product/detail?id=${id}`, {
|
||||
key: `product-${id}`
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cms-content :deep(h2) {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 1.2em 0 0.6em;
|
||||
color: #f5f0e6;
|
||||
}
|
||||
.cms-content :deep(h3) {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
margin: 1em 0 0.5em;
|
||||
color: #f5f0e6;
|
||||
}
|
||||
.cms-content :deep(h4) {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
margin: 0.8em 0 0.4em;
|
||||
color: #f5f0e6;
|
||||
}
|
||||
.cms-content :deep(p) {
|
||||
margin-bottom: 1em;
|
||||
line-height: 1.8;
|
||||
color: #d8d2c4;
|
||||
}
|
||||
.cms-content :deep(a) {
|
||||
color: #d4af37;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.cms-content :deep(img) {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 0.75rem;
|
||||
margin: 1em 0;
|
||||
}
|
||||
.cms-content :deep(ul),
|
||||
.cms-content :deep(ol) {
|
||||
padding-left: 1.5em;
|
||||
margin-bottom: 1em;
|
||||
color: #d8d2c4;
|
||||
}
|
||||
.cms-content :deep(li) {
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
.cms-content :deep(strong) {
|
||||
color: #f5f0e6;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user