Files
cz-web/src/views/profile/cpns/HelpFaq.vue
2026-10-13 15:56:12 +08:00

133 lines
2.5 KiB
Vue

<script setup lang="ts">
import { computed } from 'vue'
import type { HelpFaqGroup, HelpFaqItem } from '@/types/business/profile'
interface Props {
groups: HelpFaqGroup[]
}
const props = defineProps<Props>()
const questions = computed<HelpFaqItem[]>(() =>
props.groups.flatMap((group) => group.items),
)
</script>
<template>
<div class="help-faq">
<aside class="help-faq__aside">
<p
v-for="item in questions"
:key="item.q"
class="help-faq__q"
>
Q: {{ item.q }}
</p>
</aside>
<div class="help-faq__main">
<div class="help-faq__main-inner">
<section
v-for="(group, gi) in groups"
:key="group.title"
class="help-faq__group"
>
<h3 class="help-faq__group-title">
{{ gi + 1 }}、{{ group.title }}
</h3>
<p
v-for="item in group.items"
:key="`${group.title}-${item.q}`"
class="help-faq__a"
>
{{ item.a }}
</p>
</section>
</div>
</div>
<p v-if="groups.length === 0" class="help-faq__empty text-secondary">
暂无常见问题
</p>
</div>
</template>
<style lang="less" scoped>
.help-faq {
display: grid;
grid-template-columns: max-content 1fr;
column-gap: @spacing-xxl;
align-items: start;
width: 100%;
min-width: 0;
&__aside {
.flex(column, flex-start, flex-start);
gap: @spacing-xl;
text-align: left;
}
&__q {
margin: 0;
font-size: @font-size-base;
font-weight: 600;
color: @heading-color;
line-height: 1.6;
text-align: left;
white-space: nowrap;
}
&__main {
display: flex;
justify-content: center;
align-items: flex-start;
width: 100%;
min-width: 0;
box-sizing: border-box;
}
&__main-inner {
width: 100%;
max-width: 480px;
margin: 0 auto;
text-align: center;
}
&__group {
.flex(column, flex-start, center);
gap: @spacing-base;
width: 100%;
& + & {
margin-top: @spacing-xxl;
}
}
&__group-title {
margin: 0;
width: 100%;
font-size: @font-size-base;
font-weight: 600;
color: @heading-color;
line-height: 1.4;
text-align: center;
}
&__a {
margin: 0;
width: 100%;
font-size: @font-size-sm;
line-height: 1.8;
color: @text-color-secondary;
text-align: center;
}
&__empty {
grid-column: 1 / -1;
padding: @spacing-xxl 0;
text-align: center;
font-size: @font-size-sm;
}
}
</style>