feat: 优化在微信小程序中接口返回的错误信息 会被uni.hideLoading取消展示错误信息问题

This commit is contained in:
学习很差啦
2023-04-11 18:41:34 +08:00
parent c070ed01f7
commit 2bdb8682e1
38 changed files with 70 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="wrapper">
<!-- 空白页-->
<view v-if="cartDetail.cartList == '' || cartDetail.cartList == [] || !cartDetail" class="empty">
<view v-if="!loading && (cartDetail.cartList == '' || cartDetail.cartList == [] || !cartDetail)" class="empty">
<image src="/static/emptyCart.png" mode="aspectFit"></image>
<view class="empty-tips">
空空如也
@@ -184,6 +184,7 @@ import { debounce } from "@/utils/tools.js";
export default {
data() {
return {
loading:false,
lightColor: this.$lightColor,
discountDetailsFlag: false, //优惠明细开关
// 商品栏右侧滑动按钮
@@ -508,6 +509,7 @@ export default {
});
API_Trade.getCarts()
.then((result) => {
this.loading = false;
uni.stopPullDownRefresh();
if (result.data.success) {
this.cartDetail = result.data.result;
@@ -541,10 +543,10 @@ export default {
uni.stopPullDownRefresh();
}
})
.catch((err) => {});
uni.hideLoading();
.catch((err) => {this.loading = false;});
if (this.$store.state.isShowToast){ uni.hideLoading() };
} else {
uni.hideLoading();
if (this.$store.state.isShowToast){ uni.hideLoading() };
}
},

View File

@@ -56,7 +56,7 @@
})
this.params.keyword = this.goods.goodsName;
getGoodsList(this.params).then(res => {
uni.hideLoading()
if (this.$store.state.isShowToast){ uni.hideLoading() }
if (res.statusCode == 200) {
let data = res.data;
if (data.data_total == 0) {