Browse Source

feat: 调整楼层切换时序

v1.0.1
jiannibang 3 years ago
parent
commit
ca1f9c8604
  1. 64
      public/static/qm/MainMap_QM.js
  2. 20
      src/composables/useHandleScreen.js
  3. 2
      src/composables/useInitMap.js
  4. 7
      src/views/Billboard/Billboard.vue
  5. 30
      src/views/Guide/Guide.vue

64
public/static/qm/MainMap_QM.js

@ -2267,11 +2267,11 @@ MainMap_QM.prototype = {
* Map_QM.showFloor(1); * Map_QM.showFloor(1);
* *
*/ */
showFloor: function (fIndex = -1) {
showFloor: function (fIndex = -1, callBack = undefined) {
Map_QM.resetFloorState() Map_QM.resetFloorState()
Map_QM.clearFloor(fIndex) Map_QM.clearFloor(fIndex)
if (fIndex != -1) { if (fIndex != -1) {
Map_QM.changeFloorInner(-1, fIndex)
Map_QM.changeFloorInner(-1, fIndex, callBack)
} }
}, },
/** /**
@ -2296,7 +2296,7 @@ MainMap_QM.prototype = {
} }
} }
}, },
changeFloorInner: function (build = -1, fIndex = -1, endIndex = -1, midIndex = -1) {
changeFloorInner: function (build = -1, fIndex = -1, callBack = undefined, endIndex = -1, midIndex = -1) {
let addFloor = fIndex - Map_QM.util.deviceObj.floor > 0 ? 1 : -1 let addFloor = fIndex - Map_QM.util.deviceObj.floor > 0 ? 1 : -1
fIndex = fIndex != -1 ? fIndex : Map_QM.util.deviceObj.floor fIndex = fIndex != -1 ? fIndex : Map_QM.util.deviceObj.floor
build = build != -1 ? build : Map_QM.util.deviceObj.build build = build != -1 ? build : Map_QM.util.deviceObj.build
@ -2351,6 +2351,7 @@ MainMap_QM.prototype = {
//一层 //一层
if (build == Map_QM.util.selectBuild && fIndex == Map_QM.util.selectFloor) { if (build == Map_QM.util.selectBuild && fIndex == Map_QM.util.selectFloor) {
Map_QM.timeOutInit() Map_QM.timeOutInit()
if (callBack) callBack()
} else { } else {
Map_QM.util.selectBuild = build Map_QM.util.selectBuild = build
Map_QM.util.selectFloor = fIndex Map_QM.util.selectFloor = fIndex
@ -2363,6 +2364,7 @@ MainMap_QM.prototype = {
ease: Cubic.easeIn, ease: Cubic.easeIn,
onComplete: function () { onComplete: function () {
Map_QM.timeOutInit() Map_QM.timeOutInit()
if (callBack) callBack()
} }
} }
) )
@ -2379,6 +2381,7 @@ MainMap_QM.prototype = {
} }
} else { } else {
if (build == Map_QM.util.selectBuild && fIndex == Map_QM.util.selectFloor) { if (build == Map_QM.util.selectBuild && fIndex == Map_QM.util.selectFloor) {
if (callBack) callBack()
Map_QM.timeOutInit() Map_QM.timeOutInit()
} else { } else {
Map_QM.util.selectBuild = build Map_QM.util.selectBuild = build
@ -2392,6 +2395,7 @@ MainMap_QM.prototype = {
ease: Cubic.easeIn, ease: Cubic.easeIn,
onComplete: function () { onComplete: function () {
Map_QM.timeOutInit() Map_QM.timeOutInit()
if (callBack) callBack()
} }
} }
) )
@ -3330,14 +3334,20 @@ MainMap_QM.prototype = {
}) })
} }
}, },
//改变选中店铺box
setSelectShopMat: function (selObject) {
TweenMax.killAll(true)
if (Map_QM.selectShop) {
Map_QM.selectShop.scale.z = 1
}
Map_QM.parseSelectShop(selObject)
},
/**
* @api {方法} setSelectShopMatByName(shopNum) 设置box 选中
* @apiGroup 地图交互
* @apiDescription 地图box 选中
* @apiVersion 2.0.0
* @apiParam {String} shopNum POI编号
*
* @apiSampleRequest off
*
* @apiParamExample {String} 请求示例
*
* Map_QM.setSelectShopMatByName("L101");
*
*/
setSelectShopMatByName: function (ipName) { setSelectShopMatByName: function (ipName) {
for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) { for (let i = 0; i < Map_QM.mapArr[Map_QM.util.selectBuild].length; i++) {
let shopArr = Map_QM.mapArr[Map_QM.util.selectBuild][i].shopObj.children let shopArr = Map_QM.mapArr[Map_QM.util.selectBuild][i].shopObj.children
@ -3349,6 +3359,14 @@ MainMap_QM.prototype = {
} }
} }
}, },
//改变选中店铺box
setSelectShopMat: function (selObject) {
TweenMax.killAll(true)
if (Map_QM.selectShop) {
Map_QM.selectShop.scale.z = 1
}
Map_QM.parseSelectShop(selObject)
},
/** /**
* 初始化后调用 * 初始化后调用
*/ */
@ -4385,9 +4403,9 @@ MainMap_QM.prototype = {
if (Map_QM.util.options.overlap) { if (Map_QM.util.options.overlap) {
if (Map_QM.forShopArr.length == 2) { if (Map_QM.forShopArr.length == 2) {
Map_QM.changeFloorInner(-1, Map_QM.forShopArr[0].floor, Map_QM.forShopArr[1].floor)
Map_QM.changeFloorInner(-1, Map_QM.forShopArr[0].floor, () => {}, Map_QM.forShopArr[1].floor)
} else if (Map_QM.forShopArr.length == 3) { } else if (Map_QM.forShopArr.length == 3) {
Map_QM.changeFloorInner(-1, Map_QM.forShopArr[0].floor, Map_QM.forShopArr[1].floor, Map_QM.forShopArr[2].floor)
Map_QM.changeFloorInner(-1, Map_QM.forShopArr[0].floor, () => {}, Map_QM.forShopArr[1].floor, Map_QM.forShopArr[2].floor)
} else { } else {
Map_QM.changeFloorInner(-1, Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor) Map_QM.changeFloorInner(-1, Map_QM.forShopArr[Map_QM.util._indexPathFloor].floor)
} }
@ -5063,7 +5081,7 @@ FloorMap_QM.prototype = {
if (Map_QM.util.logos) { if (Map_QM.util.logos) {
Map_QM.util.logos.map(item => { Map_QM.util.logos.map(item => {
if (item.build == sopce.buildOrder && item.floor == sopce.floorOrder) { if (item.build == sopce.buildOrder && item.floor == sopce.floorOrder) {
sopce.logoUtil.renderIcon(item, sopce, item.site)
sopce.logoUtil.renderIcon(item, sopce, item.site || 0)
} }
}) })
} }
@ -5336,7 +5354,7 @@ FloorMap_QM.prototype = {
if (mapData.shopArea[i].logoUrl && mapData.shopArea[i].isLabel == 0) { if (mapData.shopArea[i].logoUrl && mapData.shopArea[i].isLabel == 0) {
//添加logo //添加logo
this.logoUtil.renderIcon(mapData.shopArea[i], mahc, parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site) + 1)
this.logoUtil.renderIcon(mapData.shopArea[i], mahc, parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site || 0) + 1)
} else { } else {
//添加文字 //添加文字
let some = Map_QM.util.options.boxShop.some(item => { let some = Map_QM.util.options.boxShop.some(item => {
@ -5354,7 +5372,7 @@ FloorMap_QM.prototype = {
shopLabel.position.set( shopLabel.position.set(
mapData.shopArea[i].xaxis >> 0, mapData.shopArea[i].xaxis >> 0,
(-1 * mapData.shopArea[i].yaxis) >> 0, (-1 * mapData.shopArea[i].yaxis) >> 0,
parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site)
parseInt(mapData.shopArea[i].toHeight) + parseInt(mapData.shopArea[i].site || 0)
) )
shopLabel.name = mapData.shopArea[i].name shopLabel.name = mapData.shopArea[i].name
this.labelObj.add(shopLabel) this.labelObj.add(shopLabel)
@ -5399,7 +5417,7 @@ FloorMap_QM.prototype = {
if (facArr[i].downState) { if (facArr[i].downState) {
//上扶梯 //上扶梯
let ex = Map_QM.util.pathStateObj.elevator.clone() let ex = Map_QM.util.pathStateObj.elevator.clone()
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site)
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0)
ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180
ex.userData.type = 'icon' ex.userData.type = 'icon'
ex.userData.use = '3d' ex.userData.use = '3d'
@ -5416,7 +5434,7 @@ FloorMap_QM.prototype = {
} else if (facArr[i].upState) { } else if (facArr[i].upState) {
//下扶梯 //下扶梯
let ex = Map_QM.util.pathStateObj.elevatorDown.clone() let ex = Map_QM.util.pathStateObj.elevatorDown.clone()
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site)
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0)
ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180
ex.userData.type = 'icon' ex.userData.type = 'icon'
ex.userData.use = '3d' ex.userData.use = '3d'
@ -5439,7 +5457,7 @@ FloorMap_QM.prototype = {
} else if (facArr[i].facCode == 'upft') { } else if (facArr[i].facCode == 'upft') {
if (Map_QM.util.pathStateObj.elevator) { if (Map_QM.util.pathStateObj.elevator) {
let ex = Map_QM.util.pathStateObj.elevator.clone() let ex = Map_QM.util.pathStateObj.elevator.clone()
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site)
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0)
ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180
ex.userData.type = 'icon' ex.userData.type = 'icon'
ex.userData.use = '3d' ex.userData.use = '3d'
@ -5460,7 +5478,7 @@ FloorMap_QM.prototype = {
} else if (facArr[i].facCode == 'downft') { } else if (facArr[i].facCode == 'downft') {
if (Map_QM.util.pathStateObj.elevatorDown) { if (Map_QM.util.pathStateObj.elevatorDown) {
let ex = Map_QM.util.pathStateObj.elevatorDown.clone() let ex = Map_QM.util.pathStateObj.elevatorDown.clone()
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site)
ex.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0)
ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 ex.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180
ex.userData.type = 'icon' ex.userData.type = 'icon'
ex.userData.use = '3d' ex.userData.use = '3d'
@ -5481,7 +5499,7 @@ FloorMap_QM.prototype = {
} else if (facArr[i].facCode == 'dt') { } else if (facArr[i].facCode == 'dt') {
if (Map_QM.util.pathStateObj.straight) { if (Map_QM.util.pathStateObj.straight) {
let stra = Map_QM.util.pathStateObj.straight.clone() let stra = Map_QM.util.pathStateObj.straight.clone()
stra.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site)
stra.position.set(facArr[i].x, -1 * facArr[i].y, facArr[i].site || 0)
stra.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180 stra.rotation.y = ((facArr[i].angle || 0) * Math.PI) / -180
stra.userData.type = 'icon' stra.userData.type = 'icon'
stra.userData.use = '3d' stra.userData.use = '3d'
@ -5542,7 +5560,7 @@ FloorMap_QM.prototype = {
this.allObj.add(gp) this.allObj.add(gp)
gp.position.x = mapData.groupArea[k].xaxis gp.position.x = mapData.groupArea[k].xaxis
gp.position.y = -1 * mapData.groupArea[k].yaxis gp.position.y = -1 * mapData.groupArea[k].yaxis
gp.position.z = mapData.groupArea[k].site
gp.position.z = mapData.groupArea[k].site || 0
gp.scale.set(mapData.groupArea[k].scale, mapData.groupArea[k].scale, mapData.groupArea[k].scale) gp.scale.set(mapData.groupArea[k].scale, mapData.groupArea[k].scale, mapData.groupArea[k].scale)
} }
} }
@ -6003,7 +6021,7 @@ MyModel_QM.prototype.MyModelText = function (svgArea) {
group.position.x = parseInt(svgArea.xaxis) group.position.x = parseInt(svgArea.xaxis)
group.position.y = -1 * parseInt(svgArea.yaxis) group.position.y = -1 * parseInt(svgArea.yaxis)
group.position.z = parseInt(svgArea.site)
group.position.z = parseInt(svgArea.site || 0)
group.rotateX((parseInt(svgArea.angleZ) * Math.PI) / 180) group.rotateX((parseInt(svgArea.angleZ) * Math.PI) / 180)
group.rotateY((parseInt(svgArea.angleY) * Math.PI) / 180) group.rotateY((parseInt(svgArea.angleY) * Math.PI) / 180)
group.rotateZ((parseInt(svgArea.angle) * Math.PI) / 180) group.rotateZ((parseInt(svgArea.angle) * Math.PI) / 180)

20
src/composables/useHandleScreen.js

@ -25,7 +25,11 @@ export const useHandleScreen = callback => {
//socket发送消息 //socket发送消息
function send(msg) { function send(msg) {
state?.messageWS?.send(msg)
try {
state?.messageWS?.send(msg)
} catch (error) {
console.log(error)
}
} }
//获取返回时长 //获取返回时长
@ -99,13 +103,17 @@ export const useHandleScreen = callback => {
//初始化与容器通信的websocket //初始化与容器通信的websocket
function initWebSocket() { function initWebSocket() {
state.messageWS = new WebSocket(backSocket.value)
try {
state.messageWS = new WebSocket(backSocket.value)
//连接成功
state.messageWS.onopen = setOnopenMessage
//连接成功
state.messageWS.onopen = setOnopenMessage
//收到消息的回调
state.messageWS.onmessage = setOnmessageMessage
//收到消息的回调
state.messageWS.onmessage = setOnmessageMessage
} catch (error) {
console.log(error)
}
} }
//websocket连接成功 //websocket连接成功

2
src/composables/useInitMap.js

@ -74,7 +74,7 @@ function showMapDialog() {
} }
export const showFacility = fac => { export const showFacility = fac => {
window.Map_QM.addElementLabel(document.getElementById('fac'), fac.site.x, fac.site.y, 'fac')
window.Map_QM.addElementLabel(document.getElementById('fac'), fac.site.x, -fac.site.y, 100, 'fac')
document.getElementById('fac').style.visibility = 'visible' document.getElementById('fac').style.visibility = 'visible'
} }

7
src/views/Billboard/Billboard.vue

@ -104,11 +104,10 @@ Promise.all([getBrandListByFormat()]).then(([{ data: brandListByFormat }]) => {
}) })
try { try {
window.Map_QM?.showFloor?.(currentFloor.value.floorOrder)
setShopInactive()
setTimeout(() => {
window.Map_QM?.showFloor?.(currentFloor.value.floorOrder, () => {
window.Map_QM?.changeMapState('2d') window.Map_QM?.changeMapState('2d')
}, 500)
})
setShopInactive()
} catch (error) { } catch (error) {
console.log('error:', error) console.log('error:', error)
} }

30
src/views/Guide/Guide.vue

@ -142,9 +142,9 @@ function handleMapIcon(item, index) {
mapIdx.value = index mapIdx.value = index
switch (item.name) { switch (item.name) {
case RESET: case RESET:
window.Map_QM.showFloor(currentFloor.value.floorOrder)
onClickDeviceSite() onClickDeviceSite()
filterAboutCurrentInfo() filterAboutCurrentInfo()
window.Map_QM.showFloor(currentFloor.value.floorOrder)
break break
case DIRECTION: case DIRECTION:
window.Map_QM.onShowMeDir() window.Map_QM.onShowMeDir()
@ -186,7 +186,6 @@ function changeFloor(index) {
showAll.value = false showAll.value = false
hideMapDialog() hideMapDialog()
mapIdx.value = -1 mapIdx.value = -1
window.Map_QM.showFloor(floor.floorOrder)
floorIdx.value = index floorIdx.value = index
selectedShopList.value = shopList.value.map(brand => ({ selectedShopList.value = shopList.value.map(brand => ({
...brand, ...brand,
@ -197,6 +196,9 @@ function changeFloor(index) {
return { ...item, ...(meta ? meta : {}) } return { ...item, ...(meta ? meta : {}) }
}) })
})) }))
nextTick(() => {
window.Map_QM.showFloor(floor.floorOrder)
})
resolve() resolve()
}) })
} }
@ -211,11 +213,6 @@ function filterAboutCurrentInfo(needShowFloor = true) {
const floorCode = shop.value ? shop.value.floorCode : currentFloor.value.floorCode const floorCode = shop.value ? shop.value.floorCode : currentFloor.value.floorCode
const floor = shop.value ? shop.value.floor : currentFloor.value.floor const floor = shop.value ? shop.value.floor : currentFloor.value.floor
const floorOrder = shop.value ? shop.value.floorOrder : currentFloor.value.floorOrder const floorOrder = shop.value ? shop.value.floorOrder : currentFloor.value.floorOrder
try {
needShowFloor && window.Map_QM.showFloor(floorOrder)
} catch (error) {
console.warn(error)
}
floorIdx.value = currentBuildingFloorsList.value.findIndex(item => item.floorCode === floorCode) floorIdx.value = currentBuildingFloorsList.value.findIndex(item => item.floorCode === floorCode)
selectedShopList.value = shopList.value.map(brand => ({ selectedShopList.value = shopList.value.map(brand => ({
...brand, ...brand,
@ -226,13 +223,18 @@ function filterAboutCurrentInfo(needShowFloor = true) {
return { ...item, ...(meta ? meta : {}) } return { ...item, ...(meta ? meta : {}) }
}) })
})) }))
nextTick(() => {
if (shop.value) {
setShopActive(shop.value)
} else if (facility.value) {
handleFacility(facility.value)
}
})
try {
needShowFloor &&
window.Map_QM.showFloor(floorOrder, () => {
if (shop.value) {
setShopActive(shop.value)
} else if (facility.value) {
handleFacility(facility.value)
}
})
} catch (error) {
console.warn(error)
}
} }
const initiated = computed(() => selectedShopList.value && selectedShopList.value.length) const initiated = computed(() => selectedShopList.value && selectedShopList.value.length)
onBeforeUnmount(() => { onBeforeUnmount(() => {

Loading…
Cancel
Save