|
@@ -390,7 +390,7 @@ movable-view {
|
|
|
</block>
|
|
|
<div
|
|
|
class="selected-icon"
|
|
|
- v-if="selectArea"
|
|
|
+ v-if="selectArea && selectArea.floorId==selectedFloor"
|
|
|
mode="scaleToFill"
|
|
|
:style="{top:(selectArea.top*mapScale-38)+'px',width:(selectArea.selectIconWidth)+'px',left:(selectArea.left*mapScale+(selectArea.width*mapScale/2)-selectArea.selectIconWidth/2)+'px',background:(selectArea.circleColor), transform: 'rotate('+(selectArea.rotate)+'deg)'}"
|
|
|
>
|
|
@@ -453,7 +453,7 @@ import store from '@/store';
|
|
|
|
|
|
import {
|
|
|
getSpaceBytoothHttp,
|
|
|
- getMapDetailHttp
|
|
|
+ getMapDetailHttp,
|
|
|
} from '@/packagesEnv/api/intelligentControl';
|
|
|
import { checkHasUserInfo } from '@/service/user';
|
|
|
import utils from '@/common/utils';
|
|
@@ -465,7 +465,7 @@ import { getCompanyMapData } from '@/api/home';
|
|
|
import {
|
|
|
getBuildingList,
|
|
|
getFloorList,
|
|
|
- getMapInfo
|
|
|
+ getMapInfo,
|
|
|
} from '@/packagesEnv/api/mapApi.js';
|
|
|
|
|
|
let h5StaticPath = config.h5StaticPath;
|
|
@@ -488,12 +488,12 @@ let pageSelectedAreaRecord = {
|
|
|
let touchMapStartRecord = {
|
|
|
timeStamp: 0,
|
|
|
pageX: 0,
|
|
|
- pageY: 0
|
|
|
+ pageY: 0,
|
|
|
};
|
|
|
let touchMapEndRecord = {
|
|
|
timeStamp: 0,
|
|
|
pageX: 0,
|
|
|
- pageY: 0
|
|
|
+ pageY: 0,
|
|
|
};
|
|
|
let from = 'officehome';
|
|
|
|
|
@@ -504,8 +504,8 @@ wepy.component({
|
|
|
props: {
|
|
|
space: {
|
|
|
type: Object,
|
|
|
- default: {}
|
|
|
- }
|
|
|
+ default: {},
|
|
|
+ },
|
|
|
},
|
|
|
store,
|
|
|
data: {
|
|
@@ -536,12 +536,12 @@ wepy.component({
|
|
|
companyId: '',
|
|
|
buildingData: [],
|
|
|
buildingItem: {},
|
|
|
- floorItem: {}
|
|
|
+ floorItem: {},
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
- userInfo: state => state.user.userInfo
|
|
|
- })
|
|
|
+ userInfo: (state) => state.user.userInfo,
|
|
|
+ }),
|
|
|
},
|
|
|
ready() {
|
|
|
// 获取地图数据
|
|
@@ -562,7 +562,7 @@ wepy.component({
|
|
|
this.init();
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
// 收起
|
|
@@ -585,7 +585,7 @@ wepy.component({
|
|
|
},
|
|
|
//设置建筑名称
|
|
|
setBuidingItem() {
|
|
|
- this.buildingData.map(item => {
|
|
|
+ this.buildingData.map((item) => {
|
|
|
if (item.id == this.space.buildingId) {
|
|
|
this.selectedBuilding = item.id;
|
|
|
this.buildingItem = item;
|
|
@@ -596,10 +596,10 @@ wepy.component({
|
|
|
getPageBuildingList() {
|
|
|
let params = {
|
|
|
criteria: {
|
|
|
- projectId: this.projectId
|
|
|
- }
|
|
|
+ projectId: this.projectId,
|
|
|
+ },
|
|
|
};
|
|
|
- getBuildingList(params).then(res => {
|
|
|
+ getBuildingList(params).then((res) => {
|
|
|
this.buildingData = res.content || [];
|
|
|
this.setBuidingItem();
|
|
|
if (this.selectedBuilding) {
|
|
@@ -609,7 +609,7 @@ wepy.component({
|
|
|
},
|
|
|
// 设置楼层
|
|
|
setFlorrItem() {
|
|
|
- this.floors.map(item => {
|
|
|
+ this.floors.map((item) => {
|
|
|
if (item.id == this.space.floorId) {
|
|
|
this.selectedFloor = item.id;
|
|
|
this.floorItem = item;
|
|
@@ -623,10 +623,10 @@ wepy.component({
|
|
|
let params = {
|
|
|
criteria: {
|
|
|
projectId: this.projectId,
|
|
|
- buildingId: this.selectedBuilding
|
|
|
- }
|
|
|
+ buildingId: this.selectedBuilding,
|
|
|
+ },
|
|
|
};
|
|
|
- getFloorList(params).then(res => {
|
|
|
+ getFloorList(params).then((res) => {
|
|
|
this.floors = res.content || [];
|
|
|
this.setFlorrItem();
|
|
|
// console.log('this.selectedFloor==', this.selectedFloor);
|
|
@@ -638,26 +638,31 @@ wepy.component({
|
|
|
/**
|
|
|
* 获取地图信息
|
|
|
*/
|
|
|
- getPageMapInfo() {
|
|
|
+ getPageMapInfo(type) {
|
|
|
let params = {
|
|
|
projectId: this.projectId,
|
|
|
floorId: this.selectedFloor,
|
|
|
userCode: this.userInfo.userId,
|
|
|
- companyId: this.userInfo.companyId
|
|
|
+ companyId: this.userInfo.companyId,
|
|
|
};
|
|
|
getMapInfo(params)
|
|
|
- .then(res => {
|
|
|
+ .then((res) => {
|
|
|
let data = res.data || {};
|
|
|
this.mapAreasInfo = data.spaceList || [];
|
|
|
CompanyMapData.mapWidth = data.width;
|
|
|
this.setMapIcon();
|
|
|
this.getMapSize();
|
|
|
console.log('this.selectArea===', this.selectArea);
|
|
|
- if (this.selectArea) {
|
|
|
- if (this.space.from) {
|
|
|
+ if (this.selectArea && type != 1) {
|
|
|
+ if (this.space.from == 'FindIt') {
|
|
|
this.doSelectArea(this.selectArea);
|
|
|
} else {
|
|
|
- this.doSelectArea(this.selectArea, true);
|
|
|
+ console.log('type==', type);
|
|
|
+ if (type == 1) {
|
|
|
+ this.doSelectArea(this.selectArea, false);
|
|
|
+ } else {
|
|
|
+ this.doSelectArea(this.selectArea, true);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -665,7 +670,7 @@ wepy.component({
|
|
|
},
|
|
|
// 设置地图的图标
|
|
|
setMapIcon() {
|
|
|
- this.mapAreasInfo.map(item => {
|
|
|
+ this.mapAreasInfo.map((item) => {
|
|
|
if (item.spaceId == this.space.spaceId) {
|
|
|
console.log(this.selectArea);
|
|
|
this.selectArea = item;
|
|
@@ -705,7 +710,7 @@ wepy.component({
|
|
|
}
|
|
|
});
|
|
|
if (this.space.from == 'FindIt') {
|
|
|
- this.selectArea;
|
|
|
+ // this.selectArea;
|
|
|
}
|
|
|
},
|
|
|
// 切换建筑
|
|
@@ -716,18 +721,18 @@ wepy.component({
|
|
|
},
|
|
|
// 切换楼层
|
|
|
changeFloorFun(floor) {
|
|
|
- console.log('切换楼层');
|
|
|
+ console.log('切换楼层', floor);
|
|
|
this.selectedFloor = floor;
|
|
|
// this.floorItem = floor;
|
|
|
- this.getPageMapInfo();
|
|
|
+ this.getPageMapInfo(1);
|
|
|
},
|
|
|
// 获取地图的缩放比例
|
|
|
getMapSize() {
|
|
|
- getScreenInfo().then(res => {
|
|
|
+ getScreenInfo().then((res) => {
|
|
|
this.screenScale = res.screenScale;
|
|
|
});
|
|
|
|
|
|
- this.getMapScale().then(res => {
|
|
|
+ this.getMapScale().then((res) => {
|
|
|
this.mapScale = res.mapScale;
|
|
|
this.mapWidth = Math.ceil(res.mapScale * CompanyMapData.mapWidth); // 因为有小数点的误差,故增加一部分
|
|
|
this.mapHeight = res.mapHeight;
|
|
@@ -739,18 +744,18 @@ wepy.component({
|
|
|
return new Promise((resolve, reject) => {
|
|
|
wx.getStorage({
|
|
|
key: 'SelectedASpace',
|
|
|
- success: res => {
|
|
|
+ success: (res) => {
|
|
|
if (res.data && res.data.spaceId) {
|
|
|
pageSelectedAreaRecord = {
|
|
|
...CompanyMapData.defalutSelectedId,
|
|
|
- [res.data.floorId]: res.data.spaceId // 如果有历史记录选中,覆盖值
|
|
|
+ [res.data.floorId]: res.data.spaceId, // 如果有历史记录选中,覆盖值
|
|
|
};
|
|
|
resolve(res.data);
|
|
|
} else {
|
|
|
pageSelectedAreaRecord = CompanyMapData.defalutSelectedId;
|
|
|
resolve({
|
|
|
spaceId: CompanyMapData.defalutSelectedId[this.selectedFloor],
|
|
|
- floorId: this.selectedFloor
|
|
|
+ floorId: this.selectedFloor,
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -758,14 +763,15 @@ wepy.component({
|
|
|
pageSelectedAreaRecord = CompanyMapData.defalutSelectedId;
|
|
|
resolve({
|
|
|
spaceId: CompanyMapData.defalutSelectedId[this.selectedFloor],
|
|
|
- floorId: this.selectedFloor
|
|
|
+ floorId: this.selectedFloor,
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
// 设置选中的路径
|
|
|
doSelectArea(area, sign) {
|
|
|
+ debugger;
|
|
|
if (!area) {
|
|
|
return;
|
|
|
}
|
|
@@ -784,7 +790,7 @@ wepy.component({
|
|
|
wx.showToast({
|
|
|
title: '不可选区域',
|
|
|
duration: 1000,
|
|
|
- icon: 'none'
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -799,25 +805,25 @@ wepy.component({
|
|
|
return;
|
|
|
}
|
|
|
getExpandPXHeight()
|
|
|
- .then(res => {
|
|
|
+ .then((res) => {
|
|
|
const { expandPXHeight, screenHeight, screenWidth } = res;
|
|
|
- return this.getMapScale().then(res => {
|
|
|
+ return this.getMapScale().then((res) => {
|
|
|
return {
|
|
|
...res,
|
|
|
expandPXHeight,
|
|
|
screenHeight,
|
|
|
- screenWidth
|
|
|
+ screenWidth,
|
|
|
};
|
|
|
});
|
|
|
})
|
|
|
- .then(res => {
|
|
|
+ .then((res) => {
|
|
|
const { foldStatus } = this;
|
|
|
const {
|
|
|
screenHeight,
|
|
|
screenWidth,
|
|
|
expandPXHeight,
|
|
|
mapScale,
|
|
|
- mapHeight
|
|
|
+ mapHeight,
|
|
|
} = res;
|
|
|
let viewHeight = screenHeight - tarBarHeight - expandPXHeight;
|
|
|
let viewCenterX = screenWidth / 2,
|
|
@@ -854,7 +860,7 @@ wepy.component({
|
|
|
},
|
|
|
// 下面面板折叠起来的逻辑
|
|
|
foldPanelFun() {
|
|
|
- this.getMapHeight().then(res => {
|
|
|
+ this.getMapHeight().then((res) => {
|
|
|
this.mapHeight = res.mapHeight;
|
|
|
this.y = 0;
|
|
|
});
|
|
@@ -865,12 +871,12 @@ wepy.component({
|
|
|
toSearchPage() {
|
|
|
console.log('被点击了');
|
|
|
wx.navigateTo({
|
|
|
- url: `/packagesEnv/pages/search/index`
|
|
|
+ url: `/packagesEnv/pages/search/index`,
|
|
|
});
|
|
|
},
|
|
|
goBack() {
|
|
|
wx.navigateBack({
|
|
|
- delta: 1 // 返回的页面数,如果 delta 大于现有页面数,则返回到首页,
|
|
|
+ delta: 1, // 返回的页面数,如果 delta 大于现有页面数,则返回到首页,
|
|
|
});
|
|
|
},
|
|
|
getfoldPanelPXHeight() {
|
|
@@ -883,10 +889,10 @@ wepy.component({
|
|
|
return Promise.resolve({
|
|
|
foldPanelPXHeight,
|
|
|
screenWidth: screenInfo.screenWidth,
|
|
|
- screenHeight: screenInfo.screenHeight
|
|
|
+ screenHeight: screenInfo.screenHeight,
|
|
|
});
|
|
|
}
|
|
|
- return getScreenInfo().then(res => {
|
|
|
+ return getScreenInfo().then((res) => {
|
|
|
let foldHeight =
|
|
|
from == 'officehome' ? switchPanelHeight : panelFoldHeight;
|
|
|
// foldPanelPXHeight = parseInt(res.screenScale * foldHeight);
|
|
@@ -894,30 +900,30 @@ wepy.component({
|
|
|
return {
|
|
|
screenWidth: res.screenWidth,
|
|
|
screenHeight: res.screenHeight,
|
|
|
- foldPanelPXHeight
|
|
|
+ foldPanelPXHeight,
|
|
|
};
|
|
|
});
|
|
|
},
|
|
|
getMapHeight() {
|
|
|
- return this.getfoldPanelPXHeight().then(res => {
|
|
|
+ return this.getfoldPanelPXHeight().then((res) => {
|
|
|
let mapHeight = res.screenHeight - tarBarHeight - res.foldPanelPXHeight;
|
|
|
|
|
|
return {
|
|
|
...res,
|
|
|
- mapHeight
|
|
|
+ mapHeight,
|
|
|
};
|
|
|
});
|
|
|
},
|
|
|
getMapScale() {
|
|
|
- return this.getMapHeight().then(res => {
|
|
|
+ return this.getMapHeight().then((res) => {
|
|
|
mapScale = Math.floor((res.mapHeight / standerMapHeight) * 10) / 10;
|
|
|
return {
|
|
|
...res,
|
|
|
- mapScale
|
|
|
+ mapScale,
|
|
|
};
|
|
|
});
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
});
|
|
|
function getScreenInfo() {
|
|
|
if (
|
|
@@ -928,21 +934,21 @@ function getScreenInfo() {
|
|
|
) {
|
|
|
return Promise.resolve({
|
|
|
...screenInfo,
|
|
|
- screenScale
|
|
|
+ screenScale,
|
|
|
});
|
|
|
}
|
|
|
return new Promise((resolve, reject) => {
|
|
|
wx.getSystemInfo({
|
|
|
- success: res => {
|
|
|
+ success: (res) => {
|
|
|
screenInfo.screenHeight = res.screenHeight;
|
|
|
screenInfo.screenWidth = res.screenWidth;
|
|
|
screenScale = res.screenWidth / standerScreenWidth;
|
|
|
resolve({
|
|
|
screenWidth: res.screenWidth,
|
|
|
screenHeight: res.screenHeight,
|
|
|
- screenScale
|
|
|
+ screenScale,
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -956,15 +962,15 @@ function getExpandPXHeight() {
|
|
|
return Promise.resolve({
|
|
|
expandPXHeight,
|
|
|
screenWidth: screenInfo.screenWidth,
|
|
|
- screenHeight: screenInfo.screenHeight
|
|
|
+ screenHeight: screenInfo.screenHeight,
|
|
|
});
|
|
|
}
|
|
|
- return getScreenInfo().then(res => {
|
|
|
+ return getScreenInfo().then((res) => {
|
|
|
expandPXHeight = parseInt(res.screenScale * panelExpandHeight);
|
|
|
return {
|
|
|
screenWidth: res.screenWidth,
|
|
|
screenHeight: res.screenHeight,
|
|
|
- expandPXHeight
|
|
|
+ expandPXHeight,
|
|
|
};
|
|
|
});
|
|
|
}
|