diff --git a/package.json b/package.json index 4075e3b..f938932 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "babel-preset-es2015": "^6.24.1", "element-ui": "^2.8.2", "jsencrypt": "^3.3.2", + "lodash": "^4.17.21", "simple-keyboard": "^3.7.26", "simple-keyboard-layouts": "^3.3.34", "vue": "^2.5.2", diff --git a/src/config/getData.js b/src/config/getData.js index 49ed52a..48931a2 100644 --- a/src/config/getData.js +++ b/src/config/getData.js @@ -33,3 +33,29 @@ export const updateStation = (code, st) => post('api/operate/updateStation', { station_code: code, station_name: st }) + +export const imageUrl = require('../images/new/apt_map.png') + +// 地图 +export const fetchMapData = () => { + let res = { + code: 200, + message: 'success', + data: { + image: imageUrl, + width: 400, + height: 300, + pixelRatio: 1, + leftBottomCoordinate: {x: -100, y: -300} + } + } + return res +} +export const fetchPathData = () => { + let res = { + code: 200, + message: 'success', + data: [{id: 'A', x: '0', y: '-200'}, {id: 'B', x: '100', y: '-250'}] + } + return res +} diff --git a/src/images/new/agv.png b/src/images/new/agv.png new file mode 100644 index 0000000..bb3117f Binary files /dev/null and b/src/images/new/agv.png differ diff --git a/src/images/new/apt_map.png b/src/images/new/apt_map.png new file mode 100644 index 0000000..c8c180d Binary files /dev/null and b/src/images/new/apt_map.png differ diff --git a/src/pages/modules/building.vue b/src/pages/modules/building.vue index 9917193..05b677d 100644 --- a/src/pages/modules/building.vue +++ b/src/pages/modules/building.vue @@ -44,18 +44,23 @@ import { startMapping, setStation, stopMapping, getLocalMaps, oneClickDeployment } from '@config/getData.js' export default { beforeRouteLeave (to, from, next) { - this.$confirm('是否放弃本次建图?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - next() // 允许离开 - }).catch(() => { - next(false) // 阻止离开 - }) + if (this.needsConfirmation) { + this.$confirm('是否放弃本次建图?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + next() // 允许离开 + }).catch(() => { + next(false) // 阻止离开 + }) + } else { + next() + } }, data () { return { + needsConfirmation: true, mapName: '', dialogVisible: false, dataForm: { @@ -245,6 +250,7 @@ export default { type: 'success', message: res.message }) + this.needsConfirmation = false this.$router.push('/index/home') } else { this.$message.error(res.message) diff --git a/src/pages/modules/home.vue b/src/pages/modules/home.vue index fcd8eda..8a185a0 100644 --- a/src/pages/modules/home.vue +++ b/src/pages/modules/home.vue @@ -18,7 +18,7 @@ export default { {title: '操作', zh_title: '操作', en_title: 'Operation', router: '/index/device'}, {title: '建图', zh_title: '建图', en_title: 'Map building', router: '/index/building'}, {title: '取消任务', zh_title: '取消任务', en_title: 'Cancel task', router: ''}, - {title: '地图', zh_title: '地图', en_title: 'Map', router: ''} + {title: '地图', zh_title: '地图', en_title: 'Map', router: '/index/map'} ], disabled: false } diff --git a/src/pages/modules/map.vue b/src/pages/modules/map.vue new file mode 100644 index 0000000..a0c1505 --- /dev/null +++ b/src/pages/modules/map.vue @@ -0,0 +1,289 @@ + + + + + + diff --git a/src/pages/shells/index.vue b/src/pages/shells/index.vue index d3033b1..e8de42c 100644 --- a/src/pages/shells/index.vue +++ b/src/pages/shells/index.vue @@ -131,7 +131,6 @@ export default { padding 0 2% background top center / 100% 84px url(../../images/new/header_bg_1.png) no-repeat .button-home - padding .06rem .1rem background linear-gradient(0deg, #E64F29, rgba(230, 79, 41, 0.5)) border-color rgba(230, 79, 41, 0.7) .state-item diff --git a/src/router/index.js b/src/router/index.js index c3d3d9f..9bc4a4f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ const Home = r => require.ensure([], () => r(require('@page/modules/home.vue')), const Device = r => require.ensure([], () => r(require('@page/modules/device.vue')), 'modules') const Warning = r => require.ensure([], () => r(require('@page/modules/warning.vue')), 'modules') const Building = r => require.ensure([], () => r(require('@page/modules/building.vue')), 'modules') +const Map = r => require.ensure([], () => r(require('@page/modules/map.vue')), 'modules') Vue.use(VueRouter) const router = new VueRouter({ @@ -35,6 +36,9 @@ const router = new VueRouter({ }, { path: 'building', component: Building + }, { + path: 'map', + component: Map }] } ] diff --git a/src/style/common.styl b/src/style/common.styl index 04931a7..1901a18 100644 --- a/src/style/common.styl +++ b/src/style/common.styl @@ -82,6 +82,10 @@ color #fff .el-button font-size .16rem + padding-top 0 + padding-bottom 0 + height .32rem + line-height .32rem .el-dialog background center / 100% 100% url(../images/new/modal_bg.png) no-repeat .el-dialog__header diff --git a/yarn.lock b/yarn.lock index 7ee94ec..afebb70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5589,6 +5589,11 @@ lodash@^4.17.19: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-symbols@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"