Commit 5c24089913f634544f4370e7c989416e3666743a

Authored by “张旭”
1 parent d84f6c89

栏目 ,电商分类icon修改

metaCode/Classes/Main/HuBiLieHomePage/Controller/CNLiveTVHomeViewController.swift
... ... @@ -371,12 +371,15 @@ class CNLiveTVHomeViewController:CNLiveBaseViewController, UITableViewDataSource
371 371 return 50.0+15.0//80
372 372 }else if let slideModel = self.dataArray[indexPath.row] as? CNLiveHomeShopCategoryModel{
373 373 //商品分类 一排三个
374   - let maxCount = slideModel.group.count > 6 ? 6 : slideModel.group.count
375   - let hangNum = Int(ceil(Double(maxCount)/3.0))
376   - let imgW = (KSreenWidth-15*4)/3.0
377   - let imgH = imgW*32.0/105.0
378   - let rowH = imgH+15.0
379   - let height = CGFloat(hangNum)*rowH
  374 + let maxCount = slideModel.group.count > 4 ? 4 : slideModel.group.count
  375 +// let hangNum = Int(ceil(Double(maxCount)/3.0))
  376 +// let imgW = (KSreenWidth-15*4)/3.0
  377 +// let imgH = imgW*32.0/105.0
  378 + let imgWH = 44.0
  379 + let titleH = 22.0
  380 + let rowH = imgWH+titleH+15.0
  381 +// let height = CGFloat(hangNum)*rowH
  382 + let height = rowH
380 383 return height
381 384 }else{
382 385 return 60
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeADCell.swift
... ... @@ -82,7 +82,8 @@ class CNLiveHomeADCell: UITableViewCell ,FSPagerViewDataSource,FSPagerViewDelega
82 82 let kCNLliveShopDetailBannerCellID = "kCNLliveShopDetailBannerCellID"
83 83 lazy var viewPager: FSPagerView = {
84 84 let viewPager = FSPagerView()
85   - viewPager.frame = CGRect(x: 15, y: 0, width: KSreenWidth-30, height: 190.0*(KSreenWidth-30)/345.0)
  85 +// viewPager.frame = CGRect(x: 15, y: 0, width: KSreenWidth-30, height: 190.0*(KSreenWidth-30)/345.0)
  86 + viewPager.frame = CGRect(x: 15, y: 0, width: CGFloat(DownSlideTodayRecommendW), height: CGFloat(CNLiveHomeADH))
86 87 viewPager.dataSource = self
87 88 viewPager.delegate = self
88 89 viewPager.register(FSPagerViewCell.self, forCellWithReuseIdentifier: kCNLliveShopDetailBannerCellID)
... ... @@ -102,7 +103,8 @@ class CNLiveHomeADCell: UITableViewCell ,FSPagerViewDataSource,FSPagerViewDelega
102 103  
103 104 // 懒加载滚动图片浏下标
104 105 lazy var pagerControl:FSPageControl = {
105   - let pageControl = FSPageControl(frame: CGRect(x: KSreenWidth-30-100, y: 190.0*(KSreenWidth-30)/345.0-14, width: 100, height: 4))
  106 +// let pageControl = FSPageControl(frame: CGRect(x: KSreenWidth-30-100, y: 190.0*(KSreenWidth-30)/345.0-14, width: 100, height: 4))
  107 + let pageControl = FSPageControl(frame: CGRect(x: self.viewPager.right-100-15, y: self.viewPager.height-14, width: 100, height: 4))
106 108 //设置下标位置
107 109 pageControl.contentHorizontalAlignment = .right
108 110 //设置下标指示器颜色(选中状态和普通状态)
... ... @@ -157,12 +159,13 @@ class CNLiveHomeADCell: UITableViewCell ,FSPagerViewDataSource,FSPagerViewDelega
157 159 if self.slideModel?.contents.count ?? 0 >= (index+1){
158 160 let imgUrl = self.slideModel?.contents[index].poster
159 161 cell.imageView?.kf.setImage(with: URL(string: imgUrl!))
160   - cell.textLabel?.text = self.slideModel?.contents[index].title
  162 + cell.imageView?.contentMode = .scaleAspectFill
  163 +// cell.textLabel?.text = self.slideModel?.contents[index].title
161 164  
162 165 }
163 166 cell.imageView?.layer.cornerRadius = 9
164 167 cell.imageView?.clipsToBounds = true
165   - cell.textLabel?.font = BoldFont_18
  168 +// cell.textLabel?.font = BoldFont_18
166 169 return cell
167 170 }
168 171  
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeLanmuCell.swift
... ... @@ -20,36 +20,15 @@ class CNLiveHomeLanmuCell:UITableViewCell{
20 20 }
21 21 set{
22 22 _slideModel = newValue!
  23 + for obj in contentView.subviews{
  24 + if obj.tag > 100{
  25 + obj.removeFromSuperview()
  26 + }
  27 + }
23 28 self.setupNewUI(model: slideModel!)
24 29 }
25 30 }
26   -
27   - //MARK: - 懒加载
28   - lazy var iconImgView1 :UIImageView = {
29   - let iconImgView = UIImageView(frame: CGRect(x: 15, y: 0, width: (KSreenWidth-60)/3.0, height: 32))
30   - iconImgView.contentMode = .scaleAspectFill
31   - iconImgView.tag = 1001
32   - iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(iconImgViewAction)))
33   - iconImgView.isUserInteractionEnabled = true
34   - return iconImgView
35   - }()
36   - lazy var iconImgView2 :UIImageView = {
37   - let iconImgView = UIImageView(frame: CGRect(x: iconImgView1.right+15, y: 0, width: iconImgView1.width, height: iconImgView1.height))
38   - iconImgView.contentMode = .scaleAspectFill
39   - iconImgView.tag = 1002
40   - iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(iconImgViewAction)))
41   - iconImgView.isUserInteractionEnabled = true
42   - return iconImgView
43   - }()
44   - lazy var iconImgView3 :UIImageView = {
45   - let iconImgView = UIImageView(frame: CGRect(x: iconImgView2.right+15, y: 0, width: iconImgView1.width, height: iconImgView1.height))
46   - iconImgView.contentMode = .scaleAspectFill
47   - iconImgView.tag = 1003
48   - iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(iconImgViewAction)))
49   - iconImgView.isUserInteractionEnabled = true
50   - return iconImgView
51   - }()
52   -
  31 +
