增加房间

This commit is contained in:
liyuhua
2024-03-07 16:56:48 +08:00
parent 3783cc5c95
commit bfee907f9e
45 changed files with 1191 additions and 29 deletions

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_default_avatar@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_default_avatar@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yib_room_quit_heat_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yib_room_quit_heat_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_room_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_room_quit_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_room_quit_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_room_report_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_room_report_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_room_top_gift_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_room_top_gift_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_room_top_lock_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_room_top_lock_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "yin_room_top_right@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "yin_room_top_right@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

View File

@@ -98,8 +98,8 @@ class YMNetworkHelper: NSObject {
if ResultMo.keys.contains("message") { messageIn = ResultMo["message"] as? String ?? "" }
fail3?(codeNum,messageIn)
}
} else if ResultMo.keys.contains("errno") {
let CodeNum :Int = ResultMo["errno"] as? Int ?? 0
} else if ResultMo.keys.contains("erron") {
let CodeNum :Int = ResultMo["erron"] as? Int ?? 0
if CodeNum == 0 {
if ResultMo.keys.contains("data") {
let dataSc = ResultMo["data"] as Any

View File

@@ -0,0 +1,14 @@
//
// Enum.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import Foundation
import HandyJSON
///
enum UserSexType: Int, HandyJSONEnum {
case Boy = 1,Girl
}

View File

@@ -7,28 +7,94 @@
import Foundation
private var isSafeScreen: Bool {
if #available(iOS 11, *) {
guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else {
return false
}
if unwrapedWindow.safeAreaInsets.left > 0 || unwrapedWindow.safeAreaInsets.bottom > 0 {
print(unwrapedWindow.safeAreaInsets)
return true
}
}
return false
}
let ScreenWidth = UIScreen.main.bounds.size.width
let ScreenHeight = UIScreen.main.bounds.size.height
let StatusBarHeight = UIApplication.shared.statusBarFrame.height
let SafeAraeBottomHeight = isSafeScreen ? 34.0 : 0.0
let SafeAraeTopmHeight = isSafeScreen ? 24.0 : 0.0
let NavHeight = (StatusBarHeight + 44)
let TabHeight = (49)
let StatusBarHeight = UIDevice.yinStatusBarHeight()
let SafeAraeBottomHeight = UIDevice.yinSafeDistanceBottom()
let SafeAraeTopmHeight = UIDevice.yinSafeDistanceTop()
let NavHeight = UIDevice.yinNavigationFullHeight()
let TabHeight = UIDevice.yinTabBarHeight()
let keyWindow = UIApplication.shared.windows.first!
let DesKey = "1ea53d260ecf11e7b56e00163e046a26"
let H5_URL = "http://beta.h5.ymlive.fun"
extension UIFont{
static func getScaleFont(ofSize:CGFloat,weight:Weight)->UIFont{
return UIFont.systemFont(ofSize: UIDevice.scaleWidth(width: ofSize), weight: weight)
}
}
extension UIDevice {
static func scaleWidth(width:CGFloat)->CGFloat{
return round(ScreenWidth / 375 * width)
}
static func scaleHeighth(width:CGFloat)->CGFloat{
return round(ScreenHeight / 812 * width)
}
///
static func yinSafeDistanceTop() -> CGFloat {
if #available(iOS 13.0, *) {
let scene = UIApplication.shared.connectedScenes.first
guard let windowScene = scene as? UIWindowScene else { return 0 }
guard let window = windowScene.windows.first else { return 0 }
return window.safeAreaInsets.top
}
guard let window = UIApplication.shared.windows.first else { return 0 }
return window.safeAreaInsets.top
}
///
static func yinSafeDistanceBottom() -> CGFloat {
if #available(iOS 13.0, *) {
let scene = UIApplication.shared.connectedScenes.first
guard let windowScene = scene as? UIWindowScene else { return 0 }
guard let window = windowScene.windows.first else { return 0 }
return window.safeAreaInsets.bottom
}
guard let window = UIApplication.shared.windows.first else { return 0 }
return window.safeAreaInsets.bottom
}
///
static func yinStatusBarHeight() -> CGFloat {
var statusBarHeight: CGFloat = 0
if #available(iOS 13.0, *) {
let scene = UIApplication.shared.connectedScenes.first
guard let windowScene = scene as? UIWindowScene else { return 0 }
guard let statusBarManager = windowScene.statusBarManager else { return 0 }
statusBarHeight = statusBarManager.statusBarFrame.height
} else {
statusBarHeight = UIApplication.shared.statusBarFrame.height
}
return statusBarHeight
}
///
static func yinNavigationBarHeight() -> CGFloat {
return 44.0
}
/// +
static func yinNavigationFullHeight() -> CGFloat {
return UIDevice.yinStatusBarHeight() + UIDevice.yinNavigationBarHeight()
}
///
static func yinTabBarHeight() -> CGFloat {
return 49.0
}
///
static func yinTabBarFullHeight() -> CGFloat {
return UIDevice.yinTabBarHeight() + UIDevice.yinSafeDistanceBottom()
}
}

