소스 검색

修复商品信息异常时显示

Eratosici 3 년 전
부모
커밋
f89fd0922d
1개의 변경된 파일15개의 추가작업 그리고 2개의 파일을 삭제
  1. 15 2
      mall4uni/pages/prod/prod.vue

+ 15 - 2
mall4uni/pages/prod/prod.vue

@@ -376,7 +376,7 @@ export default {
     },
 
     /**
-     * 添加或者取消收藏商品 
+     * 添加或者取消收藏商品
      */
     addOrCannelCollection() {
       uni.showLoading();
@@ -405,6 +405,19 @@ export default {
 
         },
         callBack: res => {
+          if (!res) {
+            uni.hideLoading()
+            uni.showModal({
+              title: '提示',
+              content: '商品信息异常',
+              showCancel:  false,
+              confirmText: '确定',
+              success(res) {
+                // 返回上一页
+                uni.navigateBack()
+              }
+            });
+          }
           //console.log(res);
           var imgStrs = res.imgs;
           var imgs = imgStrs.split(",");
@@ -806,4 +819,4 @@ export default {
 </script>
 <style>
 @import "./prod.css";
-</style>
+</style>