This commit is contained in:
13684185576
2025-07-22 18:51:12 +08:00
parent a2b8cd74e9
commit 3c9d244817
4 changed files with 77 additions and 71 deletions

View File

@ -1,7 +1,8 @@
<template> <template>
<div :id="mapid" class="map"></div> <div :id="mapid" class="map"></div>
<div class="changeMap_box" v-if="props.isShow"> <div class="changeMap_box" v-if="props.isShow">
<el-switch v-model="conditionRoute" @change="handleSwitch" active-text="打开路况" inactive-text="关闭路况" style="--el-switch-color:#13ce66;--el-switch-off-color:#ff4949;" /> <el-switch v-model="conditionRoute" @change="handleSwitch" active-text="打开路况" inactive-text="关闭路况"
style="--el-switch-color: #13ce66; --el-switch-off-color: #ff4949" />
<!-- <el-carousel type="card" height="75px" :autoplay="false" indicator-position="none" :initial-index="3" @change="onMapImageChange"> <!-- <el-carousel type="card" height="75px" :autoplay="false" indicator-position="none" :initial-index="3" @change="onMapImageChange">
<el-carousel-item> <el-carousel-item>
<div class="mapImageItem"> <div class="mapImageItem">
@ -74,7 +75,7 @@ const props = defineProps({
}); });
try { try {
const userInfo = getItem("deptId")[0].deptCode; const userInfo = getItem("deptId")[0].deptCode;
} catch (error) {} } catch (error) { }
let map; let map;
let mapLayer; let mapLayer;
let mapLayer1; let mapLayer1;
@ -88,27 +89,32 @@ onMounted(() => {
map = new EliMap({ map = new EliMap({
id: props.mapid, id: props.mapid,
crs: "EPSG:3857", crs: "EPSG:4490",
style: { style: {
glyphs: "./fonts/{fontstack}/{range}.pbf", glyphs: "./fonts/{fontstack}/{range}.pbf",
center: [94.36,29.65], center: [94.36057012, 29.64276831],
zoom: 10 zoom: 15
}, },
transformRequest: (url) => { minZoom: 7,
if (url.indexOf("TileMatrix=") != -1) { maxZoom: 18,
const arr = url.split("TileMatrix=");
const arr1 = arr[1].split("&");
const nurl = `${arr[0]}&TileMatrix=${Number(arr1[0])}&${arr1[1]}&${arr1[2]}`;
}
}
}); });
window.map = map; window.map = map;
map.mapboxGLMap.on("load", () => { map.mapboxGLMap.on("load", () => {
map.addGaudLayer({ map.addWMTSLayer(
url: 'http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', "/PGIS_S_TileMapServer/Maps/XZDJ_SL/EzMap",
}) {
Service: "getImage",
Type: "RGB",
ZoomOffset: "0",
V: "0.3",
Zoom: "{z}",
Row: "{y}",
Col: "{x}"
},
{
tileSize: 300
}
);
zoomTarget.value = map.mapboxGLMap.getZoom(); zoomTarget.value = map.mapboxGLMap.getZoom();
}); });
mapUtil.value = new MapUtil(map); mapUtil.value = new MapUtil(map);
@ -128,8 +134,6 @@ onMounted(() => {
}); });
// //
emitter.on("addPointArea", (obj) => { emitter.on("addPointArea", (obj) => {
console.log(obj);
mapUtil.value.makerSki(obj); mapUtil.value.makerSki(obj);
}); });
// //
@ -168,7 +172,7 @@ onMounted(() => {
}); });
// 线 // 线
emitter.on("echoLine", (res) => { emitter.on("echoLine", (res) => {
mapUtil.value.createLine(res); mapUtil.value.createLine(res, res.flag);
}); });
//geojson //geojson
emitter.on("setBoundarys", (res) => { emitter.on("setBoundarys", (res) => {
@ -199,11 +203,6 @@ onMounted(() => {
mapUtil.value.diffusionCircle(res); mapUtil.value.diffusionCircle(res);
}); });
//
emitter.on("removeElementAll", () => {
mapUtil.value.removeElementAll();
});
// //
emitter.on("showGapText", (obj) => { emitter.on("showGapText", (obj) => {
mapUtil.value.gapText(obj); mapUtil.value.gapText(obj);
@ -302,7 +301,6 @@ onUnmounted(() => {
emitter.off("diffusionCircle"); emitter.off("diffusionCircle");
emitter.off("SsCircle"); emitter.off("SsCircle");
emitter.off("ClearssCircle"); emitter.off("ClearssCircle");
emitter.off("removeElementAll");
}); });
</script> </script>
@ -325,29 +323,35 @@ onUnmounted(() => {
right: 398px; right: 398px;
bottom: 4px; bottom: 4px;
z-index: 9; z-index: 9;
.mapImageItem { .mapImageItem {
border: 1px solid #08aae8; border: 1px solid #08aae8;
background: rgb(9, 26, 70); background: rgb(9, 26, 70);
& > img {
&>img {
width: 100%; width: 100%;
height: 50px; height: 50px;
} }
& > div {
&>div {
text-align: center; text-align: center;
position: relative; position: relative;
top: -3px; top: -3px;
} }
} }
.zoomTargetBox { .zoomTargetBox {
margin-top: 10px; margin-top: 10px;
margin-left: 23px; margin-left: 23px;
} }
::v-deep .el-input-number__decrease, ::v-deep .el-input-number__decrease,
::v-deep .el-input-number__increase { ::v-deep .el-input-number__increase {
background: #133362; background: #133362;
color: #fff; color: #fff;
border: none; border: none;
} }
::v-deep .el-input__inner { ::v-deep .el-input__inner {
background: #0c1641; background: #0c1641;
} }

View File

@ -6,7 +6,7 @@ import {
removeAllItem removeAllItem
} from "@/utils/storage"; } from "@/utils/storage";
// 白名单 // 白名单
const whiteList = ['/login','/','/StationLevel', '/oatuh_login','/editPassword', '/404', '/401'] const whiteList = ['/login','/oatuh_login','/','/StationLevel','/editPassword', '/404', '/401']
/** /**
* 路由前置守卫 * 路由前置守卫
* to 去哪里 * to 去哪里
@ -14,42 +14,45 @@ const whiteList = ['/login','/','/StationLevel', '/oatuh_login','/editPassword',
* next 往下走 * next 往下走
*/ */
let onRun = true; let onRun = true;
// router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
// // 存在 token ,进入主页 // 存在 token ,进入主页
// // if (store.state.user.token) { console.log(store.getters.token,'===store.getters.token');
// // 快捷访问
// if (store.getters.token) { // if (store.state.user.token) {
// // 判断用户资料是否获取 // 快捷访问
// // 若不存在用户信息,则需要获取用户信息 if (store.getters.token) {
// // 触发获取用户信息的 action并获取用户当前权限 // 判断用户资料是否获取
// await store.commit('permission/setRouteReady', true) // 若不存在用户信息,则需要获取用户信息
// // 添加完动态路由之后,需要在进行一次主动跳转 // 触发获取用户信息的 action并获取用户当前权限
// const afterMenuList = await getItem('menusPermission'); await store.commit('permission/setRouteReady', true)
// // 处理用户权限,筛选出需要添加的权限 // 添加完动态路由之后,需要在进行一次主动跳转
// if (store.state.permission.routes == 0) { const afterMenuList = await getItem('menusPermission');
// const filterRoutes = await store.dispatch('permission/filterRoutes', afterMenuList) // 处理用户权限,筛选出需要添加的权限
// filterRoutes.forEach(item => { if (store.state.permission.routes == 0) {
// router.addRoute(item) const filterRoutes = await store.dispatch('permission/filterRoutes', afterMenuList)
// }) filterRoutes.forEach(item => {
// next({ router.addRoute(item)
// ...to, })
// replace: true next({
// }) ...to,
// } else { replace: true
// next() })
// } } else {
// // 利用 addRoute 循环添加 next()
// } else { }
// const isOatuh = getItem('isOatuh') // 利用 addRoute 循环添加
// // 没有token的情况下可以进入白名单 } else {
// if (whiteList.indexOf(to.path) > -1) { const isOatuh = getItem('isOatuh')
// next() // 没有token的情况下可以进入白名单
// } else { if (whiteList.indexOf(to.path) > -1) {
// if (isOatuh) { next()
// next('/oatuh_login') } else {
// } else { next('/oatuh_login')
// next('/login') // if (isOatuh) {
// } // next('/oatuh_login')
// } // } else {
// } // next('/login')
// }) // }
}
}
})

View File

@ -142,7 +142,7 @@ export default {
systemId, systemId,
}) })
.then((data) => { .then((data) => {
debugger
if (data.deptList.length === 1) { if (data.deptList.length === 1) {
this.commit("user/setToken", data.jwtToken); this.commit("user/setToken", data.jwtToken);
this.commit("user/setDeptId", data.deptList); this.commit("user/setDeptId", data.deptList);

View File

@ -14,7 +14,6 @@ function redirectAuth() {
let token = location.hash.slice(20) || null; let token = location.hash.slice(20) || null;
if (token != null) { if (token != null) {
debugger
token = token.replace(/\ +/g, ""); token = token.replace(/\ +/g, "");
setItem("SSOTOKEN", token) setItem("SSOTOKEN", token)
handleLogin({ token: token}); handleLogin({ token: token});
@ -27,7 +26,7 @@ const handleLogin = (e) => {
store.dispatch("user/oatuhLogin", e).then((res) => { store.dispatch("user/oatuhLogin", e).then((res) => {
// 登录后操作 // 登录后操作
if (res.deptList.length === 1) { if (res.deptList.length === 1) {
window.location.hash = "/"; // window.location.hash = "/";
} else { } else {
deptList.value = [...res.deptList]; deptList.value = [...res.deptList];
loginDialog.value = true; loginDialog.value = true;