Reviewed-on: https://git.1000my.com/project-shenyangk11/sy_k11_H_base_daoshi_vue_ts/pulls/12test
@ -1,5 +1,5 @@ |
|||
{ |
|||
"code": 200, |
|||
"msg": "操作成功", |
|||
"data": [600, null] |
|||
"data": [15, null] |
|||
} |
|||
|
|||
|
After Width: | Height: | Size: 1014 B |
|
After Width: | Height: | Size: 640 B |
|
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 869 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 211 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 662 B |
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 548 B |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 539 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,174 @@ |
|||
<template> |
|||
<div class="floors-wrapper"> |
|||
<img ref="bg" src="../../assets/images/guide/bg_floor.svg" alt="" class="floors-active" /> |
|||
<ul class="floor-nav-items"> |
|||
<li |
|||
v-for="(item, index) of reverseFloors" |
|||
:id="`floor${index}`" |
|||
:key="item.floorCode" |
|||
ref="li" |
|||
:class="{ active: item.floorOrder === currentOrder }" |
|||
class="floor-nav-item" |
|||
@click="clickItem(item, index)" |
|||
> |
|||
<!-- <img v-if="item.name === currentFloor.floorName" class="bg-wrapper" :src="getFloorBg(item)" /> --> |
|||
|
|||
<p class="floor">{{ item.floor }}</p> |
|||
<img |
|||
v-if="item.floor === device.floor" |
|||
class="loc" |
|||
src="@/assets/images/guide/pos_icon.svg" |
|||
:style="{ opacity: item.floor === currentOrder ? 1 : 1 }" |
|||
alt="" |
|||
/> |
|||
<!-- <p class="loc" v-if="item.name === device.floorName" v-text="$t('guide.loc')"></p> --> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { useRootStore } from '@/store/root' |
|||
import { storeToRefs } from 'pinia' |
|||
import { toRaw, ref, computed, nextTick, onMounted } from 'vue' |
|||
|
|||
const currentOrder = ref() |
|||
const store = useRootStore() |
|||
const { currentBuildingFloorsList, device } = storeToRefs(store) |
|||
const emit = defineEmits(['click']) |
|||
const reverseFloors = computed(() => { |
|||
const arr: Floor[] = JSON.parse(JSON.stringify(toRaw(currentBuildingFloorsList.value))) |
|||
return arr //.reverse() |
|||
}) |
|||
const bg = ref() |
|||
const li = ref<[]>([]) |
|||
currentOrder.value = device.value.floorOrder |
|||
|
|||
function clickItem(item: Floor, index: number) { |
|||
if (item) { |
|||
currentOrder.value = item.floorOrder |
|||
emit('click', item) |
|||
} |
|||
if (index !== null) { |
|||
nextTick(() => { |
|||
const selFloor: any = li.value[index] ?? null |
|||
|
|||
if (selFloor) { |
|||
bg.value.style.top = parseInt(selFloor.offsetTop, 10) - 20 + 'px' |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
function goCurrentFloor() { |
|||
let index = 0 |
|||
const obj: Floor | undefined = reverseFloors.value.find((item: Floor, idx) => { |
|||
if (item.floorOrder === device.value.floorOrder) { |
|||
index = idx |
|||
return true |
|||
} |
|||
}) |
|||
if (obj) { |
|||
clickItem(obj, index) |
|||
} |
|||
} |
|||
function goSelectFloor(val: Floor) { |
|||
let index = 0 |
|||
const obj: Floor | undefined = reverseFloors.value.find((item: Floor, idx) => { |
|||
if (item.floorOrder === val.floorOrder) { |
|||
index = idx |
|||
return true |
|||
} |
|||
}) |
|||
if (obj) { |
|||
clickItem(obj, index) |
|||
} |
|||
} |
|||
onMounted(() => { |
|||
goCurrentFloor() |
|||
}) |
|||
defineExpose({ |
|||
goCurrentFloor, |
|||
goSelectFloor |
|||
}) |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.floors-wrapper { |
|||
position: absolute; |
|||
top: 266px; |
|||
left: 0; |
|||
z-index: 2; |
|||
width: 80px; |
|||
padding: 0; |
|||
.floors-active { |
|||
position: absolute; |
|||
z-index: -1; |
|||
} |
|||
.floor-nav-items { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
width: 31px; |
|||
height: fit-content; |
|||
margin-left: 28px; |
|||
flex-direction: column; |
|||
// align-items: center; |
|||
.floor-nav-item { |
|||
position: relative; |
|||
width: 100%; |
|||
height: 72px; |
|||
line-height: 72px; |
|||
margin-right: 0; |
|||
margin-bottom: 0; |
|||
font-size: 16px; |
|||
font-family: 'font_bold'; |
|||
text-align: center; |
|||
color: #84754e; |
|||
background: #fff0; |
|||
border-radius: 0; |
|||
font-style: normal; |
|||
font-weight: 700; |
|||
.loc { |
|||
position: absolute; |
|||
top: 27px; |
|||
left: -21px; |
|||
font-size: 10px; |
|||
// margin: 0 auto; |
|||
// filter: grayscale(1); |
|||
// color: rgba(0, 0, 0, 0.4); |
|||
} |
|||
.bg-wrapper { |
|||
position: absolute; |
|||
top: 5px; |
|||
left: -53px; |
|||
// z-index: -1; |
|||
// width: 100%; |
|||
// height: 100%; |
|||
} |
|||
&.active { |
|||
font-size: 24px; |
|||
color: #b7a475; |
|||
|
|||
// .floor { |
|||
// // color: #fff; |
|||
// // top: px; |
|||
// } |
|||
.loc { |
|||
// color: #fff; |
|||
// filter: brightness(2.5); |
|||
} |
|||
&::after { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 4px; |
|||
height: 24px; |
|||
content: ''; |
|||
// background: #e9487300; |
|||
// border-radius: 4px 0px 0px 4px; |
|||
// transform: matrix(-1, 0, 0, 1, 0, 0); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
|||
@ -0,0 +1,102 @@ |
|||
<template> |
|||
<transition appear enter-active-class="animate__animated animate__fadeIn" leave-active-class="animate__animated animate__fadeOut"> |
|||
<masker v-if="showThis" @click="close"> |
|||
<transition appear enter-active-class="animate__animated animate__fadeInUp" leave-active-class="animate__animated animate__zoomOut"> |
|||
<div class="dialog-wrapper" @click="close"> |
|||
<img ref="tip" src="@/assets/images/index/home_tip.svg" alt="" @load="loadHandler" /> |
|||
</div> |
|||
</transition> |
|||
</masker> |
|||
</transition> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import masker from '@/base/Masker/Masker.vue' |
|||
import { ref, onMounted, onBeforeUnmount } from 'vue' |
|||
|
|||
const tip = ref() |
|||
const showThis = ref(false) |
|||
|
|||
function show() { |
|||
showThis.value = true |
|||
} |
|||
function close() { |
|||
showThis.value = false |
|||
clearInterval(Number(timeId)) |
|||
} |
|||
function getNum(min: number, max = 0) { |
|||
min > max ? ([min, max] = [max, min]) : '' |
|||
return parseInt((Math.random() * (max - min + 1)).toString(), 10) + min |
|||
} |
|||
|
|||
let timeId: NodeJS.Timeout |
|||
//控制移动的函数 |
|||
function move() { |
|||
clearInterval(Number(timeId)) //每次调用先停止时间函数,不然会出现每调用一次,运行速度变快一次 |
|||
|
|||
let winWidth = window.innerWidth //获取视口宽度、高度 |
|||
let winHeight = window.innerHeight |
|||
winWidth -= parseInt(tip.value.width) //让它减去小球的宽度,因为移动到右边的最大距离是视口宽度减去小球自身宽度 |
|||
winHeight -= parseInt(tip.value.height) |
|||
console.log(winWidth) |
|||
let i = 0 |
|||
let j = 0 |
|||
let x = 0 |
|||
let y = 0 //设置时间函数 |
|||
|
|||
timeId = setInterval(() => { |
|||
//当它到达边界时改变颜色 |
|||
// if (i === 0 || j === 0 || i === winWidth || j === winHeight) { |
|||
// tip.value.backgroundColor = `rgb(${getNum(0, 255)},${getNum(0, 255)},${getNum(0, 255)})` |
|||
// } |
|||
// console.log('x,y :>> ', x, y) |
|||
tip.value.style.transform = `translate(${x}px,${y}px)` //移动它的位置 |
|||
i += 0.5 //随意设置,与快慢有关,但也会影响35行判断到达最大移动距离时改变颜色,因为它可能加不到等于最大距离的时候 |
|||
//假如最大距离为10,i+=3,那i的值只能为3,6,9,12...则进不了改变颜色那个条件,则到达右边时不会改变颜色 |
|||
j += 0.5 |
|||
x = i |
|||
y = j |
|||
if (i >= winWidth) { |
|||
x = 2 * winWidth - i //当到达最大移动距离后,让它的x变为两个最大移动距离减去i,因为i是一值在增加的 |
|||
if (i >= 2 * winWidth) { |
|||
//当到达两个最大移动距离后,即小球已经回到了最左边了,让i=0,就重新开始 |
|||
i = 0 |
|||
x = 0 |
|||
} |
|||
} |
|||
if (j >= winHeight) { |
|||
y = 2 * winHeight - j |
|||
if (j >= 2 * winHeight) { |
|||
j = 0 |
|||
y = 0 |
|||
} |
|||
} |
|||
}, 1) |
|||
} |
|||
function loadHandler() { |
|||
if (tip.value) { |
|||
move() |
|||
} |
|||
} |
|||
onMounted(() => {}) |
|||
onBeforeUnmount(() => { |
|||
clearInterval(Number(timeId)) |
|||
}) |
|||
defineExpose({ |
|||
show, |
|||
close |
|||
}) |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.dialog-wrapper { |
|||
width: 1920px; |
|||
height: 1080px; |
|||
img { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
width: 480px; |
|||
} |
|||
} |
|||
</style> |
|||
@ -1,13 +1,273 @@ |
|||
<template> |
|||
<div class="guide-container"></div> |
|||
<div class="guide-container"> |
|||
<!-- 楼层 --> |
|||
<guideFloors ref="guideFloorsRef" @click="clickFloor"></guideFloors> |
|||
|
|||
<!-- 品牌 --> |
|||
<div class="bg"></div> |
|||
<scrollView |
|||
class="shop-container-scroll animate__animated animate__fadeInUp" |
|||
:pull-up="false" |
|||
:list="selectedShopList" |
|||
:scrollbar="true" |
|||
> |
|||
<ul class="shop-items-wrapper"> |
|||
<div class="shop-format-wrapper"> |
|||
<!-- <h4 v-if="item.length">{{ switchLanguage(item, 'name') }}</h4> --> |
|||
<div v-if="selectedShopList.length" class="brand-list"> |
|||
<shop-item v-for="shop of selectedShopList" :key="shop.shopCode" :shop="shop" @click="handleShop(shop)"></shop-item> |
|||
</div> |
|||
</div> |
|||
</ul> |
|||
</scrollView> |
|||
|
|||
<!-- 控制地图 --> |
|||
<!-- 公共设施 --> |
|||
<div class="fac-list animate__animated animate__fadeInUp"> |
|||
<div v-for="(item, index) in facilityList" :key="index" class="fac-item" @click="clickFac(item)"> |
|||
<img :src="item.filePath" alt="" /> |
|||
<p v-text="switchLanguage(item, 'name')"></p> |
|||
</div> |
|||
</div> |
|||
<div class="map-btns-list"> |
|||
<div |
|||
v-for="(item, index) in list" |
|||
:key="index" |
|||
class="map-btn animate__animated animate__fadeInUp" |
|||
:class="{ active: index === mapIdx }" |
|||
@mousedown="mapIdx = index" |
|||
@mouseup="mapIdx = -1" |
|||
@click="clickMapItem(item, index)" |
|||
> |
|||
<div class="img-wrapper"> |
|||
<img :src="index === mapIdx ? item.iconActive : item.icon" alt="" /> |
|||
</div> |
|||
<p v-text="switchLanguage(item, 'name')"></p> |
|||
</div> |
|||
</div> |
|||
<!-- 搜索图 --> |
|||
<img src="@/assets/images/guide/search.svg" class="search-btn" alt="" @click="router.push('/brand')" /> |
|||
<!-- 手势图 --> |
|||
<img |
|||
class="tip" |
|||
:src=" |
|||
language === 'zh' |
|||
? require('@/assets/images/nav/tip_zh.svg') |
|||
: language === 'tw' |
|||
? require('@/assets/images/nav/tip_tw.svg') |
|||
: require('@/assets/images/nav/tip_en.svg') |
|||
" |
|||
alt="" |
|||
/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
// import { useGuideMapOperation } from '@/composables/useGuideMapOperation' |
|||
// import { useFacilityNav } from '@/composables/useFacilityNav' |
|||
// import { useGuideFilterShop } from '@/composables/useGuideFilterShop' |
|||
import guideFloors from '@/components/GuideFloors/GuideFloors.vue' |
|||
import type { Item } from '@/views/Guide/list' |
|||
import { hideMapDialog } from '@/composables/useInitMap' |
|||
import shopItem from '@/components/ShopItem/ShopItem.vue' |
|||
import scrollView from '@/base/ScrollView/ScrollView.vue' |
|||
|
|||
import { storeToRefs } from 'pinia' |
|||
import { useRootStore } from '@/store/root' |
|||
const store = useRootStore() |
|||
const { language, facilityList, mapStatus, device } = storeToRefs(store) |
|||
|
|||
import { useGuideMapOperation } from '@/composables/useGuideMapOperation' |
|||
import { useFacilityNav } from '@/composables/useFacilityNav' |
|||
import { useGuideFilterShop } from '@/composables/useGuideFilterShop' |
|||
import { ref, onMounted, watch } from 'vue' |
|||
import { useRouter } from 'vue-router' |
|||
|
|||
const router = useRouter() |
|||
|
|||
const { floorIdx, selectedShopList, filterShopByFloorName, filterAboutCurrentInfo } = useGuideFilterShop() //筛选楼层 |
|||
const { switchFloor, handleMapIcon, list, mapIdx } = useGuideMapOperation() //复位 位置等操作 |
|||
const { handleFacility } = useFacilityNav() //公共设施导航 |
|||
|
|||
const selectFloor = ref<Floor>() |
|||
|
|||
// 点击楼层按钮事件 |
|||
function clickFloor(floorItem: Floor) { |
|||
store.shop.houseNumber && store.shop.formatColor && window.Map_QM.changeMapIPState(store.shop.houseNumber, store.shop.formatColor) |
|||
selectFloor.value = floorItem |
|||
mapIdx.value = -1 |
|||
filterShopByFloorName(floorItem.floor) |
|||
switchFloor(floorItem.floorOrder) |
|||
} |
|||
//点击公共设施 |
|||
function clickFac(item: Facility) { |
|||
store.shop.houseNumber && store.shop.formatColor && window.Map_QM.changeMapIPState(store.shop.houseNumber, store.shop.formatColor) |
|||
handleFacility(item) |
|||
} |
|||
|
|||
//点击控制地图 |
|||
const guideFloorsRef = ref() |
|||
function clickMapItem(item: Item, index: number) { |
|||
store.shop.houseNumber && store.shop.formatColor && window.Map_QM.changeMapIPState(store.shop.houseNumber, store.shop.formatColor) |
|||
if (index === 2) { |
|||
// clickFloor(selectFloor.value) //复位 |
|||
if (selectFloor.value) { |
|||
guideFloorsRef.value.goSelectFloor(selectFloor.value) |
|||
} else { |
|||
guideFloorsRef.value.goCurrentFloor() |
|||
} |
|||
} else { |
|||
guideFloorsRef.value.goCurrentFloor() |
|||
} |
|||
handleMapIcon(item, index) |
|||
} |
|||
//点击店铺 |
|||
function handleShop(item: Shop) { |
|||
hideMapDialog() |
|||
store.shop.houseNumber && store.shop.formatColor && window.Map_QM.changeMapIPState(store.shop.houseNumber, store.shop.formatColor) |
|||
store.SET_SHOP(item) |
|||
store.SET_SHOW_DETAIL(true) |
|||
} |
|||
|
|||
// const { floorIdx, selectedShopList, filterShopByFloorName, filterAboutCurrentInfo } = useGuideFilterShop() //筛选楼层 |
|||
// const { switchFloor, handleMapIcon, list, mapIdx } = useGuideMapOperation() //复位 位置等操作 |
|||
// const { handleFacility } = useFacilityNav() //公共设施导航 |
|||
onMounted(() => { |
|||
if (mapStatus.value) { |
|||
clickFloor({ |
|||
floorCode: device.value.floorCode, |
|||
floor: device.value.floor, |
|||
floorOrder: device.value.floorOrder, |
|||
floorMapUrl: '', |
|||
floorMapCode: '' |
|||
}) |
|||
} |
|||
}) |
|||
watch(mapStatus, newValue => { |
|||
if (newValue) { |
|||
clickFloor({ |
|||
floorCode: device.value.floorCode, |
|||
floor: device.value.floor, |
|||
floorOrder: device.value.floorOrder, |
|||
floorMapUrl: '', |
|||
floorMapCode: '' |
|||
}) |
|||
} |
|||
}) |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.guide-container { |
|||
.bg { |
|||
position: absolute; |
|||
right: 0; |
|||
bottom: 0; |
|||
z-index: 1; |
|||
width: 524px; |
|||
height: 1080px; |
|||
background-repeat: no-repeat; |
|||
background-size: contain; |
|||
background-image: url('@/assets/images/guide/bg_shop.svg'); |
|||
} |
|||
.shop-container-scroll { |
|||
position: absolute; |
|||
top: 188px; |
|||
right: 4px; |
|||
bottom: 0; |
|||
z-index: 1; |
|||
overflow: hidden; |
|||
width: 496px; |
|||
height: 880px; |
|||
padding-right: 20px; |
|||
.shop-items-wrapper { |
|||
.shop-format-wrapper { |
|||
width: 496px; |
|||
.brand-list { |
|||
display: flex; |
|||
flex-wrap: wrap; |
|||
gap: 24px 16px; |
|||
margin-bottom: 48px; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.fac-list { |
|||
position: absolute; |
|||
top: 881px; |
|||
left: 590px; |
|||
z-index: 1; |
|||
display: flex; |
|||
justify-content: flex-start; |
|||
.fac-item { |
|||
width: 44px; |
|||
margin-right: 16px; |
|||
font-size: 10px; |
|||
font-family: 'font_regular'; |
|||
text-align: center; |
|||
color: #736661; |
|||
img { |
|||
width: 44px; |
|||
height: 44px; |
|||
margin-bottom: 6px; |
|||
border-radius: 14px; |
|||
} |
|||
p { |
|||
width: 100%; |
|||
padding-left: 0; |
|||
} |
|||
} |
|||
} |
|||
.map-btns-list { |
|||
position: absolute; |
|||
top: 881px; |
|||
left: 421px; |
|||
z-index: 2; |
|||
display: flex; |
|||
.map-btn { |
|||
display: inline-block; |
|||
width: 44px; |
|||
margin-right: 16px; |
|||
text-align: center; |
|||
vertical-align: top; |
|||
.img-wrapper { |
|||
position: relative; |
|||
width: 44px; |
|||
height: 44px; |
|||
margin-bottom: 6px; |
|||
background: #fff; |
|||
border: 1px solid rgb(38 36 36 / 10%); |
|||
border-radius: 12px; |
|||
img { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
left: 0; |
|||
margin: auto; |
|||
filter: initial; |
|||
} |
|||
} |
|||
p { |
|||
font-size: 10px; |
|||
font-family: 'font_regular'; |
|||
text-align: center; |
|||
white-space: nowrap; |
|||
color: #736661; |
|||
} |
|||
&:active, |
|||
&.active { |
|||
.img-wrapper { |
|||
background-color: #a6976f; |
|||
img { |
|||
filter: brightness(2.5); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.tip { |
|||
position: absolute; |
|||
top: 93px; |
|||
left: 421px; |
|||
} |
|||
.search-btn { |
|||
position: absolute; |
|||
top: 992px; |
|||
left: 38px; |
|||
z-index: 1; |
|||
} |
|||
} |
|||
</style> |
|||
|
|||