Commit c8e0704b authored by agping's avatar agping

修改

parent 68f0e92d
$(function(){
$(function() {
var _heightTemp = $(window).height();
if(_heightTemp<680){
if(_heightTemp < 680) {
$('header,footer').addClass('small-screen');
}
$('.main-area').height(_heightTemp);
$(document.body).show();//页面显示出来
$(document.body).show(); //页面显示出来
//以上针对不同屏幕高度动态处理一些样式
var _loginBtn = $('#btn_login'),
_loginTempBtn = $('#btn_login_temp');
$('.input-area>input').focus(function(){
$(this).parent().addClass('input-area-active');
}).blur(function(){
$(this).parent().removeClass('input-area-active');
});
$('.input-area>input').focus(function() {
$(this).parent().addClass('input-area-active');
}).blur(function() {
$(this).parent().removeClass('input-area-active');
});
//回车按键
$(document).keypress(function(event){
var keynum = (event.keyCode ? event.keyCode : event.which);
if(keynum == '13'){
_loginBtn.click();
}
});
//回车按键
$(document).keypress(function(event) {
var keynum = (event.keyCode ? event.keyCode : event.which);
if(keynum == '13') {
_loginBtn.click();
}
});
_loginBtn.click(function(e){
e.preventDefault();
e.stopPropagation();
var _userName = $.trim($('#username').val()),
_passWord = $.trim($('#passwd').val());
if(_userName == ''){
alert('请输入用户名');
return false;
};
if(_passWord == ''){
alert('请输入登录密码');
return false;
};
var NV = {};
var UA = navigator.userAgent.toLowerCase();
try {
NV.name = !-[1, ] ? 'ie' :
(UA.indexOf("firefox") > 0) ? 'firefox' :
(UA.indexOf("chrome") > 0) ? 'chrome' :
window.opera ? 'opera' :
window.openDatabase ? 'safari' :
'unkonw';
} catch(e) {};
try {
NV.version = (NV.name == 'ie') ? UA.match(/msie ([\d.]+)/)[1] :
(NV.name == 'firefox') ? UA.match(/firefox\/([\d.]+)/)[1] :
(NV.name == 'chrome') ? UA.match(/chrome\/([\d.]+)/)[1] :
(NV.name == 'opera') ? UA.match(/opera.([\d.]+)/)[1] :
(NV.name == 'safari') ? UA.match(/version\/([\d.]+)/)[1] :
'0';
} catch(e) {};
try {
NV.shell = (UA.indexOf('360ee') > -1) ? '360极速浏览器' :
(UA.indexOf('360se') > -1) ? '360安全浏览器' :
(UA.indexOf('qqbrowser') > -1) ? 'QQ浏览器' :
(UA.indexOf('se') > -1) ? '搜狗浏览器' :
(UA.indexOf('aoyou') > -1) ? '遨游浏览器' :
(UA.indexOf('theworld') > -1) ? '世界之窗浏览器' :
(UA.indexOf('worldchrome') > -1) ? '世界之窗极速浏览器' :
(UA.indexOf('greenbrowser') > -1) ? '绿色浏览器' :
(UA.indexOf('baidu') > -1) ? '百度浏览器' :
NV.name;
} catch(e) {};
//判断 谷歌 360 application/vnd.chromium.remoting-viewer 可能为360特有
if(NV.name=='chrome'){
var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
if(isChrome() && is360) {
NV.shell='360浏览器'
}
_loginBtn.click(function(e) {
e.preventDefault();
e.stopPropagation();
var _userName = $.trim($('#username').val()),
_passWord = $.trim($('#passwd').val());
if(_userName == '') {
alert('请输入用户名');
return false;
};
if(_passWord == '') {
alert('请输入登录密码');
return false;
};
//登陆的时候 获取电脑端 浏览器的型号和版本信息
var NV = {};
var UA = navigator.userAgent.toLowerCase();
try {
NV.name = !-[1, ] ? 'ie' :
(UA.indexOf("firefox") > 0) ? 'firefox' :
(UA.indexOf("chrome") > 0) ? 'chrome' :
window.opera ? 'opera' :
window.openDatabase ? 'safari' :
'unkonw';
} catch(e) {};
try {
NV.version = (NV.name == 'ie') ? UA.match(/msie ([\d.]+)/)[1] :
(NV.name == 'firefox') ? UA.match(/firefox\/([\d.]+)/)[1] :
(NV.name == 'chrome') ? UA.match(/chrome\/([\d.]+)/)[1] :
(NV.name == 'opera') ? UA.match(/opera.([\d.]+)/)[1] :
(NV.name == 'safari') ? UA.match(/version\/([\d.]+)/)[1] :
'0';
} catch(e) {};
try {
NV.shell = (UA.indexOf('360ee') > -1) ? '360极速浏览器' :
(UA.indexOf('360se') > -1) ? '360安全浏览器' :
(UA.indexOf('qqbrowser') > -1) ? 'QQ浏览器' :
(UA.indexOf('se') > -1) ? '搜狗浏览器' :
(UA.indexOf('aoyou') > -1) ? '遨游浏览器' :
(UA.indexOf('theworld') > -1) ? '世界之窗浏览器' :
(UA.indexOf('worldchrome') > -1) ? '世界之窗极速浏览器' :
(UA.indexOf('greenbrowser') > -1) ? '绿色浏览器' :
(UA.indexOf('baidu') > -1) ? '百度浏览器' :
NV.name;
} catch(e) {};
//判断 谷歌 360 application/vnd.chromium.remoting-viewer 可能为360特有
if(NV.name == 'chrome') {
var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
if(isChrome() && is360) {
NV.shell = '360浏览器'
}
//检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
function isChrome() {
var ua = navigator.userAgent.toLowerCase();
......@@ -89,49 +90,50 @@ $(function(){
return false;
}
}
// alert('浏览器UA=' + UA +
// '\n\n浏览器名称=' + NV.name +
// '\n\n浏览器版本=' + NV.version +
// //'\n\n浏览器版本='+parseInt(NV.version)+
// '\n\n浏览器外壳=' + NV.shell);
var browser_version = NV.shell + '/' + NV.version;
console.log(browser_version);
$.ajax({
type: 'POST',
url: '/admin.php/index/loginVerify',
data: {
'username': _userName,
'password': _passWord,
'model': browser_version
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {
_loginBtn.hide();
_loginTempBtn.show();
},
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
localStorage.setItem('pcUserInfo', encodeURIComponent(JSON.stringify(data.data))); //存储PC后台登录用户所有信息
location.href = '/admin.php/index/getHouseList';
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus) {
_loginTempBtn.hide();
_loginBtn.show();
if(textStatus === 'timeout') {
alert('请求超时');
};
}
// alert('浏览器UA=' + UA +
// '\n\n浏览器名称=' + NV.name +
// '\n\n浏览器版本=' + NV.version +
// //'\n\n浏览器版本='+parseInt(NV.version)+
// '\n\n浏览器外壳=' + NV.shell);
var browser_version=NV.shell+'/'+NV.version;
$.ajax({
type: 'POST',
url: '/admin.php/index/loginVerify',
data: {
'username': _userName,
'password': _passWord,
'model':browser_version
},
timeout: 30000,
dataType: 'json',
beforeSend: function() {
_loginBtn.hide();
_loginTempBtn.show();
},
success: function(data) {
if(typeof data === 'object') {
if (data.code == 200) {
localStorage.setItem('pcUserInfo',encodeURIComponent(JSON.stringify(data.data)));//存储PC后台登录用户所有信息
location.href = '/admin.php/index/getHouseList';
}else {
alert(data['msg']);
};
}else{
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus){
_loginTempBtn.hide();
_loginBtn.show();
if(textStatus === 'timeout'){
alert('请求超时');
};
}
});
})
});
})
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment