123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- //
- // YOUPAILZChatRoomBlockListWindow.m
- // VQU
- //
- // Created by CY on 2021/11/10.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomBlockListWindow.h"
- #import "YOUPAILZChatRoomBlockCell.h"
- @interface YOUPAILZChatRoomBlockListWindow ()<UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic, weak)UITableView *youpaiptableView;
- @property (nonatomic, weak)UIButton *youpaipconfirmBtn;
- @property (nonatomic, strong) NSMutableArray <YOUPAILZChatRoomBlockModel *>*youpaipdataSource;
- @end
- @implementation YOUPAILZChatRoomBlockListWindow
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.baseView.hidden = YES;
- [self youpaifinitUI];
- [self youpaifrequestList];
- }
- - (void)youpaifinitUI{
- UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 375.0f + SafeHeight)];
- bgV.backgroundColor = HexColorFromRGB(0x2A2935);
- [self.view addSubview:bgV];
- [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.offset(0.0f);
- make.height.offset(375.0f + SafeHeight);
- }];
- [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(20.0f, 20.0f)];
-
-
- UIView *navV = [[UIView alloc] init];
- [bgV addSubview:navV];
- [navV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.top.offset(0.0f);
- make.height.offset(49.0f);
- }];
- UIButton *youpaipcloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_nav_return_white"] forState:UIControlStateNormal];
- [youpaipcloseBtn setImage:[UIImage imageNamed:@"vqu_images_nav_return_white"] forState:UIControlStateHighlighted];
- [youpaipcloseBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [navV addSubview:youpaipcloseBtn];
- [youpaipcloseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(4.0f);
- make.centerY.equalTo(navV);
- make.size.mas_offset(CGSizeMake(44.0f, 44.0f));
- }];
-
- UILabel *titleL = [[UILabel alloc] init];
- titleL.text = self.youpaiptitleStr;
- titleL.textColor = [UIColor whiteColor];
- titleL.font = LCBoldFont(17.0f);
- [navV addSubview:titleL];
- [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(navV);
- }];
-
- UIButton *youpaipconfirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [youpaipconfirmBtn addTarget:self action:@selector(youpaifconfirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [youpaipconfirmBtn setTitle:self.youpaipbtnTitle forState:0];
- [youpaipconfirmBtn setTitleColor:HexColorFromRGB(0x9F9DA5) forState:UIControlStateNormal];
- [youpaipconfirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
- youpaipconfirmBtn.titleLabel.font = LCFont(16);
- [youpaipconfirmBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 80.0f, 48.0f) FromColors:@[HexColorFromRGB(0x4F4B5B),HexColorFromRGB(0x4F4B5B)] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
- [youpaipconfirmBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 80.0f, 48.0f) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:GradientLeftToRight] forState:UIControlStateSelected];
- youpaipconfirmBtn.layer.cornerRadius = 24.0f;
- youpaipconfirmBtn.clipsToBounds = YES;
- youpaipconfirmBtn.userInteractionEnabled = NO;
- [bgV addSubview:youpaipconfirmBtn];
- self.youpaipconfirmBtn = youpaipconfirmBtn;
- [youpaipconfirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(40.0f);
- make.right.offset(-40.0f);
- make.bottom.offset(-SafeHeight-10.0f);
- make.height.offset(48.0f);
- }];
-
- UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
- tableView.delegate = self;
- tableView.dataSource = self;
- tableView.rowHeight = 68.0f;
- tableView.estimatedRowHeight = 68.0f;
- tableView.estimatedSectionHeaderHeight = 0.0f;
- tableView.estimatedSectionFooterHeight = 0.0f;
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- tableView.backgroundColor = [UIColor clearColor];
- tableView.showsVerticalScrollIndicator = NO;
- [self.view addSubview:tableView];
- self.youpaiptableView = tableView;
- [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.bottom.equalTo(youpaipconfirmBtn.mas_top).offset(-10.0f);
- make.top.equalTo(navV.mas_bottom).offset(0.0f);
- }];
- }
- - (void)youpaifcloseBtnClick{
- [self dismissViewControllerAnimated:YES completion:^{}];
- }
- - (void)youpaifconfirmBtnClick{
- NSMutableString *userIdStr = [NSMutableString string];
- for (YOUPAILZChatRoomBlockModel *model in self.youpaipdataSource) {
- if (model.youpaipisSelected) {
- [userIdStr appendFormat:@"%@,",model.youpaipid];
- }
- }
- @weakify(self);
- [LCHttpHelper requestWithURLString:ForbidUser parameters:@{@"room_id":self.youpaipchatroomModel.youpaiproom_id,@"time":@"0",@"type":self.youpaiptype,@"op_uid":userIdStr.copy} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {//成功
- [ZCHUDHelper showTitle:@"操作成功"];
- for (NSInteger i = 0; i < self.youpaipdataSource.count; i ++) {
- YOUPAILZChatRoomBlockModel *model = self.youpaipdataSource[i];
- if (model.youpaipisSelected) {
- [self.youpaipdataSource removeObject:model];
- i --;
- }
- }
- [self.youpaiptableView reloadData];
- [self youpaifreloadConfirmBtnStyle];
- }
- } failure:^(NSError *error) {
- }];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.youpaipdataSource.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- NSString *cellID = @"YOUPAILZChatRoomBlockCell";
- YOUPAILZChatRoomBlockCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
- if (cell == nil) {
- cell = [[YOUPAILZChatRoomBlockCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- }
- [cell youpaifreloadWithModel:self.youpaipdataSource[indexPath.row]];
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- self.youpaipdataSource[indexPath.row].youpaipisSelected = !self.youpaipdataSource[indexPath.row].youpaipisSelected;
- [self.youpaiptableView reloadData];
- [self youpaifreloadConfirmBtnStyle];
- }
- - (void)youpaifreloadConfirmBtnStyle{
- BOOL isSelected = NO;
- for (YOUPAILZChatRoomBlockModel *model in self.youpaipdataSource) {
- if (model.youpaipisSelected) {
- isSelected = YES;
- break;
- }
- }
- self.youpaipconfirmBtn.selected = isSelected;
- self.youpaipconfirmBtn.userInteractionEnabled = isSelected;
- }
- - (void)youpaifrequestList{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetForbidUserList parameters:@{@"type":self.youpaiptype,@"room_id":self.youpaipchatroomModel.youpaiproom_id} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {//成功
- self.youpaipdataSource = [YOUPAILZChatRoomBlockModel mj_objectArrayWithKeyValuesArray:[dict objectForKey:@"data"]];
- [self.youpaiptableView reloadData];
- }
- } failure:^(NSError *error) {
- }];
- }
- @end
|