增加换肤功能
This commit is contained in:
19
QXLive/Mine(音域)/Controller/我的房间/QXCreateRoomViewController.h
Executable file
19
QXLive/Mine(音域)/Controller/我的房间/QXCreateRoomViewController.h
Executable file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXMyRoomViewController.h
|
||||
// SoundRiver
|
||||
//
|
||||
// Created by mac on 2020/7/17.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
#import "QXRoomModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXCreateRoomViewController : QXBaseViewController
|
||||
@property (nonatomic,copy)void(^createSucceessBlock)(void);
|
||||
@property (nonatomic,copy)void(^editSucceessBlock)(QXRoomModel *roomModel);
|
||||
@property (nonatomic,strong)QXRoomModel *roomModel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
461
QXLive/Mine(音域)/Controller/我的房间/QXCreateRoomViewController.m
Executable file
461
QXLive/Mine(音域)/Controller/我的房间/QXCreateRoomViewController.m
Executable file
@@ -0,0 +1,461 @@
|
||||
|
||||
//
|
||||
// QXMyRoomViewController.m
|
||||
// SoundRiver
|
||||
//
|
||||
// Created by mac on 2020/7/17.
|
||||
//
|
||||
|
||||
#import "QXCreateRoomViewController.h"
|
||||
#import "TZImagePickerController/TZImagePickerController.h"
|
||||
#import "QXTextView.h"
|
||||
#import "QXOSSManager.h"
|
||||
#import "UIImage+QX.h"
|
||||
#import "QXTimer.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXCreateRoomViewController ()<UITextFieldDelegate>
|
||||
@property (nonatomic,strong) UILabel *roomCoverLabel;
|
||||
@property (nonatomic,strong) UIImageView *roomImageView;
|
||||
@property (nonatomic,strong) UIButton *roomImageBtn;
|
||||
@property (nonatomic,strong) NSString* roomCoverUrl;
|
||||
|
||||
@property (nonatomic,strong) UILabel *roomNameLabel;
|
||||
@property (nonatomic,strong) UIView *textFieldbgView;
|
||||
@property (nonatomic,strong) UITextField *textField;
|
||||
@property (nonatomic,strong) UIButton *deleteBtn;
|
||||
@property (nonatomic,strong) UIButton *randomBtn;
|
||||
|
||||
|
||||
@property (nonatomic,strong) UILabel *roomNoticeLabel;
|
||||
@property (nonatomic,strong) UIView *noticeBgView;
|
||||
@property (nonatomic,strong) QXTextView *textView;
|
||||
|
||||
@property (nonatomic,strong) UILabel *warningLabel;
|
||||
@property (nonatomic,strong) UIButton *submitBtn; ///< 提交
|
||||
@property (nonatomic,assign)NSInteger selectedIndex;
|
||||
|
||||
@property (nonatomic,strong) QXTimer *timer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXCreateRoomViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"创建房间");
|
||||
}
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
|
||||
|
||||
- (void)initSubViews {
|
||||
self.selectedIndex = -1;
|
||||
[self.view addSubview:self.roomImageView];
|
||||
[self.view addSubview:self.roomImageBtn];
|
||||
[self.view addSubview:self.roomCoverLabel];
|
||||
[self.roomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.size.mas_equalTo(CGSizeMake(120, 120));
|
||||
make.top.mas_equalTo(NavContentHeight+20);
|
||||
}];
|
||||
[self.roomImageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.top.equalTo(self.roomImageView);
|
||||
}];
|
||||
[self.roomCoverLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.roomImageView.mas_bottom).offset(10);
|
||||
make.centerX.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
|
||||
[self.view addSubview:self.roomNameLabel];
|
||||
[self.view addSubview:self.textFieldbgView];
|
||||
[self.view addSubview:self.randomBtn];
|
||||
[self.textFieldbgView addSubview:self.textField];
|
||||
[self.textFieldbgView addSubview:self.deleteBtn];
|
||||
[self.roomNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.roomCoverLabel.mas_bottom).offset(12);
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
[self.randomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
make.height.mas_equalTo(44);
|
||||
make.top.equalTo(self.roomNameLabel.mas_bottom).offset(12);
|
||||
make.width.mas_equalTo(65);
|
||||
}];
|
||||
[self.textFieldbgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.roomNameLabel.mas_bottom).offset(12);
|
||||
make.left.equalTo(self.roomNameLabel);
|
||||
make.right.equalTo(self.randomBtn.mas_left).offset(-8);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.textFieldbgView);
|
||||
make.right.equalTo(self.textFieldbgView).offset(-12);
|
||||
make.width.mas_equalTo(44);
|
||||
}];
|
||||
[self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.textFieldbgView);
|
||||
make.left.equalTo(self.textFieldbgView).offset(12);
|
||||
make.right.equalTo(self.deleteBtn.mas_left).offset(-4);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
[self.view addSubview:self.roomNoticeLabel];
|
||||
[self.view addSubview:self.noticeBgView];
|
||||
[self.noticeBgView addSubview:self.textView];
|
||||
[self.roomNoticeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.textFieldbgView.mas_bottom).offset(12);
|
||||
make.left.equalTo(self.roomNameLabel);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
[self.noticeBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.roomNoticeLabel.mas_bottom).offset(12);
|
||||
make.left.equalTo(self.roomNameLabel);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.height.mas_equalTo(150);
|
||||
}];
|
||||
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.mas_equalTo(5);
|
||||
make.right.mas_equalTo(-5);
|
||||
make.bottom.mas_equalTo(-5);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
[self.view addSubview:self.submitBtn];
|
||||
[self.submitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(38);
|
||||
make.right.equalTo(self.view).offset(-38);
|
||||
make.height.mas_equalTo(42);
|
||||
make.bottom.equalTo(self.view).offset(-kSafeAreaBottom);
|
||||
}];
|
||||
|
||||
|
||||
[self.warningLabel sizeToFit];
|
||||
self.warningLabel.frame = CGRectMake((SCREEN_WIDTH-self.warningLabel.width)/2.0-8, SCREEN_HEIGHT-kSafeAreaBottom-42-8-21, self.warningLabel.width+16, 21);
|
||||
[self.view addSubview:self.warningLabel];
|
||||
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:3 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
|
||||
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
self->_warningLabel.y = SCREEN_HEIGHT-kSafeAreaBottom-42-8-21+5;
|
||||
} completion:^(BOOL finished) {
|
||||
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
self->_warningLabel.y = SCREEN_HEIGHT-kSafeAreaBottom-42-8-21-5;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
}];
|
||||
}];
|
||||
if (self.roomModel) {
|
||||
[self.roomImageView sd_setImageWithURL:[NSURL URLWithString:self.roomModel.room_info.room_cover]];
|
||||
self.textField.text = self.roomModel.room_info.room_name;
|
||||
self.textView.text = self.roomModel.room_info.room_intro;
|
||||
if ([self.roomModel.room_info.room_intro isExist]) {
|
||||
self.textView.placehoulderLabel.hidden = YES;
|
||||
}
|
||||
self.roomCoverUrl = self.roomModel.room_info.room_cover;
|
||||
[self.submitBtn setTitle:QXText(@"确认修改") forState:UIControlStateNormal];
|
||||
self.warningLabel.hidden = YES;
|
||||
self.navigationItem.title = QXText(@"编辑房间");
|
||||
}else{
|
||||
[self.submitBtn setTitle:QXText(@"提交审核") forState:UIControlStateNormal];
|
||||
self.warningLabel.hidden = NO;
|
||||
[self getRandomName];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void)getRandomName{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork getRoomRandomNameSuccessBlock:^(NSString * _Nonnull name) {
|
||||
weakSelf.textField.text = name;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
#pragma mark - Request Data
|
||||
- (void)requestCreateMineRoomData {
|
||||
if (self.textField.text.length == 0) {
|
||||
showToast(@"请输入房间名称");
|
||||
return;
|
||||
}
|
||||
if (self.roomCoverUrl.length == 0) {
|
||||
showToast(@"请上传房间封面");
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
if (self.roomModel) {
|
||||
[QXMineNetwork roomInfoEditWithRoomId:self.roomModel.room_info.room_id room_name:self.textField.text room_cover:self.roomCoverUrl room_intro:self.textView.text room_background:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.editSucceessBlock) {
|
||||
weakSelf.roomModel.room_info.room_name = weakSelf.textField.text;
|
||||
weakSelf.roomModel.room_info.room_cover = weakSelf.roomCoverUrl;
|
||||
weakSelf.roomModel.room_info.room_intro = weakSelf.textView.text;
|
||||
weakSelf.editSucceessBlock(weakSelf.roomModel);
|
||||
}
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg)
|
||||
}];
|
||||
}else{
|
||||
[QXMineNetwork createRoomWithName:self.textField.text room_cover:self.roomCoverUrl room_intro:self.textView.text successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.createSucceessBlock) {
|
||||
weakSelf.createSucceessBlock();
|
||||
}
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
} 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 = YES;
|
||||
imagePickerVc.cropRect = CGRectMake(0, (SCREEN_HEIGHT-SCREEN_WIDTH)/2, SCREEN_WIDTH, SCREEN_WIDTH);
|
||||
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 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.view];
|
||||
[[QXOSSManager sharedInstance] uploadFile:files withObjectKey:fileNames isAsync:YES complete:^(NSArray<NSString *> *names, UploadImageState state) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[QXProjectTools hideLoadingInView:self.view];
|
||||
});
|
||||
if (state == UploadImageSuccess) {
|
||||
NSString *fileName = [names lastObject];
|
||||
NSString *fileUrl =[NSString stringWithFormat:@"https://%@.%@/%@",OSS_BUCKET_NAME,OSSEndPoint,fileName];
|
||||
weakSelf.roomCoverUrl = fileUrl;
|
||||
[weakSelf.roomImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:[UIImage imageNamed:@"mine_room_cover_add"]];
|
||||
}else{
|
||||
QXLOG(@"文件上传失败,请重新尝试");
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
/// 跳转到我的直播间
|
||||
- (void)jumpMineLivingRoomWith:(int64_t)roomId {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
return [self.textField resignFirstResponder];
|
||||
}
|
||||
- (void)textFieldDidChanged:(UITextField *)textField {
|
||||
if (textField.text.length > 20) {
|
||||
[textField deleteBackward];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Btn Click
|
||||
//- (void)onChatBtnClick:(UIButton *)btn {
|
||||
// [MineAnalyticsManager DataBuryingClickInitRoomSelectTag:@{@"tag":@"chat"}];
|
||||
// btn.selected = !btn.selected;
|
||||
// self.gameBtn.selected = NO;
|
||||
//}
|
||||
//- (void)onKSongBtnClick:(UIButton *)btn {
|
||||
// [MineAnalyticsManager DataBuryingClickInitRoomSelectTag:@{@"tag":@"song"}];
|
||||
// btn.selected = !btn.selected;
|
||||
// self.chatBtn.selected = NO;
|
||||
//}
|
||||
//-(void)typeBtnClick:(UIButton*)sender{
|
||||
// self.typeBtn.selected = !self.typeBtn.selected;
|
||||
// sender.selected = !sender.selected;
|
||||
// self.typeBtn = sender;
|
||||
//}
|
||||
- (void)onSubmitBtnClick:(UIButton *)btn {
|
||||
|
||||
[self requestCreateMineRoomData];
|
||||
}
|
||||
-(void)clearAllAction{
|
||||
self.textField.text = @"";
|
||||
}
|
||||
|
||||
#pragma mark - Getter
|
||||
- (UILabel *)roomNameLabel {
|
||||
if (!_roomNameLabel) {
|
||||
_roomNameLabel = [[UILabel alloc] init];
|
||||
_roomNameLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
_roomNameLabel.textColor = QXConfig.textColor;
|
||||
_roomNameLabel.text = QXText(@"房间标题");
|
||||
}
|
||||
return _roomNameLabel;
|
||||
}
|
||||
-(UIView *)textFieldbgView{
|
||||
if (!_textFieldbgView) {
|
||||
_textFieldbgView = [[UIView alloc] init];
|
||||
_textFieldbgView.layer.masksToBounds = YES;
|
||||
_textFieldbgView.layer.cornerRadius = 11;
|
||||
_textFieldbgView.backgroundColor = [UIColor colorWithHexString:@"#EFF2F8"];
|
||||
}
|
||||
return _textFieldbgView;
|
||||
}
|
||||
-(UIButton *)deleteBtn{
|
||||
if (!_deleteBtn) {
|
||||
_deleteBtn = [[UIButton alloc] init];
|
||||
[_deleteBtn setImage:[UIImage imageNamed:@"Plus Circle"] forState:(UIControlStateNormal)];
|
||||
[_deleteBtn addTarget:self action:@selector(clearAllAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
}
|
||||
return _deleteBtn;
|
||||
}
|
||||
- (UITextField *)textField {
|
||||
if (!_textField) {
|
||||
_textField = [[UITextField alloc] init];
|
||||
_textField.layer.cornerRadius = 5;
|
||||
_textField.layer.masksToBounds = YES;
|
||||
_textField.font = [UIFont boldSystemFontOfSize:16];
|
||||
_textField.textColor = QXConfig.textColor;
|
||||
_textField.placeholder = QXText(@"请输入房间标题");
|
||||
_textField.textAlignment = NSTextAlignmentLeft;
|
||||
_textField.delegate = self;
|
||||
_textField.returnKeyType = UIReturnKeyDone;
|
||||
[_textField addTarget:self action:@selector(textFieldDidChanged:) forControlEvents:UIControlEventEditingChanged];
|
||||
}
|
||||
return _textField;
|
||||
}
|
||||
|
||||
- (UILabel *)roomNoticeLabel {
|
||||
if (!_roomNoticeLabel) {
|
||||
_roomNoticeLabel = [[UILabel alloc] init];
|
||||
_roomNoticeLabel.font = [UIFont boldSystemFontOfSize:15];
|
||||
_roomNoticeLabel.textColor = QXConfig.textColor;
|
||||
_roomNoticeLabel.text = QXText(@"房间公告");
|
||||
}
|
||||
return _roomNoticeLabel;
|
||||
}
|
||||
|
||||
-(UILabel *)roomCoverLabel{
|
||||
if (!_roomCoverLabel) {
|
||||
_roomCoverLabel = [[UILabel alloc] init];
|
||||
_roomCoverLabel.font = [UIFont systemFontOfSize:14];
|
||||
_roomCoverLabel.textColor = QXConfig.textColor;
|
||||
_roomCoverLabel.text = QXText(@"房间封面");
|
||||
}
|
||||
return _roomCoverLabel;
|
||||
}
|
||||
-(UIImageView *)roomImageView{
|
||||
if (!_roomImageView) {
|
||||
_roomImageView = [[UIImageView alloc] init];
|
||||
_roomImageView.image = [UIImage imageNamed:@"mine_room_cover_add"];
|
||||
_roomImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_roomImageView.clipsToBounds = YES;
|
||||
}
|
||||
return _roomImageView;
|
||||
}
|
||||
-(UIView *)noticeBgView{
|
||||
if (!_noticeBgView) {
|
||||
_noticeBgView = [[UIView alloc] init];
|
||||
_noticeBgView.backgroundColor = RGB16(0xEFF2F8);
|
||||
[_noticeBgView addRoundedCornersWithRadius:11];
|
||||
}
|
||||
return _noticeBgView;
|
||||
}
|
||||
-(QXTextView *)textView{
|
||||
if (!_textView) {
|
||||
_textView = [[QXTextView alloc] init];
|
||||
_textView.font = [UIFont systemFontOfSize:12];
|
||||
_textView.textColor = QXConfig.textColor;
|
||||
_textView.placehoulder = QXText(@"本房间严禁刷屏,禁止非法广告宣传,禁止引战地域黑,语言攻击等");
|
||||
_textView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
|
||||
-(UIButton *)roomImageBtn{
|
||||
if (!_roomImageBtn) {
|
||||
_roomImageBtn = [[UIButton alloc] init];
|
||||
[_roomImageBtn addTarget:self action:@selector(selectAlbumPhoto) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
}
|
||||
return _roomImageBtn;
|
||||
}
|
||||
-(UIButton *)randomBtn{
|
||||
if (!_randomBtn) {
|
||||
_randomBtn = [[UIButton alloc] init];
|
||||
[_randomBtn setTitle:QXText(@"随机名称") forState:(UIControlStateNormal)];
|
||||
_randomBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[_randomBtn setTitleColor:RGB16(0xFF8ACC) forState:(UIControlStateNormal)];
|
||||
[_randomBtn addTarget:self action:@selector(getRandomName) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _randomBtn;
|
||||
}
|
||||
- (UIButton *)submitBtn {
|
||||
if (!_submitBtn) {
|
||||
_submitBtn = [[UIButton alloc] init];
|
||||
[_submitBtn setTitle:QXText(@"提交审核") forState:UIControlStateNormal];
|
||||
_submitBtn.titleLabel.font = [UIFont systemFontOfSize:15];
|
||||
[_submitBtn setTitleColor:QXConfig.textColor forState:UIControlStateNormal];
|
||||
_submitBtn.backgroundColor = QXConfig.themeColor;
|
||||
_submitBtn.layer.masksToBounds = YES;
|
||||
_submitBtn.layer.cornerRadius = 21;
|
||||
[_submitBtn addTarget:self action:@selector(onSubmitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _submitBtn;
|
||||
}
|
||||
|
||||
-(UILabel *)warningLabel{
|
||||
if (!_warningLabel) {
|
||||
_warningLabel = [[UILabel alloc] init];
|
||||
_warningLabel.backgroundColor = RGB16(0x333333);
|
||||
[_warningLabel addRoundedCornersWithRadius:3];
|
||||
_warningLabel.textColor = UIColor.whiteColor;
|
||||
_warningLabel.font = [UIFont systemFontOfSize:11];
|
||||
_warningLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_warningLabel.text = QXText(@"创建房间需要审核,通过后可开启直播");
|
||||
}
|
||||
return _warningLabel;
|
||||
}
|
||||
@end
|
||||
17
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomSubViewController.h
Normal file
17
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomSubViewController.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXMyRoomSubViewController.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/5.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JXCategoryView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@interface QXMyRoomSubViewController : UIViewController<JXCategoryListContentViewDelegate>
|
||||
/// 0 我创建的 1 我主持的 2我管理的 3 我关注的
|
||||
@property(nonatomic,assign)NSInteger type;
|
||||
-(void)refreshRoom;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
285
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomSubViewController.m
Normal file
285
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomSubViewController.m
Normal file
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// QXMyRoomSubViewController.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/5.
|
||||
//
|
||||
|
||||
#import "QXMyRoomSubViewController.h"
|
||||
#import "QXHomeRoomCell.h"
|
||||
#import "QXMyRoomListCell.h"
|
||||
#import "QXMyHistoryHeaderView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXMyRoomViewController.h"
|
||||
#import "QXMyCpRoomListCell.h"
|
||||
|
||||
@interface QXMyRoomSubViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,QXMyHistoryHeaderViewDelegate>
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *historyArray;
|
||||
@property (nonatomic,strong)NSMutableArray *cpRoomArray;
|
||||
|
||||
|
||||
@property (nonatomic,strong) QXMyHistoryHeaderView *headerView;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXMyRoomSubViewController
|
||||
-(UIView *)listView{
|
||||
return self.view;
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self initSubview];
|
||||
}
|
||||
-(void)initSubview{
|
||||
self.page = 1;
|
||||
[self.view addSubview:self.collectionView];
|
||||
[self getRoomList];
|
||||
}
|
||||
-(void)refreshRoom{
|
||||
self.page = 1;
|
||||
[self getRoomList];
|
||||
}
|
||||
-(void) getRoomList{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork myRoomListWithType:[NSString stringWithFormat:@"%ld",self.type] page:self.page successBlock:^(NSArray<QXRoomListModel *> * _Nonnull list) {
|
||||
|
||||
if (self.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
}
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
if (list.count == 0) {
|
||||
if (weakSelf.type == 0) {
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
}else{
|
||||
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}
|
||||
}else{
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
[weakSelf.collectionView.mj_header endRefreshing];
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.collectionView.mj_header endRefreshing];
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
}];
|
||||
if (self.type == 0) {
|
||||
[QXMineNetwork myHistoryRoomWithPage:self.page successBlock:^(NSArray<QXMyRoomHistory *> * _Nonnull list) {
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.historyArray removeAllObjects];
|
||||
}
|
||||
[weakSelf.historyArray addObjectsFromArray:list];
|
||||
if (list.count == 0) {
|
||||
weakSelf.collectionView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
}
|
||||
[weakSelf.collectionView.mj_header endRefreshing];
|
||||
[weakSelf.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.collectionView.mj_header endRefreshing];
|
||||
[weakSelf.collectionView.mj_footer endRefreshing];
|
||||
}];
|
||||
|
||||
[QXMineNetwork getMyCpRoomListSuccessBlock:^(NSArray<QXRoomListCpModel *> * _Nonnull list) {
|
||||
[weakSelf.cpRoomArray removeAllObjects];
|
||||
[weakSelf.cpRoomArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadSections:[NSIndexSet indexSetWithIndex:1]];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
// [self.dataArray addObject:@""];
|
||||
// [self.dataArray addObject:@""];
|
||||
// [self.dataArray addObject:@""];
|
||||
// [self.dataArray addObject:@""];
|
||||
// [self.historyArray addObject:@""];
|
||||
}
|
||||
#pragma mark - QXMyHistoryHeaderViewDelegate
|
||||
-(void)didClickClearBtn{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork clearRoomHistorySuccessBlock:^(NSArray<QXRoomListCpModel *> * _Nonnull list) {
|
||||
[self.historyArray removeAllObjects];
|
||||
[self.collectionView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
- (void)requestDeleteAllFootprintData {
|
||||
|
||||
}
|
||||
#pragma mark - UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
if (self.type == 0) {
|
||||
return 3;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (self.type == 0) {
|
||||
if (section == 0) {
|
||||
return self.dataArray.count;;
|
||||
}else if (section == 1) {
|
||||
return self.cpRoomArray.count;;
|
||||
}else{
|
||||
return self.historyArray.count;
|
||||
}
|
||||
}
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.type == 0) {
|
||||
if (indexPath.section == 0) {
|
||||
QXMyRoomListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMyRoomListCell" forIndexPath:indexPath];
|
||||
cell.type = self.type;
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}else if (indexPath.section == 1) {
|
||||
QXMyCpRoomListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMyCpRoomListCell" forIndexPath:indexPath];
|
||||
cell.type = self.type;
|
||||
cell.cpModel = self.cpRoomArray[indexPath.row];
|
||||
return cell;
|
||||
}else{
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.historyModel = self.historyArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}else if (self.type == 1){
|
||||
QXMyRoomListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMyRoomListCell" forIndexPath:indexPath];
|
||||
cell.type = self.type;
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}else{
|
||||
QXHomeRoomCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXHomeRoomCell" forIndexPath:indexPath];
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.type == 0) {
|
||||
if (indexPath.section == 0 || indexPath.section == 1) {
|
||||
return CGSizeMake(SCREEN_WIDTH, 143);
|
||||
}else{
|
||||
return CGSizeMake((SCREEN_WIDTH-15*3-1)/2.0, (SCREEN_WIDTH-15*3-1)/2.0);
|
||||
}
|
||||
}else if (self.type == 1){
|
||||
return CGSizeMake(SCREEN_WIDTH, 143);
|
||||
}else{
|
||||
return CGSizeMake((SCREEN_WIDTH-15*3-1)/2.0, (SCREEN_WIDTH-15*3-1)/2.0);
|
||||
}
|
||||
}
|
||||
-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.type == 0) {
|
||||
if (indexPath.section == 2) {
|
||||
if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
|
||||
UICollectionReusableView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXMyHistoryHeaderView" forIndexPath:indexPath];
|
||||
[header addSubview:self.headerView];
|
||||
return header;
|
||||
}else{
|
||||
return nil;
|
||||
}
|
||||
}else{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section{
|
||||
if (self.type == 0) {
|
||||
if (section == 2) {
|
||||
return CGSizeMake(SCREEN_WIDTH, 46);
|
||||
}else{
|
||||
return CGSizeZero;
|
||||
}
|
||||
}else{
|
||||
return CGSizeZero;
|
||||
}
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
if (self.type == 0) {
|
||||
if (indexPath.section == 0) {
|
||||
QXRoomListModel *model = self.dataArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}else if (indexPath.section == 1) {
|
||||
QXRoomListCpModel *cpRoom = self.cpRoomArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:cpRoom.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}else{
|
||||
QXMyRoomHistory *model = self.historyArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
}else if (self.type == 1){
|
||||
QXRoomListModel *model = self.dataArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}else{
|
||||
QXRoomListModel *model = self.dataArray[indexPath.row];
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
}
|
||||
|
||||
-(UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumLineSpacing = 15;
|
||||
layout.minimumInteritemSpacing = 15;
|
||||
layout.sectionInset = UIEdgeInsetsMake(8, 15, 8, 15);
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-kSafeAreaTop-kSafeAreaBottom-44*2) collectionViewLayout:layout];
|
||||
_collectionView.delegate = self;
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.backgroundColor = [UIColor clearColor];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXHomeRoomCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXHomeRoomCell"];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXMyRoomListCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXMyRoomListCell"];
|
||||
[_collectionView registerNib:[UINib nibWithNibName:@"QXMyCpRoomListCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXMyCpRoomListCell"];
|
||||
[_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"QXMyHistoryHeaderView"];
|
||||
MJWeakSelf
|
||||
_collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
[weakSelf getRoomList];
|
||||
}];
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)historyArray{
|
||||
if (!_historyArray) {
|
||||
_historyArray = [NSMutableArray array];
|
||||
}
|
||||
return _historyArray;
|
||||
}
|
||||
-(NSMutableArray *)cpRoomArray{
|
||||
if (!_cpRoomArray) {
|
||||
_cpRoomArray = [NSMutableArray array];
|
||||
}
|
||||
return _cpRoomArray;
|
||||
}
|
||||
|
||||
-(QXMyHistoryHeaderView *)headerView{
|
||||
if (!_headerView) {
|
||||
_headerView = [[QXMyHistoryHeaderView alloc] init];
|
||||
_headerView.delegate = self;
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
17
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomViewController.h
Normal file
17
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomViewController.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXMyRoomViewController.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/5.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXMyRoomViewController : QXBaseViewController
|
||||
/// 1已实名 0 未实名
|
||||
@property (nonatomic,assign)BOOL auth_status;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
116
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomViewController.m
Normal file
116
QXLive/Mine(音域)/Controller/我的房间/QXMyRoomViewController.m
Normal file
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// QXMyRoomViewController.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/5.
|
||||
//
|
||||
|
||||
#import "QXMyRoomViewController.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXMyRoomSubViewController.h"
|
||||
#import "QXCreateRoomViewController.h"
|
||||
|
||||
@interface QXMyRoomViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
||||
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
||||
@property (nonatomic,strong)NSArray *titles;
|
||||
@property (nonatomic,strong)QXMyRoomSubViewController *myRoomVC;
|
||||
@end
|
||||
|
||||
@implementation QXMyRoomViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
[super viewDidAppear:animated];
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = @"我的房间";
|
||||
UIButton*createBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
||||
[createBtn setImage:[UIImage imageNamed:@"mine_add"] forState:(UIControlStateNormal)];
|
||||
createBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing;
|
||||
[createBtn addTarget:self action:@selector(createAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:createBtn];
|
||||
}
|
||||
|
||||
-(void)createAction{
|
||||
MJWeakSelf
|
||||
QXCreateRoomViewController *vc = [[QXCreateRoomViewController alloc] init];
|
||||
vc.createSucceessBlock = ^{
|
||||
[weakSelf.myRoomVC refreshRoom];
|
||||
};
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.titles = @[@"我创建的",@"我主持的",@"我管理的",@"我关注的"];
|
||||
self.listVCArray = [NSMutableArray array];
|
||||
self.categoryView = [[JXCategoryTitleView alloc] init];
|
||||
self.categoryView.frame = CGRectMake(15, kSafeAreaTop+44, SCREEN_WIDTH-30, 44);
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titles = self.titles;
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
|
||||
self.categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
|
||||
self.categoryView.cellWidth = 70;
|
||||
self.categoryView.contentEdgeInsetLeft = 0;
|
||||
self.categoryView.cellSpacing = 0;
|
||||
// self.categoryView.titleLabelZoomScale = 1.1;
|
||||
self.categoryView.titleLabelZoomEnabled = YES;
|
||||
self.categoryView.titleFont = [UIFont systemFontOfSize:12];
|
||||
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
|
||||
self.categoryView.averageCellSpacingEnabled = NO;
|
||||
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
||||
indicatorView.indicatorImageViewSize = CGSizeMake(58, 8);
|
||||
indicatorView.verticalMargin = 11;
|
||||
self.categoryView.indicators = @[indicatorView];
|
||||
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
|
||||
self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom);
|
||||
[self.view addSubview:self.categoryView];
|
||||
[self.view addSubview:self.containerView];
|
||||
self.categoryView.listContainer = self.containerView;
|
||||
[self requestMineUserInfoData];
|
||||
}
|
||||
- (void)requestMineUserInfoData {
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
||||
return self.titles.count;
|
||||
}
|
||||
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXMyRoomSubViewController *vc = [[QXMyRoomSubViewController alloc] init];
|
||||
vc.type = index;
|
||||
if (index == 0) {
|
||||
self.myRoomVC = vc;
|
||||
}
|
||||
return vc;
|
||||
}
|
||||
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
18
QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.h
Normal file
18
QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXRoomDetailViewController.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/5.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomDetailViewController : QXBaseViewController
|
||||
/// 0我创建的 1我主持的
|
||||
@property (nonatomic,assign)NSInteger type;
|
||||
@property (nonatomic,strong)NSString* room_id;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
243
QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.m
Normal file
243
QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.m
Normal file
@@ -0,0 +1,243 @@
|
||||
//
|
||||
// QXRoomDetailViewController.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/3/5.
|
||||
//
|
||||
|
||||
#import "QXRoomDetailViewController.h"
|
||||
#import "QXRoomDetailHeaderView.h"
|
||||
#import "QXRoomWaterListCell.h"
|
||||
#import "NSArray+YYAdd.h"
|
||||
#import "NSString+YYAdd.h"
|
||||
#import "QXRoomSubsidyViewController.h"
|
||||
#import "QXRoomWaterModel.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomDetailViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSMutableDictionary *dict;
|
||||
@property (nonatomic,strong)NSMutableArray *allDateArray;
|
||||
@property (nonatomic,strong)QXRoomDetailHeaderView *headerView;
|
||||
@property (nonatomic,strong)NSString* startTime;
|
||||
@property (nonatomic,strong)NSString* endTime;
|
||||
@end
|
||||
|
||||
@implementation QXRoomDetailViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
}
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
[super viewDidAppear:animated];
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = @"房间明细";
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.page = 1;
|
||||
UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 55, 44)];
|
||||
[rightBtn setTitle:@"补贴明细" forState:(UIControlStateNormal)];
|
||||
rightBtn.titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
[rightBtn setTitleColor:[UIColor colorWithHexString:@"#FF8ACC"] forState:(UIControlStateNormal)];
|
||||
[rightBtn addTarget:self action:@selector(detailAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
|
||||
[self.view addSubview:self.headerView];
|
||||
[self.view addSubview:self.tableView];
|
||||
self.dict = [NSMutableDictionary dictionary];
|
||||
[self getPriceData];
|
||||
}
|
||||
-(void)detailAction{
|
||||
QXRoomSubsidyViewController *vc = [[QXRoomSubsidyViewController alloc] init];
|
||||
vc.room_id = self.room_id;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(void)getPriceData{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomWaterDetailWithRoomId:self.room_id start_time:self.startTime end_time:self.endTime page:self.page type:self.type successBlock:^(QXRoomDetailModel * _Nonnull model) {
|
||||
weakSelf.headerView.model = model;
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dict removeAllObjects];
|
||||
}
|
||||
|
||||
NSArray *arr = [weakSelf.dict allKeys];
|
||||
for (QXRoomWaterModel*md in model.list) {
|
||||
BOOL haveKey = NO;
|
||||
for (NSString *s in arr) {
|
||||
if ([s isEqualToString:md.time]) {
|
||||
haveKey = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!haveKey) {
|
||||
// key没有包含某个日期,设置日期的流水json
|
||||
[weakSelf.dict setObject:[md yy_modelToJSONString] forKey:md.time];
|
||||
}else{
|
||||
//有包含某个日期,先取出之前已有的数据
|
||||
NSString *json = [weakSelf.dict objectForKey:md.time];
|
||||
//转换为模型
|
||||
QXRoomWaterModel *m = [QXRoomWaterModel yy_modelWithJSON:json];
|
||||
//旧数据
|
||||
NSMutableArray *newArr = [NSMutableArray arrayWithArray:m.list];
|
||||
//添加新数据
|
||||
[newArr addObjectsFromArray:md.list];
|
||||
//赋值于历史数据
|
||||
m.list = newArr;
|
||||
// 重新设置键值对
|
||||
[weakSelf.dict setObject:[m yy_modelToJSONString] forKey:md.time];
|
||||
}
|
||||
}
|
||||
NSArray *keys = [weakSelf.dict.allKeys sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
|
||||
// NSString *s1 = obj1;
|
||||
// NSString *s2 = obj2;
|
||||
NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter1 setDateFormat:@"yyyy-MM-dd"];
|
||||
NSDate *date1 = [dateFormatter1 dateFromString:obj1];
|
||||
|
||||
NSDateFormatter *dateFormatter2 = [[NSDateFormatter alloc] init];
|
||||
[dateFormatter2 setDateFormat:@"yyyy-MM-dd"];
|
||||
NSDate *date2 = [dateFormatter2 dateFromString:obj2];
|
||||
NSComparisonResult result = [date1 compare:date2];
|
||||
if (result == NSOrderedAscending) {
|
||||
return NSOrderedDescending;
|
||||
}else if (result == NSOrderedDescending){
|
||||
return NSOrderedAscending;
|
||||
}else{
|
||||
return NSOrderedSame;
|
||||
}
|
||||
}];
|
||||
self.allDateArray = [NSMutableArray arrayWithArray:keys];
|
||||
[weakSelf.tableView reloadData];
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
if (model.list.count == 0) {
|
||||
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.allDateArray.count;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
NSString *json = [self.dict objectForKey:self.allDateArray[section]];
|
||||
QXRoomWaterModel*model = [QXRoomWaterModel yy_modelWithJSON:json];
|
||||
return model.list.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomWaterListCell *cell = [QXRoomWaterListCell cellWithTableView:tableView];
|
||||
NSString *json = [self.dict objectForKey:self.allDateArray[indexPath.section]];
|
||||
//转换为数组
|
||||
QXRoomWaterModel*m = [QXRoomWaterModel yy_modelWithJSON:json];
|
||||
QXRoomWaterDetailModel *model = m.list[indexPath.row];
|
||||
cell.model = model;
|
||||
return cell;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
NSString *time = [self.allDateArray objectAtIndex:section];
|
||||
NSString *json = [self.dict objectForKey:time];
|
||||
//转换为数组
|
||||
QXRoomWaterModel*model = [QXRoomWaterModel yy_modelWithJSON:json];
|
||||
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 25)];
|
||||
header.backgroundColor = [UIColor whiteColor];
|
||||
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, 130, 25)];
|
||||
timeLabel.font = [UIFont systemFontOfSize:13];
|
||||
timeLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
timeLabel.text = time;
|
||||
[header addSubview:timeLabel];
|
||||
|
||||
UILabel *waterLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-16-130, 0, SCREEN_WIDTH-130-32, 25)];
|
||||
waterLabel.font = [UIFont systemFontOfSize:13];
|
||||
waterLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
NSString *total_earning = [NSString stringWithFormat:@"%.2f",model.total_earning];
|
||||
NSString *total_price = [NSString stringWithFormat:@"%.2f",model.total_price];
|
||||
NSString *s = [NSString stringWithFormat:@"收益 %@ 流水 %@",total_earning,total_price];
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:s];
|
||||
[attr yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:[s rangeOfString:total_earning]];
|
||||
[attr yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:[s rangeOfString:total_price]];
|
||||
// waterLabel.text = [NSString stringWithFormat:@"收益 %@ 流水 %@",model.total_earning,model.total_price];
|
||||
waterLabel.attributedText = attr;
|
||||
waterLabel.textAlignment = NSTextAlignmentRight;
|
||||
[waterLabel sizeToFit];
|
||||
waterLabel.frame = CGRectMake(SCREEN_WIDTH-16-waterLabel.size.width, 0, waterLabel.size.width, 25);
|
||||
[header addSubview:waterLabel];
|
||||
return header;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
return 25;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.01;
|
||||
}
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.headerView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.headerView.bottom) style:(UITableViewStylePlain)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.rowHeight = 65;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
_tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
MJWeakSelf
|
||||
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getPriceData];
|
||||
}];
|
||||
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getPriceData];
|
||||
}];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)allDateArray{
|
||||
if (!_allDateArray) {
|
||||
_allDateArray = [NSMutableArray array];
|
||||
}
|
||||
return _allDateArray;
|
||||
}
|
||||
-(QXRoomDetailHeaderView *)headerView{
|
||||
if (!_headerView) {
|
||||
UIImage*img = [UIImage imageNamed:@"mine_room_water_bg"];
|
||||
CGFloat height = (SCREEN_WIDTH-32)/img.size.width*img.size.height;
|
||||
_headerView = [[QXRoomDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 11+ kSafeAreaTop+44 + height)];
|
||||
MJWeakSelf
|
||||
_headerView.chooseDateBlock = ^(NSString * _Nonnull startTime, NSString * _Nonnull endTime) {
|
||||
weakSelf.startTime = startTime;
|
||||
weakSelf.endTime = endTime;
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getPriceData];
|
||||
};
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXRoomHistoryViewController.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/4/23.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomHistoryViewController : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString *room_id;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
128
QXLive/Mine(音域)/Controller/我的房间/QXRoomHistoryViewController.m
Normal file
128
QXLive/Mine(音域)/Controller/我的房间/QXRoomHistoryViewController.m
Normal file
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// QXRoomHistoryViewController.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/4/23.
|
||||
//
|
||||
|
||||
#import "QXRoomHistoryViewController.h"
|
||||
#import "QXSubsidyModel.h"
|
||||
#import "QXRoomSubsidyHistoryCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomHistoryViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)UIView *headerView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomHistoryViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.navigationItem.title = @"历史记录";
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.headerView];
|
||||
self.page = 1;
|
||||
[self getHistorySubsidy];
|
||||
}
|
||||
-(void)getHistorySubsidy{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomSubsidyHisoryWithWithRoomId:self.room_id page:self.page successBlock:^(NSArray<QXSubsidyHistoryModel *> * _Nonnull list) {
|
||||
if (self.page == 1) {
|
||||
[self.dataArray removeAllObjects];
|
||||
}
|
||||
if (list.count == 0) {
|
||||
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
showToast(msg)
|
||||
}];
|
||||
}
|
||||
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSubsidyHistoryCell *cell = [QXRoomSubsidyHistoryCell cellWithTableView:tableView];
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
//-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
// return self.headerView;
|
||||
//}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 44;
|
||||
}
|
||||
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
// return 44;
|
||||
//}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.headerView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.headerView.bottom) style:(UITableViewStylePlain)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor whiteColor];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
if (@available(iOS 15.0, *)) {
|
||||
_tableView.sectionHeaderTopPadding = 0;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
}
|
||||
MJWeakSelf
|
||||
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getHistorySubsidy];
|
||||
}];
|
||||
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getHistorySubsidy];
|
||||
}];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
-(UIView *)headerView{
|
||||
if (!_headerView) {
|
||||
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0,NavContentHeight+18 , SCREEN_WIDTH, 44)];
|
||||
[_headerView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
_headerView.backgroundColor = [UIColor whiteColor];
|
||||
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 145, 44)];
|
||||
timeLabel.text = @"时间";
|
||||
timeLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
timeLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
timeLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[_headerView addSubview:timeLabel];
|
||||
|
||||
UILabel *statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-16-50, 0, 50, 44)];
|
||||
statusLabel.text = @"状态";
|
||||
statusLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
statusLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
statusLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[_headerView addSubview:statusLabel];
|
||||
|
||||
UILabel *subsidyLabel = [[UILabel alloc] initWithFrame:CGRectMake(statusLabel.left-75, 0, 65, 44)];
|
||||
subsidyLabel.text = @"获得补贴";
|
||||
subsidyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
subsidyLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
subsidyLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[_headerView addSubview:subsidyLabel];
|
||||
|
||||
UILabel *allWaterLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.right+10, 0, subsidyLabel.left-20-timeLabel.right, 44)];
|
||||
allWaterLabel.text = @"累计流水";
|
||||
allWaterLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
allWaterLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
allWaterLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[_headerView addSubview:allWaterLabel];
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXRoomSubsidyViewController.h
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/4/23.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomSubsidyViewController : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString *room_id;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
110
QXLive/Mine(音域)/Controller/我的房间/QXRoomSubsidyViewController.m
Normal file
110
QXLive/Mine(音域)/Controller/我的房间/QXRoomSubsidyViewController.m
Normal file
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// QXRoomSubsidyViewController.m
|
||||
// IsLandVoice
|
||||
//
|
||||
// Created by 启星 on 2025/4/23.
|
||||
//
|
||||
|
||||
#import "QXRoomSubsidyViewController.h"
|
||||
#import "QXRoomHistoryViewController.h"
|
||||
#import "QXRoomSubsidyCell.h"
|
||||
#import "QXSubsidyModel.h"
|
||||
#import <WebKit/WKWebView.h>
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomSubsidyViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)QXSubsidyModel *model;
|
||||
@property (nonatomic,strong)WKWebView *webView;
|
||||
@end
|
||||
|
||||
@implementation QXRoomSubsidyViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.navigationItem.title = @"房间补贴";
|
||||
UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 55, 44)];
|
||||
[rightBtn setTitle:@"历史记录" forState:(UIControlStateNormal)];
|
||||
rightBtn.titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
[rightBtn setTitleColor:[UIColor colorWithHexString:@"#FF8ACC"] forState:(UIControlStateNormal)];
|
||||
[rightBtn addTarget:self action:@selector(detailAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.view addSubview:self.webView];
|
||||
[self getSubsidy];
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)detailAction{
|
||||
QXRoomHistoryViewController *vc = [[QXRoomHistoryViewController alloc] init];
|
||||
vc.room_id = self.room_id;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(void)getSubsidy{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomSubsidyWithRoomId:self.room_id successBlock:^(QXSubsidyModel * _Nonnull model) {
|
||||
weakSelf.model = model;
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",model.explain]];
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:url];
|
||||
[weakSelf.webView loadRequest:request];
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
if (self.model) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXRoomSubsidyCell *cell = [QXRoomSubsidyCell cellWithTableView:tableView];
|
||||
if (indexPath.row == 0) {
|
||||
cell.titleLabel.text = @"上周补贴";
|
||||
cell.model = self.model.lastweek;
|
||||
}else{
|
||||
cell.titleLabel.text = @"本周补贴";
|
||||
cell.model = self.model.thisweek;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
return 90;
|
||||
}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight+18, SCREEN_WIDTH, 190) style:(UITableViewStylePlain)];
|
||||
[_tableView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor whiteColor];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.scrollEnabled = NO;
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
-(WKWebView *)webView{
|
||||
if (!_webView) {
|
||||
_webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, self.tableView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.tableView.bottom)];
|
||||
}
|
||||
return _webView;
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user