From cc24def792786bb4b958caeaac7d2916414ded14 Mon Sep 17 00:00:00 2001 From: Joe <1712833832@qq.com> Date: Thu, 18 Jan 2024 07:53:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E8=BD=A6=E8=AF=B1=E5=AF=BC=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JiHeExpressway/components/Adaptation.vue | 80 ++++++++- .../components/Buttons/Button.vue | 48 +++++- .../FormConfig/components/ElSelect.vue | 2 +- .../components/FormConfig/index.vue | 42 ++++- .../components/TimeLine/TimeLine1/index.vue | 7 +- .../components/DeviceControlDialog.vue | 161 ++++++++++++++++-- .../RoadAndEvents/utils/httpList.js | 2 +- .../views/JiHeExpressway/scss/el-reset.scss | 58 +++++++ .../views/JiHeExpressway/utils/axios/auth.js | 2 +- 9 files changed, 368 insertions(+), 34 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/components/Adaptation.vue b/ruoyi-ui/src/views/JiHeExpressway/components/Adaptation.vue index 403081c7..47f79ff9 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/components/Adaptation.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/components/Adaptation.vue @@ -50,12 +50,38 @@ export default { initScale() { let winW = window.innerWidth; let winH = window.innerHeight; - this.scale.scaleX = winW / this.defaultWidth; - this.scale.scaleY = winH / this.defaultHeight; + + this.setScale(this.scale.scaleX = winW / this.defaultWidth, this.scale.scaleY = winH / this.defaultHeight) + }, + setScale(scaleX, scaleY) { + const cssGlobalVariable = [ + [ + '--keep-ratio', + '' + ], + [ + '--reverse-scale', + '' + ], + ]; + + if (scaleX > scaleY) { + cssGlobalVariable[0][1] = `scaleX(${1 / scaleX * scaleY})`; + cssGlobalVariable[1][1] = `scaleY(${1 / scaleX})`; + } else { + cssGlobalVariable[0][1] = `scaleY(${1 / scaleY * scaleX})`; + cssGlobalVariable[1][1] = `scaleX(${1 / scaleY})`; + } + + cssGlobalVariable.forEach((data) => { + document.documentElement.style.setProperty(...data); + }); + } }, mounted() { this.initScale(); + window.addEventListener( "resize", _.debounce(this.initScale.bind(this), 360) @@ -64,6 +90,56 @@ export default { }; + +