Files
cz-web/src/views/home/detail.vue
2026-10-01 17:24:57 +08:00

122 lines
2.5 KiB
Vue

<script setup lang="ts">
import { computed, onMounted, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useHomeStore } from '@/stores/modules/home'
import type { BusinessType } from '@/types/api'
import HomeServiceContents from './cpns/HomeServiceContents.vue'
import HomeServiceTypes from './cpns/HomeServiceTypes.vue'
const route = useRoute()
const homeStore = useHomeStore()
const line = computed(() => homeStore.currentBusiness)
const businessType = computed(() => route.params.type as BusinessType)
function load(): void {
void homeStore.fetchBusinessDetail(businessType.value)
}
watch(businessType, load)
onMounted(load)
</script>
<template>
<div class="business-detail">
<div class="container">
<nav class="business-detail__breadcrumb">
<RouterLink to="/" class="link">
首页
</RouterLink>
<span> &gt; </span>
<span>业务详情</span>
</nav>
<template v-if="line">
<header class="business-detail__hero">
<div class="business-detail__intro">
<h1 class="business-detail__name">
{{ line.name }}
</h1>
<p class="business-detail__slogan">
{{ line.slogan }}
</p>
</div>
</header>
<HomeServiceTypes :service-types="line.serviceTypes" />
<HomeServiceContents :contents="line.contents" />
</template>
<p v-else class="business-detail__loading">
正在加载业务详情...
</p>
</div>
</div>
</template>
<style lang="less" scoped>
.business-detail {
padding-top: 32px;
padding-bottom: @spacing-xxl;
&__breadcrumb {
margin-bottom: 49px;
font-size: 24px;
font-weight: 500;
line-height: 37px;
color: @home-breadcrumb;
.link {
color: @home-breadcrumb;
}
}
&__hero {
.flex(column, flex-start);
margin-bottom: @spacing-base;
padding: 129px 29px 0;
border-radius: @radius-lg;
background: @home-detail-hero-bg;
height: 219px;
box-sizing: border-box;
}
&__loading {
padding: 80px 0;
font-size: 16px;
color: @text-color-secondary;
}
&__logo {
display: none;
}
&__intro {
.flex(column, flex-start);
gap: 8px;
}
&__name {
margin: 0;
font-size: 26px;
font-weight: 400;
line-height: 33px;
color: @home-body;
}
&__slogan {
margin: 0;
font-size: 14px;
font-weight: 400;
line-height: 18px;
color: @home-body;
}
&__cta {
display: none;
}
}
</style>