提交 5fe43bc7 作者: 翁进城

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

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