Showing
1 changed file
with
11 additions
and
22 deletions
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | import moment from 'moment'; | 74 | import moment from 'moment'; |
75 | // 导入一些静态图片,避免打包时不能正确解析 | 75 | // 导入一些静态图片,避免打包时不能正确解析 |
76 | import djx from '/@/assets/images/djx.png'; | 76 | import djx from '/@/assets/images/djx.png'; |
77 | - import locationJx from '/@/assets/images/location.png'; | 77 | + // import locationJx from '/@/assets/images/location.png'; |
78 | import zx from '/@/assets/images/zx.png'; | 78 | import zx from '/@/assets/images/zx.png'; |
79 | import lx from '/@/assets/images/lx.png'; | 79 | import lx from '/@/assets/images/lx.png'; |
80 | import djh from '/@/assets/images/djh.png'; | 80 | import djh from '/@/assets/images/djh.png'; |
@@ -142,26 +142,15 @@ | @@ -142,26 +142,15 @@ | ||
142 | const BMap = (window as any).BMap; | 142 | const BMap = (window as any).BMap; |
143 | if (!wrapEl) return; | 143 | if (!wrapEl) return; |
144 | const map = new BMap.Map(wrapEl); | 144 | const map = new BMap.Map(wrapEl); |
145 | - | ||
146 | - const getLocation = new BMap.Geolocation(); | ||
147 | - getLocation.getCurrentPosition((position) => { | ||
148 | - if (position) { | ||
149 | - let preMarker = null; | ||
150 | - const point = new BMap.Point(position.point.lng, position.point.lat); | ||
151 | - let mapIcon = new BMap.Icon(locationJx, new BMap.Size(50, 80)); | ||
152 | - let marker = new BMap.Marker(point, { icon: mapIcon }); | ||
153 | - if (marker) { | ||
154 | - map.removeOverlay(preMarker); | ||
155 | - } | ||
156 | - map.addOverlay(marker); | ||
157 | - map.centerAndZoom(point, 15); | ||
158 | - map.enableScrollWheelZoom(true); | ||
159 | - } else { | ||
160 | - const point = new BMap.Point(104.04666605565338, 30.543516387560476); | ||
161 | - map.centerAndZoom(point, 15); | ||
162 | - map.enableScrollWheelZoom(true); | ||
163 | - } | ||
164 | - }); | 145 | + function myFun(result) { |
146 | + let mk = new BMap.Marker(result.center); | ||
147 | + map.addOverlay(mk); | ||
148 | + map.panTo(result.center); | ||
149 | + map.centerAndZoom(result.center, 15); | ||
150 | + map.enableScrollWheelZoom(true); | ||
151 | + } | ||
152 | + let myCity = new BMap.LocalCity(); | ||
153 | + myCity.get(myFun); | ||
165 | } | 154 | } |
166 | // 点击表格某一行触发 | 155 | // 点击表格某一行触发 |
167 | const deviceRowClick = async (record) => { | 156 | const deviceRowClick = async (record) => { |
@@ -192,7 +181,7 @@ | @@ -192,7 +181,7 @@ | ||
192 | // 创建信息窗口对象 | 181 | // 创建信息窗口对象 |
193 | const res = await getDeviceActiveTime(entityId); | 182 | const res = await getDeviceActiveTime(entityId); |
194 | 183 | ||
195 | - let { value: activeStatus, lastUpdateTs } = res[0]; | 184 | + let { lastUpdateTs } = res[0]; |
196 | lastUpdateTs = moment(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss'); | 185 | lastUpdateTs = moment(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss'); |
197 | let infoWindow = new BMap.InfoWindow( | 186 | let infoWindow = new BMap.InfoWindow( |
198 | ` | 187 | ` |