111 lines
3.2 KiB
Swift
111 lines
3.2 KiB
Swift
//
|
|
// SPMineMemberYesView.swift
|
|
// MoviaBox
|
|
//
|
|
// Created by 佳尔 on 2025/4/27.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SPMineMemberYesView: UIView {
|
|
|
|
var userInfo: SPUserInfo? {
|
|
didSet {
|
|
let date = Date(timeIntervalSince1970: userInfo?.vip_end_time ?? 0)
|
|
#if DEBUG
|
|
expirationTimeLabel.text = String(format: "VlP expiration time : %@".localized, date.format(dateFormat: "yyyy-MM-dd HH:mm:ss"))
|
|
#else
|
|
expirationTimeLabel.text = String(format: "VlP expiration time : %@".localized, date.format(dateFormat: "yyyy-MM-dd"))
|
|
#endif
|
|
|
|
}
|
|
}
|
|
|
|
//MARK: UI属性
|
|
private lazy var iconImageView: UIImageView = {
|
|
let imageView = UIImageView(image: UIImage(named: "vip_icon_02"))
|
|
return imageView
|
|
}()
|
|
|
|
private lazy var titleLabel: UILabel = {
|
|
let label = SPGradientLabel()
|
|
label.gradientLayer.colors = [UIColor.colorFFFFC8().cgColor, UIColor.colorF76359().cgColor]
|
|
label.font = .fontMedium(ofSize: 18)
|
|
label.text = "VIP"
|
|
return label
|
|
}()
|
|
|
|
private lazy var expirationTimeLabel: UILabel = {
|
|
let label = UILabel()
|
|
label.font = .fontRegular(ofSize: 12)
|
|
label.textColor = .colorFFD5B2()
|
|
label.text = "VlP expiration time : 2023-11-23"
|
|
return label
|
|
}()
|
|
|
|
private lazy var openButton: UIButton = {
|
|
let button = JXButton(type: .custom)
|
|
button.setTitle("Stream Unlimited".localized, for: .normal)
|
|
button.setTitleColor(.color321704(), for: .normal)
|
|
button.jx_font = .fontRegular(ofSize: 12)
|
|
button.leftAndRightMargin = 12
|
|
button.colors = [UIColor.colorF2A3A3().cgColor, UIColor.colorFEE095().cgColor]
|
|
button.locations = [0, 1]
|
|
button.startPoint = .init(x: 0, y: 0.5)
|
|
button.endPoint = .init(x: 1, y: 0.5)
|
|
button.layer.cornerRadius = 11
|
|
button.layer.masksToBounds = true
|
|
return button
|
|
}()
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
|
|
_setupUI()
|
|
}
|
|
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
override func layoutSubviews() {
|
|
super.layoutSubviews()
|
|
}
|
|
|
|
}
|
|
|
|
extension SPMineMemberYesView {
|
|
|
|
private func _setupUI() {
|
|
addSubview(iconImageView)
|
|
addSubview(titleLabel)
|
|
addSubview(expirationTimeLabel)
|
|
addSubview(openButton)
|
|
|
|
iconImageView.snp.makeConstraints { make in
|
|
make.left.equalToSuperview().offset(3)
|
|
make.top.equalToSuperview().offset(12)
|
|
}
|
|
|
|
titleLabel.snp.makeConstraints { make in
|
|
make.left.equalTo(iconImageView.snp.right).offset(-5)
|
|
make.centerY.equalTo(iconImageView)
|
|
}
|
|
|
|
expirationTimeLabel.snp.makeConstraints { make in
|
|
make.left.equalToSuperview().offset(14)
|
|
make.bottom.equalTo(openButton.snp.top).offset(kSPMainW(-10))
|
|
}
|
|
|
|
openButton.snp.makeConstraints { make in
|
|
make.left.equalToSuperview().offset(12)
|
|
make.bottom.equalToSuperview().offset(-16)
|
|
make.height.equalTo(22)
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|