View File

@@ -0,0 +1,67 @@
//
// UIButtom+.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
extension UIButton {
private static var clickRadius = "YinClickRadius"
var setBtnClickRadius: UIEdgeInsets? {
set {
objc_setAssociatedObject(self, &Self.clickRadius, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY)
}
get {
return objc_getAssociatedObject(self, &Self.clickRadius) as? UIEdgeInsets ?? UIEdgeInsets.zero
}
}
///
override open func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
guard let inset = setBtnClickRadius else {
return super.point(inside: point, with: event)
}
var bounds = self.bounds
let x: CGFloat = -inset.left
let y: CGFloat = -inset.top
let width: CGFloat = bounds.width + inset.left + inset.right
let height: CGFloat = bounds.height + inset.top + inset.bottom
bounds = CGRect(x: x, y: y, width: width, height: height) //
return bounds.contains(point)
}
static func getCustomBtn(text:String? = nil,selectedText:String? = nil,font:UIFont? = nil,color:UIColor? = nil,selectedColor:UIColor? = nil,image:UIImage? = nil,selectedImage:UIImage? = nil,bgImage:UIImage? = nil) -> UIButton{
let customBtn = UIButton()
if let _text = text{
customBtn.setTitle(text, for: .normal)
}
if let _selectedText = selectedText{
customBtn.setTitle(selectedText, for: .selected)
}
if let _font = font{
customBtn.titleLabel?.font = font
}
if let _color = color{
customBtn.setTitleColor(color, for: .normal)
}
if let _selectedColor = selectedColor{
customBtn.setTitleColor(selectedColor, for: .selected)
}
if let _image = image{
customBtn.setImage(_image, for: .normal)
}
if let _selectedImage = selectedImage{
customBtn.setImage(_selectedImage, for: .selected)
}
if let _bgImage = bgImage{
customBtn.setBackgroundImage(_bgImage, for: .normal)
}
return customBtn
}
}

View File

@@ -121,3 +121,9 @@ extension UIImage{
return image
}
}
extension UIImage{
static func getDefaultAvatar() -> UIImage?{
return UIImage(named: "yin_default_avatar") ?? nil
}
}

View File

@@ -0,0 +1,44 @@
//
// UILabel+.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import Foundation
extension UILabel{
static func getCustomLabel(text:String? = "",font:UIFont? = nil,color:UIColor? = nil,textAlignment:NSTextAlignment? = .left)->UILabel{
let customView = UILabel()
if let _text = text {
customView.text = text
}
if let _font = font {
customView.font = _font
}
if let _color = color {
customView.textColor = _color
}
if let _textAlignment = textAlignment{
customView.textAlignment = _textAlignment
}
return customView
}
static func getLabelHeigth(text:String,width:CGFloat,font:UIFont)-> CGFloat{
let label:UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: width, height: CGFloat.greatestFiniteMagnitude))
label.numberOfLines = 0
label.lineBreakMode = NSLineBreakMode.byWordWrapping
label.font = font
label.text = text
label.sizeToFit()
return label.frame.height
}
static func getLabelWidth(text:String,heigth:CGFloat,font:UIFont)-> CGFloat{
let label:UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: CGFloat.greatestFiniteMagnitude, height:heigth ))
label.numberOfLines = 0
label.lineBreakMode = NSLineBreakMode.byWordWrapping
label.font = font
label.text = text
label.sizeToFit()
return label.frame.width
}
}

