feat: 完成网站前端的基本建设

- 网站内容展示:首页, 产品页, 解决方案, 联系信息等
- 网站跳转逻辑:通过Vue-Router实现路由跳转
- 后端通信: 通过Nuxt Strapi与后端Strapi服务进行通信
This commit is contained in:
2025-09-06 15:59:52 +08:00
parent 6470da9792
commit f957adfa5d
52 changed files with 3358 additions and 92 deletions

View File

@ -0,0 +1,65 @@
<template>
<div class="document-list">
<el-card v-for="(doc, index) in documents" :key="index" class="document-card">
<div class="document-info">
<h3>{{ doc.caption || doc.name }}</h3>
<div class="document-content">
<span v-if="doc.size" class="document-meta">大小: {{ formatFileSize(doc.size) }} </span>
<span v-if="doc.ext" class="document-meta">格式: {{ formatFileExtension(doc.ext) }}</span>
<el-button
class="download-button" type="primary"
@click="handleDownload(doc.name, doc.url)">
下载
</el-button>
</div>
</div>
</el-card>
</div>
</template>
<script setup lang="ts">
defineProps({
documents: {
type: Array as () => Array<StrapiMedia>,
default: () => []
}
})
const handleDownload = async (fileName: string, fileUrl: string) => {
const response = await fetch(fileUrl)
const blob = await response.blob()
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = fileName
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
}
</script>
<style scoped>
.document-list {
display: flex;
flex-direction: column;
gap: 1rem;
width: 100%;
}
.document-meta {
font-size: 0.8rem;
color: var(--el-text-color-secondary);
}
.download-button {
margin-left: auto;
}
.document-content {
display: flex;
align-items: center;
gap: 1rem;
}
</style>

View File

