修复bug

This commit is contained in:
liyuhua
2023-08-04 10:20:09 +08:00
parent 6a5b31c6d1
commit 347b4afe3e
3 changed files with 6 additions and 36 deletions

View File

@@ -197,7 +197,7 @@
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
if([self.tabId isEqualToString:@"recommend"]){
return section == 0 ? UIEdgeInsetsMake(kGetScaleWidth(8), kGetScaleWidth(16), 0, kGetScaleWidth(16)):UIEdgeInsetsMake(0, 0, 0, 0);
return section == 0 ? UIEdgeInsetsMake(kGetScaleWidth(8), kGetScaleWidth(15), 0, kGetScaleWidth(15)):UIEdgeInsetsMake(0, 0, 0, 0);
}
return UIEdgeInsetsMake(0, 0, 0, 0);
}

View File

@@ -55,26 +55,11 @@
- (void)setCardModel:(XPPrivilegeCardItemModel *)cardModel{
_cardModel = cardModel;
_titleVeiw.text = _cardModel.cardName;
if(_cardModel.checkTime != nil){
NSArray *curTimeList = [_cardModel.checkTime componentsSeparatedByString:@" "];
if(curTimeList.count > 0){
NSString *dailyTime = [self getTimeWtihCurTime:curTimeList.firstObject dailyTime:_cardModel.effectDay];
_timeView.text = [NSString stringWithFormat:@"有效期至:%@",dailyTime];
}
}
_timeView.text = [NSString stringWithFormat:@"有效期至:%@",_cardModel.expireTime];
_bgImageView.imageUrl = _cardModel.cardUrl;
_bgImageView.layer.borderWidth = _cardModel.isSelected ? 2 : 0;
}
-(NSString *)getTimeWtihCurTime:(NSString *)curTime dailyTime:(NSString *)dailyTime{
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier :@"zh_CN"]];
[inputFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *inputDate = [inputFormatter dateFromString:curTime];
NSDate *nextDate = [NSDate dateWithTimeInterval:(24*60*60*dailyTime.integerValue) sinceDate:inputDate];
NSDateComponents *comps = [calendar components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitWeekday|NSCalendarUnitDay fromDate:nextDate];
return [NSString stringWithFormat:@"%ld-%ld-%ld",comps.year,comps.month,comps.day];
}
#pragma mark -
- (NetImageView *)bgImageView{

View File

@@ -217,13 +217,7 @@
_nameView.attributedText =_cardModel.nameAtt;
_instructionsView.attributedText = _cardModel.instructionsAtt;
_useIDView.text = _cardModel.erbanNoStr;
if(_cardModel.checkTime != nil){
NSArray *curTimeList = [_cardModel.checkTime componentsSeparatedByString:@" "];
if(curTimeList.count > 0){
NSString *dailyTime = [self getTimeWtihCurTime:curTimeList.firstObject dailyTime:_cardModel.effectDay];
_timeView.text = [NSString stringWithFormat:@"有效期:%@ 至 %@",curTimeList.firstObject,dailyTime];
}
}
_timeView.text = [NSString stringWithFormat:@"有效期:%@ 至 %@",_cardModel.effectTime,_cardModel.expireTime];
@@ -234,16 +228,7 @@
return textAtt;
};
-(NSString *)getTimeWtihCurTime:(NSString *)curTime dailyTime:(NSString *)dailyTime{
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier :@"zh_CN"]];
[inputFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate *inputDate = [inputFormatter dateFromString:curTime];
NSDate *nextDate = [NSDate dateWithTimeInterval:(24*60*60*dailyTime.integerValue) sinceDate:inputDate];
NSDateComponents *comps = [calendar components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitWeekday|NSCalendarUnitDay fromDate:nextDate];
return [NSString stringWithFormat:@"%ld-%ld-%ld",comps.year,comps.month,comps.day];
}
-(void)againEditAction{
if(self.delegate && [self.delegate respondsToSelector:@selector(againEditPrivilegeCardWithCell:cardModel:)]){
[self.delegate againEditPrivilegeCardWithCell:self cardModel:self.cardModel];