// 创建axios实例 const $ajax = axios.create({ // 定义请求全局地址前缀 baseurl: '../', // 定义请求超时时间 timeout: 600000, // 跨域请求时是否需要凭证 withcredentials: false, // 定义消息头 headers: {'x-requested-with': 'xmlhttprequest'} }); // 空值判断 function isnull(obj){ return obj == null || obj == "" || typeof(obj) == "undefined"; } // 非空判断 function isnotnull(obj){ return obj != null && obj != "" && typeof(obj) != "undefined"; } // 判断字符串为空 function isemptycommon(str) { if(str == null || typeof(str) == "undefined"){ return true; } // 变量转字符串 str = string(str); if(str == "0"){ return false; } if(!str){ return true; } return str == null || str == "" || typeof(str) == "undefined"; } // 判断字符串不为空 function isnotemptycommon(str) { if(str == null || typeof(str) == "undefined"){ return false; } // 变量转字符串 str = string(str); if(str == "0"){ return true; } if(!str){ return false; } return str != null && str != "" && typeof(str) != "undefined"; }