Browse Source

feat: 移除未落位店铺过滤

v1.0.1
jiannibang 3 years ago
parent
commit
d68d8a6f41
  1. 2
      src/store/root/getters.js
  2. 2
      src/views/Brand/Brand.vue
  3. 2
      src/views/Foods/Foods.vue
  4. 4
      src/views/Guide/Guide.vue
  5. 4
      src/views/Index/Index.vue

2
src/store/root/getters.js

@ -32,7 +32,7 @@ export const currentFloorShopMap = ({ currentFloor: device, shopList, mapData })
const deviceX = nodes[device.location].x const deviceX = nodes[device.location].x
const deviceY = nodes[device.location].y const deviceY = nodes[device.location].y
return shopList return shopList
.filter(shop => shop.floor === device.floor && shop.yaxis)
.filter(shop => shop.floor === device.floor)
.reduce((acc, shop) => { .reduce((acc, shop) => {
const result = {} const result = {}
try { try {

2
src/views/Brand/Brand.vue

@ -22,7 +22,7 @@ Promise.all([getBrandListByFloor()]).then(([_brandList]) => {
if (storeRefs.shop.value) shop.value = storeRefs.shop.value if (storeRefs.shop.value) shop.value = storeRefs.shop.value
const recMap = indexList.value.recommendList.reduce((acc, { shopCode }) => ({ ...acc, [shopCode]: true }), {}) const recMap = indexList.value.recommendList.reduce((acc, { shopCode }) => ({ ...acc, [shopCode]: true }), {})
const list = _brandList.data.list const list = _brandList.data.list
selectedList.value = list.map(({ name, shopList: _shopList }) => ({ name, shopList: _shopList.filter(({ shopCode, yaxis }) => recMap[shopCode] && yaxis) }))
selectedList.value = list.map(({ name, shopList: _shopList }) => ({ name, shopList: _shopList.filter(({ shopCode }) => recMap[shopCode]) }))
}) })
function handleShop(item) { function handleShop(item) {

2
src/views/Foods/Foods.vue

@ -22,7 +22,7 @@ Promise.all([getBrandListByFloor()]).then(([_brandList]) => {
if (storeRefs.shop.value) shop.value = storeRefs.shop.value if (storeRefs.shop.value) shop.value = storeRefs.shop.value
const list = _brandList.data.list.map(item => ({ const list = _brandList.data.list.map(item => ({
name: item.name, name: item.name,
shopList: item.shopList.filter(_ => _.isSpecial && _.yaxis)
shopList: item.shopList.filter(_ => _.isSpecial)
})) }))
selectedList.value = list selectedList.value = list
}) })

4
src/views/Guide/Guide.vue

@ -191,7 +191,7 @@ function changeFloor(index) {
selectedShopList.value = shopList.value.map(brand => ({ selectedShopList.value = shopList.value.map(brand => ({
...brand, ...brand,
shopList: brand.shopList shopList: brand.shopList
.filter(item => item.floor === floor.floor && item.yaxis)
.filter(item => item.floor === floor.floor)
.map(item => { .map(item => {
const meta = currentFloorShopMap.value[item.shopCode] const meta = currentFloorShopMap.value[item.shopCode]
return { ...item, ...(meta ? meta : {}) } return { ...item, ...(meta ? meta : {}) }
@ -218,7 +218,7 @@ function filterAboutCurrentInfo(needShowFloor = true) {
selectedShopList.value = shopList.value.map(brand => ({ selectedShopList.value = shopList.value.map(brand => ({
...brand, ...brand,
shopList: brand.shopList shopList: brand.shopList
.filter(item => item.floor === floor && item.yaxis)
.filter(item => item.floor === floor)
.map(item => { .map(item => {
const meta = currentFloorShopMap.value[item.shopCode] const meta = currentFloorShopMap.value[item.shopCode]
return { ...item, ...(meta ? meta : {}) } return { ...item, ...(meta ? meta : {}) }

4
src/views/Index/Index.vue

@ -159,7 +159,7 @@ const store = useStore()
const { indexList, currentFloor, buildingList, shopList, sidebarList, config, theme } = storeToRefs(store) const { indexList, currentFloor, buildingList, shopList, sidebarList, config, theme } = storeToRefs(store)
const guideDesc = ref('') const guideDesc = ref('')
const foodList = computed(() => { const foodList = computed(() => {
const arr = shopList.value.filter(({ isSpecial, yaxis }) => isSpecial && yaxis)
const arr = shopList.value.filter(({ isSpecial }) => isSpecial)
if (arr.length > 12) { if (arr.length > 12) {
while (arr.length % 4 !== 0) { while (arr.length % 4 !== 0) {
arr.push(arr[Math.floor(Math.random() * arr.length)]) arr.push(arr[Math.floor(Math.random() * arr.length)])
@ -169,7 +169,7 @@ const foodList = computed(() => {
}) })
const hotRecommend = computed(() => indexList?.value?.hotSearch?.slice(0, 5) ?? []) const hotRecommend = computed(() => indexList?.value?.hotSearch?.slice(0, 5) ?? [])
const recommendShops = computed(() => { const recommendShops = computed(() => {
const arr = indexList?.value?.recommendList.filter(({ yaxis }) => !!yaxis)
const arr = indexList?.value?.recommendList
if (arr.length > 12) { if (arr.length > 12) {
while (arr.length % 4 !== 0) { while (arr.length % 4 !== 0) {
arr.push(arr[Math.floor(Math.random() * arr.length)]) arr.push(arr[Math.floor(Math.random() * arr.length)])

Loading…
Cancel
Save