diff --git a/src/components/GlobalFooter/index.less b/src/components/GlobalFooter/index.less index 2483aa3fac033199ef16a3d63069e0652115d75e..df711c0bd5d5f69fb20148f4535b52e1c79b5c5e 100644 --- a/src/components/GlobalFooter/index.less +++ b/src/components/GlobalFooter/index.less @@ -1,7 +1,8 @@ @import "~antd/lib/style/themes/default.less"; .globalFooter { - margin: 32px 28px 16px; + padding: 16px; + margin: 32px 0 16px 0; text-align: center; .links { diff --git a/src/utils/request.js b/src/utils/request.js index 4d62c87f1ce918cb627673637741dd253bf1948a..5bc56370d36479d0b7ac1752893b0e91b7943632 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,13 +1,28 @@ import fetch from 'dva/fetch'; +import { notification } from 'antd'; function checkStatus(response) { if (response.status >= 200 && response.status < 300) { return response; } - const error = new Error(response.statusText); - error.response = response; - throw error; + return response.json().then((result) => { + if (result.code) { + notification.error({ + message: result.name, + description: result.message, + }); + } + if (result.stack) { + notification.error({ + message: '请求错误', + description: result.message, + }); + } + const error = new Error(result.message); + error.response = response; + throw error; + }); } /**