新增勋章 VIP 控制相关的资源,包括 medals_control_vip4、medals_control_vip6、medals_control_vip7 和 medals_control_vip9 的 Contents.json 文件及其对应的 vip@3x.png 图片,保持代码结构一致性。

This commit is contained in:
edwinQQQ
2025-06-23 14:29:08 +08:00
parent 143ad115bc
commit a72c010b56
14 changed files with 191 additions and 21 deletions

View File

@@ -57,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface MineAllMedalModel : PIBaseModel
@property (nonatomic, copy) NSArray <MedalVo *> *allMedals;
@property (nonatomic, copy) NSArray <VipMedalSeatVo *>*vipMedalSeatVos;
@property (nonatomic, copy) NSDictionary <NSString *,NSArray *> *vipMedalSeatVos;
@property (nonatomic, copy) NSArray *useMedals;
@property (nonatomic, assign) NSInteger vipLevel;
@property (nonatomic, assign) NSInteger medalNum;

View File

@@ -44,7 +44,7 @@
+ (NSDictionary *)mj_objectClassInArray {
return @{
@"allMedals" : [MedalVo class],
@"vipMedalSeatVos" : [VipMedalSeatVo class],
// @"vipMedalSeatVos" : [VipMedalSeatVo class],
// @"allMedals" : [MedalVo class],
};
}

View File

