Showing
4 changed files
with
66 additions
and
0 deletions
config/tcMapConfig.js
0 → 100644
| 1 | +<template> | |
| 2 | + <view> | |
| 3 | + <!-- 公共组件-每个页面必须引入 --> | |
| 4 | + <public-module></public-module> | |
| 5 | + <map style="width: 100%; min-height: 100vh;" :markers="markers" :scale="scale" :latitude="getPos.latitude" :longitude="getPos.longitude"></map> | |
| 6 | + </view> | |
| 7 | +</template> | |
| 8 | + | |
| 9 | +<script> | |
| 10 | +import { mapUrl, mapKay } from '@/config/tcMapConfig.js'; | |
| 11 | + | |
| 12 | +export default { | |
| 13 | + components: {}, | |
| 14 | + data() { | |
| 15 | + return { | |
| 16 | + getPos: { | |
| 17 | + longitude: 0, | |
| 18 | + latitude: 0 | |
| 19 | + }, | |
| 20 | + scale: 15, | |
| 21 | + markers: [ | |
| 22 | + { | |
| 23 | + latitude: 0, | |
| 24 | + longitude: 0 | |
| 25 | + } | |
| 26 | + ] | |
| 27 | + }; | |
| 28 | + }, | |
| 29 | + onLoad(e) { | |
| 30 | + if (e.data != null) { | |
| 31 | + const params = JSON.parse(e.data); | |
| 32 | + if (params) this.getPos.longitude = params.longitude; | |
| 33 | + this.getPos.latitude = params.latitude; | |
| 34 | + this.markers[0].longitude = params.longitude; | |
| 35 | + this.markers[0].latitude = params.latitude; | |
| 36 | + } | |
| 37 | + }, | |
| 38 | + methods: {} | |
| 39 | +}; | |
| 40 | +</script> | |
| 41 | + | |
| 42 | +<style lang="scss" scoped></style> | ... | ... |
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }} |
| 13 | 13 | </view> |
| 14 | 14 | </view> |
| 15 | + <view style="margin-right: 20rpx;"><u-icon v-if="deviceDetail.deviceInfo.longitude !== ''" @click="handleClick" name="map-fill"></u-icon></view> | |
| 15 | 16 | <view style="margin-right: 20rpx;" v-if="deviceDetail.deviceState === 'ONLINE' && deviceDetail.deviceType !== 'SENSOR'"> |
| 16 | 17 | <u-button type="primary" shape="circle" size="mini" text="下发命令" @click="showModal" /> |
| 17 | 18 | </view> |
| ... | ... | @@ -118,6 +119,15 @@ export default { |
| 118 | 119 | }, |
| 119 | 120 | mounted() {}, |
| 120 | 121 | methods: { |
| 122 | + handleClick() { | |
| 123 | + const data = { | |
| 124 | + longitude: this.deviceDetail.deviceInfo.longitude || 0, | |
| 125 | + latitude: this.deviceDetail.deviceInfo.latitude || 0 | |
| 126 | + }; | |
| 127 | + uni.navigateTo({ | |
| 128 | + url: '/deviceSubPage/deviceDetailPage/devicePosition?data=' + JSON.stringify(data) | |
| 129 | + }); | |
| 130 | + }, | |
| 121 | 131 | showModal() { |
| 122 | 132 | this.showModel = true; |
| 123 | 133 | }, | ... | ... |