You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

472 lines
13 KiB

<template>
<View mid>
<div class="index-container">
<div class="header">
<div class="hot-search">
<h1 class="title">{{ $t('hotSearch') }}</h1>
<div class="row">
<div class="item" v-for="(item, i) of hotRecommend" :key="item.shopId" @click="handleHot(item)">
<img class="medal" v-if="i === 0" src="./fir.svg" />
<img class="medal" v-if="i === 1" src="./sec.svg" />
<img class="medal" v-if="i === 2" src="./thi.svg" />
<div class="text">{{ item.shopName }}</div>
</div>
</div>
</div>
</div>
<div class="content">
<div class="r1">
<div class="guide" @click="goPage({ title: '地图导览', path: '/guide' })">
<div class="top">
<div class="title">找店</div>
<div class="meta">{{ guideDesc }}</div>
<img src="./guideImg.svg" />
</div>
<div class="meta1">当前位置<img :src="theme.images.loc" /></div>
<div class="meta2">{{ bf }}</div>
<div class="bottom-right">
<QRCodeFromText
class="qrcode"
:size="80"
:text="`${config.mobileNav}?s=${currentFloor.floorOrder}_${currentFloor.location}_屏幕的位置`"
v-if="currentFloor"
></QRCodeFromText>
扫我导航
</div>
</div>
<div v-if="showFood" class="food" @click="goPage({ title: '推荐美食', path: '/foods' })">
<div class="title">
<h1>推荐美食</h1>
<h2>此时此刻,美食正在等你</h2>
</div>
<div class="grid">
<img class="item" v-for="shop of foodList" :key="shop.id" :src="config.sourceUrl + shop.logoUrl" alt="" />
</div>
</div>
<div v-else class="rec" @click="goPage({ title: '品牌列表', path: '/brand' })">
<div class="title">
<h1>推荐品牌</h1>
<h2>心动之选,拥抱美好生活</h2>
</div>
<div class="grid">
<img class="item" v-for="shop of shopList.slice(0, 16)" :key="shop.id" :src="config.sourceUrl + shop.logoUrl" alt="" />
</div>
</div>
</div>
<div class="r2">
<div class="item" v-for="tab of sidebarList" :key="tab.title" @click="goPage(tab)">
<div class="icon"><img :src="theme.images[tab.moduleName]" /></div>
<div class="title">{{ switchLanguage(tab, 'title') }}</div>
</div>
</div>
<div class="r3">
<EffectFade :list="activityList ?? []">
<template v-slot="{ item }">
<div class="banner-wrapper">
<img class="banner" :src="config.sourceUrl + item.fileUrl" alt="" />
<div class="name">{{ item.activityName }}</div>
</div>
</template>
</EffectFade>
</div>
</div>
<router-view />
</div>
</View>
</template>
<script setup>
import { computed, ref } from 'vue'
import { useRouter } from 'vue-router'
import { storeToRefs } from 'pinia'
import { useStore } from '@/store/root'
import { getBrandList } from '@/http/brand/api'
import { getActivityList } from '@/http/api'
import View from '@/layouts/View.vue'
import EffectFade from '@/components/EffectFade/EffectFade.vue'
import { useTime } from '@/composables/useTime'
import QRCodeFromText from '@/components/QRCodeFromText/QRCodeFromText.vue'
const router = useRouter()
const store = useStore()
const { indexList, currentFloor, buildingList, shopList, sidebarList, config, theme } = storeToRefs(store)
const guideDesc = ref('')
const foodList = computed(() => shopList.value.filter(({ isSpecial }) => isSpecial).slice(0, 12) ?? [])
const hotRecommend = computed(() => indexList.value.hotSearch.slice(0, 5) ?? [])
const bf = computed(() => (buildingList.length > 1 ? currentFloor.value.building + '-' : '') + currentFloor.value.floor)
const activityList = ref([])
const { currentHour } = useTime()
const showFood = computed(() => (currentHour.value >= 11 && currentHour.value < 13) || (currentHour.value >= 17 && currentHour.value < 20))
getBrandList().then(({ data: { allShopNum, industryFatherList } }) => {
const spFormat = industryFatherList.find(({ isSpecial }) => isSpecial)
guideDesc.value = `全场${allShopNum}个品牌${spFormat ? `,其中${spFormat.shopNum}${spFormat.industryName}品牌` : ''}`
})
const goPage = item => {
store.SET_SELECTED_MODULE(item.title)
router.push(item.path)
}
function handleHot(item) {
const shop = shopList.value.find(_shop => _shop.shopId === item.shopId)
store.SET_SHOP(shop)
goPage({ title: 'Guide', path: '/guide' })
}
getActivityList(3).then(({ data }) => {
activityList.value = data?.activityList ?? []
console.log(data.activityList)
})
</script>
<style lang="scss" scoped>
.index-container {
display: flex;
flex-direction: column;
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
.header {
width: 100%;
height: 515px;
padding: 392px 0 0 68px;
.hot-search {
.title {
font-style: normal;
font-weight: 900;
font-size: 20px;
line-height: 23px;
color: var(--index-recTitleColor);
}
.row {
margin-top: 16px;
.item {
position: relative;
display: inline-block;
max-width: 176px;
height: 52px;
background: rgba(255, 255, 255, 0.8);
border-radius: 100px;
.text {
text-align: center;
font-weight: 900;
font-size: 16px;
line-height: 52px;
color: rgba(0, 0, 0, 0.6);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding: 0 32px;
}
.medal {
position: absolute;
width: 32px;
height: 32px;
left: 4px;
top: -10px;
}
}
.item + .item {
margin-left: 24px;
}
}
}
}
.content {
width: 100%;
flex: 1;
padding: 40px 68px 0 68px;
.r1 {
display: flex;
height: 557px;
.guide {
position: relative;
flex: 0 0 339px;
width: 339px;
height: 557px;
background: var(--index-guideBackground);
border: var(--index-guideBorder);
border-radius: 32px;
overflow: hidden;
padding: 460px 0 0 40px;
.top {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 432px;
background: var(--index-guideTopBg);
border-radius: 32px;
padding: 40px;
z-index: 1;
.title {
font-style: normal;
font-weight: 900;
font-size: 56px;
line-height: 66px;
color: #ffffff;
}
.meta {
margin-top: 8px;
font-style: normal;
font-weight: 700;
font-size: 16px;
line-height: 19px;
color: rgba(255, 255, 255, 0.8);
}
img {
margin-top: 40px;
width: 259px;
}
}
.bottom-right {
position: absolute;
width: 108px;
height: 156px;
right: 0;
bottom: 0;
background: var(--index-guideQrcodeBg);
padding-top: 132px;
font-weight: 700;
font-size: 14px;
line-height: 16px;
text-align: center;
color: var(--index-guideMetaColor);
.qrcode {
position: absolute;
width: 84px;
height: 84px;
background: #fff;
display: flex;
right: 12px;
bottom: 29px;
justify-content: center;
align-items: center;
}
}
.meta1 {
display: inline-flex;
font-weight: 700;
font-size: 20px;
line-height: 23px;
color: var(--index-guideMetaColor);
margin-bottom: 6px;
img {
width: 20px;
height: 20px;
margin-left: 4px;
}
}
.meta2 {
font-weight: 900;
font-size: 32px;
line-height: 38px;
color: var(--index-guideColor);
}
}
.food,
.rec {
h1 {
font-weight: 900;
font-size: 56px;
line-height: 66px;
color: #ffffff;
margin-bottom: 8px;
}
h2 {
font-weight: 700;
font-size: 16px;
line-height: 19px;
color: rgba(255, 255, 255, 0.8);
}
.grid {
margin-top: 40px;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
width: 485px;
gap: 15px;
.item {
width: 110px;
height: 110px;
background: #ffffff;
border-radius: 12px;
padding: 10px;
object-fit: contain;
}
}
}
.food {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
margin-left: 40px;
background: var(--index-foodBg);
border-radius: 32px;
border: var(--index-foodBorder);
align-items: center;
overflow: hidden;
.title {
margin-top: 4px;
width: 549px;
background: center / cover no-repeat url(./foodBg.png);
height: 160px;
flex: 0 0 160px;
box-shadow: 0px 15px 26px rgba(244, 142, 88, 0.32);
border-radius: 27px;
padding: 32px 0 0 40px;
}
}
.rec {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
margin-left: 40px;
background: var(--index-recBg);
border: var(--index-recBorder);
border-radius: 32px;
align-items: center;
overflow: hidden;
.title {
margin-top: 8px;
width: 549px;
background: center / cover no-repeat url(./recBg.png);
height: 160px;
flex: 0 0 160px;
box-shadow: 0px 15px 26px rgba(230, 201, 148, 0.3);
border-radius: 27px;
padding: 32px 0 0 40px;
}
}
}
.r2 {
display: flex;
margin-top: 40px;
.item:nth-child(5n + 1) {
.icon {
background: var(--menu-activeBg1);
}
}
.item:nth-child(5n + 2) {
.icon {
background: var(--menu-activeBg2);
}
}
.item:nth-child(5n + 3) {
.icon {
background: var(--menu-activeBg3);
}
}
.item:nth-child(5n + 4) {
.icon {
background: var(--menu-activeBg4);
}
}
.item:nth-child(5n + 5) {
.icon {
background: var(--menu-activeBg5);
}
}
.item {
display: flex;
flex-direction: column;
flex: 1;
height: 151px;
justify-content: space-between;
.icon {
display: flex;
justify-content: center;
align-items: center;
height: 118px;
border-radius: 24px;
img {
width: 80px;
height: 80px;
}
}
.title {
font-weight: 700;
font-size: 18px;
line-height: 21px;
text-align: center;
color: var(--menu-indexColor);
}
}
.item + .item {
margin-left: 24px;
}
}
.r3 {
margin-top: 40px;
width: 944px;
height: 531px;
:deep(.swiper) {
.swiper-pagination {
top: 20px;
right: 27px;
bottom: auto;
left: auto;
width: auto;
.swiper-pagination-bullet {
width: 34px !important;
height: 4px !important;
background: rgba(0, 0, 0, 0.6);
border-radius: 6px !important;
opacity: inherit !important;
margin: 0;
&.swiper-pagination-bullet-active {
background: #ffffff;
border-radius: 6px !important;
}
}
}
}
.banner-wrapper {
position: relative;
width: 944px;
height: 531px;
border-radius: 24px;
overflow: hidden;
.banner {
width: 944px;
height: 531px;
object-fit: cover;
}
.name {
position: absolute;
bottom: 0;
left: 0;
width: 944px;
height: 58px;
background: rgba(0, 0, 0, 0.4);
font-weight: 700;
font-size: 24px;
line-height: 58px;
color: #ffffff;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 0 30px;
}
}
}
}
.text {
font-size: 88px;
font-weight: 700;
font-family: 'font_bold';
color: var(--color-white-opacity);
text-transform: uppercase;
i {
font-size: 60px;
}
}
}
</style>