View File

@@ -24,7 +24,7 @@ class AuthPrivacyView: BaseView {
make.edges.equalTo(contentView)
}
contentView.snp.makeConstraints { make in
make.size.equalTo(CGSize(width: 335, height: 490))
make.size.equalTo(CGSize(width: 335, height: 490))
make.centerX.equalTo(self)
make.centerY.equalTo(self)
}

View File

@@ -0,0 +1,30 @@
//
// RoomVC.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
class RoomVC: BaseViewController, HiddenNavigationBarProtocol {
override func viewDidLoad() {
super.viewDidLoad()
setUILayout()
}
private func setUILayout(){
view.addSubview(backgroundView)
backgroundView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
}
private func requestData(){
}
//MARK: -
private lazy var backgroundView:RoomBackgroundView = {
let _backgroundView = RoomBackgroundView(frame: .zero)
return _backgroundView
}()
}

View File

@@ -0,0 +1,33 @@
//
// RoomBackgroundView.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
class RoomBackgroundView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUILayout(){
addSubview(bgImageView)
bgImageView.snp.makeConstraints { make in
make.edges.equalTo(self)
}
}
//MARK: -
private lazy var bgImageView:UIImageView = {
let _bgImageView = UIImageView()
_bgImageView.image = UIImage(named: "yin_room_bg")
return _bgImageView
}()
}

View File

@@ -0,0 +1,18 @@
//
// RoomQuitItemModel.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/7.
//
import UIKit
enum RoomQuitClickType {
case quit,report
}
class RoomQuitItemModel: NSObject {
var type:RoomQuitClickType = .quit
var text = ""
var image = ""
}

View File

@@ -0,0 +1,25 @@
//
// RoomQuitView.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import Foundation
import HandyJSON
struct RoomQuitModel: HandyJSON {
var roomId = 0
var uid = 0
var isPermitRoom = 0
var title = ""
var onlineNum = 0
var micUserCount = 0
var tagPict = ""
var roomTag = ""
var avatar = ""
var gender:UserSexType = .Boy
var infoUid = ""
var nick = ""
var roomPwd = ""
}

View File

@@ -0,0 +1,12 @@
//
// RoomQuitViewModel.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/7.
//
import UIKit
import RxSwift
class RoomQuitViewModel: NSObject {
}

View File

@@ -0,0 +1,63 @@
//
// RoomQuitClickCell.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
import Nuke
class RoomQuitClickCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUILayout(){
contentView.addSubview(avatarView)
contentView.addSubview(nameView)
avatarView.snp.makeConstraints { make in
make.width.height.equalTo(UIDevice.scaleWidth(width: 52))
make.top.equalTo(self)
make.centerX.equalTo(self)
}
nameView.snp.makeConstraints { make in
make.top.equalTo(self.avatarView.snp.bottom).offset(UIDevice.scaleWidth(width: 4))
make.centerX.equalTo(self)
make.height.equalTo(UIDevice.scaleWidth(width: 12))
}
}
var model:RoomQuitItemModel{
didSet{
avatarView.image = UIImage(named: model.image)
nameView.text = model.text
}
}
//MARK: - set/get
var text:String = ""{
didSet{
nameView.text = text
}
}
var image:String = ""{
didSet{
Nuke.loadImage(with: image, into: avatarView, completion: nil)
}
}
//MARK: -
private lazy var avatarView:UIImageView = {
let _avatarView = UIImageView()
return _avatarView
}()
private lazy var nameView:UILabel = {
let _nameView = UILabel.getCustomLabel(font: UIFont.systemFont(ofSize: 10),color: .white)
return _nameView
}()
}

View File

