fix: BUG修改

This commit is contained in:
kun 2023-10-27 17:27:09 +08:00
parent f87bb58e53
commit b7c1c22615
5 changed files with 101 additions and 67 deletions

View File

@ -1,7 +1,7 @@
// ? 全局不动配置项 只做导出不做修改
// * 首页地址(默认)
export const HOME_URL: string = "/government";
export const HOME_URL: string = "/largeScreen";
// * 登录页地址(默认)
export const LOGIN_URL: string = "/login";

View File

@ -1 +1 @@
export const HOME_URL: string[] = ["/government", "/home", "/home", "/home"];
export const HOME_URL: string[] = ["/largeScreen", "/home", "/home", "/home"];

View File

@ -77,6 +77,7 @@ onMounted(() => {
});
// 线
const startFly = (row: any, index: number) => {
//
productRoute(row, index);
};
// 线
@ -86,51 +87,116 @@ const productRoute = (obj: any, index: number) => {
console.log(endGraphic);
const graphic = routeLayer.getGraphicById(obj.id);
console.log(graphic);
// let pointsArr = [] as any;
// obj.points.map((item: any) => {
// pointsArr.push(mars3d.LngLatPoint.fromArray(item));
// });
// console.log(pointsArr);
let pointsArr = [] as any;
obj.points.map((item: any) => {
pointsArr.push(mars3d.LngLatPoint.fromArray(item));
});
console.log(pointsArr);
const newRoutePath = new mars3d.graphic.FixedRoute({
id: obj.id + "-" + index,
name: "路线-" + index,
speed: 200,
positions: [startGraphic.points[0], endGraphic.points[0]],
positions: [...pointsArr],
clockLoop: false, //
model: {
url: "//data.mars3d.cn/gltf/mars/MQ-9-Predator.glb",
scale: 1,
minimumPixelSize: 60
url: "//data.mars3d.cn/gltf/mars/jingche/jingche.gltf",
heading: 90,
mergeOrientation: true, // ,orientationheading
minimumPixelSize: 50
},
path: {
camera: {
type: "gs",
pitch: -30,
radius: 500
},
polyline: {
color: "#ffff00",
opacity: 0.5,
width: 1,
leadTime: 0
},
coneTrack: {
angle: 15, //
color: "rgba(255,0,255,0.5)"
},
updateClock: false,
point: {
color: "#ffff00",
pixelSize: 5,
distanceDisplayCondition: true,
distanceDisplayCondition_near: 80000,
distanceDisplayCondition_far: Number.MAX_VALUE
},
label: {
text: "测试",
font_size: 20
width: 3
}
});
console.log(newRoutePath);
console.log(newRoutePath.info);
routeLayer.addGraphic(newRoutePath);
//
newRoutePath.flyTo();
newRoutePath.start();
// popup
bindPopup(newRoutePath);
newRoutePath.autoSurfaceHeight().then(function (e: any) {
//
newRoutePath.flyTo();
newRoutePath.start();
addParticleSystem(newRoutePath.property);
});
};
const bindPopup = (fixedRoute: any) => {
fixedRoute.bindPopup(
`<div style="width: 200px">
<div> <span id="lblAllLen"> </span></div>
<div> <span id="lblAllTime"> </span></div>
<div>开始时间<span id="lblStartTime"> </span></div>
<div>剩余时间<span id="lblRemainTime"> </span></div>
<div>剩余距离<span id="lblRemainLen"> </span></div>
</div>`,
{ closeOnClick: false }
);
// DOM,popup
fixedRoute.on(mars3d.EventType.postRender, function (event: any) {
const container = event.container; // popupDOM
const params = fixedRoute?.info;
console.log(fixedRoute?.info);
if (!params) {
return;
}
const lblAllLen = container.querySelector("#lblAllLen");
if (lblAllLen) {
lblAllLen.innerHTML = mars3d.MeasureUtil.formatDistance(params.distance_all);
}
const lblAllTime = container.querySelector("#lblAllTime");
if (lblAllTime) {
lblAllTime.innerHTML = mars3d.Util.formatTime(params.second_all / map.clock.multiplier);
}
const lblStartTime = container.querySelector("#lblStartTime");
if (lblStartTime) {
lblStartTime.innerHTML = mars3d.Util.formatDate(Cesium.JulianDate.toDate(fixedRoute.startTime), "yyyy-M-d HH:mm:ss");
}
const lblRemainTime = container.querySelector("#lblRemainTime");
if (lblRemainTime) {
lblRemainTime.innerHTML = mars3d.Util.formatTime((params.second_all - params.second) / map.clock.multiplier);
}
const lblRemainLen = container.querySelector("#lblRemainLen");
if (lblRemainLen) {
lblRemainLen.innerHTML = mars3d.MeasureUtil.formatDistance(params.distance_all - params.distance) || "完成";
}
});
};
//
function addParticleSystem(property: any) {
const particleSystem = new mars3d.graphic.ParticleSystem({
position: property,
style: {
image: "src/assets/images/Mars3DImg/particle/smoke.png",
particleSize: 12, //
emissionRate: 20.0, // /
pitch: 40, //
maxHeight: 1000, //
startColor: Cesium.Color.GREY.withAlpha(0.7), //
endColor: Cesium.Color.WHITE.withAlpha(0.0), //
startScale: 1.0, // imageSize
endScale: 5.0, // imageSize
minimumSpeed: 1.0, // (/)
maximumSpeed: 4.0 // (/)
},
attr: { remark: "车辆尾气" }
});
routeLayer.addGraphic(particleSystem);
}
let lastRoute: any;
// 线
const highLightRoute = (row: any) => {

View File

@ -1,32 +0,0 @@
import * as mars3d from "mars3d";
export let map: mars3d.Map; // mars3d.Map三维地图对象
/**
*
*
* @param {mars3d.Map} mapInstance
* @returns {void}
*/
export function onMounted(mapInstance: any) {
map = mapInstance; // 记录首次创建的map
}
/**
*
* @returns {void}
*/
export function onUnmounted() {
map = null;
}
// 获取图层
export function getLayers() {
return map.getLayers({
basemaps: true, // 是否取config.json中的basemaps
layers: true // 是否取config.json中的layers
});
}
export function addLayer(layer: any) {
map.addLayer(layer);
}

View File

@ -66,7 +66,7 @@ const login = (formEl: FormInstance | undefined) => {
if (!valid) return;
loading.value = true;
try {
const arr = ref(["/government", "/home", "/home", "/home"]);
const arr = ref(["/largeScreen", "/home", "/home", "/home"]);
// 1.
const { result } = await loginApi({ ...loginForm, showPassword: loginForm.showPassword });
console.log(result);