This commit is contained in:
2025-12-17 20:37:53 +08:00
parent 8aa43d723a
commit 85012eab78
2 changed files with 27 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#import "KBSkinCardCell.h"
#import "KBSearchVM.h"
#import "KBSearchThemeModel.h"
#import "KBSkinDetailVC.h"
static NSString * const kResultCellId = @"KBSkinCardCell";
@@ -113,6 +114,17 @@ static NSString * const kResultCellId = @"KBSkinCardCell";
return cell;
}
#pragma mark - UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
KBSearchThemeModel *model = self.resultItems[indexPath.item];
NSString *themeId = [model.themeId stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (themeId.length == 0) { return; }
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
vc.themeId = themeId;
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - UICollectionViewDelegateFlowLayout
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {

View File

@@ -15,6 +15,7 @@
#import "UICollectionViewLeftAlignedLayout.h"
#import "KBSearchVM.h"
#import "KBShopThemeModel.h"
#import "KBSkinDetailVC.h"
static NSString * const kTagCellId = @"KBTagCell";
@@ -137,6 +138,15 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
[self.navigationController pushViewController:vc animated:YES];
}
///
- (void)openDetailForThemeId:(NSString *)themeId {
NSString *trim = [themeId stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (trim.length == 0) { return; }
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
vc.themeId = trim;
[self.navigationController pushViewController:vc animated:YES];
}
///
- (NSArray<NSString *> *)currentDisplayHistory {
if (self.historyExpanded) { return self.historyWords; }
@@ -367,6 +377,11 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
[self performSearch:kw];
[self openResultForKeyword:kw];
}
return;
}
if (indexPath.section == KBSearchSectionRecommend) {
KBShopThemeModel *model = self.recommendedThemes[indexPath.item];
[self openDetailForThemeId:model.themeId ?: @""];
}
}