Commit d81a27e8 authored by Steven杜宇's avatar Steven杜宇

// 赴港

parent 4108251b
...@@ -20,17 +20,19 @@ class YHGrabItem { ...@@ -20,17 +20,19 @@ class YHGrabItem {
var detail: String = "" var detail: String = ""
var files: [String] = [] var files: [String] = []
var publicFiles: [String] = [] var publicFiles: [String] = []
var isSingleLine: Bool = true
required init() { required init() {
} }
init(type: YHGrabItemViewType, title: String, detail: String, files:[String] = [], publicFiles:[String] = []) { init(type: YHGrabItemViewType, title: String, detail: String, files:[String] = [], publicFiles:[String] = [], isSingleLine: Bool = true) {
self.type = type self.type = type
self.title = title self.title = title
self.detail = detail self.detail = detail
self.files = files self.files = files
self.publicFiles = publicFiles self.publicFiles = publicFiles
self.isSingleLine = isSingleLine
} }
} }
...@@ -68,6 +70,15 @@ class YHGrabNumberInfoItemView: UIView { ...@@ -68,6 +70,15 @@ class YHGrabNumberInfoItemView: UIView {
titleLabel.text = item.title titleLabel.text = item.title
detailLabel.text = item.detail detailLabel.text = item.detail
if item.isSingleLine {
detailLabel.textAlignment = .right
} else { // 需要显示多行
// 当文字只有一行时右对齐,当文字有多行时左对齐
let detaiLabelMaxWidth = KScreenWidth-(34.0+14.0)*2.0-titleMaxWidth
let detailHeight = self.getHeight(text: item.detail, font: detailLabel.font, width: detaiLabelMaxWidth)
detailLabel.textAlignment = detailHeight > 20.0 ? .left : .right
}
if item.type == .grab { if item.type == .grab {
detailLabel.textColor = grabNumColor detailLabel.textColor = grabNumColor
...@@ -77,7 +88,6 @@ class YHGrabNumberInfoItemView: UIView { ...@@ -77,7 +88,6 @@ class YHGrabNumberInfoItemView: UIView {
dotView.isHidden = (item.type != .grab) dotView.isHidden = (item.type != .grab)
collectionView.isHidden = item.type != .files collectionView.isHidden = item.type != .files
collectionView.reloadData() collectionView.reloadData()
var rowCount = item.files.count/4 var rowCount = item.files.count/4
if item.files.count%4 != 0 { if item.files.count%4 != 0 {
...@@ -148,13 +158,13 @@ class YHGrabNumberInfoItemView: UIView { ...@@ -148,13 +158,13 @@ class YHGrabNumberInfoItemView: UIView {
make.right.equalTo(0) make.right.equalTo(0)
make.top.equalTo(0) make.top.equalTo(0)
make.height.greaterThanOrEqualTo(20.0) make.height.greaterThanOrEqualTo(20.0)
make.left.greaterThanOrEqualTo(titleLabel.snp.right).offset(0)
} }
dotView.snp.makeConstraints { make in dotView.snp.makeConstraints { make in
make.width.height.equalTo(dotWidth) make.width.height.equalTo(dotWidth)
make.centerY.equalTo(detailLabel) make.centerY.equalTo(detailLabel)
make.right.equalTo(detailLabel.snp.left).offset(-4) make.right.equalTo(detailLabel.snp.left).offset(-4)
make.left.greaterThanOrEqualTo(titleLabel.snp.right).offset(0)
} }
collectionView.snp.makeConstraints { make in collectionView.snp.makeConstraints { make in
...@@ -164,6 +174,13 @@ class YHGrabNumberInfoItemView: UIView { ...@@ -164,6 +174,13 @@ class YHGrabNumberInfoItemView: UIView {
make.bottom.equalTo(0) make.bottom.equalTo(0)
} }
} }
func getHeight(text:String, font:UIFont, width:CGFloat)->CGFloat {
let size = CGSize.init(width:width , height: CGFloat(MAXFLOAT))
let dic = [NSAttributedString.Key.font: font]
let strSize = text.boundingRect(with: size, options: [.usesLineFragmentOrigin], attributes: dic, context:nil).size
return CGSizeMake(strSize.width, ceil(strSize.height)).height
}
} }
class YHGrabNumberInfoView: UIView { class YHGrabNumberInfoView: UIView {
......
...@@ -31,14 +31,15 @@ class YHGrabingNumberListCell: UITableViewCell { ...@@ -31,14 +31,15 @@ class YHGrabingNumberListCell: UITableViewCell {
} }
// 抢号信息 // 抢号信息
let items1 = [YHGrabItem(type: .grab, title: "赴港时间:", detail: "抢号中"), let items1 = [YHGrabItem(type: .grab, title: "赴港时间:", detail: "抢号中", isSingleLine: true),
YHGrabItem(type: .grab, title: "香港入境处:", detail: "抢号中"), YHGrabItem(type: .grab, title: "香港入境处:", detail: "抢号中", isSingleLine: true),
YHGrabItem(type: .grab, title: "抢号反馈回执:", detail: "抢号中"),] YHGrabItem(type: .grab, title: "抢号反馈回执:", detail: "抢号中",isSingleLine: true),]
listView.grabInfoView.updateItems(items1) listView.grabInfoView.updateItems(items1)
// 意向信息 // 意向信息
let items2 = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: "\(group.wantMinTime)~\(group.wantMaxTime)"), let items2 = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: "\(group.wantMinTime) ~ \(group.wantMaxTime)",isSingleLine: true),
YHGrabItem(type: .info, title: "期望香港办证点:", detail: group.wantImmigrationOffice)] YHGrabItem(type: .info, title: "期望香港办证点:", detail: group.wantImmigrationOffice, isSingleLine: false)]
listView.intentionInfoView.updateItems(items2) listView.intentionInfoView.updateItems(items2)
listContainView.addSubview(listView) listContainView.addSubview(listView)
......
...@@ -56,9 +56,9 @@ class YHGrabingNumberListView: UIView { ...@@ -56,9 +56,9 @@ class YHGrabingNumberListView: UIView {
lazy var grabInfoView: YHGrabNumberInfoView = { lazy var grabInfoView: YHGrabNumberInfoView = {
let view = YHGrabNumberInfoView(frame: .zero) let view = YHGrabNumberInfoView(frame: .zero)
view.titleLabel.text = "抢号信息" view.titleLabel.text = "抢号信息"
let items = [YHGrabItem(type: .grab, title: "赴港时间:", detail: "抢号中"), let items = [YHGrabItem(type: .grab, title: "赴港时间:", detail: "抢号中", isSingleLine: true),
YHGrabItem(type: .grab, title: "香港入境处:", detail: "抢号中"), YHGrabItem(type: .grab, title: "香港入境处:", detail: "抢号中", isSingleLine: true),
YHGrabItem(type: .grab, title: "抢号反馈回执:", detail: "抢号中"),] YHGrabItem(type: .grab, title: "抢号反馈回执:", detail: "抢号中", isSingleLine: true),]
view.updateItems(items) view.updateItems(items)
return view return view
}() }()
...@@ -66,8 +66,8 @@ class YHGrabingNumberListView: UIView { ...@@ -66,8 +66,8 @@ class YHGrabingNumberListView: UIView {
lazy var intentionInfoView: YHGrabNumberInfoView = { lazy var intentionInfoView: YHGrabNumberInfoView = {
let view = YHGrabNumberInfoView(frame: .zero) let view = YHGrabNumberInfoView(frame: .zero)
view.titleLabel.text = "意向信息" view.titleLabel.text = "意向信息"
let items = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: ""), let items = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: "", isSingleLine: true),
YHGrabItem(type: .info, title: "期望香港办证点:", detail: ""), YHGrabItem(type: .info, title: "期望香港办证点:", detail: "", isSingleLine: false),
YHGrabItem(type: .files, title: "抢号反馈回执:", detail: ""),] YHGrabItem(type: .files, title: "抢号反馈回执:", detail: ""),]
view.updateItems(items) view.updateItems(items)
return view return view
......
...@@ -24,14 +24,14 @@ class YHHaveGrabbedNumberListCell: UITableViewCell { ...@@ -24,14 +24,14 @@ class YHHaveGrabbedNumberListCell: UITableViewCell {
listView.membersLabel.text = "成员:\(group.getMemberNames())" listView.membersLabel.text = "成员:\(group.getMemberNames())"
// 抢号信息 // 抢号信息
let items1 = [YHGrabItem(type: .info, title: "赴港时间:", detail: group.goTime), let items1 = [YHGrabItem(type: .info, title: "赴港时间:", detail: group.goTime, isSingleLine:true),
YHGrabItem(type: .info, title: "香港入境处:", detail: group.immigrationOffice), YHGrabItem(type: .info, title: "香港入境处:", detail: group.immigrationOffice, isSingleLine: false),
YHGrabItem(type: .files, title: "抢号反馈回执:", detail: "", files:group.receipts, publicFiles: group.publicReceipts)] YHGrabItem(type: .files, title: "抢号反馈回执:", detail: "", files:group.receipts, publicFiles: group.publicReceipts)]
listView.grabInfoView.updateItems(items1) listView.grabInfoView.updateItems(items1)
// 意向信息 // 意向信息
let items2 = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: "\(group.wantMinTime)~\(group.wantMaxTime)"), let items2 = [YHGrabItem(type: .info, title: "期望赴港时间:", detail: "\(group.wantMinTime) ~ \(group.wantMaxTime)", isSingleLine:true),
YHGrabItem(type: .info, title: "期望香港办证点:", detail: group.wantImmigrationOffice)] YHGrabItem(type: .info, title: "期望香港办证点:", detail: group.wantImmigrationOffice, isSingleLine:false)]
listView.intentionInfoView.updateItems(items2) listView.intentionInfoView.updateItems(items2)
listContainView.addSubview(listView) listContainView.addSubview(listView)
......
...@@ -338,7 +338,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -338,7 +338,7 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if true { if true {
let vc = YHCertificateAppointViewController() let vc = YHCertificateAppointViewController()
vc.orderId = 151296 vc.orderId = 151085
// 151296 // 151296
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
return return
......
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