Browse Source

Merge branch 'feature/liuxuqing' into develop

Chris 6 years ago
parent
commit
586e68d9f3

+ 34 - 2
RainbowPlanet/RainbowPlanet/Modules/OrderModule/OrderComment/ViewController/OrderCommentController.swift

@@ -12,6 +12,9 @@ import SwiftyJSON
 
 class OrderCommentController: BaseViewController {
     
+    typealias CommentSuccessedBlock = () -> Void
+    var commentSuccessedBlock : CommentSuccessedBlock?
+    
     var orderDetailModel: OrderModel? {
         didSet {
             self.productArr = self.orderDetailModel?.detail
@@ -177,6 +180,15 @@ extension OrderCommentController {
 //            }
         }
         
+        DispatchQueue.global(qos: .userInitiated).async {
+            self.uploadImages()
+        }
+        
+        self.productAddCommentApi()
+    }
+    
+    func uploadImages() {
+        print("----开始上传流程")
         // 上传全部商品图片
         for (idx, productMdl) in (productArr?.enumerated())! {
             let curImageArr = productArr![idx].imageArr
@@ -190,17 +202,37 @@ extension OrderCommentController {
             SwiftMoyaNetWorkServiceConfig.shared().configUploadMultiImgApi(imageArray: curImageArr) { (imgUrlArr) -> (Void) in
                 let imgJsonStr = JSON(imgUrlArr).description
                 productMdl.imageArrUrlStr = imgJsonStr
+                NXLLog("----signal\(idx)")
                 sema.signal()
             }
             //异步调用返回前,就会一直阻塞在这
+            NXLLog("----wait\(idx)")
             sema.wait()
         }
-        
-        self.productAddCommentApi()
     }
     
     func productAddCommentApi() {
+        print("----评价流程")
+        return
+        
+        let paraMdl = OrderCommentParameterModel()
+        paraMdl.purchase_id = orderDetailModel?.id
+        paraMdl.purchase_no = orderDetailModel?.purchaseNo
+        paraMdl.shop_id = orderDetailModel?.shopId
+        paraMdl.shop_name = orderDetailModel?.shopName
+        
+        let userModel = UserModel.shared().getModel()
+        paraMdl.username = userModel?.username
+        paraMdl.avatar = userModel?.avatarurl
         
+        paraMdl.cmtProductArr = productArr
+        
+        // 新增评价Api
+        SwiftMoyaNetWorkServiceProduct.shared().productAddCommentApi(paraMdl: paraMdl) { (data) -> (Void) in
+            if let commentSuccessedBlock = self.commentSuccessedBlock {
+                commentSuccessedBlock()
+            }
+        }
     }
     
 }

+ 1 - 13
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartHotSale/ShoppingCartHotSaleTableViewCell.swift

@@ -20,18 +20,6 @@ class ShoppingCartHotSaleTableViewCell: UITableViewCell {
         }
     }
     
-    override var frame: CGRect {
-        get {
-            return super.frame
-        }
-        set {
-            var frame = newValue
-            frame.origin.x += 14 * kScaleWidth
-            frame.size.width -= 14 * kScaleWidth * 2
-            super.frame = frame
-        }
-    }
-    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ShoppingCartHotSaleTableViewCell {
         let ID = "ShoppingCartHotSaleTableViewCell"
         tableView.register(ShoppingCartHotSaleTableViewCell.self, forCellReuseIdentifier: ID)
@@ -186,7 +174,7 @@ extension ShoppingCartHotSaleTableViewCell: UICollectionViewDelegateFlowLayout,U
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
-        return UIEdgeInsets(top: 10, left: 0, bottom: 20, right: 0)
+        return UIEdgeInsets(top: 10, left: 14 * kScaleWidth, bottom: 20, right: 14 * kScaleWidth)
     }
     
 }

+ 20 - 10
RainbowPlanet/RainbowPlanet/Modules/ShoppingCartModule/ShoppingCart/View/ShoppingCartView.swift

@@ -72,17 +72,25 @@ class ShoppingCartView: BaseView {
     func updateAccountViewCondition() {
         if cartListModelArr?.isEmpty ?? true {
             accountView.isHidden = true
-            accountView.snp_updateConstraints { (make) in
-                accountView.snp_updateConstraints { (make) in
-                    make.height.equalTo(0)
-                }
+            
+            accountView.snp.remakeConstraints { (make) in
+                make.left.right.bottom.equalToSuperview()
+                make.height.equalTo(0)
+            }
+            tableView.snp.remakeConstraints { (make) in
+                make.edges.equalToSuperview()
+//                make.bottom.equalTo(accountView.snp_top).offset(0)
             }
         } else {
             accountView.isHidden = false
-            accountView.snp_updateConstraints { (make) in
-                accountView.snp_updateConstraints { (make) in
-                    make.height.equalTo(48)
-                }
+            
+            accountView.snp.remakeConstraints { (make) in
+                make.left.right.bottom.equalToSuperview()
+                make.height.equalTo(48)
+            }
+            tableView.snp.remakeConstraints { (make) in
+                make.top.left.right.equalToSuperview()
+                make.bottom.equalTo(accountView.snp_top).offset(0)
             }
         }
     }
@@ -145,11 +153,12 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
             case 0:
                 // 购物车列表为空
                 let cell = ShoppingCartListNoneItemCell.cellWith(tableView: tableView, indexPath: indexPath)
+                 cell.frame = tableView.bounds
                 return cell
             case 1:
                 // 超值热卖
                 let hotSaleCell = ShoppingCartHotSaleTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-                hotSaleCell.frame = tableView.bounds
+//                hotSaleCell.frame = tableView.bounds
                 hotSaleCell.hotSaleModelArr = hotSaleModelArr
                 hotSaleCell.layoutIfNeeded()
                 hotSaleCell.reloadData()
@@ -168,6 +177,7 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
             if indexPath.section < cartListModelArr!.count {
                 // 购物车列表Item
                 let cell = ShoppingCartListTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
+                cell.frame = tableView.bounds
                 cell.productMdl = cartListModelArr![indexPath.section].productList![indexPath.row]
                 
                 cell.productSelBlock = { [weak self]
@@ -194,7 +204,7 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
             } else {
                 // 超值热卖
                 let hotSaleCell = ShoppingCartHotSaleTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
-                hotSaleCell.frame = tableView.bounds
+//                hotSaleCell.frame = tableView.bounds
                 hotSaleCell.hotSaleModelArr = hotSaleModelArr
                 hotSaleCell.layoutIfNeeded()
                 hotSaleCell.reloadData()