Commit c8e0704b authored by agping's avatar agping

修改

parent 68f0e92d
$(function(){ $(function() {
var _heightTemp = $(window).height(); var _heightTemp = $(window).height();
if(_heightTemp<680){ if(_heightTemp < 680) {
$('header,footer').addClass('small-screen'); $('header,footer').addClass('small-screen');
} }
$('.main-area').height(_heightTemp); $('.main-area').height(_heightTemp);
$(document.body).show();//页面显示出来 $(document.body).show(); //页面显示出来
//以上针对不同屏幕高度动态处理一些样式 //以上针对不同屏幕高度动态处理一些样式
var _loginBtn = $('#btn_login'), var _loginBtn = $('#btn_login'),
_loginTempBtn = $('#btn_login_temp'); _loginTempBtn = $('#btn_login_temp');
$('.input-area>input').focus(function(){ $('.input-area>input').focus(function() {
$(this).parent().addClass('input-area-active'); $(this).parent().addClass('input-area-active');
}).blur(function(){ }).blur(function() {
$(this).parent().removeClass('input-area-active'); $(this).parent().removeClass('input-area-active');
}); });
//回车按键 //回车按键
$(document).keypress(function(event){ $(document).keypress(function(event) {
var keynum = (event.keyCode ? event.keyCode : event.which); var keynum = (event.keyCode ? event.keyCode : event.which);
if(keynum == '13'){ if(keynum == '13') {
_loginBtn.click(); _loginBtn.click();
} }
}); });
_loginBtn.click(function(e){ _loginBtn.click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var _userName = $.trim($('#username').val()), var _userName = $.trim($('#username').val()),
_passWord = $.trim($('#passwd').val()); _passWord = $.trim($('#passwd').val());
if(_userName == ''){ if(_userName == '') {
alert('请输入用户名'); alert('请输入用户名');
return false; return false;
}; };
if(_passWord == ''){ if(_passWord == '') {
alert('请输入登录密码'); alert('请输入登录密码');
return false; return false;
}; };
var NV = {}; //登陆的时候 获取电脑端 浏览器的型号和版本信息
var UA = navigator.userAgent.toLowerCase(); var NV = {};
try { var UA = navigator.userAgent.toLowerCase();
NV.name = !-[1, ] ? 'ie' : try {
(UA.indexOf("firefox") > 0) ? 'firefox' : NV.name = !-[1, ] ? 'ie' :
(UA.indexOf("chrome") > 0) ? 'chrome' : (UA.indexOf("firefox") > 0) ? 'firefox' :
window.opera ? 'opera' : (UA.indexOf("chrome") > 0) ? 'chrome' :
window.openDatabase ? 'safari' : window.opera ? 'opera' :
'unkonw'; window.openDatabase ? 'safari' :
} catch(e) {}; 'unkonw';
try { } catch(e) {};
NV.version = (NV.name == 'ie') ? UA.match(/msie ([\d.]+)/)[1] : try {
(NV.name == 'firefox') ? UA.match(/firefox\/([\d.]+)/)[1] : NV.version = (NV.name == 'ie') ? UA.match(/msie ([\d.]+)/)[1] :
(NV.name == 'chrome') ? UA.match(/chrome\/([\d.]+)/)[1] : (NV.name == 'firefox') ? UA.match(/firefox\/([\d.]+)/)[1] :
(NV.name == 'opera') ? UA.match(/opera.([\d.]+)/)[1] : (NV.name == 'chrome') ? UA.match(/chrome\/([\d.]+)/)[1] :
(NV.name == 'safari') ? UA.match(/version\/([\d.]+)/)[1] : (NV.name == 'opera') ? UA.match(/opera.([\d.]+)/)[1] :
'0'; (NV.name == 'safari') ? UA.match(/version\/([\d.]+)/)[1] :
} catch(e) {}; '0';
try { } catch(e) {};
NV.shell = (UA.indexOf('360ee') > -1) ? '360极速浏览器' : try {
(UA.indexOf('360se') > -1) ? '360安全浏览器' : NV.shell = (UA.indexOf('360ee') > -1) ? '360极速浏览器' :
(UA.indexOf('qqbrowser') > -1) ? 'QQ浏览器' : (UA.indexOf('360se') > -1) ? '360安全浏览器' :
(UA.indexOf('se') > -1) ? '搜狗浏览器' : (UA.indexOf('qqbrowser') > -1) ? 'QQ浏览器' :
(UA.indexOf('aoyou') > -1) ? '遨游浏览器' : (UA.indexOf('se') > -1) ? '搜狗浏览器' :
(UA.indexOf('theworld') > -1) ? '世界之窗浏览器' : (UA.indexOf('aoyou') > -1) ? '遨游浏览器' :
(UA.indexOf('worldchrome') > -1) ? '世界之窗极速浏览器' : (UA.indexOf('theworld') > -1) ? '世界之窗浏览器' :
(UA.indexOf('greenbrowser') > -1) ? '绿色浏览器' : (UA.indexOf('worldchrome') > -1) ? '世界之窗极速浏览器' :
(UA.indexOf('baidu') > -1) ? '百度浏览器' : (UA.indexOf('greenbrowser') > -1) ? '绿色浏览器' :
NV.name; (UA.indexOf('baidu') > -1) ? '百度浏览器' :
} catch(e) {}; NV.name;
//判断 谷歌 360 application/vnd.chromium.remoting-viewer 可能为360特有 } catch(e) {};
if(NV.name=='chrome'){ //判断 谷歌 360 application/vnd.chromium.remoting-viewer 可能为360特有
var is360 = _mime("type", "application/vnd.chromium.remoting-viewer"); if(NV.name == 'chrome') {
if(isChrome() && is360) { var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
NV.shell='360浏览器' if(isChrome() && is360) {
} NV.shell = '360浏览器'
}
//检测是否是谷歌内核(可排除360及谷歌以外的浏览器) //检测是否是谷歌内核(可排除360及谷歌以外的浏览器)
function isChrome() { function isChrome() {
var ua = navigator.userAgent.toLowerCase(); var ua = navigator.userAgent.toLowerCase();
...@@ -89,49 +90,50 @@ $(function(){ ...@@ -89,49 +90,50 @@ $(function(){
return false; 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