@@ -53,12 +53,15 @@
}
- (void)mineAllMedals:(NSInteger)page {
@kWeakify(self);
[Api medalMineAll:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(mineAllMedalsSuccess:)]) {
MineAllMedalModel *m = [MineAllMedalModel modelWithJSON:data.data];
[[self getView] mineAllMedalsSuccess:m];
}
} fail:^(NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if ([[self getView] respondsToSelector:@selector(mineAllMedalsFailure)]) {
[[self getView] mineAllMedalsFailure];
}

View File

@@ -394,6 +394,28 @@ typedef enum : NSInteger {
- (void)userMedalsFailure {
[self endReresh];
// 退
switch (self.currentTabType) {
case MedalsCenterTab_TaskMedals:
if (self.currentPageTaskMedals > 1) {
self.currentPageTaskMedals--;
}
break;
case MedalsCenterTab_ActivityMedals:
if (self.currentPageActivityMedals > 1) {
self.currentPageActivityMedals--;
}
break;
case MedalsCenterTab_GloryMedals:
if (self.currentPageGloryMedals > 1) {
self.currentPageGloryMedals--;
}
break;
default:
break;
}
[self _updateDataSource:@[]];
}
@@ -404,6 +426,27 @@ typedef enum : NSInteger {
- (void)squareMedalsFailure {
[self endReresh];
// 退
switch (self.currentTabType) {
case MedalsCenterTab_TaskMedals:
if (self.currentPageTaskMedals > 1) {
self.currentPageTaskMedals--;
}
break;
case MedalsCenterTab_ActivityMedals:
if (self.currentPageActivityMedals > 1) {
self.currentPageActivityMedals--;
}
break;
case MedalsCenterTab_GloryMedals:
if (self.currentPageGloryMedals > 1) {
self.currentPageGloryMedals--;
}
break;
default:
break;
}
}
- (void)_updateOtherInfo:(UserMedalsModel *)userModel {
@@ -416,8 +459,10 @@ typedef enum : NSInteger {
- (void)_updateDataSource:(NSArray <MedalSeriesVo *>*)models {
if (models.count < 8) {
if (models.count < [self.presenter pageSize]) {
[self.medalsCollectionView.mj_footer endRefreshingWithNoMoreData];
} else {
[self.medalsCollectionView.mj_footer resetNoMoreData];
}
switch (self.currentTabType) {

View File

@@ -22,7 +22,9 @@
@property (nonatomic, assign) NSInteger medalsAreaPage;
@property (nonatomic, copy) NSArray <MedalVo *> *allMedalsVo;
@property (nonatomic, copy) NSArray <VipMedalSeatVo *> *vipSeatVo;
//@property (nonatomic, copy) NSArray <VipMedalSeatVo *> *vipSeatVo;
@property (nonatomic, copy) NSDictionary *vipSeatDic;
@property (nonatomic, assign) NSInteger minVipLevelForSeats;
@end
@@ -59,13 +61,13 @@
make.height.mas_equalTo(kGetScaleWidth(147));
}];
[self.controlAreaCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.controlAreaBG);
make.edges.mas_equalTo(self.controlAreaBG).insets(UIEdgeInsetsMake(15, 15, 15, 15));
}];
[self.contentArea addSubview:self.medalsAreaCollectionView];
[self.medalsAreaCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.controlAreaCollectionView.mas_bottom).offset(14);
make.leading.trailing.mas_equalTo(self.controlAreaCollectionView);
make.top.mas_equalTo(self.controlAreaBG.mas_bottom).offset(14);
make.leading.trailing.mas_equalTo(self.controlAreaBG);
make.bottom.mas_equalTo(self.contentArea);
}];
}
@@ -94,12 +96,18 @@
- (void)mineAllMedalsSuccess:(MineAllMedalModel *)model {
[self endRefresh];
self.vipSeatVo = model.vipMedalSeatVos;
self.allMedalsVo = model.allMedals;
// VIP level
self.minVipLevelForSeats = 0;
if (model.allMedals.count < [self.presenter pageSize]) {
// TODO: footer
[self.medalsAreaCollectionView.mj_footer endRefreshingWithNoMoreData];
} else {
[self.medalsAreaCollectionView.mj_footer resetNoMoreData];
}
self.vipSeatDic = model.vipMedalSeatVos;
self.allMedalsVo = model.allMedals;
[self.controlAreaCollectionView reloadData];
[self.medalsAreaCollectionView reloadData];
}
@@ -131,12 +139,33 @@
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
if (collectionView == self.controlAreaCollectionView) {
MedalsWearingControlCollectionViewCell *cell = [MedalsWearingControlCollectionViewCell cellFor:collectionView atIndexPath:indexPath];
for (VipMedalSeatVo *vo in self.vipSeatVo) {
if (vo.medalSeatNum-1 == indexPath.row) {
[cell updateVIPLevel:vo.vipLevel];
break;
// vipSeatDic updateVIPLevel
NSString *seatKey = [NSString stringWithFormat:@"%ld", (long)(indexPath.row + 1)];
NSArray *vipLevels = self.vipSeatDic[seatKey];
if (vipLevels && vipLevels.count > 0) {
// VIP level
NSInteger currentMinVipLevel = NSIntegerMax;
for (NSNumber *levelNum in vipLevels) {
NSInteger level = [levelNum integerValue];
if (level < currentMinVipLevel) {
currentMinVipLevel = level;
}
}
if (currentMinVipLevel != NSIntegerMax) {
// VIP level
if (self.minVipLevelForSeats == 0 || currentMinVipLevel < self.minVipLevelForSeats) {
self.minVipLevelForSeats = currentMinVipLevel;
}
[cell updateVIPLevel:currentMinVipLevel];
}
} else if (self.minVipLevelForSeats > 0) {
// vip seat voVIP level沿
[cell updateVIPLevel:self.minVipLevelForSeats];
}
return cell;
} else if (collectionView == self.medalsAreaCollectionView) {
MedalsWearingListCollectionViewCell *cell = [MedalsWearingListCollectionViewCell cellFor:collectionView atIndexPath:indexPath];
@@ -149,19 +178,17 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
MedalVo *vo = [self.allMedalsVo xpSafeObjectAtIndex:indexPath.row];
if (vo) {
[self.presenter updateMedalUseStatus:vo.medalId isUse:!vo.useStatus];
[self.presenter updateMedalUseStatus:vo.id isUse:!vo.useStatus];
}
}
#pragma mark - Refresh Actions
- (void)headerRefresh {
// TODO:
self.medalsAreaPage = 1;
[self loadMedals];
}
- (void)footerRefresh {
// TODO:
self.medalsAreaPage++;
[self loadMedals];
}