| | |
| | | // 全局未授权错误提示状态,只提示一次 |
| | | let isErrorShown = false; |
| | | |
| | | axios.defaults.timeout = 10000; |
| | | // 超时时间设置为10分钟,部分接口上传比较慢,如固件上传 |
| | | axios.defaults.timeout = 600000; |
| | | //返回其他状态码 |
| | | axios.defaults.validateStatus = function (status) { |
| | | return status >= 200 && status <= 500; // 默认的 |
| | |
| | | : 'bearer ' + token; |
| | | } |
| | | // 开启报文加密 |
| | | if (cryptoData) { |
| | | if (config.params) { |
| | | const data = crypto.encryptAES(JSON.stringify(config.params), crypto.aesKey); |
| | | config.params = { data }; |
| | | } |
| | | if (config.data) { |
| | | config.text = true; |
| | | config.data = crypto.encryptAES(JSON.stringify(config.data), crypto.aesKey); |
| | | } |
| | | } |
| | | // if (cryptoData) { |
| | | // if (config.params) { |
| | | // const data = crypto.encryptAES(JSON.stringify(config.params), crypto.aesKey); |
| | | // config.params = { data }; |
| | | // } |
| | | // if (config.data) { |
| | | // config.text = true; |
| | | // config.data = crypto.encryptAES(JSON.stringify(config.data), crypto.aesKey); |
| | | // } |
| | | // } |
| | | //headers中配置text请求 |
| | | if (config.text === true) { |
| | | config.headers['Content-Type'] = 'text/plain'; |