541 lines
24 KiB
Objective-C
541 lines
24 KiB
Objective-C
//
|
|
// CreatRoomViewController.m
|
|
// DingDangApp
|
|
//
|
|
// Created by apple on 2023/6/21.
|
|
//
|
|
|
|
#import "CreatRoomViewController.h"
|
|
#import "WLBlockTableView.h"
|
|
#import "CreatRoomBgImageViewCell.h"
|
|
#import "CeratRoomTitleViewCell.h"
|
|
#import "CreatRoomCoverViewCell.h"
|
|
#import "CreatRoomTypeViewCell.h"
|
|
#import "CreatRoomNoticeViewCell.h"
|
|
#import "CreatRoomOnlyFansViewCell.h"
|
|
#import "CreatRoomCancleViewCell.h"
|
|
#import "ResourcePickerToolsObject.h"
|
|
#import "FileToolsObject.h"
|
|
#import "DDRoomRequest.h"
|
|
@interface CreatRoomViewController ()
|
|
@property (nonatomic,strong) WLBlockTableView *listView;
|
|
@property (nonatomic,strong) UIButton *cancenBtn;
|
|
@property (nonatomic,strong) NSMutableArray *dataSource;
|
|
@property (nonatomic,strong) NSMutableArray *imageBGArray;
|
|
@property (nonatomic,strong) NSMutableArray *roomTypeArray;
|
|
@property (strong, nonatomic) UIButton * sendButton;
|
|
@property (strong, nonatomic) UIButton * commitBtn;
|
|
@end
|
|
|
|
@implementation CreatRoomViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
if(self.isUpDate){
|
|
[self defaultNavTitle:@"房间设置" hideLine:YES];
|
|
}else{
|
|
[self defaultNavTitle:@"创建房间" hideLine:YES];
|
|
}
|
|
if(!self.roomInfo){
|
|
self.roomInfo = [[RoomModel alloc] init];
|
|
}
|
|
[self listView];
|
|
[self sendButton];
|
|
[self commitBtn];
|
|
[self listViewBlock];
|
|
[self initRequest];
|
|
|
|
[DDRoomRequest DD_GetRoomUserInformationWithRoomUid:[NSString stringWithFormat:@"%ld",self.adminId] success:^(RoomInfoModel * _Nonnull roomInfo, UserInfoModel * _Nonnull userInfo) {
|
|
|
|
} fail:^(NSError * _Nonnull error) {
|
|
|
|
}];
|
|
|
|
}
|
|
#pragma mark -
|
|
#pragma mark --- 网络请求
|
|
- (void)initRequest {
|
|
|
|
dispatch_group_t group = dispatch_group_create();
|
|
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
|
WeakSelf(ws);
|
|
dispatch_group_async(group, queue, ^{
|
|
[ws getRoomBgList];
|
|
});
|
|
dispatch_group_async(group, queue, ^{
|
|
[ws getRoomTypeList];
|
|
});
|
|
dispatch_group_async(group, queue, ^{
|
|
[ws getRoomAccount];
|
|
});
|
|
|
|
}
|
|
- (void)sendButtonClick{
|
|
[self.view endEditing:YES];
|
|
if([self checkSend]){
|
|
return;
|
|
}
|
|
[ToolsObject ShowSVProgressHUD:@""];
|
|
NSMutableDictionary *params =@{@"room_name":self.roomInfo.room_name,
|
|
@"room_type":self.roomInfo.room_type,
|
|
@"room_desc":self.roomInfo.room_desc,
|
|
@"wallpaper_id":self.roomInfo.wallpaper_id,
|
|
@"room_head":self.roomInfo.room_head
|
|
}.mutableCopy;
|
|
WeakSelf(ws);
|
|
|
|
/// /room/create/room
|
|
NSString *url = [DDEncryptManager dd_aesDecryptWithText:@"ChxMUvYUT7npeuVmsUNThyE/Dr+rK2bdvJQnr0QDjXo="];
|
|
[NetworkRequest requestPOST:url parameters:params block:^(BaseResponse * _Nonnull response) {
|
|
[ToolsObject DismissSVProgressHUD];
|
|
if(response.code ==200){
|
|
if(![ToolsObject IsNullWithObject:response.data]){
|
|
NSString *roomID = response.data[@"room_id"];
|
|
[ToolsObject addPopVieToText:@"创建房间成功"];
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"KNoti_UserCreatRoomRefreshKey" object:@(YES) userInfo:@{}];
|
|
if(ws.creatRoomSuccess){
|
|
ws.creatRoomSuccess(roomID);
|
|
}
|
|
[ws.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
}
|
|
}];
|
|
|
|
|
|
}
|
|
|
|
- (void)commitBtnClick{
|
|
if(!self.roomInfo ||[ToolsObject IsNullWithObject:self.roomInfo.room_id]){
|
|
[ToolsObject addPopVieToText:@"未获取到房间信息,请离开后重进"];
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
return;
|
|
}
|
|
if([self checkSend]){
|
|
return;
|
|
}
|
|
[ToolsObject ShowSVProgressHUD:@""];
|
|
NSMutableDictionary *params =@{
|
|
@"room_id":self.roomInfo.room_id,
|
|
@"room_name":self.roomInfo.room_name,
|
|
@"room_type":self.roomInfo.room_type,
|
|
@"room_desc":self.roomInfo.room_desc,
|
|
@"wallpaper_id":self.roomInfo.wallpaper_id,
|
|
@"room_head":self.roomInfo.room_head,
|
|
@"fans_can_see":@(self.roomInfo.fans_can_see)}.mutableCopy;
|
|
WeakSelf(ws);
|
|
/// /room/edit/info
|
|
NSString *url = [DDEncryptManager dd_aesDecryptWithText:@"bu2SreaUL51PfbpYIFUlCA=="];
|
|
[NetworkRequest requestPOST:url parameters:params block:^(BaseResponse * _Nonnull response) {
|
|
[ToolsObject DismissSVProgressHUD];
|
|
if(response.code ==200){
|
|
[ToolsObject addPopVieToText:@"修改成功"];
|
|
[ws.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
}];
|
|
}
|
|
- (void)requestCancleRoom{
|
|
if(!self.roomInfo ||[ToolsObject IsNullWithObject:self.roomInfo.room_id]){
|
|
[ToolsObject addPopVieToText:@"未获取到房间信息,请离开后重进"];
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
return;
|
|
}
|
|
[ToolsObject ShowSVProgressHUD:@""];
|
|
NSMutableDictionary *params =@{
|
|
@"room_id":self.roomInfo.room_id,
|
|
}.mutableCopy;
|
|
/// /room/cancel
|
|
NSString *url = [DDEncryptManager dd_aesDecryptWithText:@"5/ZGj6QKrzIhciHArsxkrQ=="];
|
|
[NetworkRequest requestPOST:url parameters:params block:^(BaseResponse * _Nonnull response) {
|
|
[ToolsObject DismissSVProgressHUD];
|
|
if(response.code ==200){
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[ToolsObject addPopVieToText:@"注销成功"];
|
|
});
|
|
// [ws.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
}];
|
|
}
|
|
- (BOOL)checkSend{
|
|
if ([ToolsObject IsNullWithObject:self.roomInfo.room_image]) {
|
|
[ToolsObject addPopVieToText:@"请选择房间背景"];
|
|
return YES;
|
|
}
|
|
|
|
if ([ToolsObject IsNullWithObject:self.roomInfo.room_name]) {
|
|
[ToolsObject addPopVieToText:@"请输入房间名称"];
|
|
return YES;
|
|
}
|
|
|
|
if ([ToolsObject IsNullWithObject:self.roomInfo.room_type]) {
|
|
[ToolsObject addPopVieToText:@"请选择房间类型"];
|
|
return YES;
|
|
}
|
|
|
|
if ([ToolsObject IsNullWithObject:self.roomInfo.room_head]) {
|
|
[ToolsObject addPopVieToText:@"请上传房间封面"];
|
|
return YES;
|
|
}
|
|
|
|
if ([ToolsObject IsNullWithObject:self.roomInfo.room_desc]) {
|
|
[ToolsObject addPopVieToText:@"请输入房间公告"];
|
|
return YES;
|
|
}
|
|
return NO;
|
|
}
|
|
- (void)chooseHomeHead{
|
|
WeakSelf(weakSelf)
|
|
[[ResourcePickerToolsObject shareIntance] getImageVideoWithIsVideo:NO WithIsImage:YES maxImagesCount:1 columnNumber:3 pushPhotoPickerVc:YES allowTakePicture:YES allowTakeVideo:NO allowPickingGif:NO imagePickerBlock:^(TZImagePickerController * _Nonnull picker, NSArray<UIImage *> * _Nonnull photos, NSArray * _Nonnull assets, BOOL isSelectOriginalPhoto, BOOL isSelectGifPhoto) {
|
|
PHImageRequestOptions * options = [[PHImageRequestOptions alloc] init];
|
|
options.resizeMode = PHImageRequestOptionsResizeModeFast;
|
|
options.synchronous = YES;
|
|
PHCachingImageManager * imageManager = [[PHCachingImageManager alloc] init];
|
|
[imageManager requestImageDataForAsset:assets.firstObject options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
|
|
NSString *path = [FileToolsObject libraryDir];
|
|
NSMutableArray *imageArr = @[].mutableCopy;
|
|
for (UIImage * image in photos) {
|
|
NSString * imgUrl = [NSString stringWithFormat:@"source/personInfo/image/%@.jpg",[ToolsObject dateChangeRealtimestamp]];
|
|
[FileToolsObject createFileAtPath:[path stringByAppendingPathComponent:imgUrl] overwrite:YES];
|
|
NSData *thumbImageData = [ToolsObject compressWithMaxLength:1024 WithImage:image];
|
|
[imageArr addObject:[path stringByAppendingPathComponent:imgUrl]];
|
|
[FileToolsObject writeFileAtPath:[path stringByAppendingPathComponent:imgUrl] content:thumbImageData];
|
|
}
|
|
[weakSelf uploadImage:imageArr];
|
|
}];
|
|
} videoPickerControllerBlock:^(TZImagePickerController * _Nonnull picker, UIImage * _Nonnull coverImage, PHAsset * _Nonnull asset) {}];
|
|
|
|
}
|
|
- (void)uploadImage:(NSMutableArray *)imageArr{
|
|
WeakSelf(weakSelf)
|
|
[ToolsObject uploadImageWithArr:imageArr WithRecourseType:(OSSUploadType_HeaderImage) completionHandler:^(NSMutableArray * _Nonnull urlArr) {
|
|
if (urlArr.count > 0) {
|
|
weakSelf.roomInfo.room_head = urlArr.firstObject;
|
|
weakSelf.roomInfo = self.roomInfo;
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[weakSelf.listView reloadData];
|
|
});
|
|
return;
|
|
}
|
|
[ToolsObject addPopVieToText:@"上传失败,请重试"];
|
|
}];
|
|
}
|
|
|
|
- (void)getRoomBgList{
|
|
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
|
|
WeakSelf(ws);
|
|
/// /room/wallpaper/list
|
|
NSString *url = [DDEncryptManager dd_aesDecryptWithText:@"owppLuL3ybChTuqrMmW6r6vyiioZYvDs+ZNRdixsEjo="];
|
|
[NetworkRequest requestPOST:url parameters:params block:^(BaseResponse * _Nonnull response) {
|
|
if(response.code ==200){
|
|
NSArray *dataArray =[NSArray yy_modelArrayWithClass:[RoomCreatBgImageModel class] json:response.data];
|
|
__block BOOL isSelect = NO;
|
|
[dataArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
if ([obj isKindOfClass:[RoomCreatBgImageModel class]]) {
|
|
RoomCreatBgImageModel * model = obj;
|
|
if ([[ToolsObject isBlankString:ws.roomInfo.wallpaper_id] isEqualToString:model.wallpaper_id]) {
|
|
model.isSelect = YES;
|
|
isSelect = YES;
|
|
}else{
|
|
model.isSelect = NO;
|
|
}
|
|
}
|
|
}];
|
|
if (!isSelect&&![ToolsObject IsNullWithObject:dataArray]) {
|
|
RoomCreatBgImageModel * model = dataArray[0];
|
|
model.isSelect = YES;
|
|
self.roomInfo.room_image = model.url;
|
|
self.roomInfo.wallpaper_id = model.wallpaper_id;
|
|
}
|
|
self.imageBGArray = [NSMutableArray arrayWithArray:dataArray];
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[ws.listView baseReloadData];
|
|
});
|
|
}
|
|
}];
|
|
}
|
|
- (void)getRoomTypeList{
|
|
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
|
|
WeakSelf(ws);
|
|
|
|
/// /room/type/list
|
|
NSString *url = [DDEncryptManager dd_aesDecryptWithText:@"3LQBcQSBkDIKNtUvUQ3ZhA=="];
|
|
[NetworkRequest requestPOST:url parameters:params block:^(BaseResponse * _Nonnull response) {
|
|
if(response.code ==200){
|
|
NSArray *dataArrayay =[NSArray yy_modelArrayWithClass:[RoomTypeModel class] json:response.data];
|
|
[dataArrayay enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
if ([obj isKindOfClass:[RoomTypeModel class]]) {
|
|
RoomTypeModel * model = obj;
|
|
if ([[ToolsObject isBlankString:ws.roomInfo.room_type] isEqualToString:model.type_id]) {
|
|
model.isSelect = YES;
|
|
}else{
|
|
model.isSelect = NO;
|
|
}
|
|
}
|
|
}];
|
|
ws.roomTypeArray = [NSMutableArray arrayWithArray:dataArrayay];
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[ws.listView baseReloadData];
|
|
});
|
|
}
|
|
}];
|
|
}
|
|
- (void)getRoomAccount{
|
|
if([ToolsObject IsNullWithObject:self.roomInfo.room_id]){
|
|
return;
|
|
};
|
|
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
|
|
[params setObject:self.roomInfo.room_id forKey:@"room_id"];
|
|
WeakSelf(ws);
|
|
|
|
/// /room/account
|
|
NSString *url = [DDEncryptManager dd_aesDecryptWithText:@"95n4OlfuaAWaZZhZ0MuTMQ=="];
|
|
[NetworkRequest requestPOST:url parameters:params block:^(BaseResponse * _Nonnull response) {
|
|
if(response.code ==200){
|
|
NSInteger room_account = [response.data[@"room_account"] integerValue];
|
|
ws.roomInfo.room_account = room_account;
|
|
}
|
|
}];
|
|
}
|
|
|
|
- (void)listViewBlock{
|
|
|
|
WeakSelf(ws);
|
|
|
|
self.listView.numberOfRowsInSectionBlock = ^NSInteger(UITableView * _Nonnull tableView, NSInteger section) {
|
|
return ws.dataSource.count;
|
|
};
|
|
self.listView.heightForRowAtIndexPathBlock = ^CGFloat(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) {
|
|
NSDictionary * dict = ws.dataSource[indexPath.row];
|
|
return [dict[@"height"] integerValue]?:CGFLOAT_MIN;
|
|
};
|
|
self.listView.heightForHeaderInSectionBlock = ^CGFloat(UITableView * _Nonnull tableView, NSInteger section) {
|
|
return CGFLOAT_MIN;
|
|
};
|
|
self.listView.heightForFooterInSectionBlock = ^CGFloat(UITableView * _Nonnull tableView, NSInteger section) {
|
|
|
|
return CGFLOAT_MIN;;
|
|
};
|
|
self.listView.viewForHeaderInSectionBlock = ^UIView * _Nonnull(UITableView * _Nonnull tableView, NSInteger section) {
|
|
return [UIView new];
|
|
};
|
|
self.listView.viewForFooterInSectionBlock = ^UIView * _Nonnull(UITableView * _Nonnull tableView, NSInteger section) {
|
|
return [UIView new];
|
|
};
|
|
self.listView.cellForRowAtIndexPathBlock = ^UITableViewCell * _Nonnull(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) {
|
|
|
|
NSDictionary * dict = ws.dataSource[indexPath.row];
|
|
NSString * title = dict[@"title"];
|
|
if ([title isEqualToString:@"房间壁纸"]) {
|
|
CreatRoomBgImageViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CreatRoomBgImageViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.dataArray = ws.imageBGArray;
|
|
cell.selectImageBlock = ^(RoomCreatBgImageModel * _Nonnull model) {
|
|
ws.roomInfo.room_image = model.url;
|
|
ws.roomInfo.wallpaper_id = model.wallpaper_id;
|
|
ws.roomInfo = ws.roomInfo;
|
|
};
|
|
cell.addImageBlock = ^{
|
|
|
|
};
|
|
return cell ;
|
|
}
|
|
if ([title isEqualToString:@"房间名称"]) {
|
|
CeratRoomTitleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CeratRoomTitleViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.roomTitle = ws.roomInfo.room_name;
|
|
cell.editTitle = ^(NSString * _Nonnull title) {
|
|
NSString * str = @"";
|
|
if (title.length > 15) {
|
|
str = [title substringToIndex:15];
|
|
}else{
|
|
str = title;
|
|
}
|
|
ws.roomInfo.room_name = str;
|
|
ws.roomInfo = ws.roomInfo;
|
|
};
|
|
return cell ;
|
|
}
|
|
if ([title isEqualToString:@"房间类型"]) {
|
|
CreatRoomTypeViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CreatRoomTypeViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.isUpDate = ws.isUpDate;
|
|
cell.dataArray = ws.roomTypeArray;
|
|
cell.selectTypeBlock = ^(RoomTypeModel * _Nonnull model) {
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[ws.view endEditing:YES];
|
|
});
|
|
ws.roomInfo.room_type = model.type_id;
|
|
ws.roomInfo.type_name = model.type_name;
|
|
ws.roomInfo = ws.roomInfo;
|
|
};
|
|
return cell ;
|
|
}
|
|
if ([title isEqualToString:@"仅粉丝可见"]) {
|
|
CreatRoomOnlyFansViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CreatRoomOnlyFansViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.isSee = ws.roomInfo.fans_can_see;
|
|
cell.editFansOnlyBlock = ^(BOOL fans_can_see) {
|
|
[ws.view endEditing:YES];
|
|
ws.roomInfo.fans_can_see = fans_can_see;
|
|
};
|
|
return cell ;
|
|
|
|
}
|
|
if ([title isEqualToString:@"房间封面"]) {
|
|
CreatRoomCoverViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CreatRoomCoverViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.imageUrl = ws.roomInfo.room_head;
|
|
cell.uploadImageBlock = ^{
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[ws.view endEditing:YES];
|
|
[ws chooseHomeHead];
|
|
});
|
|
};
|
|
return cell ;
|
|
}
|
|
if ([title isEqualToString:@"房间公告"]) {
|
|
CreatRoomNoticeViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CreatRoomNoticeViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.notice = ws.roomInfo.room_desc;
|
|
cell.editNoticeBlock = ^(NSString * _Nonnull notice) {
|
|
ws.roomInfo.room_desc = notice;
|
|
ws.roomInfo = ws.roomInfo;
|
|
};
|
|
return cell ;
|
|
}
|
|
if ([title isEqualToString:@"注销房间"]) {
|
|
CreatRoomCancleViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CreatRoomCancleViewCell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
cell.cancleBlock = ^{
|
|
[ws.view endEditing:YES];
|
|
NSString * subTitle = @"";
|
|
if (ws.roomInfo.room_account>0) {
|
|
subTitle = [NSString stringWithFormat:@"该房间还有 %lu 收益没有提现\n注销后将作废",self.roomInfo.room_account];
|
|
}
|
|
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"是否注销房间?" message:@"" preferredStyle:UIAlertControllerStyleAlert];
|
|
UIAlertAction *cancelaction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
|
|
UIAlertAction *sendaction = [UIAlertAction actionWithTitle:@"注销" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
[ws requestCancleRoom];
|
|
}];
|
|
[alertVC addAction:cancelaction];
|
|
[alertVC addAction:sendaction];
|
|
[ws presentViewController:alertVC animated:YES completion:nil];
|
|
|
|
};
|
|
return cell ;
|
|
}
|
|
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
return cell;
|
|
};
|
|
self.listView.didSelectRowAtIndexPathBlock = ^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) {
|
|
|
|
};
|
|
}
|
|
- (WLBlockTableView *)listView{
|
|
if (!_listView) {
|
|
_listView = [[WLBlockTableView alloc] init];
|
|
_listView.rowHeight = KAdaptedHeight(70);
|
|
_listView.backgroundColor = [UIColor clearColor];
|
|
[_listView registerClass:[CreatRoomBgImageViewCell class] forCellReuseIdentifier:@"CreatRoomBgImageViewCell"];
|
|
[_listView registerClass:[CeratRoomTitleViewCell class] forCellReuseIdentifier:@"CeratRoomTitleViewCell"];
|
|
[_listView registerClass:[CreatRoomCoverViewCell class] forCellReuseIdentifier:@"CreatRoomCoverViewCell"];
|
|
[_listView registerClass:[CreatRoomTypeViewCell class] forCellReuseIdentifier:@"CreatRoomTypeViewCell"];
|
|
[_listView registerClass:[CreatRoomNoticeViewCell class] forCellReuseIdentifier:@"CreatRoomNoticeViewCell"];
|
|
[_listView registerClass:[CreatRoomOnlyFansViewCell class] forCellReuseIdentifier:@"CreatRoomOnlyFansViewCell"];
|
|
[_listView registerClass:[CreatRoomCancleViewCell class] forCellReuseIdentifier:@"CreatRoomCancleViewCell"];
|
|
[self.view addSubview:_listView];
|
|
[_listView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view).mas_offset(0);
|
|
make.top.mas_equalTo(self.customNavBar.mas_bottom).mas_offset(0);
|
|
if(self.isUpDate){
|
|
make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(-KSAFEAREA_BOTTOM_HEIHGHT);
|
|
}else{
|
|
make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(-KSAFEAREA_BOTTOM_HEIHGHT-KAdaptedHeight(78));
|
|
}
|
|
}];
|
|
}
|
|
return _listView;
|
|
}
|
|
- (NSMutableArray*)imageBGArray{
|
|
if (!_imageBGArray) {
|
|
_imageBGArray = [[NSMutableArray alloc] init];
|
|
}
|
|
return _imageBGArray;
|
|
}
|
|
- (NSMutableArray*)roomTypeArray{
|
|
if (!_roomTypeArray) {
|
|
_roomTypeArray = [[NSMutableArray alloc] init];
|
|
}
|
|
return _roomTypeArray;
|
|
}
|
|
- (NSMutableArray*)dataSource{
|
|
if (!_dataSource) {
|
|
_dataSource = [[NSMutableArray alloc] init];
|
|
if (self.roomAuth == 2) {
|
|
_dataSource = @[
|
|
@{@"title":@"房间壁纸",@"height":@(229)},
|
|
@{@"title":@"房间名称",@"height":@(96)},
|
|
@{@"title":@"房间类型",@"height":@(82)},
|
|
@{@"title":@"房间封面",@"height":@(157)},
|
|
@{@"title":@"房间公告",@"height":@(192)},
|
|
@{@"title":@"注销房间",@"height":@(60)}].mutableCopy;
|
|
if (self.roomInfo.open_type == 1||!self.isUpDate) {
|
|
[_dataSource insertObject:@{@"title":@"仅粉丝可见",@"height":@(50)} atIndex:3];
|
|
}
|
|
}else if (self.roomAuth == 5) {
|
|
_dataSource = @[
|
|
@{@"title":@"房间壁纸",@"height":@(229)},
|
|
@{@"title":@"房间名称",@"height":@(96)},
|
|
@{@"title":@"房间类型",@"height":@(82)},
|
|
@{@"title":@"房间封面",@"height":@(157)},
|
|
@{@"title":@"房间公告",@"height":@(192)}, @{@"title":@"注销房间",@"height":@(60)}].mutableCopy;
|
|
}else{
|
|
_dataSource = @[
|
|
@{@"title":@"房间壁纸",@"height":@(229)},
|
|
@{@"title":@"房间名称",@"height":@(96)},
|
|
@{@"title":@"房间类型",@"height":@(82)},
|
|
@{@"title":@"房间封面",@"height":@(157)},
|
|
@{@"title":@"房间公告",@"height":@(192)}].mutableCopy;
|
|
}
|
|
}
|
|
return _dataSource;
|
|
}
|
|
|
|
- (UIButton *)sendButton{
|
|
if (!_sendButton) {
|
|
_sendButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_sendButton setTitle:@"创建房间" forState:UIControlStateNormal];
|
|
[_sendButton setTitleColor:KRGB(255) forState:UIControlStateNormal];
|
|
_sendButton.hidden = self.isUpDate;
|
|
_sendButton.titleLabel.font = KFontMedium(16);
|
|
[_sendButton setBackgroundImage:[UIImage imageNamed:@"room_23"] forState:UIControlStateNormal];
|
|
[_sendButton addTarget:self action:@selector(sendButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
|
[self.view addSubview:_sendButton];
|
|
[_sendButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(KAdaptedWidth(343), KAdaptedHeight(48)));
|
|
make.centerX.mas_equalTo(self.view).mas_offset(0);
|
|
make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(-KSAFEAREA_BOTTOM_HEIHGHT-KAdaptedHeight(15));
|
|
}];
|
|
}
|
|
return _sendButton;
|
|
}
|
|
- (UIButton *)commitBtn{
|
|
if (!_commitBtn) {
|
|
_commitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
_commitBtn.hidden = !self.isUpDate;
|
|
_commitBtn.titleLabel.font = KFontMedium(16);
|
|
[_commitBtn setImage:[UIImage imageNamed:@"room_30"] forState:UIControlStateNormal];
|
|
[_commitBtn addTarget:self action:@selector(commitBtnClick) forControlEvents:UIControlEventTouchUpInside];
|
|
[self.view addSubview:_commitBtn];
|
|
[_commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(KAdaptedWidth(50), KAdaptedHeight(44)));
|
|
make.bottom.mas_equalTo(self.customNavBar.mas_bottom).mas_offset(0);
|
|
make.right.mas_equalTo(self.customNavBar.mas_right).mas_offset(-KAdaptedWidth(10));
|
|
}];
|
|
}
|
|
return _commitBtn;
|
|
}
|
|
|
|
|
|
@end
|