// // QSLHomeEmptyView.swift // QuickSearchLocation // // Created by mac on 2024/4/11. // import UIKit import MarqueeLabel protocol QSLHomeEmptyViewDelegate: NSObjectProtocol { func emptyFriPhoneViewClick() } class QSLHomeEmptyView: UIView { weak var delegate: QSLHomeEmptyViewDelegate? lazy var emptyBgView: UIView = { let _emptyBgView = UIView() if let image = UIImage.gradient([UIColor.hexStringColor(hexString: "#F6F6F6", alpha: 0), QSLColor.backGroundColor], size: CGSize(width: qsl_kScreenW, height: 175), locations: [0,22.0 / 175.0], direction: .vertical) { _emptyBgView.backgroundColor = UIColor(patternImage: image) } return _emptyBgView }() lazy var emptyFriView: UIView = { let _emptyFriView = UIView() _emptyFriView.backgroundColor = .white _emptyFriView.addRadius(radius: 6) return _emptyFriView }() lazy var emptyFriTitleIcon: UIImageView = { let _emptyFriTitleIcon = UIImageView() _emptyFriTitleIcon.image = UIImage.image(color: QSLColor.themeMainColor, size: CGSize(width: 4, height: 16)) return _emptyFriTitleIcon }() lazy var emptyFriTitleLabel: UILabel = { let _emptyFriTitleLabel = UILabel() _emptyFriTitleLabel.boldFont(15) _emptyFriTitleLabel.textColor = QSLColor.textColor_333 _emptyFriTitleLabel.text = "查找好友" return _emptyFriTitleLabel }() lazy var emptyFriPhoneView: UIView = { let _emptyFriPhoneView = UIView() _emptyFriPhoneView.backgroundColor = QSLColor.backGroundColor _emptyFriPhoneView.addRadius(radius: 4) _emptyFriPhoneView.isUserInteractionEnabled = true let tap = UITapGestureRecognizer(target: self, action: #selector(emptyFriPhoneViewAction)) _emptyFriPhoneView.addGestureRecognizer(tap) return _emptyFriPhoneView }() lazy var emptyFriPhoneLabel: UILabel = { let _emptyFriPhoneLabel = UILabel() _emptyFriPhoneLabel.font(14) _emptyFriPhoneLabel.textColor = QSLColor.textColor_AAA _emptyFriPhoneLabel.text = "输入手机号码 查看定位" return _emptyFriPhoneLabel }() lazy var lineIcon: UIImageView = { let _lineIcon = UIImageView() _lineIcon.image = UIImage.image(color: QSLColor.textColor_AAA, size: CGSize(width: 1, height: 16)) return _lineIcon }() lazy var emptyFriAddLabel: UILabel = { let _emptyFriAddLabel = UILabel() _emptyFriAddLabel.mediumFont(14) _emptyFriAddLabel.textColor = QSLColor.textColor_333 _emptyFriAddLabel.text = "查找" return _emptyFriAddLabel }() lazy var emptyInfoView: UIView = { let _emptyInfoView = UIView() _emptyInfoView.backgroundColor = UIColor.hexStringColor(hexString:"#E6CD9F") _emptyInfoView.addRadius(radius: 14) return _emptyInfoView }() lazy var emptyInfoBgImageView: UIImageView = { let _emptyInfoBgImageView = UIImageView() _emptyInfoBgImageView.image = UIImage(named: "home_empty_info_bg") return _emptyInfoBgImageView }() lazy var emptyInfoIcon: UIImageView = { let _emptyInfoIcon = UIImageView() _emptyInfoIcon.image = UIImage(named: "home_empty_info_icon") return _emptyInfoIcon }() lazy var emptyInfoUserLabel: UILabel = { let _emptyInfoUserLabel = UILabel() _emptyInfoUserLabel.font(12) _emptyInfoUserLabel.textColor = .white _emptyInfoUserLabel.text = "我:" return _emptyInfoUserLabel }() lazy var emptyInfoAddrLabel: MarqueeLabel = { // let _emptyInfoAddrLabel = MarqueeLabel(frame: CGRect(x: 0, y: 0, width: qsl_kScreenW - 224.0, height: 17.0), duration: 8.0, fadeLength: 10) let _emptyInfoAddrLabel = MarqueeLabel(frame: .zero, duration: 8.0, fadeLength: 10) _emptyInfoAddrLabel.font(12) _emptyInfoAddrLabel.textColor = .white _emptyInfoAddrLabel.text = "广东奥林匹克广东奥林匹克广东奥林匹克 " return _emptyInfoAddrLabel }() lazy var emptyInfoCheckLabel: UILabel = { let _emptyInfoCheckLabel = UILabel() _emptyInfoCheckLabel.textAlignment = .right _emptyInfoCheckLabel.font(12) _emptyInfoCheckLabel.textColor = UIColor.hexStringColor(hexString: "#5A330F") _emptyInfoCheckLabel.text = "查看轨迹" return _emptyInfoCheckLabel }() override init(frame: CGRect) { super.init(frame: frame) addSubview(emptyBgView) emptyBgView.addSubview(emptyFriView) emptyFriView.addSubview(emptyFriTitleIcon) emptyFriView.addSubview(emptyFriTitleLabel) emptyFriView.addSubview(emptyFriPhoneView) emptyFriPhoneView.addSubview(emptyFriPhoneLabel) emptyFriPhoneView.addSubview(lineIcon) emptyFriPhoneView.addSubview(emptyFriAddLabel) addSubview(emptyInfoView) emptyInfoView.addSubview(emptyInfoBgImageView) emptyInfoView.addSubview(emptyInfoIcon) emptyInfoView.addSubview(emptyInfoUserLabel) emptyInfoView.addSubview(emptyInfoAddrLabel) emptyInfoView.addSubview(emptyInfoCheckLabel) } override func layoutSubviews() { super.layoutSubviews() emptyBgView.snp.makeConstraints { make in make.edges.equalTo(0) } emptyFriView.snp.makeConstraints { make in make.left.equalTo(12) make.right.bottom.equalTo(-12) make.height.equalTo(127) } emptyFriTitleIcon.snp.makeConstraints { make in make.left.equalTo(12) make.top.equalTo(20) } emptyFriTitleLabel.snp.makeConstraints { make in make.left.equalTo(emptyFriTitleIcon.snp.right).offset(6) make.centerY.equalTo(emptyFriTitleIcon.snp.centerY) } emptyFriPhoneView.snp.makeConstraints { make in make.left.equalTo(12) make.right.equalTo(-12) make.bottom.equalTo(-25) make.height.equalTo(44) } emptyFriPhoneLabel.snp.makeConstraints { make in make.left.equalTo(16) make.centerY.equalTo(emptyFriPhoneView.snp.centerY) } emptyFriAddLabel.snp.makeConstraints { make in make.right.equalTo(-14) make.centerY.equalTo(emptyFriPhoneView.snp.centerY) } lineIcon.snp.makeConstraints { make in make.right.equalTo(emptyFriAddLabel.snp.left).offset(-11) make.centerY.equalTo(emptyFriPhoneView.snp.centerY) } emptyInfoView.snp.makeConstraints { make in make.left.equalTo(12); make.bottom.equalTo(emptyFriView.snp.top).offset(-8); make.width.equalTo(269); make.height.equalTo(28) } emptyInfoBgImageView.snp.makeConstraints { make in make.left.top.bottom.equalTo(0) } emptyInfoIcon.snp.makeConstraints { make in make.size.equalTo(CGSize(width: 24, height: 24)) make.left.top.equalTo(2) make.bottom.equalTo(-2) } emptyInfoUserLabel.snp.makeConstraints { make in make.width.equalTo(22) make.left.equalTo(emptyInfoIcon.snp.right).offset(6) make.centerY.equalTo(emptyInfoIcon.snp.centerY) } emptyInfoCheckLabel.snp.makeConstraints { make in make.top.bottom.equalTo(0); make.right.equalTo(-8); make.width.equalTo(58) } emptyInfoAddrLabel.snp.makeConstraints { make in make.left.equalTo(emptyInfoUserLabel.snp.right) make.centerY.equalTo(emptyInfoIcon.snp.centerY) make.right.equalTo(emptyInfoCheckLabel.snp.left).offset(-8) make.height.equalTo(17) } } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } extension QSLHomeEmptyView { @objc func emptyFriPhoneViewAction() { delegate?.emptyFriPhoneViewClick() } }