Sfoglia il codice sorgente

app-我的钱包-增加数据异常加载提示处理

@dongkboy 1 settimana fa
parent
commit
0dc49437ec
1 ha cambiato i file con 20 aggiunte e 4 eliminazioni
  1. 20 4
      pages/wallet/myWallet.vue

+ 20 - 4
pages/wallet/myWallet.vue

@@ -166,6 +166,8 @@
 				</view>
 			</template>
 		</uni-PopupMessage>
+		<!-- 自定义加载动画 -->
+		<global-loading :show="loadingShow" :text="loadingText"></global-loading>
 	</view>
 </template>
 
@@ -177,6 +179,8 @@
 	export default {
 		data() {
 			return {
+				loadingShow: false,
+				loadingText: '数据加载中',
 				deleteShow: false, //
 				defaultCard: false, // 控制默认银行卡的单选状态
 				currentTab: 1, // 当前激活的选项卡索引
@@ -276,11 +280,23 @@
 			...mapState(['userInfo']),
 		},
 		async onShow() {
-			let res = await this.$http.get('/userAccount/userWallet'); //获取钱包信息
-			if (res.code == '200') {
-				this.walletInfo = res.data;
+			this.loadingShow = true;
+			try {
+				let res = await this.$http.get('/userAccount/userWallet'); //获取钱包信息
+				if (res.code == '200') {
+					this.walletInfo = res.data;
+				} else {
+					uni.showToast({
+						icon: 'none',
+						title: res.msg,
+					})
+				}
+				await this.getcardPack();
+				this.loadingShow = false;
+			} catch {
+				this.loadingShow = false;
 			}
-			await this.getcardPack();
+
 		},
 		async onLoad(options) {
 			if (options) {