@@ -0,0 +1,96 @@
//
// RoomQuitUserInfoCell.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
import Nuke
class RoomQuitUserInfoCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUILayout(){
backgroundColor = .clear
selectionStyle = .none
contentView.addSubview(avatarView)
contentView.addSubview(roomNameView)
contentView.addSubview(typeIconView)
contentView.addSubview(heatImageView)
contentView.addSubview(heatNumView)
avatarView.snp.makeConstraints { make in
make.top.equalTo(UIDevice.scaleWidth(width: 12))
make.leading.equalTo(UIDevice.scaleWidth(width: 15))
make.width.height.equalTo(UIDevice.scaleWidth(width: 72))
}
roomNameView.snp.makeConstraints { make in
make.top.equalTo(avatarView.snp.bottom).offset(UIDevice.scaleWidth(width: 12))
make.leading.equalTo(avatarView.snp.trailing).offset((UIDevice.scaleWidth(width: 7)))
make.height.equalTo(UIDevice.scaleWidth(width: 14))
make.trailing.equalTo(-UIDevice.scaleWidth(width: 0))
}
typeIconView.snp.makeConstraints { make in
make.width.equalTo(UIDevice.scaleWidth(width: 34))
make.height.equalTo(UIDevice.scaleWidth(width: 18))
make.top.equalTo(roomNameView.snp.bottom).offset(UIDevice.scaleWidth(width: 12))
make.leading.equalTo(roomNameView)
}
heatImageView.snp.makeConstraints { make in
make.width.height.equalTo(UIDevice.scaleWidth(width: 13))
make.leading.equalTo(typeIconView.snp.trailing).offset((UIDevice.scaleWidth(width: 12)))
make.centerY.equalTo(typeIconView)
}
heatNumView.snp.makeConstraints { make in
make.leading.equalTo(heatImageView.snp.trailing).offset((UIDevice.scaleWidth(width: 3)))
make.centerY.equalTo(typeIconView)
make.trailing.equalTo(-UIDevice.scaleWidth(width: 0))
make.height.equalTo(UIDevice.scaleWidth(width: 12))
}
}
//MARK: -
var model:RoomQuitModel? = nil {
didSet{
guard let _model = model else {return}
Nuke.loadImage(with: _model.avatar, into: avatarView, completion: nil)
roomNameView.text = _model.title
Nuke.loadImage(with: _model.tagPict, into: typeIconView, completion: nil)
heatNumView.text = "\(_model.onlineNum)"
}
}
//MARK: -
private lazy var avatarView:UIImageView = {
let _avatarView = UIImageView()
_avatarView.layer.cornerRadius = UIDevice.scaleWidth(width: 8)
_avatarView.layer.masksToBounds = true
return _avatarView
}()
private lazy var typeIconView:UIImageView = {
let _typeIconView = UIImageView()
return _typeIconView
}()
private lazy var heatImageView:UIImageView = {
let _heatImageView = UIImageView()
_heatImageView.image = UIImage(named: "yib_room_quit_heat_icon")
return _heatImageView
}()
private lazy var roomNameView:UILabel = {
let _roomNameView = UILabel.getCustomLabel(font: UIFont.getScaleFont(ofSize: 14, weight: .semibold),color: .white)
return _roomNameView
}()
private lazy var heatNumView:UILabel = {
let _heatNumView = UILabel.getCustomLabel(font: UIFont.getScaleFont(ofSize: 12, weight: .regular),color: .white)
return _heatNumView
}()
}

View File

@@ -0,0 +1,34 @@
//
// RoomQuitUserInfoEmptyCell.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
class RoomQuitUserInfoEmptyCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUILayout(){
backgroundColor = .clear
selectionStyle = .none
contentView.addSubview(textView)
textView.snp.makeConstraints { make in
make.leading.trailing.equalTo(self.contentView)
make.centerY.equalTo(self)
}
}
//MARK: -
private lazy var textView:UILabel = {
let _textView = UILabel.getCustomLabel(text: "暂无房间", font: UIFont.getScaleFont(ofSize: 14, weight: .regular), color: .white, textAlignment: .center)
return _textView
}()
}

