fix: BUG修改

This commit is contained in:
kun 2023-11-22 17:09:22 +08:00
parent 5d6e06a306
commit fed5b55de4
10 changed files with 178 additions and 146 deletions

2
dist/index.html vendored
View File

@ -1,4 +1,4 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title></title><script type="module" crossorigin src="./assets/js/index-cd55c11d.js"></script><link rel="stylesheet" href="./assets/css/index-3a232b61.css"></head><body><div id="app"><style>#app,body,html{width:100%;height:100%;padding:0;margin:0}.loading-box{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%}.loading-box .loading-wrap{display:flex;align-items:center;justify-content:center;padding:98px}.dot{position:relative;box-sizing:border-box;display:inline-block;width:32px;height:32px;font-size:32px;transform:rotate(45deg);animation:ant-rotate 1.2s infinite linear}.dot i{position:absolute;display:block;width:14px;height:14px;background-color:#409eff;border-radius:100%;opacity:.3;transform:scale(.75);transform-origin:50% 50%;animation:ant-spin-move 1s infinite linear alternate}.dot i:first-child{top:0;left:0}.dot i:nth-child(2){top:0;right:0;animation-delay:.4s}.dot i:nth-child(3){right:0;bottom:0;animation-delay:.8s}.dot i:nth-child(4){bottom:0;left:0;animation-delay:1.2s}@keyframes ant-rotate{to{transform:rotate(405deg)}}@keyframes ant-spin-move{to{opacity:1}}</style><div class="loading-box"><div class="loading-wrap"><span class="dot dot-spin"><i></i><i></i><i></i><i></i></span></div></div></div><script>const globalState = JSON.parse(window.localStorage.getItem("GlobalState"));
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title></title><script type="module" crossorigin src="./assets/js/index-081a3316.js"></script><link rel="stylesheet" href="./assets/css/index-3a232b61.css"></head><body><div id="app"><style>#app,body,html{width:100%;height:100%;padding:0;margin:0}.loading-box{display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%}.loading-box .loading-wrap{display:flex;align-items:center;justify-content:center;padding:98px}.dot{position:relative;box-sizing:border-box;display:inline-block;width:32px;height:32px;font-size:32px;transform:rotate(45deg);animation:ant-rotate 1.2s infinite linear}.dot i{position:absolute;display:block;width:14px;height:14px;background-color:#409eff;border-radius:100%;opacity:.3;transform:scale(.75);transform-origin:50% 50%;animation:ant-spin-move 1s infinite linear alternate}.dot i:first-child{top:0;left:0}.dot i:nth-child(2){top:0;right:0;animation-delay:.4s}.dot i:nth-child(3){right:0;bottom:0;animation-delay:.8s}.dot i:nth-child(4){bottom:0;left:0;animation-delay:1.2s}@keyframes ant-rotate{to{transform:rotate(405deg)}}@keyframes ant-spin-move{to{opacity:1}}</style><div class="loading-box"><div class="loading-wrap"><span class="dot dot-spin"><i></i><i></i><i></i><i></i></span></div></div></div><script>const globalState = JSON.parse(window.localStorage.getItem("GlobalState"));
if (globalState) {
const color = globalState.themeConfig.primary;
const isDark = globalState.themeConfig.isDark;

View File

@ -114,6 +114,7 @@
}
}
.front-model {
height: max-content;
.el-header {
background-image: url("@/assets/images/Mars3DIcon/frontHeadBg.png");
background-size: cover;

View File

@ -41,6 +41,7 @@
display: flex;
align-items: center;
margin-bottom: 10px;
margin-top: 5px;
> span {
color: #fff;
font-size: 14px;

View File

@ -36,16 +36,34 @@
</div>
<div class="layer-config" v-if="props.type == '白膜'">
<div class="property-column-item">
<span>偏移量lon经度{{ formData.lng ? formData.lng : 0 }}</span>
<el-slider v-model="formData.lng" :step="0.0001" :max="0.01" :min="-0.01" @change="e => albugineaOperate(e, 'lng')" />
<span>经度</span>
<el-input-number
v-model="formData.lng"
:step="0.0001"
controls-position="right"
style="margin: 5px 0"
@change="e => albugineaOperate(e, 'lng')"
/>
</div>
<div class="property-column-item">
<span>偏移量lat纬度{{ formData.lat ? formData.lat : 0 }}</span>
<el-slider v-model="formData.lat" :step="0.0001" :max="0.01" :min="-0.01" @change="e => albugineaOperate(e, 'lat')" />
<span>纬度</span>
<el-input-number
v-model="formData.lat"
:step="0.0001"
controls-position="right"
style="margin: 5px 0"
@change="e => albugineaOperate(e, 'lat')"
/>
</div>
<div class="property-column-item">
<span>偏移量height高度(){{ formData.alt ? formData.alt : 0 }}</span>
<el-slider v-model="formData.alt" :step="10" :max="500" :min="-500" @change="e => albugineaOperate(e, 'alt')" />
<span>高度()</span>
<el-input-number
v-model="formData.alt"
:step="10"
controls-position="right"
style="margin: 5px 0"
@change="e => albugineaOperate(e, 'alt')"
/>
</div>
<!-- <div class="property-row-item">
<span>是否反色</span>
@ -205,6 +223,7 @@ let map: any;
let graphicLayer: any;
let thisLayer: any; //
let thisAlbuginea: any; //
let tiles3dLayer: any;
//
const editModelConfig = async () => {
let requestData = {
@ -327,20 +346,10 @@ const pointPositionOperate = (e: any, label: any) => {
}
console.log(777);
};
let initCenter: any; //
let requestNum: number = 0; //
//
const albugineaOperate = (e: any, label: any) => {
console.log(formData.value);
thisAlbuginea = map.getLayerById(formData.value.id);
if (requestNum == 0) {
initCenter = {
lng: thisAlbuginea.orginCenterPoint.lng,
lat: thisAlbuginea.orginCenterPoint.lat,
alt: thisAlbuginea.orginCenterPoint.alt
};
++requestNum;
}
console.log(thisAlbuginea);
if (label == "color") {
console.log(e, label);
@ -359,9 +368,9 @@ const albugineaOperate = (e: any, label: any) => {
}
} else {
thisAlbuginea.position = {
lng: initCenter.lng + formData.value.lng,
lat: initCenter.lat + formData.value.lat,
alt: initCenter.alt + formData.value.alt
lng: formData.value.lng,
lat: formData.value.lat,
alt: formData.value.alt
};
console.log(thisAlbuginea);
}
@ -436,30 +445,44 @@ const getAlbugineaInfo = async () => {
};
const { result }: { result: any } = await albugineaMapDetails(requestData);
console.log(result, "--------白膜");
await initMars3d(configJson.value);
if (result) {
formData.value = {
...result,
lng: +result.lng,
lat: +result.lat,
alt: +result.alt
...result
};
configJson.value.layers = [
{
id: result.id,
name: result.name,
type: "3dtiles",
url: result.url,
maximumScreenSpaceError: 1,
style: {
color: {
conditions: [["true", "color('" + result.color + "')"]]
}
},
show: true,
flyTo: true
}
];
initMars3d(configJson.value);
let showObj = {
id: result.id,
name: result.name,
url: result.url,
maximumScreenSpaceError: 16,
cacheBytes: 1073741824, // 1024MB = 1024*1024*1024
maximumCacheOverflowBytes: 2147483648, // 2048MB = 2048*1024*1024
position: { lng: result.lng, lat: result.lat, alt: result.alt },
popup: "all",
flyTo: true
};
if (+result.lng || +result.lat || +result.alt) {
showObj.position = { lng: +result.lng, lat: +result.lat, alt: +result.alt };
}
tiles3dLayer = new mars3d.layer.TilesetLayer(showObj);
map.addLayer(tiles3dLayer);
// configJson.value.layers = [
// {
// id: result.id,
// name: result.name,
// type: "3dtiles",
// url: result.url,
// position: { lng: formData.value.lng, lat: formData.value.lat, alt: formData.value.alt },
// maximumScreenSpaceError: 1,
// style: {
// color: {
// conditions: [["true", "color('" + result.color + "')"]]
// }
// },
// show: true,
// flyTo: true
// }
// ];
}
};
//
@ -492,10 +515,9 @@ const randomPoint = (position: any) => {
const random = (min: any, max: any) => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
const initMars3d = (option: any) => {
const initMars3d = async (option: any) => {
console.log(666);
map = new mars3d.Map("mars3dContainer", option);
//
graphicLayer = new mars3d.layer.GraphicLayer();
map.addLayer(graphicLayer);
@ -654,26 +676,6 @@ const initMars3d = (option: any) => {
graphicLayer.addGraphic(model);
model.flyTo({ maxHeight: 200 });
}
if (props.type == "白膜") {
setTimeout(function () {
thisAlbuginea = map.getLayerById(formData.value.id);
console.log(thisAlbuginea);
if (requestNum == 0) {
initCenter = {
lng: thisAlbuginea.orginCenterPoint.lng,
lat: thisAlbuginea.orginCenterPoint.lat,
alt: thisAlbuginea.orginCenterPoint.alt
};
++requestNum;
}
thisAlbuginea.position = {
lng: initCenter.lng + +formData.value.lng,
lat: initCenter.lat + +formData.value.lat,
alt: initCenter.alt + +formData.value.alt
};
console.log(thisAlbuginea.position);
}, 200);
}
};
onBeforeUnmount(async () => {
// if (props.type == "") {

View File

@ -6,6 +6,9 @@ import { initDynamicRouter } from "@/routers/modules/dynamicRouter";
import { staticRouter, errorRouter } from "@/routers/modules/staticRouter";
import NProgress from "@/config/nprogress";
import { HOME_URL } from "@/enums/Home";
import { loginApi } from "@/api/modules/login";
import { TabsStore } from "@/stores/modules/tabs";
import { KeepAliveStore } from "@/stores/modules/keepAlive";
// import path from "path";
/**
@ -36,7 +39,6 @@ const router = createRouter({
* */
router.beforeEach(async (to, from, next) => {
const globalStore = GlobalStore();
// 1.NProgress 开始
NProgress.start();
@ -44,7 +46,10 @@ router.beforeEach(async (to, from, next) => {
const title = import.meta.env.VITE_GLOB_APP_TITLE;
// document.title = to.meta.title ? `${to.meta.title} - ${title}` : title;
document.title = to.meta.title ? `${to.meta.title} ` : title;
// 附加.判断是否特殊进入,是的话则默认登录
if (to.query.title && to.query.title == "default") {
await defaultLogin();
}
// 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由并放行到登陆页
if (to.path === LOGIN_URL) {
if (globalStore.token) return next(from.fullPath);
@ -73,6 +78,30 @@ router.beforeEach(async (to, from, next) => {
next();
});
/**
* @description
* */
export const defaultLogin = async () => {
const { result } = await loginApi({ account: "admin", showPassword: "123456" });
const globalStore = GlobalStore();
const tabsStore = TabsStore();
const keepAlive = KeepAliveStore();
console.log(result);
globalStore.setUserInfo(result);
globalStore.setToken(result.token);
globalStore.setAccount(result.account);
globalStore.setAccountType(result.accountType);
globalStore.setProjectDateAuth(result.projectDateAuth);
globalStore.setIsManager(result.isManager); //我已知晓
// 2.添加动态路由
// await initDynamicRouter();
// router.push(arr[result.accountType - 1]);
// 3.清空 tabs、keepAlive 保留的数据
tabsStore.closeMultipleTab();
keepAlive.setKeepAliveName();
};
/**
* @description
* */

View File

@ -1,5 +1,5 @@
<template>
<layoutTop></layoutTop>
<layoutTop v-if="plusMenu.topAble"></layoutTop>
<div class="map-content" id="map-content">
<div id="mars3dContainer" class="mars3d-container"></div>
<!-- 搜索框 -->
@ -362,7 +362,8 @@ const albugineaList = ref([]);
//
const plusMenu = ref({
searchAble: false,
menuAble: false
menuAble: false,
topAble: false
});
const hours = computed(() => Math.floor(sunProperty.value.currDate / 60));
const minutes = computed(() => Math.floor(sunProperty.value.currDate / 60));
@ -423,7 +424,7 @@ onMounted(async () => {
let initAlbugineamaps: any = [{ id: 2040, name: "城市白模", type: "group" }];
albugineaList.value = resAlbuginea.result;
resAlbuginea.result.map((item: any) => {
initAlbugineamaps.push({
let pushObj = {
pid: 2040,
id: item.id,
name: item.name,
@ -437,9 +438,13 @@ onMounted(async () => {
},
show: item.show ? item.show : false,
flyTo: item.flyTo ? item.flyTo : false
});
configJson.value.layers = initAlbugineamaps;
};
if (+item.lng || +item.lat || +item.alt) {
pushObj.position = { lng: +item.lng, lat: +item.lat, alt: +item.alt };
}
initAlbugineamaps.push(pushObj);
});
configJson.value.layers = initAlbugineamaps;
}
// gltf
const resModel: any = await gltfModelList({});
@ -482,6 +487,7 @@ const getPlusConfig = async () => {
let arr = JSON.parse(result.configValue);
plusMenu.value.searchAble = arr[0].value;
plusMenu.value.menuAble = arr[1].value;
plusMenu.value.topAble = arr[2].value;
}
};
//

View File

@ -66,8 +66,8 @@ let map: any = props.mapInstance;
let graphicLayer: any = props.graphicInstance;
const addRandomGraphicByCount = () => {
const graphicImg = new mars3d.graphic.DivGraphic({
// position: [117.077462, 31.657745, 60],
position: [113.933005, 22.518904, 60],
position: [117.077462, 31.657745, 60],
// position: [113.933005, 22.518904, 60],
style: {
html: ` <div class="mars3d-camera-content">
<img class="mars3d-camera-img" src="${
@ -98,7 +98,7 @@ const addRandomGraphicByCount = () => {
if (!attr) {
return;
}
const dom = initVue3Popup(QueryPopup, attr);
const dom = initVue3Popup(previewComp.value, { name: "你好啊" });
return dom;
});
graphicLayer.addGraphic(graphicImg);
@ -154,7 +154,7 @@ const onBlur = (viewUpdate: any) => {
document.head.insertBefore(style, ref);
}
};
const comp = defineAsyncComponent(() => loadModule("./textPopup.vue", options));
const comp = defineAsyncComponent(() => loadModule("textPopup.vue", options));
console.log(comp);
previewComp.value = comp;
addRandomGraphicByCount();

View File

@ -420,7 +420,7 @@ onMounted(async () => {
let initAlbugineamaps: any = [{ id: 2040, name: "城市白模", type: "group" }];
albugineaList.value = resAlbuginea.result;
resAlbuginea.result.map((item: any) => {
initAlbugineamaps.push({
let pushObj = {
pid: 2040,
id: item.id,
name: item.name,
@ -434,9 +434,13 @@ onMounted(async () => {
},
show: item.show ? item.show : false,
flyTo: item.flyTo ? item.flyTo : false
});
configJson.value.layers = initAlbugineamaps;
};
if (+item.lng || +item.lat || +item.alt) {
pushObj.position = { lng: +item.lng, lat: +item.lat, alt: +item.alt };
}
initAlbugineamaps.push(pushObj);
});
configJson.value.layers = initAlbugineamaps;
}
// gltf
const resModel: any = await gltfModelList({});
@ -535,9 +539,9 @@ const showMapData = (arr: any) => {
});
console.log(newRoutePath);
graphicLayer.addGraphic(newRoutePath);
//
newRoutePath.flyTo();
newRoutePath.start();
// //
// newRoutePath.flyTo();
// newRoutePath.start();
} else {
graphicLayer.addGraphic(item);
console.log("111111111111111");
@ -1210,24 +1214,24 @@ const handleCheckChangeMapSplitScreen = (e: any, obj: any) => {
}
if (keys.indexOf(e.key) !== -1) {
setTimeout(function () {
//
let findItem: any = albugineaList.value.find(item => item.id == e.key);
console.log(findItem);
if (!findItem) return;
let initCenter: any;
initCenter = {
lng: layer.orginCenterPoint.lng,
lat: layer.orginCenterPoint.lat,
alt: layer.orginCenterPoint.alt
};
layer.position = {
lng: initCenter.lng + +findItem.lng,
lat: initCenter.lat + +findItem.lat,
alt: initCenter.alt + +findItem.alt
};
console.log(layer.position);
}, 200);
// setTimeout(function () {
// //
// let findItem: any = albugineaList.value.find(item => item.id == e.key);
// console.log(findItem);
// if (!findItem) return;
// let initCenter: any;
// initCenter = {
// lng: layer.orginCenterPoint.lng,
// lat: layer.orginCenterPoint.lat,
// alt: layer.orginCenterPoint.alt
// };
// layer.position = {
// lng: initCenter.lng + +findItem.lng,
// lat: initCenter.lat + +findItem.lat,
// alt: initCenter.alt + +findItem.alt
// };
// console.log(layer.position);
// }, 200);
layer.show = true;
layer.flyTo();
} else {
@ -1270,24 +1274,24 @@ const handleCheckChange = (e: any, obj: any) => {
}
if (keys.indexOf(e.key) !== -1) {
setTimeout(function () {
//
let findItem: any = albugineaList.value.find(item => item.id == e.key);
console.log(findItem);
if (!findItem) return;
let initCenter: any;
initCenter = {
lng: layer.orginCenterPoint.lng,
lat: layer.orginCenterPoint.lat,
alt: layer.orginCenterPoint.alt
};
layer.position = {
lng: initCenter.lng + +findItem.lng,
lat: initCenter.lat + +findItem.lat,
alt: initCenter.alt + +findItem.alt
};
console.log(layer.position);
}, 200);
// setTimeout(function () {
// //
// let findItem: any = albugineaList.value.find(item => item.id == e.key);
// console.log(findItem);
// if (!findItem) return;
// // let initCenter: any;
// // initCenter = {
// // lng: layer.orginCenterPoint.lng,
// // lat: layer.orginCenterPoint.lat,
// // alt: layer.orginCenterPoint.alt
// // };
// layer.position = {
// lng: +findItem.lng,
// lat: +findItem.lat,
// alt: +findItem.alt
// };
// console.log(layer.position);
// }, 200);
layer.show = true;
layer.flyTo();
} else {

View File

@ -24,39 +24,18 @@
</el-form-item>
</div>
<div class="row">
<el-form-item label="偏移量lon经度:">
<el-input-number
v-model="formData.lng"
:step="0.0001"
:max="0.01"
:min="-0.01"
placeholder="请输入"
controls-position="right"
/>
<el-form-item label="lon经度:">
<el-input-number v-model="formData.lng" :step="0.0001" placeholder="请输入" controls-position="right" />
</el-form-item>
</div>
<div class="row">
<el-form-item label="偏移量lat维度:">
<el-input-number
v-model="formData.lat"
:step="0.0001"
:max="0.01"
:min="-0.01"
placeholder="请输入"
controls-position="right"
/>
<el-form-item label="lat维度:">
<el-input-number v-model="formData.lat" :step="0.0001" placeholder="请输入" controls-position="right" />
</el-form-item>
</div>
<div class="row">
<el-form-item label="偏移量高z米:">
<el-input-number
v-model="formData.alt"
:step="10"
:max="500"
:min="-500"
placeholder="请输入"
controls-position="right"
/>
<el-form-item label="高z米:">
<el-input-number v-model="formData.alt" :step="10" placeholder="请输入" controls-position="right" />
</el-form-item>
</div>
<div class="row">
@ -157,7 +136,12 @@ const getInfo = async () => {
};
const { result }: { result: any } = await albugineaMapDetails(requestData);
if (result) {
formData.value = { ...result, lng: result.lng || 0, lat: result.lat || 0, alt: result.alt || 0 };
formData.value = {
...result,
lat: result.lat ? result.lat : 0,
lng: result.lng ? result.lng : 0,
alt: result.alt ? result.alt : 0
};
}
};
//

View File

@ -128,7 +128,8 @@ const configJson = ref<any>({
});
const plusTable = ref([
{ title: "搜索功能", value: false }, // 180-180
{ title: "菜单功能", value: false } // 90-90
{ title: "菜单功能", value: false }, // 90-90
{ title: "顶部展示", value: false } // 90-90
]);
const viewsTable = ref([
{ title: "初始化经度", value: "", key: "lng" }, // 180-180
@ -207,7 +208,11 @@ const getPlusConfig = async () => {
console.log(result, "6666666");
if (result) {
plusId.value = result.configId;
plusTable.value = JSON.parse(result.configValue);
plusTable.value.map(item => {
let findItem = JSON.parse(result.configValue).find(item2 => item.title == item2.title);
if (!findItem) return;
item.value = findItem.value;
});
}
};
onBeforeMount(async () => {