fix: 添加图片上传失败的错误处理
在注册、编辑资料、车辆认证和出售页面中,为图片上传功能添加失败时的错误提示处理,显示错误信息并隐藏加载状态
Showing
4 changed files
with
45 additions
and
1 deletions
| ... | @@ -296,6 +296,17 @@ const uploadImage = (filePath) => { | ... | @@ -296,6 +296,17 @@ const uploadImage = (filePath) => { |
| 296 | } | 296 | } |
| 297 | }, | 297 | }, |
| 298 | }); | 298 | }); |
| 299 | + }, | ||
| 300 | + fail: function (res) { | ||
| 301 | + Taro.hideLoading({ | ||
| 302 | + success: () => { | ||
| 303 | + Taro.showToast({ | ||
| 304 | + icon: 'error', | ||
| 305 | + title: '上传失败,稍后重试!', | ||
| 306 | + mask: true | ||
| 307 | + }) | ||
| 308 | + } | ||
| 309 | + }) | ||
| 299 | } | 310 | } |
| 300 | }); | 311 | }); |
| 301 | } | 312 | } | ... | ... |
| ... | @@ -274,6 +274,17 @@ const uploadImage = (filePath) => { | ... | @@ -274,6 +274,17 @@ const uploadImage = (filePath) => { |
| 274 | } | 274 | } |
| 275 | }, | 275 | }, |
| 276 | }); | 276 | }); |
| 277 | + }, | ||
| 278 | + fail: function (res) { | ||
| 279 | + Taro.hideLoading({ | ||
| 280 | + success: () => { | ||
| 281 | + Taro.showToast({ | ||
| 282 | + icon: 'error', | ||
| 283 | + title: '上传失败,稍后重试!', | ||
| 284 | + mask: true | ||
| 285 | + }) | ||
| 286 | + } | ||
| 287 | + }) | ||
| 277 | } | 288 | } |
| 278 | }); | 289 | }); |
| 279 | } | 290 | } | ... | ... |
| ... | @@ -505,8 +505,19 @@ const uploadImage = (filePath, type) => { | ... | @@ -505,8 +505,19 @@ const uploadImage = (filePath, type) => { |
| 505 | mask: true | 505 | mask: true |
| 506 | }) | 506 | }) |
| 507 | } | 507 | } |
| 508 | - }, | 508 | + } |
| 509 | }); | 509 | }); |
| 510 | + }, | ||
| 511 | + fail: function (res) { | ||
| 512 | + Taro.hideLoading({ | ||
| 513 | + success: () => { | ||
| 514 | + Taro.showToast({ | ||
| 515 | + icon: 'error', | ||
| 516 | + title: '上传失败,稍后重试!', | ||
| 517 | + mask: true | ||
| 518 | + }) | ||
| 519 | + } | ||
| 520 | + }) | ||
| 510 | } | 521 | } |
| 511 | }); | 522 | }); |
| 512 | } | 523 | } | ... | ... |
| ... | @@ -287,6 +287,17 @@ const uploadImage = (filePath, type) => { | ... | @@ -287,6 +287,17 @@ const uploadImage = (filePath, type) => { |
| 287 | } | 287 | } |
| 288 | }, | 288 | }, |
| 289 | }); | 289 | }); |
| 290 | + }, | ||
| 291 | + fail: function (res) { | ||
| 292 | + Taro.hideLoading({ | ||
| 293 | + success: () => { | ||
| 294 | + Taro.showToast({ | ||
| 295 | + icon: 'error', | ||
| 296 | + title: '上传失败,稍后重试!', | ||
| 297 | + mask: true | ||
| 298 | + }) | ||
| 299 | + } | ||
| 300 | + }) | ||
| 290 | } | 301 | } |
| 291 | }); | 302 | }); |
| 292 | } | 303 | } | ... | ... |
-
Please register or login to post a comment