@ -0,0 +1,275 @@
<template>
<footer class="jinshen-footer">
<div class="footer-container">
<!-- Logo 和公司信息 -->
<div class="footer-section">
<div class="footer-logo">
<img src="/jinshen-logo.png" alt="Jinshen Logo" class="logo-image">
<h3>{{ $t('company-name') }}</h3>
</div>
<p class="company-description">
{{ $t('company-description') }}
</p>
</div>
<!-- 快速链接 -->
<div class="footer-section">
<h4>{{ $t('quick-links') }}</h4>
<ul class="footer-links">
<li>
<NuxtLinkLocale to="/">{{ $t('navigation.home') }}</NuxtLinkLocale>
</li>
<li>
<NuxtLink :to="$localePath('/productions')">{{ $t('navigation.productions') }}</NuxtLink>
</li>
<li>
<NuxtLink :to="$localePath('/solutions')">{{ $t('navigation.solutions') }}</NuxtLink>
</li>
<li>
<NuxtLink :to="$localePath('/support')">{{ $t('navigation.support') }}</NuxtLink>
</li>
<li>
<NuxtLink :to="$localePath('/about')">{{ $t('navigation.about-us') }}</NuxtLink>
</li>
</ul>
</div>
<!-- 联系信息 -->
<div class="footer-section">
<h4>{{ $t('contact-info') }}</h4>
<div class="contact-item">
<el-icon><Phone /></el-icon>
<span>{{ $t('telephone') }}: 0573-88187988</span>
</div>
<div class="contact-item">
<el-icon><Message /></el-icon>
<span>{{ $t('email') }}: jinshen@wzjinshen.com</span>
</div>
<div class="contact-item">
<el-icon><Location /></el-icon>
<span>{{ $t('address') }}: {{ $t('company-address') }}</span>
</div>
</div>
<!-- 社交媒体 -->
<div class="footer-section">
<h4>{{ $t('follow-us') }}</h4>
<div class="social-links">
<a href="#" class="social-link" aria-label="WeChat">
<el-icon size="20"><ChatDotRound /></el-icon>
</a>
<a href="#" class="social-link" aria-label="Weibo">
<el-icon size="20"><Star /></el-icon>
</a>
<a href="#" class="social-link" aria-label="LinkedIn">
<el-icon size="20"><Link /></el-icon>
</a>
<a href="#" class="social-link" aria-label="Email">
<el-icon size="20"><Message /></el-icon>
</a>
</div>
</div>
</div>
<!-- 版权信息 -->
<div class="footer-bottom">
<div class="footer-container">
<div class="copyright">
<p>&copy; {{ currentYear }} {{ $t('company-name') }}. {{ $t('all-rights-reserved') }}</p>
<p>备案号: 浙ICP备12003709号-5</p>
</div>
<div class="footer-links-bottom">
<NuxtLink :to="$localePath('/privacy')">{{ $t('privacy-policy') }}</NuxtLink>
<span class="separator">|</span>
<NuxtLink :to="$localePath('/terms')">{{ $t('terms-of-service') }}</NuxtLink>
<span class="separator">|</span>
<NuxtLink :to="$localePath('/sitemap')">{{ $t('sitemap') }}</NuxtLink>
</div>
</div>
</div>
</footer>
</template>
<script setup lang="ts">
import {
Phone,
Message,
Location,
ChatDotRound,
Star,
Link
} from '@element-plus/icons-vue'
const currentYear = new Date().getFullYear()
</script>
<style scoped>
.jinshen-footer {
background: var(--el-bg-color-page);
border-top: 1px solid var(--el-border-color);
margin-top: auto;
}
.footer-container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem 1rem;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
}
.footer-section h3,
.footer-section h4 {
color: var(--el-text-color-primary);
margin-bottom: 1rem;
font-weight: 600;
}
.footer-logo {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1rem;
}
.logo-image {
width: 40px;
height: 40px;
object-fit: contain;
}
.company-description {
color: var(--el-text-color-regular);
line-height: 1.6;
margin: 0;
}
.footer-links {
list-style: none;
padding: 0;
margin: 0;
}
.footer-links li {
margin-bottom: 0.5rem;
}
.footer-links a {
color: var(--el-text-color-regular);
text-decoration: none;
transition: color 0.3s ease;
}
.footer-links a:hover {
color: var(--el-color-primary);
}
.contact-item {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.75rem;
color: var(--el-text-color-regular);
}
.contact-item .el-icon {
color: var(--el-color-primary);
}
.social-links {
display: flex;
gap: 1rem;
}
.social-link {
display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background: var(--el-fill-color-light);
border-radius: 50%;
color: var(--el-text-color-regular);
text-decoration: none;
transition: all 0.3s ease;
}
.social-link:hover {
background: var(--el-color-primary);
color: white;
transform: translateY(-2px);
}
.footer-bottom {
background: var(--el-fill-color-light);
border-top: 1px solid var(--el-border-color-lighter);
padding: 1rem 0;
}
.footer-bottom .footer-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 1rem;
grid-template-columns: none;
gap: 1rem;
}
.copyright p {
margin: 0;
color: var(--el-text-color-regular);
font-size: 0.875rem;
}
.footer-links-bottom {
display: flex;
align-items: center;
gap: 0.5rem;
}
.footer-links-bottom a {
color: var(--el-text-color-regular);
text-decoration: none;
font-size: 0.875rem;
transition: color 0.3s ease;
}
.footer-links-bottom a:hover {
color: var(--el-color-primary);
}
.separator {
color: var(--el-text-color-placeholder);
}
/* 响应式设计 */
@media (max-width: 768px) {
.footer-container {
grid-template-columns: 1fr;
padding: 1.5rem 1rem;
}
.footer-bottom .footer-container {
flex-direction: column;
text-align: center;
gap: 1rem;
}
.footer-links-bottom {
flex-wrap: wrap;
justify-content: center;
}
}
/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
.jinshen-footer {
background: var(--el-bg-color-page);
}
.footer-bottom {
background: var(--el-fill-color-darker);
}
}
</style>

