[update] 移动端登录
This commit is contained in:
@@ -602,3 +602,28 @@ export function evil (fn) {
|
||||
const Fn = Function // 一个变量指向Function,防止有些前端编译工具报错
|
||||
return new Fn('return ' + fn)()
|
||||
}
|
||||
|
||||
// 判断当前设备
|
||||
export 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user