2025-11-06 14:02:22 +08:00
|
|
|
|
//
|
|
|
|
|
|
// HomeHotVC.m
|
|
|
|
|
|
// keyBoard
|
|
|
|
|
|
//
|
|
|
|
|
|
// Created by Mac on 2025/11/6.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import "HomeHotVC.h"
|
2025-11-06 14:59:00 +08:00
|
|
|
|
// 视图
|
|
|
|
|
|
#import "KBTopThreeView.h"
|
|
|
|
|
|
#import "HomeHotCell.h"
|
2025-11-06 16:05:28 +08:00
|
|
|
|
#import "HomeRankVC.h"
|
2025-11-07 22:22:41 +08:00
|
|
|
|
#import "KBSearchVC.h"
|
2025-11-17 15:39:03 +08:00
|
|
|
|
#import "HomeRankDetailPopView.h"
|
|
|
|
|
|
#import "LSTPopView.h"
|
2025-11-06 14:59:00 +08:00
|
|
|
|
#import <HWPanModal/HWPanModal.h>
|
|
|
|
|
|
@interface HomeHotVC () <UITableViewDataSource, UITableViewDelegate>
|
|
|
|
|
|
|
|
|
|
|
|
// 顶部前三名视图
|
|
|
|
|
|
@property (nonatomic, strong) KBTopThreeView *topThreeView;
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic, strong) NSArray<NSDictionary *> *dataSource; // 简单模拟数据
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
2025-11-06 14:02:22 +08:00
|
|
|
|
|
|
|
|
|
|
@interface HomeHotVC ()
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@implementation HomeHotVC
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
|
|
[super viewDidLoad];
|
2025-11-06 14:59:00 +08:00
|
|
|
|
// 构建数据(演示)
|
|
|
|
|
|
self.dataSource = @[
|
|
|
|
|
|
@{@"rank":@4, @"title":@"Ambiguous", @"sub":@"Be Neither Too Close Nor Too Distant, Want To ...", @"joined":@NO},
|
|
|
|
|
|
@{@"rank":@5, @"title":@"Ambiguous", @"sub":@"Be Neither Too Close Nor Too Distant, Want To ...", @"joined":@YES},
|
|
|
|
|
|
@{@"rank":@6, @"title":@"Ambiguous", @"sub":@"Be Neither Too Close Nor Too Distant, Want To ...", @"joined":@NO},
|
|
|
|
|
|
@{@"rank":@7, @"title":@"Ambiguous", @"sub":@"Be Neither Too Close Nor Too Distant, Want To ...", @"joined":@NO}
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
// 搭建 UI
|
|
|
|
|
|
[self.view addSubview:self.tableView];
|
|
|
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
|
make.edges.equalTo(self.view);
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
// 顶部前三名作为 tableHeaderView(注意:tableHeaderView 需设定明确高度)
|
|
|
|
|
|
CGFloat headerH = 280.0;
|
|
|
|
|
|
self.topThreeView = [[KBTopThreeView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, headerH)];
|
|
|
|
|
|
// 示例配置:三个条目的标题
|
|
|
|
|
|
[self.topThreeView configWithItems:@[
|
|
|
|
|
|
@{@"title":@"High EQ", @"rank":@1},
|
|
|
|
|
|
@{@"title":@"Flirt Girls", @"rank":@2},
|
|
|
|
|
|
@{@"title":@"Humorous", @"rank":@3}
|
|
|
|
|
|
]];
|
|
|
|
|
|
self.tableView.tableHeaderView = self.topThreeView;
|
2025-11-06 14:02:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 14:59:00 +08:00
|
|
|
|
#pragma mark - UITableViewDataSource
|
2025-11-06 14:02:22 +08:00
|
|
|
|
|
2025-11-06 14:59:00 +08:00
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
|
|
|
return self.dataSource.count;
|
2025-11-06 14:02:22 +08:00
|
|
|
|
}
|
2025-11-06 14:59:00 +08:00
|
|
|
|
|
|
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
HomeHotCell *cell = [tableView dequeueReusableCellWithIdentifier:HomeHotCell.reuseId forIndexPath:indexPath];
|
|
|
|
|
|
NSDictionary *item = self.dataSource[indexPath.row];
|
|
|
|
|
|
// 配置 cell
|
|
|
|
|
|
[cell configWithRank:[item[@"rank"] integerValue]
|
|
|
|
|
|
title:item[@"title"]
|
|
|
|
|
|
subtitle:item[@"sub"]
|
|
|
|
|
|
joined:[item[@"joined"] boolValue]];
|
|
|
|
|
|
return cell;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - UITableViewDelegate
|
|
|
|
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
return 84.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
2025-11-17 15:39:03 +08:00
|
|
|
|
// KBSearchVC *vc = [[KBSearchVC alloc] init];
|
2025-11-06 16:57:28 +08:00
|
|
|
|
// [self.navigationController pushViewController:vc animated:true];
|
2025-11-17 15:39:03 +08:00
|
|
|
|
// UINavigationController *nav = KB_CURRENT_NAV;
|
2025-11-10 13:27:26 +08:00
|
|
|
|
// [nav pushViewController:vc animated:true];
|
2025-11-06 16:57:28 +08:00
|
|
|
|
NSLog(@"===");
|
|
|
|
|
|
|
2025-11-17 15:39:03 +08:00
|
|
|
|
// 点击卡片 -> 展示弹窗
|
|
|
|
|
|
NSDictionary *d = self.dataSource[indexPath.item];
|
|
|
|
|
|
|
|
|
|
|
|
// 自定义内容视图(尺寸可按需调节)
|
|
|
|
|
|
CGFloat width = MIN(KB_SCREEN_WIDTH - 76, 420);
|
|
|
|
|
|
HomeRankDetailPopView *content = [[HomeRankDetailPopView alloc] initWithFrame:CGRectMake(0, 0, width, 460)];
|
|
|
|
|
|
NSString *title = d[@"title"] ?: @"High EQ";
|
|
|
|
|
|
NSString *people = d[@"people"] ?: @"Download: 1 Million";
|
|
|
|
|
|
NSString *desc = @"Be Neither Too Close\nNor Too Distant"; // 示例文案
|
|
|
|
|
|
[content configWithAvatar:nil title:title download:people desc:desc];
|
|
|
|
|
|
|
|
|
|
|
|
// 创建并弹出
|
|
|
|
|
|
LSTPopView *pop = [LSTPopView initWithCustomView:content
|
|
|
|
|
|
parentView:nil
|
|
|
|
|
|
popStyle:LSTPopStyleScale
|
|
|
|
|
|
dismissStyle:LSTDismissStyleScale];
|
|
|
|
|
|
pop.hemStyle = LSTHemStyleCenter; // 居中
|
|
|
|
|
|
pop.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
|
|
|
|
|
pop.isClickBgDismiss = YES; // 点击背景关闭
|
|
|
|
|
|
pop.cornerRadius = 0; // 自定义 view 自处理圆角
|
|
|
|
|
|
|
|
|
|
|
|
__weak typeof(pop) weakPop = pop;
|
|
|
|
|
|
content.saveHandler = ^{ [weakPop dismiss]; };
|
|
|
|
|
|
content.closeHandler = ^{ [weakPop dismiss]; };
|
|
|
|
|
|
|
|
|
|
|
|
[pop pop];
|
|
|
|
|
|
|
2025-11-06 14:59:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Lazy
|
|
|
|
|
|
|
|
|
|
|
|
- (BaseTableView *)tableView {
|
|
|
|
|
|
if (!_tableView) {
|
|
|
|
|
|
// 使用 BaseTableView,统一默认配置
|
|
|
|
|
|
_tableView = [[BaseTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
|
|
|
|
_tableView.dataSource = self;
|
|
|
|
|
|
_tableView.delegate = self;
|
|
|
|
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 设计为卡片式,去掉系统分割线
|
|
|
|
|
|
_tableView.showsVerticalScrollIndicator = NO;
|
|
|
|
|
|
_tableView.contentInset = UIEdgeInsetsMake(8, 0, KB_SafeAreaBottom(), 0);
|
|
|
|
|
|
[_tableView registerClass:HomeHotCell.class forCellReuseIdentifier:HomeHotCell.reuseId];
|
|
|
|
|
|
}
|
|
|
|
|
|
return _tableView;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-06 14:02:22 +08:00
|
|
|
|
|
|
|
|
|
|
@end
|