1
This commit is contained in:
@@ -172,7 +172,9 @@
|
||||
}
|
||||
|
||||
- (void)kb_handleShopTapAtIndexPath:(NSIndexPath *)indexPath {
|
||||
KBShopThemeModel *selTheme = (indexPath.item < self.dataSource.count) ? self.dataSource[indexPath.item] : nil;
|
||||
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
|
||||
vc.themeId = selTheme.themeId;
|
||||
[self.navigationController pushViewController:vc animated:true];
|
||||
return;
|
||||
KBShopThemeModel *theme = (indexPath.item < self.dataSource.count) ? self.dataSource[indexPath.item] : nil;
|
||||
|
||||
@@ -279,7 +279,7 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
[KBHUD show];
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.shopVM fetchWalletBalanceWithCompletion:^(NSNumber * _Nullable balance, NSError * _Nullable error) {
|
||||
[self.shopVM fetchWalletBalanceWithCompletion:^(NSString * _Nullable balance, NSError * _Nullable error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (showHUD) {
|
||||
[KBHUD dismiss];
|
||||
@@ -289,9 +289,9 @@ static const CGFloat JXheightForHeaderInSection = 50;
|
||||
[KBHUD showInfo:msg];
|
||||
return;
|
||||
}
|
||||
double amountValue = balance.doubleValue;
|
||||
NSString *amountString = [NSString stringWithFormat:@"%.2f", amountValue];
|
||||
[weakSelf.userHeaderView updatePoints:amountString];
|
||||
// double amountValue = balance.doubleValue;
|
||||
// NSString *amountString = [NSString stringWithFormat:@"%.2f", amountValue];
|
||||
[weakSelf.userHeaderView updatePoints:balance];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBSkinDetailVC : BaseViewController
|
||||
@property (nonatomic, copy, nullable) NSString *themeId;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "KBSkinCardCell.h"
|
||||
#import "KBSkinSectionTitleCell.h"
|
||||
#import "KBSkinBottomActionView.h"
|
||||
#import "KBShopVM.h"
|
||||
|
||||
static NSString * const kHeaderCellId = @"kHeaderCellId";
|
||||
static NSString * const kTagsContainerCellId = @"kTagsContainerCellId";
|
||||
@@ -30,6 +31,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
@property (nonatomic, strong) KBSkinBottomActionView *bottomBar; // 底部操作条
|
||||
@property (nonatomic, copy) NSArray<NSString *> *tags; // 标签数据
|
||||
@property (nonatomic, copy) NSArray<NSDictionary *> *gridData; // 底部网格数据
|
||||
@property (nonatomic, strong) KBShopVM *shopVM;
|
||||
@end
|
||||
|
||||
@implementation KBSkinDetailVC
|
||||
@@ -65,6 +67,8 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT);
|
||||
make.bottom.equalTo(self.bottomBar.mas_top).offset(-10);
|
||||
}];
|
||||
|
||||
[self fetchThemeDetailIfNeeded];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionView DataSource
|
||||
@@ -206,4 +210,30 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
||||
// 预留:下载/购买动作
|
||||
}
|
||||
|
||||
- (void)fetchThemeDetailIfNeeded {
|
||||
if (self.themeId.length == 0) {
|
||||
NSLog(@"[KBSkinDetailVC] themeId is empty, skip detail request");
|
||||
return;
|
||||
}
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.shopVM fetchThemeDetailWithId:self.themeId completion:^(NSDictionary * _Nullable json, NSError * _Nullable error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error) {
|
||||
NSLog(@"[KBSkinDetailVC] fetch detail failed: %@", error);
|
||||
return;
|
||||
}
|
||||
NSLog(@"[KBSkinDetailVC] theme detail json: %@", json);
|
||||
// TODO: parse json into models once the structure is finalized.
|
||||
[weakSelf.collectionView reloadData];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (KBShopVM *)shopVM {
|
||||
if (!_shopVM) {
|
||||
_shopVM = [[KBShopVM alloc] init];
|
||||
}
|
||||
return _shopVM;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user