From 785acaa00f15e03cb8b2190f9aca7b72f5328ed2 Mon Sep 17 00:00:00 2001 From: danshihao Date: Fri, 19 Apr 2024 17:02:34 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E5=88=A4=E6=96=AD=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=A2=9E=E5=8A=A0=E9=B8=BF=E8=92=99UA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/util.js | 2 +- src/views/user/Login.vue | 25 +------------------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/utils/util.js b/src/utils/util.js index aaba2d5..e6c2bd6 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -607,7 +607,7 @@ export function evil (fn) { export function isMobile () { const userAgentInfo = navigator.userAgent - const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'] + const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod', 'Harmony'] let mobileFlag = false diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue index 1e4b5ad..75061a8 100644 --- a/src/views/user/Login.vue +++ b/src/views/user/Login.vue @@ -123,6 +123,7 @@ import { postAction, getAction } from '@/api/manage' import { getRSAPublicKey } from '@/utils/encryption.js' import { JSEncrypt } from 'jsencrypt' +import { isMobile } from '@/utils/util' // const Base64 = require('js-base64').Base64 export default { @@ -333,30 +334,6 @@ export default { } } } -// 判断当前设备 -function isMobile () { - const userAgentInfo = navigator.userAgent - - const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'] - - let mobileFlag = false - - // 根据userAgent判断是否是手机 - for (let v = 0; v < mobileAgents.length; v++) { - if (userAgentInfo.indexOf(mobileAgents[v]) > 0) { - mobileFlag = true - break - } - } - const screenWidth = window.screen.width - const screenHeight = window.screen.height - - // 根据屏幕分辨率判断是否是手机 - if (screenWidth < 500 && screenHeight < 800) { - mobileFlag = true - } - return mobileFlag -}