h5跳转房间打开礼物面板

This commit is contained in:
chenguilong
2022-08-04 18:22:31 +08:00
parent 03fe19f47f
commit 0650dcdc01
11 changed files with 119 additions and 9 deletions

View File

@@ -52,6 +52,8 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
///当前用户贵族等级
@property (nonatomic, assign) NSInteger curUserNobleLevel;
@property (nonatomic, copy) NSString *defaultSelectGiftId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -69,6 +69,8 @@
@property (nonatomic,assign) GiftSegmentType segmentType;
///
@property (nonatomic,strong) GiftInfoModel *lastSelectGift;
@property (nonatomic, assign) NSInteger selectIndex;
@end
@implementation XPGiftInfoView
@@ -351,8 +353,17 @@
break;
}
if (self.datasource.count > 0) {
GiftInfoModel * gift = [self.datasource firstObject];
[self dealSelectGift:gift];
if (self.defaultSelectGiftId.length) {
for (GiftInfoModel * gift in self.datasource) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
[self dealSelectGift:gift];
self.selectIndex = [self.datasource indexOfObject:gift];
}
}
} else {
GiftInfoModel * gift = [self.datasource firstObject];
[self dealSelectGift:gift];
}
} else {
self.playRuleButton.hidden = YES;
}
@@ -393,7 +404,34 @@
self.giftLuckyArray = luckyArray;
self.giftNobleArray = nobleArray;
self.giftWeekStarArray = weekStarArray;
self.segmentType = GiftSegmentType_Normal;
if (self.defaultSelectGiftId.length) {
for (GiftInfoModel *gift in self.normalOriginArray) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
self.segmentType = GiftSegmentType_Normal;
break;
}
}
for (GiftInfoModel *gift in self.giftLuckyArray) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
self.segmentType = GiftSegmentType_Lucky;
break;
}
}
for (GiftInfoModel *gift in self.giftNobleArray) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
self.segmentType = GiftSegmentType_Noble;
break;
}
}
for (GiftInfoModel *gift in self.giftWeekStarArray) {
if (gift.giftId == [self.defaultSelectGiftId integerValue]) {
self.segmentType = GiftSegmentType_WeekStar;
break;
}
}
} else {
self.segmentType = GiftSegmentType_Normal;
}
}
- (void)setPackOriginArray:(NSArray *)packOriginArray {
@@ -413,6 +451,10 @@
}
}
- (void)setDefaultSelectGiftId:(NSString *)defaultSelectGiftId {
_defaultSelectGiftId = defaultSelectGiftId;
}
- (UIStackView *)segmentStackView {
if (!_segmentStackView) {
_segmentStackView = [[UIStackView alloc] init];

View File

@@ -31,6 +31,9 @@ typedef NS_ENUM(NSInteger, SendGiftType) {
///完全封闭的一个组件
- (void)configGiftUsers:(NSArray<XPGiftUserInfoModel *> *)users;
///选中的礼物id
@property (nonatomic, copy) NSString *selectGiftId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -487,6 +487,11 @@
self.giftInfoView.usingplaceType = _usingplaceType;
}
- (void)setSelectGiftId:(NSString *)selectGiftId {
_selectGiftId = selectGiftId;
self.giftInfoView.defaultSelectGiftId = selectGiftId;
}
- (UIView *)topView {
if (!_topView) {
_topView = [[UIView alloc] init];