View File

@ -0,0 +1,153 @@
<template>
<div class="header-container">
<div class="logo-section">
<NuxtLink :to="$localePath('/')" class="logo-link">
<el-image class="website-logo" src="/jinshen-logo.png" alt="Jinshen Logo" fit="contain" />
</NuxtLink>
</div>
<!-- 导航菜单 -->
<el-menu
:default-active="activeName" class="header-menu" mode="horizontal" :ellipsis="false"
:persistent="false" router>
<el-menu-item index="productions" :route="$localePath('/productions')">
<span class="title">{{ $t('navigation.productions') }}</span>
</el-menu-item>
<el-menu-item index="solutions" :route="$localePath('/solutions')">
<span class="title">{{ $t('navigation.solutions') }}</span>
</el-menu-item>
<el-menu-item index="support" :route="$localePath('/support')">
<span class="title">{{ $t('navigation.support') }}</span>
</el-menu-item>
<el-menu-item index="about" :route="$localePath('/about')">
<span class="title">{{ $t('navigation.about-us') }}</span>
</el-menu-item>
</el-menu>
<!-- 右侧功能区 -->
<div class="header-actions">
<el-input
v-model="searchQuery" class="search-input" :placeholder="$t('search-placeholder')"
:prefix-icon="Search" clearable @keyup.enter="handleSearch" />
<el-dropdown @command="setLocale">
<el-link type="info" :underline="false">
<el-icon class="mdi mdi-translate translate-link" />
</el-link>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="zh">简体中文</el-dropdown-item>
<el-dropdown-item command="en">English</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
</template>
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue';
const router = useRouter();
const { setLocale } = useI18n();
const searchQuery = ref('')
const activeName = ref<string | undefined>(undefined)
const handleSearch = () => {
if (searchQuery.value.trim()) {
// 这里可以添加搜索逻辑,例如导航到搜索结果页面
console.log('Searching for:', searchQuery.value);
// 示例:导航到搜索结果页面
// router.push({ path: '/search', query: { q: searchQuery.value } });
}
}
const refreshMenu = () => {
const path = router.currentRoute.value.path;
if (path.startsWith('/productions')) {
activeName.value = 'productions';
} else if (path.startsWith('/solutions')) {
activeName.value = 'solutions';
} else if (path.startsWith('/support')) {
activeName.value = 'support';
} else if (path.startsWith('/about')) {
activeName.value = 'about';
} else {
activeName.value = undefined; // 默认不激活任何菜单项
}
}
onMounted(() => {
refreshMenu();
// 监听路由变化以更新激活状态
router.afterEach(() => {
refreshMenu();
});
})
</script>
<style scoped>
.header-container {
margin: 0 auto;
padding: 0 10px;
display: flex;
height: 80px;
align-items: center;
border-bottom: 1px solid #e0e0e0;
}
.logo-section {
display: flex;
flex: 1;
align-items: center;
margin-left: 20px;
}
.logo-link {
display: flex;
align-items: center;
text-decoration: none;
}
.website-logo {
height: 64px;
width: auto;
}
.header-menu {
margin-right: 40px;
border-bottom: none !important;
width: auto;
--el-menu-horizontal-height: 100%;
}
.header-menu .el-menu-item {
font-size: 16px;
background-color: transparent !important;
}
.header-menu .el-menu-item.is-active {
border-bottom: 2.5px solid var(--el-color-primary-dark-2);
color: var(--el-color-primary);
}
.header-menu .el-menu-item:hover {
border-bottom: 2.5px solid var(--el-color-primary);
}
.header-actions {
display: flex;
align-items: center;
gap: 16px;
}
.search-input {
width: 200px;
}
.translate-link {
font-size: 20px;
}
</style>

View File

