//
|
// JobTCell.swift
|
// OKProject
|
//
|
// Created by 无故事王国 on 2022/5/16.
|
// Copyright © 2022 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
import RxSwift
|
|
class JobTCell: UITableViewCell {
|
|
@IBOutlet weak var titleL: UILabel!
|
@IBOutlet weak var priceL: UILabel!
|
@IBOutlet weak var collectionView: UICollectionView!
|
@IBOutlet weak var collectionViewHeiCons: NSLayoutConstraint!
|
private var jobListModel:JobListModel?
|
private var disposeBag = DisposeBag()
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
selectionStyle = .none
|
collectionView.delegate = self
|
collectionView.dataSource = self
|
collectionView.register(UINib(nibName: "Common_SingleText_CCell", bundle: nil), forCellWithReuseIdentifier: "_Common_SingleText_CCell")
|
}
|
|
func setJobListModel(_ m:JobListModel){
|
jobListModel = m
|
|
//75002 [司机招募]招聘信息显示标题(内外一致)且需将面议招聘信息显示为薪资面议
|
titleL.text = m.title
|
if m.startSalary == 0 && m.endSalary == 0{
|
priceL.text = "薪资面议"
|
}else{
|
priceL.text = String(format: "%.2lf-%.2lf元/月", m.startSalary,m.endSalary)
|
}
|
collectionView.reloadData()
|
}
|
}
|
|
extension JobTCell:UICollectionViewDelegate{
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
}
|
}
|
|
extension JobTCell:UICollectionViewDataSource{
|
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
return jobListModel!.welfare.components(separatedBy: ",").filter({!$0.isEmpty}).count
|
}
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
let text = jobListModel!.welfare.components(separatedBy: ",").filter({!$0.isEmpty})[indexPath.row]
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_Common_SingleText_CCell", for: indexPath) as! Common_SingleText_CCell
|
cell.titleL.text = text
|
cell.titleL.font = UIFont.systemFont(ofSize: 12)
|
cell.titleL.cornerRadius = 2
|
cell.titleL.borderWidth = 0.6
|
cell.titleL.maskToBounds = true
|
cell.titleL.borderColor = UIColor.color(hexString: "#00BF30")
|
cell.titleL.backgroundColor = .white
|
cell.titleL.textColor = UIColor.color(hexString: "#00BF30")
|
return cell
|
}
|
}
|
|
extension JobTCell:UICollectionViewDelegateFlowLayout{
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
|
return 8
|
}
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
|
return 8
|
}
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
let title = jobListModel!.welfare.components(separatedBy: ",").filter({!$0.isEmpty})[indexPath.row]
|
let calCellW = title.width(UIFont.systemFont(ofSize: 12), height: 18)
|
return CGSize(width: calCellW+6, height: 18)
|
}
|
}
|