View File

@@ -0,0 +1,140 @@
//
// RoomQuitView.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
protocol RoomQuitViewProtocol{
func didClickTypeWithModel(clickModel:RoomQuitItemModel) -> Void
func didChooseRoomWithModel(roomModel:RoomQuitModel?) -> Void
}
class RoomQuitView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
registerCell()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUILayout(){
addSubview(bgMaskView)
addSubview(collectionView)
addSubview(textView)
addSubview(tableView)
bgMaskView.snp.makeConstraints { make in
make.edges.equalTo(self)
}
collectionView.snp.makeConstraints { make in
make.leading.trailing.equalTo(self).inset(0)
make.top.equalTo(UIDevice.scaleWidth(width: 8) + StatusBarHeight)
make.height.equalTo(UIDevice.scaleWidth(width: 164))
}
textView.snp.makeConstraints { make in
make.top.equalTo(collectionView.snp.bottom).offset(UIDevice.scaleWidth(width: 16))
make.leading.equalTo(UIDevice.scaleWidth(width: 11))
}
tableView.snp.makeConstraints { make in
make.leading.trailing.bottom.equalTo(0)
make.top.equalTo(textView.snp.bottom).offset(UIDevice.scaleWidth(width: 0))
}
}
private func registerCell(){
collectionView.register(RoomQuitClickCell.self, forCellWithReuseIdentifier: "RoomQuitClickCell")
collectionView.delegate = self
collectionView.dataSource = self
tableView.register(RoomQuitUserInfoEmptyCell.self, forCellReuseIdentifier: "RoomQuitUserInfoEmptyCell")
tableView.register(RoomQuitUserInfoCell.self, forCellReuseIdentifier: "RoomQuitUserInfoEmptyCell")
tableView.delegate = self
tableView.dataSource = self
}
//MARK: -
let emptyCellHeight = ScreenHeight - StatusBarHeight - UIDevice.scaleWidth(width: 128)
var delegate:RoomQuitViewProtocol?
var clickModelList:[RoomQuitItemModel] {
let quitModel = RoomQuitItemModel()
quitModel.text = "退出房间"
quitModel.image = "yin_room_quit_icon"
let reportModel = RoomQuitItemModel()
reportModel.text = "举报房间"
reportModel.type = .report
reportModel.image = "yin_room_report_icon"
return [quitModel,reportModel]
}
var roomModelList:[RoomQuitModel] = []
private lazy var bgMaskView:UIVisualEffectView = {
var _bgMaskView = UIVisualEffectView()
let blurEffect = UIBlurEffect(style: .dark)
_bgMaskView = UIVisualEffectView(effect: blurEffect)
return _bgMaskView
}()
private lazy var collectionView:UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.minimumLineSpacing = UIDevice.scaleWidth(width: 14)
let spacing = UIDevice.scaleWidth(width: 94) / 4
layout.minimumInteritemSpacing = spacing
layout.itemSize = CGSize(width: UIDevice.scaleWidth(width: 52), height: UIDevice.scaleWidth(width: 68))
layout.sectionInset = UIEdgeInsets(top: 0, left: spacing, bottom: 0, right: spacing)
let _collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
_collectionView.backgroundColor = .clear
return _collectionView
}()
private lazy var tableView:UITableView = {
let _tableView = UITableView.init(frame: .zero, style: .plain)
_tableView.separatorStyle = .none
_tableView.showsVerticalScrollIndicator = false
_tableView.showsHorizontalScrollIndicator = false
_tableView.backgroundColor = .clear
return _tableView
}()
private lazy var textView:UILabel = {
let _textView = UILabel.getCustomLabel(text:"为你推荐",font: UIFont.getScaleFont(ofSize: 14, weight: .medium),color: .white)
return _textView
}()
}
extension RoomQuitView:UICollectionViewDelegate ,UICollectionViewDataSource{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return clickModelList.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RoomQuitClickCell", for: indexPath) as! RoomQuitClickCell
cell.model = clickModelList[indexPath.row]
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
self.delegate?.didClickTypeWithModel(clickModel: clickModelList[indexPath.row])
}
}
extension RoomQuitView:UITableViewDelegate,UITableViewDataSource{
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return roomModelList.isEmpty ? 1 : roomModelList.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return !roomModelList.isEmpty ? UIDevice.scaleWidth(width: 84) : emptyCellHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if roomModelList.isEmpty {
let cell = tableView.dequeueReusableCell(withIdentifier: "RoomQuitUserInfoEmptyCell", for: indexPath) as! RoomQuitUserInfoEmptyCell
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "RoomQuitUserInfoCell", for: indexPath) as! RoomQuitUserInfoCell
cell.model = roomModelList[safe:indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.delegate?.didChooseRoomWithModel(roomModel: roomModelList[safe: indexPath.row])
}
}

