暂时保存下代码1
function errorHandler(response, ignoreError)
{
var regJsonIndex = /^\[.*?\]$/;
var regJsonAssoc = /^\{.*?\}$/;
if('object' == typeof(response) || regJsonIndex.test(response) || regJsonAssoc.test(response))
{
var dataObject = null;
if('object' == typeof(response))
{
dataObject = response;
}else
{
//dataObject = JSON.parse(response);
var dataObject = eval('('+response+')');
}
if(0 < dataObject['code'] && 'undefined'==typeof(ignoreError))
{
$.messager.alert('错误(' + dataObject['code'] + ')', dataObject['message']);
switch(dataObject['code'])
{
case 1:
case 2:
case 3:
case 4:
case 5:
}
}
if('undefined' == typeof(dataObject['data']))
{
dataObject['data'] = null;
}
return dataObject;
}else
{
return {'code': 0, 'message': '', 'data': response};
}
}