From 245a4e8d30762d8b3a60b71b95cb643b0d7775fd Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Mon, 15 Dec 2025 18:58:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/web3D/index.js | 31 +- src/assets/icons/svg/jiankong.svg | 8 + src/views/components/AccessDoor.vue | 4 +- src/views/environmentalScreen/index copy.vue | 787 +++++++++++++++++++ src/views/environmentalScreen/index.js | 27 + src/views/environmentalScreen/index.vue | 782 ++++++++++-------- src/views/home111.vue | 749 ++++++++++++++++++ 7 files changed, 2040 insertions(+), 348 deletions(-) create mode 100644 src/assets/icons/svg/jiankong.svg create mode 100644 src/views/environmentalScreen/index copy.vue create mode 100644 src/views/home111.vue diff --git a/public/web3D/index.js b/public/web3D/index.js index 25761bd..90e61fe 100644 --- a/public/web3D/index.js +++ b/public/web3D/index.js @@ -28,6 +28,8 @@ var targetAngles = { var camera + + BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function() { if (document.getElementById('customLoadingScreenDiv')) { document.getElementById('customLoadingScreenDiv').style.display = 'initial' @@ -243,6 +245,32 @@ BABYLON.DracoCompression.Configuration.decoder.wasmUrl = './js/draco_wasm_wrappe BABYLON.DracoCompression.Configuration.decoder.wasmBinaryUrl = './js/draco_decoder_gltf.wasm' BABYLON.DracoCompression.Configuration.decoder.fallbackUrl = './js/draco_decoder_gltf.js' + + +// 3D模型页面(web3D/index.html)的createScene函数后添加适配逻辑 +var canvas = document.getElementById('renderCanvas') +var engine = new BABYLON.Engine(canvas, true, { stencil: true }) + +// ========== 新增:画布自适应iframe尺寸 ========== +function resizeCanvas() { + // 获取iframe的容器尺寸(如果iframe有父容器,也可以取父容器尺寸) + const iframeWidth = window.innerWidth || document.documentElement.clientWidth + const iframeHeight = window.innerHeight || document.documentElement.clientHeight + + // 设置canvas尺寸为iframe的100%(保证填满iframe,且跟随iframe缩放) + canvas.width = iframeWidth + canvas.height = iframeHeight + + // 通知引擎更新尺寸 + engine.resize() +} + +// 初始化时执行一次 +resizeCanvas() +// 监听窗口大小变化(iframe缩放时触发) +window.addEventListener('resize', resizeCanvas) + + // createScene function that creates and return the scene var createScene = function() { engine.displayLoadingUI() @@ -256,13 +284,14 @@ var createScene = function() { camera.setTarget(new BABYLON.Vector3(0, 0, 0)) camera.attachControl(canvas, true) + // 相机参数(保持原优化) camera.lowerRadiusLimit = 0.1 camera.upperRadiusLimit = 500 camera.inertia = 0.1 camera.minZ = 0.01 camera.maxZ = 1000 - camera.fov = 0.8 + camera.fov = 1.0 camera.useAutoRotationBehavior = isRotating // 初始启用自动旋转 diff --git a/src/assets/icons/svg/jiankong.svg b/src/assets/icons/svg/jiankong.svg new file mode 100644 index 0000000..4720a9a --- /dev/null +++ b/src/assets/icons/svg/jiankong.svg @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/views/components/AccessDoor.vue b/src/views/components/AccessDoor.vue index 04bdc2a..f453e83 100644 --- a/src/views/components/AccessDoor.vue +++ b/src/views/components/AccessDoor.vue @@ -13,7 +13,7 @@
{{ scope.row.time | parseTime }}
- + @@ -126,7 +126,7 @@ export default { } }, getAccessdoor() { - FetchInitHikDoorLog({ page: 0, size: 30 }).then((data) => { + FetchInitHikDoorLog({ page: 0, size: 5 }).then((data) => { if (data.content && data.content.length > 0) { this.tableData.splice(0, data.content.length, ...data.content) } diff --git a/src/views/environmentalScreen/index copy.vue b/src/views/environmentalScreen/index copy.vue new file mode 100644 index 0000000..3cd462f --- /dev/null +++ b/src/views/environmentalScreen/index copy.vue @@ -0,0 +1,787 @@ +