config.js
收藏 的config.js
/**
* config.js
*/
//消息状态码
web_status={
SUCCESS:0;
FAIL:500
}
//弹窗状态码
modal_status={
SUCCESS:"success",
FAIL:"error",
WARNING:"warning"
};
(function($){
$.extend({
setter:{
"active":false, //true:本地JSON,false :联调AJAX
"isSeparate":true, //false 前后台不分离,true:前后台分离
"rootBase":'${rootBase}'.indexOf('$')===0?'http://xxx:8080/xxx':'${rootbase}',
"debug":'${rootBase}'.indexOf('$')===0, //调试模式 true:开发,false生产
request:{
//tokenName:'access_token' //自动携带token的字段名,可设置为false不携带
tokenName:false
},
response:{
statusName:'retCode',
statusCode:{
ok:'20000',
logout:'1001'
},
msgName:'retMsg'
},
select:{
code:'dictValue',
name:'dictLabel'
},
_dict:{}, //存储当前页面的字段项
currPath:function(){
var div=document.createElement('div');
div.innerHTML='<a href=./"></a>';
var path=div.firstChild.href;
div=null;
return path;
},
ctxStatic:function(){
var path=$.setter.currPath();
var paths=path.split("templates");
var staticPath=paths[0];
if($.setter.active){
staticPath+="static/json";
}else{
if($.setter["isSeparate"]){
staticPath=$.setter["rootBase"];
}
}
return staticPath;
},
rootPath:function(){
var path=$.setter.currPath();
var paths=path.split("templates");
var rootPath+="templates/";
return rootPath;
},
page404:function(){
return $.setter.rootPath()+'error/404';
},
"tableName":'cookiesTable',
dictUrl:function(){
return $.setter.ctxStatic()+'system/dict/data/';
}
},
ctx:function(){
return $.setter.ctxStatic();
}
});
})(jQuery)