Commit cb60d525 authored by David黄金龙's avatar David黄金龙

活动详情框架

parent d0afbd39
...@@ -406,6 +406,8 @@ ...@@ -406,6 +406,8 @@
A567E5B82BD7643D00D5D5A0 /* YHSearchItemLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */; }; A567E5B82BD7643D00D5D5A0 /* YHSearchItemLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */; };
A56D2D612B62020C009C83A8 /* YHContractMainItemStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */; }; A56D2D612B62020C009C83A8 /* YHContractMainItemStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */; };
A5787E342C22B45700B021D7 /* YHActivityListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5787E332C22B45700B021D7 /* YHActivityListCell.swift */; }; A5787E342C22B45700B021D7 /* YHActivityListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5787E332C22B45700B021D7 /* YHActivityListCell.swift */; };
A5787E362C23CFDA00B021D7 /* YHActivityDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5787E352C23CFDA00B021D7 /* YHActivityDetailViewController.swift */; };
A5787E382C23D1DC00B021D7 /* YHActivityDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5787E372C23D1DC00B021D7 /* YHActivityDetailCell.swift */; };
A580371E2BAD784B0031C312 /* YHMySchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */; }; A580371E2BAD784B0031C312 /* YHMySchemeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */; };
A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */; }; A58037212BAD7B2A0031C312 /* YHMySchemeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */; };
A582B23D2BB944ED009D098C /* YHHKPlanDoctumentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A582B23C2BB944ED009D098C /* YHHKPlanDoctumentVC.swift */; }; A582B23D2BB944ED009D098C /* YHHKPlanDoctumentVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A582B23C2BB944ED009D098C /* YHHKPlanDoctumentVC.swift */; };
...@@ -941,6 +943,8 @@ ...@@ -941,6 +943,8 @@
A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchItemLayout.swift; sourceTree = "<group>"; }; A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchItemLayout.swift; sourceTree = "<group>"; };
A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHContractMainItemStatusCell.swift; sourceTree = "<group>"; }; A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHContractMainItemStatusCell.swift; sourceTree = "<group>"; };
A5787E332C22B45700B021D7 /* YHActivityListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHActivityListCell.swift; sourceTree = "<group>"; }; A5787E332C22B45700B021D7 /* YHActivityListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHActivityListCell.swift; sourceTree = "<group>"; };
A5787E352C23CFDA00B021D7 /* YHActivityDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHActivityDetailViewController.swift; sourceTree = "<group>"; };
A5787E372C23D1DC00B021D7 /* YHActivityDetailCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHActivityDetailCell.swift; sourceTree = "<group>"; };
A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySchemeViewModel.swift; sourceTree = "<group>"; }; A580371D2BAD784B0031C312 /* YHMySchemeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySchemeViewModel.swift; sourceTree = "<group>"; };
A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySchemeModel.swift; sourceTree = "<group>"; }; A58037202BAD7B2A0031C312 /* YHMySchemeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMySchemeModel.swift; sourceTree = "<group>"; };
A582B23C2BB944ED009D098C /* YHHKPlanDoctumentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKPlanDoctumentVC.swift; sourceTree = "<group>"; }; A582B23C2BB944ED009D098C /* YHHKPlanDoctumentVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHHKPlanDoctumentVC.swift; sourceTree = "<group>"; };
...@@ -2279,6 +2283,7 @@ ...@@ -2279,6 +2283,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
044D0BEF2C2025FF00C5CF5E /* YHActivityListViewController.swift */, 044D0BEF2C2025FF00C5CF5E /* YHActivityListViewController.swift */,
A5787E352C23CFDA00B021D7 /* YHActivityDetailViewController.swift */,
); );
path = C; path = C;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2287,6 +2292,7 @@ ...@@ -2287,6 +2292,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A5787E332C22B45700B021D7 /* YHActivityListCell.swift */, A5787E332C22B45700B021D7 /* YHActivityListCell.swift */,
A5787E372C23D1DC00B021D7 /* YHActivityDetailCell.swift */,
); );
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -3270,6 +3276,7 @@ ...@@ -3270,6 +3276,7 @@
A567E59F2BD7643D00D5D5A0 /* YHStartPageViewController.swift in Sources */, A567E59F2BD7643D00D5D5A0 /* YHStartPageViewController.swift in Sources */,
045EEF202B9F171A0022A143 /* YHCardExampleView.swift in Sources */, 045EEF202B9F171A0022A143 /* YHCardExampleView.swift in Sources */,
A567E5A72BD7643D00D5D5A0 /* YHHomeKingKongBlockView.swift in Sources */, A567E5A72BD7643D00D5D5A0 /* YHHomeKingKongBlockView.swift in Sources */,
A5787E382C23D1DC00B021D7 /* YHActivityDetailCell.swift in Sources */,
04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */, 04A6715E2B9FFCA700C1FB91 /* YHCertificateNameCell.swift in Sources */,
A567E5AF2BD7643D00D5D5A0 /* YHHomeWebViewBottomForSavePicView.swift in Sources */, A567E5AF2BD7643D00D5D5A0 /* YHHomeWebViewBottomForSavePicView.swift in Sources */,
048787D72BCE96F50036E221 /* YHServiceOrderProgressTableViewCell.swift in Sources */, 048787D72BCE96F50036E221 /* YHServiceOrderProgressTableViewCell.swift in Sources */,
...@@ -3288,6 +3295,7 @@ ...@@ -3288,6 +3295,7 @@
0414BDAB2BC7E9C200225367 /* YHMyPermissionCell.swift in Sources */, 0414BDAB2BC7E9C200225367 /* YHMyPermissionCell.swift in Sources */,
04C8F4832B7216D800ADF59B /* YHUserInfoHeaderView.swift in Sources */, 04C8F4832B7216D800ADF59B /* YHUserInfoHeaderView.swift in Sources */,
045EEEAF2B9F171A0022A143 /* YHWorkExperienceTextItemView.swift in Sources */, 045EEEAF2B9F171A0022A143 /* YHWorkExperienceTextItemView.swift in Sources */,
A5787E362C23CFDA00B021D7 /* YHActivityDetailViewController.swift in Sources */,
A5ACE9492B4564F7002C94D2 /* YHHUDSuccessView.swift in Sources */, A5ACE9492B4564F7002C94D2 /* YHHUDSuccessView.swift in Sources */,
045EEE9C2B9F171A0022A143 /* YHCompanyViewModel.swift in Sources */, 045EEE9C2B9F171A0022A143 /* YHCompanyViewModel.swift in Sources */,
A58556BA2B6BCF1A003746B2 /* YHPersonInfoFillStepModel.swift in Sources */, A58556BA2B6BCF1A003746B2 /* YHPersonInfoFillStepModel.swift in Sources */,
......
//
// YHActivityDetailViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/6/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHActivityDetailViewController: YHBaseViewController {
lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped)
tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = UIColor.white
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHActivityDetailCell.self, forCellReuseIdentifier: YHActivityDetailCell.cellReuseIdentifier)
tableView.backgroundView = self.emptyDataTipsView
return tableView
}()
lazy var emptyDataTipsView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("暂无活动", kNoFriendsBgName)
view.topMargin = 222
view.isHidden = true
return view
}()
// MARK: - 生命周期方法
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
gk_navigationBar.isHidden = true
gk_navigationBar.backgroundColor = .white
view.addSubview(self.tableView)
tableView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview()
make.top.equalToSuperview()
}
tableView.es.addYHPullToRefresh {
self.loadFirstData()
}
tableView.es.addInfiniteScrolling {
self.loadMoreData()
}
}
var friendsArr:[String] = ["","","","","","","","",""]
}
extension YHActivityDetailViewController {
func loadMoreData() {
// DispatchQueue.global().async {
// self.viewModel.getHomeNewsList(firstPageFlag : false) {[weak self] success, error in
// guard let self = self else { return }
// DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.35, execute: {
// CATransaction.setDisableActions(true)
// self.homeCollectView.reloadData()
// CATransaction.commit()
//
// self.homeCollectView.es.stopLoadingMore()
// if self.viewModel.hasMoreForHomeNews == false {
// self.homeCollectView.es.noticeNoMoreData()
// self.homeCollectView.footer?.alpha = 1
// }
// })
// }
// }
DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
self.tableView.es.stopLoadingMore()
})
}
func loadFirstData() {
// self.viewModel.getHomeNewsList(firstPageFlag : true) {[weak self] success, error in
// guard let self = self else { return }
//
// if let arrB = self.viewModel.arrHomeNewsData,arrB.count > 0 {
// let arrString = arrB.toJSONString()
// UserDefaults.standard.set(arrString, forKey: "homeFirstPageNewsData")
// UserDefaults.standard.synchronize()
// }
//
// DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
// self.homeCollectView.es.stopPullToRefresh()
//
//
// if self.viewModel.hasMoreForHomeNews == false {
// self.homeCollectView.es.noticeNoMoreData()
// self.homeCollectView.footer?.alpha = 1
// }
//
// CATransaction.setDisableActions(true)
// self.homeCollectView.reloadData()
// CATransaction.commit()
// })
// }
DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
self.tableView.es.stopPullToRefresh()
})
}
}
extension YHActivityDetailViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
if self.friendsArr.count > 0 {
return friendsArr.count
}
return 0
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHActivityDetailCell.cellReuseIdentifier, for: indexPath) as! YHActivityDetailCell
cell.sessionIndex = indexPath.section
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 185.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
var height : CGFloat = 16.0
if section != 0 {
height = 20.0
}
return height
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
var height : CGFloat = 16.0
if section != 0 {
height = 20.0
}
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth-16.0*2, height: height))
view.backgroundColor = .clear
return view
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth-16.0*2, height: 0.001))
view.backgroundColor = .clear
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.001
}
}
...@@ -14,37 +14,15 @@ import JXSegmentedView ...@@ -14,37 +14,15 @@ import JXSegmentedView
*/ */
class YHActivityListViewController: YHBaseViewController { class YHActivityListViewController: YHBaseViewController {
// MARK: - 生命周期方法
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .clear
gk_navigationBar.isHidden = true
gk_navigationBar.backgroundColor = .white
self.view.backgroundColor = UIColor(hex: 0xF8FAFB)
self.view.addSubview(self.tableView)
self.tableView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview()
make.top.equalToSuperview()
}
}
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.grouped) let tableView = UITableView(frame:.zero, style:.grouped)
tableView.estimatedSectionHeaderHeight = 185
tableView.showsVerticalScrollIndicator = false tableView.showsVerticalScrollIndicator = false
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: 0xF8FAFB) tableView.backgroundColor = UIColor.white
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
tableView.register(YHActivityListCell.self, forCellReuseIdentifier: YHActivityListCell.cellReuseIdentifier) tableView.register(YHActivityListCell.self, forCellReuseIdentifier: YHActivityListCell.cellReuseIdentifier)
// tableView.contentInset = UIEdgeInsets(top: YHFriendsResponseView.height+16, left: 0, bottom: 0, right: 0)
// tableView.addSubview(self.friendRequestView)
tableView.backgroundView = self.emptyDataTipsView tableView.backgroundView = self.emptyDataTipsView
return tableView return tableView
}() }()
...@@ -56,26 +34,105 @@ class YHActivityListViewController: YHBaseViewController { ...@@ -56,26 +34,105 @@ class YHActivityListViewController: YHBaseViewController {
return view return view
}() }()
var friendsArr:[String] = ["","",""] // MARK: - 生命周期方法
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
gk_navigationBar.isHidden = true
gk_navigationBar.backgroundColor = .white
view.addSubview(self.tableView)
tableView.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview()
make.top.equalToSuperview()
}
tableView.es.addYHPullToRefresh {
self.loadFirstData()
}
tableView.es.addInfiniteScrolling {
self.loadMoreData()
}
}
var friendsArr:[String] = ["","","","","","","","",""]
}
extension YHActivityListViewController {
func loadMoreData() {
// DispatchQueue.global().async {
// self.viewModel.getHomeNewsList(firstPageFlag : false) {[weak self] success, error in
// guard let self = self else { return }
// DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.35, execute: {
// CATransaction.setDisableActions(true)
// self.homeCollectView.reloadData()
// CATransaction.commit()
//
// self.homeCollectView.es.stopLoadingMore()
// if self.viewModel.hasMoreForHomeNews == false {
// self.homeCollectView.es.noticeNoMoreData()
// self.homeCollectView.footer?.alpha = 1
// }
// })
// }
// }
DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
self.tableView.es.stopLoadingMore()
})
}
func loadFirstData() {
// self.viewModel.getHomeNewsList(firstPageFlag : true) {[weak self] success, error in
// guard let self = self else { return }
//
// if let arrB = self.viewModel.arrHomeNewsData,arrB.count > 0 {
// let arrString = arrB.toJSONString()
// UserDefaults.standard.set(arrString, forKey: "homeFirstPageNewsData")
// UserDefaults.standard.synchronize()
// }
//
// DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
// self.homeCollectView.es.stopPullToRefresh()
//
//
// if self.viewModel.hasMoreForHomeNews == false {
// self.homeCollectView.es.noticeNoMoreData()
// self.homeCollectView.footer?.alpha = 1
// }
//
// CATransaction.setDisableActions(true)
// self.homeCollectView.reloadData()
// CATransaction.commit()
// })
// }
DispatchQueue.main.asyncAfter(deadline: .now()+0.5, execute: {
self.tableView.es.stopPullToRefresh()
})
}
} }
extension YHActivityListViewController: UITableViewDelegate, UITableViewDataSource { extension YHActivityListViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int { func numberOfSections(in tableView: UITableView) -> Int {
if self.friendsArr.count > 0 { if self.friendsArr.count > 0 {
return 1 return friendsArr.count
} }
return 0 return 0
} }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return friendsArr.count return 1
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: YHActivityListCell.cellReuseIdentifier, for: indexPath) as! YHActivityListCell let cell = tableView.dequeueReusableCell(withIdentifier: YHActivityListCell.cellReuseIdentifier, for: indexPath) as! YHActivityListCell
// if 0 <= indexPath.row && indexPath.row < friendsArr.count { cell.sessionIndex = indexPath.section
// }
return cell return cell
} }
...@@ -84,43 +141,39 @@ extension YHActivityListViewController: UITableViewDelegate, UITableViewDataSour ...@@ -84,43 +141,39 @@ extension YHActivityListViewController: UITableViewDelegate, UITableViewDataSour
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHActivityDetailViewController()
navigationController?.pushViewController(vc)
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
var height : CGFloat = 16.0
if section != 0 {
height = 20.0
}
return height
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
// if 0 <= indexPath.row && indexPath.row < friendsArr.count { var height : CGFloat = 16.0
// let vc = YHMyNameCardViewController() if section != 0 {
// self.navigationController?.pushViewController(vc) height = 20.0
// } }
let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth-16.0*2, height: height))
view.backgroundColor = .clear
return view
} }
// func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
// return 52.0 let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth-16.0*2, height: 0.001))
// } view.backgroundColor = .clear
// return view
// func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { }
// let view = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth-16.0*2, height: 52))
// view.backgroundColor = .white func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// return 0.001
// let titleLabel = UILabel() }
// titleLabel.text = "好友列表"
// titleLabel.textColor = UIColor.mainTextColor
// titleLabel.textAlignment = .left
// titleLabel.font = UIFont.PFSC_M(ofSize:16)
// view.addSubview(titleLabel)
//
// let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
// let path = UIBezierPath(roundedRect:view.bounds,byRoundingCorners: corner,cornerRadii:CGSizeMake(6.0, 6.0))
// let layer = CAShapeLayer()
// layer.frame = view.bounds
// layer.path = path.cgPath
// view.layer.mask = layer
//
// titleLabel.snp.makeConstraints { make in
// make.left.equalTo(16)
// make.top.equalTo(16)
// make.height.equalTo(22)
// }
// return view
// }
} }
......
//
// YHActivityDetailCell.swift
// galaxy
//
// Created by davidhuangA on 2024/6/20.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHActivityDetailCell: UITableViewCell {
static let cellReuseIdentifier = "YHActivityDetailCell"
var sessionIndex : Int = 0 {
didSet {
let tmp = sessionIndex % 3
let name = "activity_cell_bkg_" + String(tmp)
bkgImgV.image = UIImage(named: name)
contentView.backgroundColor = .red//for test hjl
}
}
lazy var bkgImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "activity_cell_bkg_0")
// view.contentMode = .scaleAspectFill
return view
}()
lazy var vipImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "activity_vip_icon")
view.contentMode = .scaleAspectFill
return view
}()
lazy var nameLabel:UILabel = {
let nameLabel = UILabel()
nameLabel.textColor = UIColor.mainTextColor
nameLabel.textAlignment = .left
nameLabel.font = UIFont.PFSC_M(ofSize:18)
nameLabel.text = "银河APP发布会"
nameLabel.numberOfLines = 2
return nameLabel
}()
lazy var activityImgV:UIImageView = {
let view = UIImageView()
view.contentMode = .scaleAspectFill
view.backgroundColor = .purple //for test hjl
return view
}()
lazy var lineView:UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
lazy var dateLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12)
label.text = "08/08 周五 18:00-20:00"
return label
}()
lazy var detailLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.mainTextColor70
label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12)
label.text = "深圳深南大道本元大厦26A银河体验中心"
return label
}()
lazy var statusLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.brandMainColor
label.textAlignment = .right
label.font = UIFont.PFSC_R(ofSize:12)
label.text = "立即报名"
return label
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
}
extension YHActivityDetailCell {
func setupUI() {
backgroundColor = .clear
selectionStyle = .none
contentView.addSubview(bkgImgV)
contentView.addSubview(vipImgV)
contentView.addSubview(nameLabel)
contentView.addSubview(activityImgV)
contentView.addSubview(lineView)
contentView.addSubview(dateLabel)
contentView.addSubview(detailLabel)
contentView.addSubview(statusLabel)
bkgImgV.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
vipImgV.snp.makeConstraints { make in
make.top.left.equalToSuperview()
make.width.equalTo(44)
make.height.equalTo(18)
}
activityImgV.snp.makeConstraints { make in
make.right.equalTo(-20)
make.top.equalTo(20)
make.width.height.equalTo(72)
}
nameLabel.snp.makeConstraints { make in
make.top.equalTo(28)
make.left.equalTo(18)
make.right.equalTo(activityImgV.snp.left).offset(-20)
}
lineView.snp.makeConstraints { make in
make.top.equalTo(activityImgV.snp.bottom).offset(20)
make.left.equalTo(nameLabel.snp.left)
make.right.equalTo(activityImgV.snp.right)
make.height.equalTo(1)
}
dateLabel.snp.makeConstraints { make in
make.top.equalTo(lineView.snp.bottom).offset(14)
make.left.equalTo(lineView.snp.left)
make.right.equalTo(lineView.snp.right)
make.height.equalTo(17)
}
statusLabel.snp.makeConstraints { make in
make.top.equalTo(dateLabel.snp.bottom).offset(8)
make.right.equalTo(dateLabel.snp.right)
make.height.equalTo(17)
make.width.equalTo(48)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(statusLabel.snp.top)
make.left.equalTo(dateLabel.snp.left)
make.height.equalTo(17)
make.right.equalTo(statusLabel.snp.left).offset(16)
}
}
}
...@@ -11,9 +11,26 @@ import UIKit ...@@ -11,9 +11,26 @@ import UIKit
class YHActivityListCell: UITableViewCell { class YHActivityListCell: UITableViewCell {
static let cellReuseIdentifier = "YHActivityListCell" static let cellReuseIdentifier = "YHActivityListCell"
lazy var vipImgV:UIImageView = {
var sessionIndex : Int = 0 {
didSet {
let tmp = sessionIndex % 3
let name = "activity_cell_bkg_" + String(tmp)
bkgImgV.image = UIImage(named: name)
contentView.backgroundColor = .red//for test hjl
}
}
lazy var bkgImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "activity_cell_bkg_0") view.image = UIImage(named: "activity_cell_bkg_0")
// view.contentMode = .scaleAspectFill
return view
}()
lazy var vipImgV:UIImageView = {
let view = UIImageView()
view.image = UIImage(named: "activity_vip_icon")
view.contentMode = .scaleAspectFill view.contentMode = .scaleAspectFill
return view return view
}() }()
...@@ -22,13 +39,17 @@ class YHActivityListCell: UITableViewCell { ...@@ -22,13 +39,17 @@ class YHActivityListCell: UITableViewCell {
let nameLabel = UILabel() let nameLabel = UILabel()
nameLabel.textColor = UIColor.mainTextColor nameLabel.textColor = UIColor.mainTextColor
nameLabel.textAlignment = .left nameLabel.textAlignment = .left
nameLabel.font = UIFont.PFSC_B(ofSize:16) nameLabel.font = UIFont.PFSC_M(ofSize:18)
nameLabel.text = "银河APP发布会"
nameLabel.numberOfLines = 2
return nameLabel return nameLabel
}() }()
lazy var signImgV:UIImageView = {
lazy var activityImgV:UIImageView = {
let view = UIImageView() let view = UIImageView()
view.image = UIImage(named: "people_sign") view.contentMode = .scaleAspectFill
view.backgroundColor = .purple //for test hjl
return view return view
}() }()
...@@ -38,19 +59,32 @@ class YHActivityListCell: UITableViewCell { ...@@ -38,19 +59,32 @@ class YHActivityListCell: UITableViewCell {
return view return view
}() }()
lazy var professionalLabel:UILabel = { lazy var dateLabel:UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor.mainTextColor70 label.textColor = UIColor.mainTextColor70
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:13) label.font = UIFont.PFSC_R(ofSize:12)
label.text = "08/08 周五 18:00-20:00"
return label return label
}() }()
lazy var detailLabel:UILabel = { lazy var detailLabel:UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor.mainTextColor50 label.textColor = UIColor.mainTextColor70
label.textAlignment = .left label.textAlignment = .left
label.font = UIFont.PFSC_R(ofSize:12) label.font = UIFont.PFSC_R(ofSize:12)
label.text = "深圳深南大道本元大厦26A银河体验中心"
return label
}()
lazy var statusLabel:UILabel = {
let label = UILabel()
label.textColor = UIColor.brandMainColor
label.textAlignment = .right
label.font = UIFont.PFSC_R(ofSize:12)
label.text = "立即报名"
return label return label
}() }()
...@@ -63,10 +97,75 @@ class YHActivityListCell: UITableViewCell { ...@@ -63,10 +97,75 @@ class YHActivityListCell: UITableViewCell {
setupUI() setupUI()
} }
}
extension YHActivityListCell {
func setupUI() { func setupUI() {
backgroundColor = .clear
selectionStyle = .none
contentView.addSubview(bkgImgV)
contentView.addSubview(vipImgV)
contentView.addSubview(nameLabel)
contentView.addSubview(activityImgV)
contentView.addSubview(lineView)
contentView.addSubview(dateLabel)
contentView.addSubview(detailLabel)
contentView.addSubview(statusLabel)
bkgImgV.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
vipImgV.snp.makeConstraints { make in
make.top.left.equalToSuperview()
make.width.equalTo(44)
make.height.equalTo(18)
}
activityImgV.snp.makeConstraints { make in
make.right.equalTo(-20)
make.top.equalTo(20)
make.width.height.equalTo(72)
}
nameLabel.snp.makeConstraints { make in
make.top.equalTo(28)
make.left.equalTo(18)
make.right.equalTo(activityImgV.snp.left).offset(-20)
}
lineView.snp.makeConstraints { make in
make.top.equalTo(activityImgV.snp.bottom).offset(20)
make.left.equalTo(nameLabel.snp.left)
make.right.equalTo(activityImgV.snp.right)
make.height.equalTo(1)
}
dateLabel.snp.makeConstraints { make in
make.top.equalTo(lineView.snp.bottom).offset(14)
make.left.equalTo(lineView.snp.left)
make.right.equalTo(lineView.snp.right)
make.height.equalTo(17)
}
statusLabel.snp.makeConstraints { make in
make.top.equalTo(dateLabel.snp.bottom).offset(8)
make.right.equalTo(dateLabel.snp.right)
make.height.equalTo(17)
make.width.equalTo(48)
}
self.backgroundColor = .white detailLabel.snp.makeConstraints { make in
self.selectionStyle = .none make.top.equalTo(statusLabel.snp.top)
self.contentView.addSubview(self.vipImgV) make.left.equalTo(dateLabel.snp.left)
make.height.equalTo(17)
make.right.equalTo(statusLabel.snp.left).offset(16)
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment