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.
722 lines
17 KiB
722 lines
17 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.shopCode" @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="menu">
|
|
<div class="item" v-for="tab of menuList" :key="tab.moduleCode" @click="goMenu(tab)">
|
|
<div class="icon"><img :src="theme.images[tab.routePath.slice(1)]" /></div>
|
|
<div class="title">{{ tab.moduleName }}</div>
|
|
</div>
|
|
</div>
|
|
<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}?code=${currentFloor.projectCode}&s=${currentFloor.floorOrder}_${currentFloor.location}_屏幕的位置`"
|
|
v-if="currentFloor"
|
|
></QRCodeFromText>
|
|
扫我导航
|
|
</div>
|
|
</div>
|
|
<div v-if="showFood" class="food">
|
|
<div
|
|
class="title"
|
|
@click="
|
|
() => {
|
|
clearShop()
|
|
goPage({ title: '推荐美食', path: '/foods' })
|
|
}
|
|
"
|
|
>
|
|
<h1>推荐美食</h1>
|
|
<h2>此时此刻,美食正在等你</h2>
|
|
</div>
|
|
<Swiper
|
|
class="brandSwiper"
|
|
:watchOverflow="true"
|
|
:slides-per-view="3"
|
|
:loop="foodList.length > 3"
|
|
:modules="[Autoplay]"
|
|
:direction="'vertical'"
|
|
:speed="3000"
|
|
:autoplay="
|
|
foodList.length > 3
|
|
? {
|
|
delay: 0,
|
|
disableOnInteraction: false
|
|
}
|
|
: false
|
|
"
|
|
>
|
|
<SwiperSlide class="brandSlide" v-for="(list, i) of foodList" :key="i">
|
|
<div class="grid">
|
|
<img class="item" v-for="shop of list" :key="shop.shopCode" :src="'./static/offline' + shop.logoUrl" alt="" @click="handleFood(shop.shopCode)" />
|
|
</div>
|
|
</SwiperSlide>
|
|
</Swiper>
|
|
</div>
|
|
<div v-else class="rec">
|
|
<div
|
|
class="title"
|
|
:style="{ backgroundImage: `url(${theme.images.recBg})` }"
|
|
@click="
|
|
() => {
|
|
clearShop()
|
|
goPage({ title: '品牌列表', path: '/brand' })
|
|
}
|
|
"
|
|
>
|
|
<h1>推荐品牌</h1>
|
|
<h2>心动之选,拥抱美好生活</h2>
|
|
</div>
|
|
<Swiper
|
|
class="brandSwiper"
|
|
:slides-per-view="3"
|
|
:loop="recommendShops.length > 3"
|
|
:modules="[Autoplay]"
|
|
:direction="'vertical'"
|
|
:speed="3000"
|
|
:autoplay="
|
|
recommendShops.length > 3
|
|
? {
|
|
delay: 0,
|
|
disableOnInteraction: false
|
|
}
|
|
: false
|
|
"
|
|
>
|
|
<SwiperSlide class="brandSlide" v-for="(list, i) of recommendShops" :key="i">
|
|
<div class="grid">
|
|
<img class="item" v-for="shop of list" :key="shop.shopCode" :src="'./static/offline' + shop.logoUrl" alt="" @click="handleRecBrand(shop.shopCode)" />
|
|
</div>
|
|
</SwiperSlide>
|
|
</Swiper>
|
|
</div>
|
|
|
|
<div class="acts">
|
|
<EffectFade :list="ads ?? []">
|
|
<template v-slot="{ item }">
|
|
<div class="banner-wrapper">
|
|
<img class="banner" :src="'./static/offline' + item.content.pic[0]" alt="" />
|
|
<div class="name">{{ item.content.name }}</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 { getAD } 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'
|
|
import { Swiper, SwiperSlide } from 'swiper/vue'
|
|
import { Autoplay } from 'swiper'
|
|
|
|
const splitBy = (array, chunkSize = 4) => {
|
|
const result = []
|
|
for (let i = 0; i < array.length; i += chunkSize) {
|
|
const chunk = array.slice(i, i + chunkSize)
|
|
result.push(chunk)
|
|
}
|
|
return result
|
|
}
|
|
|
|
const router = useRouter()
|
|
const store = useStore()
|
|
const { indexList, currentFloor, buildingList, shopList, menuList, config, theme, foodIndustryMap } = storeToRefs(store)
|
|
const guideDesc = ref('')
|
|
const foodList = computed(() => {
|
|
const arr = shopList.value.filter(({ industryFatherCode }) => foodIndustryMap.value[industryFatherCode])
|
|
if (arr.length > 12) {
|
|
while (arr.length % 4 !== 0) {
|
|
arr.push(arr[Math.floor(Math.random() * arr.length)])
|
|
}
|
|
}
|
|
return splitBy(arr)
|
|
})
|
|
const hotRecommend = computed(() => indexList?.value?.hotSearch?.slice(0, 5) ?? [])
|
|
const recommendShops = computed(() => {
|
|
const arr = indexList?.value?.recommendList
|
|
if (arr.length > 12) {
|
|
while (arr.length % 4 !== 0) {
|
|
arr.push(arr[Math.floor(Math.random() * arr.length)])
|
|
}
|
|
}
|
|
|
|
return splitBy(arr)
|
|
})
|
|
const bf = computed(() => (buildingList.length > 1 ? currentFloor.value.building + '-' : '') + currentFloor.value.floor)
|
|
const ads = 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(({ industryCode }) => foodIndustryMap.value[industryCode])
|
|
guideDesc.value = `全场${allShopNum}个品牌${spFormat ? `,其中${spFormat.shopNum}个${spFormat.industryName}品牌` : ''}`
|
|
})
|
|
|
|
const goPage = item => router.push(item.path)
|
|
|
|
const goMenu = item => router.push(item.routePath)
|
|
|
|
const setShopByCode = code => {
|
|
const shop = shopList.value.find(_shop => _shop.shopCode === code)
|
|
store.SET_SHOP(shop)
|
|
}
|
|
|
|
function handleHot(item) {
|
|
const shop = shopList.value.find(_shop => _shop.shopCode === item.shopCode)
|
|
store.SET_SHOP(shop)
|
|
goPage({ title: 'Guide', path: '/guide' })
|
|
}
|
|
getAD().then(({ data }) => {
|
|
ads.value = data ?? []
|
|
})
|
|
|
|
const clearShop = () => {
|
|
store.SET_SHOP(null)
|
|
}
|
|
|
|
const handleRecBrand = code => {
|
|
setShopByCode(code)
|
|
goPage({ title: '品牌列表', path: '/brand' })
|
|
}
|
|
const handleFood = code => {
|
|
setShopByCode(code)
|
|
goPage({ title: '推荐美食', path: '/foods' })
|
|
}
|
|
</script>
|
|
<style lang="scss">
|
|
// @keyframes marquee {
|
|
// from {
|
|
// transform: translateY(0);
|
|
// }
|
|
// 95% {
|
|
// transform: translateY(calc(-100% + 389px - 40px - 15px));
|
|
// }
|
|
// to {
|
|
// transform: translateY(0);
|
|
// }
|
|
// }
|
|
</style>
|
|
<style lang="scss" scoped>
|
|
.index-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
position: absolute;
|
|
top: 0;
|
|
|
|
.header {
|
|
width: 100%;
|
|
height: 296px;
|
|
padding: 172px 0 0 68px;
|
|
|
|
.hot-search {
|
|
.title {
|
|
font-style: normal;
|
|
font-weight: 900;
|
|
font-size: 20px;
|
|
line-height: 23px;
|
|
color: var(--index-hotSearchTitleColor);
|
|
}
|
|
|
|
.row {
|
|
margin-top: 16px;
|
|
|
|
.item {
|
|
position: relative;
|
|
display: inline-block;
|
|
max-width: 176px;
|
|
height: 52px;
|
|
|
|
background: var(--index-hotSearchBg);
|
|
border-radius: var(--global-radius, 100px);
|
|
|
|
.text {
|
|
text-align: center;
|
|
font-weight: 900;
|
|
font-size: 16px;
|
|
line-height: 52px;
|
|
color: var(--index-hotSearchColor);
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
padding: 0 32px;
|
|
display: inline-block;
|
|
align-items: center;
|
|
max-width: 176px;
|
|
}
|
|
|
|
.medal {
|
|
position: absolute;
|
|
width: 32px;
|
|
height: 32px;
|
|
left: 4px;
|
|
top: -10px;
|
|
}
|
|
}
|
|
|
|
.item + .item {
|
|
margin-left: 24px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.content {
|
|
position: relative;
|
|
width: 100%;
|
|
flex: 1;
|
|
|
|
.guide {
|
|
position: absolute;
|
|
width: 339px;
|
|
height: 557px;
|
|
left: 68px;
|
|
top: 232px;
|
|
background: var(--index-guideBackground);
|
|
border: var(--index-guideBorder);
|
|
border-radius: var(--global-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: var(--global-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 {
|
|
position: absolute;
|
|
display: flex;
|
|
flex-direction: column;
|
|
top: 232px;
|
|
left: 447px;
|
|
width: 565px;
|
|
height: 557px;
|
|
|
|
h1 {
|
|
z-index: 1;
|
|
font-weight: 900;
|
|
font-size: 56px;
|
|
line-height: 66px;
|
|
color: #ffffff;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
h2 {
|
|
z-index: 1;
|
|
font-weight: 700;
|
|
font-size: 16px;
|
|
line-height: 19px;
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
|
|
.brandSwiper {
|
|
height: 389px;
|
|
z-index: 0;
|
|
|
|
:deep() {
|
|
.swiper-wrapper {
|
|
transition-timing-function: linear;
|
|
}
|
|
}
|
|
}
|
|
|
|
.marquee {
|
|
z-index: 0;
|
|
flex: 1;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.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: var(--global-radius, 12px);
|
|
padding: 10px;
|
|
object-fit: contain;
|
|
}
|
|
}
|
|
}
|
|
|
|
.food {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: var(--index-foodBg);
|
|
border-radius: var(--global-radius, 32px);
|
|
border: var(--index-foodBorder);
|
|
align-items: center;
|
|
overflow: hidden;
|
|
|
|
.title {
|
|
z-index: 1;
|
|
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: var(--global-radius, 27px);
|
|
padding: 32px 0 0 40px;
|
|
}
|
|
}
|
|
|
|
.rec {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: var(--index-recBg);
|
|
border: var(--index-recBorder);
|
|
border-radius: var(--global-radius, 32px);
|
|
align-items: center;
|
|
overflow: hidden;
|
|
|
|
.title {
|
|
z-index: 1;
|
|
margin-top: 8px;
|
|
width: 549px;
|
|
background: center / cover no-repeat;
|
|
height: 160px;
|
|
flex: 0 0 160px;
|
|
box-shadow: 0px 15px 26px rgba(230, 201, 148, 0.3);
|
|
border-radius: var(--global-radius, 27px);
|
|
padding: 32px 0 0 40px;
|
|
}
|
|
}
|
|
|
|
.menu {
|
|
position: absolute;
|
|
left: 68px;
|
|
right: 68px;
|
|
// top: 637px;
|
|
top: 40px;
|
|
display: flex;
|
|
|
|
.item:nth-child(5n + 1) {
|
|
.icon {
|
|
background: var(--menu-indexBg1);
|
|
}
|
|
}
|
|
|
|
.item:nth-child(5n + 2) {
|
|
.icon {
|
|
background: var(--menu-indexBg2);
|
|
}
|
|
}
|
|
|
|
.item:nth-child(5n + 3) {
|
|
.icon {
|
|
background: var(--menu-indexBg3);
|
|
}
|
|
}
|
|
|
|
.item:nth-child(5n + 4) {
|
|
.icon {
|
|
background: var(--menu-indexBg4);
|
|
}
|
|
}
|
|
|
|
.item:nth-child(5n + 5) {
|
|
.icon {
|
|
background: var(--menu-indexBg5);
|
|
}
|
|
}
|
|
|
|
.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: var(--global-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;
|
|
}
|
|
}
|
|
|
|
.acts {
|
|
position: absolute;
|
|
left: 68px;
|
|
right: 68px;
|
|
bottom: 266px;
|
|
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: var(--global-radius, 24px);
|
|
overflow: hidden;
|
|
|
|
.banner {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
border-radius: var(--global-radius, 24px);
|
|
}
|
|
|
|
.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;
|
|
color: var(--color-white-opacity);
|
|
text-transform: uppercase;
|
|
|
|
i {
|
|
font-size: 60px;
|
|
}
|
|
}
|
|
}
|
|
|
|
@media (min-aspect-ratio: 1/1) {
|
|
.index-container {
|
|
.header {
|
|
height: 280px;
|
|
flex: 0 0 280px;
|
|
padding: 157px 0 0 0;
|
|
|
|
.hot-search {
|
|
.title {
|
|
text-align: center;
|
|
}
|
|
|
|
.row {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
}
|
|
}
|
|
|
|
.content {
|
|
.guide {
|
|
top: 84px;
|
|
width: 339px;
|
|
height: 625px;
|
|
padding: 528px 0 0 40px;
|
|
|
|
.top {
|
|
height: 500px;
|
|
}
|
|
}
|
|
|
|
.rec,
|
|
.food {
|
|
height: 625px;
|
|
top: 84px;
|
|
|
|
.brandSwiper {
|
|
height: 457px;
|
|
}
|
|
}
|
|
|
|
.menu {
|
|
left: 1068px;
|
|
right: 68px;
|
|
top: 84px;
|
|
}
|
|
|
|
.acts {
|
|
top: 267px;
|
|
left: 1068px;
|
|
right: 68px;
|
|
width: 784px;
|
|
height: 442px;
|
|
.banner-wrapper {
|
|
width: 784px;
|
|
height: 442px;
|
|
.name {
|
|
width: 784px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
|