This commit is contained in:
2025-12-11 15:39:33 +08:00
parent 4fd0a52a36
commit be1d1ad70d
5 changed files with 36 additions and 11 deletions

View File

@@ -9,11 +9,13 @@
NS_ASSUME_NONNULL_BEGIN
@class KBShopThemeDetailModel;
@interface KBSkinDetailHeaderCell : UICollectionViewCell
@property (nonatomic, strong) UIImageView *coverView; // 顶部大图
@property (nonatomic, strong) UILabel *leftLabel; // 下方左侧文案(#1B1F1A
@property (nonatomic, strong) UILabel *rightLabel; // 下方右侧文案(#02BEAC
- (void)configWithTitle:(NSString *)title right:(NSString *)right;
- (void)configWithDetail:(nullable KBShopThemeDetailModel *)detail;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,6 +6,8 @@
//
#import "KBSkinDetailHeaderCell.h"
#import "UIImageView+KBWebImage.h"
#import "KBShopThemeDetailModel.h"
@implementation KBSkinDetailHeaderCell
- (instancetype)initWithFrame:(CGRect)frame {
@@ -37,12 +39,18 @@
return self;
}
- (void)configWithTitle:(NSString *)title right:(NSString *)right {
// /
self.leftLabel.text = title.length ? title : @"Dopamine";
self.rightLabel.text = right.length ? right : @"Download: 1 Million";
//
self.coverView.backgroundColor = [UIColor colorWithWhite:0.94 alpha:1.0];
- (void)configWithDetail:(KBShopThemeDetailModel *)detail {
NSString *title = detail.themeName.length ? detail.themeName : @"Dopamine";
NSString *download = detail.themeDownload.length ? detail.themeDownload : @"0";
NSString *downloadText = [NSString stringWithFormat:@"%@: %@", KBLocalized(@"Download"), download];
self.leftLabel.text = title;
self.rightLabel.text = downloadText;
UIImage *placeholder = [UIImage imageNamed:@"shop_headbigBg_icon"];
if (detail.themePreviewImageUrl.length) {
[self.coverView kb_setImageURL:detail.themePreviewImageUrl placeholder:placeholder];
} else {
self.coverView.image = placeholder;
}
}
#pragma mark - Lazy
@@ -51,6 +59,7 @@
_coverView = [[UIImageView alloc] init];
_coverView.contentMode = UIViewContentModeScaleAspectFill;
_coverView.clipsToBounds = YES;
_coverView.layer.cornerRadius = 12;
}
return _coverView;
}

View File

@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
/// 还原设计稿见需求截图左侧「Points\nMall」标题 + 右侧大金币装饰
/// 下方卡片显示积分与「Recharge」按钮。
/// Masonry 约束 + 懒加载,中文注释。
@class KBShopThemeDetailModel;
@interface KBShopHeadView : UIView
/// 点击充值回调
@@ -21,6 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 更新积分展示
- (void)updatePoints:(NSString *)points;
/// 根据主题详情更新头图(展示主题预览图等)
- (void)configureWithThemeDetail:(KBShopThemeDetailModel * _Nullable)detail;
@end
NS_ASSUME_NONNULL_END

View File

@@ -7,6 +7,8 @@
#import "KBShopHeadView.h"
#import "KBJfPay.h"
#import "UIImageView+KBWebImage.h"
#import "KBShopThemeDetailModel.h"
@interface KBShopHeadView ()
@@ -172,6 +174,16 @@
self.amountLabel.text = points;
}
- (void)configureWithThemeDetail:(KBShopThemeDetailModel * _Nullable)detail {
NSString *urlString = detail.themePreviewImageUrl;
UIImage *placeholder = [UIImage imageNamed:@"shop_headbigBg_icon"];
if (urlString.length > 0) {
[self.bigCoinView kb_setImageURL:urlString placeholder:placeholder];
} else {
self.bigCoinView.image = placeholder;
}
}
#pragma mark - Actions
- (void)onRechargeTappedAction {
// if (self.onRechargeTapped) { self.onRechargeTapped(); }

View File

@@ -92,10 +92,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
switch (indexPath.section) {
case KBSkinDetailSectionHeader: {
KBSkinDetailHeaderCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kHeaderCellId forIndexPath:indexPath];
NSString *title = self.detailModel.themeName.length ? self.detailModel.themeName : @"Dopamine";
NSString *download = self.detailModel.themeDownload.length ? self.detailModel.themeDownload : @"0";
NSString *right = [NSString stringWithFormat:@"%@: %@", KBLocalized(@"Download"), download];
[cell configWithTitle:title right:right];
[cell configWithDetail:self.detailModel];
return cell;
}
case KBSkinDetailSectionTags: {