@ -0,0 +1,73 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<!-- v-html 渲染解析后的 HTML -->
<div class="markdown-body" v-html="safeHtml" />
</template>
<script setup lang="ts">
interface Props {
content: string
}
const props = defineProps<Props>()
const contentWithAbsoluteUrls = convertMedia(props.content)
// 将 Markdown 转换成 HTML
const safeHtml = computed(() => renderMarkdown(contentWithAbsoluteUrls))
// const safeHtml = computed(() => renderMarkdown(props.content))
console.log('Rendered HTML:', safeHtml.value)
</script>
<style>
.markdown-body {
padding: 10px;
line-height: 1.6;
}
.markdown-body h1 {
color: var(--el-color-primary);
font-size: 1.5em;
margin-bottom: 0.5em;
text-align: center;
}
.markdown-body h2 {
color: var(--el-color-primary);
font-size: 1.5em;
margin-bottom: 0.5em;
}
.markdown-body h3 {
color: var(--el-color-primary);
font-size: 1.2em;
margin-bottom: 0.5em;
}
.markdown-body p {
text-indent: 2em;
text-align: justify;
margin: 0.5em 0;
margin-bottom: 1em;
}
.markdown-body ol {
list-style-type: decimal;
padding-left: 2em;
margin-bottom: 1em;
}
.markdown-body ul {
list-style-type: disc;
padding-left: 2em;
margin-bottom: 1em;
}
.markdown-body hr {
border: none;
border-top: 1px solid var(--el-border-color);
margin: 20px 0;
}
</style>

View File

@ -0,0 +1,87 @@
<template>
<el-card class="production-card" @click="handleClick">
<template #header>
<!-- Image -->
<el-image class="production-image" :src="imageUrl" fit="contain" />
</template>
<div class="card-body">
<!-- Name -->
<div class="text-center">
<span class="production-name">{{ name }}</span>
</div>
<!-- Description -->
<div class="card-description text-left opacity-25">{{ description }}</div>
</div>
</el-card>
</template>
<script setup lang="ts">
interface Props {
name: string
description: string
imageUrl: string
id?: string | number
slug?: string
}
const props = defineProps<Props>()
const localePath = useLocalePath()
const handleClick = () => {
// 优先使用 slug如果没有则使用 id
const routeParam = props.slug || props.id
if (routeParam) {
navigateTo(localePath(`/productions/${routeParam}`))
}
}
</script>
<style scoped>
.production-card {
width: 20%;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
}
.production-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
.production-name {
font-size: 1rem;
font-weight: 600;
}
.card-description {
font-size: 0.8rem;
margin-top: 5px;
}
.production-card .el-image {
height: 150px;
border-radius: 4px;
}
.card-body {
margin: 10px auto;
padding: 0px auto;
height: 100px;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.production-card {
width: 45%;
}
}
@media (max-width: 768px) {
.production-card {
width: 90%;
}
}
</style>

View File

@ -0,0 +1,60 @@
<template>
<div class="question-list">
<el-collapse class="question-collapse" accordion>
<el-collapse-item
v-for="(question, index) in questions" :key="index" :title="question.title"
:name="String(index)">
<markdown-renderer :content="question.content || ''" />
</el-collapse-item>
</el-collapse>
</div>
</template>
<script setup lang="ts">
defineProps({
questions: {
type: Array as () => Array<{ title: string; content: string }>,
default: () => []
}
})
</script>
<style scoped>
.question-list {
width: 100%;
}
.question-collapse {
border: none;
}
.question-collapse :deep(.el-collapse-item) {
margin-bottom: 1rem;
border-radius: 8px;
}
.question-collapse :deep(.el-collapse-item__header) {
font-size: 1rem;
padding: 1rem;
border-radius: 8px;
background-color: #f5f7fa;
transition: all 0.3s ease;
&.is-active {
background-color: #e1e6eb;
color: var(--el-color-primary);
}
}
.question-collapse :deep(.el-collapse-item__wrap) {
border: none;
}
.question-collapse :deep(.el-collapse-item__content) {
padding: 1rem;
font-size: 0.9rem;
}
</style>

