feat 搭建架构骨架
This commit is contained in:
108
src/views/home/detail.vue
Normal file
108
src/views/home/detail.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
// 业务详情页:数据只经 useHomeStore,不直接 import api
|
||||
import { useHomeStore } from '@/stores/modules/home'
|
||||
import type { BusinessType } from '@/types/api'
|
||||
import HomeServiceTabs from './cpns/HomeServiceTabs.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">
|
||||
<nav class="business-detail__breadcrumb text-secondary">
|
||||
<RouterLink to="/" class="link">
|
||||
首页
|
||||
</RouterLink>
|
||||
<span> > </span>
|
||||
<span>业务详情</span>
|
||||
</nav>
|
||||
|
||||
<template v-if="line">
|
||||
<header class="business-detail__hero">
|
||||
<span class="business-detail__logo">
|
||||
<!-- TODO(蓝湖): 替换业务图标切图 -->
|
||||
{{ line.name.slice(0, 2) }}
|
||||
</span>
|
||||
<div class="business-detail__intro">
|
||||
<h1 class="business-detail__name">
|
||||
{{ line.name }}
|
||||
</h1>
|
||||
<p class="business-detail__slogan text-secondary">
|
||||
{{ line.slogan }}
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<HomeServiceTabs
|
||||
:service-types="line.serviceTypes"
|
||||
:service-content="line.serviceContent"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<p v-else class="text-secondary">
|
||||
正在加载业务详情...
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.business-detail {
|
||||
padding-top: @spacing-lg;
|
||||
padding-bottom: @spacing-xxl;
|
||||
|
||||
&__breadcrumb {
|
||||
margin-bottom: @spacing-base;
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
|
||||
&__hero {
|
||||
.flex(row, flex-start);
|
||||
gap: @spacing-base;
|
||||
margin-bottom: @spacing-xl;
|
||||
padding: @spacing-xl;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
box-shadow: @shadow-base;
|
||||
}
|
||||
|
||||
&__logo {
|
||||
.flex(row, center);
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: @radius-lg;
|
||||
background: @primary-light;
|
||||
color: @primary-color;
|
||||
font-size: @font-size-xl;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__intro {
|
||||
.flex(column, flex-start);
|
||||
gap: @spacing-xs;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: @font-size-xxl;
|
||||
font-weight: 600;
|
||||
color: @heading-color;
|
||||
}
|
||||
|
||||
&__slogan {
|
||||
font-size: @font-size-base;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user