Commit 8ba7d54285606934f3391d490bbd81b6a8fc2b98

Authored by 张旭
1 parent 29fa9b96

首页在追短剧最大4个

积分付费后延迟0.5秒刷新
metaCode/Classes/Main/HomePages/Controller/AuthController/CNLiveAuthViewController.swift
... ... @@ -113,6 +113,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
113 113 else {
114 114 return CNLiveHomePageDuanJuCell()
115 115 }
  116 +
116 117 cell.setModelArr(modelArr: self.duanjuDataArray)
117 118 cell.DuanJUCellSelectedCallBack = {
118 119 duanJuCell in
... ... @@ -246,8 +247,15 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
246 247  
247 248 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
248 249 if self.isHaveDuanJU && indexPath.section == 0{
249   - //标题55+n个cell*(45+15*2)+首尾15+12圆角
250   - return CGFloat(self.duanjuDataArray.count)*(45+15*2)+CGFloat(55)+15+15+12
  250 + if self.duanjuDataArray.count > 4{
  251 + //标题55+4个cell*(45+15*2)+首尾15+12圆角
  252 + return CGFloat(4)*(45+15*2)+CGFloat(55)+15+15+12
  253 +
  254 + }else{
  255 + //标题55+n个cell*(45+15*2)+首尾15+12圆角
  256 + return CGFloat(self.duanjuDataArray.count)*(45+15*2)+CGFloat(55)+15+15+12
  257 +
  258 + }
251 259 }else{
252 260 let slideModel = self.dataArray[indexPath.row] as! CNLiveDownSlideModel
253 261 return CGFloat(slideModel.cellH)
... ... @@ -290,6 +298,7 @@ class CNLiveAuthViewController:CNLiveBaseViewController,UITableViewDelegate,UITa
290 298 if arr.count>0{
291 299 //显示在追短剧cell
292 300 self.isHaveDuanJU = true
  301 +
293 302 self.duanjuDataArray = NSMutableArray(array: arr)
294 303 }else{
295 304 //隐藏在追短剧cell
... ...
metaCode/Classes/Main/HomePages/Controller/PlayletHomePage/CNLivePlayletHomePageController.swift
... ... @@ -108,7 +108,9 @@ class CNLivePlayletHomePageController:CNLiveBaseViewController, UITableViewDataS
108 108 self.tableView.reloadData()
109 109 }
110 110 cell.homePageNeedReloadActionBlock = {
111   - self.getAlbumList(aid: self.albumId)
  111 + DispatchQueue.main.asyncAfter(deadline: .now()+0.5) { [self] in
  112 + self.getAlbumList(aid: self.albumId)
  113 + }
112 114 }
113 115 if self.albumModelArr.count > 0{
114 116 let albumListModel = self.albumModelArr[0]
... ...
metaCode/Classes/Main/HomePages/View/HomePage/CNLiveHomePageDuanJuCell.swift
... ... @@ -21,8 +21,14 @@ class CNLiveHomePageDuanJuCell:UITableViewCell,UITableViewDelegate,UITableViewDa
21 21 func setModelArr(modelArr:NSMutableArray){
22 22 self.modelArr = NSMutableArray(array: modelArr)
23 23  
24   - self.tableView.height = CGFloat(self.modelArr.count)*(45+15*2)
25   - self.totalView.height = CGFloat(self.modelArr.count)*(45+15*2) + 55 + 12
  24 + var numCell = 0
  25 + if self.modelArr.count > 4{
  26 + numCell = 4
  27 + }else{
  28 + numCell = self.modelArr.count
  29 + }
  30 + self.tableView.height = CGFloat(numCell)*(45+15*2)
  31 + self.totalView.height = CGFloat(numCell)*(45+15*2) + 55 + 12
26 32 self.tableView.reloadData()
27 33 }
28 34 //MARK: - 懒加载
... ... @@ -85,7 +91,11 @@ class CNLiveHomePageDuanJuCell:UITableViewCell,UITableViewDelegate,UITableViewDa
85 91 }
86 92  
87 93 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
88   - self.modelArr.count
  94 + if self.modelArr.count > 4{
  95 + return 4
  96 + }else{
  97 + return self.modelArr.count
  98 + }
89 99 }
90 100  
91 101 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
... ...