Commit 50ede8bb6641d97030b93c2fc04a2dc6f3937b1c

Authored by 张旭
1 parent 371cf857

编辑显示数据异常问题

metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift
... ... @@ -147,12 +147,15 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
147 147 }
148 148  
149 149 func initBgScrollViewContentView(){
  150 +
  151 + self.dataModel.initDataSource()
150 152 if self.type == .edit{
151   - var tempArray = Array(self.dataModel.list)
152   - tempArray.removeSubrange(self.dataModel.list.count - 3..<3)
153   - self.dataModel.list = tempArray
  153 + if self.dataModel.list.count > 3{
  154 + var tempArray = Array(self.dataModel.list)
  155 + tempArray.removeSubrange(Range(NSRange(location: self.dataModel.list.count - 3, length: 3))!)
  156 + self.dataModel.list = tempArray
  157 + }
154 158 }
155   - self.dataModel.initDataSource()
156 159 for i in 0..<self.dataModel.list.count {
157 160 let model = self.dataModel.list[i]
158 161 let singleView = CNLiveShopAddGoodsSingleView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: 50), model: model)
... ... @@ -542,7 +545,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
542 545 showMessage(message: "请输入发货时效")
543 546 return
544 547 }
545   - var kvArray = Array<Dictionary<String, String>>()// NSMutableArray()
  548 + var kvArray = Array<Dictionary<String, String>>()
