修改了心愿礼物修改的时候显示错误

This commit is contained in:
fengshuo
2022-10-25 11:33:51 +08:00
parent 083e820403
commit d59f952a65
4 changed files with 88 additions and 17 deletions

View File

@@ -1584,10 +1584,11 @@
#pragma mark - #pragma mark -
- (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment { - (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment {
CGFloat x = random() % (int)(KScreenWidth - 200);
CGFloat y= random() % 40 + kNavigationHeight;
if (self.wishGiftEffectView.superview == nil) { if (self.wishGiftEffectView.superview == nil) {
[self.lowLevelView addSubview:self.wishGiftEffectView]; [self.lowLevelView addSubview:self.wishGiftEffectView];
CGFloat x = random() % 300;
CGFloat y= random() % 20 + kNavigationHeight;
[self.wishGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { [self.wishGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(x); make.left.mas_equalTo(x);
make.top.mas_equalTo(y); make.top.mas_equalTo(y);
@@ -1595,6 +1596,13 @@
make.height.mas_equalTo(167); make.height.mas_equalTo(167);
}]; }];
} }
[self.wishGiftEffectView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(x);
make.top.mas_equalTo(y);
}];
[self.parser parseWithNamed:@"room_wish_gift_sendCelebrate" inBundle:NSBundle.mainBundle completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { [self.parser parseWithNamed:@"room_wish_gift_sendCelebrate" inBundle:NSBundle.mainBundle completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
self.wishGiftEffectView.alpha = 1; self.wishGiftEffectView.alpha = 1;
self.wishGiftEffectView.loops = 1; self.wishGiftEffectView.loops = 1;
@@ -1661,6 +1669,9 @@
} else if(container == self.luckyVapGiftEffectView) { } else if(container == self.luckyVapGiftEffectView) {
[self.luckyVapGiftEffectView removeFromSuperview]; [self.luckyVapGiftEffectView removeFromSuperview];
self.luckyVapGiftEffectView = nil; self.luckyVapGiftEffectView = nil;
} else if(container == self.wishGiftEffectView) {
[self.wishGiftEffectView removeFromSuperview];
self.wishGiftEffectView = nil;
} }
}); });
} }

View File

@@ -10,6 +10,12 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class WishGiftInfoModel; @class WishGiftInfoModel;
@interface XPWishGiftCreateItemViewController : MvpViewController @interface XPWishGiftCreateItemViewController : MvpViewController
///初级礼物
@property (nonatomic,strong) NSArray *levelOneGiftList;
///中级礼物
@property (nonatomic,strong) NSArray *levelTwoGiftList;
///高级礼物
@property (nonatomic,strong) NSArray *levelThirdGiftList;
///房主的uid ///房主的uid
@property (nonatomic,strong) NSString *roomUid; @property (nonatomic,strong) NSString *roomUid;

View File

