diff --git a/Thimra/Base/Extension/UIColor+SPAdd.swift b/Thimra/Base/Extension/UIColor+SPAdd.swift index 410ff49..363acb1 100644 --- a/Thimra/Base/Extension/UIColor+SPAdd.swift +++ b/Thimra/Base/Extension/UIColor+SPAdd.swift @@ -204,5 +204,13 @@ extension UIColor { static func colorB0B0B3(alpha: CGFloat = 1) -> UIColor { return color(hex: 0xB0B0B3, alpha: alpha) } + + static func colorBBB9B3(alpha: CGFloat = 1) -> UIColor { + return color(hex: 0xBBB9B3, alpha: alpha) + } + + static func colorFFD791(alpha: CGFloat = 1) -> UIColor { + return color(hex: 0xFFD791, alpha: alpha) + } } diff --git a/Thimra/Class/Mine/View/SPMineHeaderView.swift b/Thimra/Class/Mine/View/SPMineHeaderView.swift index a986783..cc1bbd5 100644 --- a/Thimra/Class/Mine/View/SPMineHeaderView.swift +++ b/Thimra/Class/Mine/View/SPMineHeaderView.swift @@ -12,11 +12,21 @@ class SPMineHeaderView: UIView { var contentHeight: CGFloat { var height: CGFloat = kSPStatusbarHeight + 108 + var stackHeight = 0.0 + stackHeight += memberView.intrinsicContentSize.height + if playHistoryArr?.count ?? 0 > 0 { - height += playHistoryView.contentHeight + stackHeight += self.stackView.spacing + stackHeight += playHistoryView.contentHeight + } + + + if stackHeight > 0 { + height += stackHeight height += 10 } + return height } @@ -35,11 +45,8 @@ class SPMineHeaderView: UIView { var playHistoryArr: [SPShortModel]? { didSet { - stackView.removeAllArrangedSubview() + updateStackViewLayout() - if let arr = playHistoryArr, arr.count > 0 { - stackView.addArrangedSubview(playHistoryView) - } playHistoryView.dataArr = playHistoryArr } @@ -84,9 +91,17 @@ class SPMineHeaderView: UIView { private lazy var stackView: UIStackView = { let view = UIStackView() view.axis = .vertical + view.spacing = 12 return view }() + ///会员视图 + private lazy var memberView: SPMineMemberView = { + let view = SPMineMemberView() + return view + }() + + ///播放记录 private lazy var playHistoryView: SPMinePlayHistoryView = { let view = SPMinePlayHistoryView() return view @@ -109,6 +124,7 @@ class SPMineHeaderView: UIView { override init(frame: CGRect) { super.init(frame: frame) + updateStackViewLayout() _setupUI() } @@ -116,6 +132,19 @@ class SPMineHeaderView: UIView { fatalError("init(coder:) has not been implemented") } + private func updateStackViewLayout() { + stackView.removeAllArrangedSubview() + + stackView.addArrangedSubview(memberView) + + if let arr = playHistoryArr, arr.count > 0 { + stackView.addArrangedSubview(playHistoryView) + } + } + +} + +extension SPMineHeaderView { @objc private func handleCopyButton() { SPAPPTool.copy(text: userInfo?.customer_id) @@ -171,7 +200,7 @@ extension SPMineHeaderView { loginButton.snp.makeConstraints { make in make.right.equalToSuperview().offset(-16) make.height.equalTo(30) - make.width.equalTo(76) + make.width.equalTo(loginWidth) make.centerY.equalTo(avatarImageView) } diff --git a/Thimra/Class/Mine/View/SPMineMemberNoView.swift b/Thimra/Class/Mine/View/SPMineMemberNoView.swift new file mode 100644 index 0000000..a15f10d --- /dev/null +++ b/Thimra/Class/Mine/View/SPMineMemberNoView.swift @@ -0,0 +1,78 @@ +// +// SPMineMemberNoView.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + +class SPMineMemberNoView: UIView { + + + //MARK: UI属性 + private lazy var iconImageView: UIImageView = { + let imageView = UIImageView(image: UIImage(named: "vip_icon_01")) + return imageView + }() + + private lazy var titleLabel: UILabel = { + let label = UILabel() + label.text = "You are not a member yet".localized + label.textColor = .colorBBB9B3() + label.font = .fontMedium(ofSize: 16) + label.adjustsFontSizeToFitWidth = true + return label + }() + + + private lazy var activateButton: UIButton = { + let button = JXButton(type: .custom) + button.leftAnyRightmargin = 13 + button.setTitle("Activate".localized, for: .normal) + button.setTitleColor(.colorFFD791(), for: .normal) + button.jx_font = .fontMedium(ofSize: 14) + button.layer.cornerRadius = 14 + button.layer.masksToBounds = true + button.layer.borderWidth = 1 + button.layer.borderColor = UIColor.colorFFD791().cgColor + return button + }() + + override init(frame: CGRect) { + super.init(frame: frame) + _setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +extension SPMineMemberNoView { + + private func _setupUI() { + addSubview(iconImageView) + addSubview(titleLabel) + addSubview(activateButton) + + iconImageView.snp.makeConstraints { make in + make.left.equalToSuperview().offset(12) + make.top.equalToSuperview().offset(15) + } + + titleLabel.snp.makeConstraints { make in + make.left.equalTo(iconImageView.snp.right).offset(4) + make.centerY.equalTo(iconImageView) + make.right.lessThanOrEqualToSuperview().offset(-12) + } + + activateButton.snp.makeConstraints { make in + make.right.equalToSuperview().offset(-18) + make.bottom.equalToSuperview().offset(-14) + make.height.equalTo(28) + } + } + +} diff --git a/Thimra/Class/Mine/View/SPMineMemberView.swift b/Thimra/Class/Mine/View/SPMineMemberView.swift new file mode 100644 index 0000000..46932a8 --- /dev/null +++ b/Thimra/Class/Mine/View/SPMineMemberView.swift @@ -0,0 +1,73 @@ +// +// SPMineMemberView.swift +// Thimra +// +// Created by 佳尔 on 2025/4/25. +// + +import UIKit + +class SPMineMemberView: UIView { + + + override var intrinsicContentSize: CGSize { + let width = kSPScreenWidth - 32 + return CGSize(width: width, height: width * bgRatio) + } + + ///背景图宽高比 + var bgRatio: CGFloat { + let imageSize = bgImageView.image?.size ?? .zero + if imageSize == .zero { + return 1 + } else { + return imageSize.height / imageSize.width + } + } + + //MARK: UI属性 + private lazy var bgImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = UIImage(named: "member_bg_image_01") + return imageView + }() + + private lazy var noView: SPMineMemberNoView = { + let view = SPMineMemberNoView() + return view + }() + + override init(frame: CGRect) { + super.init(frame: frame) + + _setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + +} + +extension SPMineMemberView { + + private func _setupUI() { + addSubview(bgImageView) + addSubview(noView) + + let width = kSPScreenWidth - 32 + bgImageView.snp.makeConstraints { make in + make.top.equalToSuperview() + make.left.equalToSuperview().offset(16) + make.centerX.equalToSuperview() + make.height.equalTo(width * bgRatio) + } + + noView.snp.makeConstraints { make in + make.edges.equalTo(bgImageView) + } + + } + +} diff --git a/Thimra/Class/Mine/View/SPMinePlayHistoryView.swift b/Thimra/Class/Mine/View/SPMinePlayHistoryView.swift index a7f4462..9cec68e 100644 --- a/Thimra/Class/Mine/View/SPMinePlayHistoryView.swift +++ b/Thimra/Class/Mine/View/SPMinePlayHistoryView.swift @@ -10,7 +10,7 @@ import UIKit class SPMinePlayHistoryView: UIView { var contentHeight: CGFloat { - return collectionViewLayout.itemSize.height + 20 + 12 + return 8 + collectionViewLayout.itemSize.height + 20 + 12 } override var intrinsicContentSize: CGSize { @@ -91,7 +91,7 @@ extension SPMinePlayHistoryView { titleIconImageView.snp.makeConstraints { make in make.left.equalToSuperview().offset(16) - make.top.equalToSuperview() + make.top.equalToSuperview().offset(8) } titleLabel.snp.makeConstraints { make in diff --git a/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Contents.json new file mode 100644 index 0000000..8457c0b --- /dev/null +++ b/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group 57@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group 57@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Group 57@2x.png b/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Group 57@2x.png new file mode 100644 index 0000000..c76801c Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Group 57@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Group 57@3x.png b/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Group 57@3x.png new file mode 100644 index 0000000..0b5d399 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/icon/vip_icon_01.imageset/Group 57@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Contents.json b/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Contents.json new file mode 100644 index 0000000..da84f88 --- /dev/null +++ b/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group 63@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group 63@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Group 63@2x.png b/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Group 63@2x.png new file mode 100644 index 0000000..96f6a15 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Group 63@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Group 63@3x.png b/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Group 63@3x.png new file mode 100644 index 0000000..41ab047 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/image/member_bg_image_01.imageset/Group 63@3x.png differ diff --git a/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Contents.json b/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Contents.json new file mode 100644 index 0000000..6b4968d --- /dev/null +++ b/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Frame 208@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Frame 208@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Frame 208@2x.png b/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Frame 208@2x.png new file mode 100644 index 0000000..7aea1a1 Binary files /dev/null and b/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Frame 208@2x.png differ diff --git a/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Frame 208@3x.png b/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Frame 208@3x.png new file mode 100644 index 0000000..ccaf99f Binary files /dev/null and b/Thimra/Source/Assets.xcassets/image/member_bg_image_02.imageset/Frame 208@3x.png differ diff --git a/Thimra/Source/en.lproj/Localizable.strings b/Thimra/Source/en.lproj/Localizable.strings index c5966eb..a835210 100644 --- a/Thimra/Source/en.lproj/Localizable.strings +++ b/Thimra/Source/en.lproj/Localizable.strings @@ -51,7 +51,8 @@ "List of Third-Party Sharing of Personal Information" = "List of Third-Party Sharing of Personal Information"; "Explicit List of Personal Information Collection" = "Explicit List of Personal Information Collection"; "Log in" = "Log in"; - +"You are not a member yet" = "You are not a member yet"; +"Activate" = "Activate"; "kLoginAgreementText" = "By continuing, you agree to the User Agreement and Privacy Policy";