View File

@@ -0,0 +1,142 @@
//
// RoomTopView.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/6.
//
import UIKit
import MarqueeLabel
class RoomTopView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setUILayout(){
}
//MARK: - bntTarget
@objc func colectRoomAction(){
}
//MARK: -
private lazy var settingBnt:UIButton = {
let _settingBtn = UIButton.getCustomBtn(image: UIImage(named: "yin_room_top_right"))
_settingBtn.setBtnClickRadius = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
return _settingBtn
}()
private lazy var colectRoomBtn:UIButton = {
let image = UIImage.image(color: ThemeColor(hexStr: "#FFDA24"))
let _colectRoomBtn = UIButton.getCustomBtn(text: "收藏",selectedText:"已收藏",font: UIFont.getScaleFont(ofSize: 11, weight: .medium),color: .white,bgImage: image)
_colectRoomBtn.layer.cornerRadius = UIDevice.scaleWidth(width: 10)
_colectRoomBtn.layer.masksToBounds = true
_colectRoomBtn.contentEdgeInsets = UIEdgeInsets(top: 0, left: UIDevice.scaleWidth(width: 7), bottom: 0, right: UIDevice.scaleWidth(width: 7))
_colectRoomBtn.addTarget(self, action: #selector(colectRoomAction), for: .touchUpInside)
_colectRoomBtn.isHidden = true
return _colectRoomBtn
}()
private lazy var nameStackView:UIStackView = {
let _nameStackView = UIStackView()
_nameStackView.axis = .vertical
_nameStackView.distribution = .fill
_nameStackView.alignment = .leading
return _nameStackView
}()
private lazy var textStackView:UIStackView = {
let _textStackView = UIStackView()
_textStackView.axis = .horizontal
_textStackView.distribution = .fill
_textStackView.alignment = .center
_textStackView.spacing = UIDevice.scaleWidth(width: 5)
return _textStackView
}()
private lazy var textView:MarqueeLabel = {
let _textView = MarqueeLabel()
_textView.speed = .duration(8)
_textView.fadeLength = UIDevice.scaleWidth(width: 6)
_textView.font = UIFont.getScaleFont(ofSize: 12, weight: .medium)
_textView.textColor = .white
_textView.isUserInteractionEnabled = true
return _textView
}()
private lazy var giftIconView:UIImageView = {
let _giftIconView = UIImageView()
_giftIconView.image = UIImage(named: "yin_room_top_gift_icon")
_giftIconView.isUserInteractionEnabled = true
return _giftIconView
}()
private lazy var lockIconView:UIImageView = {
let _lockIconView = UIImageView()
_lockIconView.image = UIImage(named: "yin_room_top_lock_icon")
_lockIconView.isUserInteractionEnabled = true
_lockIconView.isHidden = true
return _lockIconView
}()
private lazy var onlineNumStackView:UIStackView = {
let _onlineNumStackView = UIStackView()
_onlineNumStackView.axis = .horizontal
_onlineNumStackView.distribution = .fill
_onlineNumStackView.alignment = .center
_onlineNumStackView.spacing = UIDevice.scaleWidth(width: 2)
return _onlineNumStackView
}()
private lazy var greenPointView:UIView = {
let _greenPointView = UIView()
_greenPointView.backgroundColor = ThemeColor(hexStr: "#3EFED7")
_greenPointView.layer.cornerRadius = UIDevice.scaleWidth(width: 3)/2
_greenPointView.layer.masksToBounds = true
return _greenPointView
}()
private lazy var userIdView:UILabel = {
let _userIdView = UILabel.getCustomLabel(font: UIFont.getScaleFont(ofSize: 10, weight: .regular),color: .white)
return _userIdView
}()
private lazy var onlineNumView:UILabel = {
let _onlineNumView = UILabel.getCustomLabel(font: UIFont.getScaleFont(ofSize: 10, weight: .regular),color: .white)
return _onlineNumView
}()
private lazy var avatarView:UIImageView = {
let _avatarView = UIImageView()
_avatarView.isUserInteractionEnabled = true
_avatarView.layer.masksToBounds = true
_avatarView.layer.cornerRadius = UIDevice.scaleWidth(width: 17)
_avatarView.contentMode = .scaleAspectFill
return _avatarView
}()
private lazy var superStackView:UIStackView = {
let _superStackView = UIStackView()
_superStackView.axis = .horizontal
_superStackView.distribution = .fill
_superStackView.alignment = .center
_superStackView.spacing = UIDevice.scaleWidth(width: 4)
_superStackView.backgroundColor = UIColor(white: 1, alpha: 0.1)
_superStackView.layer.cornerRadius = UIDevice.scaleWidth(width: 17)
return _superStackView
}()
private lazy var quitView:RoomQuitView = {
let _quitView = RoomQuitView(frame: .zero)
_quitView.delegate = self
return _quitView
}()
}
extension RoomTopView:RoomQuitViewProtocol{
func didChooseRoomWithModel(roomModel: RoomQuitModel?) {
}
func didClickTypeWithModel(clickModel: RoomQuitItemModel) {
}
}

