refactor: 将支持页的相关部分提取为可复用的组件

- support页的el-card,单独提取为SupportCard组件
This commit is contained in:
2025-10-29 16:08:33 +08:00
parent 5920925ded
commit c4e797500f
2 changed files with 125 additions and 109 deletions

View File

@ -0,0 +1,96 @@
<template>
<el-card class="support-card">
<el-row>
<el-col :span="6">
<el-icon class="card-icon" size="80">
<component :is="iconComponent" />
</el-icon>
</el-col>
<el-col :span="18">
<div class="card-title">
<span>{{ title }}</span>
</div>
</el-col>
</el-row>
<el-row>
<div class="card-content">
<p>{{ description }}</p>
</div>
</el-row>
<el-row>
<NuxtLink class="card-link" :to="to">
<el-button class="card-button" round>
<span>了解更多 > </span>
</el-button>
</NuxtLink>
</el-row>
</el-card>
</template>
<script setup lang="ts">
defineProps({
title: {
type: String,
default: '',
},
description: {
type: String,
default: '',
},
to: {
type: String,
default: '',
},
iconComponent: {
type: Object,
default: null,
},
});
</script>
<style scoped>
.support-card {
width: 100%;
padding: 20px;
box-shadow: none;
border-radius: none;
}
.card-icon {
color: var(--el-color-primary);
}
.card-title {
display: flex;
height: 100%;
align-items: center;
margin-left: 2rem;
font-size: 1.5rem;
font-weight: bold;
color: var(--el-color-primary);
}
.card-link {
margin-left: auto;
}
.card-button {
cursor: pointer;
text-align: center;
font-size: 1rem;
color: var(--el-color-primary);
transition: all 0.3s ease;
}
.el-row {
margin-bottom: 20px;
}
.el-row:last-child {
margin-bottom: 0;
}
.el-col {
border-radius: 4px;
}
</style>

View File

@ -12,87 +12,14 @@
</p>
</section>
<div class="card-group">
<el-card class="card">
<el-row>
<el-col :span="6">
<el-icon class="card-icon" size="80">
<ElIconQuestionFilled />
</el-icon>
</el-col>
<el-col :span="18">
<div class="card-title">
<span>{{ $t('navigation.faq') }}</span>
</div>
</el-col>
</el-row>
<el-row>
<div class="card-content">
<p>我们为用户整理了常见问题的答案帮助您快速解决疑惑</p>
</div>
</el-row>
<el-row>
<NuxtLink class="card-link" :to="$localePath('/support/faq')">
<el-button class="card-button" round>
<span>了解更多 > </span>
</el-button>
</NuxtLink>
</el-row>
</el-card>
<el-card class="card">
<el-row>
<el-col :span="6">
<el-icon class="card-icon" size="80">
<ElIconDocumentChecked />
</el-icon>
</el-col>
<el-col :span="18">
<div class="card-title">
<span>{{ $t('navigation.documents') }}</span>
</div>
</el-col>
</el-row>
<el-row>
<div class="card-content">
<p>我们为用户整理了常见问题的答案为您快速解决疑惑</p>
</div>
</el-row>
<el-row>
<NuxtLink class="card-link" :to="$localePath('/support/documents')">
<el-button class="card-button" round>
<span>了解更多 > </span>
</el-button>
</NuxtLink>
</el-row>
</el-card>
<el-card class="card">
<el-row>
<el-col :span="6">
<el-icon class="card-icon" size="80">
<ElIconService />
</el-icon>
</el-col>
<el-col :span="18">
<div class="card-title">
<span>{{ $t('navigation.contact-info') }}</span>
</div>
</el-col>
</el-row>
<el-row>
<div class="card-content">
<p>通过电话邮箱联系我们我们将现场为您服务</p>
</div>
</el-row>
<el-row>
<NuxtLink
class="card-link"
:to="$localePath('/support/contact-us')"
>
<el-button class="card-button" round>
<span>了解更多 > </span>
</el-button>
</NuxtLink>
</el-row>
</el-card>
<support-card
v-for="(item, index) in supportItems"
:key="index"
:title="item.title"
:description="item.description"
:to="item.to"
:icon-component="item.iconComponent"
/>
</div>
</div>
</div>
@ -104,6 +31,27 @@
{ label: $t('navigation.home'), to: localePath('/') },
{ label: $t('navigation.support') },
];
const supportItems = [
{
title: $t('navigation.faq'),
description: '我们为用户整理了常见问题的答案,帮助您快速解决疑惑。',
to: localePath('/support/faq'),
iconComponent: ElIconQuestionFilled,
},
{
title: $t('navigation.documents'),
description: '我们为用户整理了常见问题的答案,帮助您快速解决疑惑。',
to: localePath('/support/documents'),
iconComponent: ElIconDocumentChecked,
},
{
title: $t('navigation.contact-info'),
description: '通过电话、邮箱联系我们,我们将现场为您服务。',
to: localePath('/support/contact-us'),
iconComponent: ElIconService,
},
];
</script>
<style scoped>
@ -169,34 +117,6 @@
margin-left: auto;
}
.card-button {
cursor: pointer;
text-align: center;
font-size: 1rem;
color: var(--el-color-primary);
transition: all 0.3s ease;
}
.button-group {
display: flex;
justify-content: left;
margin-top: 2rem;
margin-left: 2rem;
gap: 20px;
}
.el-row {
margin-bottom: 20px;
}
.el-row:last-child {
margin-bottom: 0;
}
.el-col {
border-radius: 4px;
}
.grid-content {
border-radius: 4px;
min-height: 36px;