Commit 4d4cacd4 authored by Steven杜宇's avatar Steven杜宇

// 方案

parent 83270873
......@@ -7,6 +7,7 @@
//
import UIKit
import JXSegmentedView
class YHPlanViewController: YHBaseViewController {
......@@ -17,6 +18,7 @@ class YHPlanViewController: YHBaseViewController {
"双法防",
"沙发上",
"啊防守打法"]
let topScrollHeight = 146.0-44.0
lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
......@@ -24,6 +26,7 @@ class YHPlanViewController: YHBaseViewController {
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}
tableView.bounces = false
tableView.showsVerticalScrollIndicator = false
tableView.estimatedSectionHeaderHeight = 1.0
tableView.estimatedSectionFooterHeight = 1.0
......@@ -35,27 +38,187 @@ class YHPlanViewController: YHBaseViewController {
tableView.register(YHPlanScoreCell.self, forCellReuseIdentifier: YHPlanScoreCell.cellReuseIdentifier)
tableView.register(YHPlanCustomerCaseListCell.self, forCellReuseIdentifier: YHPlanCustomerCaseListCell.cellReuseIdentifier)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCell")
view.backgroundColor = .clear
tableView.tableHeaderView = headerView
return tableView
}()
lazy var headerView: UIView = {
let v = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 146.0))
v.addSubview(titleImgView)
v.addSubview(descLabel)
v.addSubview(revalueBtn)
segmented1View.dataSource = segmented1DataSource
v.addSubview(segmented1View)
titleImgView.snp.makeConstraints { make in
make.left.equalTo(16)
make.width.equalTo(266)
make.height.equalTo(29)
make.top.equalTo(18)
}
descLabel.snp.makeConstraints { make in
make.left.equalTo(16)
make.top.equalTo(titleImgView.snp.bottom).offset(17)
make.height.equalTo(16)
}
revalueBtn.snp.makeConstraints { make in
make.top.equalTo(titleImgView).offset(16)
make.right.equalTo(-16)
make.width.equalTo(68)
make.height.equalTo(28)
}
segmented1View.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(30)
make.bottom.equalTo(-10)
}
return v
}()
lazy var bgImgView: UIImageView = {
let v = UIImageView()
v.image = UIImage(named: "plan_list_head_bg")
return v
}()
lazy var titleImgView: UIImageView = {
let v = UIImageView()
v.image = UIImage(named: "plan_list_title")
return v
}()
lazy var descLabel: UILabel = {
let lable = UILabel()
lable.textColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
lable.textAlignment = .left
lable.font = UIFont.PFSC_R(ofSize: 12)
lable.text = "具体方案您可以联系专属顾问和生活管家深入咨询"
return lable
}()
lazy var revalueBtn: UIButton = {
let btn = UIButton()
btn.backgroundColor = .clear
btn.setTitle("重新评估", for: .normal)
btn.setTitleColor(.white, for: .normal)
btn.titleLabel?.font = UIFont.PFSC_M(ofSize: 11)
btn.addTarget(self, action: #selector(didRevalueBtnClicked), for: .touchUpInside)
btn.layer.cornerRadius = kCornerRadius3
btn.layer.borderWidth = 0.5
btn.layer.borderColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.2).cgColor
btn.YH_clickEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)
return btn
}()
let segmentTitles = ["综合", "工作", "生活", "投资", "逗留"]
lazy var segmented1View: JXSegmentedView = {
let view = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_safeAreaInsetsTop(), width: KScreenWidth, height: 30))
view.backgroundColor = .clear
// 配置指示器
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorHeight = 2
indicator.indicatorCornerRadius = 0.0
indicator.indicatorColor = UIColor.white
view.indicators = [indicator]
return view
}()
lazy var segmented1DataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.titles = segmentTitles
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 16)
dataSource.titleNormalColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleSelectedColor = .white
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = (KScreenWidth-16.0*2.0)/Double(segmentTitles.count)
dataSource.itemSpacing = 0.0
return dataSource
}()
lazy var segmented2View: JXSegmentedView = {
let view = JXSegmentedView(frame: CGRect(x: 0, y: k_Height_safeAreaInsetsTop(), width: KScreenWidth, height: 48))
view.backgroundColor = .clear
// 配置指示器
let indicator = JXSegmentedIndicatorLineView()
indicator.indicatorWidth = 16
indicator.indicatorHeight = 2
indicator.indicatorCornerRadius = 0.0
indicator.indicatorColor = .mainTextColor
view.indicators = [indicator]
return view
}()
lazy var segmented2DataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.titles = segmentTitles
dataSource.titleNormalFont = UIFont.PFSC_R(ofSize: 16)
dataSource.titleNormalColor = UIColor.init(hex: 0x6A7586)
dataSource.titleSelectedFont = UIFont.PFSC_M(ofSize: 16)
dataSource.titleSelectedColor = .mainTextColor
dataSource.isItemSpacingAverageEnabled = false
dataSource.itemWidth = (KScreenWidth-16.0*2.0)/Double(segmentTitles.count)
dataSource.itemSpacing = 0.0
return dataSource
}()
lazy var fixedSegmentView: UIView = {
let v = UIView()
v.backgroundColor = .white
segmented2View.dataSource = segmented2DataSource
v.addSubview(segmented2View)
segmented2View.snp.makeConstraints { make in
make.left.equalTo(16)
make.right.equalTo(-16)
make.height.equalTo(30)
make.bottom.equalTo(-6)
make.top.equalTo(8)
}
return v
}()
@objc func didRevalueBtnClicked() {
}
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .init(hex: 0xF5F6F8)
self.view.backgroundColor = .init(hex: 0xF8F9FB)
self.view.addSubview(bgImgView)
self.view.addSubview(tableView)
self.view.addSubview(fixedSegmentView)
bgImgView.snp.makeConstraints { make in
make.left.right.top.equalToSuperview()
make.height.equalTo(bgImgView.snp.width)
}
tableView.snp.makeConstraints { make in
make.left.right.bottom.equalToSuperview()
make.top.equalTo(200)
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
}
fixedSegmentView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.height.equalTo(44)
}
}
}
......@@ -136,8 +299,8 @@ extension YHPlanViewController: UITableViewDelegate, UITableViewDataSource {
var yOffset1 = 0.0
var yOffset2 = 0.0
for (index, item) in cases.enumerated() {
var textHeight = self.getHeigt(font: UIFont.PFSC_R(ofSize: 14), width: cellWidth-8.0*2.0, string: cases[index])
for (index, _) in cases.enumerated() {
let textHeight = self.getHeigt(font: UIFont.PFSC_R(ofSize: 14), width: cellWidth-8.0*2.0, string: cases[index])
let caseCellHeight = textHeight + (cellWidth*(200.0/166.0) + 8.0+12.0+10.0)
if index % 2 == 0 {
......@@ -149,5 +312,13 @@ extension YHPlanViewController: UITableViewDelegate, UITableViewDataSource {
let contentHeight = max(yOffset1, yOffset2) + 20.0 + 12.0
return contentHeight
}
}
extension YHPlanViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
bgImgView.isHidden = scrollView.contentOffset.y >= topScrollHeight
segmented2View.isHidden = scrollView.contentOffset.y < topScrollHeight
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "续签至永居方案分析@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "续签至永居方案分析@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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