102 lines
3.0 KiB
Mathematica
102 lines
3.0 KiB
Mathematica
|
|
//
|
||
|
|
// DLMineBlackVC.m
|
||
|
|
// SweetParty
|
||
|
|
//
|
||
|
|
// Created by bj_szd on 2023/6/28.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "DLMineBlackVC.h"
|
||
|
|
#import "DLMineBlackCell.h"
|
||
|
|
|
||
|
|
@interface DLMineBlackVC ()
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
@implementation DLMineBlackVC
|
||
|
|
|
||
|
|
- (void)viewDidLoad {
|
||
|
|
[super viewDidLoad];
|
||
|
|
|
||
|
|
UIImageView *bgImgV = [[UIImageView alloc] initWithImage:ImageNamed(@"home_bg")];
|
||
|
|
[self.view addSubview:bgImgV];
|
||
|
|
[self.view sendSubviewToBack:bgImgV];
|
||
|
|
[bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
|
make.top.left.right.equalTo(self.view);
|
||
|
|
make.height.mas_equalTo(ScreenWidth/375*812);
|
||
|
|
}];
|
||
|
|
|
||
|
|
[self showNaviBarWithTitle:@"黑名单"];
|
||
|
|
|
||
|
|
[self createUI];
|
||
|
|
|
||
|
|
[self fetchData];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)createUI {
|
||
|
|
[self.tableView registerNib:[UINib nibWithNibName:@"DLMineBlackCell" bundle:nil] forCellReuseIdentifier:@"DLMineBlackCell"];
|
||
|
|
self.tableView.rowHeight = 75;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)fetchData {
|
||
|
|
NSDictionary *params = @{@"page":@"1", @"page_limit":@"1000"};
|
||
|
|
[AFNetworkRequset.shared postRequestWithParams:params Path:@"/api/user_tencent/get_blacklist_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
||
|
|
[self.dataArray removeAllObjects];
|
||
|
|
[self.tableView reloadData];
|
||
|
|
|
||
|
|
NSArray *arr = [SPFocusFansModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"room_black_list"]];
|
||
|
|
[self.dataArray addObjectsFromArray:arr];
|
||
|
|
[self.tableView reloadData];
|
||
|
|
|
||
|
|
if (self.dataArray.count <= 0) {
|
||
|
|
[self showNoContentView];
|
||
|
|
} else {
|
||
|
|
[self hideNoContentView];
|
||
|
|
}
|
||
|
|
|
||
|
|
} Failure:^(id _Nonnull errorData) {
|
||
|
|
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
#pragma mark - Table view data source
|
||
|
|
|
||
|
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||
|
|
return self.dataArray.count;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
|
DLMineBlackCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DLMineBlackCell" forIndexPath:indexPath];
|
||
|
|
cell.selectionStyle = NO;
|
||
|
|
|
||
|
|
SPFocusFansModel *model = self.dataArray[indexPath.row];
|
||
|
|
cell.model = model;
|
||
|
|
|
||
|
|
WEAK_SELF
|
||
|
|
[cell.focusBtn buttonAddTaget:^(UIButton *btn) {
|
||
|
|
[weakSelf onBlack:model isSet:NO];
|
||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
||
|
|
|
||
|
|
return cell;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)onBlack:(SPFocusFansModel *)model isSet:(BOOL)isSet {
|
||
|
|
NSDictionary *params = @{@"rid":@"", @"user_id":model.uid};
|
||
|
|
NSString *urlStr = isSet ? @"/api/user_tencent/add_blacklist" : @"/api/user_tencent/remove_blacklist";
|
||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:urlStr Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
|
||
|
|
[self fetchData];
|
||
|
|
} Failure:^(id _Nonnull errorData) {
|
||
|
|
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||
|
|
SPFocusFansModel *model = self.dataArray[indexPath.row];
|
||
|
|
[UIViewController goUserMainpageWith:model.uid withRid:@""];
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|