完成
This commit is contained in:
@@ -381,6 +381,7 @@
|
||||
[weakSelf.sendView hide];
|
||||
self->_sendView = nil;
|
||||
};
|
||||
self.sendView.vc = weakSelf.viewController;
|
||||
[self.sendView showInView:KEYWINDOW];
|
||||
|
||||
// al.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
|
||||
@@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong)NSString* auctionId;
|
||||
/// 交友房助力id
|
||||
@property (nonatomic,strong)NSString* heartId;
|
||||
/// 跳转活动
|
||||
@property (nonatomic,copy)void(^jumpActivityGiftBlock)(QXGiftModel *gift,NSString*userIds);
|
||||
|
||||
@property (nonatomic,copy)void(^sendSuccessBlock)(NSString*dynamicId);
|
||||
|
||||
@@ -60,8 +62,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSString *giftLabelId;
|
||||
@property (nonatomic,strong)NSString *roomId;
|
||||
@property (nonatomic,assign)NSInteger selectedIndex;
|
||||
@property (nonatomic,copy)void(^selectetGiftBlock)(QXGiftModel *gift);
|
||||
@property (nonatomic,assign)QXSendGiftViewType type;
|
||||
@end
|
||||
|
||||
@interface QXSendGiftUserView : UIView<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
|
||||
@@ -90,6 +90,8 @@
|
||||
[_pitUserListView removeFromSuperview];
|
||||
_pitUserListView = nil;
|
||||
}
|
||||
self.cornLabel.textColor = RGB16(0x333333);
|
||||
[self.countBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
self.bgView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429)+kSafeAreaBottom);
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
self.bgImageView.hidden = YES;
|
||||
@@ -200,7 +202,7 @@
|
||||
|
||||
self.cornLabel = [[UILabel alloc] init];
|
||||
self.cornLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.cornLabel.textColor = QXConfig.textColor;
|
||||
self.cornLabel.textColor = RGB16(0xffffff);
|
||||
self.cornLabel.text = @"0";
|
||||
[self.bgView addSubview:self.cornLabel];
|
||||
[self.cornLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -238,7 +240,7 @@
|
||||
|
||||
self.countBtn = [[UIButton alloc] init];
|
||||
[self.countBtn setTitle:@"X1" forState:(UIControlStateNormal)];
|
||||
[self.countBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.countBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
self.countBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.countBtn addTarget:self action:@selector(selectedCount:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.sendBgView addSubview:self.countBtn];
|
||||
@@ -283,10 +285,12 @@
|
||||
_dynamicId = dynamicId;
|
||||
self.userListView.dynamicId = dynamicId;
|
||||
self.rechargeBtn.hidden = !QXGlobal.shareGlobal.isOpenRecharge;
|
||||
[self getMyWallet];
|
||||
}
|
||||
/// 发送礼物
|
||||
-(void)sendAction{
|
||||
MJWeakSelf
|
||||
__block NSString *type = self.categoryView.selectedIndex==0?@"2":@"1";
|
||||
if (self.type == QXSendGiftViewTypeRoom) {
|
||||
if (self.giftModel==nil) {
|
||||
showToast(@"请选择礼物");
|
||||
@@ -300,11 +304,13 @@
|
||||
self.auctionId = @"";
|
||||
/// 2为背包
|
||||
NSString *userId = [self.pitUserListView.selectedArray componentsJoinedByString:@","];
|
||||
NSString *type = self.categoryView.selectedIndex==0?@"2":@"1";
|
||||
|
||||
[QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:userId heart_id:self.heartId type:type pit_number:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
if (weakSelf.roomSendSuccessBlock) {
|
||||
weakSelf.roomSendSuccessBlock(self.type,weakSelf.giftModel,userId,@"");
|
||||
if (type.intValue == 1) {
|
||||
if (weakSelf.roomSendSuccessBlock) {
|
||||
weakSelf.roomSendSuccessBlock(self.type,weakSelf.giftModel,userId,@"");
|
||||
}
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg)
|
||||
@@ -312,11 +318,12 @@
|
||||
}else if (self.type == QXSendGiftViewTypeAuction) {
|
||||
self.heartId = @"";
|
||||
/// 2为背包
|
||||
NSString *type = self.categoryView.selectedIndex==0?@"2":@"1";
|
||||
[QXMineNetwork roomAuctionJoinWithAuctionId:self.auctionId user_id:[QXGlobal shareGlobal].loginModel.user_id gift_id:self.giftModel.gift_id num:self.giftCount type:type successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
if (weakSelf.roomSendSuccessBlock) {
|
||||
weakSelf.roomSendSuccessBlock(self.type,weakSelf.giftModel,[QXGlobal shareGlobal].loginModel.user_id,weakSelf.auctionId);
|
||||
if (type.intValue == 1) {
|
||||
if (weakSelf.roomSendSuccessBlock) {
|
||||
weakSelf.roomSendSuccessBlock(self.type,weakSelf.giftModel,[QXGlobal shareGlobal].loginModel.user_id,weakSelf.auctionId);
|
||||
}
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
@@ -328,8 +335,10 @@
|
||||
NSString *type = self.categoryView.selectedIndex==0?@"2":@"1";
|
||||
[QXMineNetwork roomSendGiftWithRoomId:self.roomId gift_id:self.giftModel.gift_id gift_num:self.giftCount to_uid:userId heart_id:self.heartId type:type pit_number:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf hide];
|
||||
if (weakSelf.roomSendSuccessBlock) {
|
||||
weakSelf.roomSendSuccessBlock(self.type,weakSelf.giftModel,userId,weakSelf.heartId);
|
||||
if (type.intValue == 1) {
|
||||
if (weakSelf.roomSendSuccessBlock) {
|
||||
weakSelf.roomSendSuccessBlock(self.type,weakSelf.giftModel,userId,weakSelf.heartId);
|
||||
}
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg)
|
||||
@@ -358,10 +367,12 @@
|
||||
MJWeakSelf
|
||||
switch (self.type) {
|
||||
case QXSendGiftViewTypeFind:{
|
||||
[self.viewController dismissViewControllerAnimated:YES completion:^{
|
||||
QXRechargeViewcController *vc = [[QXRechargeViewcController alloc] init];
|
||||
[weakSelf.vc.navigationController pushViewController:vc animated:YES];
|
||||
}];
|
||||
// [self.viewController dismissViewControllerAnimated:YES completion:^{
|
||||
[self hide];
|
||||
QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
||||
recharge.isPop = YES;
|
||||
[recharge showInView:KEYWINDOW];
|
||||
// }];
|
||||
}
|
||||
break;
|
||||
case QXSendGiftViewTypeRoom:{
|
||||
@@ -456,10 +467,24 @@
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXSendGiftCollectionView *subGiftView = [[QXSendGiftCollectionView alloc] initWithFrame:listContainerView.bounds];
|
||||
QXGiftLabelModel *md = self.titles[index];
|
||||
subGiftView.roomId = self.roomId;
|
||||
subGiftView.giftLabelId = md.id;
|
||||
subGiftView.type = self.type;
|
||||
MJWeakSelf
|
||||
subGiftView.selectetGiftBlock = ^(QXGiftModel * _Nonnull gift) {
|
||||
weakSelf.giftModel = gift;
|
||||
if ([gift.activities_id isEqualToString:@"5"]) {
|
||||
if (weakSelf.pitUserListView.selectedArray.count == 0) {
|
||||
showToast(@"请选择送礼对象");
|
||||
return;
|
||||
}
|
||||
NSString *userIds = [weakSelf.pitUserListView.selectedArray componentsJoinedByString:@","];
|
||||
if (weakSelf.jumpActivityGiftBlock) {
|
||||
weakSelf.jumpActivityGiftBlock(gift,userIds);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (gift.gift_bag_name.length > 0) {
|
||||
weakSelf.funnyView.hidden = NO;
|
||||
weakSelf.titleLabel.text = gift.gift_bag_name;
|
||||
@@ -493,13 +518,17 @@
|
||||
if (weakSelf.userListView.dataArray.count == 0) {
|
||||
return;
|
||||
}else{
|
||||
QXAlertViewController *al = (QXAlertViewController *)weakSelf.viewController;
|
||||
[al hideViewFinishBlock:^{
|
||||
// QXAlertViewController *al = (QXAlertViewController *)weakSelf.viewController;
|
||||
// [al hideViewFinishBlock:^{
|
||||
[weakSelf hide];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
QXGiveGiftListView *listView = [[QXGiveGiftListView alloc] init];
|
||||
listView.dynamicId = weakSelf.dynamicId;
|
||||
listView.vc = weakSelf.vc;
|
||||
[listView showInView:KEYWINDOW];
|
||||
}];
|
||||
});
|
||||
|
||||
// }];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -558,7 +587,7 @@
|
||||
-(void)getGiftListWithLabel:(NSString*)label{
|
||||
MJWeakSelf
|
||||
self.selectedIndex = -1;
|
||||
[QXMineNetwork giftListWithLabel:label successBlock:^(NSArray<QXGiftModel *> * _Nonnull list) {
|
||||
[QXMineNetwork giftListWithLabel:label roomId:self.roomId successBlock:^(NSArray<QXGiftModel *> * _Nonnull list) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.collectionView reloadData];
|
||||
@@ -586,19 +615,41 @@
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeLive;
|
||||
cell.roomGiftModel = self.dataArray[indexPath.row];
|
||||
if (self.selectedIndex == indexPath.row) {
|
||||
cell.selecteBtn.selected = YES;
|
||||
|
||||
if (self.type == QXSendGiftViewTypeFind) {
|
||||
cell.giftNameLabel.textColor = RGB16(0x333333);
|
||||
[cell.cornBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
if (self.selectedIndex == indexPath.row) {
|
||||
cell.selecteBtn.selected = YES;
|
||||
}else{
|
||||
cell.selecteBtn.selected = NO;
|
||||
}
|
||||
}else{
|
||||
cell.selecteBtn.selected = NO;
|
||||
if (self.selectedIndex == indexPath.row) {
|
||||
cell.selecteBtn.selected = YES;
|
||||
cell.giftNameLabel.textColor = RGB16(0x333333);
|
||||
[cell.cornBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
cell.selecteBtn.selected = NO;
|
||||
cell.giftNameLabel.textColor = RGB16(0xffffff);
|
||||
[cell.cornBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
}
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXGiftModel *model = self.dataArray[indexPath.row];
|
||||
if ([model.activities_id isEqualToString:@"5"]) {
|
||||
/// 要进入活动
|
||||
if (self.selectetGiftBlock) {
|
||||
self.selectetGiftBlock(model);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (indexPath.row == self.selectedIndex) {
|
||||
return;
|
||||
}
|
||||
self.selectedIndex = indexPath.row;
|
||||
QXGiftModel *model = self.dataArray[indexPath.row];
|
||||
if (self.selectetGiftBlock) {
|
||||
self.selectetGiftBlock(model);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user