|
|
@ -22,15 +22,36 @@ export default class ApiClient { |
|
|
|
data: params |
|
|
|
}); |
|
|
|
if ( !response.data.success ) { |
|
|
|
let errorInfo = response.data.ecode; |
|
|
|
delete errorInfo.codeChName; |
|
|
|
let content = h('div', {}, [ |
|
|
|
h('p',{class:'mb-5 text-red-400'},response.data.message), |
|
|
|
h('pre', JSON.stringify(response.data.ecode, null, 2)), |
|
|
|
h('pre', {class:'overflow-auto h-96 mt-5'}, response.data.traceInfo), |
|
|
|
h('p',{class:'mb-5 text-red-400 white-space-pre'},response.data.message), |
|
|
|
h('div', { |
|
|
|
style:{height:'20px',overflow:'hidden'}, |
|
|
|
onClick:(event) => { |
|
|
|
let elem = event.target.parentElement; |
|
|
|
if ( '20px' === elem.style.height ) { |
|
|
|
elem.style.height = '600px'; |
|
|
|
elem.style.overflow = 'auto'; |
|
|
|
} else { |
|
|
|
elem.style.height = '20px'; |
|
|
|
elem.scrollTop = 0; |
|
|
|
elem.style.overflow = 'hidden'; |
|
|
|
} |
|
|
|
} |
|
|
|
}, [ |
|
|
|
h('div','详情'), |
|
|
|
h('pre', JSON.stringify(errorInfo, null, 2)), |
|
|
|
h('pre', {class:'overflow-auto h-96 mt-5'}, response.data.traceInfo), |
|
|
|
]), |
|
|
|
]); |
|
|
|
Modal.error({title: '请求错误',content:content,width:800}); |
|
|
|
throw new Error(`API【${name}】调用失败 : ${response.data}`); |
|
|
|
} |
|
|
|
if ( 'object' === typeof(response.data.data) ) { |
|
|
|
if ( 'MESSAGE' === response.data.appRetType ) { |
|
|
|
Modal.info({title:'通知', contnet:response.data.message}); |
|
|
|
} |
|
|
|
if ( null !== response.data.data && 'object' === typeof(response.data.data) ) { |
|
|
|
response.data.data.$dataType = response.data.dataType; |
|
|
|
} |
|
|
|
return response.data.data; |
|
|
|