@@ -47,12 +47,6 @@
@property (nonatomic,strong) WishGiftInfoModel *levleInfo; @property (nonatomic,strong) WishGiftInfoModel *levleInfo;
/// ///
@property (nonatomic,strong) WishGiftInfoModel *giftInfo; @property (nonatomic,strong) WishGiftInfoModel *giftInfo;
///
@property (nonatomic,strong) NSArray *levelOneGiftList;
///
@property (nonatomic,strong) NSArray *levelTwoGiftList;
///
@property (nonatomic,strong) NSArray *levelThirdGiftList;
@end @end
@implementation XPWishGiftCreateItemViewController @implementation XPWishGiftCreateItemViewController
@@ -77,10 +71,23 @@
self.levleInfo = self.levelLists.firstObject; self.levleInfo = self.levelLists.firstObject;
[self handleLevleDatasource:self.levleInfo.level]; [self handleLevleDatasource:self.levleInfo.level];
[self.levelView configDefaultInfo:self.levleInfo]; [self.levelView configDefaultInfo:self.levleInfo];
if (self.levelOneGiftList.count > 0) {
self.giftInfo = self.levelOneGiftList.firstObject;
[self.giftView configDefaultInfo:self.giftInfo];
[self handleGiftDatasource:self.levelOneGiftList giftId:self.giftInfo.giftId];;
} }
}
[self loadWishGiftLevelList];
}
- (void)loadWishGiftLevelList {
if (self.levelOneGiftList.count <= 0) {
[self.presenter wishGiftConfigList:self.roomUid level:@"1"]; [self.presenter wishGiftConfigList:self.roomUid level:@"1"];
} else if(self.levelTwoGiftList.count <= 0) {
[self.presenter wishGiftConfigList:self.roomUid level:@"2"]; [self.presenter wishGiftConfigList:self.roomUid level:@"2"];
} else if(self.levelThirdGiftList.count <= 0) {
[self.presenter wishGiftConfigList:self.roomUid level:@"3"]; [self.presenter wishGiftConfigList:self.roomUid level:@"3"];
}
} }
- (void)initSubViews { - (void)initSubViews {
@@ -254,10 +261,19 @@
[self.giftView configDefaultInfo:self.giftInfo]; [self.giftView configDefaultInfo:self.giftInfo];
[self handleGiftDatasource:self.levelOneGiftList giftId:self.giftInfo.giftId];; [self handleGiftDatasource:self.levelOneGiftList giftId:self.giftInfo.giftId];;
} }
if (self.modifiGiftInfo) {
[self handleGiftDatasource:self.levelThirdGiftList giftId:_modifiGiftInfo.giftId];
}
} else if (level.intValue == 2) { } else if (level.intValue == 2) {
self.levelTwoGiftList = list; self.levelTwoGiftList = list;
if (self.modifiGiftInfo) {
[self handleGiftDatasource:self.levelTwoGiftList giftId:_modifiGiftInfo.giftId];
}
} else { } else {
self.levelThirdGiftList = list; self.levelThirdGiftList = list;
if (self.modifiGiftInfo) {
[self handleGiftDatasource:self.levelThirdGiftList giftId:_modifiGiftInfo.giftId];
}
} }
} }
@@ -312,7 +328,6 @@
_modifiGiftInfo = modifiGiftInfo; _modifiGiftInfo = modifiGiftInfo;
if (_modifiGiftInfo) { if (_modifiGiftInfo) {
WishGiftInfoModel * levelInfo; WishGiftInfoModel * levelInfo;
for (WishGiftInfoModel * info in self.levelLists) { for (WishGiftInfoModel * info in self.levelLists) {
if (info.level == _modifiGiftInfo.level) { if (info.level == _modifiGiftInfo.level) {
levelInfo = info; levelInfo = info;
@@ -327,12 +342,24 @@
[self handleLevleDatasource:levelInfo.level]; [self handleLevleDatasource:levelInfo.level];
/// ///
if (_modifiGiftInfo.level == WishGiftLevel_Normal) { if (_modifiGiftInfo.level == WishGiftLevel_Normal) {
if (self.levelOneGiftList.count <=0) {
[self.presenter wishGiftConfigList:self.roomUid level:@"1"];
} else {
[self handleGiftDatasource:self.levelOneGiftList giftId:_modifiGiftInfo.giftId]; [self handleGiftDatasource:self.levelOneGiftList giftId:_modifiGiftInfo.giftId];
}
} else if (_modifiGiftInfo.level == WishGiftLevel_Middle) { } else if (_modifiGiftInfo.level == WishGiftLevel_Middle) {
if (self.levelTwoGiftList.count <= 0) {
[self.presenter wishGiftConfigList:self.roomUid level:@"2"];
} else {
[self handleGiftDatasource:self.levelTwoGiftList giftId:_modifiGiftInfo.giftId]; [self handleGiftDatasource:self.levelTwoGiftList giftId:_modifiGiftInfo.giftId];
}
} else {
if (self.levelThirdGiftList.count <= 0) {
[self.presenter wishGiftConfigList:self.roomUid level:@"3"];
} else { } else {
[self handleGiftDatasource:self.levelThirdGiftList giftId:_modifiGiftInfo.giftId]; [self handleGiftDatasource:self.levelThirdGiftList giftId:_modifiGiftInfo.giftId];
} }
}
self.textField.text = [NSString stringWithFormat:@"%ld", _modifiGiftInfo.targetNum]; self.textField.text = [NSString stringWithFormat:@"%ld", _modifiGiftInfo.targetNum];
self.number = (int)_modifiGiftInfo.targetNum; self.number = (int)_modifiGiftInfo.targetNum;

View File

@@ -40,6 +40,12 @@
@property (nonatomic,strong) NSString *roomUid; @property (nonatomic,strong) NSString *roomUid;
/// ///
@property (nonatomic,weak) id<RoomHostDelegate> delegate; @property (nonatomic,weak) id<RoomHostDelegate> delegate;
///
@property (nonatomic,strong) NSArray *levelOneGiftList;
///
@property (nonatomic,strong) NSArray *levelTwoGiftList;
///
@property (nonatomic,strong) NSArray *levelThirdGiftList;
@end @end
@implementation XPWishGiftCreateViewController @implementation XPWishGiftCreateViewController
@@ -52,7 +58,7 @@
self.delegate = delegate; self.delegate = delegate;
self.roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid]; self.roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
[self initWishGiftList]; [self initWishGiftList];
[self initWishLevleGiftList];
RoomInfoModel * roomInfo = [self.delegate getRoomInfo]; RoomInfoModel * roomInfo = [self.delegate getRoomInfo];
if (roomInfo.hasOpenWishGift) { if (roomInfo.hasOpenWishGift) {
self.addWishButton.hidden = YES; self.addWishButton.hidden = YES;
@@ -75,6 +81,12 @@
[self.presenter wishGiftList:self.roomUid]; [self.presenter wishGiftList:self.roomUid];
} }
- (void)initWishLevleGiftList {
[self.presenter wishGiftConfigList:self.roomUid level:@"1"];
[self.presenter wishGiftConfigList:self.roomUid level:@"2"];
[self.presenter wishGiftConfigList:self.roomUid level:@"3"];
}
- (void)initSubViews { - (void)initSubViews {
self.title = @"创建心愿单"; self.title = @"创建心愿单";
[self.view addSubview:self.configLabel]; [self.view addSubview:self.configLabel];
@@ -151,6 +163,9 @@
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didUpdateWishGift:(WishGiftInfoModel *)info { - (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didUpdateWishGift:(WishGiftInfoModel *)info {
XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init]; XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init];
createItemVC.roomUid = self.roomUid; createItemVC.roomUid = self.roomUid;
createItemVC.levelOneGiftList = self.levelOneGiftList;
createItemVC.levelTwoGiftList = self.levelTwoGiftList;
createItemVC.levelThirdGiftList = self.levelThirdGiftList;
createItemVC.modifiGiftInfo = info; createItemVC.modifiGiftInfo = info;
@kWeakify(self); @kWeakify(self);
createItemVC.Dismiss = ^(BOOL finish) { createItemVC.Dismiss = ^(BOOL finish) {
@@ -175,6 +190,16 @@
[self initWishGiftList]; [self initWishGiftList];
} }
- (void)wishGiftConfigListSucces:(NSArray *)list level:(NSString *)level {
if (level.intValue == 1) {
self.levelOneGiftList = list;
} else if (level.intValue == 2) {
self.levelTwoGiftList = list;
} else {
self.levelThirdGiftList = list;
}
}
#pragma mark - Event Response #pragma mark - Event Response
- (void)rightButtonAction:(UIButton *)sender { - (void)rightButtonAction:(UIButton *)sender {
XPWishGiftHistoryViewController * historyVC = [[XPWishGiftHistoryViewController alloc] init]; XPWishGiftHistoryViewController * historyVC = [[XPWishGiftHistoryViewController alloc] init];
@@ -199,6 +224,9 @@
- (void)addWishButtonAction:(UIButton *)sender { - (void)addWishButtonAction:(UIButton *)sender {
XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init]; XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init];
createItemVC.levelOneGiftList = self.levelOneGiftList;
createItemVC.levelTwoGiftList = self.levelTwoGiftList;
createItemVC.levelThirdGiftList = self.levelThirdGiftList;
createItemVC.roomUid = self.roomUid; createItemVC.roomUid = self.roomUid;
@kWeakify(self); @kWeakify(self);
createItemVC.Dismiss = ^(BOOL finish) { createItemVC.Dismiss = ^(BOOL finish) {
@@ -210,7 +238,6 @@
} }
- (void)createButtonAction:(UIButton *)sender { - (void)createButtonAction:(UIButton *)sender {
TTAlertConfig * config = [[TTAlertConfig alloc] init]; TTAlertConfig * config = [[TTAlertConfig alloc] init];
config.title = @""; config.title = @"";
config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除"; config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除";