结构调整
This commit is contained in:
28
QXLive/Room(房间)/View/设置/QXAddDirectCell.h
Normal file
28
QXLive/Room(房间)/View/设置/QXAddDirectCell.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// QXAddDirectCell.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXSearchModel.h"
|
||||
#import "QXRoomListModel.h"
|
||||
#import "QXDirectDelegate.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAddDirectCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *IDLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *addBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *sexImageView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *levelImageView;
|
||||
@property (nonatomic,strong)QXSearchModel *user;
|
||||
@property (nonatomic,strong)QXRoomListModel *roomModel;
|
||||
@property (nonatomic,weak)id<QXDirectDelegate>delegate;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
81
QXLive/Room(房间)/View/设置/QXAddDirectCell.m
Normal file
81
QXLive/Room(房间)/View/设置/QXAddDirectCell.m
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// QXAddDirectCell.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXAddDirectCell.h"
|
||||
|
||||
@implementation QXAddDirectCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXAddDirectCell";
|
||||
QXAddDirectCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.addBtn.layer.borderWidth = 1;
|
||||
cell.addBtn.layer.borderColor = [UIColor colorWithHexString:@"#333333"].CGColor;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)setUser:(QXSearchModel *)user{
|
||||
_user = user;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:user.picture]];
|
||||
self.nameLabel.text = user.name;
|
||||
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",user.code];
|
||||
if (user.icon.count==0) {
|
||||
self.levelImageView.hidden = YES;
|
||||
self.sexImageView.hidden = YES;
|
||||
return;
|
||||
}
|
||||
if (user.icon.count == 1) {
|
||||
self.sexImageView.hidden = NO;
|
||||
self.levelImageView.hidden = YES;
|
||||
NSString *firstIcon = user.icon.firstObject;
|
||||
[self.sexImageView sd_setImageWithURL:[NSURL URLWithString:firstIcon] placeholderImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.icon.count >= 2) {
|
||||
self.sexImageView.hidden = NO;
|
||||
self.levelImageView.hidden = NO;
|
||||
NSString *firstIcon = user.icon.firstObject;
|
||||
[self.sexImageView sd_setImageWithURL:[NSURL URLWithString:firstIcon] placeholderImage:nil];
|
||||
NSString *secondtIcon = user.icon[1];
|
||||
[self.levelImageView sd_setImageWithURL:[NSURL URLWithString:secondtIcon] placeholderImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setRoomModel:(QXRoomListModel *)roomModel{
|
||||
_roomModel = roomModel;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover]];
|
||||
self.nameLabel.text = roomModel.room_name;
|
||||
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",roomModel.room_number];
|
||||
[self.addBtn setTitle:@"邀请PK" forState:(UIControlStateNormal)];
|
||||
}
|
||||
|
||||
- (IBAction)addAction:(id)sender {
|
||||
if (self.roomModel) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(sendPKWithRoomId:)]) {
|
||||
[self.delegate sendPKWithRoomId:self.roomModel.room_id];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(addDirectWithUser:)]) {
|
||||
[self.delegate addDirectWithUser:self.user];
|
||||
}
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
111
QXLive/Room(房间)/View/设置/QXAddDirectCell.xib
Normal file
111
QXLive/Room(房间)/View/设置/QXAddDirectCell.xib
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="137" id="KGk-i7-Jjw" customClass="QXAddDirectCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="565" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="565" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="aSv-eD-6iI">
|
||||
<rect key="frame" x="16" y="48" width="41" height="41"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="41" id="A4m-xL-NQK"/>
|
||||
<constraint firstAttribute="height" constant="41" id="vYz-zp-WUU"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="20.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="用户昵称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZJr-FU-QBy">
|
||||
<rect key="frame" x="63" y="48" width="59.666666666666657" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID:123456789" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lcS-Ly-5FJ">
|
||||
<rect key="frame" x="63.000000000000007" y="73.333333333333329" width="86.666666666666686" height="15.666666666666671"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QZa-JC-MXc">
|
||||
<rect key="frame" x="489" y="55.666666666666657" width="60" height="26"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="26" id="Boa-4d-dg7"/>
|
||||
<constraint firstAttribute="width" constant="60" id="cH3-cv-H4V"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="添加">
|
||||
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="13"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="addAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="0Uf-3S-hbO"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="WNp-fx-wB4">
|
||||
<rect key="frame" x="138.66666666666666" y="49" width="42" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="42" id="i4b-No-E9k"/>
|
||||
<constraint firstAttribute="height" constant="16" id="uDz-e7-foq"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mrn-O8-mqZ">
|
||||
<rect key="frame" x="196.66666666666666" y="49" width="42" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="16" id="6fq-EJ-3Fu"/>
|
||||
<constraint firstAttribute="width" constant="42" id="gr3-mM-gha"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="QZa-JC-MXc" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="04K-CM-8tf"/>
|
||||
<constraint firstItem="lcS-Ly-5FJ" firstAttribute="bottom" secondItem="aSv-eD-6iI" secondAttribute="bottom" id="ChU-Pd-XEM"/>
|
||||
<constraint firstItem="mrn-O8-mqZ" firstAttribute="leading" secondItem="WNp-fx-wB4" secondAttribute="trailing" constant="16" id="Kya-QG-P70"/>
|
||||
<constraint firstItem="aSv-eD-6iI" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="NfN-kP-rxq"/>
|
||||
<constraint firstItem="ZJr-FU-QBy" firstAttribute="leading" secondItem="aSv-eD-6iI" secondAttribute="trailing" constant="6" id="OGt-a2-IDz"/>
|
||||
<constraint firstAttribute="trailing" secondItem="QZa-JC-MXc" secondAttribute="trailing" constant="16" id="g2W-Nl-QjT"/>
|
||||
<constraint firstItem="mrn-O8-mqZ" firstAttribute="centerY" secondItem="ZJr-FU-QBy" secondAttribute="centerY" id="gmd-D6-1ok"/>
|
||||
<constraint firstItem="lcS-Ly-5FJ" firstAttribute="leading" secondItem="ZJr-FU-QBy" secondAttribute="leading" id="lX5-Zk-G8B"/>
|
||||
<constraint firstItem="aSv-eD-6iI" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="q72-gm-qAb"/>
|
||||
<constraint firstItem="WNp-fx-wB4" firstAttribute="leading" secondItem="ZJr-FU-QBy" secondAttribute="trailing" constant="16" id="rTK-gZ-DeY"/>
|
||||
<constraint firstItem="ZJr-FU-QBy" firstAttribute="top" secondItem="aSv-eD-6iI" secondAttribute="top" id="yZv-Eo-18i"/>
|
||||
<constraint firstItem="WNp-fx-wB4" firstAttribute="centerY" secondItem="ZJr-FU-QBy" secondAttribute="centerY" id="zZo-Eg-hvW"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="IDLabel" destination="lcS-Ly-5FJ" id="uJ5-Vt-bXU"/>
|
||||
<outlet property="addBtn" destination="QZa-JC-MXc" id="NbW-u2-cUi"/>
|
||||
<outlet property="headerImageView" destination="aSv-eD-6iI" id="BAg-8k-e6c"/>
|
||||
<outlet property="levelImageView" destination="mrn-O8-mqZ" id="cmb-8v-pgm"/>
|
||||
<outlet property="nameLabel" destination="ZJr-FU-QBy" id="3ba-hZ-XYa"/>
|
||||
<outlet property="sexImageView" destination="WNp-fx-wB4" id="A6C-fp-C0t"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="325.95419847328242" y="52.464788732394368"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
</resources>
|
||||
</document>
|
||||
18
QXLive/Room(房间)/View/设置/QXAddDirectView.h
Normal file
18
QXLive/Room(房间)/View/设置/QXAddDirectView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXAddDirectView.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAddDirectView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
171
QXLive/Room(房间)/View/设置/QXAddDirectView.m
Normal file
171
QXLive/Room(房间)/View/设置/QXAddDirectView.m
Normal file
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// QXAddDirectView.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXAddDirectView.h"
|
||||
#import "QXAddDirectCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXAddDirectView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate,UITextFieldDelegate,QXDirectDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIView *seachBgView;
|
||||
@property (nonatomic,strong)UIImageView *searchImageView;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
|
||||
@property (nonatomic,strong)UITableView*tableView;
|
||||
@property (nonatomic,strong)NSMutableArray*dataArray;
|
||||
@end
|
||||
|
||||
@implementation QXAddDirectView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self createViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)createViews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(429), SCREEN_WIDTH, ScaleWidth(429))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
|
||||
self.titleLabel.text = @"添加主持";
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.seachBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+12, SCREEN_WIDTH-16*2, 35)];
|
||||
self.seachBgView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"];
|
||||
self.seachBgView.layer.masksToBounds = YES;
|
||||
self.seachBgView.layer.cornerRadius = 17.5;
|
||||
[self.bgView addSubview:self.seachBgView];
|
||||
|
||||
self.searchImageView = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5.5, 24, 24)];
|
||||
self.searchImageView.image = [UIImage imageNamed:@"room_song_search"];
|
||||
[self.seachBgView addSubview:self.searchImageView];
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchImageView.right+6, 0, self.seachBgView.width-self.searchImageView.right-6-8, 35)];
|
||||
self.textField.placeholder = @"请输入ID/用户名搜索";
|
||||
self.textField.font = [UIFont systemFontOfSize:14];
|
||||
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventEditingChanged)];
|
||||
self.textField.returnKeyType = UIReturnKeyDone;
|
||||
self.textField.delegate = self;
|
||||
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.seachBgView addSubview:self.textField];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.seachBgView.bottom+12, self.width, self.bgView.height-12-self.seachBgView.bottom) style:(UITableViewStylePlain)];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableFooterView = [UIView new];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
[self.bgView addSubview:self.tableView];
|
||||
}
|
||||
-(void)textDidChange:(UITextField*)textField{
|
||||
//发起网络请求
|
||||
MJWeakSelf
|
||||
// [self.adpter qx_searchUserWithKeyword:textField.text completion:^(BOOL success, NSArray<SRUserHomeModel *> * _Nullable results) {
|
||||
// [weakSelf.dataArray removeAllObjects];
|
||||
// [weakSelf.dataArray addObjectsFromArray:results];
|
||||
// [weakSelf.tableView reloadData];
|
||||
// }];
|
||||
[QXMineNetwork searchApiWithType:1 search:textField.text successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
NSArray *arr = [NSArray yy_modelArrayWithClass:[QXSearchModel class] json:dict];
|
||||
[weakSelf.dataArray addObjectsFromArray:arr];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITextFieldDelegate
|
||||
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
-(void)textFieldDidBeginEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = kSafeAreaTop+90;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)textFieldDidEndEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - QXAddDirectCellDelegate
|
||||
-(void)addDirectWithUser:(QXSearchModel *)user{
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:YES type:1 roomId:self.roomId user_id:user.id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"添加成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXAddDirectCell *cell = [QXAddDirectCell cellWithTableView:tableView];
|
||||
QXSearchModel *model = self.dataArray[indexPath.row];
|
||||
cell.user = model;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 52;
|
||||
}
|
||||
|
||||
|
||||
-(void)resetView{
|
||||
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
[self resetView];
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.x = 0;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
|
||||
@end
|
||||
28
QXLive/Room(房间)/View/设置/QXDirectDelegate.h
Normal file
28
QXLive/Room(房间)/View/设置/QXDirectDelegate.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// QXDirectDelegate.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/17.
|
||||
//
|
||||
//#import "SRUserHomeModel.h"
|
||||
|
||||
#ifndef QXDirectDelegate_h
|
||||
#define QXDirectDelegate_h
|
||||
#import "QXSearchModel.h"
|
||||
@protocol QXDirectDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
/// 设置主持人比例
|
||||
-(void)setDirectRatioSuccess;
|
||||
/// 删除主持人
|
||||
-(void)removeDirectSuccess;
|
||||
/// 添加主持人
|
||||
-(void)addDirectWithUser:(QXSearchModel*)user;
|
||||
/// 删除亲密关系
|
||||
-(void)removeRelationshipSuccess;
|
||||
/// 发起pk
|
||||
-(void)sendPKWithRoomId:(NSString*)roomId;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* QXDirectDelegate_h */
|
||||
26
QXLive/Room(房间)/View/设置/QXDirectListCell.h
Normal file
26
QXLive/Room(房间)/View/设置/QXDirectListCell.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// QXDirectListCell.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
#import "QXDirectSetScaleView.h"
|
||||
#import "QXDirectDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXDirectListCell : UITableViewCell<QXDirectDelegate>
|
||||
@property (weak, nonatomic) IBOutlet UIView *bgView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *scaleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
|
||||
@property (strong, nonatomic) QXRoomOnlineList *model;
|
||||
@property (strong, nonatomic) NSString *roomId;
|
||||
@property (weak, nonatomic)id<QXDirectDelegate>delegate;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
82
QXLive/Room(房间)/View/设置/QXDirectListCell.m
Normal file
82
QXLive/Room(房间)/View/设置/QXDirectListCell.m
Normal file
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// QXDirectListCell.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXDirectListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXDirectListCell()
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXDirectListCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXDirectListCell";
|
||||
QXDirectListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
- (IBAction)removeAction:(id)sender {
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomAddOrDeleteManagerIsAdd:NO type:1 roomId:self.roomId user_id:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(removeDirectSuccess)]) {
|
||||
[weakSelf.delegate removeDirectSuccess];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
//-(void)setModel:(QXDirectListModel *)model{
|
||||
// _model = model;
|
||||
// self.nameLabel.text = model.user_nickname;
|
||||
// [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.head_picture] placeholderImage:PLACEHOLDER_IMAGE];
|
||||
// self.timeLabel.text = model.online_time;
|
||||
// self.scaleLabel.text = [NSString stringWithFormat:@"%@%%",model.earnings_ratio];
|
||||
// self.priceLabel.text = model.earnings;
|
||||
//}
|
||||
-(void)setModel:(QXRoomOnlineList *)model{
|
||||
_model = model;
|
||||
self.nameLabel.text = model.nickname;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.scaleLabel.text = [NSString stringWithFormat:@"%.2f%%",model.ratio.doubleValue];
|
||||
self.priceLabel.text = [NSString stringWithFormat:@"%.4f",model.earnings.doubleValue];
|
||||
}
|
||||
- (IBAction)setScaleAction:(id)sender {
|
||||
QXDirectSetScaleView *scaleView = [[QXDirectSetScaleView alloc] init];
|
||||
scaleView.userId = self.model.user_id;
|
||||
scaleView.roomId = self.roomId;
|
||||
scaleView.delegate = self;
|
||||
for (UIWindow *w in [UIApplication sharedApplication].windows) {
|
||||
if ([w isKeyWindow]) {
|
||||
[scaleView showInView:w];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setDirectRatioSuccess{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(setDirectRatioSuccess)]) {
|
||||
[self.delegate setDirectRatioSuccess];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
// Group 7049男性
|
||||
// Group 7050 女性
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
178
QXLive/Room(房间)/View/设置/QXDirectListCell.xib
Normal file
178
QXLive/Room(房间)/View/设置/QXDirectListCell.xib
Normal file
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="193" id="KGk-i7-Jjw" customClass="QXDirectListCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="606" height="193"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="606" height="193"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fyv-GJ-MOK">
|
||||
<rect key="frame" x="16" y="6" width="574" height="181"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="yB5-02-7V0">
|
||||
<rect key="frame" x="-6" y="-6" width="586" height="193"/>
|
||||
</imageView>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="9j4-xg-khE">
|
||||
<rect key="frame" x="12" y="12" width="43" height="43"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="43" id="3Bd-Pm-hFS"/>
|
||||
<constraint firstAttribute="height" constant="43" id="foB-bp-k5X"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="21.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="用户昵称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Ns-Wn-8ne">
|
||||
<rect key="frame" x="63" y="12" width="59.666666666666657" height="18"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收益比例:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tpG-r0-TB6">
|
||||
<rect key="frame" x="63" y="38" width="65" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="65" id="ced-P9-eNL"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.49803921569999998" green="0.49803921569999998" blue="0.49803921569999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="20.00" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5SN-gE-KAi">
|
||||
<rect key="frame" x="524.66666666666663" y="38" width="37.333333333333371" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收益" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tlv-bM-4Yi">
|
||||
<rect key="frame" x="527" y="12.666666666666668" width="35" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="35" id="iFz-Q5-lXa"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VQV-kA-f4N">
|
||||
<rect key="frame" x="133" y="38" width="36.666666666666657" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R6z-CR-U6M">
|
||||
<rect key="frame" x="162" y="134" width="400" height="35"/>
|
||||
<color key="backgroundColor" red="0.050980392156862744" green="1" blue="0.72549019607843135" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="35" id="dr0-y5-hdV"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="收益比例">
|
||||
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="17.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="setScaleAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="5UG-3x-Cba"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8xh-FH-6or">
|
||||
<rect key="frame" x="12" y="134" width="130" height="35"/>
|
||||
<color key="backgroundColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="35" id="81x-JT-9hH"/>
|
||||
<constraint firstAttribute="width" constant="130" id="PMh-Nj-WiF"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="移除">
|
||||
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="17.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="removeAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Ebt-8r-a5p"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_diamond" translatesAutoresizingMaskIntoConstraints="NO" id="dSa-62-x0n">
|
||||
<rect key="frame" x="502.66666666666663" y="36.666666666666664" width="20" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="20" id="9k7-Ud-Z6z"/>
|
||||
<constraint firstAttribute="height" constant="20" id="VUO-Ol-gH3"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="dSa-62-x0n" firstAttribute="centerY" secondItem="5SN-gE-KAi" secondAttribute="centerY" id="222-AB-wvY"/>
|
||||
<constraint firstItem="yB5-02-7V0" firstAttribute="leading" secondItem="Fyv-GJ-MOK" secondAttribute="leading" constant="-6" id="2hY-ds-bNR"/>
|
||||
<constraint firstItem="VQV-kA-f4N" firstAttribute="centerY" secondItem="tpG-r0-TB6" secondAttribute="centerY" id="4Ms-xc-eXJ"/>
|
||||
<constraint firstItem="8xh-FH-6or" firstAttribute="leading" secondItem="Fyv-GJ-MOK" secondAttribute="leading" constant="12" id="4tq-yD-Eds"/>
|
||||
<constraint firstItem="R6z-CR-U6M" firstAttribute="centerY" secondItem="8xh-FH-6or" secondAttribute="centerY" id="6du-Hx-qjc"/>
|
||||
<constraint firstAttribute="bottom" secondItem="8xh-FH-6or" secondAttribute="bottom" constant="12" id="AuV-57-Lz4"/>
|
||||
<constraint firstItem="5SN-gE-KAi" firstAttribute="centerY" secondItem="tpG-r0-TB6" secondAttribute="centerY" id="DIm-m1-EHb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="tlv-bM-4Yi" secondAttribute="trailing" constant="12" id="F2u-bZ-b3F"/>
|
||||
<constraint firstItem="1Ns-Wn-8ne" firstAttribute="top" secondItem="9j4-xg-khE" secondAttribute="top" id="H4h-Jb-JYv"/>
|
||||
<constraint firstItem="tpG-r0-TB6" firstAttribute="bottom" secondItem="9j4-xg-khE" secondAttribute="bottom" id="KLU-gn-U1W"/>
|
||||
<constraint firstAttribute="bottom" secondItem="yB5-02-7V0" secondAttribute="bottom" constant="-6" id="Kbu-qy-RS0"/>
|
||||
<constraint firstItem="5SN-gE-KAi" firstAttribute="leading" secondItem="dSa-62-x0n" secondAttribute="trailing" constant="2" id="Mpa-vx-SNo"/>
|
||||
<constraint firstItem="9j4-xg-khE" firstAttribute="leading" secondItem="Fyv-GJ-MOK" secondAttribute="leading" constant="12" id="Mq3-26-CA4"/>
|
||||
<constraint firstItem="9j4-xg-khE" firstAttribute="top" secondItem="Fyv-GJ-MOK" secondAttribute="top" constant="12" id="UM9-cA-Io6"/>
|
||||
<constraint firstItem="1Ns-Wn-8ne" firstAttribute="leading" secondItem="9j4-xg-khE" secondAttribute="trailing" constant="8" id="ebh-DE-As7"/>
|
||||
<constraint firstItem="yB5-02-7V0" firstAttribute="top" secondItem="Fyv-GJ-MOK" secondAttribute="top" constant="-6" id="etd-V1-iy3"/>
|
||||
<constraint firstItem="R6z-CR-U6M" firstAttribute="leading" secondItem="8xh-FH-6or" secondAttribute="trailing" constant="20" id="j1j-Qu-d19"/>
|
||||
<constraint firstAttribute="trailing" secondItem="R6z-CR-U6M" secondAttribute="trailing" constant="12" id="lkj-tu-4kn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="yB5-02-7V0" secondAttribute="trailing" constant="-6" id="nfK-0p-2al"/>
|
||||
<constraint firstItem="5SN-gE-KAi" firstAttribute="trailing" secondItem="tlv-bM-4Yi" secondAttribute="trailing" id="ngH-er-Jvg"/>
|
||||
<constraint firstItem="tpG-r0-TB6" firstAttribute="leading" secondItem="1Ns-Wn-8ne" secondAttribute="leading" id="uwF-q4-5Zu"/>
|
||||
<constraint firstItem="tlv-bM-4Yi" firstAttribute="centerY" secondItem="1Ns-Wn-8ne" secondAttribute="centerY" id="wEB-Vs-DV3"/>
|
||||
<constraint firstItem="VQV-kA-f4N" firstAttribute="leading" secondItem="tpG-r0-TB6" secondAttribute="trailing" constant="5" id="wbr-dY-qZs"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Fyv-GJ-MOK" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="ASn-IQ-z5V"/>
|
||||
<constraint firstItem="Fyv-GJ-MOK" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="SxV-C8-n6s"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Fyv-GJ-MOK" secondAttribute="trailing" constant="16" id="d8e-Gh-ZcC"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Fyv-GJ-MOK" secondAttribute="bottom" constant="6" id="kIe-d4-FNo"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="bgView" destination="Fyv-GJ-MOK" id="tr7-3h-oye"/>
|
||||
<outlet property="headerImageView" destination="9j4-xg-khE" id="2A9-rQ-YNd"/>
|
||||
<outlet property="nameLabel" destination="1Ns-Wn-8ne" id="xCu-CO-9G9"/>
|
||||
<outlet property="priceLabel" destination="5SN-gE-KAi" id="XXL-fG-7lp"/>
|
||||
<outlet property="scaleLabel" destination="VQV-kA-f4N" id="Ix7-Lt-nCA"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="232.06106870229007" y="-41.901408450704224"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
<image name="wallet_diamond" width="28" height="28"/>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
18
QXLive/Room(房间)/View/设置/QXDirectListView.h
Normal file
18
QXLive/Room(房间)/View/设置/QXDirectListView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXDirectListView.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXDirectListView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
154
QXLive/Room(房间)/View/设置/QXDirectListView.m
Normal file
154
QXLive/Room(房间)/View/设置/QXDirectListView.m
Normal file
@@ -0,0 +1,154 @@
|
||||
//
|
||||
// QXDirectListView.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXDirectListView.h"
|
||||
#import "QXDirectListCell.h"
|
||||
#import "QXAddDirectView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAlertView.h"
|
||||
|
||||
@interface QXDirectListView()<UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate,QXDirectDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIButton *addBtn;
|
||||
|
||||
@property (nonatomic,strong)UITableView*tableView;
|
||||
@property (nonatomic,strong)NSMutableArray*dataArray;
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
|
||||
@end
|
||||
@implementation QXDirectListView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self createViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)createViews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(429))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 300, 24)];
|
||||
self.titleLabel.text = @"主持人";
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.addBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-75, 5, 60, 40)];
|
||||
[self.addBtn setTitle:@"添加主持" forState:(UIControlStateNormal)];
|
||||
[self.addBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:(UIControlStateNormal)];
|
||||
self.addBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.addBtn addTarget:self action:@selector(addAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.addBtn];
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+6, self.width, self.bgView.height-6-self.titleLabel.bottom) style:(UITableViewStylePlain)];
|
||||
if (@available(iOS 15.0, *)) {
|
||||
self.tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableFooterView = [UIView new];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
[self.bgView addSubview:self.tableView];
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
[self getDirectList];
|
||||
}
|
||||
-(void)getDirectList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomManagerListWithRoomId:self.roomId type:1 successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)addAction{
|
||||
[self hide];
|
||||
QXAddDirectView *v = [[QXAddDirectView alloc] init];
|
||||
v.roomId = self.roomId;
|
||||
for (UIWindow *w in [UIApplication sharedApplication].windows) {
|
||||
if ([w isKeyWindow]) {
|
||||
[v showInView:w];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setDirectRatioSuccess{
|
||||
[self getDirectList];
|
||||
}
|
||||
|
||||
-(void)removeDirectSuccess{
|
||||
[self getDirectList];
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429);
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
//-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
// [self hide];
|
||||
//}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXDirectListCell *cell = [QXDirectListCell cellWithTableView:tableView];
|
||||
QXRoomOnlineList *model = self.dataArray[indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.roomId = self.roomId;
|
||||
cell.model = model;
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 126;
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
MJWeakSelf
|
||||
_alertView.commitBlock = ^{
|
||||
|
||||
};
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
@end
|
||||
31
QXLive/Room(房间)/View/设置/QXDirectSetScaleView.h
Normal file
31
QXLive/Room(房间)/View/设置/QXDirectSetScaleView.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXDirectSetScaleView.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXDirectDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@interface QXDirectSetScaleView : UIView
|
||||
@property (nonatomic,strong)NSString *userId;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
/// 转币
|
||||
@property (nonatomic,assign)BOOL isGiveCoin;
|
||||
|
||||
/// 头条
|
||||
@property (nonatomic,assign)BOOL isHeadline;
|
||||
/// 分钟
|
||||
@property (nonatomic,strong)NSString* minutes;
|
||||
/// 金币
|
||||
@property (nonatomic,strong)NSString* coin;
|
||||
/// 当前所需金币
|
||||
@property (nonatomic,strong)NSString* now_coin;
|
||||
|
||||
@property (nonatomic,weak)id<QXDirectDelegate>delegate;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hide;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
249
QXLive/Room(房间)/View/设置/QXDirectSetScaleView.m
Normal file
249
QXLive/Room(房间)/View/设置/QXDirectSetScaleView.m
Normal file
@@ -0,0 +1,249 @@
|
||||
//
|
||||
// QXDirectSetScaleView.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/6.
|
||||
//
|
||||
|
||||
#import "QXDirectSetScaleView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXDirectSetScaleView()<UITextFieldDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)UIView *scaleBGView;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
@property (nonatomic,strong)UILabel *unitLabel;
|
||||
|
||||
@property (nonatomic,strong)UIButton *coinBtn;
|
||||
@property (nonatomic,strong)UILabel *timeLabel;
|
||||
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXDirectSetScaleView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self createViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)createViews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
|
||||
// self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-AUTO_CEIL_WIETH(275))/2.0, (SCREEN_HEIGHT-AUTO_CEIL_WIETH(300))/2.0, AUTO_CEIL_WIETH(275), AUTO_CEIL_WIETH(300))];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(300))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
self.bgView.layer.masksToBounds = YES;
|
||||
self.bgView.layer.cornerRadius = 16;
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 12, self.bgView.width, 24)];
|
||||
self.titleLabel.text = @"请设置收益比例";
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-50, 0, 50, 50)];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.bgView addSubview:self.closeBtn];
|
||||
|
||||
self.scaleBGView = [[UIView alloc] initWithFrame:CGRectMake(12, self.titleLabel.bottom+35, self.bgView.width-12*2, 44)];
|
||||
self.scaleBGView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"];
|
||||
self.scaleBGView.layer.masksToBounds = YES;
|
||||
self.scaleBGView.layer.cornerRadius = 11;
|
||||
[self.bgView addSubview:self.scaleBGView];
|
||||
|
||||
self.unitLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.scaleBGView.right-12-35, 0, 35, self.scaleBGView.height)];
|
||||
self.unitLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
self.unitLabel.text = @"%";
|
||||
self.unitLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self.scaleBGView addSubview:self.unitLabel];
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(12, 0, self.unitLabel.left-24, 44)];
|
||||
self.textField.placeholder = @"请设置收益比例";
|
||||
self.textField.returnKeyType = UIReturnKeyDone;
|
||||
self.textField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
self.textField.delegate = self;
|
||||
self.textField.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventValueChanged)];
|
||||
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.scaleBGView addSubview:self.textField];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(18, self.scaleBGView.bottom+35, self.bgView.width-36, 90)];
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
self.messageLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
self.messageLabel.text = @"设置后主持人收益为主持期间房间收益的该百分比";
|
||||
self.messageLabel.font = [UIFont systemFontOfSize:13];
|
||||
[self.bgView addSubview:self.messageLabel];
|
||||
|
||||
self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, self.scaleBGView.bottom+12, 50, 18)];
|
||||
self.timeLabel.numberOfLines = 0;
|
||||
self.timeLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
self.timeLabel.font = [UIFont systemFontOfSize:13];
|
||||
self.timeLabel.hidden = YES;
|
||||
[self.bgView addSubview:self.timeLabel];
|
||||
|
||||
self.coinBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 200, 18)];
|
||||
self.coinBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
|
||||
[self.coinBtn setImage:[UIImage imageNamed:@"room_upseat_coin"] forState:(UIControlStateNormal)];
|
||||
[self.coinBtn setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:(UIControlStateNormal)];
|
||||
self.coinBtn.titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
self.coinBtn.hidden = YES;
|
||||
[self.bgView addSubview:self.coinBtn];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(50, self.bgView.height-12-42, self.bgView.width-100, 42)];
|
||||
[self.commitBtn setTitle:@"确定" forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.commitBtn.layer.masksToBounds = YES;
|
||||
self.commitBtn.layer.cornerRadius = 21;
|
||||
self.commitBtn.needEventInterval = 0.3;
|
||||
[self.bgView addSubview:self.commitBtn];
|
||||
|
||||
}
|
||||
-(void)setIsGiveCoin:(BOOL)isGiveCoin{
|
||||
_isGiveCoin = isGiveCoin;
|
||||
self.titleLabel.text = @"您正在进行转币操作";
|
||||
self.textField.placeholder = @"请输入金币数量";
|
||||
self.messageLabel.hidden = YES;
|
||||
self.unitLabel.hidden = YES;
|
||||
self.textField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
}
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
[self endEditing:YES];
|
||||
}
|
||||
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
|
||||
[textField resignFirstResponder];
|
||||
return YES;
|
||||
}
|
||||
-(void)textFieldDidBeginEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0-100;
|
||||
}];
|
||||
}
|
||||
-(void)textFieldDidEndEditing:(UITextField *)textField{
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0;
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)commitAction{
|
||||
if (self.isGiveCoin) {
|
||||
if (self.textField.text.longValue == 0) {
|
||||
showToast(@"请输入金币数量");
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXMineNetwork giveCoinWithUserId:self.userId coin:self.textField.text successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"转币成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
return;
|
||||
}
|
||||
if (self.isHeadline) {
|
||||
NSString *content = self.textField.text;
|
||||
if (![content isExist]) {
|
||||
showToast(@"请填写头条内容");
|
||||
return;
|
||||
}
|
||||
if (content.length > 15) {
|
||||
showToast(@"头条内容不能超过15个汉字");
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXMineNetwork sendHeadlineWithContent:content money:self.coin roomId:self.roomId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"抢头条成功");
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf hide];
|
||||
showToast(msg);
|
||||
}];
|
||||
}else{
|
||||
NSString *ratio = self.textField.text;
|
||||
if (ratio.doubleValue > 0 && ratio.doubleValue < 100) {
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomSetHostRatio:ratio roomId:self.roomId user_id:self.userId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(setDirectRatioSuccess)]) {
|
||||
[weakSelf.delegate setDirectRatioSuccess];
|
||||
[weakSelf hide];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}else{
|
||||
showToast(@"请设置正确的收益比例");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-(void)setIsHeadline:(BOOL)isHeadline{
|
||||
_isHeadline = isHeadline;
|
||||
self.titleLabel.text = @"发头条";
|
||||
self.textField.placeholder = @"请输入内容,最多15字";
|
||||
self.unitLabel.hidden = YES;
|
||||
self.textField.frame = CGRectMake(12, 0, self.scaleBGView.width-24, 44);
|
||||
self.messageLabel.frame = CGRectMake(12, self.timeLabel.bottom+12, self.bgView.width-36, self.commitBtn.top-self.timeLabel.bottom-24);
|
||||
self.coinBtn.frame = CGRectMake(self.timeLabel.right+10, self.scaleBGView.bottom+12, 200, 18);
|
||||
self.coinBtn.hidden = NO;
|
||||
self.timeLabel.hidden = NO;
|
||||
self.textField.keyboardType = UIKeyboardTypeDefault;
|
||||
[self.commitBtn setTitle:@"发布" forState:(UIControlStateNormal)];
|
||||
}
|
||||
-(void)setMinutes:(NSString *)minutes{
|
||||
_minutes = minutes;
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"%@分钟",minutes];
|
||||
}
|
||||
- (void)setCoin:(NSString *)coin{
|
||||
_coin = coin;
|
||||
[self.coinBtn setTitle:coin forState:(UIControlStateNormal)];
|
||||
}
|
||||
-(void)setNow_coin:(NSString *)now_coin{
|
||||
_now_coin = now_coin;
|
||||
if (now_coin.intValue > 0) {
|
||||
self.titleLabel.text = @"抢头条";
|
||||
self.messageLabel.text = [NSString stringWithFormat:@"当前头条价格%@,抢头条价格%@,可立即覆盖当前头条",now_coin,self.coin];
|
||||
}else{
|
||||
self.titleLabel.text = @"发头条";
|
||||
self.messageLabel.text = @"";
|
||||
}
|
||||
}
|
||||
|
||||
-(void)closeAction{
|
||||
[self hide];
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.textField.text = @"";
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(300))/2.0;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
17
QXLive/Room(房间)/View/设置/QXHeadlineView.h
Normal file
17
QXLive/Room(房间)/View/设置/QXHeadlineView.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXHeadlineView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/25.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXHeadlineView : UIView
|
||||
@property (nonatomic,strong)QXHeadLineModel *model;
|
||||
@property (nonatomic,copy)void(^getHeadlineBlock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
230
QXLive/Room(房间)/View/设置/QXHeadlineView.m
Normal file
230
QXLive/Room(房间)/View/设置/QXHeadlineView.m
Normal file
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// QXHeadlineView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/25.
|
||||
//
|
||||
|
||||
#import "QXHeadlineView.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
#import "QXTimer.h"
|
||||
|
||||
@interface QXHeadlineView()
|
||||
|
||||
@property (nonatomic,strong)UIButton *iconBtn;
|
||||
|
||||
@property (nonatomic,strong)UIView *headLineBgView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIImageView *headImageView;
|
||||
@property (nonatomic,strong)UIButton *headBtn;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
@property (nonatomic,strong)UILabel *contentLabel;
|
||||
|
||||
@property (nonatomic,strong)UIButton *getBtn;
|
||||
@property (nonatomic,strong)UIButton *trampleBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,assign)BOOL isSmall;
|
||||
@property (nonatomic,assign)long startTime;
|
||||
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@end
|
||||
|
||||
@implementation QXHeadlineView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(12, SCREEN_HEIGHT-460, ScaleWidth(344), 64);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.clipsToBounds = YES;
|
||||
// [self addRoundedCornersWithRadius:8];
|
||||
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
|
||||
[self addGestureRecognizer:panRecognizer];
|
||||
self.iconBtn = [[UIButton alloc] init];
|
||||
self.iconBtn.frame = CGRectMake(0, 0, 78, 64);
|
||||
// self.iconImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self.iconBtn setBackgroundImage:[UIImage imageNamed:@"room_headline_icon"] forState:(UIControlStateNormal)];
|
||||
[self.iconBtn setBackgroundImage:[UIImage imageNamed:@"room_headline_icon"] forState:(UIControlStateHighlighted)];
|
||||
[self.iconBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.iconBtn];
|
||||
|
||||
self.headLineBgView = [[UIView alloc] initWithFrame:CGRectMake(self.iconBtn.right-6, self.height-44, self.width-self.iconBtn.right-6, 44)];
|
||||
self.headLineBgView.clipsToBounds = YES;
|
||||
[self.headLineBgView addRoundedCornersWithRadius:4 byRoundingCorners:(UIRectCornerTopRight|UIRectCornerBottomRight)];
|
||||
[self insertSubview:self.headLineBgView belowSubview:self.iconBtn];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_headline_bg"]];
|
||||
self.bgImageView.frame = self.headLineBgView.bounds;
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
self.bgImageView.clipsToBounds = YES;
|
||||
[self.headLineBgView addSubview:self.bgImageView];
|
||||
|
||||
|
||||
|
||||
self.headImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.headImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.headImageView.frame = CGRectMake(12, 9, ScaleWidth(28), ScaleWidth(28));
|
||||
[self.headImageView addRoundedCornersWithRadius:ScaleWidth(14)];
|
||||
self.headImageView.centerY = self.bgImageView.centerY;
|
||||
self.headImageView.layer.borderWidth = 1;
|
||||
self.headImageView.layer.borderColor = RGB16(0xffffff).CGColor;
|
||||
[self.headLineBgView addSubview:self.headImageView];
|
||||
|
||||
self.headBtn = [[UIButton alloc] initWithFrame:CGRectMake(12, 0, 44, 44)];
|
||||
[self.headBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.headLineBgView addSubview:self.headBtn];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headImageView.right+4, self.headImageView.top-4, self.width-self.headImageView.right-4-60, 18)];
|
||||
self.nameLabel.font = [UIFont boldSystemFontOfSize:12];
|
||||
self.nameLabel.textColor = RGB16(0xffffff);
|
||||
[self.headLineBgView addSubview:self.nameLabel];
|
||||
|
||||
self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headImageView.right+4, self.nameLabel.bottom, self.width-self.headImageView.right-4-60, 18)];
|
||||
self.contentLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.contentLabel.textColor = RGB16(0xffffff);
|
||||
[self.headLineBgView addSubview:self.contentLabel];
|
||||
|
||||
|
||||
|
||||
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.headLineBgView.width-22, 0, 22, 44)];
|
||||
// self.closeBtn.backgroundColor = RGB16(0x9C7DED);
|
||||
[self.closeBtn addRoundedCornersWithRadius:4 byRoundingCorners:(UIRectCornerTopRight|UIRectCornerBottomRight)];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"head_line_back"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.headLineBgView addSubview:self.closeBtn];
|
||||
|
||||
self.getBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.closeBtn.left-2-ScaleWidth(22),12 , ScaleWidth(22), ScaleWidth(22))];
|
||||
[self.getBtn addRoundedCornersWithRadius:ScaleWidth(11)];
|
||||
self.getBtn.layer.borderWidth = 1;
|
||||
self.getBtn.layer.borderColor = RGB16(0xffffff).CGColor;
|
||||
[self.getBtn setTitle:@"抢" forState:(UIControlStateNormal)];
|
||||
self.getBtn.titleLabel.font = [UIFont boldSystemFontOfSize:ScaleWidth(12)];
|
||||
[self.getBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
[self.getBtn addTarget:self action:@selector(getAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.headLineBgView addSubview:self.getBtn];
|
||||
self.getBtn.centerY = self.headImageView.centerY;
|
||||
|
||||
self.trampleBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.getBtn.left-8-ScaleWidth(22),12 , ScaleWidth(22), ScaleWidth(22))];
|
||||
[self.trampleBtn addRoundedCornersWithRadius:ScaleWidth(11)];
|
||||
self.trampleBtn.layer.borderWidth = 1;
|
||||
self.trampleBtn.layer.borderColor = RGB16(0xffffff).CGColor;
|
||||
[self.trampleBtn setTitle:@"踩" forState:(UIControlStateNormal)];
|
||||
self.trampleBtn.titleLabel.font = [UIFont boldSystemFontOfSize:ScaleWidth(12)];
|
||||
[self.trampleBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
[self.trampleBtn addTarget:self action:@selector(trampleAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.headLineBgView addSubview:self.trampleBtn];
|
||||
self.trampleBtn.centerY = self.headImageView.centerY;
|
||||
}
|
||||
|
||||
|
||||
-(void)getAction:(UIButton*)sender{
|
||||
if (self.getHeadlineBlock) {
|
||||
self.getHeadlineBlock();
|
||||
}
|
||||
}
|
||||
|
||||
-(void)trampleAction{
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:self.model.room_id isRejoin:NO navagationController:self.viewController.navigationController];
|
||||
}
|
||||
-(void)headerAction{
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
vc.user_id = self.model.user_id;
|
||||
vc.hidesBottomBarWhenPushed = YES;
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(void)backAction{
|
||||
if (self.isSmall) {
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
// self.headLineBgView.width = self.width-self.iconImageView.right-6;
|
||||
// self.closeBtn.left = self.headLineBgView.width-22;
|
||||
// self.closeBtn.imageView.transform = CGAffineTransformIdentity;
|
||||
|
||||
self.width = ScaleWidth(344);
|
||||
} completion:^(BOOL finished) {
|
||||
self.isSmall = NO;
|
||||
}];
|
||||
}else{
|
||||
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
// self.headLineBgView.width = 6+22;
|
||||
// self.closeBtn.left = 6;
|
||||
// self.closeBtn.imageView.transform = CGAffineTransformMakeRotation(180 * M_PI/180.0);
|
||||
|
||||
self.width = 78;
|
||||
} completion:^(BOOL finished) {
|
||||
self.isSmall = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-(void)setModel:(QXHeadLineModel *)model{
|
||||
_model = model;
|
||||
self.nameLabel.text = model.nickname;
|
||||
[self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.contentLabel.text = model.content;
|
||||
[self startTimer];
|
||||
if (self.isSmall) {
|
||||
[UIView animateWithDuration:0.15 animations:^{
|
||||
// self.headLineBgView.width = self.width-self.iconImageView.right-6;
|
||||
// self.closeBtn.left = self.headLineBgView.width-22;
|
||||
// self.closeBtn.imageView.transform = CGAffineTransformIdentity;
|
||||
|
||||
self.width = ScaleWidth(344);
|
||||
} completion:^(BOOL finished) {
|
||||
self.isSmall = NO;
|
||||
}];
|
||||
}
|
||||
}
|
||||
-(void)startTimer{
|
||||
MJWeakSelf
|
||||
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
// 将秒转换为毫秒
|
||||
long long milliseconds = (long long)(timeInterval);
|
||||
self.startTime = self.model.end_time.longLongValue - milliseconds;
|
||||
if (self.startTime <= 0) {
|
||||
//时间错误不进行倒计时
|
||||
[self removeFromSuperview];
|
||||
return;
|
||||
}
|
||||
[self stopTimer];
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
weakSelf.startTime--;
|
||||
if (weakSelf.startTime<=0) {
|
||||
[weakSelf stopTimer];
|
||||
[weakSelf removeFromSuperview];
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
-(void)stopTimer{
|
||||
if (_timer) {
|
||||
[self->_timer invalidate];
|
||||
self->_timer= nil;
|
||||
}
|
||||
}
|
||||
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
|
||||
if (recognizer.state == UIGestureRecognizerStateEnded) {
|
||||
NSLog(@"拖动结束");
|
||||
}
|
||||
CGPoint translation = [recognizer translationInView:self.viewController.view];
|
||||
// CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
// recognizer.view.center.y + translation.y);
|
||||
// if (panCenter.x-214/2 <= 0 || panCenter.x+214/2 >= SCREEN_WIDTH || panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
recognizer.view.center.y + translation.y);
|
||||
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
|
||||
}
|
||||
@end
|
||||
22
QXLive/Room(房间)/View/设置/QXRoomBgMusicView.h
Normal file
22
QXLive/Room(房间)/View/设置/QXRoomBgMusicView.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// QXRoomBgMusicView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXSongListModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomBgMusicView : UIView
|
||||
@property (nonatomic,strong)void(^moreActionBlock)(void);
|
||||
@property (nonatomic,strong)void(^nextActionBlock)(void);
|
||||
@property (nonatomic,strong)void(^pauseActionBlock)(UIButton* playBtn);
|
||||
@property (nonatomic,strong)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,strong)QXSongListModel *songModel;
|
||||
@property (nonatomic,assign)NSUInteger progress;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
144
QXLive/Room(房间)/View/设置/QXRoomBgMusicView.m
Normal file
144
QXLive/Room(房间)/View/设置/QXRoomBgMusicView.m
Normal file
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// QXRoomBgMusicView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import "QXRoomBgMusicView.h"
|
||||
#import "MarqueeLabel.h"
|
||||
|
||||
@interface QXRoomBgMusicView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIImageView *musicCover;
|
||||
@property (nonatomic,strong)MarqueeLabel *nameLabel;
|
||||
@property (nonatomic,strong)UILabel *singerLabel;
|
||||
@property (nonatomic,strong)UILabel *timeLabel;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
|
||||
@property (nonatomic,strong)UIButton *moreBtn;
|
||||
@property (nonatomic,strong)UIButton *nextBtn;
|
||||
@property (nonatomic,strong)UIButton *playBtn;
|
||||
@end
|
||||
@implementation QXRoomBgMusicView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(SCREEN_WIDTH-215-12, kSafeAreaTop+56, 214, 97);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
[self addRoundedCornersWithRadius:16];
|
||||
self.backgroundColor = RGB16A(0xffffff, 0.7);
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
[self addSubview:self.bgImageView];
|
||||
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
|
||||
[self addGestureRecognizer:panRecognizer];
|
||||
self.musicCover = [[UIImageView alloc] initWithFrame:CGRectMake(12, 12, 44, 44)];
|
||||
[self.musicCover addRoundedCornersWithRadius:2];
|
||||
self.musicCover.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self addSubview:self.musicCover];
|
||||
|
||||
self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, self.height-40-2, 58, 40)];
|
||||
self.timeLabel.font = [UIFont systemFontOfSize:9];
|
||||
self.timeLabel.textColor = RGB16(0x666666);
|
||||
[self addSubview:self.timeLabel];
|
||||
|
||||
self.nameLabel = [[MarqueeLabel alloc] initWithFrame:CGRectMake(self.musicCover.right+4, self.musicCover.top, 95, 18)];
|
||||
self.nameLabel.textColor = QXConfig.textColor;
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.nameLabel];
|
||||
|
||||
self.singerLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.musicCover.right+4, self.nameLabel.bottom+4, 95, 18)];
|
||||
self.singerLabel.textColor = QXConfig.textColor;
|
||||
self.singerLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.singerLabel];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-40, 0, 40, 40)];
|
||||
[self.closeBtn setImage:[UIImage imageNamed:@"wallet_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
|
||||
|
||||
self.moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.nameLabel.left, self.height-40-2, 40, 40)];
|
||||
[self.moreBtn setImage:[UIImage imageNamed:@"room_music_more"] forState:(UIControlStateNormal)];
|
||||
[self.moreBtn addTarget:self action:@selector(moreAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.moreBtn];
|
||||
|
||||
self.nextBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-25-40, self.moreBtn.top, 40, 40)];
|
||||
[self.nextBtn setImage:[UIImage imageNamed:@"room_music_next"] forState:(UIControlStateNormal)];
|
||||
[self.nextBtn addTarget:self action:@selector(nextAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.nextBtn];
|
||||
|
||||
self.playBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.moreBtn.right+(self.nextBtn.left-self.moreBtn.right-40)/2, self.moreBtn.top, 40, 40)];
|
||||
[self.playBtn setImage:[UIImage imageNamed:@"room_music_pause"] forState:(UIControlStateNormal)];
|
||||
[self.playBtn setImage:[UIImage imageNamed:@"room_music_play"] forState:(UIControlStateSelected)];
|
||||
self.playBtn.selected = YES;
|
||||
[self.playBtn addTarget:self action:@selector(playAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.playBtn];
|
||||
|
||||
}
|
||||
|
||||
-(void)moreAction{
|
||||
if (self.moreActionBlock) {
|
||||
self.moreActionBlock();
|
||||
}
|
||||
}
|
||||
-(void)playAction{
|
||||
if (self.pauseActionBlock) {
|
||||
self.pauseActionBlock(self.playBtn);
|
||||
}
|
||||
}
|
||||
-(void)nextAction{
|
||||
if (self.nextActionBlock) {
|
||||
self.nextActionBlock();
|
||||
}
|
||||
}
|
||||
-(void)setSongModel:(QXSongListModel *)songModel{
|
||||
_songModel = songModel;
|
||||
self.playBtn.selected = NO;
|
||||
[self.musicCover sd_setImageWithURL:[NSURL URLWithString:songModel.poster]];
|
||||
self.nameLabel.text = songModel.song_name;
|
||||
self.singerLabel.text = songModel.singer;
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"00:00/%02ld:%02ld",songModel.duration/60,songModel.duration%60];
|
||||
}
|
||||
-(void)setProgress:(NSUInteger)progress{
|
||||
_progress = progress;
|
||||
NSInteger minutes = progress/1000/60;
|
||||
NSInteger second = progress/1000%60;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld/%02ld:%02ld",minutes,second,self.songModel.duration/60,self.songModel.duration%60];
|
||||
});
|
||||
}
|
||||
|
||||
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
|
||||
if (recognizer.state == UIGestureRecognizerStateEnded) {
|
||||
NSLog(@"拖动结束");
|
||||
}
|
||||
CGPoint translation = [recognizer translationInView:self.viewController.view];
|
||||
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
recognizer.view.center.y + translation.y);
|
||||
if (panCenter.x-214/2 <= 0 || panCenter.x+214/2 >= SCREEN_WIDTH || panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
|
||||
recognizer.view.center.y + translation.y);
|
||||
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
}
|
||||
@end
|
||||
20
QXLive/Room(房间)/View/设置/QXRoomBgSettingView.h
Normal file
20
QXLive/Room(房间)/View/设置/QXRoomBgSettingView.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// QXRoomBgSettingView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomBgSettingView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
@interface QXRoomBgSettingCell : UICollectionViewCell
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
291
QXLive/Room(房间)/View/设置/QXRoomBgSettingView.m
Normal file
291
QXLive/Room(房间)/View/设置/QXRoomBgSettingView.m
Normal file
@@ -0,0 +1,291 @@
|
||||
//
|
||||
// QXRoomBgSettingView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import "QXRoomBgSettingView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "UIImage+QX.h"
|
||||
#import "QXOSSManager.h"
|
||||
#import "QXAlertView.h"
|
||||
#import <TZImagePickerController.h>
|
||||
|
||||
@interface QXRoomBgSettingView()<UIGestureRecognizerDelegate,UICollectionViewDataSource,UICollectionViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIButton *publicBgBtn;
|
||||
@property (nonatomic,strong)UIButton *myBgBtn;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray *publicArray;
|
||||
@property (nonatomic,strong)NSMutableArray *myBgArray;
|
||||
@property (nonatomic,strong)NSString* roomCoverUrl;
|
||||
@end
|
||||
|
||||
@implementation QXRoomBgSettingView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubiews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubiews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(348))];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.publicBgBtn = [[UIButton alloc] initWithFrame:CGRectMake(16, 18, 70, 24)];
|
||||
[self.publicBgBtn setTitle:QXText(@"公共背景") forState:(UIControlStateNormal)];
|
||||
self.publicBgBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self.publicBgBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.publicBgBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
self.publicBgBtn.selected = YES;
|
||||
[self.publicBgBtn addTarget:self action:@selector(typeAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.bgView addSubview:self.publicBgBtn];
|
||||
|
||||
self.myBgBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.publicBgBtn.right+16, 18, 70, 24)];
|
||||
[self.myBgBtn setTitle:QXText(@"我的背景") forState:(UIControlStateNormal)];
|
||||
self.myBgBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.myBgBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.myBgBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
[self.myBgBtn addTarget:self action:@selector(typeAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.bgView addSubview:self.myBgBtn];
|
||||
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 20;
|
||||
layout.minimumInteritemSpacing = 20;
|
||||
int itemWidth = (self.width-16*2-22*2)/3;
|
||||
layout.itemSize = CGSizeMake(itemWidth, itemWidth);
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.publicBgBtn.bottom+12, self.bgView.width, self.bgView.height-self.publicBgBtn.bottom-12) collectionViewLayout:layout];
|
||||
self.collectionView.scrollEnabled = NO;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
[self.collectionView registerClass:[QXRoomBgSettingCell class] forCellWithReuseIdentifier:@"QXRoomBgSettingCell"];
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
[self getRoomBgList];
|
||||
}
|
||||
-(void)getRoomBgList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork getRoomBgListSuccessBlock:^(NSArray<QXRoomBgListModel *> * _Nonnull publicArray, NSArray<QXRoomBgListModel *> * _Nonnull myBgArray) {
|
||||
[weakSelf.publicArray removeAllObjects];
|
||||
[weakSelf.myBgArray removeAllObjects];
|
||||
[weakSelf.publicArray addObjectsFromArray:publicArray];
|
||||
[weakSelf.myBgArray addObjectsFromArray:myBgArray];
|
||||
QXRoomBgListModel *md = [[QXRoomBgListModel alloc] init];
|
||||
md.image_url = @"mine_room_cover_add";
|
||||
[weakSelf.myBgArray insertObject:md atIndex:0];
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)typeAction:(UIButton*)sender{
|
||||
if (sender.selected) {
|
||||
return;
|
||||
}
|
||||
if (sender == self.publicBgBtn) {
|
||||
self.publicBgBtn.selected = YES;
|
||||
self.myBgBtn.selected = NO;
|
||||
self.publicBgBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.myBgBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
}else{
|
||||
self.publicBgBtn.selected = NO;
|
||||
self.myBgBtn.selected = YES;
|
||||
self.myBgBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.publicBgBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
}
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (self.publicBgBtn.selected == YES) {
|
||||
return self.publicArray.count;
|
||||
}
|
||||
return self.myBgArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomBgSettingCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRoomBgSettingCell" forIndexPath:indexPath];
|
||||
QXRoomBgListModel *model;
|
||||
if (self.publicBgBtn.selected == YES) {
|
||||
model = self.publicArray[indexPath.row];
|
||||
}else{
|
||||
model = self.myBgArray[indexPath.row];
|
||||
}
|
||||
if ([model.image_url hasPrefix:@"http"] || [model.image_url hasPrefix:@"https"]) {
|
||||
[cell.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.image_url]];
|
||||
}else{
|
||||
cell.bgImageView.image = [UIImage imageNamed:model.image_url];
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomBgListModel *model;
|
||||
if (self.publicBgBtn.selected == YES) {
|
||||
model = self.publicArray[indexPath.row];
|
||||
}else{
|
||||
model = self.myBgArray[indexPath.row];
|
||||
}
|
||||
if (self.publicBgBtn.selected == YES) {
|
||||
[self showAlertViewWithUrl:model.image_url];
|
||||
}else{
|
||||
if (indexPath.row == 0) {
|
||||
[self selectAlbumPhoto];
|
||||
}else{
|
||||
[self showAlertViewWithUrl:model.image_url];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)showAlertViewWithUrl:(NSString*)imageUrl{
|
||||
MJWeakSelf
|
||||
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(275), ScaleWidth(200))];
|
||||
al.message = @"确定要更换房间背景吗?";
|
||||
al.commitBlock = ^{
|
||||
[weakSelf changeRoomBgWithUrl:imageUrl];
|
||||
};
|
||||
[[QXGlobal shareGlobal] showView:al controller:self.viewController popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)changeRoomBgWithUrl:(NSString*)imageUrl{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomInfoEditWithRoomId:self.roomId room_name:@"" room_cover:@"" room_intro:@"" room_background:imageUrl successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)selectAlbumPhoto {
|
||||
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:nil];
|
||||
imagePickerVc.maxImagesCount = 1;
|
||||
imagePickerVc.allowCameraLocation = NO;
|
||||
imagePickerVc.allowPickingOriginalPhoto = NO;
|
||||
|
||||
imagePickerVc.allowTakeVideo = NO;
|
||||
imagePickerVc.allowPickingVideo = NO;
|
||||
imagePickerVc.showSelectBtn = NO;
|
||||
imagePickerVc.allowCrop = NO;
|
||||
MJWeakSelf
|
||||
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
|
||||
if (photos.count) {
|
||||
NSData *imageData = [photos.firstObject qx_compressImageQualityWithToByte:(SCREEN_WIDTH*SCREEN_HEIGHT*2)];
|
||||
|
||||
[weakSelf OSSUploadPhotoWithFileData:imageData contentType:[NSString contentTypeWithImageData:imageData]];
|
||||
}
|
||||
}];
|
||||
imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[imagePickerVc.navigationBar setBackgroundImage:[UIImage imageWithColor:RGB16(0x333333)] forBarMetrics:UIBarMetricsDefault];
|
||||
[self.viewController presentViewController:imagePickerVc animated:YES completion:nil];
|
||||
}
|
||||
- (void)OSSUploadPhotoWithFileData:(NSData *)fileData contentType:(NSString *)contentType {
|
||||
[self OSSUploadPhotoWithFileData:fileData contentType:contentType isVideoCover:NO];
|
||||
}
|
||||
|
||||
- (void)OSSUploadPhotoWithFileData:(NSData *)fileData contentType:(NSString *)contentType isVideoCover:(BOOL)isVideoCover {
|
||||
if (!fileData || !contentType) {
|
||||
QXLOG(@"资源加载错误");
|
||||
return;
|
||||
}
|
||||
if (fileData.length > 1024*1024 && [contentType isEqualToString:IMG_FILE_BASE_PATH]) {
|
||||
QXLOG(@"请不要上传超过1M的头像");
|
||||
return;
|
||||
}
|
||||
NSMutableArray *files = [[NSMutableArray alloc] initWithObjects:fileData, nil];
|
||||
|
||||
NSString *fileBasePath = IMG_FILE_BASE_PATH;// 默认图片上传
|
||||
NSString *fileName = [NSString stringWithFormat:@"%@%@/%@.%@",fileBasePath,[[QXOSSManager sharedInstance] currentDate],[NSUUID UUID].UUIDString,contentType];
|
||||
NSMutableArray *fileNames = [[NSMutableArray alloc] initWithObjects:fileName, nil];
|
||||
__weak typeof(self)weakSelf = self;
|
||||
[QXProjectTools showLoadingInView:self.viewController.view];
|
||||
[[QXOSSManager sharedInstance] uploadFile:files withObjectKey:fileNames isAsync:YES complete:^(NSArray<NSString *> *names, UploadImageState state) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[QXProjectTools hideLoadingInView:self.viewController.view];
|
||||
});
|
||||
if (state == UploadImageSuccess) {
|
||||
NSString *fileName = [names lastObject];
|
||||
NSString *fileUrl =[NSString stringWithFormat:@"https://%@.%@/%@",OSS_BUCKET_NAME,OSSEndPoint,fileName];
|
||||
weakSelf.roomCoverUrl = fileUrl;
|
||||
[weakSelf uploadImage];
|
||||
}else{
|
||||
QXLOG(@"文件上传失败,请重新尝试");
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)uploadImage{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork uploadRoomBgWithImageUrl:self.roomCoverUrl Id:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf getRoomBgList];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(348);
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
-(NSMutableArray *)publicArray{
|
||||
if (!_publicArray) {
|
||||
_publicArray = [NSMutableArray array];
|
||||
}
|
||||
return _publicArray;
|
||||
}
|
||||
-(NSMutableArray *)myBgArray{
|
||||
if (!_myBgArray) {
|
||||
_myBgArray = [NSMutableArray array];
|
||||
}
|
||||
return _myBgArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation QXRoomBgSettingCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubView{
|
||||
self.bgImageView = [[UIImageView alloc] init];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.bgImageView addRoundedCornersWithRadius:10];
|
||||
[self.contentView addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.bottom.equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
@end
|
||||
108
QXLive/Room(房间)/View/设置/QXRoomSettingView.h
Normal file
108
QXLive/Room(房间)/View/设置/QXRoomSettingView.h
Normal file
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// QXRoomSettingView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/12.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomModel.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 房间类型
|
||||
/// 点唱房
|
||||
QXRoomSettingTypeRoomTypeSing = 10,
|
||||
/// 拍卖房
|
||||
QXRoomSettingTypeRoomTypeAuction = 11,
|
||||
/// 男神房
|
||||
QXRoomSettingTypeRoomTypeBoy = 12,
|
||||
/// 女神房
|
||||
QXRoomSettingTypeRoomTypeGirl = 13,
|
||||
/// 交友房
|
||||
QXRoomSettingTypeRoomTypeFriend = 14,
|
||||
/// 互娱
|
||||
QXRoomSettingTypeRoomTypeFunny = 100,
|
||||
|
||||
/// 常用工具
|
||||
/// 房间补贴
|
||||
QXRoomSettingTypeRoomSubsidy = 9,
|
||||
/// 主持设置
|
||||
QXRoomSettingTypeRoomCompere = 15,
|
||||
/// 清空消息
|
||||
QXRoomSettingTypeRoomClearMessage = 16,
|
||||
/// 麦序
|
||||
QXRoomSettingTypeRoomOrderMic = 17,
|
||||
/// 背景音乐
|
||||
QXRoomSettingTypeRoomBgMusic = 18,
|
||||
/// 背景图片
|
||||
QXRoomSettingTypeRoomBgImage = 19,
|
||||
|
||||
/// 更多操作
|
||||
/// 离开房间
|
||||
QXRoomSettingTypeRoomLeave = 20,
|
||||
/// 分享房间
|
||||
QXRoomSettingTypeRoomShare = 21,
|
||||
/// 调音台
|
||||
QXRoomSettingTypeRoomVoiceSet = 22,
|
||||
/// 房间设置
|
||||
QXRoomSettingTypeRoomSetting = 23,
|
||||
/// 房间欢迎语
|
||||
QXRoomSettingTypeRoomWelcome = 24,
|
||||
/// 关闭特效
|
||||
QXRoomSettingTypeRoomCloseEffects = 25,
|
||||
/// 意见反馈
|
||||
QXRoomSettingTypeRoomReport = 26,
|
||||
/// 关闭飘屏
|
||||
QXRoomSettingTypeDrifPop = 27,
|
||||
/// 发红包
|
||||
QXRoomSettingTypeSendRedBag = 28,
|
||||
}QXRoomSettingType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class QXRoomSettingModel;
|
||||
@protocol QXRoomSettingViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
///
|
||||
-(void)didClickSetModel:(QXRoomSettingModel*)model;
|
||||
|
||||
/// 抢头条
|
||||
-(void)didClickHeadLine;
|
||||
|
||||
@end
|
||||
@interface QXRoomSettingView : UIView
|
||||
@property (nonatomic,weak)id<QXRoomSettingViewDelegate>delegate;
|
||||
@property (nonatomic,strong)QXRoomModel *roomModel;
|
||||
|
||||
-(void)showInView:(UIView *)view;
|
||||
-(void)hide;
|
||||
-(void)updateRole:(QXRoomRoleType)roleType isUpSeat:(BOOL)isUpSeat;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomSettingCell : UITableViewCell<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSArray* dataArray;
|
||||
@property (nonatomic,strong) NSString *roomId;
|
||||
@property (nonatomic,weak)id<QXRoomSettingViewDelegate>delegate;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
@class QXRoomSettingModel;
|
||||
@interface QXRoomSettingSubCell : UICollectionViewCell
|
||||
@property (nonatomic,strong) UIImageView* imageView;
|
||||
@property (nonatomic,strong) UILabel* titleLabel;
|
||||
@property (nonatomic,strong) QXRoomSettingModel *model;
|
||||
@property (nonatomic,strong) NSString *roomId;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomSettingModel : NSObject
|
||||
@property (nonatomic,strong) NSString *name;
|
||||
@property (nonatomic,strong) NSString *selName;
|
||||
@property (nonatomic,strong) NSString *icon;
|
||||
@property (nonatomic,strong) NSString *selIcon;
|
||||
@property (nonatomic,assign) QXRoomSettingType type;
|
||||
@property (nonatomic,assign) BOOL isSelected;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
771
QXLive/Room(房间)/View/设置/QXRoomSettingView.m
Normal file
771
QXLive/Room(房间)/View/设置/QXRoomSettingView.m
Normal file
@@ -0,0 +1,771 @@
|
||||
//
|
||||
// QXRoomSettingView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/12.
|
||||
//
|
||||
|
||||
#import "QXRoomSettingView.h"
|
||||
#import "UIButton+QX.h"
|
||||
#import "QXGiftPlayerManager.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXDressViewController.h"
|
||||
#import "QXDirectListView.h"
|
||||
#import "QXSingerConfigView.h"
|
||||
#import "QXRoomWelcomeView.h"
|
||||
#import "QXAlertView.h"
|
||||
#import "QXGiftDriftView.h"
|
||||
#import "QXMeetActivityDriftView.h"
|
||||
#import "QXDrifRoomHourRankView.h"
|
||||
#import "QXRedPacketDriftView.h"
|
||||
|
||||
@interface QXRoomSettingView()<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource,QXRoomSettingViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UIView *topView;
|
||||
@property (nonatomic,strong)NSArray *titles;
|
||||
@property (nonatomic,strong)NSDictionary *dataDict;
|
||||
///
|
||||
@property (nonatomic,strong)UIView *bottomBgView;
|
||||
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
|
||||
/// 房间类型
|
||||
/// 点唱房间类型
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomTypeSing;
|
||||
/// 排麦房间类型
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomTypeAuction;
|
||||
/// 男神房
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomTypeBoy;
|
||||
/// 女神房
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomTypeGirl;
|
||||
/// 交友房 以前的交友换成互娱
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomTypeFriend;
|
||||
/// 互娱 曾经的男神女神合并为交友
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomTypeFunny;
|
||||
|
||||
|
||||
/// 常用工具
|
||||
/// 房间补贴
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomSubsidy;
|
||||
/// 主持设置
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomCompere;
|
||||
/// 清除消息
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomMessage;
|
||||
/// 麦序模式
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomOrderMic;
|
||||
/// 背景音乐
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomBgMusic;
|
||||
/// 房间背景
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomBgImage;
|
||||
|
||||
/// 更多操作
|
||||
/// 离开房间
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomLeave;
|
||||
/// 分享房间
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomShare;
|
||||
/// 个性装扮
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomVoiceSet;
|
||||
/// 房间设置
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomSetting;
|
||||
/// 欢迎语
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomWelcome;
|
||||
/// 礼物特效
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomEffects;
|
||||
/// 意见反馈
|
||||
@property (nonatomic,strong)QXRoomSettingModel *roomReport;
|
||||
/// 飘屏开关
|
||||
@property (nonatomic,strong)QXRoomSettingModel *drifPop;
|
||||
/// 发送红包
|
||||
@property (nonatomic,strong)QXRoomSettingModel *redBag;
|
||||
|
||||
|
||||
/// 主持列表
|
||||
@property (nonatomic,strong)QXDirectListView *directView;
|
||||
/// 调音台
|
||||
@property (nonatomic,strong)QXSingerConfigView *singerConifgView;
|
||||
///
|
||||
@property (nonatomic,strong)QXRoomWelcomeView *welcomeView;
|
||||
|
||||
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomSettingView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubiews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubiews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, self.width, ScaleWidth(407)+kSafeAreaBottom)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.topView = [[UIView alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-16*2, ScaleWidth(54))];
|
||||
UIImageView *topicBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_topic_bg"]];
|
||||
topicBgImageView.frame = self.topView.bounds;
|
||||
[self.topView addSubview:topicBgImageView];
|
||||
UIButton *sendTopic = [[UIButton alloc] initWithFrame:CGRectMake(self.topView.width - 120-ScaleWidth(23), self.topView.height-ScaleWidth(13)-15, 120, 15)];
|
||||
[sendTopic setImage:[UIImage imageNamed:@"arrowRight"] forState:(UIControlStateNormal)];
|
||||
[sendTopic setTitle:QXText(@"立即发送头条") forState:(UIControlStateNormal)];
|
||||
sendTopic.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[sendTopic setTitleColor:QXConfig.textColor forState:(UIControlStateNormal)];
|
||||
[sendTopic qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleRight) imageTitleSpace:2];
|
||||
[self.topView addSubview:sendTopic];
|
||||
sendTopic.userInteractionEnabled = NO;
|
||||
[self.bgView addSubview:self.topView];
|
||||
MJWeakSelf
|
||||
[self.topView addTapBlock:^(id _Nonnull obj) {
|
||||
[weakSelf hide];
|
||||
if (weakSelf.delegate && [self.delegate respondsToSelector:@selector(didClickHeadLine)]) {
|
||||
[weakSelf.delegate didClickHeadLine];
|
||||
}
|
||||
}];
|
||||
|
||||
self.bottomBgView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topView.bottom+4, self.width, self.bgView.height-self.topView.bottom-4)];
|
||||
self.bottomBgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bottomBgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self.bgView addSubview:self.bottomBgView];
|
||||
|
||||
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
|
||||
|
||||
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, self.width, self.bottomBgView.height-10) style:(UITableViewStyleGrouped)];
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = ScaleWidth(54)+5;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.scrollEnabled = NO;
|
||||
[self.bottomBgView addSubview:self.tableView];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)setRoomModel:(QXRoomModel *)roomModel{
|
||||
_roomModel = roomModel;
|
||||
/// 排麦
|
||||
if (self.roomModel.room_info.room_up_pit_type.intValue == 1) {
|
||||
self.roomOrderMic.isSelected = NO;
|
||||
}else{
|
||||
self.roomOrderMic.isSelected = YES;
|
||||
}
|
||||
BOOL isEffectsCLose = [[NSUserDefaults standardUserDefaults] boolForKey:kEffectsCLose];
|
||||
BOOL isDrifPopCLose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifPop];
|
||||
self.roomEffects.isSelected = isEffectsCLose;
|
||||
self.drifPop.isSelected = isDrifPopCLose;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
// isUpSeat true 麦上 false 麦下
|
||||
-(void)updateRole:(QXRoomRoleType)roleType isUpSeat:(BOOL)isUpSeat{
|
||||
NSArray *roomTypeArr;
|
||||
NSArray *toolsArr;
|
||||
NSArray *moreArr;
|
||||
switch (roleType) {
|
||||
// 主持
|
||||
case QXRoomRoleTypeCompere:{
|
||||
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4 || self.roomModel.room_info.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 2) {
|
||||
// toolsArr = @[self.roomSubsidy,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
/// 暂时不需要房间补贴
|
||||
toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
|
||||
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
|
||||
}else{
|
||||
// toolsArr = @[self.roomSubsidy,self.roomMessage,self.roomOrderMic,self.roomBgMusic,self.roomBgImage];
|
||||
/// 暂时不需要房间补贴
|
||||
toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
|
||||
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
|
||||
}
|
||||
|
||||
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
|
||||
}
|
||||
break;
|
||||
case QXRoomRoleTypeAudience:{
|
||||
// 观众 更多操作 不区分麦上麦下
|
||||
roomTypeArr = @[];
|
||||
toolsArr = @[];
|
||||
moreArr = @[self.redBag,self.roomVoiceSet,self.roomEffects,self.drifPop,self.roomReport];
|
||||
self.titles = @[QXText(@"更多操作")];
|
||||
}
|
||||
break;
|
||||
case QXRoomRoleTypeOwner:{
|
||||
/// 房主 全量 不区分麦上麦下
|
||||
// if (isUpSeat) {
|
||||
|
||||
// }else{
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
// }
|
||||
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4 || self.roomModel.room_info.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 2) {
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
/// 暂时不需要房间补贴
|
||||
toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
}else{
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgMusic,self.roomBgImage];
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
/// 暂时不需要房间补贴
|
||||
toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
}
|
||||
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
|
||||
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
|
||||
// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend];
|
||||
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
|
||||
}
|
||||
break;
|
||||
case QXRoomRoleTypeManager:{
|
||||
/// 管理员 除去设置管理外,展示所有功能, 不区分麦上麦下
|
||||
// if (isUpSeat) {
|
||||
|
||||
// }else{
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
// }
|
||||
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4 || self.roomModel.room_info.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 2) {
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
/// 暂时不需要房间补贴
|
||||
toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
}else{
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgMusic,self.roomBgImage];
|
||||
// toolsArr = @[self.roomSubsidy,self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
/// 暂时不需要房间补贴
|
||||
toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage];
|
||||
}
|
||||
// roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend];
|
||||
roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend];
|
||||
moreArr = @[self.redBag,self.roomVoiceSet,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport];
|
||||
self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
self.dataDict = @{
|
||||
QXText(@"房间类型"):roomTypeArr,
|
||||
QXText(@"常用工具"):toolsArr,
|
||||
QXText(@"更多操作"):moreArr
|
||||
};
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.titles.count;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return 1;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSettingCell *cell = [QXRoomSettingCell cellWithTableView:tableView];
|
||||
NSArray *arr = self.dataDict[self.titles[indexPath.section]];
|
||||
cell.dataArray = arr;
|
||||
cell.roomId = self.roomModel.room_info.room_id;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 44)];
|
||||
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, SCREEN_WIDTH-32, 44)];
|
||||
label.font = [UIFont boldSystemFontOfSize:16];
|
||||
label.textColor = RGB16(0x333333);
|
||||
label.text = self.titles [section];
|
||||
[headerView addSubview:label];
|
||||
return headerView;
|
||||
}
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
return 44;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.01;
|
||||
}
|
||||
|
||||
-(void)didClickSetModel:(QXRoomSettingModel *)model{
|
||||
[self hide];
|
||||
if (model.type == QXRoomSettingTypeRoomVoiceSet) {
|
||||
[self.singerConifgView showInView:KEYWINDOW];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeRoomLeave) {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
[[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeRoomCompere) {
|
||||
self.directView.roomId = self.roomModel.room_info.room_id;
|
||||
[self.directView showInView:self.viewController.view];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeRoomWelcome) {
|
||||
// MJWeakSelf
|
||||
/// 房间欢迎语 暂时注销
|
||||
// self.welcomeView.roomId = self.roomModel.room_info.room_id;
|
||||
// self.welcomeView.setIntroduceBlock = ^(NSString * _Nonnull introduce) {
|
||||
// weakSelf.roomModel.room_info.room_intro = introduce;
|
||||
// };
|
||||
// [self.welcomeView showInView:self.viewController.view];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeRoomTypeAuction || model.type == QXRoomSettingTypeRoomTypeSing || model.type == QXRoomSettingTypeRoomTypeBoy || model.type == QXRoomSettingTypeRoomTypeGirl || model.type == QXRoomSettingTypeRoomTypeFriend || model.type == QXRoomSettingTypeRoomTypeFunny) {
|
||||
self.alertView.message = [NSString stringWithFormat:@"您确定要修改为%@房吗?",model.name];
|
||||
[[QXGlobal shareGlobal] showView:self.alertView controller:self.viewController popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
MJWeakSelf
|
||||
self.alertView.commitBlock = ^{
|
||||
[weakSelf changeRoomType:model.type];
|
||||
};
|
||||
return;
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickSetModel:)]) {
|
||||
[self.delegate didClickSetModel:model];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)changeRoomType:(QXRoomSettingType)roomType{
|
||||
NSString *type = @"";
|
||||
if (roomType == QXRoomSettingTypeRoomTypeAuction) {
|
||||
type = @"2";
|
||||
}else if (roomType == QXRoomSettingTypeRoomTypeSing) {
|
||||
type = @"1";
|
||||
}else if (roomType == QXRoomSettingTypeRoomTypeBoy) {
|
||||
type = @"3";
|
||||
}else if (roomType == QXRoomSettingTypeRoomTypeGirl) {
|
||||
type = @"4";
|
||||
}else if (roomType == QXRoomSettingTypeRoomTypeFriend) {
|
||||
type = @"7";
|
||||
}else if (roomType == QXRoomSettingTypeRoomTypeFunny) {
|
||||
type = @"8";
|
||||
}
|
||||
[QXMineNetwork changeRoomTypeWithRoomId:self.roomModel.room_info.room_id type:type successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(407)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(QXRoomSettingModel *)roomTypeSing{
|
||||
if (!_roomTypeSing) {
|
||||
_roomTypeSing = [[QXRoomSettingModel alloc] init];
|
||||
_roomTypeSing.name = QXText(@"点唱");
|
||||
_roomTypeSing.type = QXRoomSettingTypeRoomTypeSing;
|
||||
_roomTypeSing.icon = @"room_set_room_type_sing";
|
||||
}
|
||||
return _roomTypeSing;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomTypeAuction{
|
||||
if (!_roomTypeAuction) {
|
||||
_roomTypeAuction = [[QXRoomSettingModel alloc] init];
|
||||
_roomTypeAuction.name = QXText(@"拍卖");
|
||||
_roomTypeAuction.type = QXRoomSettingTypeRoomTypeAuction;
|
||||
_roomTypeAuction.icon = @"room_set_room_type_auction";
|
||||
}
|
||||
return _roomTypeAuction;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomTypeBoy{
|
||||
if (!_roomTypeBoy) {
|
||||
_roomTypeBoy = [[QXRoomSettingModel alloc] init];
|
||||
_roomTypeBoy.name = QXText(@"男神");
|
||||
_roomTypeBoy.type = QXRoomSettingTypeRoomTypeBoy;
|
||||
_roomTypeBoy.icon = @"room_set_room_type_boy";
|
||||
}
|
||||
return _roomTypeBoy;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomTypeGirl{
|
||||
if (!_roomTypeGirl) {
|
||||
_roomTypeGirl = [[QXRoomSettingModel alloc] init];
|
||||
_roomTypeGirl.name = QXText(@"女神");
|
||||
_roomTypeGirl.type = QXRoomSettingTypeRoomTypeGirl;
|
||||
_roomTypeGirl.icon = @"room_set_room_type_girl";
|
||||
}
|
||||
return _roomTypeGirl;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomTypeFriend{
|
||||
if (!_roomTypeFriend) {
|
||||
_roomTypeFriend = [[QXRoomSettingModel alloc] init];
|
||||
_roomTypeFriend.name = QXText(@"互娱");
|
||||
_roomTypeFriend.type = QXRoomSettingTypeRoomTypeFriend;
|
||||
_roomTypeFriend.icon = @"room_set_room_type_friend";
|
||||
}
|
||||
return _roomTypeFriend;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomTypeFunny{
|
||||
if (!_roomTypeFunny) {
|
||||
_roomTypeFunny = [[QXRoomSettingModel alloc] init];
|
||||
_roomTypeFunny.name = QXText(@"交友");
|
||||
_roomTypeFunny.type = QXRoomSettingTypeRoomTypeFunny;
|
||||
_roomTypeFunny.icon = @"room_set_room_type_funny";
|
||||
}
|
||||
return _roomTypeFunny;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomSubsidy{
|
||||
if (!_roomSubsidy) {
|
||||
_roomSubsidy = [[QXRoomSettingModel alloc] init];
|
||||
_roomSubsidy.name = QXText(@"房间补贴");
|
||||
_roomSubsidy.type = QXRoomSettingTypeRoomSubsidy;
|
||||
_roomSubsidy.icon = @"room_set_room_subsidy";
|
||||
}
|
||||
return _roomSubsidy;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomCompere{
|
||||
if (!_roomCompere) {
|
||||
_roomCompere = [[QXRoomSettingModel alloc] init];
|
||||
_roomCompere.name = QXText(@"主持设置");
|
||||
_roomCompere.type = QXRoomSettingTypeRoomCompere;
|
||||
_roomCompere.icon = @"room_set_room_compere";
|
||||
}
|
||||
return _roomCompere;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomMessage{
|
||||
if (!_roomMessage) {
|
||||
_roomMessage = [[QXRoomSettingModel alloc] init];
|
||||
_roomMessage.name = QXText(@"清空消息");
|
||||
_roomMessage.type = QXRoomSettingTypeRoomClearMessage;
|
||||
_roomMessage.icon = @"room_set_room_message";
|
||||
}
|
||||
return _roomMessage;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomOrderMic{
|
||||
if (!_roomOrderMic) {
|
||||
_roomOrderMic = [[QXRoomSettingModel alloc] init];
|
||||
_roomOrderMic.name = QXText(@"排麦模式");
|
||||
_roomOrderMic.selName = QXText(@"排麦模式");
|
||||
_roomOrderMic.type = QXRoomSettingTypeRoomOrderMic;
|
||||
_roomOrderMic.icon = @"room_set_room_orderMic";
|
||||
_roomOrderMic.selIcon = @"room_set_room_orderMic_free";
|
||||
}
|
||||
return _roomOrderMic;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomBgMusic{
|
||||
if (!_roomBgMusic) {
|
||||
_roomBgMusic = [[QXRoomSettingModel alloc] init];
|
||||
_roomBgMusic.name = QXText(@"背景音乐");
|
||||
_roomBgMusic.type = QXRoomSettingTypeRoomBgMusic;
|
||||
_roomBgMusic.icon = @"room_set_room_bg_music";
|
||||
}
|
||||
return _roomBgMusic;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomBgImage{
|
||||
if (!_roomBgImage) {
|
||||
_roomBgImage = [[QXRoomSettingModel alloc] init];
|
||||
_roomBgImage.name = QXText(@"背景图片");
|
||||
_roomBgImage.type = QXRoomSettingTypeRoomBgImage;
|
||||
_roomBgImage.icon = @"room_set_room_bg_image";
|
||||
}
|
||||
return _roomBgImage;
|
||||
}
|
||||
|
||||
|
||||
-(QXRoomSettingModel *)roomLeave{
|
||||
if (!_roomLeave) {
|
||||
_roomLeave = [[QXRoomSettingModel alloc] init];
|
||||
_roomLeave.name = QXText(@"离开房间");
|
||||
_roomLeave.type = QXRoomSettingTypeRoomLeave;
|
||||
_roomLeave.icon = @"room_set_room_leave";
|
||||
}
|
||||
return _roomLeave;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomShare{
|
||||
if (!_roomShare) {
|
||||
_roomShare = [[QXRoomSettingModel alloc] init];
|
||||
_roomShare.name = QXText(@"分享房间");
|
||||
_roomShare.type = QXRoomSettingTypeRoomShare;
|
||||
_roomShare.icon = @"room_set_room_share";
|
||||
}
|
||||
return _roomShare;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomVoiceSet{
|
||||
if (!_roomVoiceSet) {
|
||||
_roomVoiceSet = [[QXRoomSettingModel alloc] init];
|
||||
_roomVoiceSet.name = QXText(@"调音台");
|
||||
_roomVoiceSet.type = QXRoomSettingTypeRoomVoiceSet;
|
||||
_roomVoiceSet.icon = @"room_set_room_voice";
|
||||
}
|
||||
return _roomVoiceSet;
|
||||
}
|
||||
|
||||
-(QXRoomSettingModel *)roomSetting{
|
||||
if (!_roomSetting) {
|
||||
_roomSetting = [[QXRoomSettingModel alloc] init];
|
||||
_roomSetting.name = QXText(@"房间设置");
|
||||
_roomSetting.type = QXRoomSettingTypeRoomSetting;
|
||||
_roomSetting.icon = @"room_set_room_setting";
|
||||
}
|
||||
return _roomSetting;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomEffects{
|
||||
if (!_roomEffects) {
|
||||
_roomEffects = [[QXRoomSettingModel alloc] init];
|
||||
_roomEffects.name = QXText(@"关闭特效");
|
||||
_roomEffects.selName = QXText(@"开启特效");
|
||||
_roomEffects.type = QXRoomSettingTypeRoomCloseEffects;
|
||||
_roomEffects.icon = @"room_set_room_effects_off";
|
||||
_roomEffects.selIcon = @"room_set_room_effects_on";
|
||||
}
|
||||
return _roomEffects;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomWelcome{
|
||||
if (!_roomWelcome) {
|
||||
_roomWelcome = [[QXRoomSettingModel alloc] init];
|
||||
_roomWelcome.name = QXText(@"欢迎语");
|
||||
_roomWelcome.type = QXRoomSettingTypeRoomWelcome;
|
||||
_roomWelcome.icon = @"room_set_room_welcome";
|
||||
}
|
||||
return _roomWelcome;
|
||||
}
|
||||
-(QXRoomSettingModel *)roomReport{
|
||||
if (!_roomReport) {
|
||||
_roomReport = [[QXRoomSettingModel alloc] init];
|
||||
_roomReport.name = QXText(@"举报");
|
||||
_roomReport.type = QXRoomSettingTypeRoomReport;
|
||||
_roomReport.icon = @"room_set_room_report";
|
||||
}
|
||||
return _roomReport;
|
||||
}
|
||||
-(QXRoomSettingModel *)drifPop{
|
||||
if (!_drifPop) {
|
||||
_drifPop = [[QXRoomSettingModel alloc] init];
|
||||
_drifPop.name = QXText(@"关闭飘屏");
|
||||
_drifPop.selName = QXText(@"开启飘屏");
|
||||
_drifPop.type = QXRoomSettingTypeDrifPop;
|
||||
_drifPop.icon = @"room_set_drif_pop_off";
|
||||
_drifPop.selIcon = @"room_set_drif_pop_on";
|
||||
}
|
||||
return _drifPop;
|
||||
}
|
||||
-(QXRoomSettingModel *)redBag{
|
||||
if (!_redBag) {
|
||||
_redBag = [[QXRoomSettingModel alloc] init];
|
||||
_redBag.icon = @"room_set_room_send_redbag";
|
||||
_redBag.name = QXText(@"发红包");
|
||||
_redBag.type = QXRoomSettingTypeSendRedBag;
|
||||
}
|
||||
return _redBag;
|
||||
}
|
||||
-(QXDirectListView *)directView{
|
||||
if (!_directView) {
|
||||
_directView = [[QXDirectListView alloc] init];
|
||||
}
|
||||
return _directView;
|
||||
}
|
||||
-(QXSingerConfigView *)singerConifgView{
|
||||
if (!_singerConifgView) {
|
||||
_singerConifgView = [[QXSingerConfigView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
}
|
||||
return _singerConifgView;
|
||||
}
|
||||
-(QXRoomWelcomeView *)welcomeView{
|
||||
if (!_welcomeView) {
|
||||
_welcomeView = [[QXRoomWelcomeView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
}
|
||||
return _welcomeView;
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomSettingCell
|
||||
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString* cellId = @"QXRoomSettingCell";
|
||||
QXRoomSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[QXRoomSettingCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(ScaleWidth(50), ScaleWidth(54)+5);
|
||||
layout.minimumLineSpacing = 6;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXRoomSettingSubCell class] forCellWithReuseIdentifier:@"QXRoomSettingSubCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.top.equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setDataArray:(NSArray *)dataArray{
|
||||
_dataArray = dataArray;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSettingSubCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXRoomSettingSubCell" forIndexPath:indexPath];
|
||||
QXRoomSettingModel *model = self.dataArray[indexPath.row];
|
||||
cell.model = model;
|
||||
cell.roomId = self.roomId;
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSettingModel *model = self.dataArray[indexPath.row];
|
||||
if (model.type == QXRoomSettingTypeRoomCloseEffects) {
|
||||
model.isSelected = !model.isSelected;
|
||||
QXRoomSettingSubCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
|
||||
cell.model = model;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:model.isSelected forKey:kEffectsCLose];
|
||||
[[QXGiftPlayerManager shareManager] openOrCloseEffectViewWith:!model.isSelected];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeDrifPop) {
|
||||
model.isSelected = !model.isSelected;
|
||||
QXRoomSettingSubCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
|
||||
cell.model = model;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:model.isSelected forKey:kIsCloseDrifPop];
|
||||
[[QXGiftDriftView shareView] drifPopIsClose:model.isSelected];
|
||||
[[QXMeetActivityDriftView shareView] drifPopIsClose:model.isSelected];
|
||||
[[QXDrifRoomHourRankView shareView] drifPopIsClose:model.isSelected];
|
||||
[[QXRedPacketDriftView shareView] drifPopIsClose:model.isSelected];
|
||||
return;
|
||||
}
|
||||
if (model.type == QXRoomSettingTypeRoomOrderMic) {
|
||||
[QXMineNetwork roomChangeUpSeatTypeWithRoomId:self.roomId successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
// model.isSelected = !model.isSelected;
|
||||
// QXRoomSettingSubCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
|
||||
// cell.model = model;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
return;
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickSetModel:)]) {
|
||||
[self.delegate didClickSetModel:model];
|
||||
}
|
||||
// if (model.selIcon.length > 0) {
|
||||
// model.isSelected = !model.isSelected;
|
||||
// QXRoomSettingSubCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
|
||||
// cell.model = model;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation QXRoomSettingSubCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.contentView.backgroundColor = [UIColor clearColor];
|
||||
self.imageView = [[UIImageView alloc] init];
|
||||
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self.contentView addSubview:self.imageView];
|
||||
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.equalTo(self);
|
||||
make.height.equalTo(self.imageView.mas_height);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.titleLabel.textColor = RGB16(0x666666);
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.equalTo(self);
|
||||
make.top.equalTo(self.imageView.mas_bottom).offset(5);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXRoomSettingModel *)model{
|
||||
_model = model;
|
||||
if (model.isSelected) {
|
||||
if ([model.selIcon hasPrefix:@"https"] || [model.selIcon hasPrefix:@"http"]) {
|
||||
[self.imageView sd_setImageWithURL:[NSURL URLWithString:model.selIcon]];
|
||||
}else{
|
||||
self.imageView.image = [UIImage imageNamed:model.selIcon];
|
||||
}
|
||||
self.titleLabel.text = model.selName;
|
||||
}else{
|
||||
if ([model.icon hasPrefix:@"https"] || [model.icon hasPrefix:@"http"]) {
|
||||
[self.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon]];
|
||||
}else{
|
||||
self.imageView.image = [UIImage imageNamed:model.icon];
|
||||
}
|
||||
self.titleLabel.text = model.name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomSettingModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
18
QXLive/Room(房间)/View/设置/QXRoomWelcomeView.h
Normal file
18
QXLive/Room(房间)/View/设置/QXRoomWelcomeView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXRoomWelcomeView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomWelcomeView : UIView
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,copy)void(^setIntroduceBlock)(NSString*introduce);
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
117
QXLive/Room(房间)/View/设置/QXRoomWelcomeView.m
Normal file
117
QXLive/Room(房间)/View/设置/QXRoomWelcomeView.m
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// QXRoomWelcomeView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/23.
|
||||
//
|
||||
|
||||
#import "QXRoomWelcomeView.h"
|
||||
#import "QXTextView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomWelcomeView()<UIGestureRecognizerDelegate,UITextViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIButton *saveBtn;
|
||||
@property (nonatomic,strong)QXTextView *textView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomWelcomeView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 348)];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.bgView addRoundedCornersWithRadius:16];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 100, 24)];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.text = @"编辑房间公告";
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.saveBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bgView.width-40-6, 6, 40, 40)];
|
||||
[self.saveBtn setTitle:QXText (@"保存") forState:(UIControlStateNormal)];
|
||||
self.saveBtn.titleLabel.font = [UIFont systemFontOfSize:14];;
|
||||
[self.saveBtn setTitleColor:RGB16(0xFF8ACC) forState:(UIControlStateNormal)];
|
||||
[self.saveBtn addTarget:self action:@selector(saveAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.bgView addSubview:self.saveBtn];
|
||||
|
||||
self.textView = [[QXTextView alloc] initWithFrame:CGRectMake(16, self.titleLabel.bottom+12, self.bgView.width-32, 150)];
|
||||
self.textView.delegate = self;
|
||||
[self.textView addRoundedCornersWithRadius:11];
|
||||
self.textView.font = [UIFont systemFontOfSize:12];
|
||||
self.textView.textColor = QXConfig.textColor;
|
||||
self.textView.placehoulder = QXText(@"本房间严禁刷屏,禁止非法广告宣传,禁止引战地域黑,语言攻击等");
|
||||
self.textView.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.bgView addSubview:self.textView];
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
-(void)textViewDidBeginEditing:(UITextView *)textView{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-348-200;
|
||||
}];
|
||||
}
|
||||
-(void)textViewDidEndEditing:(UITextView *)textView{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-348;
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
|
||||
if( [ @"\n" isEqualToString: text]){
|
||||
|
||||
//你的响应方法
|
||||
[textView endEditing:YES];
|
||||
return NO;
|
||||
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
-(void)saveAction{
|
||||
MJWeakSelf
|
||||
if (![self.textView.text isExist]) {
|
||||
showToast(@"请输入房间公告");
|
||||
return;
|
||||
}
|
||||
[QXMineNetwork roomInfoEditWithRoomId:self.roomId room_name:@"" room_cover:@"" room_intro:self.textView.text room_background:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (self.setIntroduceBlock) {
|
||||
self.setIntroduceBlock(weakSelf.textView.text);
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-348;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
28
QXLive/Room(房间)/View/设置/QXSingerConfigView.h
Normal file
28
QXLive/Room(房间)/View/设置/QXSingerConfigView.h
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// QXSingerConfigView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/19.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRoomSettingView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSingerConfigView : UIView
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
@interface QXSliser : UISlider
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface QXVoiceEffectCell : UICollectionViewCell
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *effectImageView;
|
||||
@property (nonatomic,strong)UIView *coverView;
|
||||
@property (nonatomic,strong)UIButton *selecteBtn;
|
||||
@property (nonatomic,strong)QXRoomSettingModel *model;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
396
QXLive/Room(房间)/View/设置/QXSingerConfigView.m
Normal file
396
QXLive/Room(房间)/View/设置/QXSingerConfigView.m
Normal file
@@ -0,0 +1,396 @@
|
||||
//
|
||||
// QXSingerConfigView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/19.
|
||||
//
|
||||
|
||||
#import "QXSingerConfigView.h"
|
||||
#import "QXAgoraEngine.h"
|
||||
@interface QXSingerConfigView()<UIGestureRecognizerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
|
||||
|
||||
@property (nonatomic,strong)UILabel *earLabel;
|
||||
@property (nonatomic,strong)UISwitch *earSwitch;
|
||||
|
||||
|
||||
@property (nonatomic,strong)UILabel *voiceLabel;
|
||||
@property (nonatomic,strong)QXSliser *voiceSliser;
|
||||
|
||||
@property (nonatomic,strong)UILabel *musicLabel;
|
||||
@property (nonatomic,strong)QXSliser *musicSliser;
|
||||
|
||||
/// 混响
|
||||
@property (nonatomic,strong)UILabel *effectLabel;
|
||||
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSArray *audioArray;
|
||||
@property (nonatomic,strong)QXRoomSettingModel *audioModel;
|
||||
|
||||
///变声
|
||||
@property (nonatomic,strong)UILabel *voiceEffectLabel;
|
||||
@property (nonatomic,strong)NSArray *voiceArray;
|
||||
@end
|
||||
@implementation QXSingerConfigView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 350)];
|
||||
// self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithFrame:self.bgView.bounds];
|
||||
self.bgImageView.image = [UIImage imageNamed:@"room_sound_bg"];
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, 118, 24)];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:16];
|
||||
self.titleLabel.textColor = RGB16A(0xffffff, 1);
|
||||
self.titleLabel.text = QXText(@"调音台");
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
self.earSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(self.bgView.width-16-45, 0, 45, 45)];
|
||||
self.earSwitch.centerY = self.titleLabel.centerY;
|
||||
self.earSwitch.onTintColor = QXConfig.themeColor;
|
||||
self.earSwitch.thumbTintColor = [UIColor whiteColor];
|
||||
self.earSwitch.backgroundColor = RGB16A(0xffffff, 0.2);
|
||||
[self.earSwitch addRoundedCornersWithRadius:15];
|
||||
[self.earSwitch addTarget:self action:@selector(earAction:) forControlEvents:(UIControlEventValueChanged)];
|
||||
self.earSwitch.on = [[QXAgoraEngine sharedEngine] ktv_GetErfan];
|
||||
[self.bgView addSubview:self.earSwitch];
|
||||
|
||||
self.earLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.earSwitch.left-100, 0, 90, 20)];
|
||||
self.earLabel.centerY = self.titleLabel.centerY;
|
||||
self.earLabel.textAlignment = NSTextAlignmentRight;
|
||||
self.earLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.earLabel.text = QXText(@"耳返");
|
||||
self.earLabel.textColor = RGB16A(0xffffff, 1);
|
||||
[self.bgView addSubview:self.earLabel];
|
||||
|
||||
self.voiceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleLabel.left, self.titleLabel.bottom+20, 160, 21)];
|
||||
self.voiceLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.voiceLabel.text = QXText(@"人声 100%");
|
||||
self.voiceLabel.textColor = RGB16A(0xffffff, 1);
|
||||
[self.bgView addSubview:self.voiceLabel];
|
||||
|
||||
self.voiceSliser = [[QXSliser alloc] initWithFrame:CGRectMake(self.titleLabel.left, self.voiceLabel.bottom+8, self.bgView.width-32, 18)];
|
||||
self.voiceSliser.minimumValue = 0;
|
||||
self.voiceSliser.maximumValue = 100;
|
||||
self.voiceSliser.value = 100;
|
||||
self.voiceSliser.minimumTrackTintColor = QXConfig.themeColor;
|
||||
self.voiceSliser.maximumTrackTintColor = [UIColor whiteColor];
|
||||
self.voiceSliser.thumbTintColor = QXConfig.themeColor;
|
||||
[self.voiceSliser addTarget:self action:@selector(voiceSliderAction:) forControlEvents:(UIControlEventValueChanged)];
|
||||
[self.bgView addSubview:self.voiceSliser];
|
||||
|
||||
|
||||
self.musicLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleLabel.left, self.voiceSliser.bottom+12, 160, 21)];
|
||||
self.musicLabel.font = [UIFont systemFontOfSize:14];
|
||||
float musicVolume = [[QXAgoraEngine sharedEngine] ktv_GetBanzouVolume];
|
||||
self.musicLabel.text = [NSString stringWithFormat:@"%@ %d",QXText(@"伴奏"),(int)musicVolume*100];
|
||||
|
||||
self.musicLabel.textColor = RGB16A(0xffffff, 1);
|
||||
[self.bgView addSubview:self.musicLabel];
|
||||
|
||||
self.musicSliser = [[QXSliser alloc] initWithFrame:CGRectMake(self.titleLabel.left, self.musicLabel.bottom+8, self.bgView.width-32, 18)];
|
||||
[self.musicSliser addTarget:self action:@selector(musicSliderAction:) forControlEvents:(UIControlEventValueChanged)];
|
||||
self.musicSliser.minimumValue = 0;
|
||||
self.musicSliser.maximumValue = 100;
|
||||
self.musicSliser.value = musicVolume*100;
|
||||
self.musicSliser.minimumTrackTintColor = QXConfig.themeColor;
|
||||
self.musicSliser.maximumTrackTintColor = [UIColor whiteColor];
|
||||
self.musicSliser.thumbTintColor = QXConfig.themeColor;
|
||||
[self.bgView addSubview:self.musicSliser];
|
||||
|
||||
|
||||
self.effectLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 160, 21)];
|
||||
self.effectLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.effectLabel.text = [NSString stringWithFormat:@"%@",QXText(@"混响")];
|
||||
self.effectLabel.textColor = RGB16A(0xffffff, 1);
|
||||
// [self.bgView addSubview:self.effectLabel];
|
||||
|
||||
QXRoomSettingModel *md1 = [[QXRoomSettingModel alloc] init];
|
||||
md1.name = @"原声";
|
||||
md1.icon = @"room_voice_normal";
|
||||
|
||||
|
||||
QXRoomSettingModel *md2 = [[QXRoomSettingModel alloc] init];
|
||||
md2.name = @"唱片机";
|
||||
md2.icon = @"room_voice_record";
|
||||
|
||||
QXRoomSettingModel *md3 = [[QXRoomSettingModel alloc] init];
|
||||
md3.name = @"三维声音";
|
||||
md3.icon = @"room_voice_3d";
|
||||
|
||||
|
||||
QXRoomSettingModel *md4 = [[QXRoomSettingModel alloc] init];
|
||||
md4.name = @"虚拟环绕";
|
||||
md4.icon = @"room_voice_cycle";
|
||||
|
||||
QXRoomSettingModel *md5 = [[QXRoomSettingModel alloc] init];
|
||||
md5.name = @"KTV";
|
||||
md5.icon = @"room_voice_ktv";
|
||||
|
||||
// self.audioArray = @[md1,md2,md3,md4,md5];
|
||||
self.audioArray = @[md1,md2,md5];
|
||||
|
||||
|
||||
QXRoomSettingModel *md6 = [[QXRoomSettingModel alloc] init];
|
||||
md6.name = @"老人";
|
||||
md6.icon = @"room_voice_oldman";
|
||||
|
||||
|
||||
QXRoomSettingModel *md7 = [[QXRoomSettingModel alloc] init];
|
||||
md7.name = @"猪八戒";
|
||||
md7.icon = @"room_voice_pig";
|
||||
|
||||
QXRoomSettingModel *md8 = [[QXRoomSettingModel alloc] init];
|
||||
md8.name = @"三维声音";
|
||||
md8.icon = @"room_voice_uncal";
|
||||
|
||||
QXRoomSettingModel *md9 = [[QXRoomSettingModel alloc] init];
|
||||
md9.name = @"姐姐";
|
||||
md9.icon = @"room_voice_sister";
|
||||
|
||||
QXRoomSettingModel *md10 = [[QXRoomSettingModel alloc] init];
|
||||
md10.name = @"女孩";
|
||||
md10.icon = @"room_voice_girl";
|
||||
|
||||
self.voiceArray = @[md6,md7,md8,md9,md10];
|
||||
|
||||
// CGFloat itemWidth = (SCREEN_WIDTH - 11*4-32)/5.0;
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
// layout.itemSize = CGSizeMake(itemWidth, ScaleWidth(54));
|
||||
layout.minimumLineSpacing = 11;
|
||||
layout.minimumInteritemSpacing = 11;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.headerReferenceSize = CGSizeMake(SCREEN_WIDTH, 30);
|
||||
layout.footerReferenceSize = CGSizeZero;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.musicSliser.bottom+12, self.bgView.width , self.bgView.height-self.effectLabel.bottom-12) collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXVoiceEffectCell class] forCellWithReuseIdentifier:@"QXVoiceEffectCell"];
|
||||
[self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionReusableView"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.showsVerticalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
|
||||
self.voiceEffectLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 160, 30)];
|
||||
self.voiceEffectLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.voiceEffectLabel.text = [NSString stringWithFormat:@"%@",QXText(@"混响")];
|
||||
self.voiceEffectLabel.textColor = RGB16A(0xffffff, 1);
|
||||
|
||||
}
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (section == 0) {
|
||||
return self.audioArray.count;
|
||||
}else{
|
||||
return self.voiceArray.count;
|
||||
}
|
||||
}
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXVoiceEffectCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXVoiceEffectCell" forIndexPath:indexPath];
|
||||
if (indexPath.section == 0) {
|
||||
cell.model = self.audioArray[indexPath.row];
|
||||
}else{
|
||||
cell.model = self.voiceArray[indexPath.row];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
|
||||
UICollectionReusableView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"UICollectionReusableView" forIndexPath:indexPath];
|
||||
if (indexPath.section == 0) {
|
||||
[header addSubview:self.effectLabel];
|
||||
}else{
|
||||
[header addSubview:self.voiceEffectLabel];
|
||||
}
|
||||
return header;
|
||||
}
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
CGFloat itemWidth = (SCREEN_WIDTH - 11*4-32)/5.0;
|
||||
if (indexPath.section == 0) {
|
||||
return CGSizeMake(itemWidth, ScaleWidth(54));;
|
||||
}
|
||||
return CGSizeMake(itemWidth, ScaleWidth(69));;
|
||||
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSettingModel *model;
|
||||
if (indexPath.section == 0) {
|
||||
if (indexPath.row == 0) {
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetOff];
|
||||
}else if(indexPath.row == 1){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetRoomAcousPhonograph];
|
||||
}else if(indexPath.row == 2){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetRoomAcous3DVoice];
|
||||
}else if(indexPath.row == 3){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetRoomAcousVirtualSurroundSound];
|
||||
}else if(indexPath.row == 4){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetRoomAcousticsKTV];
|
||||
}
|
||||
model = self.audioArray[indexPath.row];
|
||||
}else{
|
||||
if (indexPath.row == 0) {
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetVoiceChangerEffectOldMan];
|
||||
}else if(indexPath.row == 1){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetVoiceChangerEffectPigKin];
|
||||
}else if(indexPath.row == 2){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetVoiceChangerEffectUncle];
|
||||
}else if(indexPath.row == 3){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetVoiceChangerEffectBoy];
|
||||
}else if(indexPath.row == 4){
|
||||
[[QXAgoraEngine sharedEngine].agoraKit setAudioEffectPreset:AgoraAudioEffectPresetVoiceChangerEffectGirl];
|
||||
}
|
||||
model = self.voiceArray[indexPath.row];
|
||||
}
|
||||
|
||||
if (model.isSelected) {
|
||||
return;
|
||||
}else{
|
||||
self.audioModel.isSelected = NO;
|
||||
model.isSelected = YES;
|
||||
self.audioModel = model;
|
||||
}
|
||||
[collectionView reloadData];
|
||||
// self.audioModel
|
||||
}
|
||||
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)earAction:(UISwitch*)sender{
|
||||
if (sender.isOn) {
|
||||
[sender setOn:YES animated:YES];
|
||||
[[QXAgoraEngine sharedEngine] ktv_SetErfan:YES];
|
||||
}else{
|
||||
[sender setOn:NO animated:YES];
|
||||
[[QXAgoraEngine sharedEngine] ktv_SetErfan:NO];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)voiceSliderAction:(QXSliser*)slider{
|
||||
self.voiceLabel.text = [NSString stringWithFormat:@"人声 %d%%",(int)slider.value];
|
||||
[[QXAgoraEngine sharedEngine] ktv_SetRenshengVolume:slider.value/100.0];
|
||||
}
|
||||
|
||||
-(void)musicSliderAction:(QXSliser*)slider{
|
||||
self.musicLabel.text = [NSString stringWithFormat:@"伴奏 %d%%",(int)slider.value];
|
||||
[[QXAgoraEngine sharedEngine] ktv_SetBanzouVolume:slider.value/100.0];
|
||||
}
|
||||
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-350;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXSliser
|
||||
|
||||
-(CGRect)trackRectForBounds:(CGRect)bounds{
|
||||
bounds.size.height=self.frame.size.height;
|
||||
self.layer.cornerRadius = self.frame.size.height/2;
|
||||
bounds.origin.y = 0;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
//-(CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value{
|
||||
// bounds.origin.x = -5;
|
||||
// return bounds;
|
||||
//}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXVoiceEffectCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setModel:(QXRoomSettingModel *)model{
|
||||
_model = model;
|
||||
self.titleLabel.text = model.name;
|
||||
self.effectImageView.image = [UIImage imageNamed:model.icon];
|
||||
self.selecteBtn.hidden = !model.isSelected;
|
||||
self.coverView.hidden = model.isSelected;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.textColor = [UIColor whiteColor];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
self.effectImageView = [[UIImageView alloc] init];
|
||||
// self.effectImageView.backgroundColor = [UIColor redColor];
|
||||
[self.effectImageView addRoundedCornersWithRadius:12];
|
||||
[self.contentView addSubview:self.effectImageView];
|
||||
[self.effectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.bottom.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
|
||||
self.coverView = [[UIView alloc] init];
|
||||
self.coverView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.2];
|
||||
[self.coverView addRoundedCornersWithRadius:12];
|
||||
[self.contentView addSubview:self.coverView];
|
||||
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.bottom.equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
self.selecteBtn = [[UIButton alloc] init];
|
||||
// [self.selecteBtn setImage:[UIImage imageNamed:@"login_agreement_nor"] forState:(UIControlStateNormal)];
|
||||
[self.selecteBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateNormal)];
|
||||
self.selecteBtn.userInteractionEnabled = NO;
|
||||
[self.contentView addSubview:self.selecteBtn];
|
||||
[self.selecteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(20, 20));
|
||||
make.top.mas_equalTo(4);
|
||||
make.right.mas_equalTo(-4);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user