|
@@ -440,15 +440,28 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
|
|
|
|
|
|
//内容标题
|
|
|
case 1:
|
|
|
- let cell = CardContentTitleTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
- cell.communityRecommendDataModel = communityRecommendDataModel
|
|
|
- return cell
|
|
|
+
|
|
|
+ if PostType(rawValue: communityRecommendDataModel.type ?? "html") == .html {
|
|
|
+ let cell = CardTitleHTMLTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
+ cell.communityRecommendDataModel = communityRecommendDataModel
|
|
|
+ return cell
|
|
|
+ }else {
|
|
|
+ let cell = CardContentTitleTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
+ cell.communityRecommendDataModel = communityRecommendDataModel
|
|
|
+ return cell
|
|
|
+ }
|
|
|
//图片视频
|
|
|
case 2:
|
|
|
- let cell = CardContentPicVideoTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
- cell.type = .recommend
|
|
|
- cell.communityRecommendDataModel = communityRecommendDataModel
|
|
|
- return cell
|
|
|
+ if PostType(rawValue: communityRecommendDataModel.type ?? "html") == .html {
|
|
|
+ let cell = CardContentPicHTMLTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
+ cell.communityRecommendDataModel = communityRecommendDataModel
|
|
|
+ return cell
|
|
|
+ }else {
|
|
|
+ let cell = CardContentPicVideoTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
+ cell.type = .recommend
|
|
|
+ cell.communityRecommendDataModel = communityRecommendDataModel
|
|
|
+ return cell
|
|
|
+ }
|
|
|
//点赞,收藏,分享
|
|
|
case 3:
|
|
|
let cell = CardContentActionTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
@@ -523,38 +536,42 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
|
|
|
|
|
|
//内容标题
|
|
|
case 1:
|
|
|
- var titleStr = communityRecommendDataModel.title ?? ""
|
|
|
- titleStr = titleStr.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: "\r", with: "")
|
|
|
-
|
|
|
- var str = communityRecommendDataModel.content ?? ""
|
|
|
- str = str.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: "\r", with: "")
|
|
|
-
|
|
|
- let subtitleLabelHeight = str.heightForComment(font: kRegularFont14!, width: kScreenWidth-28, maxHeight: 40.0)
|
|
|
|
|
|
- if titleStr == "" {
|
|
|
+ if PostType(rawValue: communityRecommendDataModel.type ?? "html") == .html {
|
|
|
+ var titleStr = communityRecommendDataModel.title ?? ""
|
|
|
+ titleStr = titleStr.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: "\r", with: "")
|
|
|
+ let subtitleLabelHeight = titleStr.heightForComment(font: kMediumFont16!, width: kScreenWidth-28, maxHeight: 44.0)
|
|
|
return subtitleLabelHeight
|
|
|
}else {
|
|
|
- return 22 + 6 + subtitleLabelHeight
|
|
|
+ var titleStr = communityRecommendDataModel.title ?? ""
|
|
|
+ titleStr = titleStr.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: "\r", with: "")
|
|
|
+
|
|
|
+ var str = communityRecommendDataModel.content ?? ""
|
|
|
+ str = str.replacingOccurrences(of: "\n", with: "").replacingOccurrences(of: "\r", with: "")
|
|
|
+
|
|
|
+ let subtitleLabelHeight = str.heightForComment(font: kRegularFont14!, width: kScreenWidth-28, maxHeight: 40.0)
|
|
|
+
|
|
|
+ if titleStr == "" {
|
|
|
+ return subtitleLabelHeight
|
|
|
+ }else {
|
|
|
+ return 22 + 6 + subtitleLabelHeight
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//图片视频
|
|
|
case 2:
|
|
|
|
|
|
- let cardContentPicVideoModel = CardContentPicVideoModel()
|
|
|
- cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel.type ?? "html")
|
|
|
-
|
|
|
- let imgStr = communityRecommendDataModel.img
|
|
|
- if communityRecommendDataModel.imgs?.count ?? 0 == 0 {
|
|
|
- if communityRecommendDataModel.img != "" && communityRecommendDataModel.img != nil {
|
|
|
- cardContentPicVideoModel.number = 1
|
|
|
- cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
|
|
|
- cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
|
|
|
- return cardContentPicVideoModel.collectionViewHeight() + 12
|
|
|
- }else {
|
|
|
- return 0
|
|
|
- }
|
|
|
+ if PostType(rawValue: communityRecommendDataModel.type ?? "html") == .html {
|
|
|
+
|
|
|
+ return 82
|
|
|
}else {
|
|
|
- if communityRecommendDataModel.imgs?.count ?? 0 == 1 {
|
|
|
- if communityRecommendDataModel.img != "" || communityRecommendDataModel.img != nil {
|
|
|
+ let cardContentPicVideoModel = CardContentPicVideoModel()
|
|
|
+ cardContentPicVideoModel.postType = PostType(rawValue: communityRecommendDataModel.type ?? "html")
|
|
|
+
|
|
|
+ let imgStr = communityRecommendDataModel.img
|
|
|
+ if communityRecommendDataModel.imgs?.count ?? 0 == 0 {
|
|
|
+ if communityRecommendDataModel.img != "" && communityRecommendDataModel.img != nil {
|
|
|
cardContentPicVideoModel.number = 1
|
|
|
cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
|
|
|
cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
|
|
@@ -563,11 +580,21 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
|
|
|
return 0
|
|
|
}
|
|
|
}else {
|
|
|
- cardContentPicVideoModel.number = communityRecommendDataModel.imgs?.count ?? 0
|
|
|
- return cardContentPicVideoModel.collectionViewHeight() + 12
|
|
|
+ if communityRecommendDataModel.imgs?.count ?? 0 == 1 {
|
|
|
+ if communityRecommendDataModel.img != "" || communityRecommendDataModel.img != nil {
|
|
|
+ cardContentPicVideoModel.number = 1
|
|
|
+ cardContentPicVideoModel.width = getImageWidth(imgStr: (imgStr)!)
|
|
|
+ cardContentPicVideoModel.height = getImageHeight(imgStr: (imgStr)!)
|
|
|
+ return cardContentPicVideoModel.collectionViewHeight() + 12
|
|
|
+ }else {
|
|
|
+ return 0
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ cardContentPicVideoModel.number = communityRecommendDataModel.imgs?.count ?? 0
|
|
|
+ return cardContentPicVideoModel.collectionViewHeight() + 12
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//点赞,收藏,分享
|
|
|
case 3:
|
|
|
return 54
|