Kaynağa Gözat

内容页面修复

南鑫林 5 yıl önce
ebeveyn
işleme
a2d65c1392

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/Controller/CommunityRecommendController.swift

@@ -301,7 +301,7 @@ extension CommunityRecommendController: UITableViewDataSource, UITableViewDelega
         case 1:
             return 0
         case 2:
-            return heightModel1.height ?? 0
+            return heightModel.height ?? 0
         default:
             return 0
         }

+ 15 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/RecommendDetailContentCell.swift

@@ -46,6 +46,7 @@ class RecommendDetailContentCell: UITableViewCell {
         addSubview(contentLabel)
         addSubview(collectionView)
         addSubview(timeLabel)
+        addSubview(locationButton)
         addSubview(readLabel)
     }
     
@@ -87,6 +88,10 @@ class RecommendDetailContentCell: UITableViewCell {
             make.height.equalTo(15)
             make.bottom.equalToSuperview().offset(-20)
         }
+        locationButton.snp.makeConstraints { (make) in
+            make.centerY.equalTo(timeLabel)
+            make.left.equalTo(timeLabel.snp_right).offset(8)
+        }
         readLabel.snp.makeConstraints { (make) in
             make.right.equalTo(titleLabel.snp_right)
             make.centerY.equalTo(timeLabel.snp_centerY)
@@ -202,9 +207,16 @@ class RecommendDetailContentCell: UITableViewCell {
         didSet {
             beanLabel.text = "\(communityPostDetailModel?.availableBean ?? 0)彩虹豆待收获"
             contentLabel.text = communityPostDetailModel?.content
-            timeLabel.text = "\(communityPostDetailModel?.createdAt ?? "") I"
-            locationButton.setTitle(communityPostDetailModel?.location, for: UIControl.State.normal)
-            locationButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 3)
+            if communityPostDetailModel?.location == nil || communityPostDetailModel?.location == "" {
+                timeLabel.text = "\(communityPostDetailModel?.createdAt ?? "")"
+                locationButton.isHidden = true
+            }else {
+                timeLabel.text = "\(communityPostDetailModel?.createdAt ?? "") I"
+                locationButton.isHidden = false
+                locationButton.setTitle(communityPostDetailModel?.location, for: UIControl.State.normal)
+                locationButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 3)
+
+            }
             readLabel.text = "阅读·\(communityPostDetailModel?.pv ?? 0)"
 
             if communityPostDetailModel?.title == nil || communityPostDetailModel?.title == "" {