From 8fe8858b3ad50fc3e5b1740d2a742f2a900e0b12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Thu, 16 Feb 2023 23:29:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E7=99=BB=E5=BD=95=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8F=E8=A7=88=E5=99=A8=E7=9A=84=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E6=AF=94=E4=BE=8B=E8=B0=83=E6=95=B4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-web/src/views/user/Login.vue | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/jshERP-web/src/views/user/Login.vue b/jshERP-web/src/views/user/Login.vue index cfb641fd..95810133 100644 --- a/jshERP-web/src/views/user/Login.vue +++ b/jshERP-web/src/views/user/Login.vue @@ -120,6 +120,7 @@ } }, created () { + this.checkScreen() this.currdatetime = new Date().getTime(); Vue.ls.remove(ACCESS_TOKEN) this.getRouterData() @@ -315,6 +316,51 @@ this.showWeixinFlag = true } }, + checkScreen() { + let percentage = '' + let basicWidth = 1920 + const currentWidth = window.screen.width + const currentHeight = window.screen.height + //浏览器的当前比例 + const currentRatio = window.devicePixelRatio.toFixed(2) + //浏览器需要调整的比例 + let needRatio = 1 + let ratio = currentWidth/basicWidth + if(ratio>0.5 && ratio<0.67) { + percentage = '50%' + needRatio = 0.5 + } if(ratio>=0.67 && ratio<0.75) { + percentage = '67%' + needRatio = 0.67 + } else if(ratio>=0.75 && ratio<0.8) { + percentage = '75%' + needRatio = 0.75 + } else if(ratio>=0.8 && ratio<0.9) { + percentage = '80%' + needRatio = 0.8 + } else if(ratio>=1.1 && ratio<1.25) { + percentage = '110%' + needRatio = 1.1 + } else if(ratio>=1.25 && ratio<1.5) { + percentage = '125%' + needRatio = 1.25 + } else if(ratio>=1.5 && ratio<1.75) { + percentage = '150%' + needRatio = 1.5 + } + //console.log(currentRatio) + //console.log(needRatio) + if(currentRatio-0 !== needRatio) { + this.openNotificationWithIcon('warning', currentWidth, currentHeight, percentage) + } + }, + openNotificationWithIcon(type, currentWidth, currentHeight, percentage) { + this.$notification[type]({ + message: '浏览器的缩放比例调整提示', + description: '检测到您显示器的分辨率为:' + currentWidth + '*' + currentHeight + ' ,为了获得更好的操作体验,建议您将浏览器的缩放比例调整至' + percentage, + duration: 15 + }); + }, } }