2022-10-09 10:07:24 +08:00
|
|
|
|
function judgeAgent() {
|
|
|
|
|
let userAgent = navigator.userAgent // 取得浏览器的userAgent字符串
|
|
|
|
|
console.log('userAgent------------>', userAgent)
|
|
|
|
|
let isOpera = userAgent.indexOf('Opera') > -1
|
|
|
|
|
//判断是否Opera浏览器
|
|
|
|
|
if (isOpera) {
|
|
|
|
|
return 'Opera'
|
|
|
|
|
}
|
|
|
|
|
//判断是否Firefox浏览器
|
|
|
|
|
if (userAgent.indexOf('Firefox') > -1) {
|
|
|
|
|
return 'FF'
|
|
|
|
|
}
|
|
|
|
|
//判断是否chorme浏览器
|
|
|
|
|
if (userAgent.indexOf('Chrome') > -1) {
|
|
|
|
|
return 'Chrome'
|
|
|
|
|
}
|
|
|
|
|
//判断是否Safari浏览器
|
|
|
|
|
if (userAgent.indexOf('Safari') > -1) {
|
|
|
|
|
return 'Safari'
|
|
|
|
|
}
|
|
|
|
|
//判断是否IE浏览器
|
|
|
|
|
if (
|
|
|
|
|
userAgent.indexOf('compatible') > -1 &&
|
|
|
|
|
userAgent.indexOf('MSIE') > -1 &&
|
|
|
|
|
!isOpera
|
|
|
|
|
) {
|
|
|
|
|
return 'IE'
|
|
|
|
|
}
|
|
|
|
|
//判断是否Edge浏览器
|
|
|
|
|
if (userAgent.indexOf('Trident') > -1) {
|
|
|
|
|
return 'Edge'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function downloadFile(name, url) {
|
|
|
|
|
const alink = document.createElement('a')
|
|
|
|
|
alink.download = name // 文件名,大部分浏览器兼容,IE10及以下不兼容
|
|
|
|
|
alink.href = url // 创建 url地址
|
|
|
|
|
alink.click() // 自动点击
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPCNum() {
|
|
|
|
|
const agent = navigator.userAgent.toLowerCase()
|
|
|
|
|
if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
|
|
|
|
|
return 32
|
|
|
|
|
}
|
|
|
|
|
if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
|
|
|
|
|
return 64
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('------判断浏览器------>', judgeAgent())
|
|
|
|
|
|
|
|
|
|
var ModelBox = (function() {
|
|
|
|
|
var ModelBox = function(option) {
|
|
|
|
|
this.option = option || {}
|
|
|
|
|
console.log(999, 'init')
|
|
|
|
|
this.init()
|
|
|
|
|
}
|
|
|
|
|
ModelBox.prototype = {
|
|
|
|
|
isShow: false,
|
|
|
|
|
init: function() {
|
|
|
|
|
var _this = this
|
|
|
|
|
_this.isShow = this.option.isShow
|
|
|
|
|
var html =
|
|
|
|
|
'<div class="model-container">' +
|
2022-10-19 11:48:31 +08:00
|
|
|
|
'<div class="model-title">' +
|
|
|
|
|
'<span class="title-span">title</span>' +
|
|
|
|
|
'<div class="model-close"></div>' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'<div class="model-content">content</div>' +
|
2022-10-09 10:07:24 +08:00
|
|
|
|
'<div class="controls">' +
|
2022-10-19 11:48:31 +08:00
|
|
|
|
'<a class="confirmChrome">下载谷歌浏览器</a>' +
|
|
|
|
|
'<a class="confirm360">下载360浏览器</a>' +
|
2022-10-09 10:07:24 +08:00
|
|
|
|
'</div>' +
|
|
|
|
|
'</div>'
|
|
|
|
|
var ModelBoxCon = document.createElement('div')
|
|
|
|
|
ModelBoxCon.setAttribute('class', 'mask-layer')
|
|
|
|
|
ModelBoxCon.innerHTML = html
|
2022-10-19 11:48:31 +08:00
|
|
|
|
// ModelBoxCon.querySelector('.model-title').innerHTML =
|
|
|
|
|
// _this.option.title
|
|
|
|
|
ModelBoxCon.querySelector('.title-span').innerHTML =
|
2022-10-09 10:07:24 +08:00
|
|
|
|
_this.option.title
|
|
|
|
|
ModelBoxCon.querySelector('.model-content').innerHTML =
|
|
|
|
|
_this.option.content
|
|
|
|
|
document.getElementsByTagName('html')[0].appendChild(ModelBoxCon)
|
|
|
|
|
if (!_this.isShow) {
|
|
|
|
|
ModelBoxCon.style.display = 'none'
|
|
|
|
|
}
|
2022-10-19 11:48:31 +08:00
|
|
|
|
ModelBoxCon.querySelector('.model-close').onclick =
|
|
|
|
|
ModelBoxCon.querySelector('.confirmChrome').onclick =
|
|
|
|
|
ModelBoxCon.querySelector('.confirm360').onclick =
|
2022-10-09 10:07:24 +08:00
|
|
|
|
_this.eventsFn.bind('', this, ModelBoxCon)
|
|
|
|
|
},
|
|
|
|
|
show: function() {
|
|
|
|
|
document.querySelector('.mask-layer').style.display = 'block'
|
|
|
|
|
this.isShow = true
|
|
|
|
|
},
|
|
|
|
|
hide: function() {
|
|
|
|
|
document.querySelector('.mask-layer').style.display = 'none'
|
|
|
|
|
this.isShow = false
|
|
|
|
|
},
|
|
|
|
|
eventsFn: function(e, doc, target) {
|
2022-10-19 11:48:31 +08:00
|
|
|
|
debugger
|
2022-10-09 10:07:24 +08:00
|
|
|
|
var _thisEvent = target.target
|
2022-10-19 11:48:31 +08:00
|
|
|
|
if (_thisEvent.classList.contains('confirmChrome')) {
|
|
|
|
|
e.option.confirmCallBack('Chrome')
|
|
|
|
|
|
|
|
|
|
} else if (_thisEvent.classList.contains('confirm360')) {
|
|
|
|
|
e.option.confirmCallBack('360')
|
2022-10-09 10:07:24 +08:00
|
|
|
|
}
|
|
|
|
|
doc.style.display = 'none'
|
|
|
|
|
e.isShow = false
|
|
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
} || {}
|
|
|
|
|
return ModelBox
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
var opt = new ModelBox({
|
2022-10-19 11:48:31 +08:00
|
|
|
|
title: '提示信息',
|
|
|
|
|
content: '平台暂不支持IE内核浏览器访问,建议使用谷歌(Chrome)或360浏览器极速模式登录!',
|
2022-10-09 10:07:24 +08:00
|
|
|
|
isShow: false,
|
2022-10-19 11:48:31 +08:00
|
|
|
|
confirmCallBack: function(data) {
|
|
|
|
|
debugger
|
2022-10-09 10:07:24 +08:00
|
|
|
|
// 获取当前系统的方法
|
|
|
|
|
const agent = getPCNum()
|
2022-10-19 11:48:31 +08:00
|
|
|
|
//console.log('agent------------>', agent)
|
|
|
|
|
//console.log('datadatadatadata----------->', data)
|
|
|
|
|
if (data === 'Chrome') {
|
|
|
|
|
if (agent == 64) {
|
|
|
|
|
// 64位操作系统
|
|
|
|
|
downloadFile(
|
|
|
|
|
'ChromeStandaloneSetup64.exe',
|
|
|
|
|
'/static/download/ChromeStandaloneSetup64.exe'
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
// 32位操作系统
|
|
|
|
|
downloadFile(
|
|
|
|
|
'ChromeStandalonesetup32.exe',
|
|
|
|
|
'/static/download/standalonesetup32.exe'
|
|
|
|
|
)
|
|
|
|
|
}
|
2022-10-09 10:07:24 +08:00
|
|
|
|
} else {
|
2022-10-19 11:48:31 +08:00
|
|
|
|
if (agent == 64) {
|
|
|
|
|
// 64位操作系统
|
|
|
|
|
downloadFile(
|
|
|
|
|
'360se13.1.6260.0.exe',
|
|
|
|
|
'/static/download/360se13.1.6260.0.exe'
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
// 32位操作系统
|
|
|
|
|
downloadFile(
|
|
|
|
|
'360se13.1.6110.0.exe',
|
|
|
|
|
'/static/download/360se13.1.6110.0.exe'
|
|
|
|
|
)
|
|
|
|
|
}
|
2022-10-09 10:07:24 +08:00
|
|
|
|
}
|
2022-10-19 11:48:31 +08:00
|
|
|
|
|
2022-10-09 10:07:24 +08:00
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 提示下载谷歌
|
|
|
|
|
if (judgeAgent() !== 'Chrome') {
|
|
|
|
|
//alert('哈哈哈不支持')
|
|
|
|
|
opt.show()
|
|
|
|
|
}
|