123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981 |
- <style lang="less">
- .page-intelligent-control {
- position: relative;
- // height: 100%;
- width: 100%;
- box-sizing: border-box;
- overflow: hidden;
- .top-bar {
- height: 96px;
- background: #f7f8fa;
- }
- }
- .tool-box {
- position: fixed;
- bottom: 272rpx;
- right: 40rpx;
- z-index: 333;
- .search-btn-box {
- overflow: hidden;
- text-align: right;
- image {
- float: right;
- width: 88rpx;
- height: 88rpx;
- }
- }
- .search-btn {
- margin-bottom: 16rpx;
- width: 88rpx;
- height: 88rpx;
- display: block;
- border-radius: 16rpx;
- }
- .now-floor {
- box-sizing: border-box;
- padding: 20rpx 0;
- background: #ffffff;
- border-radius: 16rpx;
- box-shadow: 0px 4px 12px 0px #00000008;
- .select-building {
- display: inline-block;
- vertical-align: middle;
- padding-left: 28rpx;
- padding-right: 24rpx;
- font-family: PingFang SC;
- font-size: 32rpx;
- font-weight: 500;
- line-height: 44rpx;
- text-align: center;
- }
- .line {
- display: inline-block;
- vertical-align: middle;
- height: 36rpx;
- width: 1px;
- background: #e1e5eb;
- }
- .select-floor {
- display: inline-block;
- vertical-align: middle;
- padding: 0 24rpx;
- font-family: PingFang SC;
- font-size: 32rpx;
- font-weight: 500;
- line-height: 44rpx;
- text-align: center;
- background: #fff;
- }
- }
- }
- .page-intelligent-control .map-contanier {
- // height: 100%;
- width: 100%;
- // padding-bottom: 176rpx;
- //background: #ebeef5;
- background: #f7f8fa;
- box-sizing: border-box;
- }
- .page-intelligent-control .location-wrapper {
- position: fixed;
- bottom: 272rpx;
- right: 40rpx;
- z-index: 444;
- &.fold {
- }
- &.building {
- }
- }
- .page-intelligent-control .location-wrapper.expand {
- bottom: 658rpx;
- }
- movable-area {
- width: 100%;
- height: 0;
- position: relative;
- }
- movable-view {
- color: #fff;
- }
- .room-item {
- position: absolute;
- box-shadow: 0px 1px 4px rgba(1, 1, 51, 0.01),
- 0px 16px 40px rgba(1, 1, 51, 0.03);
- border-radius: 4px;
- box-sizing: border-box;
- padding: 0 12rpx;
- transform-origin: center;
- z-index: 1;
- &.isAbnormity {
- padding: 0;
- }
- }
- // 租户可控
- .tent-space {
- background: #ffffff;
- }
- // 用户可控
- .user-space {
- background: #d5e4ed;
- }
- // 不能控制
- .no-control {
- }
- .room-item.selected {
- border: 2px solid rgba(77, 148, 255, 0.8);
- }
- .room-item.transparent {
- box-shadow: none;
- }
- .room-item.selected.transparent {
- border: 0;
- }
- .room-item.clickDisabled {
- border: 2px solid #dfe3ed;
- box-sizing: border-box;
- background-repeat: repeat;
- }
- .room-item .bg-disabled {
- width: 100%;
- height: 100%;
- border-radius: 4px;
- }
- .room-item .icon {
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translateX(-50%) translateY(-50%);
- }
- .room-item .circle {
- width: 8rpx;
- height: 8rpx;
- border-radius: 50%;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translateX(-50%) translateY(-50%);
- }
- .room-item .door {
- position: absolute;
- width: 48rpx;
- height: 24rpx;
- }
- .room-item .text {
- font-weight: 600;
- font-size: 20rpx;
- line-height: 24rpx;
- text-align: center;
- color: #8995ba;
- position: absolute;
- top: 50%;
- left: 50%;
- width: 100%;
- transform: translateX(-50%) translateY(32rpx);
- padding: 0 16rpx;
- box-sizing: border-box;
- word-break: break-all;
- }
- .area-items-wrapper {
- position: relative;
- width: 100%;
- height: 100%;
- }
- .selected-icon {
- height: 38px;
- box-sizing: border-box;
- position: absolute;
- // background: #ac8be8;
- border-radius: 30px;
- background-size: 100% 100%;
- z-index: 9999;
- text-align: center;
- padding: 8px;
- max-width: 140px;
- .sanjiao {
- position: absolute;
- content: '';
- width: 0;
- height: 0;
- top: 30px;
- left: 50%;
- transform: translateX(-50%) rotate(90deg);
- border-top: solid 10px transparent;
- border-left: solid 10px;
- border-bottom: solid 10px transparent;
- border-top-width: 10px;
- border-top-style: solid;
- border-top-color: transparent;
- border-left-width: 10px;
- border-left-style: solid;
- // border-left-color: #ac8be8;
- border-bottom-width: 10px;
- border-bottom-style: solid;
- border-bottom-color: transparent;
- }
- label {
- position: relative;
- display: inline-block;
- // width: 100%;
- max-width: 132px;
- font-family: PingFang SC;
- font-size: 14px;
- font-weight: 600;
- line-height: 22px;
- letter-spacing: 0px;
- text-align: center;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- margin: 0 auto;
- }
- }
- .room-item.selected .text {
- font-weight: 600;
- font-size: 24rpx;
- line-height: 24rpx;
- text-align: center;
- white-space: nowrap;
- color: #515a76;
- top: 50%;
- left: 50%;
- z-index: 2;
- width: auto;
- padding: 0;
- text-shadow: #fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0;
- transform: translateX(-50%) translateY(-50%);
- }
- .room-item.selected.ConferenceRoom {
- box-shadow: 0px 0px 4px rgba(1, 1, 51, 0.01),
- 0px 0px 40px rgba(1, 1, 51, 0.03);
- border-radius: 2px;
- border: 2px solid rgba(77, 148, 255, 0.42);
- }
- .office-content-abstract {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- height: 238rpx;
- box-shadow: 0px 0px 2rpx rgba(0, 0, 0, 0.05),
- 0px 8rpx 30rpx rgba(0, 0, 0, 0.15);
- border-radius: 50rpx 50rpx 0px 0px;
- box-sizing: border-box;
- padding: 48rpx 48rpx 0;
- background: #ffffff;
- .title {
- font-weight: 600;
- font-size: 36rpx;
- line-height: 50rpx;
- color: #000000;
- }
- .btn-switch {
- position: absolute;
- top: 40rpx;
- right: 48rpx;
- width: 148rpx;
- height: 64rpx;
- font-weight: 500;
- font-size: 28rpx;
- line-height: 64rpx;
- color: #000000;
- background: #ffe823;
- text-align: center;
- box-shadow: 0px 0px 2rpx rgba(0, 0, 0, 0.15),
- 0px 8rpx 12rpx rgba(0, 0, 0, 0.07);
- border-radius: 60rpx;
- }
- }
- .icon-arrow {
- text-align: right;
- .icon-arrow-box {
- margin-top: 8rpx;
- box-sizing: border-box;
- border-radius: 16rpx;
- display: inline-block;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- width: 152rpx;
- background: #fff;
- box-shadow: 0px 4px 12px 0px #00000008;
- label {
- display: inline-block;
- vertical-align: middle;
- font-family: PingFang SC;
- font-size: 32rpx;
- font-weight: 500;
- letter-spacing: 0px;
- }
- image {
- display: inline-block;
- vertical-align: middle;
- margin-left: 16rpx;
- width: 24rpx;
- height: 24rpx;
- }
- }
- }
- </style>
- <template>
- <div class="page-intelligent-control">
- <div class="top-bar"></div>
- <div class="map-contanier">
- <movable-area
- :style="{'height':mapParentHeight+'px','width':mapParentWidth+'px'}"
- scale-area="true"
- >
- <movable-view
- x="{{x}}"
- y="{{y}}"
- style="height:{{mapHeight}}px;width:{{mapWidth}}px"
- direction="all"
- out-of-bounds="false"
- bindscale="onScale"
- scale="true"
- scale-min="0.5"
- scale-max="1"
- scale-value="1"
- >
- <div class="area-items-wrapper">
- <block
- v-for="(area, index) in mapAreasInfo"
- :key="index">
- <div
- @tap="selectAreaFun(area)"
- class="room-item {{area.isAbnormity? 'isAbnormity': ''}}"
- style="{{'width:'+ (area.isAbnormity? '0px;':area.width*mapScale +'px;') + 'height:'+(area.isAbnormity? '0px;':area.height*mapScale +'px;')+'left:'+area.left*mapScale+'px;'+'top:'+area.top*mapScale+'px;'+(area.isAbnormity?'': 'background-color:'+ area.backgroundColor+';'+(!area.isCompanyControl?('background-image:url(' +h5StaticPath+ '/page-map-icon/bg_disable.png);'): '')) + (area.isAbnormity?('border-top:' + area['borderWidth'][0]*mapScale +'px solid ' +area['borderColor'][0]+ ';' + 'border-right:' + area['borderWidth'][1]*mapScale+'px solid ' + area['borderColor'][1] +';' +'border-bottom:' + area['borderWidth'][2]*mapScale +'px solid ' +area['borderColor'][2] + ';' + 'border-left:' + area['borderWidth'][3]*mapScale +'px solid ' +area['borderColor'][3] + ';'):'')+ (area['borderRadius'] && area['borderRadius'].length? 'border-radius:' + area['borderRadius'][0]*mapScale + 'px ' + area['borderRadius'][1]*mapScale + 'px ' + area['borderRadius'][2]*mapScale + 'px ' + area['borderRadius'][3]*mapScale + 'px;': '')+(area.rotate?'transform:rotate('+area.rotate+'deg)': '')}}"
- :class="{'selected': selectArea.spaceId === area.spaceId,
- 'clickDisabled': area.isCompanyControl !==true,'transparent': !area.isCompanyControl}"
- >
- <block
- wx:if="{{area.width*mapScale*touchScale>24&&area.height*mapScale*touchScale>24}}"
- >
- <image
- wx:if="{{area.icon}}"
- class="icon"
- src="{{h5StaticPath+ '/page-map-icon/' + area.icon}}"
- />
- </block>
- <block
- wx:elif="{{area.width*mapScale*touchScale>=24 || area.height*mapScale*touchScale>=24}}"
- >
- <div class="circle" style="{{'background-color:'+ area.circleColor+';'}}"></div>
- </block>
- <div
- class="text"
- wx:if="{{selectArea.spaceId === area.spaceId || (area.height*mapScale>80 && (area.title.length*screenScale*10 +16*screenScale)<area.width*mapScale)}}"
- >{{area.title}}</div>
- </div>
- </block>
- <div
- class="selected-icon"
- v-if="selectArea"
- 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)'}"
- >
- <span :style="{'border-left-color':(selectArea.circleColor)}" class="sanjiao "></span>
- <label>{{ selectArea.localName }}</label>
- </div>
- </div>
- </movable-view>
- <div class="tool-box" v-if="foldStatus!=='expand'">
- <div class="search-btn-box">
- <image
- v-on:click="toSearchPage"
- class="search-btn"
- src="{{h5StaticPath}}/page-intelligent-control/icon-search-big.svg"
- />
- </div>
- <div class="now-floor"
- v-on:click="changeBuilding">
- <div class="select-building"
- v-if="buildingData && buildingData.length>1"
- >{{ buildingItem.localName }}</div>
- <div class="line" v-if="buildingData && buildingData.length>1"></div>
- <div class="select-floor">{{ floorItem.localName }}</div>
- </div>
- </div>
-
- <div v-if="foldStatus=='expand'" class="location-wrapper">
-
- <floor
- status="{{floorStatus}}"
- :floors="floors"
- :buildings="buildingData"
- selectedBuilding="{{ selectedBuilding }}"
- selectedFloor="{{selectedFloor}}"
- @component-building-change="changeBuildingFun($event)"
- @component-floor-change="changeFloorFun($event)"
- ></floor>
-
- <div class="icon-arrow">
- <div class="icon-arrow-box"
- @click="closeExpend">
- <label>收起</label>
- <image
- mode="scaleToFill"
- class="icon"
- src="{{h5StaticPath+ 'page-intelligent-control/icon-floor-arrow.svg'}}"/>
- </div>
- </div>
- </div>
- </movable-area>
- </div>
- </div>
- </template>
- <script>
- import wepy from '@wepy/core';
- import store from '@/store';
- import {
- getSpaceBytoothHttp,
- getMapDetailHttp
- } from '@/packagesEnv/api/intelligentControl';
- import { checkHasUserInfo } from '@/service/user';
- import utils from '@/common/utils';
- import config from '@/config';
- import { mapState } from '@wepy/x';
- import { saveCompanyConfig } from '@/service/companyConfig';
- import { getCompanyMapData } from '@/api/home';
- import {
- getBuildingList,
- getFloorList,
- getMapInfo
- } from '@/packagesEnv/api/mapApi.js';
- let h5StaticPath = config.h5StaticPath;
- const tarBarHeight = 96;
- const panelExpandHeight = 407;
- const panelFoldHeight = 96;
- const switchPanelHeight = 145;
- const standerScreenWidth = 375;
- const standerMapHeight = 812 - tarBarHeight - panelFoldHeight;
- let screenInfo = {};
- let standerMapWidth = 2336;
- let mapScale;
- let screenScale;
- let foldPanelPXHeight;
- let expandPXHeight;
- let pageSelectedAreaRecord = {
-
- };
- let touchMapStartRecord = {
- timeStamp: 0,
- pageX: 0,
- pageY: 0
- };
- let touchMapEndRecord = {
- timeStamp: 0,
- pageX: 0,
- pageY: 0
- };
- let from = 'officehome';
- let CompanyMapData = {};
- let combinedData = [];
- wepy.component({
- props: {
- space: {
- type: Object,
- default: {
- isControlSpace: 0,
- buildingId: 'Bd1101080259317347f00d0811ebb06b1d2749356f83',
- spaceId: 'Sp1101080259308f5ed92e964bc1b029038dea962de4',
- spaceName: '上格云二区',
- floorId: 'Fl1101080259282bba688d32419caa57685ff17447b2'
- }
- }
- },
- store,
- data: {
- currentSp: '',
- h5StaticPath,
- mapAreasInfo: [],
- selectArea: null,
- x: 0,
- y: 0,
- selectedBuilding: '',
- selectedFloor: '',
- foldStatus: 'fold',
- floorStatus: 'fold',
- mapHeight: 507,
- mapParentHeight: 607,
- mapParentWidth: 375,
- mapWidth: 2336,
- mapScale: 1,
- screenScale: 1,
- mapMoveByTouch: false,
- touchScale: 1,
- isShowLocationEntrance: false,
- canSearchPerson: true,
- canSlideExpanel: true,
- pageHide: false,
- query: {},
- floors: [],
- companyId: '',
- buildingData: [],
- buildingItem: {},
- floorItem: {}
- },
- computed: {
- ...mapState({
- userInfo: state => state.user.userInfo
- })
- },
- ready() {
-
- console.log('地图模块触发了--');
- if (this.space) {
- this.init();
- }
- },
-
- attached() {},
- watch: {
-
- space: function(newSpace, oldSpace) {
- console.log('获取到空间数据--');
- console.log(newSpace);
-
- }
- },
- methods: {
-
- closeExpend() {
- console.log('点击了收起--');
- this.foldStatus = 'fold';
- console.log(this.foldStatus);
- },
- init() {
-
- console.log(this.userInfo);
- this.projectId = this.userInfo.projectId;
- this.getPageBuildingList();
- },
-
- changeBuilding() {
- if (this.floors && this.floors.length > 1) {
- this.foldStatus = 'expand';
- } else {
- return;
- }
- },
-
- setBuidingItem() {
- console.log('this.space.buildingId==', this.space.buildingId);
- this.buildingData.map(item => {
- if (item.id == this.space.buildingId) {
- this.selectedBuilding = item.id;
- this.buildingItem = item;
- }
- });
- },
-
- getPageBuildingList() {
- let params = {
- criteria: {
- projectId: this.projectId
- }
- };
- getBuildingList(params).then(res => {
- this.buildingData = res.content || [];
- console.log('this.selectedBuilding==', this.selectedBuilding);
- this.setBuidingItem();
- console.log('this.selectedBuilding==', this.selectedBuilding);
- if (this.selectedBuilding) {
- this.getFloorList();
- }
- });
- },
-
- setFlorrItem() {
- this.floors.map(item => {
- if (item.id == this.space.floorId) {
- this.selectedFloor = item.id;
- this.floorItem = item;
- }
- });
- },
-
- getFloorList() {
- let params = {
- criteria: {
- projectId: this.projectId,
- buildingId: this.selectedBuilding
- }
- };
- getFloorList(params).then(res => {
- this.floors = res.content || [];
- this.setFlorrItem();
-
- if (this.selectedFloor) {
- this.getPageMapInfo();
- }
- });
- },
-
- getPageMapInfo() {
- let params = {
- projectId: this.projectId,
- floorId: this.selectedFloor,
- userCode: this.userInfo.userId,
- companyId: this.userInfo.companyId
- };
- getMapInfo(params)
- .then(res => {
- let data = res.data || {};
- this.mapAreasInfo = data.spaceList || [];
- CompanyMapData.mapWidth = data.width;
- this.setMapIcon();
- this.getMapSize();
- console.log('this.selectArea===', this.selectArea);
- })
- .catch(() => {});
- },
-
- setMapIcon() {
- this.mapAreasInfo.map(item => {
- if (item.spaceId == this.space.spaceId) {
- this.selectArea = item;
- }
- if (item.localName) {
- item.selectIconWidth = item.localName.length * 14 + 16;
- if (item.selectIconWidth < 74) {
- item.selectIconWidth = 74;
- }
- if (item.selectIconWidth > 140) {
- item.selectIconWidth = 132;
- }
- } else {
- item.selectIconWidth = 0;
- }
- item.icon = utils.getMapSpaceIcon(item.roomFuncType).icon;
- item.typeName = utils.getMapSpaceIcon(item.roomFuncType).typeName;
- item.selectIcon = item.icon;
- if (item.typeName == '开放办公区') {
- item.circleColor = '#6B96D9';
- } else if (item.typeName == '个人办公区') {
- item.circleColor = '#AC8BE8';
- } else if (item.typeName == '会议室') {
- item.circleColor = '#69CACB';
- } else {
- item.circleColor = '#9DAACB';
- }
- if (item.isCompanyControl) {
- item.backgroundColor = '#D5E4ED';
- }
- if (item.isCompanyControl && item.isUserControl) {
- item.backgroundColor = '#FFFFFF';
- }
- if (!item.isCompanyControl) {
- item.backgroundColor = '';
- }
- });
- },
-
- changeBuildingFun(building) {
-
- this.selectedBuilding = building;
- this.getFloorList();
- },
-
- changeFloorFun(floor) {
- console.log('切换楼层');
- this.selectedFloor = floor;
-
- this.getPageMapInfo();
- },
-
- getMapSize() {
- getScreenInfo().then(res => {
- this.screenScale = res.screenScale;
- });
- this.getMapScale().then(res => {
- this.mapScale = res.mapScale;
- this.mapWidth = Math.ceil(res.mapScale * CompanyMapData.mapWidth);
- this.mapHeight = res.mapHeight;
- this.mapParentHeight = res.mapHeight;
- this.mapParentWidth = res.screenWidth;
- });
- },
- getHistorySelectedArea() {
- return new Promise((resolve, reject) => {
- wx.getStorage({
- key: 'SelectedASpace',
- success: res => {
- if (res.data && res.data.spaceId) {
- pageSelectedAreaRecord = {
- ...CompanyMapData.defalutSelectedId,
- [res.data.floorId]: res.data.spaceId
- };
- resolve(res.data);
- } else {
- pageSelectedAreaRecord = CompanyMapData.defalutSelectedId;
- resolve({
- spaceId: CompanyMapData.defalutSelectedId[this.selectedFloor],
- floorId: this.selectedFloor
- });
- }
- },
- fail: () => {
- pageSelectedAreaRecord = CompanyMapData.defalutSelectedId;
- resolve({
- spaceId: CompanyMapData.defalutSelectedId[this.selectedFloor],
- floorId: this.selectedFloor
- });
- }
- });
- });
- },
-
- doSelectArea(area, sign) {
- if (!area) {
- return;
- }
- this.selectArea = area;
- this.selectedFloor = area.floorId;
- this.setAreaCenter(area);
- if (!sign) {
-
- console.log('this.selectArea==', this.selectArea);
- this.$emit('mapChangeSpaceInfo', area);
- }
- },
-
- selectAreaFun(currentSelect) {
- if (!currentSelect.isCompanyControl) {
- wx.showToast({
- title: '不可选区域',
- duration: 1000,
- icon: 'none'
- });
- return;
- }
- this.selectArea = null;
- this.doSelectArea(currentSelect);
- },
- setAreaCenter(area) {
- if (!area.id) {
- return;
- }
- if (this.touchScale !== 1) {
- return;
- }
- getExpandPXHeight()
- .then(res => {
- const { expandPXHeight, screenHeight, screenWidth } = res;
- return this.getMapScale().then(res => {
- return {
- ...res,
- expandPXHeight,
- screenHeight,
- screenWidth
- };
- });
- })
- .then(res => {
- const { foldStatus } = this;
- const {
- screenHeight,
- screenWidth,
- expandPXHeight,
- mapScale,
- mapHeight
- } = res;
- let viewHeight = screenHeight - tarBarHeight - expandPXHeight;
- let viewCenterX = screenWidth / 2,
- viewCenterY = viewHeight / 2,
- areaCenterX =
- (parseInt(area.left) + parseInt(area.width) / 2) * mapScale,
- areaCenterY =
- (parseInt(area.top) + parseInt(area.height) / 2) * mapScale;
- let x = parseInt(viewCenterX - areaCenterX);
- let y = parseInt(viewCenterY - areaCenterY);
- let max = expandPXHeight - foldPanelPXHeight + 20;
- this.mapMoveByTouch = false;
- this.x = x > 0 ? 0 : x;
- this.y =
- foldStatus === 'expand' ? (Math.abs(y) > max ? -max : y) : this.y;
-
-
-
-
-
-
-
-
-
-
- this.mapHeight = screenHeight - tarBarHeight - foldPanelPXHeight;
- });
- },
- onScale(e) {
- this.touchScale = e.$wx.detail.scale;
- },
-
- foldPanelFun() {
- this.getMapHeight().then(res => {
- this.mapHeight = res.mapHeight;
- this.y = 0;
- });
- if (this.foldStatus === 'expand') {
- this.foldStatus = 'fold';
- }
- },
- toSearchPage() {
- console.log('被点击了');
- wx.navigateTo({
- url: `/packagesEnv/pages/search/index`
- });
- },
- goBack() {
- wx.navigateBack({
- delta: 1
- });
- },
- getfoldPanelPXHeight() {
- if (
- foldPanelPXHeight &&
- screenInfo &&
- screenInfo.screenWidth &&
- screenInfo.screenHeight
- ) {
- return Promise.resolve({
- foldPanelPXHeight,
- screenWidth: screenInfo.screenWidth,
- screenHeight: screenInfo.screenHeight
- });
- }
- return getScreenInfo().then(res => {
- let foldHeight =
- from == 'officehome' ? switchPanelHeight : panelFoldHeight;
-
- foldPanelPXHeight = parseInt(foldHeight);
- return {
- screenWidth: res.screenWidth,
- screenHeight: res.screenHeight,
- foldPanelPXHeight
- };
- });
- },
- getMapHeight() {
- return this.getfoldPanelPXHeight().then(res => {
- let mapHeight = res.screenHeight - tarBarHeight - res.foldPanelPXHeight;
- return {
- ...res,
- mapHeight
- };
- });
- },
- getMapScale() {
- return this.getMapHeight().then(res => {
- mapScale = Math.floor((res.mapHeight / standerMapHeight) * 10) / 10;
- return {
- ...res,
- mapScale
- };
- });
- }
- }
- });
- function getScreenInfo() {
- if (
- screenScale &&
- screenInfo &&
- screenInfo.screenWidth &&
- screenInfo.screenHeight
- ) {
- return Promise.resolve({
- ...screenInfo,
- screenScale
- });
- }
- return new Promise((resolve, reject) => {
- wx.getSystemInfo({
- success: res => {
- screenInfo.screenHeight = res.screenHeight;
- screenInfo.screenWidth = res.screenWidth;
- screenScale = res.screenWidth / standerScreenWidth;
- resolve({
- screenWidth: res.screenWidth,
- screenHeight: res.screenHeight,
- screenScale
- });
- }
- });
- });
- }
- function getExpandPXHeight() {
- if (
- expandPXHeight &&
- screenInfo &&
- screenInfo.screenWidth &&
- screenInfo.screenHeight
- ) {
- return Promise.resolve({
- expandPXHeight,
- screenWidth: screenInfo.screenWidth,
- screenHeight: screenInfo.screenHeight
- });
- }
- return getScreenInfo().then(res => {
- expandPXHeight = parseInt(res.screenScale * panelExpandHeight);
- return {
- screenWidth: res.screenWidth,
- screenHeight: res.screenHeight,
- expandPXHeight
- };
- });
- }
- </script>
- <config>
- {
- "navigationBarBackgroundColor": "#EBEEF5",
- "backgroundColor": "#EBEEF5",
- "disableScroll": true,
- "usingComponents": {
- "control-panel": "./components/controlpanel/controlpanel",
- "temperture-control-panel": "./components/temperturecontrolpanel/temperturecontrolpanel",
- "floor": "./components/floor/floor",
- "location": "./components/location/location"
- }
- }
- </config>
|