feat 首页_业务服务整改

This commit is contained in:
Ironsp
2026-10-13 15:42:08 +08:00
parent 5fa940e9ba
commit 093cf9acd0
4 changed files with 41 additions and 10 deletions

BIN
src/assets/home/chahua.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -71,6 +71,7 @@ function toBusinessLine(vo: ProjectSubmissionVo): BusinessLine {
desc: subtitle, desc: subtitle,
slogan: subtitle, slogan: subtitle,
icon: vo.logoUrl ?? '', icon: vo.logoUrl ?? '',
cover: vo.coverUrl ?? '',
serviceContent, serviceContent,
contents, contents,
serviceTypes, serviceTypes,
@@ -99,6 +100,7 @@ function toBusinessLineFromInfo(info: ProjectSubmissionInfo): BusinessLine {
desc: subtitle, desc: subtitle,
slogan: subtitle, slogan: subtitle,
icon: ps.logoUrl ?? '', icon: ps.logoUrl ?? '',
cover: ps.coverUrl ?? '',
serviceContent, serviceContent,
contents, contents,
serviceTypes, serviceTypes,

View File

@@ -35,6 +35,7 @@ export interface BusinessLine {
desc: string desc: string
slogan: string slogan: string
icon: string icon: string
cover: string
serviceContent: string serviceContent: string
contents: ServiceContentBlock[] contents: ServiceContentBlock[]
serviceTypes: ServiceType[] serviceTypes: ServiceType[]

View File

@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { BusinessType } from '@/types/api' import type { BusinessType } from '@/types/api'
import type { BusinessLine } from '@/types/business/home' import type { BusinessLine } from '@/types/business/home'
import defaultCover from '@/assets/home/chahua.png'
interface Props { interface Props {
lines: BusinessLine[] lines: BusinessLine[]
@@ -9,6 +10,16 @@ interface Props {
defineProps<Props>() defineProps<Props>()
const FALLBACK_ACTIVE: BusinessType[] = ['internet'] const FALLBACK_ACTIVE: BusinessType[] = ['internet']
function isImageUrl(value: string): boolean {
return /^(https?:)?\/\//i.test(value) || value.startsWith('/') || value.startsWith('data:')
}
function coverSrc(line: BusinessLine): string {
const remote = (line.cover || line.icon).trim()
if (remote && isImageUrl(remote)) return remote
return defaultCover
}
</script> </script>
<template> <template>
@@ -25,6 +36,11 @@ const FALLBACK_ACTIVE: BusinessType[] = ['internet']
'home-business__card--active': FALLBACK_ACTIVE.includes(line.id), 'home-business__card--active': FALLBACK_ACTIVE.includes(line.id),
}" }"
> >
<img
class="home-business__cover"
:src="coverSrc(line)"
:alt="line.name"
>
<span class="home-business__check" aria-hidden="true" /> <span class="home-business__check" aria-hidden="true" />
<h4 class="home-business__name"> <h4 class="home-business__name">
{{ line.name }} {{ line.name }}
@@ -52,16 +68,16 @@ const FALLBACK_ACTIVE: BusinessType[] = ['internet']
} }
&__grid { &__grid {
display: flex; display: grid;
grid-template-columns: repeat(4, 1fr);
gap: @spacing-base; gap: @spacing-base;
} }
&__card { &__card {
position: relative; position: relative;
.flex(column, flex-start, flex-start); .flex(column, flex-start, flex-start);
flex: 1 1 0;
min-width: 0; min-width: 0;
min-height: 160px; min-height: 168px;
box-sizing: border-box; box-sizing: border-box;
padding: @spacing-lg; padding: @spacing-lg;
overflow: hidden; overflow: hidden;
@@ -80,22 +96,32 @@ const FALLBACK_ACTIVE: BusinessType[] = ['internet']
} }
} }
&__cover {
display: block;
width: 72px;
height: 72px;
object-fit: contain;
flex-shrink: 0;
}
&__check { &__check {
position: absolute; position: absolute;
top: 27px; top: @spacing-base;
right: 37px; right: @spacing-base;
z-index: 1;
flex-shrink: 0; flex-shrink: 0;
width: 31px; width: 20px;
height: 31px; height: 20px;
border: 1px solid @home-ring; border: 1px solid @home-ring;
border-radius: @radius-round; border-radius: @radius-round;
background: @white;
&::after { &::after {
content: ''; content: '';
position: absolute; position: absolute;
inset: 0; inset: 0;
width: 21px; width: 12px;
height: 21px; height: 12px;
margin: auto; margin: auto;
border-radius: @radius-round; border-radius: @radius-round;
background: @white; background: @white;
@@ -104,7 +130,8 @@ const FALLBACK_ACTIVE: BusinessType[] = ['internet']
} }
&__name { &__name {
margin: @spacing-xxl 0 0; margin: @spacing-base 0 0;
padding-right: @spacing-xl;
font-size: @font-size-lg; font-size: @font-size-lg;
font-weight: 500; font-weight: 500;
line-height: 1.4; line-height: 1.4;
@@ -113,6 +140,7 @@ const FALLBACK_ACTIVE: BusinessType[] = ['internet']
&__desc { &__desc {
margin: @spacing-xs 0 0; margin: @spacing-xs 0 0;
padding-right: @spacing-xl;
font-size: @font-size-sm; font-size: @font-size-sm;
font-weight: 400; font-weight: 400;
line-height: 1.5; line-height: 1.5;