feat: 新商城框架

This commit is contained in:
eggmanQQQ
2024-11-13 19:17:06 +08:00
parent 9a3aab22e9
commit e47259c82c
38 changed files with 789 additions and 7 deletions

View File

@@ -0,0 +1,70 @@
//
// ShoppingMallViewController.m
// YuMi
//
// Created by P on 2024/11/13.
//
#import "ShoppingMallViewController.h"
#import "ShoppingMallDataPresent.h"
#import "ShoppingMallCategoryListView.h"
@interface ShoppingMallViewController ()
@end
@implementation ShoppingMallViewController
- (ShoppingMallDataPresent *)createPresenter {
return [[ShoppingMallDataPresent alloc] init];
}
- (BOOL)isHiddenNavBar {
return YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColorFromRGB(0x02061D);
UIImageView *topBG = [[UIImageView alloc] initWithImage:kImage(@"mall_top_bg")];
[self.view addSubview:topBG];
[topBG mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.leading.trailing.mas_equalTo(self.view);
make.height.mas_equalTo(kGetScaleWidth(200));
}];
NSInteger top = kNavigationHeight + 56;
ShoppingMallCategoryListView *listView = [[ShoppingMallCategoryListView alloc] initWithFrame:CGRectMake(0, top, KScreenWidth, KScreenHeight - top)];
//
@kWeakify(self);
listView.fetchDataForPage = ^(NSInteger pageIndex, FetchDataCompletion completion) {
// API
@kStrongify(self);
[self fetchDataForPage:pageIndex completion:completion];
};
[self.view addSubview:listView];
listView.items = @[@{YMLocalizedString(@"XPMineDressUpViewController2") : @1}, //
@{YMLocalizedString(@"XPMineDressUpViewController1") : @0}, //
@{YMLocalizedString(@"XPMineDressUpViewController3") : @2}, //
@{YMLocalizedString(@"XPMineDressUpViewController4") : @3}, //
@{YMLocalizedString(@"XPMineDressUpViewController5") : @4} //
];
}
- (void)fetchDataForPage:(NSInteger)pageIndex completion:(FetchDataCompletion)completion {
// completion
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSMutableArray *data = [NSMutableArray array];
for (int i = 0; i < 20; i++) {
[data addObject:@(i + arc4random()%100 * 20)];
}
if (completion) {
completion(data);
}
});
}
@end