Browse Source

feat: 🚀 品牌分页

pull/1/head
liyongle 3 years ago
parent
commit
8943646670
  1. 2
      public/static/offline/JSON/GetDevCoordinateByIP.json
  2. 2
      public/static/offline/JSON/GetMapInfo.json
  3. 506
      public/static/offline/JSON/getBrandShopList.json
  4. 2
      public/static/offline/JSON/getMap.json
  5. 2
      public/static/qm/MainMap_QM.js
  6. 2
      public/static/worker/page.worker.js
  7. 2
      src/components/ShopItem/ShopItem.vue
  8. 4
      src/composables/usePage.ts
  9. 2
      src/http/api/parking/index.ts
  10. 35
      src/views/Brand/Brand.vue

2
public/static/offline/JSON/GetDevCoordinateByIP.json

@ -1 +1 @@
{"code":200,"msg":"success","data":{"machineCode":"fOjdaZJ0kCfJ2WCgszOKr","machineName":"12132","machineTypeName":"信发","label":"windows","screenAttribute":"1920*1080横屏","building":"主楼","buildingCode":"h-8eWvLqbPZP5cuWHY-vA","buildingOrder":0,"floor":"L1","floorCode":"p6U4SCkoJf9Xq5gBGpa3L","floorOrder":0,"ip":"192.168.1.209","mac":"4CEDFBCAFF27","location":"0","angle":"0","projectCode":"project-n-ww5jvpwnu0ads70lbkda"}}
{"code":200,"msg":"success","data":{"machineCode":"fOjdaZJ0kCfJ2WCgszOKr","machineName":"12132","machineTypeName":"信发","label":"windows","screenAttribute":"1920*1080横屏","building":"主楼","buildingCode":"h-8eWvLqbPZP5cuWHY-vA","buildingOrder":0,"floor":"L1","floorCode":"p6U4SCkoJf9Xq5gBGpa3L","floorOrder":1,"ip":"192.168.1.209","mac":"4CEDFBCAFF27","location":"0","angle":"0","projectCode":"project-n-ww5jvpwnu0ads70lbkda"}}

2
public/static/offline/JSON/GetMapInfo.json

File diff suppressed because one or more lines are too long

506
public/static/offline/JSON/getBrandShopList.json

File diff suppressed because one or more lines are too long

2
public/static/offline/JSON/getMap.json

File diff suppressed because one or more lines are too long

2
public/static/qm/MainMap_QM.js

