122 lines
3.6 KiB
Mathematica
122 lines
3.6 KiB
Mathematica
|
|
//
|
||
|
|
// LMLoveSkyWheelViewController.m
|
||
|
|
// SweetParty
|
||
|
|
//
|
||
|
|
// Created by Xmac on 2024/8/7.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "LMLoveSkyWheelViewController.h"
|
||
|
|
#import "LMLovelsTableHeaderView.h"
|
||
|
|
#import "LMLoveLsTableViewCell.h"
|
||
|
|
|
||
|
|
@interface LMLoveSkyWheelViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||
|
|
|
||
|
|
@property (weak, nonatomic) IBOutlet UITableView *swTableView;
|
||
|
|
@property (nonatomic, strong) LMLovelsTableHeaderView *headerView;
|
||
|
|
@property (nonatomic, strong) NSMutableArray *dataArr;
|
||
|
|
@property (nonatomic, strong) NSMutableArray *listDataArr;
|
||
|
|
@property (nonatomic, strong) NSMutableArray *topDataArr;
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
@implementation LMLoveSkyWheelViewController
|
||
|
|
|
||
|
|
- (void)viewDidLoad {
|
||
|
|
[super viewDidLoad];
|
||
|
|
self.navTitle = @"";
|
||
|
|
[self.customNavBar styleClear];
|
||
|
|
|
||
|
|
UIButton *btn = [UIButton buttonWithType:(UIButtonTypeCustom)];
|
||
|
|
[btn setImage:ImageNamed(@"week_home_yiwen") forState:(UIControlStateNormal)];
|
||
|
|
[self.customNavBar addSubview:btn];
|
||
|
|
[btn buttonAddTaget:^(UIButton *btn) {
|
||
|
|
[UIViewController goWebWithUrl:[VERSION_HTTPS_SERVER stringByAppendingString:@"index.php/index/index/page_show?id=21"]];
|
||
|
|
} forControlEvents:(UIControlEventTouchUpInside)];
|
||
|
|
|
||
|
|
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
|
make.right.mas_equalTo(-15);
|
||
|
|
make.width.height.mas_equalTo(30);
|
||
|
|
make.top.mas_equalTo(yb_StatusBar_H+7);
|
||
|
|
}];
|
||
|
|
|
||
|
|
[self.swTableView registerNib:[UINib nibWithNibName:@"LMLoveLsTableViewCell" bundle:nil] forCellReuseIdentifier:LMLoveLsTableViewCellID];
|
||
|
|
self.swTableView.tableHeaderView = self.headerView;
|
||
|
|
|
||
|
|
[self requestmotianLunTodayRank];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||
|
|
{
|
||
|
|
return self.listDataArr.count;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
|
LMLoveLsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LMLoveLsTableViewCellID forIndexPath:indexPath];
|
||
|
|
LMLoveLsListModel *model = self.listDataArr[indexPath.row];
|
||
|
|
cell.model = model;
|
||
|
|
cell.rankLabel.text = [NSString stringWithFormat:@"%02ld",indexPath.row+6];
|
||
|
|
|
||
|
|
return cell;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (LMLovelsTableHeaderView *)headerView
|
||
|
|
{
|
||
|
|
if (!_headerView){
|
||
|
|
_headerView = LoadNib(@"LMLovelsTableHeaderView");
|
||
|
|
_headerView.frame = CGRectMake(0, 0, APPW, 704);
|
||
|
|
}
|
||
|
|
return _headerView;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
- (void)requestmotianLunTodayRank
|
||
|
|
{
|
||
|
|
[BJHttpTool BJ_Get_motian_rankWithParameters:@{@"type":@"2"} success:^(id response) {
|
||
|
|
self.dataArr = [LMLoveLsListModel mj_objectArrayWithKeyValuesArray:response[@"data"]];
|
||
|
|
if (self.dataArr.count > 5){
|
||
|
|
[self.dataArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||
|
|
LMLoveLsListModel *model = obj;
|
||
|
|
if (idx < 5){
|
||
|
|
[self.topDataArr addObject:model];
|
||
|
|
}else{
|
||
|
|
[self.listDataArr addObject:model];
|
||
|
|
}
|
||
|
|
}];
|
||
|
|
[self.swTableView reloadData];
|
||
|
|
self.headerView.fiveArr = self.topDataArr;
|
||
|
|
}else{
|
||
|
|
[self.topDataArr addObjectsFromArray:self.dataArr];
|
||
|
|
self.headerView.fiveArr = self.topDataArr;
|
||
|
|
}
|
||
|
|
} failure:^(NSError *error) {
|
||
|
|
|
||
|
|
}];
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSMutableArray *)dataArr
|
||
|
|
{
|
||
|
|
if (!_dataArr){
|
||
|
|
_dataArr = [NSMutableArray array];
|
||
|
|
}
|
||
|
|
return _dataArr;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSMutableArray *)listDataArr
|
||
|
|
{
|
||
|
|
if (!_listDataArr){
|
||
|
|
_listDataArr = [NSMutableArray array];
|
||
|
|
}
|
||
|
|
return _listDataArr;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (NSMutableArray *)topDataArr
|
||
|
|
{
|
||
|
|
if (!_topDataArr){
|
||
|
|
_topDataArr = [NSMutableArray array];
|
||
|
|
}
|
||
|
|
return _topDataArr;
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|