546 549 kvArray.append(["k":"品名","v":singleView18.contentTextField.text!])
547 550 kvArray.append(["k":"规格","v":singleView19.contentTextField.text!])
548 551 kvArray.append(["k":"寄送区域","v":singleView20.contentTextView.text!])
... ... @@ -590,7 +593,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
590 593 }
591 594 showLoading(message: "")
592 595 if self.type == .add{
593   - CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3: self.selectCategoryVC?.thiCategoryId != 0 ? String(format: "%d", self.selectCategoryVC?.thiCategoryId ?? 0) : "", bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text, price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage:self.dicArrayToJson(kvArray as! [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: String(format: "%d", category_id)) { result, status in
  596 + CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3: self.selectCategoryVC?.thiCategoryId != 0 ? String(format: "%d", self.selectCategoryVC?.thiCategoryId ?? 0) : "", bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text, price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage:self.dicArrayToJson(kvArray as [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: String(format: "%d", category_id)) { result, status in
594 597 hiddenLoading()
595 598 if status == .failed{
596 599 showMessage(message: "发布失败")
... ... @@ -609,7 +612,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
609 612 }
610 613 }
611 614 }else{
612   - CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3:self.selectCategoryVC?.thiCategoryId != 0 ? String(format: "%d", self.selectCategoryVC?.thiCategoryId ?? 0) : "" , bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text ?? "", price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage: self.dicArrayToJson(kvArray as! [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: String(format: "%d", category_id)) { result, status in
  615 + CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3:self.selectCategoryVC?.thiCategoryId != 0 ? String(format: "%d", self.selectCategoryVC?.thiCategoryId ?? 0) : "" , bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text ?? "", price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage: self.dicArrayToJson(kvArray as [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: String(format: "%d", category_id)) { result, status in
613 616 hiddenLoading()
614 617 if status == .failed{
615 618 showMessage(message: "修改失败")
... ... @@ -717,7 +720,13 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
717 720 //发货时效
718 721 let singleView21 = self.bgScrollView.viewWithTag(21) as! CNLiveShopAddGoodsSingleView
719 722  
720   - let tempArray = NSMutableArray(array: self.shopGoodsDetailsModel.storageArray)
  723 + let tempArray = NSMutableArray()
  724 + for mdl in self.shopGoodsDetailsModel.storage_arr{
  725 + let dic = modelToDictionary(mdl)
  726 + tempArray.add(dic)
  727 + }
  728 +
  729 + self.shopGoodsDetailsModel.storageArray = tempArray as! [Dictionary<String, Any>]
721 730 for dic in self.shopGoodsDetailsModel.storageArray{
722 731 let dict = dic as NSDictionary
723 732 if dict.object(forKey: "k") as! String == "品名"{
... ... @@ -779,15 +788,16 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{
779 788 singleView4.uploadImageView.deleteImage = UIImage.imageWithColor(color: .clear, size: singleView4.uploadImageView.size)
780 789 singleView13.uploadImageView.deleteImage = UIImage.imageWithColor(color: .clear, size: singleView13.uploadImageView.size)
781 790 if tempArray.count > 0{
782   - let array = NSMutableArray(array: self.dataModel.list)
  791 + var array = Array(self.dataModel.list)
  792 +
783 793 for i in 0..<tempArray.count{
784 794 let dict = tempArray.object(at: i) as! NSDictionary
785 795 let paramDict = ["style":1,"isHaveTo":false,"title":dict.object(forKey: "k"),"contentTextFieldkeyboardType":1,"isDisplayLine":true,"contentType":1,"isDelect":true,"content":dict.object(forKey: "v")]
786 796 let listModel = newDictionaryToModel(paramDict as [String : Any], CNLiveShopAddEditGoodsListModel.self) as! CNLiveShopAddEditGoodsListModel
787   - array.add(listModel)
  797 + array.append(listModel)
788 798 self.reloadBgScrollViewContentViewModel(model: listModel, index: self.dataModel.list.count+1+i, isScrollToBottom: false)
789 799 if tempArray.count-1 == i{
790   - self.dataModel.list = array as! [CNLiveShopAddEditGoodsListModel]
  800 + self.dataModel.list = array
791 801 self.viewWillLayoutSubviews()
792 802 }
793 803 }
... ...
metaCode/Classes/Main/HomePage/View/CNMainView.swift
... ... @@ -170,7 +170,7 @@ class CNFrontMainView : UIView{
170 170 frontCardContentView.isHidden = true
171 171 //显示textview 添加身份
172 172 frontDescContentView.isHidden = false
173   - textView.text = newValue!.description
  173 + textView.text = newValue!.descriptions
174 174 addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor)
175 175 textViewBgImgView.kf.setImage(with: URL(string: _idModel!.descBackgroundImg), placeholder: UIImage(named: "homepage_desc_bgImg"))
176 176 }
... ...
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveAddGoodsSelectUploadImageView.swift
... ... @@ -364,7 +364,7 @@ class CNLiveAddGoodsSelectUploadImageView: UIView,UIImagePickerControllerDelegat
364 364 不上传了 删除(云中)新上传的视频
365 365 */
366 366 func deleteUploadVideoUrl(){
367   - if self.networkVideoUrl != self.uploadVideoModel?.videoUrl{
  367 + if self.uploadVideoModel?.videoUrl != nil && self.networkVideoUrl != "" && self.networkVideoUrl != nil && self.networkVideoUrl != self.uploadVideoModel?.videoUrl{
368 368 UploadManager.shared.requestQiNiuDeleteImageUrl(imageUrl: (self.uploadVideoModel?.videoUrl)!) { result, status in
369 369  
370 370 }
... ...
metaCode/Classes/Main/HomePage/ViewModel/GoodsManager/CNLiveShopGoodListViewModel.swift
... ... @@ -118,8 +118,9 @@ class CNLiveShopGoodListViewModel:NSObject{
118 118 CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/goodsInfo", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
119 119 hiddenLoading()
120 120 if (error == nil) {
121   - let resp = result as! NSDictionary
122   - let model = newDictionaryToModel(resp as! [String : Any], CNLiveShopGoodsDetailsModel.self)
  121 + let respDic = result as! NSDictionary
  122 + let resp = respDic["data"] as! NSDictionary
  123 + let model = newDictionaryToModel(resp as! [String : Any], CNLiveShopGoodsDetailsModel.self) as! CNLiveShopGoodsDetailsModel
123 124 resultBlock(model,.success)
124 125 }else{
125 126 resultBlock(NSNull(),.failed)
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -143,7 +143,7 @@ final class StandListModel: BaseModel {//, TableCodable {
143 143 var backgroundImg: String = ""//首页背景图-
144 144 var backgroundColor: String = ""//添加身份按钮背景色-
145 145 var backgroundColour: String = ""//-
146   - var description: String = ""//首页身份说明描述-
  146 + var descriptions: String = ""//首页身份说明描述-
147 147 var descBackgroundImg: String = ""//首页文字背景图
148 148 var cardImg: String = ""//卡片背景图-
149 149 var cardBackgroundImg: String = ""//首页卡片背景图
... ...
metaCode/Classes/Main/Model/GoodsDetail/CNLiveShopGoodsDetailsModel.swift
... ... @@ -202,7 +202,7 @@ class CNLiveShopGoodsDetailsModel:BaseModel{
202 202 /**
203 203 规格
204 204 */
205   - var storage_arr:String?
  205 + var storage_arr = [CNLiveGoodsDetailsAttrModel]()
206 206 /**
207 207 最小购买数
208 208 */
... ...