Browse Source

feat: 全部楼层业态

潮流
jiannibang 4 years ago
parent
commit
f871c5e82b
  1. 95
      src/views/Guide/Guide.vue

95
src/views/Guide/Guide.vue

@ -1,10 +1,12 @@
<template> <template>
<View> <View>
<Teleport to="body"> <Teleport to="body">
<div class="floors-list animate__fast animate__animated animate__fadeIn">
<ScrollView scroll-x :list="currentBuildingFloorsList" class="floors-list animate__fast animate__animated animate__fadeIn">
<div style="display: inline-block; white-space: nowrap">
<div class="floors-item all" @click="showAll = true" :class="{ active: showAll }">全部楼层</div>
<div <div
@click="handleFloor(item, index)" @click="handleFloor(item, index)"
:class="{ active: floorIdx === index, current: currentFloor.floorCode === item.floorCode }"
:class="{ active: !showAll && floorIdx === index, current: currentFloor.floorCode === item.floorCode }"
class="floors-item" class="floors-item"
v-for="(item, index) of currentBuildingFloorsList" v-for="(item, index) of currentBuildingFloorsList"
:key="item.floorCode" :key="item.floorCode"
@ -12,6 +14,17 @@
{{ item.floor }} {{ item.floor }}
</div> </div>
</div> </div>
</ScrollView>
<div class="allFloors" animate__fast animate__animated animate__fadeInUp v-if="showAll">
<ScrollView>
<div class="row" v-for="(item, index) of currentBuildingFloorsList" :key="item.floorCode">
<div class="left">{{ item.floor }}</div>
<div class="right">
<div class="format">{{ formatMap[item.floor] }}</div>
</div>
</div>
</ScrollView>
</div>
</Teleport> </Teleport>
<Teleport to="body"> <Teleport to="body">
@ -43,18 +56,21 @@
</template> </template>
<script setup> <script setup>
import { ref, watch, onBeforeUnmount } from 'vue'
import { ref, watch, onBeforeUnmount, onMounted } from 'vue'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useStore } from '@/store/root' import { useStore } from '@/store/root'
import { list, RESET, DIRECTION, ACTIVITY_BRAND } from './list' import { list, RESET, DIRECTION, ACTIVITY_BRAND } from './list'
import View from '@/layouts/View.vue' import View from '@/layouts/View.vue'
import { hideMapDialog } from '@/composables/useInitMap' import { hideMapDialog } from '@/composables/useInitMap'
import { getBrandListByFormat } from '@/http/brand/api'
import { getBrandListByFormat, getBrandListByFloor } from '@/http/brand/api'
import BrandScroll from '@/components/BrandScroll/BrandScroll.vue' import BrandScroll from '@/components/BrandScroll/BrandScroll.vue'
import ScrollView from '@/base/ScrollView/ScrollView.vue'
const shopList = ref([]) const shopList = ref([])
const showAll = ref(false)
const isRow = ref(false) const isRow = ref(false)
const store = useStore() const store = useStore()
const formatMap = ref({})
const { currentBuildingFloorsList, currentFloor, config } = storeToRefs(store) const { currentBuildingFloorsList, currentFloor, config } = storeToRefs(store)
try { try {
@ -62,6 +78,11 @@ try {
} catch (error) { } catch (error) {
console.log('error: ', error) console.log('error: ', error)
} }
getBrandListByFloor().then(({ data }) => {
formatMap.value = data.list
.map(({ name, shopList }) => ({ name, format: Object.keys(shopList.reduce((acc, nxt) => ({ ...acc, [nxt.industryFatherName]: true }), {})).join('/') }))
.reduce((acc, nxt) => ({ ...acc, [nxt.name]: nxt.format }), {})
})
getBrandListByFormat().then(({ data }) => { getBrandListByFormat().then(({ data }) => {
shopList.value = data.list shopList.value = data.list
}) })
@ -125,6 +146,7 @@ function handleShop(item) {
const floorIdx = ref(-1) const floorIdx = ref(-1)
function handleFloor(item, index) { function handleFloor(item, index) {
showAll.value = false
hideMapDialog() hideMapDialog()
mapIdx.value = -1 mapIdx.value = -1
cancelIdleCallback(idle.value) cancelIdleCallback(idle.value)
@ -156,6 +178,11 @@ onBeforeUnmount(() => {
clearTimeout(mapIconTimer.value) clearTimeout(mapIconTimer.value)
}) })
onMounted(() => {
const facs = window.Map_QM.getAllIcon()
console.log(facs)
})
watch( watch(
[shopList, currentFloor], [shopList, currentFloor],
([_shopList, _currentFloor]) => { ([_shopList, _currentFloor]) => {
@ -170,22 +197,69 @@ watch(
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.allFloors {
position: absolute;
top: 408px;
left: 0;
right: 0;
height: 642px;
background: left / 150px 100% no-repeat linear-gradient(180deg, #6c7ca6 0%, #879aca 100%), #dee6f6;
z-index: 100;
.row {
height: 76px;
display: flex;
.left {
flex: 0 0 150px;
font-family: 'Montserrat';
font-style: normal;
font-weight: 700;
font-size: 28px;
line-height: 96%;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
/* W/100% */
color: #ffffff;
}
.right {
flex: 1;
display: flex;
padding: 0 68px;
.format {
flex: 0 0 50%;
font-weight: 700;
font-size: 20px;
line-height: 23px;
display: flex;
align-items: center;
color: rgba(0, 0, 0, 0.8);
}
.facs {
flex: 0 0 50%;
}
}
}
}
.floors-list { .floors-list {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
width: 100vw;
top: 1050px; top: 1050px;
height: 100px; height: 100px;
z-index: 60; z-index: 60;
display: block; display: block;
overflow-y: hidden;
overflow-x: scroll;
overflow: hidden;
background: linear-gradient(113.71deg, #435acd 0%, #749cf3 100%); background: linear-gradient(113.71deg, #435acd 0%, #749cf3 100%);
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;
} }
.floors-item { .floors-item {
flex: 1;
display: inline-flex; display: inline-flex;
width: 122.5px; width: 122.5px;
align-items: center; align-items: center;
@ -205,6 +279,13 @@ watch(
color: #ffffff; color: #ffffff;
transition: all 0.5s; transition: all 0.5s;
&.all {
width: 150px;
font-weight: 700;
font-size: 18px;
line-height: 96%;
vertical-align: bottom;
}
&.current { &.current {
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
&::after { &::after {

Loading…
Cancel
Save