2b69686795
- 新增404页面,优化未找到页面体验,避免被搜索引擎索引 - 增加文件代理接口,隐藏真实文件服务器地址,支持文件请求代理 - 实现/article、/case、/product及/page动态路由兼容列表与详情展示 - 添加动态CMS页面兼容入口处理旧式路径,统一路由与SEO设置 - 新增模板1、模板7、模板2、模板3关于我们页面,实现多模板支持 - 模板增强支持CMS单页内容加载及SEO信息动态设置 - 配置环境变量及Git忽略文件规则辅助开发和构建环境管理
65 lines
2.5 KiB
Vue
65 lines
2.5 KiB
Vue
<template>
|
|
<div class="min-h-screen py-16 bg-white">
|
|
<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-gray-500 hover:text-blue-600">← 返回产品列表</NuxtLink>
|
|
</div>
|
|
|
|
<div class="grid lg:grid-cols-2 gap-10 mb-12">
|
|
<div class="aspect-video bg-gray-100 rounded-xl 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-gray-900 mb-4">{{ product.productName }}</h1>
|
|
<p v-if="product.subtitle" class="text-lg text-gray-600 mb-6">{{ product.subtitle }}</p>
|
|
<p class="text-gray-600 leading-relaxed mb-6">{{ stripHtml(product.description) }}</p>
|
|
<div v-if="product.price" class="text-2xl font-bold text-blue-600 mb-6">
|
|
{{ product.price }}
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="inline-flex items-center justify-center px-8 py-3 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700 transition-colors"
|
|
@click="openConsult({ need: `咨询产品:${product.productName}`, source: 'product-detail' })"
|
|
>
|
|
立即咨询
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="border-t border-gray-100 pt-10">
|
|
<h2 class="text-2xl font-bold text-gray-900 mb-6">产品详情</h2>
|
|
<RichText :content="product.content" />
|
|
</div>
|
|
</div>
|
|
|
|
<div v-else class="text-center py-20">
|
|
<h1 class="text-2xl font-bold text-gray-900 mb-4">产品不存在或已下架</h1>
|
|
<NuxtLink :to="`/product${product?.navigationId ? '?navId=' + product.navigationId : ''}`" class="text-blue-600 hover:underline">返回产品列表</NuxtLink>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { Product } from '~/types'
|
|
|
|
/**
|
|
* 模板 1 - 产品详情页
|
|
*/
|
|
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>
|