var BaseConfig = {
Const: {
"STUDY_TIME":10
},
MediumType:{
".jpg|.gif|.png|.jpeg":"图片",
".doc|.docx|.xls|.xlsx|.ppt|.pptx|.pdf":"文档",
".wmv|.asf|.flv|.mp4|.rmvb":"视频"
},
browser: function () {
if (!+[1,]) {
return "IE";
}
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
//判断是否IE浏览器
var isOpera = userAgent.indexOf("Opera") > -1
//判断是否Opera浏览器
if (userAgent.indexOf("Opera") > -1) {
return "Opera"
}
;
if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
return "IE";
}
;
//判断是否Edge浏览器
if (userAgent.indexOf("Edge") > -1) {
return "Edge";
}
;
//判断是否Firefox浏览器
if (userAgent.indexOf("Firefox") > -1) {
return "FF";
}
//判断是否Chrome浏览器
if (userAgent.indexOf("Chrome") > -1) {
return "Chrome";
}
//判断是否Safari浏览器
if (userAgent.indexOf("Safari") > -1) {
return "Safari";
}
},
loginPersonInfo: function (data) {
var LoginPerson = null;
var params = $.extend({}, data)
return {
info: function (callback) {
callback = callback || new Function();
LoginPerson ? callback(LoginPerson) : $.ajax({
type: "GET",
url: url_path_html + "/getLoginPersonInfo",
data: params,
dataType: "json",
success: function (res) {
if (res.success) {
LoginPerson = res;
callback(LoginPerson);
}
}
})
},
isLogin: function(){
return !!$.cookie("person_id")
}
}
},
closeLayer: function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
},
layerError: function(msg, callback){
callback = callback || new Function();
top.layer.msg(msg, {time:1000, icon:5, offset:['100px']}, callback);
},
layerSuccess: function(msg, callback){
callback = callback || new Function();
top.layer.msg(msg, {time:1000, icon:1, offset:['100px']}, callback);
},
isCallBack: function(callback){
return callback && $.isFunction(callback);
}
}
loginPersonInfo 的调用方法例子:
var LoginPerson = BaseConfig.loginPersonInfo();
LoginPerson.isLogin() ? LoginPerson.info(function(personInfo){
//业务处理
toPage(1);
}): toPage(1);