Commit bce745ee4f254d08efa1b25e4785b72b02bf115a

Authored by xp.Huang
2 parents 18c9dc82 b870d5ff

Merge branch 'f_local_dev' into 'main'

feat:新增设备详情地理位置

See merge request huang/thingskit-app!75
  1 +const mapUrl = 'https://apis.map.qq.com'
  2 +//你在腾讯地图控制台里申请的key值(配置你自己申请的key)文档https://lbs.qq.com/
  3 +const mapKey = '3ETBZ-WAUED-2GU46-P7X7K-ENHGZ-3PFTM'
  4 +
  5 +export {
  6 + mapUrl,
  7 + mapKey
  8 +}
  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,6 +12,7 @@
12 {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }} 12 {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }}
13 </view> 13 </view>
14 </view> 14 </view>
  15 + <view style="margin-right: 20rpx;"><u-icon v-if="deviceDetail.deviceInfo.longitude !== ''" @click="handleClick" name="map-fill"></u-icon></view>
15 <view style="margin-right: 20rpx;" v-if="deviceDetail.deviceState === 'ONLINE' && deviceDetail.deviceType !== 'SENSOR'"> 16 <view style="margin-right: 20rpx;" v-if="deviceDetail.deviceState === 'ONLINE' && deviceDetail.deviceType !== 'SENSOR'">
16 <u-button type="primary" shape="circle" size="mini" text="下发命令" @click="showModal" /> 17 <u-button type="primary" shape="circle" size="mini" text="下发命令" @click="showModal" />
17 </view> 18 </view>
@@ -118,6 +119,15 @@ export default { @@ -118,6 +119,15 @@ export default {
118 }, 119 },
119 mounted() {}, 120 mounted() {},
120 methods: { 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 showModal() { 131 showModal() {
122 this.showModel = true; 132 this.showModel = true;
123 }, 133 },
@@ -87,6 +87,12 @@ @@ -87,6 +87,12 @@
87 "style": { 87 "style": {
88 "navigationBarTitleText": "命令详情" 88 "navigationBarTitleText": "命令详情"
89 } 89 }
  90 + },
  91 + {
  92 + "path": "deviceDetailPage/devicePosition",
  93 + "style": {
  94 + "navigationBarTitleText": "设备地理位置"
  95 + }
90 } 96 }
91 ] 97 ]
92 }, 98 },