View File

@ -0,0 +1,83 @@
<template>
<el-card class="solution-card" body-class="card-body" header-class="card-header" @click="handleClick">
<template #header>
<!-- Cover Image -->
<el-image class="solution-cover" :src="coverUrl" fit="cover" />
</template>
<!-- Title -->
<template #default>
<div class="text-center mx-auto text-md">
<span class="solution-title">{{ title }}</span>
</div>
<!-- Summary -->
<div class="mx-auto mt-5 text-left text-sm opacity-25">{{ summary }}</div>
</template>
</el-card>
</template>
<script setup lang="ts">
interface Props {
title: string
summary: string
coverUrl: string
documentId?: string
}
const props = defineProps<Props>()
const localePath = useLocalePath()
const handleClick = () => {
const routeParam = props.documentId
if (routeParam) {
navigateTo(localePath(`/solutions/${routeParam}`))
}
}
</script>
<style scoped>
.solution-card {
width: 30%;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
}
.solution-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
.solution-title {
font-weight: 600;
}
:deep(.card-header) {
padding: 0;
border-bottom: none !important;
}
:deep(.card-body) {
margin: 10px auto;
padding: 1px auto;
}
.solution-card .el-image {
height: 250px;
}
@media (max-width: 1200px) {
.solution-card {
width: 45%;
}
}
@media (max-width: 768px) {
.solution-card {
width: 90%;
margin: 10px auto;
}
}
</style>

View File

@ -0,0 +1,34 @@
<template>
<div class="spec-collapse">
<el-collapse v-model="activeName">
<el-collapse-item v-for="item in data" :key="item.title" :title="item.title" :name="item.title">
<el-descriptions :column="1" border>
<el-descriptions-item v-for="subItem in item.items" :key="subItem.label" :label="subItem.label">
{{ subItem.value }}
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
</el-collapse>
</div>
</template>
<script lang="ts" setup>
const props = defineProps({
data: {
type: Object as () => ProductionSpecGroup[],
required: true
}
})
// 默认全部展开
const activeName = ref<string[]>(props.data.map((item: ProductionSpecGroup) => {
return item.title
}) || [])
</script>
<style scoped>
.spec-collapse ::v-deep(.el-collapse-item__header) {
font-size: 1rem;
padding: 1rem;
}
</style>

View File

@ -0,0 +1,65 @@
<template>
<div class="page-tab">
<el-segmented
v-model="activeTab"
class="segmented"
:options="options"
block
size="large"
@change="handleSegmentedChange"
/>
</div>
</template>
<script setup lang="ts">
const props = defineProps({
modelValue: {
type: String,
default: '',
},
})
const activeTab = ref(props.modelValue || '')
const options = [
{ label: '服务支持', value: '' },
{ label: '常见问题', value: 'faq' },
{ label: '文档资料', value: 'documents' },
{ label: '联系售后', value: 'contact-us' },
]
const handleSegmentedChange = (value: string) => {
const localePath = useLocalePath()
navigateTo(localePath(`/support/${value}`))
}
</script>
<style scoped>
.segmented {
--el-segmented-bg-color: transparent;
--el-segmented-item-active-color: var(--el-color-primary);
--el-segmented-item-color: var(--el-text-color-secondary);
--el-segmented-item-hover-color: var(--el-color-primary);
--el-segmented-item-border-color: transparent;
--el-segmented-item-active-border-color: transparent;
border-bottom: 1px solid var(--el-border-color-light);
}
.segmented :deep(.el-segmented__item-selected) {
/* --el-border-radius-base: 16px; */
transition: none;
background: transparent;
}
.segmented :deep(.el-segmented__item) {
&:hover {
background: transparent;
color: var(--el-color-primary);
}
&.is-selected {
color: var(--el-color-primary-dark-2);
border-bottom: 4px solid var(--el-color-primary-dark-2);
}
}
</style>