135 lines
2.8 KiB
Vue
Raw Normal View History

<template>
2023-10-17 18:13:53 +08:00
<div class="leftTop">
<Card title="项目展示">
2024-09-06 09:23:41 +08:00
<!-- 全屏icon -->
<div class="fullScreen" @click="handleFullScreen">
<el-icon :size="20" color="#fff">
<FullScreen />
</el-icon>
2023-10-17 18:13:53 +08:00
</div>
2024-09-06 09:23:41 +08:00
<!-- <div class="map-box" id="mapContainer"></div> -->
<iframe
style="width: 100%; height: 100%"
id="iframeDom"
src="http://222.80.185.228:6080/#/login?projectId=2"
allowfullscreen
frameborder="0"
></iframe>
2023-09-07 11:27:21 +08:00
</Card>
</div>
</template>
<script setup lang="ts">
2023-09-07 11:27:21 +08:00
import Card from "@/components/card.vue";
import { ref, onMounted, watch } from "vue";
2024-09-06 09:23:41 +08:00
import { FullScreen } from "@element-plus/icons-vue";
// ts
type Props = {
projectData?: any; // 传入项目信息
};
// withDefaults 定义默认值(传入的数据类型同默认值)
const props = withDefaults(defineProps<Props>(), {
2023-10-17 18:13:53 +08:00
projectData: {}
});
2024-09-06 09:23:41 +08:00
let map = null;
// 项目信息
2023-10-17 18:13:53 +08:00
const projectData = ref({} as any);
2024-09-06 09:23:41 +08:00
const handleFullScreen = () => {
const dom = document.getElementById('iframeDom');
requestFullScreen(dom)
};
/**
* 进入全屏
* @param element
*/
function requestFullScreen(element) {
var requestMethod =
element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
if (requestMethod) {
requestMethod.call(element);
} else if (typeof window.ActiveXObject !== "undefined") {
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
/**
* 退出全屏
*/
function exitFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
watch(
() => props.projectData,
newVal => {
// console.log(newVal, "newVal");
if (newVal) {
// props.xData = newVal;
projectData.value = newVal;
}
}
);
2024-09-06 09:23:41 +08:00
onMounted(async () => {
// initMap();
});
2023-10-17 18:13:53 +08:00
2024-09-06 09:23:41 +08:00
// 围栏定位地图
function initMap() {
//地图加载
map = new AMap.Map("mapContainer", {
// viewMode: '3D',
resizeEnable: true,
center: [90.604822, 44.329273],
// layers: [new AMap.TileLayer.Satellite()],
zoom: 15
// center: [116.39, 39.9],
// offset: new AMap.Pixel(-10, -10) // 设置地图偏移量
2023-10-17 18:13:53 +08:00
});
}
2024-04-13 11:08:23 +08:00
//将方法暴露给父组件
2024-09-06 09:23:41 +08:00
defineExpose({});
</script>
2023-09-07 11:27:21 +08:00
<style lang="scss" scoped>
.leftTop {
width: 100%;
height: 100%;
2023-10-17 18:13:53 +08:00
position: relative;
2023-09-07 11:27:21 +08:00
}
2024-09-06 09:23:41 +08:00
.map-box {
2023-10-17 18:13:53 +08:00
width: 100%;
2024-09-06 09:23:41 +08:00
height: 100%;
2023-10-17 18:13:53 +08:00
}
2023-09-07 11:27:21 +08:00
::v-deep .h-card .content {
background: none;
}
2024-09-06 09:23:41 +08:00
.fullScreen {
position: absolute;
right: 24px;
top: 8px;
cursor: pointer;
}
</style>
<style>
.amap-logo {
display: none;
opacity: 0;
}
.amap-copyright {
display: none;
opacity: 0;
}
</style>