浏览代码

修复商品信息异常时显示

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>