|
|
@ -29,7 +29,7 @@ |
|
|
{{ data.shopName }} |
|
|
{{ data.shopName }} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="right"></div> |
|
|
|
|
|
|
|
|
<div class="right">{{ data.distance ? data.distance + '米' : '' }}</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div v-else class="placeholder" :key="'placeholder' + i + '_' + j"></div> |
|
|
<div v-else class="placeholder" :key="'placeholder' + i + '_' + j"></div> |
|
|
@ -53,13 +53,34 @@ import { storeToRefs } from 'pinia' |
|
|
import { useStore } from '@/store/root' |
|
|
import { useStore } from '@/store/root' |
|
|
import { useRouter } from 'vue-router' |
|
|
import { useRouter } from 'vue-router' |
|
|
import { getBrandListByFormat } from '@/http/brand/api' |
|
|
import { getBrandListByFormat } from '@/http/brand/api' |
|
|
|
|
|
import { getMap } from '@/http/api' |
|
|
|
|
|
import arrows from './arrows/arrows' |
|
|
|
|
|
|
|
|
|
|
|
const getCodeByAngle = angle => |
|
|
|
|
|
angle < (Math.PI / 8) * 1 || angle > (Math.PI / 8) * 15 |
|
|
|
|
|
? '8003' |
|
|
|
|
|
: angle >= (Math.PI / 8) * 1 && angle < (Math.PI / 8) * 3 |
|
|
|
|
|
? '8002' |
|
|
|
|
|
: angle >= (Math.PI / 8) * 3 && angle < (Math.PI / 8) * 5 |
|
|
|
|
|
? '8001' |
|
|
|
|
|
: angle >= (Math.PI / 8) * 5 && angle < (Math.PI / 8) * 7 |
|
|
|
|
|
? '8008' |
|
|
|
|
|
: angle >= (Math.PI / 8) * 7 && angle < (Math.PI / 8) * 9 |
|
|
|
|
|
? '8007' |
|
|
|
|
|
: angle >= (Math.PI / 8) * 9 && angle < (Math.PI / 8) * 11 |
|
|
|
|
|
? '8006' |
|
|
|
|
|
: angle >= (Math.PI / 8) * 11 && angle < (Math.PI / 8) * 13 |
|
|
|
|
|
? '8005' |
|
|
|
|
|
: '8004' |
|
|
|
|
|
|
|
|
|
|
|
const getDistance = (a, b) => Math.sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y)) |
|
|
|
|
|
|
|
|
const timeout = 30000 |
|
|
const timeout = 30000 |
|
|
const heights = { shop: 44, format: 49, placeholder: 40 } |
|
|
const heights = { shop: 44, format: 49, placeholder: 40 } |
|
|
const setValue = refInstance => value => Object.assign(refInstance, { value }) |
|
|
const setValue = refInstance => value => Object.assign(refInstance, { value }) |
|
|
const store = useStore() |
|
|
const store = useStore() |
|
|
const router = useRouter() |
|
|
const router = useRouter() |
|
|
const shopListByFormat = ref([]) |
|
|
|
|
|
|
|
|
const shops = ref([]) |
|
|
const listRef = ref(null) |
|
|
const listRef = ref(null) |
|
|
const { currentFloor, buildingList } = storeToRefs(store) |
|
|
const { currentFloor, buildingList } = storeToRefs(store) |
|
|
const bf = computed(() => (buildingList.length > 1 ? currentFloor.value.building + '-' : '') + currentFloor.value.floor) |
|
|
const bf = computed(() => (buildingList.length > 1 ? currentFloor.value.building + '-' : '') + currentFloor.value.floor) |
|
|
@ -78,15 +99,52 @@ const setRemainingMinutes = setValue(remainingMinutes) |
|
|
const showBullets = computed(() => scrollLefts.value.length > 1) |
|
|
const showBullets = computed(() => scrollLefts.value.length > 1) |
|
|
const columnHeight = 746 |
|
|
const columnHeight = 746 |
|
|
|
|
|
|
|
|
const shops = computed(() => |
|
|
|
|
|
shopListByFormat.value.map(brand => ({ |
|
|
|
|
|
|
|
|
Promise.all([getMap(), getBrandListByFormat()]).then( |
|
|
|
|
|
([ |
|
|
|
|
|
{ |
|
|
|
|
|
data: { mapData } |
|
|
|
|
|
}, |
|
|
|
|
|
{ data: brandListByFormat } |
|
|
|
|
|
]) => { |
|
|
|
|
|
console.log(currentFloor.value) |
|
|
|
|
|
const device = currentFloor.value |
|
|
|
|
|
device.angle = Number(device.angle) |
|
|
|
|
|
if (isNaN(device.angle)) device.angle = 0 |
|
|
|
|
|
const building = JSON.parse(mapData)[0] |
|
|
|
|
|
const map = building.buildArr[device.floorOrder].mapData |
|
|
|
|
|
const nodes = map.path.nodes |
|
|
|
|
|
|
|
|
|
|
|
const deviceX = nodes[device.location].x |
|
|
|
|
|
const deviceY = nodes[device.location].y |
|
|
|
|
|
shops.value = brandListByFormat.list.map(brand => { |
|
|
|
|
|
const shopList = brand.shopList.filter(shop => shop.floor === currentFloor.value.floor) |
|
|
|
|
|
console.log(shopList) |
|
|
|
|
|
shopList.forEach(shop => { |
|
|
|
|
|
shop.xaxis = JSON.parse(shop.xaxis) |
|
|
|
|
|
try { |
|
|
|
|
|
shop.xaxis = shop.xaxis.map(Number) |
|
|
|
|
|
let angle = (Math.atan2(deviceY - shop.xaxis[2], shop.xaxis[0] - deviceX) / Math.PI) * 180 - device.angle |
|
|
|
|
|
if (angle < 0) angle += 360 |
|
|
|
|
|
if (angle > 360) angle -= 360 |
|
|
|
|
|
angle = (angle / 180) * Math.PI |
|
|
|
|
|
shop.dir = arrows[getCodeByAngle(angle)] |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
shop.dir = arrows[getCodeByAngle(0)] |
|
|
|
|
|
console.warn(error) |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
shop.distance = Math.ceil(getDistance({ x: deviceX, y: deviceY }, { x: shop.xaxis[0], y: shop.xaxis[2] }) / building.scale) |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.warn(error) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
return { |
|
|
...brand, |
|
|
...brand, |
|
|
shopList: brand.shopList.filter(shop => shop.floor === currentFloor.value.floor) |
|
|
|
|
|
})) |
|
|
|
|
|
|
|
|
shopList |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
) |
|
|
) |
|
|
getBrandListByFormat().then(({ data }) => { |
|
|
|
|
|
shopListByFormat.value = data.list |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
window.Map_QM?.showFloor?.(currentFloor.value.floorOrder) |
|
|
window.Map_QM?.showFloor?.(currentFloor.value.floorOrder) |
|
|
@ -327,11 +385,12 @@ watch(scrollLefts, _scrollLefts => { |
|
|
} |
|
|
} |
|
|
.right { |
|
|
.right { |
|
|
display: inline-flex; |
|
|
display: inline-flex; |
|
|
flex: 0 0 50px; |
|
|
|
|
|
|
|
|
flex: 0 0 100 px; |
|
|
font-weight: 500; |
|
|
font-weight: 500; |
|
|
font-size: 16px; |
|
|
font-size: 16px; |
|
|
line-height: 19px; |
|
|
line-height: 19px; |
|
|
text-align: right; |
|
|
|
|
|
|
|
|
justify-content: flex-end; |
|
|
|
|
|
padding-right: 16px; |
|
|
color: rgba(0, 0, 0, 0.6); |
|
|
color: rgba(0, 0, 0, 0.6); |
|
|
} |
|
|
} |
|
|
.dir { |
|
|
.dir { |
|
|
|