返回驾驶舱调整跳转页面 拼接token

This commit is contained in:
huangchenhao 2025-12-03 17:50:11 +08:00
parent ef8f0eb5d5
commit f1fe8dd14c

View File

@ -306,6 +306,7 @@ import otherEmergencyIcon from "./assets/images/其他应急点.png";
import mediaIcon from "./assets/images/media.png";
import collapseLeftArrow from "./assets/images/折叠面板左箭头.png";
import collapseRightArrow from "./assets/images/折叠面板右箭头.png";
// ====================
//
// ====================
@ -543,6 +544,13 @@ const handleBack = () => {
console.log("返回驾驶舱");
//
// router.push('/cockpit')
// token
const token = localStorage.getItem("token");
const baseUrl = "http://58.144.223.132:30017/index";
const targetUrl = `${baseUrl}?token=${encodeURIComponent(token || "")}`;
window.location.href = targetUrl;
};
/**
@ -1710,8 +1718,19 @@ provide("cesiumViewer", cesiumViewer);
provide("triggerJump", (duration = 5, height = 30) => {
triggerJumpAnimation(cesiumViewer.value, duration, height, disasterData);
});
</script>
// token
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const token = route.query.token;
const router = useRouter();
if (token) {
localStorage.setItem("token", token);
router.replace({ path: route.path }).then(() => {
window.location.reload();
});
}
</script>
<style scoped lang="scss">
@use "@/styles/mixins.scss" as *;
@use "./assets/styles/common.scss" as *;