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

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

View File

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