更新文件相关接口超时时间、超时处理

This commit is contained in:
gtz217 2022-08-05 09:57:47 +08:00
parent 726f28caa3
commit 6e65dd1b8b
2 changed files with 19 additions and 10 deletions

View File

@ -2,7 +2,7 @@
* @Author: gtz
* @Date: 2022-07-28 10:22:30
* @LastEditors: gtz
* @LastEditTime: 2022-08-04 14:56:10
* @LastEditTime: 2022-08-05 09:55:48
* @Description: file content
* @FilePath: \hf-pda\src\pages\material\material-edit.vue
-->
@ -197,6 +197,7 @@ export default {
materialDateId: null,
materialDateName: null,
materialDateCode: null,
materialId: null,
materialName: null,
materialCode: null,
replaceTime: null,
@ -336,6 +337,7 @@ export default {
materialDateId: null,
materialDateName: null,
materialDateCode: null,
materialId: null,
materialName: null,
materialCode: null,
replaceTime: null,

View File

@ -2,7 +2,7 @@
* @Author: gtz
* @Date: 2022-07-25 14:18:00
* @LastEditors: gtz
* @LastEditTime: 2022-08-04 15:55:01
* @LastEditTime: 2022-08-05 09:56:34
* @Description: file content
* @FilePath: \hf-pda\src\util\request.js
*/
@ -19,11 +19,20 @@ let toast = null
// token加入header
service.interceptors.request.use((config) => {
// console.log(store.state)
toast = Toast.loading({
mask: true,
message: '加载中...',
duration: 5000
})
if (config.responseType) {
config.timeout = 15000
toast = Toast.loading({
mask: true,
message: '加载中...',
duration: 15000
})
} else {
toast = Toast.loading({
mask: true,
message: '加载中...',
duration: 5000
})
}
// if (config.url !== '/wms/login/verify' && JSON.parse(sessionStorage.getItem('userInfo')).token) {
// config.headers['token'] = JSON.parse(sessionStorage.getItem('userInfo')).token
// }
@ -77,9 +86,7 @@ service.interceptors.response.use(
error => {
toast.clear()
toast = null
if (error.response) {
Toast.fail('网络异常')
}
Toast.fail('网络超时')
return Promise.reject(error) // 返回接口返回的错误信息
// return Promise.reject(error.response.data) // 返回接口返回的错误信息
})