diff --git a/keyBoard/Class/Shop/VC/KBSkinDetailVC.m b/keyBoard/Class/Shop/VC/KBSkinDetailVC.m index e568484..0c64f60 100644 --- a/keyBoard/Class/Shop/VC/KBSkinDetailVC.m +++ b/keyBoard/Class/Shop/VC/KBSkinDetailVC.m @@ -120,6 +120,26 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) { return [UICollectionViewCell new]; } +#pragma mark - UICollectionView Delegate + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.section != KBSkinDetailSectionGrid) { return; } + if (indexPath.item >= self.recommendedThemes.count) { return; } + KBShopThemeModel *model = self.recommendedThemes[indexPath.item]; + NSString *nextThemeId = [model.themeId stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + if (nextThemeId.length == 0) { return; } + if ([nextThemeId isEqualToString:self.themeId ?: @""]) { return; } + + // 不跳转新页面:直接切换 themeId,重新请求详情并刷新当前页面 + self.themeId = nextThemeId; + self.detailModel = nil; + self.tags = @[]; + [self updateBottomBarAppearance]; + [self.collectionView setContentOffset:CGPointZero animated:NO]; + [self.collectionView reloadData]; + [self fetchThemeDetailIfNeeded]; +} + #pragma mark - UICollectionView DelegateFlowLayout - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {