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

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 -
- (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment {
CGFloat x = random() % (int)(KScreenWidth - 200);
CGFloat y= random() % 40 + kNavigationHeight;
if (self.wishGiftEffectView.superview == nil) {
[self.lowLevelView addSubview:self.wishGiftEffectView];
CGFloat x = random() % 300;
CGFloat y= random() % 20 + kNavigationHeight;
[self.wishGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(x);
make.top.mas_equalTo(y);
@@ -1595,6 +1596,13 @@
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.wishGiftEffectView.alpha = 1;
self.wishGiftEffectView.loops = 1;
@@ -1661,6 +1669,9 @@
} else if(container == self.luckyVapGiftEffectView) {
[self.luckyVapGiftEffectView removeFromSuperview];
self.luckyVapGiftEffectView = nil;
} else if(container == self.wishGiftEffectView) {
[self.wishGiftEffectView removeFromSuperview];
self.wishGiftEffectView = nil;
}
});
}

View File

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

View File

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

View File

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