|
|
@ -8,11 +8,16 @@ |
|
|
<div |
|
|
<div |
|
|
class="list" |
|
|
class="list" |
|
|
:style="{ |
|
|
:style="{ |
|
|
height: `${columnHeight}px`, |
|
|
|
|
|
width: `${(isH ? 286 : 484) * Math.ceil(columns.length / 2) * 2 + (isH ? 38 : 68)}px` |
|
|
|
|
|
|
|
|
height: `${(columnHeight / scale / 1080) * 100}vmin`, |
|
|
|
|
|
width: `${(((isH ? 286 : 484) * Math.ceil(columns.length / 2) * 2 + (isH ? 38 : 68)) / 1080) * 100}vmin` |
|
|
}" |
|
|
}" |
|
|
> |
|
|
> |
|
|
<div v-for="(col, i) of columns" :key="'col' + i" class="column" :style="{ height: `${columnHeight}px`, opacity: Math.floor(i / 2) === index ? 1 : 0.5 }"> |
|
|
|
|
|
|
|
|
<div |
|
|
|
|
|
v-for="(col, i) of columns" |
|
|
|
|
|
:key="'col' + i" |
|
|
|
|
|
class="column" |
|
|
|
|
|
:style="{ height: `${(columnHeight / scale / 1080) * 100}vmin`, opacity: Math.floor(i / 2) === index ? 1 : 0.5 }" |
|
|
|
|
|
> |
|
|
<template v-for="(data, j) of col.list"> |
|
|
<template v-for="(data, j) of col.list"> |
|
|
<div v-if="data.type === 'format'" class="format" :key="data.name"> |
|
|
<div v-if="data.type === 'format'" class="format" :key="data.name"> |
|
|
{{ data.name }} |
|
|
{{ data.name }} |
|
|
@ -71,11 +76,12 @@ import { getBrandListByFormat } from '@/http/brand/api' |
|
|
import QRCodeFromText from '@/components/QRCodeFromText/QRCodeFromText.vue' |
|
|
import QRCodeFromText from '@/components/QRCodeFromText/QRCodeFromText.vue' |
|
|
import { useMediaQuery, useWindowSize } from '@vueuse/core' |
|
|
import { useMediaQuery, useWindowSize } from '@vueuse/core' |
|
|
import { setShopInactive } from '@/composables/useInitMap' |
|
|
import { setShopInactive } from '@/composables/useInitMap' |
|
|
|
|
|
|
|
|
|
|
|
const vmin = Math.min(window.innerWidth, window.innerHeight) |
|
|
|
|
|
const scale = vmin / 1080 |
|
|
const isH = useMediaQuery('(min-aspect-ratio: 1/1)') |
|
|
const isH = useMediaQuery('(min-aspect-ratio: 1/1)') |
|
|
const { width } = useWindowSize() |
|
|
const { width } = useWindowSize() |
|
|
const timeout = 30000 |
|
|
const timeout = 30000 |
|
|
const heights = { shop: 44, format: 49, placeholder: 40 } |
|
|
|
|
|
|
|
|
const heights = { shop: 44 * scale, format: 49 * scale, placeholder: 40 * scale } |
|
|
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() |
|
|
@ -96,7 +102,7 @@ const remainingMinutes = ref(Math.ceil(timeout / 1000)) |
|
|
const setRemainingMinutes = setValue(remainingMinutes) |
|
|
const setRemainingMinutes = setValue(remainingMinutes) |
|
|
|
|
|
|
|
|
const showBullets = computed(() => scrollLefts.value.length > 1) |
|
|
const showBullets = computed(() => scrollLefts.value.length > 1) |
|
|
const columnHeight = computed(() => (isH.value ? 706 : 746)) |
|
|
|
|
|
|
|
|
const columnHeight = computed(() => (isH.value ? 706 : 746) * scale) |
|
|
|
|
|
|
|
|
Promise.all([getBrandListByFormat()]).then(([{ data: brandListByFormat }]) => { |
|
|
Promise.all([getBrandListByFormat()]).then(([{ data: brandListByFormat }]) => { |
|
|
shops.value = brandListByFormat.list.map(brand => { |
|
|
shops.value = brandListByFormat.list.map(brand => { |
|
|
@ -212,7 +218,7 @@ watch(index, (nxt, _, onCleanup) => { |
|
|
watch(scrollWidth, _scrollWidth => { |
|
|
watch(scrollWidth, _scrollWidth => { |
|
|
if (_scrollWidth > 0) { |
|
|
if (_scrollWidth > 0) { |
|
|
const list = Array.from(document.querySelectorAll('.shop')) |
|
|
const list = Array.from(document.querySelectorAll('.shop')) |
|
|
.map(el => el.getBoundingClientRect().left - (isH.value ? 1326 : 68)) |
|
|
|
|
|
|
|
|
.map(el => el.getBoundingClientRect().left - (isH.value ? 1326 : 68) * scale) |
|
|
.reduce((acc, nxt) => { |
|
|
.reduce((acc, nxt) => { |
|
|
const last = acc[acc.length - 1] |
|
|
const last = acc[acc.length - 1] |
|
|
return nxt === last ? acc : [...acc, nxt] |
|
|
return nxt === last ? acc : [...acc, nxt] |
|
|
|