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 -}