125 lines
3.4 KiB
Mathematica
125 lines
3.4 KiB
Mathematica
|
|
|
||
|
|
// SPGonghuiListVC.m
|
||
|
|
// SweetParty
|
||
|
|
//
|
||
|
|
// Created by bj_szd on 2022/6/29.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "SPGonghuiListVC.h"
|
||
|
|
#import "SPGonghuiListCell.h"
|
||
|
|
#import "SPGonghuiDetailVC.h"
|
||
|
|
#import "LMGonghuiDetailsViewController.h"
|
||
|
|
|
||
|
|
@interface SPGonghuiListVC ()
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
@implementation SPGonghuiListVC
|
||
|
|
|
||
|
|
- (void)viewDidLoad {
|
||
|
|
[super viewDidLoad];
|
||
|
|
|
||
|
|
[self createUI];
|
||
|
|
|
||
|
|
[self fetchData];
|
||
|
|
}
|
||
|
|
|
||
|
|
-(void)createUI {
|
||
|
|
self.view.backgroundColor = [UIColor clearColor];
|
||
|
|
|
||
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
|
make.edges.equalTo(self.view);
|
||
|
|
}];
|
||
|
|
|
||
|
|
[self.tableView registerNib:[UINib nibWithNibName:@"SPGonghuiListCell" bundle:nil] forCellReuseIdentifier:@"SPGonghuiListCell"];
|
||
|
|
self.tableView.rowHeight = 84;
|
||
|
|
|
||
|
|
[self showPullToRefresh];
|
||
|
|
[self showLoadMoreRefresh];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)fetchData {
|
||
|
|
NSDictionary *params = @{@"time":@(self.dateType), @"page":@(self.page), @"page_limit":@"20", @"keywords":C_string(self.keywords)};
|
||
|
|
[AFNetworkRequset.shared postRequestWithParams:params Path:@"api/guild/get_guild_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
||
|
|
if (self.page == 1) {
|
||
|
|
[self.dataArray removeAllObjects];
|
||
|
|
[self.tableView reloadData];
|
||
|
|
}
|
||
|
|
[self endRefresh];
|
||
|
|
|
||
|
|
NSArray *arr = [SPGonghuiListModel 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 {
|
||
|
|
SPGonghuiListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPGonghuiListCell" forIndexPath:indexPath];
|
||
|
|
cell.selectionStyle = NO;
|
||
|
|
|
||
|
|
SPGonghuiListModel *model = self.dataArray[indexPath.row];
|
||
|
|
cell.model = model;
|
||
|
|
|
||
|
|
if (indexPath.row < 3) {
|
||
|
|
cell.orderLab.hidden = YES;
|
||
|
|
cell.orderImgV.hidden = NO;
|
||
|
|
NSString *orderStr = [NSString stringWithFormat:@"gonghui_order_%ld", indexPath.row+1];
|
||
|
|
cell.orderImgV.image = ImageNamed(orderStr);
|
||
|
|
}else {
|
||
|
|
cell.orderLab.hidden = NO;
|
||
|
|
cell.orderImgV.hidden = YES;
|
||
|
|
cell.orderLab.text = [NSString stringWithFormat:@"%02ld",indexPath.row];
|
||
|
|
}
|
||
|
|
|
||
|
|
return cell;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||
|
|
SPGonghuiListModel *model = self.dataArray[indexPath.row];
|
||
|
|
LMGonghuiDetailsViewController *vc = [[LMGonghuiDetailsViewController alloc] init];
|
||
|
|
vc.guild_id = model.guild_id;
|
||
|
|
[vc pushSelf];
|
||
|
|
}
|
||
|
|
|
||
|
|
#pragma mark - JXCategoryListContentViewDelegate
|
||
|
|
|
||
|
|
- (UIView *)listView {
|
||
|
|
return self.view;
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|