|
|
|
@ -0,0 +1,183 @@
|
|
|
|
|
//
|
|
|
|
|
// ContactViewController.swift
|
|
|
|
|
// IndieMusic
|
|
|
|
|
//
|
|
|
|
|
// Created by WenLei on 2024/3/9.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
|
|
class ContactViewController: ViewController {
|
|
|
|
|
let contactView: ContactView = {
|
|
|
|
|
let contactView = ContactView.init()
|
|
|
|
|
|
|
|
|
|
return contactView
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
|
super.viewDidLoad()
|
|
|
|
|
|
|
|
|
|
// Do any additional setup after loading the view.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func makeUI() {
|
|
|
|
|
view.addSubview(contactView)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func bindViewModel() {
|
|
|
|
|
super.bindViewModel()
|
|
|
|
|
|
|
|
|
|
contactView.cancelButton.rx.tap.subscribe { _ in
|
|
|
|
|
self.navigator.dismiss(sender: self)
|
|
|
|
|
}.disposed(by: rx.disposeBag)
|
|
|
|
|
|
|
|
|
|
contactView.confirmButton.rx.tap.subscribe { _ in
|
|
|
|
|
self.navigator.dismiss(sender: self)
|
|
|
|
|
|
|
|
|
|
UIPasteboard.general.string = Configs.App.wechatContact
|
|
|
|
|
|
|
|
|
|
}.disposed(by: rx.disposeBag)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override func viewDidLayoutSubviews() {
|
|
|
|
|
super.viewDidLayoutSubviews()
|
|
|
|
|
|
|
|
|
|
contactView.snp.makeConstraints { make in
|
|
|
|
|
make.centerX.equalTo(view)
|
|
|
|
|
make.centerY.equalTo(view)
|
|
|
|
|
make.left.equalTo(view).offset(46)
|
|
|
|
|
make.right.equalTo(view).offset(-46)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension ContactViewController: UIViewControllerTransitioningDelegate {
|
|
|
|
|
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
|
|
|
|
|
|
|
|
|
|
let carePresentationVC = CardPresentationController.init(presentedViewController: presented, presenting: presenting)
|
|
|
|
|
carePresentationVC.viewType = .tips(true)
|
|
|
|
|
|
|
|
|
|
return carePresentationVC
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ContactView: UIView {
|
|
|
|
|
let titleLabel: UILabel = {
|
|
|
|
|
let titleLabel = UILabel.init()
|
|
|
|
|
titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .medium)
|
|
|
|
|
titleLabel.textColor = .primaryText()
|
|
|
|
|
titleLabel.text = "添加微信联系我们"
|
|
|
|
|
|
|
|
|
|
return titleLabel
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
let tipsLabel: UILabel = {
|
|
|
|
|
let tipsLabel = UILabel.init()
|
|
|
|
|
tipsLabel.textColor = .tertiaryText()
|
|
|
|
|
tipsLabel.font = UIFont.systemFont(ofSize: 12)
|
|
|
|
|
tipsLabel.text = "微信号:indier"
|
|
|
|
|
|
|
|
|
|
return tipsLabel
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
let qrCodeView: UIImageView = {
|
|
|
|
|
let qrCodeView = UIImageView.init()
|
|
|
|
|
qrCodeView.image = UIImage.init(named: "contact_qr")
|
|
|
|
|
|
|
|
|
|
return qrCodeView
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
let cancelButton: UIButton = {
|
|
|
|
|
let cancelButton = UIButton.init()
|
|
|
|
|
cancelButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
|
|
|
|
|
cancelButton.backgroundColor = .init(hex: 0x000000, alpha: 0.05)
|
|
|
|
|
cancelButton.layer.cornerRadius = 22
|
|
|
|
|
cancelButton.layer.masksToBounds = true
|
|
|
|
|
cancelButton.setTitle("取消", for: .normal)
|
|
|
|
|
cancelButton.setTitleColor(.secondaryText(), for: .normal)
|
|
|
|
|
|
|
|
|
|
return cancelButton
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
let confirmButton: UIButton = {
|
|
|
|
|
let confirmButton = UIButton.init()
|
|
|
|
|
confirmButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
|
|
|
|
|
confirmButton.setTitle("复制微信", for: .normal)
|
|
|
|
|
confirmButton.setTitleColor(.white, for: .normal)
|
|
|
|
|
confirmButton.layer.cornerRadius = 22
|
|
|
|
|
confirmButton.layer.masksToBounds = true
|
|
|
|
|
confirmButton.backgroundColor = .primary()
|
|
|
|
|
|
|
|
|
|
return confirmButton
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override init(frame: CGRect) {
|
|
|
|
|
super.init(frame: frame)
|
|
|
|
|
|
|
|
|
|
makeUI()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func makeUI() {
|
|
|
|
|
backgroundColor = .white
|
|
|
|
|
layer.cornerRadius = 12
|
|
|
|
|
layer.masksToBounds = true
|
|
|
|
|
|
|
|
|
|
addSubview(titleLabel)
|
|
|
|
|
addSubview(tipsLabel)
|
|
|
|
|
addSubview(qrCodeView)
|
|
|
|
|
addSubview(cancelButton)
|
|
|
|
|
addSubview(confirmButton)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func layoutSubviews() {
|
|
|
|
|
super.layoutSubviews()
|
|
|
|
|
|
|
|
|
|
titleLabel.snp.makeConstraints { make in
|
|
|
|
|
make.centerX.equalTo(self)
|
|
|
|
|
make.top.equalTo(self).offset(24)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tipsLabel.snp.makeConstraints { make in
|
|
|
|
|
make.centerX.equalTo(self)
|
|
|
|
|
make.top.equalTo(titleLabel.snp.bottom).offset(3)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qrCodeView.snp.makeConstraints { make in
|
|
|
|
|
make.top.equalTo(tipsLabel.snp.bottom).offset(9)
|
|
|
|
|
make.size.equalTo(CGSize.init(width: 142, height: 142))
|
|
|
|
|
make.centerX.equalTo(self)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cancelButton.snp.makeConstraints { make in
|
|
|
|
|
make.left.equalTo(self).offset(18)
|
|
|
|
|
make.right.equalTo(self.snp.centerX).offset(-6)
|
|
|
|
|
make.height.equalTo(44)
|
|
|
|
|
make.top.equalTo(qrCodeView.snp.bottom).offset(28)
|
|
|
|
|
make.bottom.equalTo(self).offset(-24)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confirmButton.snp.makeConstraints { make in
|
|
|
|
|
make.right.equalTo(self).offset(-18)
|
|
|
|
|
make.top.equalTo(qrCodeView.snp.bottom).offset(28)
|
|
|
|
|
make.height.equalTo(44)
|
|
|
|
|
make.left.equalTo(self.snp.centerX).offset(6)
|
|
|
|
|
make.bottom.equalTo(self).offset(-24)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|