提交 5fe43bc7 作者: 翁进城

1.地面站订阅增加订阅指令, 取消订阅增加取消订阅指令

2.使用天目将三期的地面站链路做测试
上级 279aced1
......@@ -9,4 +9,6 @@ export default {
悬停: "200,2117",
继续飞行: "200,2118",
指点飞行: "200,2119",
订阅: "1126,",
取消订阅: "1127,"
};
......@@ -125,7 +125,7 @@ export default {
* 订阅
* @param {*} deviceHardId
*/
subscribe({ state, commit }, deviceHardId) {
subscribe({ state, commit, dispatch }, deviceHardId) {
if (!deviceHardId) {
return deviceHardId;
}
......@@ -137,16 +137,18 @@ export default {
list.push(deviceHardId);
}
commit("setInclude", list);
dispatch("order", { order: "订阅", data: {}, deviceHardId });
},
/**
* 取消订阅
* @param {*} deviceHardId
* @returns
*/
unsubscribe({ state, commit }, deviceHardId) {
unsubscribe({ state, commit, dispatch }, deviceHardId) {
if (!deviceHardId) {
return deviceHardId;
}
let list = [...state.include];
list = list.filter((id) => {
return deviceHardId !== id;
......@@ -156,6 +158,7 @@ export default {
commit("setDataSet", state.dataSet);
}
commit("setInclude", list);
dispatch("order", { order: "取消订阅", data: {}, deviceHardId });
},
/**
* 发布消息到地面站
......
<template>
<div>
<el-form>
<el-form-item label="地面站地址">
<el-input v-model="url"></el-input>
</el-form-item>
<el-form-item label="账号">
<el-input v-model="account"></el-input>
</el-form-item>
......@@ -34,8 +37,8 @@ export default {
name: "GroundStation",
data() {
return {
account: "juchut",
password: "dG1qMDQwNyNuZXcuMQ==",
account: "mmc111",
password: "MTIzNDU2",
deviceHardId: "",
userInfo: {
username: "",
......@@ -44,6 +47,7 @@ export default {
// 'task-id': 1448
},
callbackText: "",
url: "wss://test.tmj.mmcuav.cn/websocket"
};
},
computed: {
......@@ -60,45 +64,24 @@ export default {
let formData = new FormData();
formData.append("userAccount", this.account);
formData.append("password", this.password);
let res1 = await fetch("/crm/account/login", {
let res1 = await fetch("/crm/login", {
method: "post",
headers: {
"Content-Type": "application/json",
// "Content-Type": "multipart/form-data",
},
body: JSON.stringify({
username: this.account,
password: this.password,
}),
body: formData,
});
let data1 = await res1.json();
if (data1.code == 200) {
this.userInfo.username = data1.data.username;
}
let res2 = await fetch("/crm/account/loginInfo", {
method: "post",
headers: {
token: data1.data.token,
"Content-Type": "application/json",
},
body: JSON.stringify({
loginInfo: {
appId: "40004",
token: data1.data.token,
},
}),
});
let data2 = await res2.json();
if (data2.code == 200) {
this.userInfo.token = data2.data.token + data2.data.flyingSessionId;
this.userInfo.username = data1.data.userName;
this.userInfo.token = data1.data.token;
}
},
async connect() {
try {
await this.$store.dispatch("MMCGroundStation/init", {
url: "ws://121.43.58.140:30105",
url: this.url,
userInfo: this.userInfo,
});
} catch (e) {
......
......@@ -18,7 +18,7 @@ module.exports = defineConfig({
},
proxy: {
"/crm": {
target: "http://infra.mmcuav.cn/",
target: "https://test.tmj.mmcuav.cn/",
// target: "http://47.106.147.192/", //测试
// target: "http://120.79.102.66",
// target: "http://120.77.219.153:80", //v3正式
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论