From 607ab15cf917d7aface6bf950f39ed6d0bea2436 Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Sat, 14 Jun 2025 18:37:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E9=A3=9E=E8=A1=8C=E6=95=B0=E6=8D=AE=E4=BC=A0=E5=88=B0?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B?= =?UTF-8?q?=E3=80=91=EF=BC=9A=E8=AE=A2=E9=98=85=E9=A3=9E=E6=9C=BA=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=97=B6=E5=80=99=20=E6=A3=80=E6=B5=8B=E5=88=B0?= =?UTF-8?q?=E8=A7=A3=E9=94=81=20=E5=B0=B1=E8=AE=B0=E5=BD=95=E9=A3=9E?= =?UTF-8?q?=E8=A1=8C=E6=95=B0=E6=8D=AE=20=E5=88=87=E6=8D=A2=E5=88=B0?= =?UTF-8?q?=E5=8A=A0=E9=94=81=E4=B9=8B=E5=90=8E=20=20=E5=B0=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=95=BF=E4=BC=A0=20=20=20=E6=95=B0=E6=8D=AE=E5=8C=85?= =?UTF-8?q?=E6=8B=AC=20=E5=8A=A0=E8=A7=A3=E9=94=81=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=20=E4=BD=BF=E7=94=A8=E7=94=B5=E9=87=8F=20=E7=BB=8F?= =?UTF-8?q?=E7=BA=AC=E9=AB=98=20=E9=A3=9E=E8=A1=8C=E8=B7=9D=E7=A6=BB=20?= =?UTF-8?q?=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- package.json | 4 +- src/store/index.js | 8 +++- src/utils/api/table.js | 12 ++++-- src/views/layout/index.vue | 86 ++++++++++++++++++++++++++++++++------ 4 files changed, 91 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 23d1da7..0e72579 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "mqtt": "^2.18.9", "normalize.css": "^8.0.1", "nprogress": "^0.2.0", + "geodist": "^0.2.1", "vue": "^2.6.11", "vue-router": "^3.6.5", "vue-template-compiler": "^2.7.16", @@ -38,7 +39,6 @@ "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.0", "eslint-plugin-vue": "^6.2.2", - "geodist": "^0.2.1", "sass": "^1.64.1", "sass-loader": "^8.0.2" }, @@ -46,4 +46,4 @@ "main": ".eslintrc.js", "author": "", "license": "ISC" -} +} \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index e20ed9a..b16ed4a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -304,7 +304,13 @@ const store = new Vuex.Store({ res.data.airList.forEach(plane => { plane.planeState = { // 飞机状态初始化字段 flyDataMark: false, // 飞机解锁标记成真 - flyDataSave: [], // 飞机加锁截至 待上传飞行数据之后 再清空此值 + flyDataSave: { // 飞机加锁截至 待上传飞行数据之后 再清空此值 + startTime: null, // 解锁时的时间戳(秒) + endTime: null, // 加锁时的时间戳(秒) + startBattery: null, // 解锁时的电池电量(百分比) + endBattery: null, // 加锁时的电池电量(百分比) + path: [] // 飞行路径数组,每项是 [lon, lat, alt] + }, heartBeat: null, // 心跳 heartRandom: null, // 每次接收到心跳创建一个随机数 用于watch监听 voltagBattery: null, // 电压信息 diff --git a/src/utils/api/table.js b/src/utils/api/table.js index 13d78b7..9701265 100644 --- a/src/utils/api/table.js +++ b/src/utils/api/table.js @@ -179,8 +179,14 @@ export async function getFlyData (idArr, startTime, endTime) { return res } /** - *@abstract 上传保存飞机 飞行数据 检测心跳 解锁开始记录数据 加锁上传数据 + * @abstract 上传保存飞机飞行数据(解锁至加锁 即飞行结束触发) + * @param {Object} data 包含 id, start_time, end_time, gps_path, distance, power_used */ -export async function saveFlyData () { - +export async function saveFlyData (data) { + const params = new URLSearchParams() + for (const key in data) { + params.append(key, data[key]) + } + const res = await api.post('saveFlyData', params, 'Plane') + return res } diff --git a/src/views/layout/index.vue b/src/views/layout/index.vue index 56cc9d5..790bf2c 100644 --- a/src/views/layout/index.vue +++ b/src/views/layout/index.vue @@ -19,6 +19,8 @@