Browse Source

feat: 移除shopId替换为shopCode

v1.0.1
jiannibang 3 years ago
parent
commit
f61693bf89
  1. 4
      src/components/BrandScroll/BrandScroll.vue
  2. 6
      src/components/Search/Search.vue
  3. 2
      src/components/SearchResultList/SearchResultList.vue
  4. 4
      src/http/api.js
  5. 2
      src/store/root/actions.js
  6. 2
      src/store/root/getters.js
  7. 2
      src/views/Billboard/Billboard.vue
  8. 6
      src/views/Brand/Brand.vue
  9. 2
      src/views/Foods/Foods.vue
  10. 4
      src/views/Guide/Guide.vue
  11. 10
      src/views/Index/Index.vue

4
src/components/BrandScroll/BrandScroll.vue

@ -25,8 +25,8 @@
:shop="el" :shop="el"
@click="handleShop(el)" @click="handleShop(el)"
v-for="el of item.shopList" v-for="el of item.shopList"
:isActive="shop && shop.shopId === el.shopId"
:key="el.shopId"
:isActive="shop && shop.shopCode === el.shopCode"
:key="el.shopCode"
/> />
</div> </div>
</div> </div>

6
src/components/Search/Search.vue

@ -30,7 +30,7 @@
<div class="recs" v-show="!keywords.length"> <div class="recs" v-show="!keywords.length">
<h1 class="title">大家都在找</h1> <h1 class="title">大家都在找</h1>
<div class="hot-scroll"> <div class="hot-scroll">
<div class="item" v-for="(item, i) of hotRecommend" :key="item.shopId" @click="handleShop(item)">
<div class="item" v-for="(item, i) of hotRecommend" :key="item.shopCode" @click="handleShop(item)">
<div class="text">{{ item.shopName }}</div> <div class="text">{{ item.shopName }}</div>
<img class="medal" v-if="i === 0" src="@/views/Index/fir.svg" /> <img class="medal" v-if="i === 0" src="@/views/Index/fir.svg" />
<img class="medal" v-if="i === 1" src="@/views/Index/sec.svg" /> <img class="medal" v-if="i === 1" src="@/views/Index/sec.svg" />
@ -92,8 +92,8 @@ const list = computed(() =>
const hotRecommend = computed(() => indexList.value.hotSearch ?? []) const hotRecommend = computed(() => indexList.value.hotSearch ?? [])
async function handleShop(item) { async function handleShop(item) {
useStatistics('brandSearch', { shopId: item.shopId })
const shop = shopList.value.find(_shop => _shop.shopId === item.shopId)
useStatistics('brandSearch', { shopCode: item.shopCode })
const shop = shopList.value.find(_shop => _shop.shopCode === item.shopCode)
store.SET_SHOP(shop) store.SET_SHOP(shop)
if (router.currentRoute.value.fullPath !== '/guide') { if (router.currentRoute.value.fullPath !== '/guide') {
store.SET_SELECTED_MODULE('Guide') store.SET_SELECTED_MODULE('Guide')

2
src/components/SearchResultList/SearchResultList.vue

@ -5,7 +5,7 @@
搜索结果 <span class="meta">/ {{ list.length }}</span> 搜索结果 <span class="meta">/ {{ list.length }}</span>
</h1> </h1>
<TransitionGroup name="zoom" tag="div" class="list"> <TransitionGroup name="zoom" tag="div" class="list">
<SearchResultItem :config="config" @click="handleShop" :shop="item" v-for="item of list" :key="item.shopId" />
<SearchResultItem :config="config" @click="handleShop" :shop="item" v-for="item of list" :key="item.shopCode" />
</TransitionGroup> </TransitionGroup>
</div> </div>
</ScrollView> </ScrollView>

4
src/http/api.js

@ -23,10 +23,10 @@ export const getServeList = () => get(`${url().sourceUrl}/JSON/getServeList.json
export const getTrafficList = () => get(`${url().sourceUrl}/JSON/getMallTraffic.json`) export const getTrafficList = () => get(`${url().sourceUrl}/JSON/getMallTraffic.json`)
//获取品牌喜欢数量 //获取品牌喜欢数量
export const getBrandLikesNumber = shopId => get(`${url().interfaceUrl}/guide/v1/web/getBrandStar?shopId=${shopId}`)
export const getBrandLikesNumber = shopCode => get(`${url().interfaceUrl}/guide/v1/web/getBrandStar?shopCode=${shopCode}`)
//设置品牌喜欢数量 //设置品牌喜欢数量
export const setBrandLikesNumber = shopId => get(`${url().interfaceUrl}/guide/v1/web/setBrandStar?shopId=${shopId}`)
export const setBrandLikesNumber = shopCode => get(`${url().interfaceUrl}/guide/v1/web/setBrandStar?shopCode=${shopCode}`)
//获取 影院信息 //获取 影院信息
export const getCinemaInfo = () => get(`${url().sourceUrl}/JSON/getCinemaInfo.json`) export const getCinemaInfo = () => get(`${url().sourceUrl}/JSON/getCinemaInfo.json`)

2
src/store/root/actions.js

@ -28,7 +28,7 @@ export const actions = {
}, },
SET_SHOP(shop) { SET_SHOP(shop) {
this.shop = shop this.shop = shop
if (shop) useStatistics('shop', { shopId: shop.shopId })
if (shop) useStatistics('shop', { shopCode: shop.shopCode })
}, },
SET_CURRENT_FLOOR(currentFloor) { SET_CURRENT_FLOOR(currentFloor) {
this.currentFloor = currentFloor this.currentFloor = currentFloor

2
src/store/root/getters.js

@ -47,6 +47,6 @@ export const currentFloorShopMap = ({ currentFloor: device, shopList, mapData })
} catch (error) { } catch (error) {
result.dir = arrows[getCodeByAngle(0)] result.dir = arrows[getCodeByAngle(0)]
} }
return { ...acc, [shop.shopId]: result }
return { ...acc, [shop.shopCode]: result }
}, {}) }, {})
} }

2
src/views/Billboard/Billboard.vue

@ -97,7 +97,7 @@ Promise.all([getBrandListByFormat()]).then(([{ data: brandListByFormat }]) => {
shopList: brand.shopList shopList: brand.shopList
.filter(shop => shop.floor === currentFloor.value.floor) .filter(shop => shop.floor === currentFloor.value.floor)
.map(shop => { .map(shop => {
const meta = currentFloorShopMap.value[shop.shopId]
const meta = currentFloorShopMap.value[shop.shopCode]
return { ...shop, ...(meta ? meta : {}) } return { ...shop, ...(meta ? meta : {}) }
}) })
} }

6
src/views/Brand/Brand.vue

@ -20,13 +20,13 @@ const selectedList = ref([])
Promise.all([getBrandListByFloor()]).then(([_brandList]) => { 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, { shopId }) => ({ ...acc, [shopId]: 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(({ shopId }) => recMap[shopId]) }))
selectedList.value = list.map(({ name, shopList: _shopList }) => ({ name, shopList: _shopList.filter(({ shopCode }) => recMap[shopCode]) }))
}) })
function handleShop(item) { function handleShop(item) {
shop.value = shopList.value.find(_shop => _shop.shopId === item.shopId)
shop.value = shopList.value.find(_shop => _shop.shopCode === item.shopCode)
} }
</script> </script>

2
src/views/Foods/Foods.vue

@ -28,7 +28,7 @@ Promise.all([getBrandListByFloor()]).then(([_brandList]) => {
}) })
function handleShop(item) { function handleShop(item) {
shop.value = shopList.value.find(_shop => _shop.shopId === item.shopId)
shop.value = shopList.value.find(_shop => _shop.shopCode === item.shopCode)
} }
</script> </script>

4
src/views/Guide/Guide.vue

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

10
src/views/Index/Index.vue

@ -5,7 +5,7 @@
<div class="hot-search"> <div class="hot-search">
<h1 class="title">{{ $t('hotSearch') }}</h1> <h1 class="title">{{ $t('hotSearch') }}</h1>
<div class="row"> <div class="row">
<div class="item" v-for="(item, i) of hotRecommend" :key="item.shopId" @click="handleHot(item)">
<div class="item" v-for="(item, i) of hotRecommend" :key="item.shopCode" @click="handleHot(item)">
<img class="medal" v-if="i === 0" src="./fir.svg" /> <img class="medal" v-if="i === 0" src="./fir.svg" />
<img class="medal" v-if="i === 1" src="./sec.svg" /> <img class="medal" v-if="i === 1" src="./sec.svg" />
<img class="medal" v-if="i === 2" src="./thi.svg" /> <img class="medal" v-if="i === 2" src="./thi.svg" />
@ -65,7 +65,7 @@
> >
<SwiperSlide class="brandSlide" v-for="(list, i) of foodList" :key="i"> <SwiperSlide class="brandSlide" v-for="(list, i) of foodList" :key="i">
<div class="grid"> <div class="grid">
<img class="item" v-for="shop of list" :key="shop.shopId" :src="config.sourceUrl + shop.logoUrl" alt="" @click="handleFood(shop.shopId)" />
<img class="item" v-for="shop of list" :key="shop.shopCode" :src="config.sourceUrl + shop.logoUrl" alt="" @click="handleFood(shop.shopCode)" />
</div> </div>
</SwiperSlide> </SwiperSlide>
</Swiper> </Swiper>
@ -102,7 +102,7 @@
> >
<SwiperSlide class="brandSlide" v-for="(list, i) of recommendShops" :key="i"> <SwiperSlide class="brandSlide" v-for="(list, i) of recommendShops" :key="i">
<div class="grid"> <div class="grid">
<img class="item" v-for="shop of list" :key="shop.shopId" :src="config.sourceUrl + shop.logoUrl" alt="" @click="handleRecBrand(shop.shopId)" />
<img class="item" v-for="shop of list" :key="shop.shopCode" :src="config.sourceUrl + shop.logoUrl" alt="" @click="handleRecBrand(shop.shopCode)" />
</div> </div>
</SwiperSlide> </SwiperSlide>
</Swiper> </Swiper>
@ -194,12 +194,12 @@ const goPage = item => {
} }
const setShopById = id => { const setShopById = id => {
const shop = shopList.value.find(_shop => _shop.shopId === id)
const shop = shopList.value.find(_shop => _shop.shopCode === id)
store.SET_SHOP(shop) store.SET_SHOP(shop)
} }
function handleHot(item) { function handleHot(item) {
const shop = shopList.value.find(_shop => _shop.shopId === item.shopId)
const shop = shopList.value.find(_shop => _shop.shopCode === item.shopCode)
store.SET_SHOP(shop) store.SET_SHOP(shop)
goPage({ title: 'Guide', path: '/guide' }) goPage({ title: 'Guide', path: '/guide' })
} }

Loading…
Cancel
Save