Compare commits

..

4 Commits

Author SHA1 Message Date
d8abb0a50e refactor(production): 重构产品详情页代码
- 将文档列表调整为单独的vue组件
2025-09-03 17:06:14 +08:00
80d2ade9bb style: 调整SpecTable样式
- 增大标题字体大小
2025-09-03 14:28:26 +08:00
e0c16c6391 refactor(production): 重构产品详情页代码
- 将问题列表调整为单独的Vue组件
2025-09-03 14:25:18 +08:00
1ac659cd68 refactor(support): 重构support页面代码
- 将segement tab移至单独的vue组件
- 增添部分i18n文本
2025-09-03 14:06:08 +08:00
11 changed files with 274 additions and 173 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,44 @@
<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__header) {
font-size: 1rem;
padding: 1rem;
}
.question-collapse :deep(.el-collapse-item) {
margin-bottom: 1rem;
border: 1px solid var(--el-border-color-light);
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
}
</style>

View File

@ -25,3 +25,10 @@ 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>

View File

@ -33,33 +33,10 @@
<spec-table :data="production.production_specs" />
</el-tab-pane>
<el-tab-pane label="常见问题" name="faq">
<div class="faq-list">
<el-collapse class="faq-collapse" accordion>
<el-collapse-item
v-for="(question, index) in production.questions" :key="index" :title="question.title"
:name="String(index)">
<markdown-renderer :content="question.content || ''" />
</el-collapse-item>
</el-collapse>
</div>
<question-list :questions="production.questions" />
</el-tab-pane>
<el-tab-pane label="相关文档" name="documents">
<div class="document-list">
<el-card v-for="(doc, index) in production.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="downloadFile(doc.name, useStrapiMedia(doc.url || ''))">
下载
</el-button>
</div>
</div>
</el-card>
</div>
<document-list :documents="production.documents" />
</el-tab-pane>
</el-tabs>
</div>
@ -102,20 +79,6 @@ const activeName = ref('details') // 默认选中概览标签
// 获取路由参数slug 或 id
const documentId = computed(() => route.params.slug as string)
const downloadFile = async (filename: string, url: string) => {
const response = await fetch(url)
const blob = await response.blob()
const fileUrl = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = fileUrl
link.download = filename
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(fileUrl)
}
onMounted(async () => {
try {
const response = await findOne<Production>('productions', documentId.value, {
@ -211,46 +174,6 @@ useHead({
margin: 0;
}
.document-list {
display: flex;
flex-direction: column;
gap: 1rem;
margin-top: 1rem;
}
.document-meta {
color: var(--el-text-color-secondary);
font-size: 0.8rem;
}
.download-button {
margin-left: auto;
}
.document-content {
display: flex;
align-items: center;
gap: 1rem;
}
::v-deep(.el-collapse-item__header) {
font-size: 1rem;
padding: 1rem;
}
.faq-collapse {
border: none;
}
.faq-collapse :deep(.el-collapse-item) {
margin-bottom: 1rem;
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1);
}
.faq-collapse :deep(.el-collapse-item__header) {
border: 1px solid var(--el-border-color-light);
}
.loading {
display: flex;
justify-content: center;

View File

@ -1,9 +1,7 @@
<template>
<div class="page-container">
<div v-if="content">
<div class="page-tab">
<el-segmented v-model="activeTab" class="segmented" :options="options" block size="large" @change="handleSegmentedChange" />
</div>
<support-tabs model-value="contact-us" />
<div class="page-header">
<h1 class="page-title">{{ $t('navigation.contact-info') }}</h1>
<el-breadcrumb class="breadcrumb" separator="/">
@ -43,19 +41,6 @@ const strapiLocale = getStrapiLocale()
const content = ref<string>('')
const activeTab = ref('contact-us')
const options = [
{ label: '服务支持', value: '' },
{ label: '常见问题', value: 'faq' },
{ label: '联系售后', value: 'contact-us' },
{ label: '文档资料', value: 'documents' },
]
const handleSegmentedChange = (value: string) => {
const localePath = useLocalePath()
navigateTo(localePath(`/support/${value}`))
}
onMounted(async () => {
try {
const response = await findOne<StrapiContactInfo>('contact-info', undefined, {
@ -90,35 +75,6 @@ onMounted(async () => {
margin-left: auto;
}
.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);
}
}
.page-content {
padding: 2rem;
margin-bottom: 2rem;

View File

@ -0,0 +1,41 @@
<template>
<div class="page-container">
<support-tabs model-value="documents"/>
<div class="page-header">
<h1 class="page-title">{{ $t('navigation.documents') }}</h1>
<el-breadcrumb class="breadcrumb" separator="/">
<el-breadcrumb-item class="text-md opacity-50">
<NuxtLink :to="$localePath('/')">{{ $t('navigation.home') }}</NuxtLink>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-md opacity-50">
<NuxtLink :to="$localePath('/support')">{{ $t('navigation.support') }}</NuxtLink>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-md opacity-50">
<NuxtLink :to="$localePath('/support/documents')">{{ $t('navigation.documents') }}</NuxtLink>
</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
</template>
<script setup lang="ts">
</script>
<style scoped>
.page-header {
display: flex;
padding: 2rem 2rem 0rem;
}
.page-title {
font-size: 2rem;
font-weight: bold;
color: var(--el-color-primary);
margin-bottom: 1rem;
}
.breadcrumb {
margin-left: auto;
}
</style>

43
app/pages/support/faq.vue Normal file
View File

@ -0,0 +1,43 @@
<template>
<div class="page-container">
<support-tabs model-value="faq" />
<div class="page-header">
<h1 class="page-title">{{ $t('navigation.faq') }}</h1>
<el-breadcrumb class="breadcrumb" separator="/">
<el-breadcrumb-item class="text-md opacity-50">
<NuxtLink :to="$localePath('/')">{{ $t('navigation.home') }}</NuxtLink>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-md opacity-50">
<NuxtLink :to="$localePath('/support')">{{ $t('navigation.support') }}</NuxtLink>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-md opacity-50">
<NuxtLink :to="$localePath('/support/faq')">{{ $t('navigation.faq') }}</NuxtLink>
</el-breadcrumb-item>
</el-breadcrumb>
</div>
</div>
</template>
<script setup lang="ts">
</script>
<style scoped>
.page-header {
display: flex;
padding: 2rem 2rem 0rem;
}
.page-title {
font-size: 2rem;
font-weight: bold;
color: var(--el-color-primary);
margin-bottom: 1rem;
}
.breadcrumb {
margin-left: auto;
}
</style>

View File

@ -1,10 +1,6 @@
<template>
<div class="page-container">
<div class="page-tab">
<el-segmented
v-model="activeTab" class="segmented" :options="options" block size="large"
@change="handleSegmentedChange" />
</div>
<support-tabs />
<div class="page-header">
<h1 class="page-title">{{ $t('navigation.support') }}</h1>
<el-breadcrumb class="breadcrumb" separator="/">
@ -43,18 +39,6 @@ v-model="activeTab" class="segmented" :options="options" block size="large"
</template>
<script setup lang="ts">
const activeTab = ref('support')
const options = [
{ label: '服务支持', value: 'support' },
{ label: '常见问题', value: 'faq' },
{ label: '联系售后', value: 'contact-us' },
{ label: '文档资料', value: 'documents' },
]
const handleSegmentedChange = (value: string) => {
const localePath = useLocalePath()
navigateTo(localePath(`/support/${value}`))
}
</script>
<style scoped>
@ -74,35 +58,6 @@ const handleSegmentedChange = (value: string) => {
margin-left: auto;
}
.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);
}
}
.page-content {
padding: 2rem;
}

View File

@ -16,7 +16,8 @@
"support": "Support",
"about-us": "About Us",
"contact-info": "Contact Info",
"faq": "FAQ"
"faq": "FAQ",
"documents": "Documents"
},
"contact-info": "Contact Us",
"telephone": "Telephone",

View File

@ -16,7 +16,8 @@
"support": "服务支持",
"about-us": "关于我们",
"contact-info": "联系信息",
"faq": "常见问题"
"faq": "常见问题",
"documents": "文档资料"
},
"contact-info": "联系我们",
"telephone": "电话",