Commit 15fb8b14 authored by David黄金龙's avatar David黄金龙

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  服务中心接口调试
  // UI走查
  //  UI走查
parents e00556a3 fc4da478
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
import UIKit import UIKit
class YHSearchInfoCell: UITableViewCell { class YHSearchInfoCell: UITableViewCell {
static let cellReuseIdentifier = "YHSearchInfoCell" static let cellReuseIdentifier = "YHSearchInfoCell"
...@@ -39,9 +41,8 @@ class YHSearchInfoCell: UITableViewCell { ...@@ -39,9 +41,8 @@ class YHSearchInfoCell: UITableViewCell {
return label return label
}() }()
func setupUI() { func setupUI() {
contentView.backgroundColor = .white contentView.backgroundColor = .white
contentView.addSubview(headImgView) contentView.addSubview(headImgView)
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
...@@ -58,5 +59,25 @@ class YHSearchInfoCell: UITableViewCell { ...@@ -58,5 +59,25 @@ class YHSearchInfoCell: UITableViewCell {
make.right.equalToSuperview().offset(-20) make.right.equalToSuperview().offset(-20)
} }
} }
func highlightText(in text: String, highlightString: String, highlightColor: UIColor) -> NSAttributedString {
let attributedString = NSMutableAttributedString(string: text)
// 创建一个属性字典,用于设置高亮样式
let highlightAttributes: [NSAttributedString.Key: Any] = [
.backgroundColor: highlightColor
]
// 查找并应用高亮样式到指定文字
let range = (text as NSString).range(of: highlightString)
attributedString.addAttributes(highlightAttributes, range: range)
return attributedString
}
func hopeless() {
}
} }
...@@ -119,11 +119,11 @@ extension YHHomePageViewModel { ...@@ -119,11 +119,11 @@ extension YHHomePageViewModel {
//1. json字符串 转 对象 //1. json字符串 转 对象
if json.code == 200 { if json.code == 200 {
let dic = json.data let dic = json.data
// guard let result = [YHHomeListModel].deserialize(from: dic as? [Any]) else { guard let result = [YHHomeListModel].deserialize(from: dic as? [Any]) else {
// callBackBlock(false,nil) callBackBlock(false,nil)
// return return
// } }
// self.lists = result as? [YHHomeListModel] self.lists = result as? [YHHomeListModel]
callBackBlock(true, nil) callBackBlock(true, nil)
} else { } else {
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg) let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
......
...@@ -10,12 +10,16 @@ import UIKit ...@@ -10,12 +10,16 @@ import UIKit
import JXSegmentedView import JXSegmentedView
class YHServerHKLifeViewController: YHBaseViewController { class YHServerHKLifeViewController: YHBaseViewController {
let homeViewModel: YHHomePageViewModel = YHHomePageViewModel()
private let serviceCenterMainReqVM : YHServiceCenterMainViewModel = YHServiceCenterMainViewModel()
var tableHeadView: YHServerTableHeadView! var tableHeadView: YHServerTableHeadView!
var tableFootView: YHServiceTableFootView! var tableFootView: YHServiceTableFootView!
var sectionView: YHServiceSectionView! var sectionView: YHServiceSectionView!
var dataSouce: [YHHomeListModel] = [] {
didSet {
self.homeTableView.reloadData()
}
}
var homeTableView: UITableView = { var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain) let tableView = UITableView(frame: .zero, style: .plain)
if #available(iOS 15.0, *) { if #available(iOS 15.0, *) {
...@@ -44,15 +48,24 @@ class YHServerHKLifeViewController: YHBaseViewController { ...@@ -44,15 +48,24 @@ class YHServerHKLifeViewController: YHBaseViewController {
extension YHServerHKLifeViewController { extension YHServerHKLifeViewController {
func loadData() { func loadData() {
if YHLoginManager.shared.isLogin() == false {
return homeViewModel.getHomeBanner(2){[weak self] success, error in
guard let self = self else { return }
self.tableHeadView.bannarView.dataArr = self.homeViewModel.banners ?? []
} }
serviceCenterMainReqVM.getContactList { success, error in homeViewModel.getHomeClassify{[weak self] success, error in
if success == true { guard let self = self, let classify = self.homeViewModel.classify else { return }
for item in classify {
} else { let model = item as YHHomeClassifyModel
YHHUD.flash(message: error?.errorMsg ?? "请求出错") if model.id == 2 {
self.sectionView.items = model.children
let classifyID = model.children.first?.id ?? 0
self.homeViewModel.getList(classifyID) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.homeViewModel.lists ?? []
}
}
} }
} }
} }
...@@ -63,6 +76,13 @@ extension YHServerHKLifeViewController { ...@@ -63,6 +76,13 @@ extension YHServerHKLifeViewController {
sectionView = { sectionView = {
let view = YHServiceSectionView() let view = YHServiceSectionView()
view.block = {[weak self] model in
guard let self = self else { return }
self.homeViewModel.getList(model.id) {[weak self] success, error in
guard let self = self else { return }
self.dataSouce = self.homeViewModel.lists ?? []
}
}
return view return view
}() }()
...@@ -116,6 +136,7 @@ extension YHServerHKLifeViewController : UITableViewDelegate,UITableViewDataSour ...@@ -116,6 +136,7 @@ extension YHServerHKLifeViewController : UITableViewDelegate,UITableViewDataSour
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self) let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self)
cell0.tableFootView.items = dataSouce
cell0.selectionStyle = .none cell0.selectionStyle = .none
return cell0 return cell0
} }
...@@ -134,12 +155,6 @@ extension YHServerHKLifeViewController: JXSegmentedListContainerViewListDelegate ...@@ -134,12 +155,6 @@ extension YHServerHKLifeViewController: JXSegmentedListContainerViewListDelegate
class YHServerHKLifeViewCell: UITableViewCell { class YHServerHKLifeViewCell: UITableViewCell {
static let cellReuseIdentifier = "YHServerHKLifeViewCell" static let cellReuseIdentifier = "YHServerHKLifeViewCell"
var tableFootView: YHServiceTableFootView! var tableFootView: YHServiceTableFootView!
var dataModel : YHContactItemModel? {
didSet {
updateUI()
}
}
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
......
...@@ -47,7 +47,7 @@ extension YHServiceListViewController { ...@@ -47,7 +47,7 @@ extension YHServiceListViewController {
let classifyID = model.children.first?.id ?? 0 let classifyID = model.children.first?.id ?? 0
self.homeViewModel.getList(classifyID) {[weak self] success, error in self.homeViewModel.getList(classifyID) {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
self.normalView.dataSouce = self.homeViewModel.lists ?? []
} }
} }
} }
...@@ -85,6 +85,13 @@ extension YHServiceListViewController { ...@@ -85,6 +85,13 @@ extension YHServiceListViewController {
normalView = { normalView = {
let view = YHServerNoOrderView() let view = YHServerNoOrderView()
view.sectionBlock = {[weak self] model in
guard let self = self else { return }
self.homeViewModel.getList(model.id) {[weak self] success, error in
guard let self = self else { return }
self.normalView.dataSouce = self.homeViewModel.lists ?? []
}
}
return view return view
}() }()
view.addSubview(normalView) view.addSubview(normalView)
......
...@@ -36,7 +36,7 @@ class YHCertificateCategoryItem { ...@@ -36,7 +36,7 @@ class YHCertificateCategoryItem {
class YHCertificateListContainerVC: YHBaseViewController { class YHCertificateListContainerVC: YHBaseViewController {
static let segmentHeight = 53.0 static let segmentHeight = 49.0
var orderId : Int? var orderId : Int?
var filterDict : [String: String] = [:] var filterDict : [String: String] = [:]
...@@ -68,6 +68,12 @@ class YHCertificateListContainerVC: YHBaseViewController { ...@@ -68,6 +68,12 @@ class YHCertificateListContainerVC: YHBaseViewController {
YHCertificateCategoryItem(type: .finish)] YHCertificateCategoryItem(type: .finish)]
var itemVCs:[YHCertificateListVC] = [] var itemVCs:[YHCertificateListVC] = []
lazy var segmentContainerView: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
lazy var segmentedView : JXSegmentedView = { lazy var segmentedView : JXSegmentedView = {
let segview = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: Self.segmentHeight)) let segview = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_NavigationtBarAndStatuBar, width: KScreenWidth, height: Self.segmentHeight))
segview.dataSource = segmentedDataSource segview.dataSource = segmentedDataSource
...@@ -75,6 +81,7 @@ class YHCertificateListContainerVC: YHBaseViewController { ...@@ -75,6 +81,7 @@ class YHCertificateListContainerVC: YHBaseViewController {
//配置指示器 //配置指示器
let indicator = JXSegmentedIndicatorLineView() let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16 indicator.indicatorWidth = 16
indicator.indicatorHeight = 4.0
indicator.indicatorColor = .brandMainColor indicator.indicatorColor = .brandMainColor
segview.indicators = [indicator] segview.indicators = [indicator]
segview.backgroundColor = .clear segview.backgroundColor = .clear
...@@ -163,8 +170,9 @@ class YHCertificateListContainerVC: YHBaseViewController { ...@@ -163,8 +170,9 @@ class YHCertificateListContainerVC: YHBaseViewController {
itemVCs.append(vc) itemVCs.append(vc)
} }
view.addSubview(navBar) view.addSubview(navBar)
view.addSubview(segmentedView) view.addSubview(segmentContainerView)
view.addSubview(filterBtn) segmentContainerView.addSubview(segmentedView)
segmentContainerView.addSubview(filterBtn)
view.addSubview(listContainerView) view.addSubview(listContainerView)
navBar.snp.makeConstraints { make in navBar.snp.makeConstraints { make in
...@@ -172,21 +180,27 @@ class YHCertificateListContainerVC: YHBaseViewController { ...@@ -172,21 +180,27 @@ class YHCertificateListContainerVC: YHBaseViewController {
make.top.equalToSuperview().offset(k_Height_statusBar()) make.top.equalToSuperview().offset(k_Height_statusBar())
make.height.equalTo(k_Height_NavContentBar) make.height.equalTo(k_Height_NavContentBar)
} }
segmentContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(Self.segmentHeight+4)
}
segmentedView.snp.makeConstraints { make in segmentedView.snp.makeConstraints { make in
make.left.equalToSuperview() make.top.left.equalToSuperview()
make.right.equalToSuperview().offset(-21-18) make.right.equalToSuperview().offset(-21-18)
make.top.equalToSuperview().offset(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(Self.segmentHeight) make.height.equalTo(Self.segmentHeight)
} }
filterBtn.snp.makeConstraints { make in filterBtn.snp.makeConstraints { make in
make.width.height.equalTo(YHCertificateFilterButton.width) make.width.height.equalTo(YHCertificateFilterButton.width)
make.centerY.equalTo(segmentedView.snp.centerY) make.centerY.equalToSuperview()
make.right.equalToSuperview().offset(-18) make.right.equalToSuperview().offset(-18)
} }
listContainerView.snp.makeConstraints { make in listContainerView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.top.equalTo(segmentedView.snp.bottom) make.top.equalTo(segmentContainerView.snp.bottom)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
} }
......
...@@ -283,7 +283,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData ...@@ -283,7 +283,7 @@ extension YHCertificateUploadContentListVC: UITableViewDelegate, UITableViewData
} else if editType == .delete { // 删除 } else if editType == .delete { // 删除
let msg = "您确定要删除文档\(contentItem.name)吗" let msg = "您确定要删除文档\(contentItem.name)?"
YHTwoOptionAlertView.showAlertView(message:msg) { sure in YHTwoOptionAlertView.showAlertView(message:msg) { sure in
if !sure { return } if !sure { return }
// 删除 // 删除
......
...@@ -66,7 +66,20 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -66,7 +66,20 @@ class YHCertificateInfoCell: UITableViewCell {
if !model.nameExtra.applicant.isEmpty { if !model.nameExtra.applicant.isEmpty {
ownerStr = model.nameExtra.applicant ownerStr = model.nameExtra.applicant
} }
infoLabel.text = "类型: \(typeStr) 所属人: \(ownerStr)"
infoStr = "类型: \(typeStr) | 所属人: \(ownerStr)"
let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSC_R(ofSize:11),
.foregroundColor: UIColor.labelTextColor2
]
let attrString = NSMutableAttributedString(string: infoStr, attributes: attributes)
if let separatorRange = infoStr.range(of: String("|")) {
let range = NSRange(separatorRange, in: infoStr)
attrString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex: 0xF0F0F0), range: range)
}
infoLabel.attributedText = attrString
var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor)) var result:ASAttributedString = .init(string:"", .font(UIFont.PFSC_M(ofSize: 16)), .foreground(UIColor.mainTextColor))
let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor)) let mustTag: ASAttributedString = .init("*", .font(UIFont.PFSC_M(ofSize: 16)),.foreground(UIColor.failColor))
...@@ -155,7 +168,7 @@ class YHCertificateInfoCell: UITableViewCell { ...@@ -155,7 +168,7 @@ class YHCertificateInfoCell: UITableViewCell {
nameTextView.snp.makeConstraints { make in nameTextView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(10) make.left.equalToSuperview().offset(10)
make.top.equalToSuperview().offset(4) make.top.equalToSuperview().offset(4)
make.right.equalTo(statusLabel.snp.left).offset(-6) make.right.equalTo(statusLabel.snp.left).offset(-26)
} }
infoLabel.snp.makeConstraints { make in infoLabel.snp.makeConstraints { make in
......
...@@ -9,10 +9,16 @@ ...@@ -9,10 +9,16 @@
import UIKit import UIKit
class YHServerNoOrderView: UIView { class YHServerNoOrderView: UIView {
typealias SectionBlock = (YHClassifyModel) -> ()
var sectionBlock: SectionBlock?
var tableHeadView: YHServerTableHeadView! var tableHeadView: YHServerTableHeadView!
var tableFootView: YHServiceTableFootView!
var sectionView: YHServiceSectionView! var sectionView: YHServiceSectionView!
var dataSouce: [YHHomeListModel] = [] {
didSet {
self.homeTableView.reloadData()
}
}
var homeTableView: UITableView = { var homeTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain) let tableView = UITableView(frame: .zero, style: .plain)
if #available(iOS 15.0, *) { if #available(iOS 15.0, *) {
...@@ -41,16 +47,19 @@ class YHServerNoOrderView: UIView { ...@@ -41,16 +47,19 @@ class YHServerNoOrderView: UIView {
sectionView = { sectionView = {
let view = YHServiceSectionView() let view = YHServiceSectionView()
view.block = {[weak self] model in
guard let self = self else { return }
if let block = sectionBlock {
block(model)
}
}
return view return view
}() }()
tableHeadView = YHServerTableHeadView() tableHeadView = YHServerTableHeadView()
tableHeadView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 365) tableHeadView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 365)
// tableFootView = YHServiceTableFootView()
// tableFootView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight)
addSubview(homeTableView) addSubview(homeTableView)
homeTableView.tableHeaderView = tableHeadView homeTableView.tableHeaderView = tableHeadView
homeTableView.tableFooterView = tableFootView
homeTableView.snp.makeConstraints { make in homeTableView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview() make.top.left.right.equalToSuperview()
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
...@@ -94,6 +103,7 @@ extension YHServerNoOrderView : UITableViewDelegate,UITableViewDataSource { ...@@ -94,6 +103,7 @@ extension YHServerNoOrderView : UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self) let cell0 = tableView.dequeueReusableCell(withClass: YHServerHKLifeViewCell.self)
cell0.tableFootView.items = dataSouce
cell0.selectionStyle = .none cell0.selectionStyle = .none
return cell0 return cell0
} }
......
...@@ -10,7 +10,8 @@ import UIKit ...@@ -10,7 +10,8 @@ import UIKit
class YHServiceSectionView: UIView { class YHServiceSectionView: UIView {
typealias Block = (YHClassifyModel) -> ()
var block: Block?
var items: [YHClassifyModel] = [] { var items: [YHClassifyModel] = [] {
didSet { didSet {
...@@ -43,8 +44,6 @@ class YHServiceSectionView: UIView { ...@@ -43,8 +44,6 @@ class YHServiceSectionView: UIView {
super.init(frame: frame) super.init(frame: frame)
backgroundColor = .white backgroundColor = .white
setUpView() setUpView()
// self.items = ["优才","高才","留学","专才"]
// self.myCollectView.reloadData()
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
...@@ -74,46 +73,34 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo ...@@ -74,46 +73,34 @@ extension YHServiceSectionView: UICollectionViewDelegate, UICollectionViewDataSo
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHServiceSectionCollectionViewCell let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHServiceSectionCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHServiceSectionCollectionViewCell
cell.dataSource = items[indexPath.row] cell.dataSource = items[indexPath.row]
if indexPath.row == selectIndex { if indexPath.row == selectIndex {
cell.isSelected = true cell.setSelectedStyle()
} else { } else {
cell.isSelected = false cell.setDeSelectedStyle()
} }
return cell return cell
} }
private func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIndex = indexPath.row selectIndex = indexPath.row
collectionView.reloadData() collectionView.reloadData()
let model = items[indexPath.row]
if let block = block {
block(model)
}
print("index is \(indexPath.row)") print("index is \(indexPath.row)")
} }
} }
class YHServiceSectionCollectionViewCell: UICollectionViewCell { class YHServiceSectionCollectionViewCell: UICollectionViewCell {
static let cellReuseIdentifier = "YHServiceSectionCollectionViewCell" static let cellReuseIdentifier = "YHServiceSectionCollectionViewCell"
private var isSelect: Bool = false
override var isSelected: Bool {
set {
self.isSelect = newValue
if newValue {
self.setSelectedStyle()
} else {
self.setDeSelectedStyle()
}
}
get {
return self.isSelect
}
}
private func setSelectedStyle() { func setSelectedStyle() {
contentView.backgroundColor = UIColor.brandMainColor contentView.backgroundColor = UIColor.brandMainColor
descripeLable.textColor = UIColor.white descripeLable.textColor = UIColor.white
} }
private func setDeSelectedStyle() { func setDeSelectedStyle() {
contentView.backgroundColor = UIColor(hex: 0xf4f6fa) contentView.backgroundColor = UIColor(hex: 0xf4f6fa)
descripeLable.textColor = UIColor(hex: 0x94a3bb) descripeLable.textColor = UIColor(hex: 0x94a3bb)
} }
......
...@@ -10,14 +10,11 @@ import UIKit ...@@ -10,14 +10,11 @@ import UIKit
class YHServiceTableFootView: UIView { class YHServiceTableFootView: UIView {
lazy var items = { var items:[YHHomeListModel] = [] {
return [ didSet {
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""), self.myCollectView.reloadData()
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""), }
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""), }
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "")
]
}()
lazy var myCollectView = { lazy var myCollectView = {
// 设置布局方向 // 设置布局方向
...@@ -36,24 +33,10 @@ class YHServiceTableFootView: UIView { ...@@ -36,24 +33,10 @@ class YHServiceTableFootView: UIView {
return collectinoView return collectinoView
}() }()
var dataSource: YHScemeHeadModel? {
didSet {
updateAllViews()
}
}
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
backgroundColor = .white backgroundColor = .white
setUpView() setUpView()
self.items = [
AboutAdvantageItem(iconName: "about_match", title: "精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配精准匹配精准匹配精准匹配精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://inews.gtimg.com/om_bt/OjPq2cnMN_-ivDKjxpCZ2kk_ab8YC5VMnL-0pQ21fUvd4AA/1000"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配精准匹配精准匹配精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://img.pconline.com.cn/images/upload/upc/tx/itbbs/2101/25/c1/251135935_1611532823091_mthumb.jpg"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: ""),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://photo.16pic.com/00/47/86/16pic_4786353_b.jpg"),
AboutAdvantageItem(iconName: "about_match", title: "精准匹配", detail: "大数据精准匹配,专属方案获批率更高", url: "https://inews.gtimg.com/om_bt/OMvPDmiuH_X5Vq1YLNgbFEzD2h_-2dCfWQ7xZFcKFSEsAAA/641")
]
self.myCollectView.reloadData()
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
...@@ -71,27 +54,23 @@ class YHServiceTableFootView: UIView { ...@@ -71,27 +54,23 @@ class YHServiceTableFootView: UIView {
// } // }
} }
func updateAllViews() {
guard let model = dataSource else { return }
}
func getImageSize(_ url: String?) -> CGSize { func getImageSize(_ url: String?) -> CGSize {
// guard let urlStr = url, urlStr.count != 0 else { guard let urlStr = url, urlStr.count != 0 else {
// return CGSize.zero return CGSize.zero
// } }
// let tempUrl = URL(string: urlStr) let tempUrl = URL(string: urlStr)
// let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil) let imageSourceRef = CGImageSourceCreateWithURL(tempUrl! as CFURL, nil)
// var width: CGFloat = 0 var width: CGFloat = 0
// var height: CGFloat = 0 var height: CGFloat = 0
// if let imageSRef = imageSourceRef { if let imageSRef = imageSourceRef {
// let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil) let imageProperties = CGImageSourceCopyPropertiesAtIndex(imageSRef, 0, nil)
// if let imageP = imageProperties { if let imageP = imageProperties {
// let imageDict = imageP as Dictionary let imageDict = imageP as Dictionary
// width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat width = imageDict[kCGImagePropertyPixelWidth] as! CGFloat
// height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat height = imageDict[kCGImagePropertyPixelHeight] as! CGFloat
// } }
// } }
return CGSize(width: 150, height: 250) return CGSize(width: width, height: height)
} }
} }
...@@ -103,7 +82,7 @@ extension YHServiceTableFootView: UICollectionViewDelegate, UICollectionViewData ...@@ -103,7 +82,7 @@ extension YHServiceTableFootView: UICollectionViewDelegate, UICollectionViewData
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell let cell = collectionView.dequeueReusableCell(withReuseIdentifier: YHHomeCollectionViewCell.cellReuseIdentifier, for: indexPath) as! YHHomeCollectionViewCell
cell.dataSource = items[indexPath.row] cell.listModel = items[indexPath.row]
return cell return cell
} }
...@@ -133,7 +112,7 @@ extension YHServiceTableFootView: CollectionViewWaterfallLayoutDelegate { ...@@ -133,7 +112,7 @@ extension YHServiceTableFootView: CollectionViewWaterfallLayoutDelegate {
if textHeight > 40 { if textHeight > 40 {
textHeight = 40 textHeight = 40
} }
let imageSize = getImageSize(model.url) let imageSize = getImageSize(model.img_url)
var imageHeight = 0.0 var imageHeight = 0.0
if imageSize.width == 0 { if imageSize.width == 0 {
imageHeight = width imageHeight = width
......
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