diff --git a/src/config/getData.js b/src/config/getData.js index 975b693..65d40a2 100644 --- a/src/config/getData.js +++ b/src/config/getData.js @@ -13,7 +13,7 @@ export const stopMapping = () => post('teaching/stopMapping', {}) export const getLocalMaps = () => post('teaching/getLocalMaps', {}) export const oneClickDeployment = (map) => post('teaching/oneClickDeployment?mapName=' + map, {}) export const abandonMapping = () => post('teaching/abandonMapping', {}) -export const sendAutoBack = () => post('teaching/sendAutoBack', {}) +export const sendAutoBack = (is) => post('teaching/sendAutoBack?isBack=' + is, {}) // 操作 export const queryStation = () => post('api/operate/queryStation', {}) diff --git a/src/config/mork.js b/src/config/mork.js index 6368373..609b3f6 100644 --- a/src/config/mork.js +++ b/src/config/mork.js @@ -224,4 +224,12 @@ export const abandonMapping = (sn, code) => { message: 'ok' } return res +} + +export const relocate = (x, y, angle) => { + let res = { + code: 200, + message: 'ok' + } + return res } \ No newline at end of file diff --git a/src/main.js b/src/main.js index baccb51..1580c90 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,7 @@ import Vue from 'vue' import App from './App.vue' -// import router from './router' -import router from './hubRouter' +import router from './router' +// import router from './hubRouter' import store from './vuex/store' import './style/reset.css' import { Row, Col, Button, Icon, Dialog, Form, FormItem, Input, Select, Option, Table, TableColumn, Tabs, TabPane, Popover, Loading, MessageBox, Message, Progress, Upload } from 'element-ui' diff --git a/src/pages/modules/build/gl-map.vue b/src/pages/modules/build/gl-map.vue index 0b21401..bc178e1 100644 --- a/src/pages/modules/build/gl-map.vue +++ b/src/pages/modules/build/gl-map.vue @@ -538,7 +538,7 @@ export default { this.lastUpdateTime = now if (this.reconnectTimer) clearTimeout(this.reconnectTimer) const pointData = JSON.parse(event.data) - this.updatePointCloud(pointData.data) + this.updatePointCloud(pointData.globalData) } catch (error) { console.error('解析点云数据失败:', error) } diff --git a/src/pages/modules/build/index.vue b/src/pages/modules/build/index.vue index 5e85a11..37feada 100644 --- a/src/pages/modules/build/index.vue +++ b/src/pages/modules/build/index.vue @@ -209,9 +209,10 @@ export default { cancelButtonText: this.$t('no'), type: 'warning' }).then(() => { - this._sendAutoBack() + this._sendAutoBack('0') this.backActive = false }).catch(() => { + this._sendAutoBack('1') this.backActive = false }) } @@ -505,19 +506,21 @@ export default { } }, // 打点功能点击返回成功后 - async _sendAutoBack () { + async _sendAutoBack (flag) { try { this.loading = this.$loading({ lock: true, spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.6)' }) - let res = await sendAutoBack() + let res = await sendAutoBack(flag) if (res && res.code === 200) { - this.$nextTick(() => { - this.$refs.glMap.closeWebSocket() - }) - this.tipShow = true + if (flag === '0') { + this.$nextTick(() => { + this.$refs.glMap.closeWebSocket() + }) + this.tipShow = true + } } this.loading.close() } catch (e) { diff --git a/src/pages/modules/login/index.vue b/src/pages/modules/login/index.vue index 8f017a9..1010dfc 100644 --- a/src/pages/modules/login/index.vue +++ b/src/pages/modules/login/index.vue @@ -68,7 +68,7 @@ export default { tab: 0, username: null, password: null, - baseUrl: this.$store.getters.baseUrl, + baseUrl: null, setTime: 1000, disabled: false } @@ -76,6 +76,13 @@ export default { computed: { ...mapGetters(['serverUrl']) }, + watch: { + serverUrl (newVal) { + if (newVal) { + this.baseUrl = newVal + } + } + }, mounted () { this.baseUrl = this.serverUrl }, @@ -103,10 +110,10 @@ export default { try { let res = await authlogin(this.username, this.encryptData(this.password)) if (res.code === '1') { - let obj = {} - obj = Object.assign({}, res.result) - this.$store.dispatch('userInfo', JSON.stringify(obj)) - this.$store.dispatch('setLoginInfo', {username: this.username, password: this.password}) + // let obj = {} + // obj = Object.assign({}, res.result) + // this.$store.dispatch('userInfo', JSON.stringify(obj)) + // this.$store.dispatch('setLoginInfo', {username: this.username, password: this.password}) this.$router.push('/hub') } else { this.Dialog(res.desc) diff --git a/src/pages/modules/map/index.vue b/src/pages/modules/map/index.vue index 8e895b8..a70eea3 100644 --- a/src/pages/modules/map/index.vue +++ b/src/pages/modules/map/index.vue @@ -31,7 +31,7 @@ :key="`point-${index}`" :cx="point.px_x" :cy="point.px_y" - r="1" + r="3" fill="green" /> @@ -181,7 +181,7 @@ export default { this._queryMapAllStation() ]) await Promise.all([ - this.preloadImage('map', mapData.mapImageAddress), + this.preloadImage('map', `${this.serverUrl}${mapData.mapImageAddress}`), this.preloadImage('marker', markerImage) ]) this.mapData = mapData @@ -664,13 +664,13 @@ export default { this.websocket.onopen = () => {} this.websocket.onmessage = (event) => { try { - const res = JSON.parse(event.data) - res.forEach(point => { + const pointData = JSON.parse(event.data) + pointData.currentData.forEach(point => { const pt = this.pointCmToPx(point.x, point.y) this.$set(point, 'px_x', pt.x) this.$set(point, 'px_y', pt.y) }) - this.greenPoints = res + this.greenPoints = pointData.currentData this.loading.close() } catch (error) { console.error('WebSocket消息解析失败:', error) @@ -794,6 +794,11 @@ export default { this.isCarLocked = false this.carOffsetX = 0 this.carOffsetY = 0 + this.greenPoints = [] + this.carLastX = 0 + this.carLastY = 0 + this.carCenterX = 0 + this.carCenterY = 0 }, confirmLocked () { const carImage = this.$refs.carImage diff --git a/src/pages/modules/map/map copy.vue b/src/pages/modules/map/map copy.vue deleted file mode 100644 index d6d37d9..0000000 --- a/src/pages/modules/map/map copy.vue +++ /dev/null @@ -1,838 +0,0 @@ - - - - - - diff --git a/src/router/index.js b/src/router/index.js index 6c0762c..0a846eb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,8 @@ const Warning = r => require.ensure([], () => r(require('../pages/modules/warn/i const Building = r => require.ensure([], () => r(require('../pages/modules/build/index.vue')), 'Building') const Map = r => require.ensure([], () => r(require('../pages/modules/map/index.vue')), 'Map') const Relocation = r => require.ensure([], () => r(require('../pages/modules/relocation.vue')), 'Relocation') +const Login = r => require.ensure([], () => r(require('../pages/modules/login/index.vue')), 'login') +const Hub = r => require.ensure([], () => r(require('../pages/modules/hub/index.vue')), 'Hub') Vue.use(VueRouter) const router = new VueRouter({ @@ -38,6 +40,14 @@ const router = new VueRouter({ path: 'relocation', component: Relocation }] + }, + { + path: '/login', + component: Login + }, + { + path: '/hub', + component: Hub } ] })