Compare commits

...

2 Commits

@ -11,23 +11,14 @@ enum Api {
TestRetry = '/testRetry',
Login = '/api/Check/Login',
Logout = '/api/Check/Logout',
GetSysSetting = '/api/SysAppSetting/Get',
SaveSysSetting = '/api/SysAppSetting/Save',
}
/**
* @description: user login api
*/
export function loginApi(params: LoginParams, mode: ErrorMessageMode = 'modal') {
console.log(
defHttp.post<LoginResultModel>(
{
url: Api.Login,
params,
},
{
errorMessageMode: mode,
},
),
);
return defHttp.post<LoginResultModel>(
{
url: Api.Login,
@ -66,3 +57,10 @@ export function testRetry() {
},
);
}
export function getSysSetting(id) {
return defHttp.get({ url: Api.GetSysSetting + '?id=' + id });
}
export function saveSysSetting(params) {
return defHttp.post({ url: Api.SaveSysSetting, params });
}

@ -29,7 +29,7 @@
if (lgWidth) {
isMobile.value = width.value - 1 < lgWidth;
}
handleRestoreState();
// handleRestoreState();
});
const { prefixCls } = toRefs(props);

@ -16,6 +16,8 @@ import { Persistent } from '@/utils/cache/persistent';
import { darkMode } from '@/settings/designSetting';
import { resetRouter } from '@/router';
import { deepMerge } from '@/utils';
import { saveSysSetting } from '@/api/sys/user';
import { useUserStore } from './user';
interface AppState {
darkMode?: ThemeEnum;
@ -82,8 +84,17 @@ export const useAppStore = defineStore({
},
setProjectConfig(config: DeepPartial<ProjectConfig>): void {
console.log('setProjectConfig');
this.projectConfig = deepMerge(this.projectConfig || {}, config) as ProjectConfig;
Persistent.setLocal(PROJ_CFG_KEY, this.projectConfig);
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
if (userInfo && userInfo.id) {
saveSysSetting({
userId: userInfo.id,
settingInfo: JSON.stringify(this.projectConfig),
});
}
},
setMenuSetting(setting: Partial<MenuSetting>): void {
this.projectConfig!.menuSetting = deepMerge(this.projectConfig!.menuSetting, setting);

@ -14,7 +14,7 @@ import {
} from '@/enums/cacheEnum';
import { getAuthCache, setAuthCache } from '@/utils/auth';
import { GetUserInfoModel, LoginParams } from '@/api/sys/model/userModel';
import { doLogout, getUserInfo, loginApi } from '@/api/sys/user';
import { doLogout, getUserInfo, loginApi, getSysSetting } from '@/api/sys/user';
import { useI18n } from '@/hooks/web/useI18n';
import { useMessage } from '@/hooks/web/useMessage';
import { router } from '@/router';
@ -25,6 +25,7 @@ import { isArray } from '@/utils/is';
import { h } from 'vue';
import md5 from 'js-md5';
import { useMultipleTabStore } from '@/store/modules/multipleTab';
import { useAppStore } from './app';
interface UserState {
userInfo: Nullable<UserInfo>;
@ -180,6 +181,11 @@ export const useUserStore = defineStore({
this.setRoleList([]);
}
this.setUserInfo(userInfo);
const setting = await getSysSetting(userInfo.id);
const appStore = useAppStore();
if (setting) {
appStore.setProjectConfig(JSON.parse(setting.settingInfo));
}
return userInfo;
},
/**
@ -197,7 +203,11 @@ export const useUserStore = defineStore({
this.setSubject(undefined, undefined, undefined, '');
this.setSessionTimeout(false);
this.setUserInfo(null);
console.log(PageEnum.BASE_LOGIN);
goLogin && router.push(PageEnum.BASE_LOGIN);
// localStorage.clear();
const appStore = useAppStore();
appStore.resetAllState();
},
/**

@ -98,7 +98,7 @@
import { buildGUID } from '@/utils/uuid';
import { vDrag } from '@/utils/drag';
import { EventBus } from '@/utils/eventBus';
import { drcUpTopic } from '@/utils/debugging/remote';
import { drcUpTopic, setTopic } from '@/utils/debugging/remote';
import { airPortStore } from '@/store/modules/airport';
const zIndex = ref(0);

@ -46,6 +46,7 @@
<a-button @click="exitDRC" style="background-color: #e3150e; border: none"
>退出飞行控制</a-button
>
<!-- <a-button @click="startHong">线</a-button> -->
</div>
<div class="content-info">
<div class="info-item">
@ -181,6 +182,7 @@
eventsTopicSubscribe,
drcUpTopic,
errorName,
setTopic,
} from '@/utils/debugging/remote';
import { buildGUID } from '@/utils/uuid';
import { useMessage } from '@/hooks/web/useMessage';
@ -619,6 +621,48 @@
document.removeEventListener('keydown', handleKeyDown);
document.removeEventListener('keyup', handleKeyUp);
});
const startHong = () => {
const querys = {
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'ir_metering_mode_set',
data: {
mode: 1,
payload_index: uav.camera_index,
},
};
console.log(querys);
servicesTopic(querys);
setTimeout(() => {
// const querysPonit = {
// bid: buildGUID(),
// tid: buildGUID(),
// timestamp: new Date().getTime(),
// method: 'ir_metering_point_set',
// data: {
// x: 0.5,
// y: 0.5,
// payload_index: uav.camera_index,
// },
// };
// servicesTopic(querysPonit);
const querysArea = {
bid: buildGUID(),
tid: buildGUID(),
timestamp: new Date().getTime(),
method: 'ir_metering_area_set',
data: {
payload_index: uav.camera_index,
height: 0.5,
width: 0.5,
x: 0.5,
y: 0.5,
},
};
servicesTopic(querysArea);
}, 500);
};
</script>
<style lang="less" scoped>
.flight-control {

@ -58,6 +58,7 @@
import airPoint from './airPoint.vue';
import * as mars3d from 'mars3d';
import { EventBus } from '@/utils/eventBus';
import { airPortStore } from '@/store/modules/airport';
import 'mars3d-space';
@ -2472,17 +2473,123 @@ const setUAVPosition = () => {
flyTo: true,
});
graphicLayer.addGraphic(route);
// routeroute
addGroundLine(route, 'uav-route')
addRectSensor(route, 'uav-route')
}
if (props.uavTrack.longitude) {
const positionVal = Cesium.Cartesian3.fromDegrees(
props.uavTrack.longitude,
props.uavTrack.latitude,
props.uavTrack.height,
);
route.addTimePosition(positionVal,Cesium.JulianDate.fromDate(new Date()));
const positionVal = Cesium.Cartesian3.fromDegrees(
props.uavTrack.longitude,
props.uavTrack.latitude,
props.uavTrack.height,
);
route.addTimePosition(positionVal,Cesium.JulianDate.fromDate(new Date()));
const airPortStoreVal = airPortStore();
const uav = airPortStoreVal.getUAV;
const type_subtype_gimbalindex = props.uavTrack[uav.camera_index];
const rectSensor = graphicLayer.getGraphicById("uav-route-rectSensor")
rectSensor.heading = type_subtype_gimbalindex.gimbal_yaw //0360
rectSensor.pitch = type_subtype_gimbalindex.gimbal_pitch //0360
rectSensor.roll = type_subtype_gimbalindex.gimbal_roll + 90 //0360
rectSensor.angle1 = 10 //1 0.1-89.9
rectSensor.angle2 = 10 //2 0.1-89.9
}
};
// 线
function addGroundLine(route) {
const groundPoint = new mars3d.graphic.PointPrimitive({
id: route.id + "-groundPoint",
position: route.position,
style: {
color: "#ff0000",
pixelSize: 6
}
})
graphicLayer.addGraphic(groundPoint)
const linePositions = []
const groundLine = new mars3d.graphic.PolylineEntity({
id: route.id + "-groundLine",
positions: new Cesium.CallbackProperty(function (time) {
return linePositions
}, false),
style: {
width: 1,
materialType: mars3d.MaterialType.PolylineDash,
materialOptions: {
color: Cesium.Color.WHITE,
dashLength: 20
}
}
})
graphicLayer.addGraphic(groundLine)
route.on(mars3d.EventType.change, function (event) {
const wrjPt = route.position
const wrjCarto = Cesium.Cartographic.fromCartesian(wrjPt)
const dmHeight = mars3d.PointUtil.getHeight(map?.scene, wrjCarto, { max: wrjCarto.height })
const pt2 = Cesium.Cartesian3.fromRadians(wrjCarto.longitude, wrjCarto.latitude, dmHeight)
// 线
linePositions[0] = wrjPt
linePositions[1] = pt2
//
groundPoint.position = pt2
if (route.label) {
// const wrjHeight = wrjCarto.height - dmHeight // AGL: -
// fixedRoute.label.text = `\nAGL:${mars3d.Util.formatNum(wrjHeight, 2)}m`
// ASL:
route.label.text = `火星无人机\nASL:${mars3d.Util.formatNum(wrjCarto.height, 2)}m`
}
})
}
//
function addRectSensor(route) {
const rectSensor = new mars3d.graphic.RectSensor({
id: route.id + "-rectSensor",
position: route.property,
style: {
angle1: 10,
angle2: 10,
length: 50,
rayEllipsoid: true,
color: "rgba(0,255,255,0.3)",
outline: true,
topShow: true,
topSteps: 2,
flat: true,
cameraHpr: true,
heading: 0,
pitch: 0,
roll: 90
}
})
graphicLayer.addGraphic(rectSensor)
// 线
const rectLine = new mars3d.graphic.PolylineEntity({
id: route.id + "-rectLine",
positions: new Cesium.CallbackProperty(function (time) {
const localEnd = rectSensor?.rayPosition
if (!localEnd) {
return []
}
return [rectSensor.position, localEnd]
}, false),
style: {
arcType: Cesium.ArcType.NONE,
materialType: mars3d.MaterialType.PolylineDash,
materialOptions: {
color: "#ff0000"
},
width: 1
}
})
graphicLayer.addGraphic(rectLine)
}
///////////////////////////////////////////////////////////////////////
const addAction = (action) => {

Loading…
Cancel
Save