Files
yuyin_ios/SweetParty/主类/Mine/GongHui/SPGonghuiApplyListVC.m
2025-08-08 11:05:33 +08:00

113 lines
3.0 KiB
Objective-C
Executable File

//
// SPGonghuiApplyListVC.m
// SweetParty
//
// Created by bj_szd on 2022/6/29.
//
#import "SPGonghuiApplyListVC.h"
#import "SPGonghuiApplyListCell.h"
@interface SPGonghuiApplyListVC ()
@end
@implementation SPGonghuiApplyListVC
- (void)viewDidLoad {
[super viewDidLoad];
[self showNaviBarWithTitle:@"申请列表"];
[self createUI];
[self fetchData];
}
-(void)createUI {
UIImageView *bgImgV = [[UIImageView alloc] initWithImage:ImageNamed(@"gonghui_bg")];
[self.view insertSubview:bgImgV atIndex:0];
[bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.view);
make.height.mas_equalTo(ScreenWidth/375*812);
}];
[self.tableView registerNib:[UINib nibWithNibName:@"SPGonghuiApplyListCell" bundle:nil] forCellReuseIdentifier:@"SPGonghuiApplyListCell"];
self.tableView.rowHeight = 74;
[self showPullToRefresh];
[self showLoadMoreRefresh];
}
- (void)fetchData {
NSDictionary *params = @{@"guild_id":C_string(self.guild_id), @"page":@(self.page), @"page_limit":@"10"};
[AFNetworkRequset.shared postRequestWithParams:params Path:@"api/guild/get_apply_guild_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
if (self.page == 1) {
[self.dataArray removeAllObjects];
[self.tableView reloadData];
}
[self endRefresh];
NSArray *arr = [SPGonghuiApplyModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"list"]];
[self.dataArray addObjectsFromArray:arr];
[self.tableView reloadData];
if (arr.count > 0) {
[self endFooterRefreshWithMore];
}else {
[self endFooterRefreshWithNoMore];
}
if (self.dataArray.count <= 0) {
[self showNoContentView];
} else {
[self hideNoContentView];
}
} Failure:^(id _Nonnull errorData) {
}];
}
- (void)refreshFetchData {
self.page = 1;
[self fetchData];
}
- (void)fetchMoreData {
self.page ++;
[self fetchData];
}
#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 {
SPGonghuiApplyListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPGonghuiApplyListCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
SPGonghuiApplyModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SPGonghuiApplyModel *model = self.dataArray[indexPath.row];
[UIViewController goUserMainpageWith:model.uid withRid:@""];
}
#pragma mark - JXCategoryListContentViewDelegate
- (UIView *)listView {
return self.view;
}
@end