feat 首页
This commit is contained in:
@@ -12,6 +12,10 @@ const router = useRouter()
|
||||
const activeIndex = ref(0)
|
||||
let timer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
// 后端未下发banner 时退回内置插图。插图在设计稿中并非铺满背景,
|
||||
// 而是定位在右侧 (928,104) 尺寸 723x598,需按原比例显示。
|
||||
const hasBanners = computed(() => props.banners.length > 0)
|
||||
|
||||
const slides = computed(() => {
|
||||
if (props.banners.length > 0) {
|
||||
return props.banners.map((item) => item.imageUrl)
|
||||
@@ -64,7 +68,12 @@ onBeforeUnmount(stopAutoplay)
|
||||
class="home-banner__slide"
|
||||
:class="{ 'home-banner__slide--active': index === activeIndex }"
|
||||
>
|
||||
<img class="home-banner__image" :src="src" alt="">
|
||||
<img
|
||||
class="home-banner__image"
|
||||
:class="{ 'home-banner__image--inline': !hasBanners }"
|
||||
:src="src"
|
||||
alt=""
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -128,6 +137,19 @@ onBeforeUnmount(stopAutoplay)
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
|
||||
// 内置插图:按设计稿定位与尺寸原样显示,不铺满
|
||||
&--inline {
|
||||
position: absolute;
|
||||
top: 31px;
|
||||
right: 269px;
|
||||
left: auto;
|
||||
bottom: auto;
|
||||
width: 723px;
|
||||
height: 598px;
|
||||
margin-left: auto;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
&__inner {
|
||||
@@ -216,25 +238,25 @@ onBeforeUnmount(stopAutoplay)
|
||||
|
||||
&__dots {
|
||||
position: absolute;
|
||||
right: 80px;
|
||||
bottom: 40px;
|
||||
left: 929px;
|
||||
top: 594px;
|
||||
z-index: 1;
|
||||
.flex(row, flex-end, center);
|
||||
gap: 8px;
|
||||
.flex(row, flex-start, center);
|
||||
gap: 13px;
|
||||
}
|
||||
|
||||
&__dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
background: fade(@home-banner-dot, 40%);
|
||||
background: @home-banner-dot;
|
||||
cursor: pointer;
|
||||
|
||||
&--active {
|
||||
width: 24px;
|
||||
border-radius: 4px;
|
||||
width: 44px;
|
||||
border-radius: 3px;
|
||||
background: @home-banner-dot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { BusinessType } from '@/types/api'
|
||||
import type { BusinessLine } from '@/types/business/home'
|
||||
import illInternet from '@/assets/home/business-internet.png'
|
||||
import illHardware from '@/assets/home/business-hardware.png'
|
||||
import illIot from '@/assets/home/business-iot.png'
|
||||
import illManufacturing from '@/assets/home/business-manufacturing.png'
|
||||
|
||||
interface Props {
|
||||
lines: BusinessLine[]
|
||||
@@ -12,13 +8,7 @@ interface Props {
|
||||
|
||||
defineProps<Props>()
|
||||
|
||||
const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
internet: illInternet,
|
||||
hardware: illHardware,
|
||||
iot: illIot,
|
||||
manufacturing: illManufacturing,
|
||||
other: illIot,
|
||||
}
|
||||
const FALLBACK_ACTIVE: BusinessType[] = ['internet']
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -31,13 +21,10 @@ const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
:key="line.id"
|
||||
:to="`/business/${line.id}`"
|
||||
class="home-business__card"
|
||||
:class="`home-business__card--${line.id}`"
|
||||
:class="{
|
||||
'home-business__card--active': FALLBACK_ACTIVE.includes(line.id),
|
||||
}"
|
||||
>
|
||||
<img
|
||||
class="home-business__ill"
|
||||
:src="line.icon || FALLBACK_ILL[line.id]"
|
||||
:alt="line.name"
|
||||
/>
|
||||
<span class="home-business__check" aria-hidden="true" />
|
||||
<h4 class="home-business__name">
|
||||
{{ line.name }}
|
||||
@@ -76,6 +63,7 @@ const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
min-width: 0;
|
||||
height: 206px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
overflow: hidden;
|
||||
border: 1px solid @home-business-border;
|
||||
border-radius: @radius-base;
|
||||
@@ -90,19 +78,10 @@ const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
}
|
||||
}
|
||||
|
||||
&__ill {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 48px;
|
||||
width: 81px;
|
||||
height: 111px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
&__check {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 20px;
|
||||
top: 27px;
|
||||
right: 37px;
|
||||
flex-shrink: 0;
|
||||
width: 31px;
|
||||
height: 31px;
|
||||
@@ -113,8 +92,8 @@ const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 21px;
|
||||
height: 21px;
|
||||
margin: auto;
|
||||
border-radius: @radius-round;
|
||||
background: @white;
|
||||
@@ -123,7 +102,7 @@ const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
}
|
||||
|
||||
&__name {
|
||||
margin: 106px 0 0;
|
||||
margin: 104px 0 0;
|
||||
font-size: @font-size-title;
|
||||
font-weight: 500;
|
||||
line-height: 41px;
|
||||
@@ -139,7 +118,7 @@ const FALLBACK_ILL: Record<BusinessType, string> = {
|
||||
.multi-ellipsis(1);
|
||||
}
|
||||
|
||||
&__card--internet {
|
||||
&__card--active {
|
||||
border-color: @primary-strong;
|
||||
background: @primary-strong;
|
||||
|
||||
|
||||
@@ -173,13 +173,17 @@ function onMore(): void {
|
||||
position: relative;
|
||||
.flex(column, flex-start, stretch);
|
||||
flex-shrink: 0;
|
||||
flex: 0 1 722px;
|
||||
flex: 0 0 529px;
|
||||
width: 529px;
|
||||
height: 245px;
|
||||
box-sizing: border-box;
|
||||
min-width: 0;
|
||||
gap: 0;
|
||||
padding: 18px 40px 28px;
|
||||
border: 1px solid @home-card-border;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
overflow: hidden;
|
||||
|
||||
&__head {
|
||||
.flex(row, flex-start);
|
||||
|
||||
@@ -59,15 +59,17 @@ onMounted(() => {
|
||||
|
||||
&__dashboard {
|
||||
.flex(row, space-between, stretch);
|
||||
gap: 36px;
|
||||
gap: 60px;
|
||||
}
|
||||
|
||||
&__dashboard-main {
|
||||
.flex(row, space-between, center);
|
||||
flex: 1;
|
||||
flex: 0 0 1091px;
|
||||
width: 1091px;
|
||||
min-width: 0;
|
||||
box-sizing: border-box;
|
||||
gap: @spacing-lg;
|
||||
padding: 0 73px 0 106px;
|
||||
padding: 0 59px 0 105px;
|
||||
border: 1px solid @home-card-border;
|
||||
border-radius: @radius-lg;
|
||||
background: @white;
|
||||
|
||||
Reference in New Issue
Block a user