Files
mier_ios/SweetParty/主类/音悦新增/拍卖厅/PMMoreAlert.m
2025-08-11 10:43:19 +08:00

97 lines
2.5 KiB
Objective-C
Executable File

//
// PMMoreAlert.m
// SweetParty
//
// Created by bj_szd on 2023/12/25.
//
#import "PMMoreAlert.h"
#import "PMMoreAlertCell.h"
#import "LMDeleteMiyouAlertView.h"
@interface PMMoreAlert () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) NSArray *dataArray;
@end
@implementation PMMoreAlert
- (void)awakeFromNib {
[super awakeFromNib];
[self createUI];
}
- (void)setRid:(NSString *)rid {
_rid = rid;
[self fetchData];
}
- (void)fetchData {
NSDictionary *params = @{@"rid":self.rid,@"page":@"1",@"page_limit":@"100"};
NSString *urlStr = @"/api/auction_room/auction_room_rank";
WEAK_SELF
[AFNetworkRequset.shared postRequestWithParams:params Path:urlStr Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
weakSelf.dataArray = [PMMoreModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"]];
[weakSelf.tableView reloadData];
} Failure:^(id _Nonnull errorData) {
}];
}
- (void)createUI {
WEAK_SELF
[self.touchImgV dg_Tapped:^{
[weakSelf removeFromSuperview];
}];
self.tableView.separatorStyle = NO;
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView registerNib:[UINib nibWithNibName:@"PMMoreAlertCell" bundle:nil] forCellReuseIdentifier:@"PMMoreAlertCell"];
self.tableView.rowHeight = 64;
}
- (IBAction)onDismiss:(id)sender {
[self removeFromSuperview];
}
#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 {
PMMoreAlertCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PMMoreAlertCell" forIndexPath:indexPath];
PMMoreModel *model = self.dataArray[indexPath.row];
if (indexPath.row < 3) {
cell.rankImg.hidden = NO;
cell.orderLab.hidden = YES;
NSString *rankImgName = [NSString stringWithFormat:@"love_mtl_rank_%ld",indexPath.row+1];
cell.rankImg.image = ImageNamed(rankImgName);
}else {
cell.rankImg.hidden = YES;
cell.orderLab.hidden = NO;
cell.orderLab.text = [NSString stringWithFormat:@"%02ld",indexPath.row+1];
}
cell.model = model;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
}
@end