|
@@ -0,0 +1,118 @@
|
|
|
+//
|
|
|
+// ShoppingCartListNoneItemCell.swift
|
|
|
+// RainbowPlanet
|
|
|
+//
|
|
|
+// Created by Christopher on 2019/5/9.
|
|
|
+// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
|
+// 购物车无商品の缺省Cell
|
|
|
+
|
|
|
+import UIKit
|
|
|
+import RxSwift
|
|
|
+import RxCocoa
|
|
|
+
|
|
|
+class ShoppingCartListNoneItemCell: UITableViewCell {
|
|
|
+
|
|
|
+ override var frame: CGRect {
|
|
|
+ get {
|
|
|
+ return super.frame
|
|
|
+ }
|
|
|
+ set {
|
|
|
+ var frame = newValue
|
|
|
+ frame.origin.x += 14 * kScaleWidth
|
|
|
+ frame.size.width -= 14 * kScaleWidth * 2
|
|
|
+ super.frame = frame
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ class func cellWith(tableView:UITableView,indexPath:IndexPath) -> ShoppingCartListNoneItemCell {
|
|
|
+ let ID = "ShoppingCartListNoneItemCell"
|
|
|
+ tableView.register(ShoppingCartListNoneItemCell.self, forCellReuseIdentifier: ID)
|
|
|
+ let cell : ShoppingCartListNoneItemCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! ShoppingCartListNoneItemCell
|
|
|
+ cell.indexPath = indexPath
|
|
|
+ return cell
|
|
|
+ }
|
|
|
+
|
|
|
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
|
|
+ super.init(style: style, reuseIdentifier: reuseIdentifier)
|
|
|
+ setupViews()
|
|
|
+ setupLayouts()
|
|
|
+ }
|
|
|
+
|
|
|
+ required init?(coder aDecoder: NSCoder) {
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
+ }
|
|
|
+
|
|
|
+ var indexPath: IndexPath? {
|
|
|
+ didSet {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //MRAK: - 设置View
|
|
|
+ private func setupViews() {
|
|
|
+ self.selectionStyle = .none
|
|
|
+
|
|
|
+ addSubview(iconImageView)
|
|
|
+ addSubview(titleLabel)
|
|
|
+ addSubview(jumpButton)
|
|
|
+ }
|
|
|
+
|
|
|
+ private func setupLayouts() {
|
|
|
+ iconImageView.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(30)
|
|
|
+ make.centerX.equalToSuperview()
|
|
|
+ make.width.equalTo(200)
|
|
|
+ make.height.equalTo(140)
|
|
|
+ }
|
|
|
+
|
|
|
+ titleLabel.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(iconImageView.snp.bottom).offset(16)
|
|
|
+ make.centerX.equalToSuperview()
|
|
|
+ make.left.equalToSuperview().offset(30)
|
|
|
+ make.right.equalToSuperview().offset(-30)
|
|
|
+ }
|
|
|
+
|
|
|
+ jumpButton.snp.makeConstraints { (make) in
|
|
|
+ make.top.equalTo(titleLabel.snp.bottom).offset(30)
|
|
|
+ make.bottom.equalToSuperview().offset(-30)
|
|
|
+ make.centerX.equalToSuperview()
|
|
|
+ make.width.equalTo(160)
|
|
|
+ make.height.equalTo(36)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ lazy var iconImageView : UIImageView = {
|
|
|
+ let iconImageView = UIImageView()
|
|
|
+ iconImageView.image = kImage(name: "page05")
|
|
|
+ return iconImageView
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var titleLabel: UILabel = {
|
|
|
+ let titleLabel = UILabel()
|
|
|
+ titleLabel.text = "购物车内无商品"
|
|
|
+ titleLabel.textColor = k333333Color
|
|
|
+ titleLabel.font = kRegularFont14
|
|
|
+ titleLabel.textAlignment = .center
|
|
|
+ return titleLabel
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var jumpButton: UIButton = {
|
|
|
+ let jumpButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
+ jumpButton.backgroundColor = kFFA42FColor
|
|
|
+ jumpButton.setTitle("到首页逛逛", for: UIControl.State.normal)
|
|
|
+ jumpButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
+ jumpButton.titleLabel?.font = kRegularFont16
|
|
|
+ jumpButton.cornerRadius = 18
|
|
|
+ jumpButton.masksToBounds = true
|
|
|
+// jumpButton.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
+// // if let forgetPasswordBlock = self?.forgetPasswordBlock {
|
|
|
+// // forgetPasswordBlock()
|
|
|
+// // }
|
|
|
+// print("点击了跳转到首页")
|
|
|
+// }).disposed(by: disposeBag)
|
|
|
+ return jumpButton
|
|
|
+ }()
|
|
|
+
|
|
|
+}
|
|
|
+
|