53 32 override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
54 33 super.init(style: style, reuseIdentifier: reuseIdentifier)
55 34 self.selectionStyle = .none
... ... @@ -62,29 +41,45 @@ class CNLiveHomeLanmuCell:UITableViewCell{
62 41  
63 42 private func setupUI() {
64 43 contentView.backgroundColor = .white
65   - self.contentView.addSubview(self.iconImgView1)
66   - self.contentView.addSubview(self.iconImgView2)
67   - self.contentView.addSubview(self.iconImgView3)
68 44 self.contentView.clipsToBounds = true
69 45 }
70 46  
71 47 func setupNewUI(model:CNLiveDownSlideModel){
  48 + var showNum:Int = model.contents.count>=4 ? 4 : model.contents.count
72 49 for (idx,mdl) in model.contents.enumerated(){
73   - if idx == 0{
74   - self.iconImgView1.kf.setImage(with: URL(string: mdl.poster))
75   - }else if idx == 1{
76   - self.iconImgView2.kf.setImage(with: URL(string: mdl.poster))
77   - }else if idx == 2{
78   - self.iconImgView3.kf.setImage(with: URL(string: mdl.poster))
79   - }else{
80   -
  50 + if idx >= 4 { break}
  51 +
  52 + let leftPadding:CGFloat = 30.0
  53 + let imgWH:CGFloat = 44.0
  54 + let jianJuPadding:CGFloat = (KSreenWidth-2*leftPadding-CGFloat(showNum)*imgWH)/CGFloat(showNum-1)
  55 + let imgX:CGFloat = leftPadding+CGFloat(idx)*(imgWH+jianJuPadding)
  56 + let imgY:CGFloat = 0.0
  57 + let iconImgView = UIImageView(frame: CGRect(x: imgX, y: imgY, width: imgWH, height: imgWH))
  58 + iconImgView.contentMode = .scaleAspectFill
  59 + iconImgView.tag = 1000+idx
  60 + iconImgView.kf.setImage(with: URL(string: mdl.poster))
  61 + iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(iconImgViewAction)))
  62 + iconImgView.isUserInteractionEnabled = true
  63 + self.contentView.addSubview(iconImgView)
  64 +
  65 +
  66 + let titleLbl = UILabel(frame: CGRect(x: 0, y: iconImgView.bottom+2.5, width: 50, height: 20))
  67 + titleLbl.centerX = iconImgView.centerX
  68 + titleLbl.font = Font_15
  69 + titleLbl.textColor = HexColor("#000102")
  70 + titleLbl.text = mdl.title
  71 + titleLbl.tag = 1000+idx
  72 + self.contentView.addSubview(titleLbl)
  73 + titleLbl.snp.makeConstraints { make in
  74 + make.centerX.equalTo(iconImgView.snp.centerX)
  75 + make.top.equalTo(iconImgView.snp.bottom).offset(2.5)
81 76 }
82 77 }
83 78  
84 79 }
85 80 @objc func iconImgViewAction(ges: UITapGestureRecognizer){
86 81 let imageView = ges.view as! UIImageView
87   - let index = imageView.tag-1001
  82 + let index = imageView.tag-1000
88 83 if let slideModel = self.slideModel?.contents[index]{
89 84 self.imgClickBlock?(slideModel)
90 85 }
... ...
metaCode/Classes/Main/HuBiLieHomePage/View/Home/Home/CNLiveHomeShopCategoryCell.swift
... ... @@ -7,11 +7,8 @@
7 7  
8 8 import Foundation
9 9  
10   -//typealias CNLiveHomeLanmuImgClickBlock = (_ imgModel:CNLiveDownSlideContentsModel)->Void;
11   -
12 10 class CNLiveHomeShopCategoryCell:UITableViewCell{
13 11  
14   -// var imgClickBlock : CNLiveHomeLanmuImgClickBlock?
15 12 //slideModel
16 13 var _slideModel : CNLiveHomeShopCategoryModel?
17 14 var slideModel : CNLiveHomeShopCategoryModel? {
... ... @@ -44,57 +41,94 @@ class CNLiveHomeShopCategoryCell:UITableViewCell{
44 41 }
45 42  
46 43 func setupNewUI(model:CNLiveHomeShopCategoryModel){
47   -
48   - //总块数
49   - let totalNum = model.group.count
50   - //lieIndex 当前是contents的第0列还是第1列
51   - var lieIndex = 0
52   - //hangIndex 当前是第几行,1...n
53   - var hangIndex = 1
54   -
55   - let imgW = (KSreenWidth-15*4)/3.0
56   - let imgH = imgW*32.0/105.0
57   - let rowH = imgH+15
58   - let yiHangNum = 3 //一行几块
59   - for i in 0..<totalNum{//i是第几行
60   - let groupMdl = model.group[(hangIndex-1)*yiHangNum+(lieIndex)]
61   -
62   - //
63   - let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap+CGFloat(lieIndex)*(imgW+DownSlideRecommendLeftGap), CGFloat(hangIndex-1)*rowH, CGFloat(imgW), CGFloat(imgH)))
64   - if groupMdl.title == "全部商品"{
65   - imageView.image = UIImage(named: "home_allProducts")
  44 + var showNum:Int = model.group.count>=4 ? 4 : model.group.count
  45 + for (idx,mdl) in model.group.enumerated(){
  46 + if idx >= 4 { break}
  47 +
  48 + let leftPadding:CGFloat = 30.0
  49 + let imgWH:CGFloat = 44.0
  50 + let jianJuPadding:CGFloat = (KSreenWidth-2*leftPadding-CGFloat(showNum)*imgWH)/CGFloat(showNum-1)
  51 + let imgX:CGFloat = leftPadding+CGFloat(idx)*(imgWH+jianJuPadding)
  52 + let imgY:CGFloat = 0.0
  53 + let iconImgView = UIImageView(frame: CGRect(x: imgX, y: imgY, width: imgWH, height: imgWH))
  54 + iconImgView.contentMode = .scaleAspectFill
  55 + iconImgView.tag = 1000+idx
  56 + if mdl.title == "全部商品"{
  57 + iconImgView.image = UIImage(named: "home_allProduct")
66 58 }else{
67   - imageView.kf.setImage(with: URL(string:groupMdl.simg) ,placeholder: UIImage(color: .lightGray, size: imageView.size))
  59 + iconImgView.kf.setImage(with: URL(string:mdl.simg) ,placeholder: UIImage(color: .lightGray, size: iconImgView.size))
68 60 }
69   - imageView.tag = i
70   - imageView.layer.cornerRadius = 9
71   - imageView.contentMode = .scaleAspectFill
72   -
73   - imageView.clipsToBounds = true
74   - imageView.isUserInteractionEnabled = true
75   - imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(imgTapAction)))
76   - contentView.addSubview(imageView)
  61 +// iconImgView.kf.setImage(with: URL(string: mdl.simg))
  62 + iconImgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(iconImgViewAction)))
  63 + iconImgView.isUserInteractionEnabled = true
  64 + self.contentView.addSubview(iconImgView)
  65 +
77 66  
78   - let titleLbl = UILabel(frame: CGRect(x: imageView.left, y: 0, width: imageView.width, height: 20))
79   - titleLbl.center = imageView.center
80   - titleLbl.font = Font_18
81   - titleLbl.textColor = HexColor("#FFFFFF")
82   - titleLbl.text = groupMdl.title
83   - titleLbl.textAlignment = .center
84   - contentView.addSubview(titleLbl)
85   - if lieIndex == 0{
86   - lieIndex = 1
87   - }else if lieIndex == 1{
88   - lieIndex = 2
89   - }else if lieIndex == 2{
90   - lieIndex = 0
91   - hangIndex += 1
  67 + let titleLbl = UILabel(frame: CGRect(x: 0, y: iconImgView.bottom+2.5, width: 50, height: 20))
  68 + titleLbl.centerX = iconImgView.centerX
  69 + titleLbl.font = Font_15
  70 + titleLbl.textColor = HexColor("#000102")
  71 + titleLbl.text = mdl.title
  72 + titleLbl.tag = 1000+idx
  73 + self.contentView.addSubview(titleLbl)
  74 + titleLbl.snp.makeConstraints { make in
  75 + make.centerX.equalTo(iconImgView.snp.centerX)
  76 + make.top.equalTo(iconImgView.snp.bottom).offset(2.5)
92 77 }
93 78 }
  79 +
  80 +
  81 +//
  82 +// //总块数
  83 +// let totalNum = model.group.count
  84 +// //lieIndex 当前是contents的第0列还是第1列
  85 +// var lieIndex = 0
  86 +// //hangIndex 当前是第几行,1...n
  87 +// var hangIndex = 1
  88 +//
  89 +// let imgW = (KSreenWidth-15*4)/3.0
  90 +// let imgH = imgW*32.0/105.0
  91 +// let rowH = imgH+15
  92 +// let yiHangNum = 3 //一行几块
  93 +// for i in 0..<totalNum{//i是第几行
  94 +// let groupMdl = model.group[(hangIndex-1)*yiHangNum+(lieIndex)]
  95 +//
  96 +// //
  97 +// let imageView = UIImageView(frame: CGRectMake(DownSlideRecommendLeftGap+CGFloat(lieIndex)*(imgW+DownSlideRecommendLeftGap), CGFloat(hangIndex-1)*rowH, CGFloat(imgW), CGFloat(imgH)))
  98 +// if groupMdl.title == "全部商品"{
  99 +// imageView.image = UIImage(named: "home_allProducts")
  100 +// }else{
  101 +// imageView.kf.setImage(with: URL(string:groupMdl.simg) ,placeholder: UIImage(color: .lightGray, size: imageView.size))
  102 +// }
  103 +// imageView.tag = i
  104 +// imageView.layer.cornerRadius = 9
  105 +// imageView.contentMode = .scaleAspectFill
  106 +//
  107 +// imageView.clipsToBounds = true
  108 +// imageView.isUserInteractionEnabled = true
  109 +// imageView.addGestureRecognizer(UITapGestureRecognizer.init(target: self, action: #selector(imgTapAction)))
  110 +// contentView.addSubview(imageView)
  111 +//
  112 +// let titleLbl = UILabel(frame: CGRect(x: imageView.left, y: 0, width: imageView.width, height: 20))
  113 +// titleLbl.center = imageView.center
  114 +// titleLbl.font = Font_18
  115 +// titleLbl.textColor = HexColor("#FFFFFF")
  116 +// titleLbl.text = groupMdl.title
  117 +// titleLbl.textAlignment = .center
  118 +// contentView.addSubview(titleLbl)
  119 +// if lieIndex == 0{
  120 +// lieIndex = 1
  121 +// }else if lieIndex == 1{
  122 +// lieIndex = 2
  123 +// }else if lieIndex == 2{
  124 +// lieIndex = 0
  125 +// hangIndex += 1
  126 +// }
  127 +// }
94 128 }
95   - @objc func imgTapAction(ges: UITapGestureRecognizer){
  129 + @objc func iconImgViewAction(ges: UITapGestureRecognizer){
96 130 let imageView = ges.view as! UIImageView
97   - let index = imageView.tag
  131 + let index = imageView.tag-1000
98 132 if let slideModel = self.slideModel?.group[index]{
99 133  
100 134 let urlString = "https://managemall.cnlive.com/html/mall/1/#/pages/goods/category/category?categoryId=\(slideModel.id)&uid=\(UserInfoManager.shared.userInfo.uid)&scene=app"
... ... @@ -111,4 +145,15 @@ class CNLiveHomeShopCategoryCell:UITableViewCell{
111 145 }
112 146 }
113 147  
  148 +// func setupNewUI(model:CNLiveDownSlideModel){
  149 +//
  150 +// }
  151 +// @objc func iconImgViewAction(ges: UITapGestureRecognizer){
  152 +// let imageView = ges.view as! UIImageView
  153 +// let index = imageView.tag-1000
  154 +// if let slideModel = self.slideModel?.contents[index]{
  155 +// self.imgClickBlock?(slideModel)
  156 +// }
  157 +// }
  158 +
114 159 }
... ...
metaCode/Classes/Main/Model/CNLiveDownSlideModelLayout.swift
... ... @@ -103,9 +103,9 @@ class CNLiveDownSlideModelLayout:NSObject{
103 103 }else if(_slideModel?.type == SlideModelTypeRealHotList7){//7实时热榜
104 104  
105 105 _slideModel?.cellH = Float(DownSlideRealHotListH)+Float(DownSlideRecommendLeftGap)
106   - }else if (_slideModel?.type == SlideModelTypeLanmu22){//22 首页栏目 电影 电视剧 纪录片
  106 + }else if (_slideModel?.type == SlideModelTypeLanmu22){//22 首页栏目 电影 电视剧 纪录片 音乐
107 107  
108   - _slideModel?.cellH = 32.0+15.0
  108 + _slideModel?.cellH = 44.0+38.0//+15.0
109 109 }else if (_slideModel?.type == SlideModelTypeFollow77){// 正在追
110 110 _slideModel?.cellH = 50.0+15.0//80.0
111 111 }else if (_slideModel?.type == SlideModelTypeTVOneBigTwoSmall2){//2 一大图2-6小图
... ...
metaCode/Supporting Files/Assets.xcassets/HomePage/home_allProduct.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "home_allProduct@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "home_allProduct@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/HomePage/home_allProduct.imageset/home_allProduct@2x.png 0 → 100644

16.6 KB

metaCode/Supporting Files/Assets.xcassets/HomePage/home_allProduct.imageset/home_allProduct@3x.png 0 → 100644

34.2 KB