From 08d1712ad0f749d2d110ea93c9fe057aabc0deb4 Mon Sep 17 00:00:00 2001 From: xianfuxing Date: Mon, 27 Aug 2018 21:48:47 +0800 Subject: [PATCH] # up map --- package.json | 1 + src/main.js | 13 +++++- src/views/counter/device.vue | 16 ++++++-- src/views/counter/map.vue | 77 ++++++++++++++++++++++++++++++++++-- 4 files changed, 100 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a89cc32..0c83b52 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "simplemde": "1.11.2", "sortablejs": "1.7.0", "vue": "2.5.10", + "vue-amap": "^0.5.8", "vue-count-to": "1.0.13", "vue-i18n": "7.3.2", "vue-multiselect": "2.0.8", diff --git a/src/main.js b/src/main.js index bc5c530..b74d90a 100644 --- a/src/main.js +++ b/src/main.js @@ -23,7 +23,18 @@ Vue.use(VueAMap) VueAMap.initAMapApiLoader({ key: '29fc9d79996d548cb00726229752cd1f', - plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'], + plugin: [ + 'AMap.Geolocation', + 'AMap.Driving', + 'AMap.Autocomplete', + 'AMap.PlaceSearch', + 'AMap.Scale', + 'AMap.OverView', + 'AMap.ToolBar', + 'AMap.MapType', + 'AMap.PolyEditor', + 'AMap.CircleEditor' + ], // 默认高德 sdk 版本为 1.4.4 v: '1.4.4' }) diff --git a/src/views/counter/device.vue b/src/views/counter/device.vue index 464956b..b99a198 100644 --- a/src/views/counter/device.vue +++ b/src/views/counter/device.vue @@ -80,9 +80,11 @@ min-width="100"> @@ -138,13 +140,21 @@ export default { this.listLoading = true this.getDevices({ page }) }, - handleDeviceClick(deviceID) { + handleDetailClick(deviceID) { // console.log(deviceID) this.$store.dispatch('chnageDeviceID', deviceID).then(() => { this.$router.push('/counter/detail') }).catch(() => { console.log('Err: get device_id failed in device page') }) + }, + handleMapClick(deviceID) { + // console.log(deviceID) + this.$store.dispatch('chnageDeviceID', deviceID).then(() => { + this.$router.push('/counter/map') + }).catch(() => { + console.log('Err: get device_id failed in device page') + }) } }, created() { diff --git a/src/views/counter/map.vue b/src/views/counter/map.vue index d58678d..3fd7354 100644 --- a/src/views/counter/map.vue +++ b/src/views/counter/map.vue @@ -1,21 +1,92 @@