View File

@@ -31,6 +31,7 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol {
view.addSubview(backImgView)
view.addSubview(titleLb)
view.addSubview(rechargeView)
view.addSubview(myRoomView)
view.addSubview(mobileView)
view.addSubview(passwordView)
view.addSubview(aboutView)
@@ -48,11 +49,15 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol {
}
rechargeView.snp.makeConstraints { make in
make.left.right.equalTo(view).inset(28)
make.left.equalTo(view).inset(28)
make.height.equalTo(68)
make.right.equalTo(myRoomView.snp.left).offset(-11)
make.top.equalTo(view).offset(NavHeight + 20)
}
myRoomView.snp.makeConstraints { make in
make.centerY.height.width.equalTo(rechargeView)
make.right.equalTo(view).offset(-28)
}
mobileView.snp.makeConstraints { make in
make.left.equalTo(view).offset(28)
make.height.equalTo(68)
@@ -111,7 +116,13 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol {
view.item = item
return view
}()
private lazy var myRoomView: UserFunctionView = {
let _myRoomView = UserFunctionView()
_myRoomView.delegate = self
let item = UserFunctionItem(title: "我的房间", isHiddenIcon: true ,itmeType: .myRoom)
_myRoomView.item = item
return _myRoomView
}()
private lazy var mobileView: UserFunctionView = {
let view = UserFunctionView()
view.delegate = self
@@ -164,10 +175,15 @@ class UserInfoVC: BaseViewController, HiddenNavigationBarProtocol {
extension UserInfoVC: UserFunctionViewProtocol{
func didClickItem(type: UserFunctionType) {
switch type {
case .recharge:
let vc = UserPayViewController()
self.navigationController?.pushViewController(vc, animated: true)
print("aaa")
case .myRoom:
let vc = RoomVC()
vc.modalPresentationStyle = .fullScreen
self.present(vc, animated: true, completion: nil)
case .mobile:
if self.info?.isBindPhone == true {
HUDTool.show(with: "您已绑定手机号")

View File

@@ -9,6 +9,7 @@ import Foundation
enum UserFunctionType:Int {
case recharge
case myRoom
case mobile
case password
case about