feat: 新商城暂存
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressUp_new_en.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
@@ -10,6 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "矩形 2941@3x-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.30/mall_item_card_normal_bg.imageset/矩形 2941@3x-2.png
vendored
Normal file
After Width: | Height: | Size: 25 KiB |
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressUp_new_ar.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
@@ -10,6 +9,7 @@
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "矩形 2941@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
BIN
YuMi/Assets.xcassets/1.0.30/mall_item_card_selected_bg.imageset/矩形 2941@3x.png
vendored
Normal file
After Width: | Height: | Size: 20 KiB |
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressUp_exclusive_ar.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 685 B |
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressUp_limit_ar.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 963 B |
Before Width: | Height: | Size: 841 B |
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressup_give_ar.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 450 B |
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressUp_exclusive_en.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 696 B |
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressUp_limit_en.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 935 B |
Before Width: | Height: | Size: 919 B |
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mine_dressup_give_en.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 423 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressUp_exclusive@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressUp_exclusive@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 849 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressUp_limit@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressUp_limit@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 995 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressUp_new@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressUp_new@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 505 B |
Before Width: | Height: | Size: 964 B |
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressup_give@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "mine_dressup_give@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 335 B |
Before Width: | Height: | Size: 902 B |
@@ -44,6 +44,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)setCornerRadius:(CGFloat)radius corners:(UIRectCorner)corners;
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)radius cornerMask:(CACornerMask)cornerMask;
|
||||
|
||||
/**
|
||||
* 设置视图的指定圆角、圆角半径、边框宽度和边框颜色
|
||||
*
|
||||
|
@@ -86,6 +86,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)radius cornerMask:(CACornerMask)cornerMask {
|
||||
self.layer.maskedCorners = cornerMask;
|
||||
self.layer.cornerRadius = radius;
|
||||
self.layer.masksToBounds = YES;
|
||||
}
|
||||
|
||||
|
||||
- (void)setCornerRadius:(CGFloat)radius
|
||||
corners:(CACornerMask)corners
|
||||
|
@@ -7,9 +7,11 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "DressUpShopModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef void (^FetchDataCompletion)(NSArray *data);
|
||||
typedef void (^FetchDataCompletion)(NSArray <DressUpShopModel *>* modelList);
|
||||
typedef void (^FetchDataForPage)(NSInteger pageIndex, FetchDataCompletion completion);
|
||||
|
||||
|
||||
|
@@ -9,18 +9,204 @@
|
||||
|
||||
@interface ShoppingMallItemCard : UICollectionViewCell
|
||||
|
||||
@property (nonatomic, strong) UIImageView *bgImageView;
|
||||
@property (nonatomic, strong) UIView *itemBGView;
|
||||
@property (nonatomic, strong) NetImageView *itemImageView;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
@property (nonatomic, strong) DressUpShopModel *cellModel;
|
||||
@property (nonatomic, strong) UIButton *playButton;
|
||||
@property (nonatomic, strong) UILabel *pricePerDayLabel;
|
||||
@property (nonatomic, strong) UILabel *description_1_label;
|
||||
@property (nonatomic, strong) UILabel *description_2_label;
|
||||
@property (nonatomic, strong) UILabel *statusLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ShoppingMallItemCard
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
// TODO: 补完内容
|
||||
// MARK: 逻辑比较复杂,需要新建文件处理
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
[self.contentView addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.itemBGView];
|
||||
[self.itemBGView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.mas_equalTo(self.contentView).inset(15);
|
||||
make.height.mas_equalTo(self.itemBGView.mas_width);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.itemImageView];
|
||||
[self.itemImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.itemBGView);
|
||||
make.width.height.mas_equalTo(self.itemBGView.mas_width).multipliedBy(0.7f);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.playButton];
|
||||
[self.playButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.trailing.mas_equalTo(self.itemBGView).offset(-4);
|
||||
make.size.mas_equalTo(CGSizeMake(26, 22));
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.mas_equalTo(self.itemBGView);
|
||||
make.top.mas_equalTo(self.itemBGView.mas_bottom).offset(5);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.pricePerDayLabel];
|
||||
[self.pricePerDayLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(6);
|
||||
make.leading.mas_equalTo(self.itemBGView);
|
||||
make.trailing.mas_equalTo(self.bgImageView);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.description_1_label];
|
||||
[self.description_1_label mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self.bgImageView).offset(1);
|
||||
make.bottom.trailing.mas_equalTo(self.bgImageView).offset(-1);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.description_2_label];
|
||||
[self.description_2_label mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.mas_equalTo(self.bgImageView).offset(1);
|
||||
make.bottom.trailing.mas_equalTo(self.bgImageView).offset(-1);
|
||||
make.height.mas_equalTo(45);
|
||||
}];
|
||||
|
||||
[self.contentView addSubview:self.statusLabel];
|
||||
[self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.mas_equalTo(self.bgImageView).offset(1);
|
||||
make.width.mas_greaterThanOrEqualTo(50);
|
||||
make.height.mas_equalTo(22);
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setCellModel:(DressUpShopModel *)cellModel {
|
||||
_cellModel = cellModel;
|
||||
self.titleLabel.text = cellModel.name;
|
||||
self.itemImageView.imageUrl = cellModel.pic;
|
||||
self.pricePerDayLabel.attributedText = [cellModel pricePerDay];
|
||||
self.description_1_label.text = YMLocalizedString(@"1.0.30_text_1");
|
||||
self.description_2_label.text = YMLocalizedString(@"1.0.30_text_2");
|
||||
self.statusLabel.text = @"FFUFUFUFUFUFUFUFUUFUFUCKCKCKCKKCKCKCKCKCKCK";//YMLocalizedString(@"1.0.30_text_4");
|
||||
}
|
||||
|
||||
- (void)handleTapPlay:(id)sender {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (UIImageView *)bgImageView {
|
||||
if (!_bgImageView) {
|
||||
_bgImageView = [[UIImageView alloc] initWithImage:kImage(@"mall_item_card_normal_bg")];
|
||||
}
|
||||
return _bgImageView;
|
||||
}
|
||||
|
||||
- (UIView *)itemBGView {
|
||||
if (!_itemBGView) {
|
||||
_itemBGView = [[UIView alloc] init];
|
||||
_itemBGView.backgroundColor = UIColorFromRGB(0x04184A);
|
||||
[_itemBGView setCornerRadius:6];
|
||||
}
|
||||
|
||||
return _itemBGView;
|
||||
}
|
||||
|
||||
- (NetImageView *)itemImageView {
|
||||
if (!_itemImageView) {
|
||||
_itemImageView = [[NetImageView alloc] init];
|
||||
_itemImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _itemImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel labelInitWithText:@""
|
||||
font:kFontMedium(14)
|
||||
textColor:UIColorFromRGB(0xD9E7F7)];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)playButton {
|
||||
if (!_playButton) {
|
||||
_playButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_playButton setImage:kImage(@"mall_play_icon") forState:UIControlStateNormal];
|
||||
[_playButton addTarget:self
|
||||
action:@selector(handleTapPlay:)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _playButton;
|
||||
}
|
||||
|
||||
- (UILabel *)pricePerDayLabel {
|
||||
if (!_pricePerDayLabel) {
|
||||
_pricePerDayLabel = [[UILabel alloc] init];
|
||||
}
|
||||
return _pricePerDayLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)description_1_label {
|
||||
if (!_description_1_label) {
|
||||
_description_1_label = [UILabel labelInitWithText:@""
|
||||
font:kFontRegular(12)
|
||||
textColor:UIColorRGBAlpha(0xD9E7F7, 0.5)];
|
||||
_description_1_label.textAlignment = NSTextAlignmentCenter;
|
||||
_description_1_label.backgroundColor = UIColorFromRGB(0x002840);
|
||||
_description_1_label.numberOfLines = 0;
|
||||
[_description_1_label setCornerRadius:11
|
||||
cornerMask:kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner];
|
||||
}
|
||||
return _description_1_label;
|
||||
}
|
||||
|
||||
- (UILabel *)description_2_label {
|
||||
if (!_description_2_label) {
|
||||
_description_2_label = [UILabel labelInitWithText:@""
|
||||
font:kFontRegular(12)
|
||||
textColor:UIColorRGBAlpha(0xD9E7F7, 0.5)];
|
||||
_description_2_label.textAlignment = NSTextAlignmentCenter;
|
||||
_description_2_label.backgroundColor = UIColorFromRGB(0x002840);
|
||||
_description_2_label.numberOfLines = 0;
|
||||
[_description_2_label setCornerRadius:11
|
||||
cornerMask:kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner];
|
||||
|
||||
#if DEBUG
|
||||
_description_2_label.alpha = 0.3;
|
||||
#endif
|
||||
}
|
||||
return _description_2_label;
|
||||
}
|
||||
|
||||
- (UILabel *)statusLabel {
|
||||
if (!_statusLabel) {
|
||||
// TODO: 需要单独处理
|
||||
_statusLabel = [UILabel labelInitWithText:@"" font:kFontMedium(12) textColor:UIColorFromRGB(0x51281B)];
|
||||
_statusLabel.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
||||
gradientLayer.colors = @[(__bridge id)UIColorFromRGB(0xE29030).CGColor,
|
||||
(__bridge id)UIColorFromRGB(0xFCC074).CGColor];
|
||||
gradientLayer.startPoint = CGPointMake(0.0, 0.0); // 顶部中央
|
||||
gradientLayer.endPoint = CGPointMake(0.0, 1.0); // 底部中央
|
||||
gradientLayer.frame = CGRectMake(0, 0, 80, 22); // 设置渐变图层大小
|
||||
[_statusLabel.layer insertSublayer:gradientLayer atIndex:0];
|
||||
|
||||
[_statusLabel setCornerRadius:10 cornerMask:kCALayerMinXMinYCorner | kCALayerMaxXMaxYCorner];
|
||||
}
|
||||
return _statusLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface ShoppingMallCategoryCard : UIView
|
||||
@@ -111,7 +297,7 @@
|
||||
@property (nonatomic, strong) UIScrollView *container2ScrollView;
|
||||
@property (nonatomic, strong) NSMutableArray<ShoppingMallCategoryCard *> *itemViews1;
|
||||
@property (nonatomic, strong) NSMutableArray<UICollectionView *> *itemViews2;
|
||||
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, NSArray *> *dataCache; // 缓存每页数据
|
||||
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, NSArray <DressUpShopModel *>*> *dataCache; // 缓存每页数据
|
||||
@property (nonatomic, strong) NSMutableSet<NSNumber *> *requestedPages; // 记录已经请求的数据页
|
||||
|
||||
@end
|
||||
@@ -190,9 +376,6 @@
|
||||
|
||||
// 添加 item view-2 到 container2ScrollView
|
||||
for (int i = 0; i < items.count; i++) {
|
||||
// UIView *itemView2 = [[UIView alloc] initWithFrame:CGRectMake(i * screenWidth, 0, screenWidth, self.container2ScrollView.frame.size.height)];
|
||||
// itemView2.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((screenWidth-30) / 2 - 10, kGetScaleWidth(244));
|
||||
layout.minimumInteritemSpacing = 10;
|
||||
@@ -206,6 +389,7 @@
|
||||
collectionView.backgroundColor = [UIColor clearColor];
|
||||
collectionView.tag = i;
|
||||
[collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
|
||||
[collectionView registerClass:[ShoppingMallItemCard class] forCellWithReuseIdentifier:@"ShoppingMallItemCard"];
|
||||
[self.container2ScrollView addSubview:collectionView];
|
||||
[self.itemViews2 addObject:collectionView];
|
||||
}
|
||||
@@ -231,10 +415,13 @@
|
||||
|
||||
// 使用外部提供的回调或代理来请求数据
|
||||
if (self.fetchDataForPage) {
|
||||
NSDictionary *itemDic = [self.items xpSafeObjectAtIndex:pageIndex];
|
||||
NSNumber *type = [itemDic allValues].firstObject;
|
||||
@kWeakify(self);
|
||||
self.fetchDataForPage(pageIndex, ^(NSArray *data) {
|
||||
self.fetchDataForPage(type.integerValue, ^(NSArray <DressUpShopModel *>*data) {
|
||||
@kStrongify(self);
|
||||
if (self) {
|
||||
|
||||
// 更新数据到对应的 itemView-2
|
||||
[self updateContainer2WithData:data atIndex:pageIndex];
|
||||
self.dataCache[@(pageIndex)] = data; // 缓存数据
|
||||
@@ -284,8 +471,11 @@
|
||||
}
|
||||
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
|
||||
cell.backgroundColor = [UIColor colorWithRed:arc4random()%255/255.0f green:arc4random()%255/255.0f blue:arc4random()%255/255.0f alpha:1]; // Placeholder color
|
||||
ShoppingMallItemCard *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ShoppingMallItemCard"
|
||||
forIndexPath:indexPath];
|
||||
NSArray *data = self.dataCache[@(collectionView.tag)];
|
||||
cell.cellModel = [data xpSafeObjectAtIndex:indexPath.row];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
@@ -7,13 +7,14 @@
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
#import "DressUpShopModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ShoppingMallDataPresent : BaseMvpPresenter
|
||||
/// 获取装扮商城列表
|
||||
/// @param type 类型 0:铭牌,1:头饰,2:座驾,3:资料卡,4:聊天气泡
|
||||
- (void)loadCategoryItems:(NSInteger)type
|
||||
success:(void(^)(id obj))success
|
||||
success:(void(^)(NSArray <DressUpShopModel *>* array))success
|
||||
failure:(void(^)(NSError *error))failure;
|
||||
|
||||
- (void)buyItem:(NSString *)itemID
|
||||
|
@@ -11,12 +11,13 @@
|
||||
@implementation ShoppingMallDataPresent
|
||||
|
||||
- (void)loadCategoryItems:(NSInteger)type
|
||||
success:(nonnull void (^)(id _Nonnull))success
|
||||
success:(nonnull void (^)(NSArray <DressUpShopModel *>* array))success
|
||||
failure:(nonnull void (^)(NSError * _Nonnull))failure{
|
||||
|
||||
[Api requestDressUpShopList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
if (success) {
|
||||
success(data.data);
|
||||
NSArray *array = [DressUpShopModel modelsWithArray:data.data];
|
||||
success(array);
|
||||
}
|
||||
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
if (failure) {
|
||||
|
@@ -55,16 +55,14 @@
|
||||
}
|
||||
|
||||
- (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)];
|
||||
}
|
||||
|
||||
[self.presenter loadCategoryItems:pageIndex success:^(NSArray <DressUpShopModel *>* array) {
|
||||
if (completion) {
|
||||
completion(data);
|
||||
completion(array);
|
||||
}
|
||||
});
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
// TODO: 增加错误处理
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -28,6 +28,27 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///是否限时 0:限时,1:不限时
|
||||
@property (nonatomic, assign) NSInteger dressLimitStatus;
|
||||
|
||||
//"装扮动效图片"
|
||||
@property (nonatomic, copy) NSString *effect;
|
||||
|
||||
// "折扣价格"
|
||||
@property (nonatomic, assign) CGFloat discountPrice;
|
||||
|
||||
|
||||
// "vip等级"
|
||||
@property (nonatomic, assign) NSInteger vipLevel;
|
||||
|
||||
// "vip等级对应的折扣百分比 * 100"
|
||||
@property (nonatomic, assign) CGFloat discount;
|
||||
|
||||
// "贵族限定,0-无限制,1,2,3,4..."
|
||||
@property (nonatomic, assign) NSInteger vipLimit;
|
||||
|
||||
// "获得方式,1-普通,2-活动"
|
||||
@property (nonatomic, assign) NSInteger obtainWay;
|
||||
|
||||
- (NSMutableAttributedString *)pricePerDay;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -13,4 +13,38 @@
|
||||
return @{@"dressUpId": @"id"};
|
||||
}
|
||||
|
||||
- (NSMutableAttributedString *)pricePerDay {
|
||||
// 创建一个 NSMutableAttributedString 来存放最终的结果
|
||||
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
||||
|
||||
// 1. 添加金币图片
|
||||
NSTextAttachment *coinAttachment = [[NSTextAttachment alloc] init];
|
||||
coinAttachment.image = kImage(@"moli_money_icon"); // 替换为你的金币图片名称
|
||||
coinAttachment.bounds = CGRectMake(0, -2, 18, 18); // 设置图片大小和位置,偏移量适当调整
|
||||
NSAttributedString *coinString = [NSAttributedString attributedStringWithAttachment:coinAttachment];
|
||||
[attributedString appendAttributedString:coinString];
|
||||
|
||||
// 2. 添加空格
|
||||
NSAttributedString *spaceString = [[NSAttributedString alloc] initWithString:@" "];
|
||||
[attributedString appendAttributedString:spaceString];
|
||||
|
||||
// 3. 添加 price 文本,字体加粗,颜色 #F8CE1F,字体大小 25
|
||||
NSDictionary *priceAttributes = @{
|
||||
NSFontAttributeName: kFontSemibold(15),
|
||||
NSForegroundColorAttributeName: UIColorFromRGB(0xF8CE1F)
|
||||
};
|
||||
NSAttributedString *priceString = [[NSAttributedString alloc] initWithString:@(self.dressPrice).stringValue attributes:priceAttributes];
|
||||
[attributedString appendAttributedString:priceString];
|
||||
|
||||
// 4. 添加 day 文本,字体常规,颜色 #F8CE1F,字体大小 12
|
||||
NSDictionary *dayAttributes = @{
|
||||
NSFontAttributeName: kFontRegular(12),
|
||||
NSForegroundColorAttributeName: UIColorFromRGB(0xF8CE1F)
|
||||
};
|
||||
NSAttributedString *dayString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"/%ldD", (long)self.dressDay] attributes:dayAttributes];
|
||||
[attributedString appendAttributedString:dayString];
|
||||
|
||||
return attributedString;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -62,9 +62,9 @@
|
||||
return [RACSignal return:nil];
|
||||
}];
|
||||
|
||||
RACSignal *bannerSignal_2 = [banner_2 catch:^RACSignal *(NSError *error) {
|
||||
return [RACSignal return:nil];
|
||||
}];
|
||||
// RACSignal *bannerSignal_2 = [banner_2 catch:^RACSignal *(NSError *error) {
|
||||
// return [RACSignal return:nil];
|
||||
// }];
|
||||
|
||||
RACSignal *menuSignal = [menu catch:^RACSignal *(NSError *error) {
|
||||
return [RACSignal return:nil];
|
||||
|
@@ -166,10 +166,11 @@
|
||||
|
||||
#pragma mark -
|
||||
- (void)didTapMineButton {
|
||||
#if DEBUG
|
||||
ShoppingMallViewController *vc = [[ShoppingMallViewController alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
return;
|
||||
|
||||
#endif
|
||||
|
||||
[self.pageContainer setViewControllers:@[self.viewControllers[1]]
|
||||
direction:UIPageViewControllerNavigationDirectionReverse
|
||||
|
@@ -3999,3 +3999,8 @@ ineHeadView12" = "الحمل";
|
||||
"1.0.18_28" = "كن في اي بي%@، يمكنك الحصول على %@ حصص كل يوم، والدردشة بشكل خاص مع المستخدمين مجانًا، جرب ذلك؟";
|
||||
"1.0.18_29" = "لقد قمت بالدردشة مع 1000 شخص اليوم، يرجى المحاولة مرة أخرى غدًا.";
|
||||
"1.0.18_30" = "%@كن في اي بي";
|
||||
|
||||
"1.0.30_text_1" = "VIP Enjoy Discounts";
|
||||
"1.0.30_text_2" = "Only get by event, cannot buy";
|
||||
"1.0.30_text_3" = "Exclusive for VIP%@";
|
||||
"1.0.30_text_4" = "Limited";
|
||||
|
@@ -3792,3 +3792,8 @@
|
||||
"1.0.18_28" = "Be %@, you can get %@ quotas every day, chat privately with users for free, try it?";
|
||||
"1.0.18_29" = "You have chatted with 1,000 people today, please try again tomorrow.";
|
||||
"1.0.18_30" = "Be VIP%@";
|
||||
|
||||
"1.0.30_text_1" = "VIP Enjoy Discounts";
|
||||
"1.0.30_text_2" = "Only get by event, cannot buy";
|
||||
"1.0.30_text_3" = "Exclusive for VIP%@";
|
||||
"1.0.30_text_4" = "Limited";
|
||||
|
@@ -3578,3 +3578,8 @@
|
||||
"1.0.18_28" = "%@ olun, her gün %@ kota alabilirsiniz, kullanıcılarla özel olarak ücretsiz sohbet edebilirsiniz, dener misiniz?";
|
||||
"1.0.18_29" = "Bugün 1000 kişiyle sohbet ettiniz, lütfen yarın tekrar deneyin.";
|
||||
"1.0.18_30" = "VIP%@ olun";
|
||||
|
||||
"1.0.30_text_1" = "VIP Enjoy Discounts";
|
||||
"1.0.30_text_2" = "Only get by event, cannot buy";
|
||||
"1.0.30_text_3" = "Exclusive for VIP%@";
|
||||
"1.0.30_text_4" = "Limited";
|
||||
|
@@ -3450,3 +3450,8 @@
|
||||
"1.0.18_28" = "成為%@,每天可獲得%@個配額,免費與用戶私聊,試試看嗎?";
|
||||
"1.0.18_29" = "你今天已經與1000人聊天,請明天再試。";
|
||||
"1.0.18_30" = "成為VIP%@";
|
||||
|
||||
"1.0.30_text_1" = "VIP Enjoy Discounts";
|
||||
"1.0.30_text_2" = "Only get by event, cannot buy";
|
||||
"1.0.30_text_3" = "Exclusive for VIP%@";
|
||||
"1.0.30_text_4" = "Limited";
|
||||
|