@ -1628,7 +1628,7 @@ MainMap_QM.prototype = {
this.initGuide();
this.controls.target.set(this.util.guiOptions.targatX, this.util.guiOptions.targatY, this.util.guiOptions.targatZ);
let pathData = this.util.allMap[parseInt(this.util.deviceObj.build)].buildArr[parseInt(this.util.deviceObj.floor)].mapData.path;
pathData.nodes.sort(this.util.sortNode);
pathData && pathData.nodes.sort(this.util.sortNode);
if (parseInt(this.util.deviceObj.node) != -1) {
if (pathData && pathData.nodes.length > parseInt(this.util.deviceObj.node)) {
this.util.deviceObj.xaxis = pathData.nodes[parseInt(this.util.deviceObj.node)].x;

2
public/static/worker/page.worker.js

@ -1,5 +1,5 @@
let pageIndex = 1 //数组中需要分页(即下标为pageIdx的数据)的当前页 大数组中的二维
const pageSize = 20 //一页显示的条数
const pageSize = 15 //一页显示的条数
let pageList = [] //用于UI渲染的列表
let showMore = false
let pageIdx = 0 //当前是数组中的哪一项需要分页 大数组中的一维

2
src/components/ShopItem/ShopItem.vue

@ -24,7 +24,7 @@
</template>
<script setup lang="ts">
defineProps<{ shop: Shop }>()
defineProps<{ shop: any }>()
</script>
<style scoped lang="scss">

4
src/composables/usePage.ts

@ -1,4 +1,4 @@
import { ref, shallowRef, watch, toRaw, nextTick, onBeforeUnmount, type ShallowRef } from 'vue'
import { Ref, ref, shallowRef, watch, toRaw, nextTick, onBeforeUnmount, type ShallowRef } from 'vue'
/**
* @param {array} totalList
@ -6,7 +6,7 @@ import { ref, shallowRef, watch, toRaw, nextTick, onBeforeUnmount, type ShallowR
* @return {*} { scrollEnd, pageList, loaded }
*/
type PageList = { name: string; shopList: Shop[] }
export const usePage = (totalList: PageList[], scroll: ShallowRef<any>) => {
export const usePage = (totalList: Ref<PageList[]>, scroll: ShallowRef<any>) => {
if (typeof Worker === 'undefined') {
alert('抱歉,当前运行环境不支持Web Worker API, 请升级浏览器版本')
}

2
src/http/api/parking/index.ts

@ -1,6 +1,6 @@
import { request } from '../../http'
// 找车
export const getFindCar = (plateId: string) => request<CarInfo>({ url: `/v1/web/thirdPark`, data: { plateId }, method: 'post' })
export const getFindCar = (plateId: string) => request<CarInfo>({ url: `/v1/web/thirdPark`, params: { plateId }, method: 'get' })
// 周边交通
export const getThirdTraffic = (projectCode: string) =>

35
src/views/Brand/Brand.vue

@ -31,9 +31,17 @@
</li>
</ul>
<!-- 店铺 -->
<scroll-view ref="shopScroll" :scrollbar="true" class="shop-scroll" :list="copyShopList" :pull-up="false">
<scroll-view
ref="shopScroll"
:scrollbar="true"
class="shop-scroll"
:list="pageList[0]?.shopList"
pull-up
:scroll-top="false"
@scroll-end="myScrollEnd"
>
<ul class="shop-group">
<shopItem v-for="shop in copyShopList" :key="shop.shopCode" :shop="shop" @click="clickShop(shop)" />
<shopItem v-for="shop in pageList[0]?.shopList" :key="shop.shopCode" :shop="shop" @click="clickShop(shop)" />
</ul>
</scroll-view>
</div>
@ -45,6 +53,7 @@ import typeBtnGroup from '@/components/TypeBtnList/TypeBtnList.vue'
import scrollView from '@/base/ScrollView/ScrollView.vue'
import { getBrandInfo } from '@/http/api/brand/index'
import { ref, computed, shallowRef } from 'vue'
import { usePage } from '@/composables/usePage'
import { storeToRefs } from 'pinia'
import { useRootStore } from '@/store/root'
@ -69,11 +78,12 @@ const formatZMList = computed(() => {
const formatList = ref<Industry[]>([])
const zmList = ref<Industry[]>([])
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
const floorIdx = ref(-1)
const floorList = ref<FloorItem[]>([])
const copyShopList = shallowRef<Shop[]>([])
const copyShopList = shallowRef<any>([])
const myscroll = shallowRef(null)
const { scrollEnd, pageList } = usePage(copyShopList, myscroll)
const typeBtnList = [
{
@ -149,10 +159,10 @@ function handleClickFloor(item: FloorItem, index: number) {
resetIdx()
floorIdx.value = index
if (index === 0) {
copyShopList.value = [...shopList.value]
copyShopList.value = [{ name: '1', shopList: [...shopList.value] }]
return
}
copyShopList.value = shopList.value.filter(shop => shop.floor === item.floor)
copyShopList.value = [{ name: '1', shopList: shopList.value.filter(shop => shop.floor === item.floor) }]
}
//
function handleClickFormat(item: Industry, index: number) {
@ -163,17 +173,22 @@ function handleClickFormat(item: Industry, index: number) {
return
}
if (currentTypeId.value === 0) {
copyShopList.value = shopList.value.filter(shop => shop.industryFatherCode === item.industryCode)
copyShopList.value = [{ name: '1', shopList: shopList.value.filter(shop => shop.industryFatherCode === item.industryCode) }]
useStatistics({ tag: 'industry', industryCode: item.industryCode })
} else {
copyShopList.value = shopList.value.filter(shop => shop.initials?.charAt(0) === item.industryName)
copyShopList.value = [{ name: '1', shopList: shopList.value.filter(shop => shop.initials?.charAt(0) === item.industryName) }]
}
}
//
function clickShop(item: Shop) {
function clickShop(item: any) {
store.SET_SHOP(item)
store.SET_SHOW_DETAIL(true)
}
//
function myScrollEnd() {
scrollEnd()
}
</script>
<style scoped lang="scss">
@ -240,7 +255,7 @@ function clickShop(item: Shop) {
position: absolute;
top: 319px;
left: 124px;
width: 144px;
width: 80px;
font-size: 24px;
font-family: 'font_bold';
text-align: center;

Loading…
Cancel
Save