diff --git a/QXLive.xcodeproj/project.pbxproj b/QXLive.xcodeproj/project.pbxproj index 8e60cdd..d384f87 100644 --- a/QXLive.xcodeproj/project.pbxproj +++ b/QXLive.xcodeproj/project.pbxproj @@ -787,7 +787,11 @@ "$(inherited)", "$(SDKROOT)/usr/lib/swift", ); +<<<<<<< HEAD MARKETING_VERSION = 1.1.4; +======= + MARKETING_VERSION = 1.1.6; +>>>>>>> dev PRODUCT_BUNDLE_IDENTIFIER = com.qxcm.qxlive; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -853,7 +857,11 @@ "$(inherited)", "$(SDKROOT)/usr/lib/swift", ); +<<<<<<< HEAD MARKETING_VERSION = 1.1.4; +======= + MARKETING_VERSION = 1.1.6; +>>>>>>> dev PRODUCT_BUNDLE_IDENTIFIER = com.qxcm.qxlive; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/QXLive/Base/QXBaseViewController.h b/QXLive/Base/QXBaseViewController.h index 82fe025..9e34b88 100644 --- a/QXLive/Base/QXBaseViewController.h +++ b/QXLive/Base/QXBaseViewController.h @@ -13,6 +13,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSMutableArray *dataArray; @property (nonatomic,assign)NSInteger page; @property (nonatomic,assign)BOOL bgImageHidden; +/// 是否不参与换肤 +@property (nonatomic,assign)BOOL isNoChangeBgImage; +@property (nonatomic,strong)UIColor *navigationTintColor; //交给子类来实现 -(void)setNavgationItems; -(void)initSubViews; @@ -21,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN imageurl :图片名称或链接 */ -(void)updateBgImage:(NSString*)imageUrl; + +-(void)updateBackImage:(UIImage *)image; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Base/QXBaseViewController.m b/QXLive/Base/QXBaseViewController.m index 67b64e4..b191e79 100644 --- a/QXLive/Base/QXBaseViewController.m +++ b/QXLive/Base/QXBaseViewController.m @@ -19,9 +19,13 @@ [super viewDidLoad]; // Do any additional setup after loading the view. [self.view insertSubview:self.bgImageView atIndex:0]; - [self updateBgImage:QXConfig.backgroundImage]; - [self initSubViews]; + if (self.isNoChangeBgImage) { + /// 不参与换肤 + }else{ + [self updateBgImage:QXConfig.backgroundImage]; + } [self setNavgationItems]; + [self initSubViews]; [self getData]; self.page = 1; } @@ -41,6 +45,11 @@ - (void)getData{ } + +-(void)setNavigationTintColor:(UIColor *)navigationTintColor{ + _navigationTintColor = navigationTintColor; + [self.backBtn setImage:[[UIImage imageNamed:@"back"] imageByTintColor:navigationTintColor] forState:(UIControlStateNormal)]; +} -(void)setNavgationItems{ UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; [backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)]; @@ -73,6 +82,10 @@ self.bgImageView.image = [UIImage imageNamed:imageUrl]; } } + +-(void)updateBackImage:(UIImage *)image{ + [self.backBtn setImage:image forState:(UIControlStateNormal)]; +} -(UIImageView *)bgImageView{ if (!_bgImageView) { _bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; diff --git a/QXLive/Base/QXButton.h b/QXLive/Base/QXButton.h new file mode 100644 index 0000000..091c780 --- /dev/null +++ b/QXLive/Base/QXButton.h @@ -0,0 +1,16 @@ +// +// QXButton.h +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXButton : UIButton +@property (nonatomic,strong)id object; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Base/QXButton.m b/QXLive/Base/QXButton.m new file mode 100644 index 0000000..f2b328f --- /dev/null +++ b/QXLive/Base/QXButton.m @@ -0,0 +1,20 @@ +// +// QXButton.m +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import "QXButton.h" + +@implementation QXButton + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/QXLive/Base/QXGlobal.h b/QXLive/Base/QXGlobal.h index 81ae55d..5e52ec2 100644 --- a/QXLive/Base/QXGlobal.h +++ b/QXLive/Base/QXGlobal.h @@ -85,13 +85,21 @@ typedef void (^showFinishBlock)(void); avatar:(NSString*)avatar navagationController:(UINavigationController*)navagationController; /** - 去群聊 + 去公会群聊 */ -(void)chatWithGroupId:(NSString*)groupId cover:(NSString*)cover name:(NSString*)name navagationController:(UINavigationController*)navagationController; +/** + 去家族群聊 + */ +-(void)chatWithFamilyGroupId:(NSString*)groupId + cover:(NSString*)cover + name:(NSString*)name + navagationController:(UINavigationController*)navagationController; + /** 加入房间 */ @@ -103,11 +111,15 @@ typedef void (^showFinishBlock)(void); /** 退出房间 */ --(void)quitRoomWithRoomId:(NSString*)roomId; +-(void)quitRoomWithRoomId:(NSString*)roomId removeListener:(BOOL)removeListener; /// 去完成任务 -(void)finishTask; -(void)vibrationFeedback; +/// 进入房间后开始保活 +-(void)startKeepAlive; +-(void)dirfViewDidToBackground; +-(void)dirfViewBecomeToFront; @end diff --git a/QXLive/Base/QXGlobal.m b/QXLive/Base/QXGlobal.m index 79cb752..0772a54 100644 --- a/QXLive/Base/QXGlobal.m +++ b/QXLive/Base/QXGlobal.m @@ -23,6 +23,12 @@ #import "QXRedPacketManager.h" #import "QXGiftDisplayManager.h" +#import "QXDrifNobilityJoinRoomView.h" +#import "QXDrifRoomHourRankView.h" +#import "QXGiftDriftView.h" +#import "QXMeetActivityDriftView.h" +#import "QXRedPacketDriftView.h" + @interface QXGlobal() @property (nonatomic,assign)BOOL isLogin; @@ -30,6 +36,8 @@ @property (nonatomic,assign)BOOL isClickJoinRoom; @property (nonatomic,strong)QXTimer *timer; +@property (nonatomic,strong)NSTimer *keepTimer; + @property (nonatomic,assign)NSInteger taskTime; @end @implementation QXGlobal @@ -192,6 +200,20 @@ [navagationController pushViewController:vc animated:YES]; } +-(void)chatWithFamilyGroupId:(NSString *)groupId cover:(NSString *)cover name:(NSString *)name navagationController:(UINavigationController *)navagationController{ + QXChatViewController *vc = [[QXChatViewController alloc] init]; + TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init]; + if ([groupId containsString:@"f"]) { + data.groupID = groupId; + }else{ + data.groupID = [NSString stringWithFormat:@"f%@",groupId]; + } + data.faceUrl = cover; + data.title = name; + vc.data = data; + [navagationController pushViewController:vc animated:YES]; +} + -(void)joinRoomWithRoomId:(NSString *)roomId isRejoin:(BOOL)isRejoin navagationController:(UINavigationController *)navagationController{ if (!QXGlobal.shareGlobal.isLogin) { [[QXGlobal shareGlobal] logOut]; @@ -220,6 +242,9 @@ } if ([roomId isEqualToString:self.roomId]) { if ([navagationController.viewControllers containsObject:self.roomVC]) { + if (![navagationController.visibleViewController isEqual:self.roomVC]) { + [navagationController popToViewController:self.roomVC animated:YES]; + } return; }else{ [UIApplication sharedApplication].idleTimerDisabled = YES; @@ -229,9 +254,7 @@ } return; } - if (self.roomId && ![self.roomId isEqualToString:roomId]) { - [self quitRoomWithRoomId:self.roomId]; - } + [UIApplication sharedApplication].idleTimerDisabled = YES; MJWeakSelf if (isRejoin) { @@ -256,6 +279,8 @@ weakSelf.roomVC.hidesBottomBarWhenPushed = YES; [navagationController pushViewController:weakSelf.roomVC animated:YES]; weakSelf.roomId = roomId; + } roomErrorBlock:^(NSString * _Nonnull roomId, NSString * _Nonnull msg) { + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); weakSelf.isClickJoinRoom = NO; @@ -273,6 +298,9 @@ weakSelf.isClickJoinRoom = YES; [[QXRoomMessageManager shared] joinGroupWithRoomId:roomId]; [QXMineNetwork joinRoomWithRoomId:roomId successBlock:^(QXRoomModel * _Nonnull roomModel) { + if (weakSelf.roomId && ![weakSelf.roomId isEqualToString:roomId]) { + [weakSelf quitRoomWithRoomId:weakSelf.roomId removeListener:NO]; + } // hideLoadingInView(KEYWINDOW) // roomModel.room_info.pk_room_id = @"33"; [UIApplication sharedApplication].idleTimerDisabled = YES; @@ -285,6 +313,9 @@ weakSelf.roomVC.hidesBottomBarWhenPushed = YES; [navagationController pushViewController:weakSelf.roomVC animated:YES]; weakSelf.roomId = roomId; + } roomErrorBlock:^(NSString * _Nonnull roomId, NSString * _Nonnull msg) { + weakSelf.isClickJoinRoom = NO; + [weakSelf showAlertWithMessage:msg roomId:roomId]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { weakSelf.isClickJoinRoom = NO; showToast(msg); @@ -294,6 +325,46 @@ } } +-(void)startKeepAlive{ + [self stopKeepTimer]; + self.keepTimer = [NSTimer scheduledTimerWithTimeInterval:60 + target:self + selector:@selector(checkAndUpdateRedPackets) + userInfo:nil + repeats:YES]; +} + +-(void)checkAndUpdateRedPackets{ + if ([self.roomId isExist]) { + [QXMineNetwork appKeepAliveWithRoomId:self.roomId]; + } +} + +-(void)stopKeepTimer{ + if (self.keepTimer) { + [self.keepTimer invalidate]; + self.keepTimer = nil; + } +} + +-(void)showAlertWithMessage:(NSString*)message roomId:(NSString*)roomId{ + UIAlertController *al = [UIAlertController alertControllerWithTitle:@"温馨提示" message:message preferredStyle:(UIAlertControllerStyleAlert)]; + if ([roomId isExist] && self.roomId==nil) { + [al addAction:[UIAlertAction actionWithTitle:@"再想想" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { + + }]]; + [al addAction:[UIAlertAction actionWithTitle:@"去房间" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { + [self joinRoomWithRoomId:roomId isRejoin:NO navagationController:KEYWINDOW.rootViewController.navigationController]; + }]]; + }else{ + [al addAction:[UIAlertAction actionWithTitle:@"我知道了" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { + + }]]; + } + [KEYWINDOW.rootViewController presentViewController:al animated:YES completion:nil]; +} + + -(void)popToRoomViewController{ QXRoomNavigationController *navagationController = (QXRoomNavigationController*)KEYWINDOW.rootViewController; for (UIViewController *vc in navagationController.viewControllers) { @@ -303,12 +374,15 @@ } } } --(void)quitRoomWithRoomId:(NSString *)roomId{ +-(void)quitRoomWithRoomId:(NSString *)roomId removeListener:(BOOL)removeListener{ + [self stopKeepTimer]; [UIApplication sharedApplication].idleTimerDisabled = NO; /// 移除所有红包 [[QXRedPacketManager sharedManager] destoryRedpacketInfo]; /// 移除房间内礼物飘屏 [[QXGiftDisplayManager sharedManager] clearAll]; + /// 不显示进入特效 + [[QXDrifNobilityJoinRoomView shareView] dirfViewDidToBackground]; /// 移除特效 [[QXGiftPlayerManager shareManager] destroyEffectSvga]; /// 退出声网 @@ -318,7 +392,7 @@ /// 销毁整个声网示例 [[QXAgoraEngine sharedEngine] destroyEngine]; /// 退出直播群 - [[QXRoomMessageManager shared] quitGroupWithRoomId:roomId]; + [[QXRoomMessageManager shared] quitGroupWithRoomId:roomId removeListener:removeListener]; [[QXGlobal shareGlobal].offLineDict removeAllObjects]; [[NSNotificationCenter defaultCenter] removeObserver:self]; if (_roomVC) { @@ -364,4 +438,15 @@ } return _offLineDict; } + +-(void)dirfViewDidToBackground{ + [[QXDrifNobilityJoinRoomView shareView] dirfViewDidToBackground]; + [[QXDrifRoomHourRankView shareView] dirfViewDidToBackground]; + [[QXGiftDriftView shareView] dirfViewDidToBackground]; + [[QXMeetActivityDriftView shareView] dirfViewDidToBackground]; + [[QXRedPacketDriftView shareView] dirfViewDidToBackground]; +} +-(void)dirfViewBecomeToFront{ + [[QXDrifNobilityJoinRoomView shareView] dirfViewBecomeToFront]; +} @end diff --git a/QXLive/Dynamic(语圈)/Controller/QXExpansionViewController.m b/QXLive/Dynamic(语圈)/Controller/QXExpansionViewController.m index 1d99ae1..4d9d23f 100644 --- a/QXLive/Dynamic(语圈)/Controller/QXExpansionViewController.m +++ b/QXLive/Dynamic(语圈)/Controller/QXExpansionViewController.m @@ -145,6 +145,15 @@ cell.model = model; return cell; } +-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ + QXExpansionCell *eCell = (QXExpansionCell *)cell; + [eCell nameStartAnimate]; +} +-(void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ + QXExpansionCell *eCell = (QXExpansionCell *)cell; + [eCell nameStopAnimate]; +} + -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ QXUserHomeModel *model = self.dataArray[indexPath.row]; NSArray *imgArr; @@ -154,12 +163,12 @@ // NSArray * CGFloat itemH = 94; if (imgArr.count == 1) { - itemH = (SCREEN_WIDTH-15-15-15)/2 + 94; + itemH = (SCREEN_WIDTH-15-15-15)/2 + 94+10; }else if(imgArr.count > 1){ if (imgArr.count > 3) { - itemH = (SCREEN_WIDTH-16*2-12*2-10*2)/3*2+10+94; + itemH = (SCREEN_WIDTH-16*2-12*2-10*2)/3*2+10+94+ScaleWidth(10); }else{ - itemH = (SCREEN_WIDTH-16*2-12*2-10*2)/3+94; + itemH = (SCREEN_WIDTH-16*2-12*2-10*2)/3+94+ScaleWidth(10); } }else{ itemH = 94; diff --git a/QXLive/Dynamic(语圈)/View/QXExpansionAppStoreView.m b/QXLive/Dynamic(语圈)/View/QXExpansionAppStoreView.m index 28237e3..b84b23a 100644 --- a/QXLive/Dynamic(语圈)/View/QXExpansionAppStoreView.m +++ b/QXLive/Dynamic(语圈)/View/QXExpansionAppStoreView.m @@ -441,8 +441,15 @@ self.changeBtn.hidden = NO; self.fengcheImageView.hidden = YES; [self configData]; - - [UIView animateWithDuration:0.3 animations:^{ + self.userViewCopy1.nameBgView.hidden = YES; + self.userViewCopy2.nameBgView.hidden = YES; + self.userViewCopy3.nameBgView.hidden = YES; + self.userViewCopy4.nameBgView.hidden = YES; + self.userViewCopy5.nameBgView.hidden = YES; + self.userViewCopy6.nameBgView.hidden = YES; + self.userViewCopy7.nameBgView.hidden = YES; + self.userViewCopy8.nameBgView.hidden = YES; + [UIView animateWithDuration:0.1 animations:^{ self.changeBtn.alpha = 1; self.userViewCopy1.frame = self.userView1.frame; self.userViewCopy2.frame = self.userView2.frame; @@ -474,6 +481,15 @@ self.userViewCopy7.hidden = YES; self.userViewCopy8.hidden = YES; + self.userViewCopy1.nameBgView.hidden = NO; + self.userViewCopy2.nameBgView.hidden = NO; + self.userViewCopy3.nameBgView.hidden = NO; + self.userViewCopy4.nameBgView.hidden = NO; + self.userViewCopy5.nameBgView.hidden = NO; + self.userViewCopy6.nameBgView.hidden = NO; + self.userViewCopy7.nameBgView.hidden = NO; + self.userViewCopy8.nameBgView.hidden = NO; + self.userView1.hidden = NO; self.userView2.hidden = NO; self.userView3.hidden = NO; diff --git a/QXLive/Dynamic(语圈)/View/QXExpansionCell.h b/QXLive/Dynamic(语圈)/View/QXExpansionCell.h index 222a1d4..09ede84 100644 --- a/QXLive/Dynamic(语圈)/View/QXExpansionCell.h +++ b/QXLive/Dynamic(语圈)/View/QXExpansionCell.h @@ -8,20 +8,22 @@ #import #import "QXUserModel.h" #import "QXSeatHeaderView.h" +#import "CKShimmerLabel.h" NS_ASSUME_NONNULL_BEGIN @interface QXExpansionCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIView *bgView; @property (weak, nonatomic) IBOutlet QXSeatHeaderView *avatarImgV; -@property (weak, nonatomic) IBOutlet UILabel *nicknameLab; -@property (weak, nonatomic) IBOutlet UIImageView *levelImgV; +@property (weak, nonatomic) IBOutlet CKShimmerLabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *ageLabel; @property (weak, nonatomic) IBOutlet UIButton *followBtn; @property (weak, nonatomic) IBOutlet UIView *imgsBgView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *imgsBgViewHeightCon; @property (weak, nonatomic) IBOutlet UIImageView *sexImageView; @property (nonatomic, strong) QXUserHomeModel *model; +-(void)nameStartAnimate; +-(void)nameStopAnimate; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Dynamic(语圈)/View/QXExpansionCell.m b/QXLive/Dynamic(语圈)/View/QXExpansionCell.m index cec6518..7808c04 100644 --- a/QXLive/Dynamic(语圈)/View/QXExpansionCell.m +++ b/QXLive/Dynamic(语圈)/View/QXExpansionCell.m @@ -37,6 +37,12 @@ make.size.mas_equalTo(CGSizeMake(imgWidth, imgWidth)); }]; } + self.nameLabel.textColor = RGB16(0x212121); + self.nameLabel.shimmerWidth = 20; + self.nameLabel.shimmerRadius = 20; + self.nameLabel.durationTime = 1;; + self.nameLabel.font = [UIFont boldSystemFontOfSize:15]; + [self.nameLabel stopShimmer]; } - (IBAction)chatAction:(id)sender { if (self.model.room_id.intValue > 0) { @@ -49,7 +55,19 @@ -(void)setModel:(QXUserHomeModel *)model{ _model = model; [self.avatarImgV setHeadIcon:model.avatar dress:@""]; - self.nicknameLab.text = model.nickname; + if ([model.nobility_image isExist]) { + [self.avatarImgV.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]]; + }else{ + self.avatarImgV.nobilityImageView.image = nil; + } + if ([model.nickname_color isExist]) { + self.nameLabel.shimmerColor = [UIColor colorWithHexString:model.nickname_color]; +// [self.nameLabel startShimmer]; + }else{ + self.nameLabel.shimmerColor = [UIColor clearColor]; +// [self.nameLabel stopShimmer]; + } + self.nameLabel.text = model.nickname; self.ageLabel.text = [NSString stringWithFormat:@"%ld岁 ip属地: %@",[model.birthday ageWithDateOfBirth],model.loginip]; CGFloat imgWidth = (SCREEN_WIDTH-16*2-12*2-10*2)/3; UIImageView *firstImgV = self.imgViewsArray.firstObject; @@ -102,6 +120,23 @@ self.followBtn.selected = NO; } } +-(void)nameStartAnimate{ + if ([self.model.nickname_color isExist]) { + [self.nameLabel stopShimmer]; + [self.nameLabel layoutSubviews]; + self.nameLabel.shimmerWidth = 20; + self.nameLabel.shimmerRadius = 20; + self.nameLabel.durationTime = 1; + self.nameLabel.shimmerColor = [UIColor colorWithHexString:self.model.nickname_color]; + [self.nameLabel startShimmer]; + } +} +-(void)nameStopAnimate{ + if ([self.model.nickname_color isExist]) { + self.nameLabel.shimmerColor = [UIColor colorWithHexString:self.model.nickname_color]; + [self.nameLabel stopShimmer]; + } +} -(void)previewPhotoWithCurrentIndex:(NSInteger)currentIndex{ NSArray *images = [self.model.home_bgimages componentsSeparatedByString:@","]; diff --git a/QXLive/Dynamic(语圈)/View/QXExpansionCell.xib b/QXLive/Dynamic(语圈)/View/QXExpansionCell.xib index f67471b..11df19d 100644 --- a/QXLive/Dynamic(语圈)/View/QXExpansionCell.xib +++ b/QXLive/Dynamic(语圈)/View/QXExpansionCell.xib @@ -10,19 +10,19 @@ - + - + - + - + - + @@ -33,39 +33,20 @@ - + - - - + - + - + + + - - - - + - - - + + + + @@ -142,8 +131,7 @@ - - + diff --git a/QXLive/Dynamic(语圈)/View/QXSendGiftView.m b/QXLive/Dynamic(语圈)/View/QXSendGiftView.m index f1d00d5..714de21 100644 --- a/QXLive/Dynamic(语圈)/View/QXSendGiftView.m +++ b/QXLive/Dynamic(语圈)/View/QXSendGiftView.m @@ -511,7 +511,18 @@ self.giftModel = nil; self.pitUserListView.isSingle = NO; [self.pitUserListView.selectedArray removeAllObjects]; - self.pitUserListView.users = pitUsers; + NSMutableArray *arr = [NSMutableArray array]; + for (QXRoomPitModel *md in pitUsers) { + QXRoomPitModel *model = [QXRoomPitModel new]; + model.user_id = md.user_id; + model.nickname = md.nickname; + model.pit_number = md.pit_number; + model.sex = md.sex; + model.avatar = md.avatar; + model.user_code = md.user_code; + [arr addObject:model]; + } + self.pitUserListView.users = arr; [self getMyWallet]; } -(void)setUserModel:(QXRoomPitModel *)userModel{ @@ -552,8 +563,14 @@ [weakSelf.categoryView setDefaultSelectedIndex:1]; [weakSelf.categoryView reloadData]; }else{ - for (QXGiftLabelModel*md in weakSelf.titles) { - [arr addObject:md.name]; + /// 在发现打赏时 不需要趣味 循环中剔除 + for (QXGiftLabelModel*md in list) { + if ([md.id isEqualToString:@"2"]) { + [weakSelf.titles removeObject:md]; + continue; + }else{ + [arr addObject:md.name]; + } } weakSelf.categoryView.titles = arr; [weakSelf.categoryView setDefaultSelectedIndex:0]; @@ -821,6 +838,10 @@ } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ QXGiftModel *model = self.dataArray[indexPath.row]; + if (model.is_lock.intValue == 1) { + showToast(@"请先开通爵位"); + return; + } if ([model.activities_id isEqualToString:@"5"]) { /// 要进入活动 if (self.selectetGiftBlock) { diff --git a/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m b/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m index f226b1b..cae85f0 100644 --- a/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m +++ b/QXLive/HomePage(声播)/Controlller/QXHomeViewController.m @@ -28,6 +28,7 @@ #import "QXHomeTopView.h" #import "QXSystemNoticeViewController.h" #import "QXHotRoomViewController.h" +#import "QXInvitePopView.h" @interface QXHomeViewController () @property (nonatomic, strong) JXPagerView *pagingView; @@ -53,16 +54,18 @@ @property (nonatomic,strong)UIButton *skyDownBtn; @property (nonatomic,strong)QXNewPeoplePopView *nPeopleRechargeView; -@property (nonatomic,strong)QXAppstoreHomeView *appStoreView; +//@property (nonatomic,strong)QXAppstoreHomeView *appStoreView; @property (nonatomic,strong)SDCycleScrollView *rechargePermissionView; @property (nonatomic,strong)NSMutableArray *rechargePermissionArray; @property (nonatomic,strong)QXRechargePermissionModel *permissionModel; +@property (nonatomic,strong)QXRoomListModel *recommendRoom; @end @implementation QXHomeViewController - (void)viewDidLoad { + self.isNoChangeBgImage = YES; [super viewDidLoad]; // Do any additional setup after loading the view. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil]; @@ -75,11 +78,7 @@ } - (void)initSubViews{ - if ([QXConfig.backgroundImage hasPrefix:@"http"] || [QXConfig.backgroundImage hasPrefix:@"https"]) { - [self updateBgImage:QXConfig.backgroundImage]; - }else{ - [self updateBgImage:@"app_home_bg"]; - } + [self updateBgImage:@"app_home_bg"]; UIImageView *logoImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yusheng"]]; [self.view addSubview:logoImageView]; [logoImageView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -142,14 +141,15 @@ // }]; [self getBanner]; // [self getRechargePermission]; - self.appStoreView.hidden = YES; - [self.view addSubview:self.appStoreView]; +// self.appStoreView.hidden = YES; +// [self.view addSubview:self.appStoreView]; self.rechargePermissionView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(SCREEN_WIDTH-80-17, SCREEN_HEIGHT-(TabbarContentHeight+90+80), 80, 80) delegate:self placeholderImage:nil]; self.rechargePermissionView.pageControlBottomOffset = -15; self.rechargePermissionView.backgroundColor = [UIColor clearColor]; self.rechargePermissionView.hidden = YES; [self.view addSubview:self.rechargePermissionView]; + [self getRecommendRoom]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; @@ -171,17 +171,30 @@ [self.titles removeAllObjects]; NSMutableArray *arr = [NSMutableArray array]; [self.titles addObjectsFromArray:list]; - for (QXMyRoomType *md in list) { + NSInteger default_index = 0; + for (int i = 0 ; i < list.count; i++) { + QXMyRoomType *md = list[i]; [arr addObject:md.label_name]; + if (md.default_index.intValue == 1) { + default_index = i; + } } self.categoryView.titles = arr; + self.categoryView.defaultSelectedIndex = default_index; [self.categoryView reloadData]; [self.pagingView.mainTableView.mj_header endRefreshing]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { [self.pagingView.mainTableView.mj_header endRefreshing]; }]; } - +-(void)getRecommendRoom{ + MJWeakSelf + [QXHomePageNetwork getRecommendRoomSuccessBlock:^(QXRoomListModel * _Nonnull model) { + weakSelf.recommendRoom = model; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} //-(void)getFirstRechargePermission{ // @weakify(self) // [QXHomePageNetwork getFirstRechargePermissionSuccessBlock:^(BOOL isShow) { @@ -306,6 +319,7 @@ return; } if (self.permissionModel.first_charge_permission.intValue != 1) { + [self popRecommendRoom]; return; } MJWeakSelf @@ -313,7 +327,7 @@ view.closeActionBlock = ^{ [[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{ QXLOG(@"页面关闭"); - + [weakSelf popRecommendRoom]; }]; }; view.rechargeActionBlock = ^(NSString * _Nonnull money, NSString * _Nonnull gift_bag_id) { @@ -341,6 +355,25 @@ }]; } +-(void)popRecommendRoom{ + if (self.recommendRoom) { + QXInvitePopView *view = [[QXInvitePopView alloc] init]; + view.model = self.recommendRoom; + view.closeActionBlock = ^{ + [[QXGlobal shareGlobal].alertViewController hideViewFinishBlock:^{ + QXLOG(@"页面关闭"); + + }]; + }; + view.agreeActionBlock = ^{ + [[QXGlobal shareGlobal] joinRoomWithRoomId:self.recommendRoom.room_id isRejoin:NO navagationController:self.navigationController]; + }; + + [[QXGlobal shareGlobal] showView:view popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{ + + }]; + } +} #pragma mark - JXPagingViewDelegate - (UIView *)tableHeaderViewInPagerView:(JXPagerView *)pagerView { @@ -405,11 +438,11 @@ @strongify(self) [self.dataArray removeAllObjects]; [self.dataArray addObjectsFromArray:list]; - if (isAppStore) { - self.appStoreView.hidden = NO; - }else{ - self.appStoreView.hidden = YES; - } +// if (isAppStore) { +// self.appStoreView.hidden = NO; +// }else{ +// self.appStoreView.hidden = YES; +// } // weakSelf.appStoreView.dataArray = list; self.topView.dataArray = list; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { @@ -419,7 +452,7 @@ } -(void)getBanner{ @weakify(self) - [QXHomePageNetwork homeBannerSuccessBlock:^(NSArray * _Nonnull list) { + [QXHomePageNetwork homeBannerWithType:@"3" successBlock:^(NSArray * _Nonnull list) { @strongify(self) NSMutableArray *arr = [NSMutableArray array]; for (QXBanner *banner in list) { @@ -427,7 +460,7 @@ } [self.bannerArry removeAllObjects]; [self.bannerArry addObjectsFromArray:list]; - self.appStoreView.bannerArray = list; +// self.appStoreView.bannerArray = list; self.bannerScrollView.imageURLStringsGroup = arr; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { @@ -593,12 +626,14 @@ _categoryView.titleFont = [UIFont boldSystemFontOfSize:16]; _categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:20]; _categoryView.averageCellSpacingEnabled = NO; - JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init]; + JXCategoryIndicatorLineView *indicatorView = [[JXCategoryIndicatorLineView alloc] init]; indicatorView.indicatorWidth = JXCategoryViewAutomaticDimension; - indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"]; - indicatorView.indicatorImageViewSize = CGSizeMake(50, 28); - self.indicatorView = indicatorView; - indicatorView.verticalMargin = 5; +// indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"]; +// indicatorView.indicatorImageViewSize = CGSizeMake(50, 28); +// self.indicatorView = indicatorView; +// indicatorView.verticalMargin = 5; + indicatorView.indicatorColor = QXConfig.themeColor; +// indicatorView.indicatorColor = [UIColor colorWithHexString:@"#FFFFFF"]; _categoryView.indicators = @[indicatorView]; } return _categoryView; @@ -674,12 +709,12 @@ return _rechargePermissionArray; } --(QXAppstoreHomeView *)appStoreView{ - if (!_appStoreView) { - _appStoreView = [[QXAppstoreHomeView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight)]; - } - return _appStoreView; -} +//-(QXAppstoreHomeView *)appStoreView{ +// if (!_appStoreView) { +// _appStoreView = [[QXAppstoreHomeView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight-TabbarContentHeight)]; +// } +// return _appStoreView; +//} -(void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self]; } diff --git a/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.h b/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.h index 893890c..1afad2a 100644 --- a/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.h +++ b/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface QXRankHomeSubVC : QXBaseViewController +@interface QXRankHomeSubVC : UIViewController @property (nonatomic,strong)NSString *roomId; /// 1日 2 周 3月 @property (nonatomic,strong)NSString *dataType; diff --git a/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.m b/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.m index 132d090..0fd6cfd 100644 --- a/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.m +++ b/QXLive/HomePage(声播)/Controlller/QXRankHomeSubVC.m @@ -24,6 +24,8 @@ @property (nonatomic, strong) QXRankCPTopThreeView *cpHeaderView; @property (nonatomic, strong) QXMyRankView *myRankView; @property (nonatomic, strong) NSMutableArray *topDataArray; +@property (nonatomic, strong) NSMutableArray *dataArray; +@property (nonatomic, assign) NSInteger page; @end @implementation QXRankHomeSubVC @@ -37,19 +39,25 @@ } -(void)viewDidLayoutSubviews{ [super viewDidLayoutSubviews]; - self.myRankView.frame = CGRectMake(0, self.view.height-ScaleWidth(74)-kSafeAreaTop-kSafeAreaBottom, SCREEN_WIDTH, ScaleWidth(74)); - self.tableView.frame = CGRectMake(0, self.rankTypeView.bottom+10, SCREEN_WIDTH, self.view.height - self.rankTypeView.height-20-self.myRankView.height-kSafeAreaTop-kSafeAreaBottom); + if (self.rankType == 4) { + self.tableView.frame = CGRectMake(0,kSafeAreaTop , SCREEN_WIDTH, self.view.height - kSafeAreaTop-10-self.myRankView.height); + }else{ + self.myRankView.frame = CGRectMake(0, self.view.height-ScaleWidth(74)-kSafeAreaTop-kSafeAreaBottom, SCREEN_WIDTH, ScaleWidth(74)); + self.tableView.frame = CGRectMake(0, self.rankTypeView.bottom+10, SCREEN_WIDTH, self.view.height - self.rankTypeView.height-20-self.myRankView.height-kSafeAreaTop-kSafeAreaBottom); + } } -(void)initSubViews{ - self.bgImageHidden = YES; + self.page = 1; self.dataType = @"1"; self.view.backgroundColor = [UIColor clearColor]; [self.view addSubview:self.rankTypeView]; [self.view addSubview:self.myRankView]; if (self.rankType == 4) { + self.rankTypeView.hidden = YES; self.tableView.tableHeaderView = self.cpHeaderView; self.myRankView.isCP = YES; }else{ + self.rankTypeView.hidden = NO; self.myRankView.isCP = NO; self.tableView.tableHeaderView = self.headerView; } @@ -266,4 +274,11 @@ } return _topDataArray; } +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; + +} @end diff --git a/QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m b/QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m index 4a012e7..97b790d 100644 --- a/QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m +++ b/QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m @@ -44,7 +44,7 @@ self.view.backgroundColor = [UIColor clearColor]; // self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"]; - self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"真爱榜"]; + self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"心动榜"]; self.listVCArray = [NSMutableArray array]; self.categoryView = [[JXCategoryTitleView alloc] init]; self.categoryView.frame = CGRectMake(0, 0, SCREEN_WIDTH-100, 44); diff --git a/QXLive/HomePage(声播)/Model/QXRankModel.h b/QXLive/HomePage(声播)/Model/QXRankModel.h index 6eb1406..4943ffb 100644 --- a/QXLive/HomePage(声播)/Model/QXRankModel.h +++ b/QXLive/HomePage(声播)/Model/QXRankModel.h @@ -44,6 +44,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString* user_avatar; @property (nonatomic,strong)NSString* user_avatar1; + +@property (nonatomic,strong)NSString* exp; +@property (nonatomic,strong)NSString* level; @end diff --git a/QXLive/HomePage(声播)/Model/QXRoomBestFriendModel.h b/QXLive/HomePage(声播)/Model/QXRoomBestFriendModel.h new file mode 100644 index 0000000..7aa04dc --- /dev/null +++ b/QXLive/HomePage(声播)/Model/QXRoomBestFriendModel.h @@ -0,0 +1,26 @@ +// +// QXRoomBestFriendModel.h +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXRoomBestFriendListModel,QXRoomBestFriendListSubModel; +@interface QXRoomBestFriendModel : NSObject +@property (nonatomic,strong)QXUserCpInfoModel *cp; +@property (nonatomic,strong)NSArray *no_cp; +@end +@interface QXRoomBestFriendListModel : NSObject +@property (nonatomic,strong)NSString *relation_name; +@property (nonatomic,strong)NSArray *relation_list; +@end + + + +@interface QXHeartBeatSpaceListModel : NSObject + +@end +NS_ASSUME_NONNULL_END diff --git a/QXLive/HomePage(声播)/Model/QXRoomBestFriendModel.m b/QXLive/HomePage(声播)/Model/QXRoomBestFriendModel.m new file mode 100644 index 0000000..4ad6e33 --- /dev/null +++ b/QXLive/HomePage(声播)/Model/QXRoomBestFriendModel.m @@ -0,0 +1,29 @@ +// +// QXRoomBestFriendModel.m +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import "QXRoomBestFriendModel.h" + +@implementation QXRoomBestFriendModel ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"no_cp": @"QXRoomBestFriendListModel", + @"cp": @"QXUserCpInfoModel", + }; +} +@end +@implementation QXRoomBestFriendListModel ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"relation_list": @"QXRelationshipListModel", + }; +} +@end + +@implementation QXHeartBeatSpaceListModel + +@end + diff --git a/QXLive/HomePage(声播)/Model/QXRoomFriendRelationModel.h b/QXLive/HomePage(声播)/Model/QXRoomFriendRelationModel.h index c01fd01..7148fe8 100644 --- a/QXLive/HomePage(声播)/Model/QXRoomFriendRelationModel.h +++ b/QXLive/HomePage(声播)/Model/QXRoomFriendRelationModel.h @@ -23,6 +23,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *room_id; @property (nonatomic,strong)NSString *relation_name; + +@property (nonatomic,strong)NSString *end_time; +@property (nonatomic,strong)NSString *sex2; +@property (nonatomic,strong)NSString *sex1; +@property (nonatomic,strong)NSString *delete_me_coin; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/HomePage(声播)/Services/QXHomePageNetwork.h b/QXLive/HomePage(声播)/Services/QXHomePageNetwork.h index 0ef97c0..ce96945 100644 --- a/QXLive/HomePage(声播)/Services/QXHomePageNetwork.h +++ b/QXLive/HomePage(声播)/Services/QXHomePageNetwork.h @@ -34,8 +34,9 @@ NS_ASSUME_NONNULL_BEGIN /** 首页banner */ -+(void)homeBannerSuccessBlock:(void (^)(NSArray* list))successBlock - failBlock:(void (^)(NSError * error, NSString * msg))failBlock; ++(void)homeBannerWithType:(NSString*)type + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; /** 魅力/财富榜 @@ -95,6 +96,11 @@ NS_ASSUME_NONNULL_BEGIN */ +(void)getNewUserGiftListSuccessBlock:(void (^)(NSArray * list))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; +/** + 获取推荐房间 + */ ++(void)getRecommendRoomSuccessBlock:(void (^)(QXRoomListModel * model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/HomePage(声播)/Services/QXHomePageNetwork.m b/QXLive/HomePage(声播)/Services/QXHomePageNetwork.m index 082514f..634e0c4 100644 --- a/QXLive/HomePage(声播)/Services/QXHomePageNetwork.m +++ b/QXLive/HomePage(声播)/Services/QXHomePageNetwork.m @@ -35,9 +35,10 @@ failBlock(error,msg); }]; } -+(void)homeBannerSuccessBlock:(void (^)(NSArray* list))successBlock - failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ - [[QXRequset shareInstance] getWithUrl:QXHomeBanner parameters:@{@"type":@"3"} needCache:NO success:^(id responseObject) { ++(void)homeBannerWithType:(NSString*)type + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXHomeBanner parameters:@{@"type":type?:@"3"} needCache:NO success:^(id responseObject) { if (successBlock) { NSArray *list = [NSArray yy_modelArrayWithClass:[QXBanner class] json:responseObject[@"data"]]; successBlock(list); @@ -164,6 +165,21 @@ failBlock(error,msg); }]; } + +/** + 获取推荐房间 + */ ++(void)getRecommendRoomSuccessBlock:(void (^)(QXRoomListModel * model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXRecommendRoom parameters:@{} needCache:NO success:^(id responseObject) { + if (successBlock) { + QXRoomListModel *model = [QXRoomListModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} /// 首充好礼礼物列表 //static NSString * QXAppFirstRechargeGiftList = @"api/Activities/first_charge_gift"; /// 首充好礼弹框权限 diff --git a/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPListCell.m b/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPListCell.m index be659fc..e78dd5f 100644 --- a/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPListCell.m +++ b/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPListCell.m @@ -22,7 +22,8 @@ [self.headerImageView1 sd_setImageWithURL:[NSURL URLWithString:model.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; [self.headerImageView2 sd_setImageWithURL:[NSURL URLWithString:model.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; self.nameLabel.text = [NSString stringWithFormat:@"%@\n%@",model.nickname,model.nickname1]; - self.valueLabel.text = [NSString qx_showHotCountNum:model.total.longLongValue]; +// self.valueLabel.text = [NSString qx_showHotCountNum:model.total.longLongValue]; + self.valueLabel.text = [NSString stringWithFormat:@"Lv %@",model.total]; self.numberLabel.text = model.rank; } - (void)awakeFromNib { diff --git a/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPTopThreeView.m b/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPTopThreeView.m index 32a38bd..2d2f808 100644 --- a/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPTopThreeView.m +++ b/QXLive/HomePage(声播)/View/首页/排行榜/QXRankCPTopThreeView.m @@ -55,7 +55,7 @@ [self.firstHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:firstModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; self.firstNameLabel.text = firstModel.nickname; self.firstIDLabel.text = firstModel.nickname1; - self.firstRankValueLabel.text = firstModel.total; + self.firstRankValueLabel.text = [NSString stringWithFormat:@"Lv %@",firstModel.total]; } if (secondModel) { @@ -63,7 +63,8 @@ [self.secondHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:secondModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; self.secondNameLabel.text = secondModel.nickname; self.secondIDLabel.text = secondModel.nickname1; - self.secondRankValueLabel.text = secondModel.total; +// self.secondRankValueLabel.text = secondModel.total; + self.secondRankValueLabel.text = [NSString stringWithFormat:@"Lv %@",secondModel.total]; } if (thirdModel) { @@ -71,7 +72,8 @@ [self.thirdHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:thirdModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; self.thirdNameLabel.text = thirdModel.nickname; self.thirdIDLabel.text = thirdModel.nickname1; - self.thirdRankValueLabel.text = thirdModel.total; +// self.thirdRankValueLabel.text = thirdModel.total; + self.thirdRankValueLabel.text = [NSString stringWithFormat:@"Lv %@",thirdModel.total]; } } diff --git a/QXLive/Login(登录)/Controlller/QXLoginViewController.m b/QXLive/Login(登录)/Controlller/QXLoginViewController.m index 71e7ed1..76c5e78 100644 --- a/QXLive/Login(登录)/Controlller/QXLoginViewController.m +++ b/QXLive/Login(登录)/Controlller/QXLoginViewController.m @@ -253,7 +253,7 @@ model.navIsHidden = YES; model.preferredStatusBarStyle = UIStatusBarStyleDarkContent; - model.logoImage = [UIImage imageNamed:@"login_logo"]; + model.logoImage = [UIImage imageNamed:@"app_one_login_icon"]; model.logoFrameBlock = ^CGRect(CGSize screenSize, CGSize superViewSize, CGRect frame) { frame.origin = CGPointMake((SCREEN_WIDTH - 88) * .5, 150+ kSafeAreaTop); frame.size = CGSizeMake(88, 88); @@ -530,11 +530,12 @@ showToast(QXText(@"请输入正确的手机号码")); return; } + sender.userInteractionEnabled = NO; MJWeakSelf [QXLoginNetwork getSmscodeWithMobile:self.accountTextField.textField.text type:GetSmscodeTypeLogin successBlock:^(id _Nonnull responseObject) { [weakSelf.codeTextField startTimeDown]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - + sender.userInteractionEnabled = YES; }]; } diff --git a/QXLive/Login(登录)/Model/QXLoginModel.h b/QXLive/Login(登录)/Model/QXLoginModel.h index 85fe6c6..03369ec 100644 --- a/QXLive/Login(登录)/Model/QXLoginModel.h +++ b/QXLive/Login(登录)/Model/QXLoginModel.h @@ -36,6 +36,16 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *dress; /// 聊天气泡 @property (nonatomic,strong)NSString *chat_bubble; +/// 爵位图片 +@property (nonatomic,strong)NSString *nobility_image; +/// 昵称颜色 +@property (nonatomic,strong)NSString *nickname_color; +/// 是否可以设置隐身进入的状态:0-不行,1-可以 +@property (nonatomic,strong)NSString *is_hide; +/// 当前状态:0-取消隐身,1-隐身进入 +@property (nonatomic,strong)NSString *hide_status; +/// 当前状态:-1 未认证歌手, 0待审核 1已认证 2被拒绝 +@property (nonatomic,strong)NSString *singer_status; /// 各种卡片 @property (nonatomic,strong)NSArray *icon; /// 1 能聊天 0不能聊天 diff --git a/QXLive/Login(登录)/View/QXLoginTextField.m b/QXLive/Login(登录)/View/QXLoginTextField.m index c965ddc..7ba858f 100644 --- a/QXLive/Login(登录)/View/QXLoginTextField.m +++ b/QXLive/Login(登录)/View/QXLoginTextField.m @@ -260,6 +260,9 @@ __block int timeCount = 60; _timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{ timeCount--; + if (self == nil) { + return; + } if (timeCount<=0) { [self->_timer invalidate]; self->_codeBtn.userInteractionEnabled = YES; @@ -269,4 +272,10 @@ } }]; } +-(void)dealloc{ + if (_timer) { + [_timer invalidate]; + _timer = nil; + } +} @end diff --git a/QXLive/Manager/QXHapticManager.h b/QXLive/Manager/QXHapticManager.h new file mode 100644 index 0000000..71fb147 --- /dev/null +++ b/QXLive/Manager/QXHapticManager.h @@ -0,0 +1,32 @@ +// +// QXHapticManager.h +// QXLive +// +// Created by 启星 on 2025/12/5. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXHapticManager : NSObject + ++ (instancetype)shared; + +// 检查是否支持触觉反馈 ++ (BOOL)isHapticFeedbackSupported; + +// 各种触觉反馈方法 +- (void)impactWithStyle:(UIImpactFeedbackStyle)style; +- (void)impactMedium; +- (void)notificationWithType:(UINotificationFeedbackType)type; +- (void)selectionChanged; + +// 带准备的触觉反馈 +- (void)prepareImpactWithStyle:(UIImpactFeedbackStyle)style; +- (void)triggerPreparedImpact; + +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Manager/QXHapticManager.m b/QXLive/Manager/QXHapticManager.m new file mode 100644 index 0000000..d3d5369 --- /dev/null +++ b/QXLive/Manager/QXHapticManager.m @@ -0,0 +1,172 @@ +// +// QXQXQXHapticManager.m +// QXLive +// +// Created by 启星 on 2025/12/5. +// + +#import "QXHapticManager.h" +#import +@interface QXHapticManager () +@property (nonatomic, strong) UIImpactFeedbackGenerator *impactGenerator; +@property (nonatomic, strong) UINotificationFeedbackGenerator *notificationGenerator; +@property (nonatomic, strong) UISelectionFeedbackGenerator *selectionGenerator; +@property (nonatomic, assign) BOOL isImpactPrepared; +@property (nonatomic, assign) UIImpactFeedbackStyle preparedStyle; +@end + +@implementation QXHapticManager + ++ (instancetype)shared { + static QXHapticManager *instance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [[QXHapticManager alloc] init]; + }); + return instance; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _isImpactPrepared = NO; + // 提前初始化所有生成器 + _impactGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium]; + _notificationGenerator = [[UINotificationFeedbackGenerator alloc] init]; + _selectionGenerator = [[UISelectionFeedbackGenerator alloc] init]; + + // 提前准备所有生成器 + [self prepareAllGenerators]; + } + return self; +} + +#pragma mark - 支持性检查 ++ (BOOL)isHapticFeedbackSupported { + if (@available(iOS 10.0, *)) { + // 检查设备型号是否支持 + NSString *deviceModel = [[UIDevice currentDevice] model]; + + // 检查是否是iPhone 7及以后 + // 这里简化检查,实际应使用更精确的设备型号检测 + // 可以使用 sysctlbyname 获取更精确的设备信息 + struct utsname systemInfo; + uname(&systemInfo); + NSString *deviceIdentifier = [NSString stringWithCString:systemInfo.machine + encoding:NSUTF8StringEncoding]; + + // iPhone 7及以后的设备标识符(部分示例) + NSArray *supportedDevices = @[ + @"iPhone9,", @"iPhone10,", @"iPhone11,", @"iPhone12,", + @"iPhone13,", @"iPhone14,", @"iPhone15,", @"iPhone16,", + @"iPhone8,4" // iPhone SE (第二代) + ]; + + BOOL isSupportedDevice = NO; + for (NSString *prefix in supportedDevices) { + if ([deviceIdentifier hasPrefix:prefix]) { + isSupportedDevice = YES; + break; + } + } + + // 如果是模拟器,返回YES以支持调试 + #if TARGET_IPHONE_SIMULATOR + return YES; + #else + return isSupportedDevice; + #endif + } + return NO; +} + +- (void)prepareAllGenerators { + if (![QXHapticManager isHapticFeedbackSupported]) { + return; + } + + // 在主线程准备所有生成器 + dispatch_async(dispatch_get_main_queue(), ^{ + [self.impactGenerator prepare]; + [self.notificationGenerator prepare]; + [self.selectionGenerator prepare]; + }); +} + +#pragma mark - 即时触觉反馈 +- (void)impactWithStyle:(UIImpactFeedbackStyle)style { + if (![QXHapticManager isHapticFeedbackSupported]) { + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + // 创建新的生成器确保每次都触发 + UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:style]; + [generator prepare]; + [generator impactOccurred]; + + // 延迟释放 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [generator prepare]; + }); + }); +} + +- (void)impactMedium { + [self impactWithStyle:UIImpactFeedbackStyleMedium]; +} + +#pragma mark - 带准备的触觉反馈 +- (void)prepareImpactWithStyle:(UIImpactFeedbackStyle)style { + if (![QXHapticManager isHapticFeedbackSupported]) { + return; + } + + self.preparedStyle = style; + + dispatch_async(dispatch_get_main_queue(), ^{ + // 重新创建生成器 + self.impactGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:style]; + [self.impactGenerator prepare]; + self.isImpactPrepared = YES; + }); +} + +- (void)triggerPreparedImpact { + if (![QXHapticManager isHapticFeedbackSupported] || !self.isImpactPrepared) { + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.impactGenerator) { + [self.impactGenerator impactOccurred]; + // 准备下一次 + [self.impactGenerator prepare]; + } + }); +} + +#pragma mark - 其他类型的触觉反馈 +- (void)notificationWithType:(UINotificationFeedbackType)type { + if (![QXHapticManager isHapticFeedbackSupported]) { + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [self.notificationGenerator notificationOccurred:type]; + [self.notificationGenerator prepare]; + }); +} + +- (void)selectionChanged { + if (![QXHapticManager isHapticFeedbackSupported]) { + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [self.selectionGenerator selectionChanged]; + [self.selectionGenerator prepare]; + }); +} + +@end diff --git a/QXLive/Manager/QXRoomMessageManager.h b/QXLive/Manager/QXRoomMessageManager.h index f12a473..008d910 100644 --- a/QXLive/Manager/QXRoomMessageManager.h +++ b/QXLive/Manager/QXRoomMessageManager.h @@ -10,6 +10,7 @@ #import "QXRoomModel.h" #import "QXRoomFriendRelationModel.h" #import "QXRedPacketModel.h" +#import "QXUserSongListModel.h" typedef NS_ENUM(NSInteger) { /// 清空消息 @@ -20,6 +21,11 @@ typedef NS_ENUM(NSInteger) { QXRoomMessageTypeMuteRemoteAudio = 125, /// 关闭自己声音 QXRoomMessageTypeMuteLocalAudio = 126, + /// 发送|接收到心动信号 + QXRoomMessageTypeSendAndRecieveCpHeartSignal = 130, + /// cp双向奔赴 + QXRoomMessageTypeCpHeartFinished = 131, + /// 基础文本消息类型 QXRoomMessageTypeText = 1, /// 基础表情类型 @@ -132,6 +138,29 @@ typedef NS_ENUM(NSInteger) { QXRoomMessageTypeSendRedpacket = 1060, /// 红包已被抢完 QXRoomMessageTypeRedpacketFinished = 1061, + + /// 点歌房当前歌曲发生变化 + QXRoomMessageTypeSingerRoomCurrentSongDidChanged = 1070, + /// 点歌房下一首歌曲发生变化 + QXRoomMessageTypeSingerRoomNextSongDidChanged = 1071, + /// 歌曲数量发生变化 + QXRoomMessageTypeSingerRoomSongCountDidChanged = 1072, + + /// CP 特效 + QXRoomMessageTypeCpJoinRoom = 1080, + + + /// 开始签约 + QXRoomMessageTypeStartSign = 1090, + /// 结束签约 + QXRoomMessageTypeEndSign = 1092, + /// 签约延时 + QXRoomMessageTypeDelaySignTime = 1093, + /// 身价发生变化 + QXRoomMessageTypeSignBodyPriceDidChanged = 1091, + + /// 签约麦邀请 + QXRoomMessageTypeInviteSignUpSeat = 1094, }QXRoomMessageType; NS_ASSUME_NONNULL_BEGIN @protocol QXRoomMessageManagerDelegate @@ -268,22 +297,47 @@ NS_ASSUME_NONNULL_BEGIN /// 房间用户在线状态发生变化 //-(void)roomUserOnlineStatusDidChanged:(BOOL)isOnline userId:(NSString*)userId; + + +/// 点唱房当前歌曲信息发生变化 +-(void)singerSongCurrentSongInfoDidChanged:(QXUserSongListModel*)model; +/// 点唱房下一首歌信息发生变化 +-(void)singerSongNextSongInfoDidChanged:(QXUserSongListModel*)model; +/// 已点歌曲数量发生变化 +-(void)singerSongCountDidChanged:(NSString*)count; + + +/// 签约开始 +-(void)signDidStartWithEndTime:(NSString *)endTime signId:(NSString *)signId signDay:(NSString*)signDay signValue:(NSString*)signValue; +/// 签约结束 +-(void)signDidEndWithUserInfo1:(QXUserHomeModel*)userInfo1 userInfo2:(QXUserHomeModel*)userInfo2 sign_value:(NSString*)sign_value; +/// 签约身价变化 +-(void)signValueDidChangedWithSignUserInfo:(QXUserHomeModel*)signUserInfo sign_value:(NSString*)sign_value signId:(NSString*)signId sign_coin_list:(NSArray*)sign_coin_list; +/// 签约身价变化 +-(void)signTimeDelayWithEndTime:(NSString*)endTime; +/// 主持邀请上签约麦 +-(void)signSeatInviteWithUserId:(NSString*)userId content:(NSString*)content; + @end @interface QXRoomMessageManager : NSObject @property (nonatomic,weak)iddelegate; +(instancetype)shared; + +-(void)addC2CObserver; /// 加入房间群组 -(void)joinGroupWithRoomId:(NSString*)roomId; /// 退出房间群组 --(void)quitGroupWithRoomId:(NSString*)roomId; +-(void)quitGroupWithRoomId:(NSString*)roomId removeListener:(BOOL)removeListener; -(void)sendChatMessage:(NSString *)message messageType:(QXRoomMessageType)messageType needInsertMessage:(BOOL)needInsertMessage; /// 发送表情 -(void)sendChatEmoji:(QXEmojiModel *)emoji; -(void)sendC2CMessage:(NSString *)message messageType:(QXRoomMessageType)messageType userId:(NSString*)userId; + +-(void)showCpFinishedAlertViewWithText:(NSString*)text; @end @interface QXRoomMessage : NSObject diff --git a/QXLive/Manager/QXRoomMessageManager.m b/QXLive/Manager/QXRoomMessageManager.m index 1b50aca..10e1d7d 100644 --- a/QXLive/Manager/QXRoomMessageManager.m +++ b/QXLive/Manager/QXRoomMessageManager.m @@ -12,6 +12,9 @@ #import "QXGiftDisplayManager.h" #import #import "TUIChatConfig.h" +#import "QXDrifNobilityJoinRoomView.h" +#import "QXCustomAlertView.h" +#import "QXHeartBeatSpaceViewController.h" @interface QXRoomMessageManager() @property (nonatomic,strong)NSString *groupId; @@ -33,13 +36,15 @@ } return self; } +-(void)addC2CObserver{ + [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; +} -(void)joinGroupWithRoomId:(NSString *)roomId{ MJWeakSelf if (self.groupId) { - [self quitGroupWithRoomId:self.groupId]; + [self quitGroupWithRoomId:self.groupId removeListener:YES]; } [[V2TIMManager sharedInstance] addGroupListener:self]; - [[V2TIMManager sharedInstance] addSimpleMsgListener:self]; [[V2TIMManager sharedInstance] addAdvancedMsgListener:self]; NSString *groupId = [NSString stringWithFormat:@"room%@",roomId]; [[V2TIMManager sharedInstance] joinGroup:groupId msg:@"大家好,我来啦" succ:^{ @@ -51,13 +56,13 @@ QXLOG(@"腾讯IM加入聊天室失败-code%d-原因%@",code,desc); }]; } --(void)quitGroupWithRoomId:(NSString *)roomId{ - MJWeakSelf - self.groupId = nil; - self.roomId = nil; - [[V2TIMManager sharedInstance] removeGroupListener:self]; - [[V2TIMManager sharedInstance] removeSimpleMsgListener:self]; - [[V2TIMManager sharedInstance] removeAdvancedMsgListener:self]; +-(void)quitGroupWithRoomId:(NSString *)roomId removeListener:(BOOL)removeListener{ + if (removeListener) { + self.groupId = nil; + self.roomId = nil; + [[V2TIMManager sharedInstance] removeGroupListener:self]; + [[V2TIMManager sharedInstance] removeAdvancedMsgListener:self]; + } NSString *groupId = [NSString stringWithFormat:@"room%@",roomId]; [[V2TIMManager sharedInstance] quitGroup:groupId succ:^{ @@ -109,6 +114,9 @@ // md.play_image = jia_jia; [[QXGiftPlayerManager shareManager] displayChatEffectView:jia_jia]; } + if ([model.FromUserInfo.enter_image isExist]) { + [[QXDrifNobilityJoinRoomView shareView] addNobilityUserModel:model]; + } if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { [self.delegate didInsertMessge:model]; } @@ -624,13 +632,13 @@ // 1 在线 2离线 NSInteger type = 1; type = [msg.Text[@"type"] integerValue]; - BOOL isOnline = type == 1?YES:NO; +// BOOL isOnline = type == 1?YES:NO; // if (self.delegate && [self.delegate respondsToSelector:@selector(roomUserOnlineStatusDidChanged:userId:)]) { // [self.delegate roomUserOnlineStatusDidChanged:YES userId:userId]; // } NSDictionary *parm = @{ @"user_id":userId, - @"is_online":[NSNumber numberWithBool:isOnline], + @"is_online":[NSNumber numberWithInteger:type], }; [[NSNotificationCenter defaultCenter] postNotificationName:noticeRoomUserOnlineStatusDidChanged object:parm]; } @@ -649,6 +657,80 @@ } } break; + + case QXRoomMessageTypeSingerRoomCurrentSongDidChanged:{ + QXUserSongListModel *songInfo = [QXUserSongListModel yy_modelWithJSON:msg.Text[@"song_info"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(singerSongCurrentSongInfoDidChanged:)]) { + [self.delegate singerSongCurrentSongInfoDidChanged:songInfo]; + } + } + break; + case QXRoomMessageTypeSingerRoomNextSongDidChanged:{ + QXUserSongListModel *songInfo = [QXUserSongListModel yy_modelWithJSON:msg.Text[@"next_song_info"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(singerSongNextSongInfoDidChanged:)]) { + [self.delegate singerSongNextSongInfoDidChanged:songInfo]; + } + } + break; + case QXRoomMessageTypeSingerRoomSongCountDidChanged:{ + NSString *songCount = [NSString stringWithFormat:@"%@",msg.Text[@"count"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(singerSongCountDidChanged:)]) { + [self.delegate singerSongCountDidChanged:songCount]; + } + } + break; + case QXRoomMessageTypeCpJoinRoom:{ + QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; + [[QXGiftPlayerManager shareManager] displayCpEffectView:model]; + } + break; + case QXRoomMessageTypeStartSign:{ + NSString *sign_id = [NSString stringWithFormat:@"%@",msg.Text[@"sign_id"]]; + NSString *end_time = [NSString stringWithFormat:@"%@",msg.Text[@"end_time"]]; + NSString *sign_day = [NSString stringWithFormat:@"%@",msg.Text[@"sign_day"]]; + NSString *current_body_value = [NSString stringWithFormat:@"%@",msg.Text[@"current_body_value"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(signDidStartWithEndTime:signId:signDay:signValue:)]) { + [self.delegate signDidStartWithEndTime:end_time signId:sign_id signDay:sign_day signValue:current_body_value]; + } + } + break; + case QXRoomMessageTypeEndSign:{ + QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; + NSString *sign_value = [NSString stringWithFormat:@"%@",msg.Text[@"sign_value"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(signDidEndWithUserInfo1:userInfo2:sign_value:)]) { + [self.delegate signDidEndWithUserInfo1:model.FromUserInfo userInfo2:model.ToUserInfo sign_value:sign_value]; + } + } + break; + case QXRoomMessageTypeDelaySignTime:{ + NSString *end_time = [NSString stringWithFormat:@"%@",msg.Text[@"end_time"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(signTimeDelayWithEndTime:)]) { + [self.delegate signTimeDelayWithEndTime:end_time]; + } + } + break; + case QXRoomMessageTypeSignBodyPriceDidChanged:{ + QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; + NSString *sign_id = [NSString stringWithFormat:@"%@",msg.Text[@"sign_id"]]; + NSString *sign_value = [NSString stringWithFormat:@"%@",msg.Text[@"sign_value"]]; + NSArray *sign_coin_list; + id object = msg.Text[@"sign_coin_list"]; + if ([object isKindOfClass:[NSArray class]]) { + sign_coin_list = object; + } + if (self.delegate && [self.delegate respondsToSelector:@selector(signValueDidChangedWithSignUserInfo:sign_value:signId:sign_coin_list:)]) { + [self.delegate signValueDidChangedWithSignUserInfo:model.FromUserInfo sign_value:sign_value signId:sign_id sign_coin_list:sign_coin_list]; + } + } + break; + case QXRoomMessageTypeInviteSignUpSeat:{ + NSString *user_id = [NSString stringWithFormat:@"%@",msg.Text[@"user_id"]]; + NSString *text = [NSString stringWithFormat:@"%@",msg.Text[@"text"]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(signSeatInviteWithUserId:content:)]) { + [self.delegate signSeatInviteWithUserId:user_id content:text]; + } + } + break; default: break; } @@ -668,6 +750,46 @@ */ +-(void)reSendGiftWithId:(NSString*)giftId userId:(NSString*)userId{ + MJWeakSelf + [QXMineNetwork userCpReSendWithGiftId:giftId userId:userId roomId:self.roomId successBlock:^(NSDictionary * _Nonnull dict) { + + id object = dict[@"cp_type"]; + if ([object isKindOfClass:[NSDictionary class]]) { + NSDictionary *cpDict = (NSDictionary *)object; + NSString *cp_type = object[@"cp_type"]; + if (cp_type.intValue == 1) { + /// 单向送cp礼物 + NSString *jsonStr = [cpDict jsonStringEncoded]; + [[QXRoomMessageManager shared] sendC2CMessage:jsonStr messageType:(QXRoomMessageTypeSendAndRecieveCpHeartSignal) userId:userId]; + }else if (cp_type.intValue == 2){ + /// cp礼物已达成双向绑定 + NSString *jsonStr = [cpDict jsonStringEncoded]; + [[QXRoomMessageManager shared] sendC2CMessage:jsonStr messageType:(QXRoomMessageTypeCpHeartFinished) userId:userId]; + NSString *message = [NSString stringWithFormat:@"%@",cpDict[@"text"]]; + [weakSelf showCpFinishedAlertViewWithText:message]; + }else{ + + } + } + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)showCpFinishedAlertViewWithText:(NSString*)text{ + QXCustomAlertView *alertView = [[QXCustomAlertView alloc] init]; + + [alertView showInView:KEYWINDOW title:@"缘定三生 此刻同心" message:text cancleTitle:@"稍后进入" commitTitle:@"进入心动空间"]; + + alertView.commitBlock = ^{ + QXLOG(@"进入心动空间"); + QXHeartBeatSpaceViewController *vc = [[QXHeartBeatSpaceViewController alloc] init]; + QXRoomNavigationController *navagationController = (QXRoomNavigationController*)KEYWINDOW.rootViewController; + vc.userId = QXGlobal.shareGlobal.loginModel.user_id; + [navagationController pushViewController:vc animated:YES]; + }; +} -(void)onRecvC2CTextMessage:(NSString *)msgID sender:(V2TIMUserInfo *)info text:(NSString *)text{ @@ -684,6 +806,23 @@ if (self.delegate && [self.delegate respondsToSelector:@selector(pkMuteRemoteAudio:fromUserInfo:)]) { [self.delegate pkMuteRemoteAudio:is_mute==1 fromUserInfo:model.FromUserInfo]; } + }else if (meesageType == QXRoomMessageTypeSendAndRecieveCpHeartSignal){ + NSString *json = [NSString stringWithFormat:@"%@",msg.Text[@"text"]]; + NSDictionary *dict = [json jsonValueDecoded]; + NSString *message = [NSString stringWithFormat:@"%@",dict[@"text1"]]; + __block NSString *gift_id = [NSString stringWithFormat:@"%@",dict[@"gift_id"]]; + QXRoomChatListModel *model = [QXRoomChatListModel yy_modelWithJSON:msg.Text]; + QXCustomAlertView *alertView = [[QXCustomAlertView alloc] init]; + [alertView showInView:KEYWINDOW title:@"心动信号" message:message cancleTitle:@"再想想" commitTitle:@"回赠"]; + MJWeakSelf + alertView.commitBlock = ^{ + [weakSelf reSendGiftWithId:gift_id userId:model.FromUserInfo.user_id]; + }; + }else if (meesageType == QXRoomMessageTypeCpHeartFinished){ + NSString *json = [NSString stringWithFormat:@"%@",msg.Text[@"text"]]; + NSDictionary *dict = [json jsonValueDecoded]; + NSString *message = [NSString stringWithFormat:@"%@",dict[@"text1"]]; + [self showCpFinishedAlertViewWithText:message]; } } -(void)onRecvGroupCustomMessage:(NSString *)msgID groupID:(NSString *)groupID sender:(V2TIMGroupMemberInfo *)info customData:(NSData *)data{ @@ -715,7 +854,7 @@ }else if (meesageType == QXRoomMessageTypeMuteLocalAudio){ NSString *json = [NSString stringWithFormat:@"%@",msg.Text[@"text"]]; NSDictionary *dict = [json jsonValueDecoded]; - NSInteger is_mute = [[dict objectForKey:@"is_mute"] integerValue]; +// NSInteger is_mute = [[dict objectForKey:@"is_mute"] integerValue]; QXUserHomeModel *userModel = [QXUserHomeModel yy_modelWithJSON:msg.Text[@"FromUserInfo"]]; AgoraRtcAudioVolumeInfo *userInfo = [[AgoraRtcAudioVolumeInfo alloc] init]; userInfo.uid = userModel.user_id.longLongValue; @@ -743,6 +882,8 @@ @"avatar":[QXGlobal shareGlobal].loginModel.avatar?[QXGlobal shareGlobal].loginModel.avatar:@"", @"icon":[QXGlobal shareGlobal].loginModel.icon?[QXGlobal shareGlobal].loginModel.icon:@"", @"chat_bubble":[QXGlobal shareGlobal].loginModel.chat_bubble?:@"", + @"nobility_image":[QXGlobal shareGlobal].loginModel.nobility_image?:@"", + @"nickname_color":[QXGlobal shareGlobal].loginModel.nickname_color?:@"", }, @"text":message } @@ -756,6 +897,8 @@ userInfo.user_id = [QXGlobal shareGlobal].loginModel.user_id; userInfo.icon = [QXGlobal shareGlobal].loginModel.icon; userInfo.chat_bubble = [QXGlobal shareGlobal].loginModel.chat_bubble; + userInfo.nobility_image = [QXGlobal shareGlobal].loginModel.nobility_image; + userInfo.nickname_color = [QXGlobal shareGlobal].loginModel.nickname_color; model.FromUserInfo = userInfo; model.messageType = QXRoomChatMessageTypeChat; if (self.delegate && [self.delegate respondsToSelector:@selector(didInsertMessge:)]) { @@ -783,6 +926,8 @@ @"avatar":[QXGlobal shareGlobal].loginModel.avatar?[QXGlobal shareGlobal].loginModel.avatar:@"", @"icon":[QXGlobal shareGlobal].loginModel.icon?[QXGlobal shareGlobal].loginModel.icon:@"", @"chat_bubble":[QXGlobal shareGlobal].loginModel.chat_bubble?:@"", + @"nobility_image":[QXGlobal shareGlobal].loginModel.nobility_image?:@"", + @"nickname_color":[QXGlobal shareGlobal].loginModel.nickname_color?:@"", }, @"emoji":@{ @"image":emoji.image?:@"", @@ -799,6 +944,8 @@ userInfo.user_id = [QXGlobal shareGlobal].loginModel.user_id; userInfo.icon = [QXGlobal shareGlobal].loginModel.icon; userInfo.chat_bubble = [QXGlobal shareGlobal].loginModel.chat_bubble; + userInfo.nobility_image = [QXGlobal shareGlobal].loginModel.nobility_image; + userInfo.nickname_color = [QXGlobal shareGlobal].loginModel.nickname_color; model.FromUserInfo = userInfo; model.messageType = QXRoomChatMessageTypeEmoji; model.emoji = emoji; @@ -843,9 +990,9 @@ [[V2TIMManager sharedInstance] sendMessage:message1 receiver:toUserId groupID:nil priority:(V2TIM_PRIORITY_HIGH) onlineUserOnly:YES offlinePushInfo:nil progress:^(uint32_t progress) { } succ:^{ - + QXLOG(@"c2c发送成功"); } fail:^(int code, NSString * _Nullable desc) { - + QXLOG(@"c2c发送失败"); }]; } @end diff --git a/QXLive/Message(音信)/Controller/QXChatViewController.m b/QXLive/Message(音信)/Controller/QXChatViewController.m index df91f03..758da74 100644 --- a/QXLive/Message(音信)/Controller/QXChatViewController.m +++ b/QXLive/Message(音信)/Controller/QXChatViewController.m @@ -77,7 +77,7 @@ -(void)moreAction{ if (self.data.groupID.length>0) { QXGuildGroupSettingVC *vc = [[QXGuildGroupSettingVC alloc] init]; - vc.groupId = [self.data.groupID stringByReplacingOccurrencesOfString:@"g" withString:@""]; + vc.groupId = self.data.groupID; [self.navigationController pushViewController:vc animated:YES]; }else{ QXMenuPopView *menuView = [[QXMenuPopView alloc] initWithPoint:CGPointMake(SCREEN_WIDTH-60, NavContentHeight+10)]; @@ -103,6 +103,7 @@ } - (void)initSubViews{ +// TUIConversationListBaseDataProvider markConversationAsRead [TUIChatConfig_Classic sharedConfig].delegate = self; if (self.data.groupID.length>0) { TUIGroupChatViewController *vc = [[TUIGroupChatViewController alloc] init]; diff --git a/QXLive/Message(音信)/Controller/QXMessageViewController.m b/QXLive/Message(音信)/Controller/QXMessageViewController.m index 517aa82..cd56e3b 100644 --- a/QXLive/Message(音信)/Controller/QXMessageViewController.m +++ b/QXLive/Message(音信)/Controller/QXMessageViewController.m @@ -74,14 +74,15 @@ [self.view addSubview:vc.view]; } -(void)reloadConversions{ - [self.vc.view removeFromSuperview]; - [self.vc removeFromParentViewController]; - self.vc = nil; - self.vc = [[TUIConversationListController alloc] init]; - self.vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, self.view.height-NavContentHeight); - self.vc.tableViewForAll.tableHeaderView = self.topView; - [self addChildViewController:self.vc]; - [self.view addSubview:self.vc.view]; +// [self.vc.view removeFromSuperview]; +// [self.vc removeFromParentViewController]; +// self.vc = nil; +// self.vc = [[TUIConversationListController alloc] init]; +// self.vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, self.view.height-NavContentHeight); +// self.vc.tableViewForAll.tableHeaderView = self.topView; +// [self addChildViewController:self.vc]; +// [self.view addSubview:self.vc.view]; + [self.vc reloadConversationList]; } - (void)conversationListController:(UIViewController *)conversationController @@ -98,6 +99,7 @@ data.title = conversation.title; data.faceUrl = conversation.faceUrl; vc.data = data; + [self.vc.dataProvider markConversationAsRead:conversation]; [self.navigationController pushViewController:vc animated:YES]; // } diff --git a/QXLive/Message(音信)/Controller/QXSystemNoticeViewController.m b/QXLive/Message(音信)/Controller/QXSystemNoticeViewController.m index bbc7ead..edd3cf3 100644 --- a/QXLive/Message(音信)/Controller/QXSystemNoticeViewController.m +++ b/QXLive/Message(音信)/Controller/QXSystemNoticeViewController.m @@ -8,9 +8,10 @@ #import "QXSystemNoticeViewController.h" #import "QXSystemNoticeCell.h" #import "QXSystemMessageCell.h" +#import "QXSystemMessageHandleCell.h" #import "QXMessageServices.h" #import "AppDelegate.h" -@interface QXSystemNoticeViewController () +@interface QXSystemNoticeViewController () @property (nonatomic,strong)UITableView *tableView; @property (nonatomic,assign)CGFloat rowHeight; @end @@ -78,12 +79,23 @@ cell.model = self.dataArray[indexPath.row]; return cell; }else{ - QXSystemMessageCell *cell = [QXSystemMessageCell cellWithTableView:tableView]; - cell.model = self.dataArray[indexPath.row]; - return cell; + QXMessageListModel *model = self.dataArray[indexPath.row]; + if (model.type.intValue == 6 || model.type.intValue == 7) { + /// 公会邀请 和 + QXSystemMessageHandleCell *cell = [QXSystemMessageHandleCell cellWithTableView:tableView]; + cell.model = model; + cell.delegate = self; + return cell; + }else{ + QXSystemMessageCell *cell = [QXSystemMessageCell cellWithTableView:tableView]; + cell.model = model; + return cell; + } + } } + -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ QXMessageListModel *model = self.dataArray[indexPath.row]; if (model.room_id.integerValue > 0) { @@ -97,13 +109,22 @@ } } +-(void)handleInviteIsAgree:(BOOL)isAgree message:(nonnull QXMessageListModel *)message{ + MJWeakSelf + [QXMessageServices guildInviteApplyHandleWithApplyId:message.id type:isAgree?@"1":@"2" successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"操作成功"); + weakSelf.page = 1; + [weakSelf getMessageList]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} -(UITableView *)tableView{ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStylePlain)]; _tableView.dataSource = self; _tableView.delegate = self; _tableView.backgroundColor = [UIColor clearColor]; - _tableView.rowHeight = 60; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; _tableView.rowHeight = UITableViewAutomaticDimension; _tableView.estimatedRowHeight = self.rowHeight; diff --git a/QXLive/Message(音信)/Model/QXMessageModel.h b/QXLive/Message(音信)/Model/QXMessageModel.h index d39fb68..da06ad1 100644 --- a/QXLive/Message(音信)/Model/QXMessageModel.h +++ b/QXLive/Message(音信)/Model/QXMessageModel.h @@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN @property (strong,nonatomic)NSString *image; @property (strong,nonatomic)NSString *url; +/// 公会邀请处理状态 0未处理 1已通过 2已拒绝 +@property (strong,nonatomic)NSString *guild_invited_status; @property (strong,nonatomic)NSString *room_id; @end diff --git a/QXLive/Message(音信)/Services/QXMessageServices.h b/QXLive/Message(音信)/Services/QXMessageServices.h index 5f7a42c..90623ab 100644 --- a/QXLive/Message(音信)/Services/QXMessageServices.h +++ b/QXLive/Message(音信)/Services/QXMessageServices.h @@ -31,6 +31,13 @@ NS_ASSUME_NONNULL_BEGIN +(void)getMessageWithId:(NSString*)Id successBlock:(void (^)(QXMessageListModel *model))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; +/** + 消息工会邀请处理 + */ ++(void)guildInviteApplyHandleWithApplyId:(NSString*)applyId + type:(NSString*)type + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Message(音信)/Services/QXMessageServices.m b/QXLive/Message(音信)/Services/QXMessageServices.m index a694d41..6a694cf 100644 --- a/QXLive/Message(音信)/Services/QXMessageServices.m +++ b/QXLive/Message(音信)/Services/QXMessageServices.m @@ -48,4 +48,24 @@ failBlock(error,msg); }]; } + +/** + 消息工会邀请处理 + */ ++(void)guildInviteApplyHandleWithApplyId:(NSString*)applyId + type:(NSString*)type + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"apply_id":applyId?:@"", + @"type":type?type:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXGuildInviteApplyHandle parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} @end diff --git a/QXLive/Message(音信)/View/QXSystemMessageHandleCell.h b/QXLive/Message(音信)/View/QXSystemMessageHandleCell.h new file mode 100644 index 0000000..543cf4a --- /dev/null +++ b/QXLive/Message(音信)/View/QXSystemMessageHandleCell.h @@ -0,0 +1,32 @@ +// +// QXSystemMessageHandleCell.h +// QXLive +// +// Created by 启星 on 2025/11/22. +// + +#import +#import "QXMessageModel.h" +NS_ASSUME_NONNULL_BEGIN +@protocol QXSystemMessageHandleCellDelegate + +@optional +-(void)handleInviteIsAgree:(BOOL)isAgree message:(QXMessageListModel*)message; + +@end + +@interface QXSystemMessageHandleCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (weak, nonatomic) IBOutlet UIButton *cancelBtn; +@property (weak, nonatomic) IBOutlet UIButton *commitBtn; +@property (weak, nonatomic) IBOutlet UILabel *timeLabel; +@property (weak, nonatomic) IBOutlet UIButton *stateBtn; + +@property (weak, nonatomic) IBOutlet UILabel *contentLabel; + +@property (weak, nonatomic) id delegate; +@property (nonatomic,strong)QXMessageListModel *model; ++(instancetype)cellWithTableView:(UITableView *)tableView; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Message(音信)/View/QXSystemMessageHandleCell.m b/QXLive/Message(音信)/View/QXSystemMessageHandleCell.m new file mode 100644 index 0000000..acd2e9b --- /dev/null +++ b/QXLive/Message(音信)/View/QXSystemMessageHandleCell.m @@ -0,0 +1,66 @@ +// +// QXSystemMessageHandleCell.m +// QXLive +// +// Created by 启星 on 2025/11/22. +// + +#import "QXSystemMessageHandleCell.h" + +@implementation QXSystemMessageHandleCell ++(instancetype)cellWithTableView:(UITableView *)tableView{ + static NSString *cellId = @"QXSystemMessageHandleCell"; + QXSystemMessageHandleCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; + if (!cell) { + cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject; + cell.backgroundColor = [UIColor clearColor]; + } + return cell; +} + +-(void)setModel:(QXMessageListModel *)model{ + _model = model; + self.contentLabel.text = model.content; + NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //此处根据项目需求,选择是否除以1000 , 如果时间戳精确到秒则去掉1000 + NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; + formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; + NSString*time = [formatter stringFromDate:date]; + self.timeLabel.text = time; + if (model.guild_invited_status.intValue == 0) { + self.cancelBtn.hidden = NO; + self.commitBtn.hidden = NO; + self.stateBtn.hidden = YES; + }else if (model.guild_invited_status.intValue == 1){ + self.cancelBtn.hidden = YES; + self.commitBtn.hidden = YES; + self.stateBtn.hidden = NO; + self.stateBtn.selected = NO; + }else if (model.guild_invited_status.intValue == 2){ + self.cancelBtn.hidden = YES; + self.commitBtn.hidden = YES; + self.stateBtn.hidden = NO; + self.stateBtn.selected = YES; + } +} +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} +- (IBAction)cancelAction:(id)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(handleInviteIsAgree:message:)]) { + [self.delegate handleInviteIsAgree:NO message:self.model]; + } +} +- (IBAction)commitAction:(id)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(handleInviteIsAgree:message:)]) { + [self.delegate handleInviteIsAgree:YES message:self.model]; + } +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/QXLive/Message(音信)/View/QXSystemMessageHandleCell.xib b/QXLive/Message(音信)/View/QXSystemMessageHandleCell.xib new file mode 100644 index 0000000..a15562d --- /dev/null +++ b/QXLive/Message(音信)/View/QXSystemMessageHandleCell.xib @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QXLive/Mine(音域)/Controller/QXMineViewController.m b/QXLive/Mine(音域)/Controller/QXMineViewController.m index 4e08fbc..6478949 100644 --- a/QXLive/Mine(音域)/Controller/QXMineViewController.m +++ b/QXLive/Mine(音域)/Controller/QXMineViewController.m @@ -29,19 +29,32 @@ #import "QXInviteViewController.h" #import "QXChatViewController.h" #import "QXWalletRuleView.h" +#import "QXRechargeViewcController.h" +#import "QXGiftWallViewController.h" +#import "QXNobilityViewController.h" +#import "QXHomePageNetwork.h" +#import "QXRoomSingerAuthViewController.h" +#import "QXMineSongListViewController.h" +#import "QXIntimateViewController.h" +#import "QXBodyPriceRuleView.h" +#import "QXFamilyViewController.h" +#import @interface QXMineViewController () @property (nonatomic,strong)QXMainHeaderView *tableHeaderView; @property (nonatomic,strong)UITableView *tableView; -@property (nonatomic,strong)UIButton *redbagBtn; -@property (nonatomic,strong)UIButton *serviceBtn; -@property (nonatomic,strong)UIButton *settingBtn; +//@property (nonatomic,strong)UIButton *redbagBtn; +//@property (nonatomic,strong)UIButton *serviceBtn; +//@property (nonatomic,strong)UIButton *settingBtn; @property (nonatomic,strong)QXUserModel *userModel; +@property (nonatomic,strong)NSMutableArray *bannerArry; +@property (nonatomic,strong)NSString *cancelCode; @end @implementation QXMineViewController - (void)viewDidLoad { + self.isNoChangeBgImage = YES; [super viewDidLoad]; // Do any additional setup after loading the view. @@ -50,78 +63,136 @@ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:YES]; [self getUserInfo]; - [self.tableView reloadData]; - if (QXGlobal.shareGlobal.isOpenRecharge) { - self.redbagBtn.hidden = NO; - }else{ - self.redbagBtn.hidden = YES; - } + [self.tableHeaderView reloadData]; } - (void)initSubViews{ + [self updateBgImage:@"app_home_bg"]; self.tableView.tableHeaderView = self.tableHeaderView; [self.view addSubview:self.tableView]; - [self.view addSubview:self.settingBtn]; - [self.view addSubview:self.serviceBtn]; - [self.view addSubview:self.redbagBtn]; - [self.settingBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(kSafeAreaTop +10); - make.right.mas_equalTo(-10); - make.width.height.mas_equalTo(30); - }]; - - [self.serviceBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.height.mas_equalTo(30); - make.centerY.equalTo(self.settingBtn); - make.right.equalTo(self.settingBtn.mas_left).offset(-10); - }]; - [self.redbagBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.serviceBtn.mas_left).offset(-10); - make.centerY.width.height.equalTo(self.settingBtn); - }]; +// [self.view addSubview:self.settingBtn]; +// [self.view addSubview:self.serviceBtn]; +// [self.view addSubview:self.redbagBtn]; +// [self.settingBtn mas_makeConstraints:^(MASConstraintMaker *make) { +// make.top.mas_equalTo(kSafeAreaTop +10); +// make.right.mas_equalTo(-10); +// make.width.height.mas_equalTo(30); +// }]; +// +// [self.serviceBtn mas_makeConstraints:^(MASConstraintMaker *make) { +// make.width.height.mas_equalTo(30); +// make.centerY.equalTo(self.settingBtn); +// make.right.equalTo(self.settingBtn.mas_left).offset(-10); +// }]; +// [self.redbagBtn mas_makeConstraints:^(MASConstraintMaker *make) { +// make.right.equalTo(self.serviceBtn.mas_left).offset(-10); +// make.centerY.width.height.equalTo(self.settingBtn); +// }]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(passwordDidChanged) name:noticeChangePassword object:nil]; + [self getBanner]; } -(void)getUserInfo{ MJWeakSelf [QXMineNetwork getMineInfoSuccessBlock:^(QXUserModel * _Nonnull userModel) { weakSelf.userModel = userModel; weakSelf.tableHeaderView.userModel = userModel; + [weakSelf.tableView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; + + [QXMineNetwork getWalletInfoSuccessBlock:^(NSString * _Nonnull coin, NSString * _Nonnull earnings, NSString * _Nonnull title, NSString * _Nonnull url) { + weakSelf.tableHeaderView.coin = coin; + weakSelf.tableHeaderView.earnings = earnings; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; } #pragma mark - QXMineServiceCellDelegate --(void)didClickServiceWithBtn:(UIButton *)button title:(NSString *)title{ - UIViewController *vc; - if ([title isEqualToString:QXText(@"道具商城")]) { - vc = [[QXPropShopViewController alloc] init]; - }else if([title isEqualToString:QXText(@"段位")]){ - vc = [[QXLevelViewController alloc] init]; - }else if([title isEqualToString:QXText(@"公会中心")]){ - vc = [[QXGuildViewController alloc] init]; - }else if([title isEqualToString:QXText(@"个性装扮")]){ - vc = [[QXDressViewController alloc] init]; - }else if([title isEqualToString:QXText(@"我的背包")]){ - vc = [[QXBackpackViewController alloc] init]; - }else if([title isEqualToString:QXText(@"每日任务")]){ - vc = [[QXTaskViewController alloc] init]; - }else if([title isEqualToString:QXText(@"钱包")]){ - BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:kWalletRuleHide]; - if (result) { - vc = [[QXWalletViewController alloc] init]; - }else{ - QXWalletRuleView *ruleView = [[QXWalletRuleView alloc] init]; - MJWeakSelf - ruleView.toWalletBlock = ^{ - QXWalletViewController*vc = [[QXWalletViewController alloc] init]; - [weakSelf.navigationController pushViewController:vc animated:YES]; - }; - [ruleView showInView:self.view]; - return; +-(void)didClickServiceWithType:(QXMineServiceType)type{ + switch (type) { + case QXMineServiceTypeLevel:{ + QXLevelViewController *vc = [[QXLevelViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; } + break; + case QXMineServiceTypeDress:{ + QXDressViewController *vc = [[QXDressViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMineServiceTypeBackpack:{ + QXBackpackViewController *vc = [[QXBackpackViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMineServiceTypeSetting:{ + [self gotoSetting]; + } + break; + case QXMineServiceTypeFamily:{ + QXLOG(@"跳转家族"); + QXFamilyViewController *vc = [[QXFamilyViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMineServiceTypeHelp:{ + [self gotoService]; + } + break; + case QXMineServiceTypeInvite:{ + [self gotoInvite]; + } + break; + case QXMineServiceTypeDayTask:{ + QXTaskViewController *vc = [[QXTaskViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMineServiceTypeReport:{ + [self gotoService]; + } + break; + case QXMineServiceTypeCustomerService:{ + WXOpenCustomerServiceReq *req = [[WXOpenCustomerServiceReq alloc] init]; + req.corpid = @"ww1de4300858c0b461"; + req.url = @"https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; + [WXApi sendReq:req completion:nil]; + } + break; + case QXMineServiceTypeSingerAuth:{ + QXLOG(@"点击了歌手认证"); + MJWeakSelf + if (![QXGlobal shareGlobal].isRealName) { + QXLOG(@"未实名,弹出实名认证"); + QXRealNamePopView *v = [[QXRealNamePopView alloc] init]; + v.closeActionBlock = ^{ + [[QXGlobal shareGlobal] hideViewBlock:^{}]; + }; + v.authActionBlock = ^{ + [[QXGlobal shareGlobal] hideViewBlock:^{ + QXRoomSingerAuthViewController *vc = [[QXRoomSingerAuthViewController alloc] init]; + vc.singer_status = weakSelf.userModel.singer_status; + [weakSelf.navigationController pushViewController:vc animated:YES]; + }]; + }; + [[QXGlobal shareGlobal] showView:v popType:(PopViewTypePopFromCenter) tapDismiss:NO finishBlock:^{}]; + }else{ + QXRoomSingerAuthViewController *vc = [[QXRoomSingerAuthViewController alloc] init]; + vc.singer_status = weakSelf.userModel.singer_status; + [weakSelf.navigationController pushViewController:vc animated:YES]; + } + } + break; + case QXMineServiceTypeSongList:{ + QXLOG(@"我的歌单"); + QXMineSongListViewController *vc = [[QXMineSongListViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + default: + break; } - [self.navigationController pushViewController:vc animated:YES]; - QXLOG(@"点击了%@",title); } -(void)didClickOptionType:(QXMainHeaderOptionType)type{ MJWeakSelf @@ -140,12 +211,63 @@ [self.navigationController pushViewController:vc animated:YES]; } break; - case QXMainHeaderOptionTypeRealName:{ - QXLOG(@"跳转实名认证"); + case QXMainHeaderOptionTypeNobility:{ + QXLOG(@"跳转贵族"); + QXNobilityViewController *vc = [[QXNobilityViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; } break; - case QXMainHeaderOptionTypeAnchorCenter:{ - QXLOG(@"跳转主播中心"); + case QXMainHeaderOptionTypeRecharge:{ + QXLOG(@"跳转充值"); + QXRechargeViewcController *vc = [[QXRechargeViewcController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMainHeaderOptionTypeShop:{ + QXLOG(@"跳转商城"); + QXPropShopViewController *vc = [[QXPropShopViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMainHeaderOptionTypeGuild:{ + QXLOG(@"跳转公会"); + QXGuildViewController *vc = [[QXGuildViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMainHeaderOptionTypeFriend:{ + QXLOG(@"跳转挚友"); + QXIntimateViewController *vc = [[QXIntimateViewController alloc] init]; + vc.userId = QXGlobal.shareGlobal.loginModel.user_id; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMainHeaderOptionTypeGiftWall:{ + QXLOG(@"跳转礼物墙"); + QXGiftWallViewController *vc = [[QXGiftWallViewController alloc] init]; + vc.userId = [QXGlobal shareGlobal].loginModel.user_id; + [self.navigationController pushViewController:vc animated:YES]; + } + break; + case QXMainHeaderOptionTypeBodyPrice:{ + [QXBodyPriceRuleView showInView:self.view currentBodyValue:self.userModel.market_value coin:self.userModel.market_value_coin bodyValue:self.userModel.market_value_market]; + } + break; + case QXMainHeaderOptionTypeWallet:{ + QXLOG(@"跳转钱包"); + BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:kWalletRuleHide]; + if (result) { + QXWalletViewController * vc = [[QXWalletViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + }else{ + QXWalletRuleView *ruleView = [[QXWalletRuleView alloc] init]; + MJWeakSelf + ruleView.toWalletBlock = ^{ + QXWalletViewController*vc = [[QXWalletViewController alloc] init]; + [weakSelf.navigationController pushViewController:vc animated:YES]; + }; + [ruleView showInView:self.view]; + } } break; case QXMainHeaderOptionTypeRoom:{ @@ -198,20 +320,46 @@ #pragma mark - UITableViewDelegate,UITableViewDataSource -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ - return 1; + return 2; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ QXMineServiceCell *cell = [QXMineServiceCell cellWithTableView:tableView]; cell.delegate = self; - [cell cellReload]; + cell.singerIsAuth = self.userModel.singer_status.intValue==1; + if (indexPath.row == 0) { + cell.isMore = NO; + }else{ + cell.isMore = YES; + } return cell; } - +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.row == 0) { +// return ScaleWidth(168); + return ScaleWidth(110); + }else{ +// if (QXGlobal.shareGlobal.isOpenRecharge) { + return ScaleWidth(168); +// }else{ +// return ScaleWidth(110); +// } + } +} +-(void)getBanner{ + MJWeakSelf + [QXHomePageNetwork homeBannerWithType:@"6" successBlock:^(NSArray * _Nonnull list) { + weakSelf.tableHeaderView.bannerArray = list; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} -(void)gotoSetting{ QXSettingViewController *vc = [[QXSettingViewController alloc] init]; + vc.haveNobility = self.userModel.is_hide.intValue == 1; MJWeakSelf - vc.logOutBlock = ^(BOOL isCancel) { + vc.logOutBlock = ^(BOOL isCancel, NSString * _Nonnull code) { + weakSelf.cancelCode = code; if (isCancel) { [weakSelf performSelector:@selector(cancelAccount) afterDelay:0.5]; }else{ @@ -220,7 +368,7 @@ }; [self.navigationController pushViewController:vc animated:YES]; } --(void)gotoRedbag{ +-(void)gotoInvite{ QXInviteViewController *vc = [[QXInviteViewController alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } @@ -252,59 +400,64 @@ } -(void)cancelAccount{ - [QXMineNetwork cancelAccountSuccessBlock:^(NSDictionary * _Nonnull dict) { +// [QXMineNetwork cancelAccountWithCode:self.cancelCode successBlock:^(NSDictionary * _Nonnull dict) { [[QXGlobal shareGlobal] logOut]; - } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - showToast(msg); - }]; +// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { +// showToast(msg); +// }]; } -(QXMainHeaderView *)tableHeaderView{ if (!_tableHeaderView) { - _tableHeaderView = [[QXMainHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 230+12-67+ScaleWidth(67))]; + _tableHeaderView = [[QXMainHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0)]; + _tableHeaderView.height = _tableHeaderView.getHeight; _tableHeaderView.delegate = self; } return _tableHeaderView; } -(UITableView *)tableView{ if (!_tableView) { - self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-TabbarContentHeight-kSafeAreaTop) style:UITableViewStylePlain]; + self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-TabbarContentHeight) style:UITableViewStylePlain]; self.tableView.backgroundColor = [UIColor clearColor]; self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - - self.tableView.rowHeight = 164; } return _tableView; } --(UIButton *)settingBtn{ - if (!_settingBtn) { - _settingBtn = [[UIButton alloc] init]; - [_settingBtn setImage:[UIImage imageNamed:@"mine_setting"] forState:UIControlStateNormal]; - [_settingBtn setImage:[UIImage imageNamed:@"mine_setting"] forState:UIControlStateHighlighted]; - [_settingBtn addTarget:self action:@selector(gotoSetting) forControlEvents:UIControlEventTouchUpInside]; +-(NSMutableArray *)bannerArry{ + if (!_bannerArry) { + _bannerArry = [NSMutableArray array]; } - return _settingBtn; -} -- (UIButton *)redbagBtn { - if (!_redbagBtn) { - _redbagBtn = [[UIButton alloc] init]; - [_redbagBtn setImage:[UIImage imageNamed:@"mine_redbag"] forState:UIControlStateNormal]; - [_redbagBtn setImage:[UIImage imageNamed:@"mine_redbag"] forState:UIControlStateHighlighted]; - [_redbagBtn addTarget:self action:@selector(gotoRedbag) forControlEvents:UIControlEventTouchUpInside]; - } - return _redbagBtn; -} - -- (UIButton *)serviceBtn { - if (!_serviceBtn) { - _serviceBtn = [[UIButton alloc] init]; - [_serviceBtn setImage:[UIImage imageNamed:@"mine_service"] forState:UIControlStateNormal]; - [_serviceBtn setImage:[UIImage imageNamed:@"mine_service"] forState:UIControlStateHighlighted]; - [_serviceBtn addTarget:self action:@selector(gotoService) forControlEvents:UIControlEventTouchUpInside]; - } - return _serviceBtn; + return _bannerArry; } +//-(UIButton *)settingBtn{ +// if (!_settingBtn) { +// _settingBtn = [[UIButton alloc] init]; +// [_settingBtn setImage:[UIImage imageNamed:@"mine_setting"] forState:UIControlStateNormal]; +// [_settingBtn setImage:[UIImage imageNamed:@"mine_setting"] forState:UIControlStateHighlighted]; +// [_settingBtn addTarget:self action:@selector(gotoSetting) forControlEvents:UIControlEventTouchUpInside]; +// } +// return _settingBtn; +//} +//- (UIButton *)redbagBtn { +// if (!_redbagBtn) { +// _redbagBtn = [[UIButton alloc] init]; +// [_redbagBtn setImage:[UIImage imageNamed:@"mine_redbag"] forState:UIControlStateNormal]; +// [_redbagBtn setImage:[UIImage imageNamed:@"mine_redbag"] forState:UIControlStateHighlighted]; +// [_redbagBtn addTarget:self action:@selector(gotoRedbag) forControlEvents:UIControlEventTouchUpInside]; +// } +// return _redbagBtn; +//} +// +//- (UIButton *)serviceBtn { +// if (!_serviceBtn) { +// _serviceBtn = [[UIButton alloc] init]; +// [_serviceBtn setImage:[UIImage imageNamed:@"mine_service"] forState:UIControlStateNormal]; +// [_serviceBtn setImage:[UIImage imageNamed:@"mine_service"] forState:UIControlStateHighlighted]; +// [_serviceBtn addTarget:self action:@selector(gotoService) forControlEvents:UIControlEventTouchUpInside]; +// } +// return _serviceBtn; +//} @end diff --git a/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m b/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m index a4110d8..dea294f 100644 --- a/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m +++ b/QXLive/Mine(音域)/Controller/个人主页/QXUserHomePageViewController.m @@ -16,6 +16,8 @@ #import "QXCreatPhotosViewController.h" #import "QXMineNetwork.h" #import "QXPhotosDetailVC.h" +#import "QXIntimateContentView.h" +#import "QXHeartBeatSpaceViewController.h" @interface QXUserHomePageViewController () @property (nonatomic,strong)UIImageView * backgourdImageView; @@ -27,6 +29,7 @@ @property (nonatomic, strong) JXCategoryTitleView *categoryView; @property (nonatomic, strong) NSArray *titles; @property (nonatomic, assign)CGRect cycleScrollViewFrame; +@property (nonatomic, strong)QXUserHomeModel *userModel; @end @implementation QXUserHomePageViewController @@ -38,12 +41,15 @@ -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:NO animated:YES]; + [self.headerView headerStartPlay]; } -(void)setNavgationItems{ [super setNavgationItems]; self.navigationController.navigationBar.backgroundColor = [UIColor clearColor]; } - (void)initSubViews{ + self.bgImageHidden = YES; + self.view.backgroundColor = RGB16(0xF3F3F3); self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, self.view.width, 121+NavContentHeight+16) delegate:self placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]]; self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill; @@ -57,14 +63,14 @@ self.cycleScrollViewFrame = self.backgourdImageView.frame; [self.view addSubview:self.backgourdImageView]; - self.titles = @[QXText(@"动态"),QXText(@"礼物墙"),QXText(@"我的相册")]; + self.titles = @[QXText(@"动态"),QXText(@"挚友"),QXText(@"我的相册")]; _categoryView = [[JXCategoryTitleView alloc] init]; self.categoryView.frame = CGRectMake(0, 0, 200, 48); self.categoryView.titles = self.titles; self.categoryView.delegate = self; self.categoryView.titleSelectedColor = QXConfig.textColor; self.categoryView.titleColor = RGB16(0x666666); - self.categoryView.titleFont = [UIFont boldSystemFontOfSize:12]; + self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14]; self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16]; self.categoryView.titleColorGradientEnabled = YES; self.categoryView.titleLabelZoomEnabled = YES; @@ -86,10 +92,12 @@ _pagingView.mainTableView.backgroundColor = [UIColor clearColor]; self.pagingView.backgroundColor = [UIColor clearColor]; [self.view addSubview:self.pagingView]; - + self.cycleScrollView.hidden = YES; + self.backgourdImageView.hidden = YES; + self.categoryView.hidden = YES; self.categoryView.listContainer = (id)self.pagingView.listContainerView; - self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0); +// self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0); // self.backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kSafeAreaTop, 40, 40)]; @@ -106,7 +114,18 @@ -(void)getUserInfo{ MJWeakSelf [QXMineNetwork userHomePageWithUserId:self.user_id successBlock:^(QXUserHomeModel * _Nonnull userModel) { + weakSelf.userModel = userModel; + weakSelf.headerView.hidden = NO; weakSelf.headerView.model = userModel; + if (weakSelf.userModel.cp_info != nil) { + weakSelf.headerView.height = 243+ScaleWidth(40)+8+ScaleWidth(100)+14; + }else{ + weakSelf.headerView.height = 243+ScaleWidth(40)+8; + } + [weakSelf.pagingView resizeTableHeaderViewHeightWithAnimatable:NO duration:0.1 curve:UIViewAnimationCurveLinear]; + weakSelf.cycleScrollView.hidden = NO; + weakSelf.backgourdImageView.hidden = NO; + weakSelf.categoryView.hidden = NO; NSArray *imgs; if (userModel.home_bgimages.length > 0) { imgs = [userModel.home_bgimages componentsSeparatedByString:@","]; @@ -125,7 +144,7 @@ weakSelf.cycleScrollView.imageURLStringsGroup = imgs; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - + showToast(msg); }]; } #pragma mark - JXPagingViewDelegate @@ -134,7 +153,7 @@ return self.headerView; } - (NSUInteger)tableHeaderViewHeightInPagerView:(JXPagerView *)pagerView { - return 215+26; + return self.headerView.height; } - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView { @@ -155,10 +174,13 @@ dynamicView.backgroundColor = RGB16(0xf6f6f6); return dynamicView; }else if(index == 1){ - QXUserGiftWallView *giftWallView = [[QXUserGiftWallView alloc] init]; - giftWallView.backgroundColor = RGB16(0xf6f6f6); - giftWallView.user_id = self.user_id; - return giftWallView; +// QXUserGiftWallView *giftWallView = [[QXUserGiftWallView alloc] init]; +// giftWallView.backgroundColor = RGB16(0xf6f6f6); +// giftWallView.user_id = self.user_id; +// return giftWallView; + QXIntimateContentView *intimateView = [[QXIntimateContentView alloc] init]; + intimateView.userId = self.user_id; + return intimateView; }else{ QXUserPhotosView *photosView = [[QXUserPhotosView alloc] init]; photosView.user_id = self.user_id; @@ -179,6 +201,8 @@ -(QXUserHomeHeaderView *)headerView{ if (!_headerView) { _headerView = [[QXUserHomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 215+26)]; + _headerView.userId = self.user_id; + _headerView.hidden = YES; } return _headerView; } diff --git a/QXLive/Mine(音域)/Controller/个性装扮/QXDressSubViewController.m b/QXLive/Mine(音域)/Controller/个性装扮/QXDressSubViewController.m index 8b3f91f..cfb7d91 100644 --- a/QXLive/Mine(音域)/Controller/个性装扮/QXDressSubViewController.m +++ b/QXLive/Mine(音域)/Controller/个性装扮/QXDressSubViewController.m @@ -10,6 +10,7 @@ #import "QXMineNetwork.h" #import "QXSeatHeaderView.h" #import "QXGiftPlayerManager.h" +#import "QXCustomAlertView.h" @interface QXDressSubViewController () @property (nonatomic,strong)QXSeatHeaderView *headerImageView; @@ -46,17 +47,20 @@ } -(void)getData{ - MJWeakSelf + @weakify(self) [QXMineNetwork userDressListWithType:self.model.id successBlock:^(NSArray * _Nonnull list) { - [weakSelf.dataArray removeAllObjects]; - [weakSelf.dataArray addObjectsFromArray:list]; - if (list.count > 0 ) { - QXUserDressModel *model = [[QXUserDressModel alloc] init]; - model.title = QXText(@"无"); - model.udid = @"-1"; - [weakSelf.dataArray insertObject:model atIndex:0]; + @strongify(self); + [self.dataArray removeAllObjects]; + [self.dataArray addObjectsFromArray:list]; + if (![self.model.id isEqualToString:@"12"]) { + if (list.count > 0 ) { + QXUserDressModel *model = [[QXUserDressModel alloc] init]; + model.title = QXText(@"无"); + model.udid = @"-1"; + [self.dataArray insertObject:model atIndex:0]; + } } - [weakSelf.collectionView reloadData]; + [self.collectionView reloadData]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { }]; @@ -76,8 +80,8 @@ return cell; } -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ - int width = (SCREEN_WIDTH-15*2-22*2-1)/3; - return CGSizeMake(width, width/100*120); + int width = (SCREEN_WIDTH-16*2-15*2-1)/3; + return CGSizeMake((int)width, ScaleWidth(136)); } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row == self.selectedIndex) { @@ -96,23 +100,45 @@ } -(void)commitAction{ + if (self.selectedIndex == -1) { + return; + } QXUserDressModel *model = self.dataArray[self.selectedIndex]; + if ([self.model.id isEqualToString:@"12"]) { + @weakify(self); + QXCustomAlertView *al = [[QXCustomAlertView alloc] init]; + [al showInView:self.view title:@"温馨提示" message:[NSString stringWithFormat:@"亲爱的羽声用户,您好~ 您是否确认使用%@,本次使用后 您的身价会降至原身价的%@%%",model.title,model.ext_value] cancleTitle:@"取消" commitTitle:@"确认"]; + al.commitBlock = ^{ + @strongify(self); + [self commitNetworkWithModel:model]; + }; + return; + } + + [self commitNetworkWithModel:model]; +} + +-(void)commitNetworkWithModel:(QXUserDressModel*)model{ BOOL isCancel = NO; if ([model.udid isEqualToString:@"-1"]) { isCancel = YES; }else{ isCancel = NO; } - MJWeakSelf + @weakify(self); [QXMineNetwork setUserDressIsCancel:isCancel udid:model.udid type:self.model.id successBlock:^(NSDictionary * _Nonnull dict) { - if (weakSelf.model.id.intValue == 1) { + @strongify(self); + if (self.model.id.intValue == 1) { [QXGlobal shareGlobal].loginModel.dress = model.play_image; } - if (weakSelf.model.id.intValue == 9) { + if (self.model.id.intValue == 9) { [QXGlobal shareGlobal].loginModel.chat_bubble = model.base_image; } [[QXGlobal shareGlobal] updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel]; showToast(@"设置成功"); + if (self.model.id.intValue == 12) { + [self getData]; + } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { showToast(msg); }]; @@ -135,9 +161,9 @@ -(UICollectionView *)collectionView{ if (!_collectionView) { UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; - layout.minimumLineSpacing = 22; - layout.minimumInteritemSpacing = 22; - layout.sectionInset = UIEdgeInsetsMake(0, 15, 0, 15); + layout.minimumLineSpacing = 15; + layout.minimumInteritemSpacing = 15; + layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16); _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.headerImageView.bottom+12+12, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) collectionViewLayout:layout]; _collectionView.delegate = self; _collectionView.dataSource = self; diff --git a/QXLive/Mine(音域)/Controller/亲密关系/QXHeartBeatSpaceViewController.h b/QXLive/Mine(音域)/Controller/亲密关系/QXHeartBeatSpaceViewController.h new file mode 100644 index 0000000..34946c6 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/亲密关系/QXHeartBeatSpaceViewController.h @@ -0,0 +1,16 @@ +// +// QXHeartBeatSpaceViewController.h +// QXLive +// +// Created by 启星 on 2025/11/21. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXHeartBeatSpaceViewController : QXBaseViewController +@property (nonatomic,strong)NSString *userId; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/亲密关系/QXHeartBeatSpaceViewController.m b/QXLive/Mine(音域)/Controller/亲密关系/QXHeartBeatSpaceViewController.m new file mode 100644 index 0000000..e8370f9 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/亲密关系/QXHeartBeatSpaceViewController.m @@ -0,0 +1,245 @@ +// +// QXHeartBeatSpaceViewController.m +// QXLive +// 心动空间 +// Created by 启星 on 2025/11/21. +// + +#import "QXHeartBeatSpaceViewController.h" +#import "QXMineNetwork.h" +#import "QXHeartBeatSpaceRecordCell.h" +#import "QXHeartBeatLevelRuleView.h" +#import "QXUserCpDressView.h" + +@interface QXHeartBeatSpaceViewController () +@property (nonatomic,strong)UIImageView *topImageView; +@property (nonatomic,strong)UIImageView *titleImageView; +@property (nonatomic,strong)UIImageView *flyImageView; +@property (nonatomic,strong)QXSeatHeaderView *leftHeaderView; +@property (nonatomic,strong)UIImageView *heartImageView; +@property (nonatomic,strong)QXSeatHeaderView *rightHeaderView; +@property (nonatomic,strong)UILabel *timeLabel; + +@property (nonatomic,strong)UIView *recordContentView; +@property (nonatomic,strong)UIView *expView; +@property (nonatomic,strong)UILabel *expLabel; +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)UIImageView *cpDressBgImageView; +@property (nonatomic,strong)QXUserCpDressView *cpDressView; + + +@end + +@implementation QXHeartBeatSpaceViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; + [recordBtn setImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)]; + recordBtn.titleLabel.font = [UIFont systemFontOfSize:16]; + [recordBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recordBtn]; +} +- (void)initSubViews{ + [self updateBackImage:[UIImage imageNamed:@"mine_intimate_back"]]; + self.page = 1; + self.view.backgroundColor = RGB16(0xBF8BFA); + self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_heart_beat_space_bg"]]; + self.topImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(336)); + [self.view addSubview:self.topImageView]; + + + + + self.titleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_heart_beat_title"]]; + self.titleImageView.frame = CGRectMake((SCREEN_WIDTH-ScaleWidth(199))/2, ScaleWidth(48), ScaleWidth(199), ScaleWidth(87)); + [self.view addSubview:self.titleImageView]; + + self.flyImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_heart_beat_fly"]]; + self.flyImageView.frame = CGRectMake((self.view.width-ScaleWidth(328))/2, self.titleImageView.top+ScaleWidth(24), ScaleWidth(328), ScaleWidth(184)); + [self.view addSubview:self.flyImageView]; + + + self.leftHeaderView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2-ScaleWidth(72), self.titleImageView.bottom+ScaleWidth(26), ScaleWidth(72), ScaleWidth(72))]; + [self.leftHeaderView addRoundedCornersWithRadius:ScaleWidth(36)]; + self.leftHeaderView.layer.borderWidth = 2; + self.leftHeaderView.layer.borderColor = RGB16(0xffffff).CGColor; + [self.view addSubview:self.leftHeaderView]; + + + self.rightHeaderView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(self.leftHeaderView.right, self.titleImageView.bottom+ScaleWidth(26), ScaleWidth(72), ScaleWidth(72))]; + [self.rightHeaderView addRoundedCornersWithRadius:ScaleWidth(36)]; + self.rightHeaderView.layer.borderWidth = 2; + self.rightHeaderView.layer.borderColor = RGB16(0xffffff).CGColor; + [self.view addSubview:self.rightHeaderView]; + + + self.heartImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_heart_beat_heart_icon"]]; + self.heartImageView.frame = CGRectMake(SCREEN_WIDTH/2-ScaleWidth(26/2), 0, ScaleWidth(26), ScaleWidth(26)); + [self.view addSubview:self.heartImageView]; + + self.heartImageView.centerY = self.leftHeaderView.centerY; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.font = [UIFont systemFontOfSize:14]; + self.timeLabel.textColor = RGB16(0xffffff); + self.timeLabel.backgroundColor = RGB16A(0x0300C8,0.35); + [self.timeLabel addRoundedCornersWithRadius:11.5]; + [self.view addSubview:self.timeLabel]; + + self.recordContentView = [[UIView alloc] initWithFrame:CGRectMake(16, self.topImageView.bottom-ScaleWidth(20), SCREEN_WIDTH-32, self.view.height-self.topImageView.bottom-ScaleWidth(20))]; + self.recordContentView.backgroundColor = RGB16(0xffffff); + [self.recordContentView addRoundedCornersWithRadius:12]; + + + self.expView = [[UIView alloc] initWithFrame:CGRectMake(14, 14, self.recordContentView.width-28, ScaleWidth(89))]; + [self.recordContentView addSubview:self.expView]; + + UIImageView *expImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_heart_beat_exp_bg"]]; + expImageView.frame = self.expView.bounds; + [self.expView addSubview:expImageView]; + + self.expLabel = [[UILabel alloc] initWithFrame:CGRectMake(127, (self.expView.height-32)/2, self.expView.width-127-10, 32)]; + self.expLabel.textColor = RGB16(0xffffff); + self.expLabel.font = [UIFont systemFontOfSize:16]; + [self.expView addSubview:self.expLabel]; + + [self.recordContentView addSubview:self.tableView]; + [self.view addSubview:self.recordContentView]; +// user_heart_beat_exp_bg + self.cpDressBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"heart_beat_space_dress_bg"]]; + self.cpDressBgImageView.frame = CGRectMake(self.view.width-ScaleWidth(115), 0, ScaleWidth(115), ScaleWidth(210)); + [self.view addSubview:self.cpDressBgImageView]; + self.cpDressBgImageView.centerY = self.leftHeaderView.centerY; +// [self.cpDressBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.right.equalTo(self.view); +// make.centerY.equalTo(self.leftHeaderView); +// make.width.mas_equalTo(ScaleWidth(115)); +// make.height.mas_equalTo(ScaleWidth(210)); +// }]; + + self.cpDressView = [[QXUserCpDressView alloc] initWithFrame:self.cpDressBgImageView.frame]; + [self.cpDressView hideHeader]; + [self.view addSubview:self.cpDressView]; +// [self.cpDressView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.edges.equalTo(self.cpDressBgImageView); +// }]; + self.cpDressView.hidden = YES; + self.cpDressBgImageView.hidden = YES; +} + +-(void)helpAction{ + QXHeartBeatLevelRuleView *view = [[QXHeartBeatLevelRuleView alloc] init]; + NSString *urlStr = [NSString stringWithFormat:@"%@api/Page/page_show?id=31",ServerUrl]; + view.rule = urlStr; + [view showInView:self.view]; +} + +-(void)setUserId:(NSString *)userId{ + _userId = userId; + self.page = 1; + [self getList]; +} +-(void)getList{ + MJWeakSelf + [QXMineNetwork heartBeatUserInfoWithUserId:self.userId page:self.page successBlock:^(QXUserCpInfoModel * _Nonnull model) { + if (weakSelf.page == 1) { + if ([model.user_info1.user_id isEqualToString:weakSelf.userId]) { + [weakSelf.leftHeaderView setHeadIcon:model.user_info1.avatar dress:model.user_info1.dress]; + [weakSelf.rightHeaderView setHeadIcon:model.user_info2.avatar dress:model.user_info2.dress]; + }else{ + [weakSelf.leftHeaderView setHeadIcon:model.user_info2.avatar dress:model.user_info2.dress]; + [weakSelf.rightHeaderView setHeadIcon:model.user_info1.avatar dress:model.user_info1.dress]; + } + if ([model.pendant isExist]) { + weakSelf.cpDressView.hidden = NO; + weakSelf.cpDressBgImageView.hidden = NO; + weakSelf.cpDressView.model = model; + } + + NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970]; + long long milliseconds = (long long)(currentTime); + NSInteger time = milliseconds - model.createtime.longLongValue; + weakSelf.timeLabel.text = [NSString stringWithFormat:@" 我们在一起%@啦 ",[NSString getTimeWithDay:time]]; + [weakSelf.timeLabel sizeToFit]; + weakSelf.timeLabel.centerX = weakSelf.topImageView.centerX; + weakSelf.timeLabel.height = 21; + weakSelf.timeLabel.top = weakSelf.leftHeaderView.bottom+ScaleWidth(21); + if (model.next_level_exp.integerValue <=0 ) { + weakSelf.expLabel.text = @"当前已是最高等级"; + }else{ + NSString *expString = [NSString stringWithFormat:@"还需%@经验升级",model.next_level_exp]; + NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:expString]; + [attr yy_setFont:[UIFont fontWithName:@"DIN Condensed" size:32] range:[expString rangeOfString:model.next_level_exp]]; + [attr yy_setColor:RGB16(0xFFF022) range:[expString rangeOfString:model.next_level_exp]]; + weakSelf.expLabel.attributedText = attr; + } + [weakSelf.dataArray removeAllObjects]; + } + [weakSelf.dataArray addObjectsFromArray:model.gift_log]; + [weakSelf.tableView reloadData]; + if (model.gift_log.count == 0) { + weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + }else{ + [weakSelf.tableView.mj_footer endRefreshing]; + } + [weakSelf.tableView.mj_header endRefreshing]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + [weakSelf.tableView.mj_header endRefreshing]; + [weakSelf.tableView.mj_footer endRefreshing]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.navigationController popViewControllerAnimated:YES]; + }); + }]; +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return self.dataArray.count; +} +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + QXHeartBeatSpaceRecordCell *cell = [QXHeartBeatSpaceRecordCell cellWithTableView:tableView]; + cell.userId = self.userId; + cell.model = self.dataArray[indexPath.row]; + return cell; +} + +-(UITableView *)tableView{ + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(14,self.expView.bottom+6,self.recordContentView.width-28,self.recordContentView.height-self.expView.bottom-14-6) style:(UITableViewStylePlain)]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = RGB16(0xF4F4F4); + [_tableView addRoundedCornersWithRadius:12]; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.rowHeight = UITableViewAutomaticDimension; + _tableView.showsVerticalScrollIndicator = NO; + _tableView.showsHorizontalScrollIndicator = NO; + if (@available(iOS 15.0, *)) { + _tableView.sectionHeaderTopPadding = 0; + } else { + // Fallback on earlier versions + } + MJWeakSelf + _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.page = 1; + [weakSelf getList]; + }]; + _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.page++; + [weakSelf getList]; + }]; + } + return _tableView; +} +@end diff --git a/QXLive/Mine(音域)/Controller/亲密关系/QXIntimateViewController.h b/QXLive/Mine(音域)/Controller/亲密关系/QXIntimateViewController.h new file mode 100644 index 0000000..67467a9 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/亲密关系/QXIntimateViewController.h @@ -0,0 +1,16 @@ +// +// QXIntimateViewController.h +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXIntimateViewController : QXBaseViewController +@property (nonatomic,strong)NSString *userId; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/亲密关系/QXIntimateViewController.m b/QXLive/Mine(音域)/Controller/亲密关系/QXIntimateViewController.m new file mode 100644 index 0000000..014caf1 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/亲密关系/QXIntimateViewController.m @@ -0,0 +1,270 @@ +// +// QXIntimateViewController.m +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import "QXIntimateViewController.h" +#import "QXIntimateCpCell.h" +#import "QXIntimateListCell.h" +#import "QXIntimateNoCpCell.h" +#import "QXMineNetwork.h" +#import "QXButton.h" +#import "QXMoreIntimateViewController.h" +#import "QXIntimateMoreListCell.h" +#import "QXHeartBeatSpaceViewController.h" +#import "QXUserHomePageViewController.h" + +@interface QXIntimateViewController () +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)QXRoomBestFriendModel *model; +@end + +@implementation QXIntimateViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)setNavgationItems{ + [super setNavgationItems]; +} + +- (void)initSubViews{ + self.page = 1; + [self updateBgImage:@"mine_intimate_bg"]; + [self updateBackImage:[UIImage imageNamed:@"mine_intimate_back"]]; + UIImageView *titleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_img"]]; + [self.view addSubview:titleImageView]; + [titleImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.view); + make.width.mas_equalTo(ScaleWidth(178)); + make.height.mas_equalTo(ScaleWidth(68)); + make.top.mas_equalTo(NavContentHeight); + }]; + [self.view addSubview:self.tableView]; +} +-(void)setUserId:(NSString *)userId{ + _userId = userId; + self.page = 1; + [self getList]; +} +-(void)getList{ + MJWeakSelf + [QXMineNetwork userBestFriendsListWithUserId:self.userId page:self.page successBlock:^(QXRoomBestFriendModel * _Nonnull model) { + weakSelf.model = model; + if (weakSelf.page == 1) { + [weakSelf.dataArray removeAllObjects]; + } + [weakSelf.dataArray addObjectsFromArray:model.no_cp]; + [weakSelf.tableView reloadData]; + if (model.no_cp.count == 0) { + weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + }else{ + [weakSelf.tableView.mj_footer endRefreshing]; + } + [weakSelf.tableView.mj_header endRefreshing]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + +-(void)moreAction:(QXButton*)btn{ + QXRoomBestFriendListModel *md = btn.object; + QXMoreIntimateViewController *vc = [[QXMoreIntimateViewController alloc] init]; + vc.userId = self.userId; + vc.relation_id = md.relation_list.firstObject.relation_id; + vc.relation_name = md.relation_name; + [self.navigationController pushViewController:vc animated:YES]; +} + +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ + if (self.model == nil) { + return 0; + }else{ + return 1+self.dataArray.count; + } +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return 1; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + if (self.model.cp) { + QXIntimateCpCell *cell = [QXIntimateCpCell cellWithTableView:tableView]; + cell.userId = self.userId; + cell.model = self.model.cp; + cell.delegate = self; + return cell; + }else{ + QXIntimateNoCpCell *cell = [QXIntimateNoCpCell cellWithTableView:tableView]; + return cell; + } + }else{ + QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1]; + if (md.relation_list.count > 1) { + QXIntimateListCell*cell = [QXIntimateListCell cellWithTableView:tableView]; + cell.userId = self.userId; + if (self.dataArray.count>0) { + QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1]; + cell.model = md; + } + return cell; + }else{ + MJWeakSelf + QXIntimateMoreListCell *cell = [QXIntimateMoreListCell cellWithTableView:tableView]; + cell.userId = self.userId; + QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1]; + cell.model = md.relation_list.firstObject; + cell.delegate = self; + cell.deleteSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) { + weakSelf.page = 1; + [weakSelf getList]; + }; + return cell; + } + + } +} + +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 50)]; + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_bg"]]; + UILabel *titleLabel = [[UILabel alloc] init]; + titleLabel.font = [UIFont boldSystemFontOfSize:16]; + titleLabel.textColor = RGB16(0xffffff); + QXButton *btn = [[QXButton alloc] init]; + [btn setTitle:@"更多>>" forState:(UIControlStateNormal)]; + [btn setTitleColor:RGB16(0xE973FC) forState:(UIControlStateNormal)]; + btn.titleLabel.font = [UIFont systemFontOfSize:12]; + [btn addTarget:self action:@selector(moreAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [header addSubview:btn]; + [header addSubview:imageView]; + [header addSubview:titleLabel]; + [imageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(132); + make.height.mas_equalTo(36); + make.centerX.centerY.equalTo(header); + }]; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(header); + make.centerY.equalTo(header).offset(2); + }]; + [btn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-23); + make.top.bottom.equalTo(header); + make.width.mas_equalTo(40); + }]; + if (section == 0) { + titleLabel.text = @"心动"; + btn.hidden = YES; + }else{ + QXRoomBestFriendListModel *md = self.dataArray[section-1]; + titleLabel.text = md.relation_name; + if (md.relation_list.count>1) { + btn.hidden = NO; + btn.object = md; + }else{ + btn.hidden = YES; + } + } + return header; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + return 50; +} + +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + if (self.model.cp) { + return ScaleWidth(100); + }else{ + return ScaleWidth(36); + } + }else{ + QXRoomBestFriendListModel *md = self.dataArray[indexPath.section-1]; + if (md.relation_list.count == 1) { + return ScaleWidth(92)+18; + }else{ + if (md.relation_list.count == 0) { + return 0; + }else{ + return ScaleWidth(125); + } + } + + } +} + +-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ + UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 15)]; + return footer; +} + +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ + return 15; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ +// if (indexPath.section == 0) { +// if (self.model.cp) { +// QXHeartBeatSpaceViewController *vc = [[QXHeartBeatSpaceViewController alloc] init]; +// vc.userId = self.userId; +// [self.navigationController pushViewController:vc animated:YES]; +// } +// } +} + +-(void)didClickHeaderCardViewWithUserId:(NSString *)userId{ + if (self.model.cp) { + QXHeartBeatSpaceViewController *vc = [[QXHeartBeatSpaceViewController alloc] init]; + vc.userId = self.userId; + [self.navigationController pushViewController:vc animated:YES]; + } +} + +-(void)didClickHeaderViewUserId:(NSString *)userId{ + QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; + vc.user_id = userId; + [self.navigationController pushViewController:vc animated:YES]; + +} +- (void)didClickHeaderWithUserId:(NSString *)userId{ + QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; + vc.user_id = userId; + [self.navigationController pushViewController:vc animated:YES]; +} + +-(UITableView *)tableView{ + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight+ScaleWidth(68), SCREEN_WIDTH, SCREEN_HEIGHT -NavContentHeight-ScaleWidth(68)) style:(UITableViewStyleGrouped)]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = [UIColor clearColor]; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + if (@available(iOS 15.0, *)) { + _tableView.sectionHeaderTopPadding = 0; + } else { + // Fallback on earlier versions + } + MJWeakSelf + _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.page = 1; + [weakSelf getList]; + }]; + _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.page++; + [weakSelf getList]; + }]; + } + return _tableView; +} +@end diff --git a/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.h b/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.h new file mode 100644 index 0000000..6630e30 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.h @@ -0,0 +1,18 @@ +// +// QXMoreIntimateViewController.h +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXMoreIntimateViewController : QXBaseViewController +@property (nonatomic,strong)NSString *userId; +@property (nonatomic,strong)NSString *relation_id; +@property (nonatomic,strong)NSString *relation_name; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.m b/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.m new file mode 100644 index 0000000..5a0da90 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.m @@ -0,0 +1,120 @@ +// +// QXMoreIntimateViewController.m +// QXLive +// +// Created by 启星 on 2025/11/20. +// + +#import "QXMoreIntimateViewController.h" +#import "QXMineNetwork.h" +#import "QXIntimateMoreListCell.h" + +@interface QXMoreIntimateViewController () +@property (nonatomic,strong)UITableView *tableView; +@end + +@implementation QXMoreIntimateViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)initSubViews{ + [super initSubViews]; + self.page = 1; + [self updateBgImage:@"mine_intimate_bg"]; + [self updateBackImage:[UIImage imageNamed:@"mine_intimate_back"]]; + UIImageView *titleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_img"]]; + [self.view addSubview:titleImageView]; + [titleImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.view); + make.width.mas_equalTo(ScaleWidth(178)); + make.height.mas_equalTo(ScaleWidth(68)); + make.top.mas_equalTo(NavContentHeight); + }]; + [self.view addSubview:self.tableView]; + +} +-(void)setUserId:(NSString *)userId{ + _userId = userId; +} +-(void)setRelation_id:(NSString *)relation_id{ + _relation_id = relation_id; + if (self.userId) { + [self getList]; + } +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return self.dataArray.count; +} +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + QXIntimateMoreListCell *cell = [QXIntimateMoreListCell cellWithTableView:tableView]; + cell.userId = self.userId; + cell.model = self.dataArray[indexPath.row]; + MJWeakSelf + cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) { + [weakSelf getList]; + }; + cell.deleteSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) { + [weakSelf getList]; + }; + return cell; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + return ScaleWidth(92)+16; +} +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 50)]; + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_bg"]]; + UILabel *titleLabel = [[UILabel alloc] init]; + titleLabel.font = [UIFont boldSystemFontOfSize:16]; + titleLabel.textColor = RGB16(0xffffff); + [header addSubview:imageView]; + [header addSubview:titleLabel]; + [imageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(132); + make.height.mas_equalTo(36); + make.centerX.centerY.equalTo(header); + }]; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(header); + make.centerY.equalTo(header).offset(2); + }]; + titleLabel.text = self.relation_name; + return header; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + return 50; +} +-(void)getList{ + MJWeakSelf + [QXMineNetwork userBestFriendsMoreListWithUserId:self.userId relation_id:self.relation_id successBlock:^(NSArray * _Nonnull model) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:model]; + [weakSelf.tableView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} +-(UITableView *)tableView{ + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight+ScaleWidth(68), SCREEN_WIDTH, SCREEN_HEIGHT -NavContentHeight-ScaleWidth(68)) style:(UITableViewStyleGrouped)]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = [UIColor clearColor]; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + if (@available(iOS 15.0, *)) { + _tableView.sectionHeaderTopPadding = 0; + } else { + // Fallback on earlier versions + } + } + return _tableView; +} +@end diff --git a/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.h b/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.h index adb14a4..1dfe7dd 100644 --- a/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.h +++ b/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN @interface QXGuildViewController : QXBaseViewController - +@property (nonatomic,strong)NSString*joinGuild; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.m b/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.m index e4d0c30..3d05159 100644 --- a/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.m +++ b/QXLive/Mine(音域)/Controller/公会中心/QXGuildViewController.m @@ -44,7 +44,12 @@ static void *WKWebBrowserContext = &WKWebBrowserContext; } - (void)loadData { NSInteger safeTop = kSafeAreaTop; - NSURL* url=[NSURL URLWithString:[NSString stringWithFormat:@"%@web/index.html#/pages/union/index?id=%@&h=%ld",H5ServerUrl,[QXGlobal shareGlobal].loginModel.token,safeTop]]; + NSString *urlString = [NSString stringWithFormat:@"%@web/index.html#/pages/union/index?id=%@&h=%ld",H5ServerUrl,[QXGlobal shareGlobal].loginModel.token,safeTop]; + + if ([self.joinGuild isExist]) { + urlString = [urlString stringByAppendingFormat:@"&guild_id=%@",self.joinGuild]; + } + NSURL* url=[NSURL URLWithString:urlString]; NSURLRequest *request =[NSURLRequest requestWithURL:url]; [self.contentWebView loadRequest:request]; } diff --git a/QXLive/Mine(音域)/Controller/家族/QXFamilyPriceRecordViewController.h b/QXLive/Mine(音域)/Controller/家族/QXFamilyPriceRecordViewController.h new file mode 100644 index 0000000..7ee5212 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/家族/QXFamilyPriceRecordViewController.h @@ -0,0 +1,16 @@ +// +// QXFamilyPriceRecordViewController.h +// QXLive +// +// Created by 启星 on 2025/11/26. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXFamilyPriceRecordViewController : QXBaseViewController +@property (nonatomic,strong)NSString *userId; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/家族/QXFamilyPriceRecordViewController.m b/QXLive/Mine(音域)/Controller/家族/QXFamilyPriceRecordViewController.m new file mode 100644 index 0000000..8938543 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/家族/QXFamilyPriceRecordViewController.m @@ -0,0 +1,129 @@ +// +// QXFamilyPriceRecordViewController.m +// QXLive +// +// Created by 启星 on 2025/11/26. +// + +#import "QXFamilyPriceRecordViewController.h" +#import "QXWalletDateView.h" +#import "QXFamilyPriceRecordCell.h" +#import "QXMineNetwork.h" + +@interface QXFamilyPriceRecordViewController () +@property (nonatomic,strong)UIView *contentView; +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)QXWalletDateView *dateView; + +@property (nonatomic,strong)NSString* startTime; +@property (nonatomic,strong)NSString* endTime; +@end + +@implementation QXFamilyPriceRecordViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationItem.title = QXText(@"总收益"); +} +-(void)initSubViews{ + self.page = 1; + UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, SCREEN_WIDTH-32, SCREEN_HEIGHT-NavContentHeight-12)]; + [contentView addRoundedCornersWithRadius:16]; + contentView.backgroundColor = RGB16(0xffffff); + self.contentView = contentView; + [self.view addSubview:contentView]; + + [contentView addSubview:self.dateView]; + [contentView addSubview:self.tableView]; +} +-(void)setUserId:(NSString *)userId{ + _userId = userId; + self.page = 1; + [self getList]; +} +-(void)getList{ + __weak typeof(self) weakSelf = self; + [QXMineNetwork getFamilyEarningWithUserId:self.userId page:self.page start_time:self.startTime end_time:self.endTime successBlock:^(NSArray * _Nonnull list) { + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + NSLog(@"⚠️ self has been deallocated, skipping hide operation"); + return; + } + if (strongSelf.page == 1) { + [strongSelf.dataArray removeAllObjects]; + } + [strongSelf.dataArray addObjectsFromArray:list]; + [strongSelf.tableView reloadData]; + if (list.count == 0) { + strongSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + }else{ + [strongSelf.tableView.mj_footer endRefreshing]; + } + [strongSelf.tableView.mj_header endRefreshing]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + dispatch_async(dispatch_get_main_queue(), ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (strongSelf) { + [strongSelf.tableView.mj_header endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; + } + }); + }]; +// +// }]; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return self.dataArray.count; +} +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + QXFamilyPriceRecordCell *cell = [QXFamilyPriceRecordCell cellWithTableView:tableView]; + cell.model = self.dataArray[indexPath.row]; + return cell; +} +#pragma mark - QXWalletDateViewDelegate +-(void)didSelectedStartDate:(NSString *)startDateString startDate:(NSDate *)startDate endDateString:(NSString *)endDateString endDate:(NSDate *)endDate{ + QXLOG(@"开始时间-%@ 结束时间-%@",startDateString,endDateString); + self.startTime = startDateString; + self.endTime = endDateString; + self.page = 1; + [self getList]; +} + + +-(QXWalletDateView *)dateView{ + if (!_dateView) { + _dateView = [[QXWalletDateView alloc] initWithFrame:CGRectMake(12, 12, SCREEN_WIDTH-32-24, 38)]; + _dateView.delegate = self; + } + return _dateView; +} +-(UITableView *)tableView{ + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.dateView.bottom+10, SCREEN_WIDTH-32, self.contentView.height - self.dateView.bottom-10) style:(UITableViewStylePlain)]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = [UIColor whiteColor]; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.rowHeight = 107; + MJWeakSelf + _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.page = 1; + [weakSelf getList]; + }]; + _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.page++; + [weakSelf getList]; + }]; + } + return _tableView; +} +@end diff --git a/QXLive/Mine(音域)/Controller/家族/QXFamilySubViewController.h b/QXLive/Mine(音域)/Controller/家族/QXFamilySubViewController.h new file mode 100644 index 0000000..5963a0c --- /dev/null +++ b/QXLive/Mine(音域)/Controller/家族/QXFamilySubViewController.h @@ -0,0 +1,17 @@ +// +// QXFamilySubViewController.h +// QXLive +// +// Created by 启星 on 2025/11/26. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXFamilySubViewController : QXBaseViewController +@property (nonatomic,assign)NSInteger index; + +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/家族/QXFamilySubViewController.m b/QXLive/Mine(音域)/Controller/家族/QXFamilySubViewController.m new file mode 100644 index 0000000..9cab6f4 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/家族/QXFamilySubViewController.m @@ -0,0 +1,190 @@ +// +// QXFamilySubViewController.m +// QXLive +// +// Created by 启星 on 2025/11/26. +// + +#import "QXFamilySubViewController.h" +#import "QXFamilyMemberCell.h" +#import "QXFamilyTopCell.h" +#import "QXMineNetwork.h" +#import "QXUserHomePageViewController.h" +@interface QXFamilySubViewController () +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)QXFamilyModel *model; +@property (nonatomic,strong)UIView *noDataView; +@end + +@implementation QXFamilySubViewController +-(UIView *)listView{ + return self.view; +} +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +- (void)initSubViews{ + self.bgImageHidden = YES; + self.view.backgroundColor = RGB16(0x102477); + [self.view addSubview:self.tableView]; +} +-(void)viewDidLayoutSubviews{ + [super viewDidLayoutSubviews]; + _tableView.frame = self.view.bounds; +} + +-(void)setIndex:(NSInteger)index{ + _index = index; + [self getList]; +} +-(void)getList{ + BOOL isJoin = YES; + if (self.index == 0) { + isJoin = NO; + }else{ + isJoin = YES; + } + MJWeakSelf + [QXMineNetwork getMyFamilyIsJoin:isJoin successBlock:^(QXFamilyModel * _Nonnull model) { + weakSelf.model = model; + if (weakSelf.model.group_members_lists.count == 0) { + weakSelf.tableView.tableFooterView = weakSelf.noDataView; + }else{ + weakSelf.tableView.tableFooterView = nil; + } + [weakSelf.tableView reloadData]; + [weakSelf.tableView.mj_header endRefreshing]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + [weakSelf.tableView.mj_header endRefreshing]; + }]; +} +-(void)needRefresh{ + self.page = 1; + [self getList]; +} + +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ + if (self.model) { + return 2; + } + return 0; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + if (section == 0) { + return 1; + }else{ + return self.model.group_members_lists.count; + } +} +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + QXFamilyTopCell *cell = [QXFamilyTopCell cellWithTableView:tableView]; + cell.model = self.model; + return cell; + }else{ + QXFamilyMemberCell *cell = [QXFamilyMemberCell cellWithTableView:tableView]; + cell.model = self.model.group_members_lists[indexPath.row]; + cell.delegate = self; + return cell; + } +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + return 180; + }else{ + return 176; + } +} +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + if (section == 0) { + return [UIView new]; + }else{ + UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 50)]; + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"family_list_section_bg"]]; + UILabel *titleLabel = [[UILabel alloc] init]; + titleLabel.font = [UIFont boldSystemFontOfSize:16]; + titleLabel.textColor = RGB16(0xffffff); + [header addSubview:imageView]; + [header addSubview:titleLabel]; + [imageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(132); + make.height.mas_equalTo(36); + make.centerX.centerY.equalTo(header); + }]; + titleLabel.text = @"家族成员"; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(header); + make.centerY.equalTo(header).offset(2); + }]; + return header; + } +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + if (section == 0) { + return 0; + } + return 50; +} +-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ + return [UIView new]; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ + return 0; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + return; + } + QXFamilyMemberModel*md = self.model.group_members_lists[indexPath.row]; + QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; + vc.user_id = md.user_id; + [self.navigationController pushViewController:vc animated:YES]; +} + +-(UITableView *)tableView{ + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.view.height) style:(UITableViewStyleGrouped)]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = [UIColor clearColor]; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + if (@available(iOS 15.0, *)) { + _tableView.sectionHeaderTopPadding = 0; + } else { + // Fallback on earlier versions + } + MJWeakSelf + _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + [weakSelf getList]; + }]; + } + return _tableView; +} +-(UIView *)noDataView{ + if (!_noDataView) { + _noDataView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(120)+30)]; + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"qx_no_data"]]; + [_noDataView addSubview:imageView]; + [imageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(ScaleWidth(148)); + make.height.mas_equalTo(ScaleWidth(99)); + make.centerX.equalTo(_noDataView); + make.top.mas_equalTo(30); + }]; + + UILabel *titleLabel = [[UILabel alloc] init]; + titleLabel.font = [UIFont systemFontOfSize:12]; + titleLabel.text = @"暂无数据"; + titleLabel.textColor = RGB16(0xffffff); + [_noDataView addSubview:titleLabel]; + [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(_noDataView); + make.top.equalTo(imageView.mas_bottom); + }]; + } + return _noDataView; +} + +@end diff --git a/QXLive/Mine(音域)/Controller/家族/QXFamilyViewController.h b/QXLive/Mine(音域)/Controller/家族/QXFamilyViewController.h new file mode 100644 index 0000000..364c9e3 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/家族/QXFamilyViewController.h @@ -0,0 +1,16 @@ +// +// QXFamilyViewController.h +// QXLive +// +// Created by 启星 on 2025/11/26. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXFamilyViewController : QXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/家族/QXFamilyViewController.m b/QXLive/Mine(音域)/Controller/家族/QXFamilyViewController.m new file mode 100644 index 0000000..c764c7d --- /dev/null +++ b/QXLive/Mine(音域)/Controller/家族/QXFamilyViewController.m @@ -0,0 +1,88 @@ +// +// QXFamilyViewController.m +// QXLive +// +// Created by 启星 on 2025/11/26. +// + +#import "QXFamilyViewController.h" +#import "QXFamilySubViewController.h" + +@interface QXFamilyViewController () +@property (nonatomic,strong)UIImageView *topImageView; +@property (nonatomic,strong)JXCategoryTitleView *categoryView; +@property (nonatomic,strong)JXCategoryListContainerView *containerView; +@property (nonatomic,strong)NSMutableArray *titles; +@end + +@implementation QXFamilyViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)}; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)}; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationItem.title = QXText(@"家族"); + self.navigationTintColor = RGB16(0xffffff); +} +- (void)initSubViews{ + self.titles = [NSMutableArray arrayWithArray:@[@"我的家族",@"我加入的家族"]]; + self.topImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_family_top_bg"]]; + self.topImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(435)); + [self.view addSubview:self.topImageView]; + self.view.backgroundColor = RGB16(0x102477); + + self.categoryView = [[JXCategoryTitleView alloc] init]; + self.categoryView.frame = CGRectMake((self.view.width-246)/2, NavContentHeight+ScaleWidth(236), 246, 38); + self.categoryView.delegate = self; + self.categoryView.titles = self.titles; + self.categoryView.backgroundColor = RGB16A(0x000000, 0.2); + [self.categoryView addRoundedCornersWithRadius:19]; + self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"]; + self.categoryView.titleColor = [UIColor colorWithHexString:@"#ffffff"]; + self.categoryView.cellWidth = 123; + self.categoryView.contentEdgeInsetLeft = 0; + self.categoryView.cellSpacing = 0; + self.categoryView.contentEdgeInsetLeft = 0; +// self.categoryView.titleLabelZoomScale = 1.1; +// self.categoryView.titleLabelZoomEnabled = YES; + self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14]; + self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:14]; + self.categoryView.averageCellSpacingEnabled = NO; + JXCategoryIndicatorBackgroundView *indicatorView = [[JXCategoryIndicatorBackgroundView alloc] init]; + indicatorView.indicatorWidth = 123; + indicatorView.indicatorHeight = 38; + indicatorView.indicatorCornerRadius = 19; + indicatorView.indicatorColor = RGB16(0xA4FFB8); + self.categoryView.indicators = @[indicatorView]; + self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_CollectionView) delegate:self]; + self.containerView.frame = CGRectMake(0, self.categoryView.bottom+8, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom-8); + [self.view addSubview:self.categoryView]; + [self.view addSubview:self.containerView]; + self.categoryView.listContainer = self.containerView; +} +-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{ + return self.titles.count; +} +-(id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{ + QXFamilySubViewController *vc = [[QXFamilySubViewController alloc] init]; + vc.index = index; + return vc; +} + + + + +@end diff --git a/QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.m b/QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.m index 9a35a9b..34a8854 100644 --- a/QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.m +++ b/QXLive/Mine(音域)/Controller/我的房间/QXRoomDetailViewController.m @@ -57,14 +57,19 @@ [self.navigationController pushViewController:vc animated:YES]; } -(void)getPriceData{ - MJWeakSelf + __weak typeof(self) weakSelf = self; [QXMineNetwork roomWaterDetailWithRoomId:self.room_id start_time:self.startTime end_time:self.endTime page:self.page type:self.type successBlock:^(QXRoomDetailModel * _Nonnull model) { - weakSelf.headerView.model = model; - if (weakSelf.page == 1) { - [weakSelf.dict removeAllObjects]; + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + NSLog(@"⚠️ self has been deallocated, skipping hide operation"); + return; + } + strongSelf.headerView.model = model; + if (strongSelf.page == 1) { + [strongSelf.dict removeAllObjects]; } - NSArray *arr = [weakSelf.dict allKeys]; + NSArray *arr = [strongSelf.dict allKeys]; for (QXRoomWaterModel*md in model.list) { BOOL haveKey = NO; for (NSString *s in arr) { @@ -75,10 +80,10 @@ } if (!haveKey) { // key没有包含某个日期,设置日期的流水json - [weakSelf.dict setObject:[md yy_modelToJSONString] forKey:md.time]; + [strongSelf.dict setObject:[md yy_modelToJSONString] forKey:md.time]; }else{ //有包含某个日期,先取出之前已有的数据 - NSString *json = [weakSelf.dict objectForKey:md.time]; + NSString *json = [strongSelf.dict objectForKey:md.time]; //转换为模型 QXRoomWaterModel *m = [QXRoomWaterModel yy_modelWithJSON:json]; //旧数据 @@ -88,10 +93,10 @@ //赋值于历史数据 m.list = newArr; // 重新设置键值对 - [weakSelf.dict setObject:[m yy_modelToJSONString] forKey:md.time]; + [strongSelf.dict setObject:[m yy_modelToJSONString] forKey:md.time]; } } - NSArray *keys = [weakSelf.dict.allKeys sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { + NSArray *keys = [strongSelf.dict.allKeys sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { // NSString *s1 = obj1; // NSString *s2 = obj2; NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init]; @@ -110,18 +115,23 @@ return NSOrderedSame; } }]; - self.allDateArray = [NSMutableArray arrayWithArray:keys]; - [weakSelf.tableView reloadData]; - [weakSelf.tableView.mj_header endRefreshing]; + strongSelf.allDateArray = [NSMutableArray arrayWithArray:keys]; + [strongSelf.tableView reloadData]; + [strongSelf.tableView.mj_header endRefreshing]; if (model.list.count == 0) { - weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + strongSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; }else{ - [weakSelf.tableView.mj_footer endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; } } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - showToast(msg); - [weakSelf.tableView.mj_footer endRefreshing]; - [weakSelf.tableView.mj_header endRefreshing]; + dispatch_async(dispatch_get_main_queue(), ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (strongSelf) { + showToast(msg); + [strongSelf.tableView.mj_header endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; + } + }); }]; } diff --git a/QXLive/Mine(音域)/Controller/歌单列表/QXMineSongListViewController.h b/QXLive/Mine(音域)/Controller/歌单列表/QXMineSongListViewController.h new file mode 100644 index 0000000..4b8aa97 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/歌单列表/QXMineSongListViewController.h @@ -0,0 +1,16 @@ +// +// QXMineSongListViewController.h +// QXLive +// +// Created by 启星 on 2025/11/13. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXMineSongListViewController : QXBaseViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/歌单列表/QXMineSongListViewController.m b/QXLive/Mine(音域)/Controller/歌单列表/QXMineSongListViewController.m new file mode 100644 index 0000000..329d028 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/歌单列表/QXMineSongListViewController.m @@ -0,0 +1,207 @@ +// +// QXMineSongListViewController.m +// QXLive +// +// Created by 启星 on 2025/11/13. +// + +#import "QXMineSongListViewController.h" +#import "QXMineNetwork.h" +#import "QXMineSongListCell.h" +#import "QXMineAddSongView.h" +#import "QXMineAddSongGiftView.h" +#import "QXCustomAlertView.h" + +@interface QXMineSongListViewController () +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)UILabel *countLabel; +@property (nonatomic,strong)QXMineAddSongView *addSongView; +@end + +@implementation QXMineSongListViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + +} + +-(void)setNavgationItems{ + [super setNavgationItems];; + self.navigationItem.title = @"歌单列表"; + UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; + [recordBtn setTitle:QXText(@"新增") forState:(UIControlStateNormal)]; + [recordBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)]; + recordBtn.titleLabel.font = [UIFont systemFontOfSize:16]; + [recordBtn addTarget:self action:@selector(addAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recordBtn]; +} +-(void)initSubViews{ + self.page = 1; + self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, 200, 35)]; + self.countLabel.textColor = RGB16(0x666666); + self.countLabel.font = [UIFont systemFontOfSize:12]; + self.countLabel.text = @"共0首歌"; + [self.view addSubview:self.countLabel]; + + UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.width-35-16, NavContentHeight+12, 35, 35)]; + [recordBtn setImage:[[UIImage imageNamed:@"nobility_help_icon"] imageByTintColor:RGB16(0x666666)] forState:(UIControlStateNormal)]; + recordBtn.titleLabel.font = [UIFont systemFontOfSize:16]; + [recordBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.view addSubview:recordBtn]; + + [self.view addSubview:self.tableView]; + [self getSongList]; +} + +-(void)getSongList{ + MJWeakSelf + [QXMineNetwork getUserSongListWithRoomId:@"" user_id:QXGlobal.shareGlobal.loginModel.user_id page:self.page SuccessBlock:^(NSArray * _Nonnull list, NSString * _Nonnull count) { + weakSelf.countLabel.text = [NSString stringWithFormat:@"共有%@首歌",count]; + if (weakSelf.page == 1) { + [weakSelf.dataArray removeAllObjects]; + } + [weakSelf.dataArray addObjectsFromArray:list]; + [weakSelf.tableView reloadData]; + [weakSelf.tableView.mj_header endRefreshing]; + if (list.count == 0) { + weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + }else{ + [weakSelf.tableView.mj_header endRefreshing]; + } + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} +-(void)helpAction{ + NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"34"]; + QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; + vc.urlStr = urlString; + [self.navigationController pushViewController:vc animated:YES]; +} +-(void)didSeletedGift:(QXGiftModel *)giftModel giftCount:(nonnull NSString *)giftCount{ + giftModel.num = giftCount; + self.addSongView.giftModel = giftModel; +} + +-(void)qx_mineAddSongViewDidSeleteGift{ + QXMineAddSongGiftView *giftView = [[QXMineAddSongGiftView alloc] initWithFrame:[UIScreen mainScreen].bounds]; + giftView.delegate = self; + [giftView showInView:self.view]; +} + +-(void)qx_mineAddSongViewCommitWithSongName:(NSString *)songName giftModel:(QXGiftModel *)giftModel{ + MJWeakSelf + [QXMineNetwork mineUserAddAndDeleteAndEditWithType:0 Id:@"" songName:songName giftId:giftModel.gift_id giftNum:giftModel.num successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"添加成功"); + [weakSelf.addSongView hide]; + weakSelf.page = 1; + [weakSelf getSongList]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(@"添加失败"); + }]; +} +-(void)qx_mineAddSongViewDidRemove{ + self.addSongView = nil; +} +-(void)qx_mineEditSongViewCommitWithSongModel:(QXUserSongListModel *)songModel{ + MJWeakSelf + [QXMineNetwork mineUserAddAndDeleteAndEditWithType:1 Id:songModel.id songName:songModel.song_name giftId:songModel.gift_id giftNum:songModel.gift_num successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"修改成功"); + [weakSelf.addSongView hide]; + weakSelf.page = 1; + [weakSelf getSongList]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(@"修改失败"); + }]; +} +-(void)addAction{ + self.addSongView = [[QXMineAddSongView alloc] initWithFrame:[UIScreen mainScreen].bounds]; + self.addSongView.delegate = self; + [self.addSongView showInView:self.view]; +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return self.dataArray.count; +} +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + QXMineSongListCell *cell = [QXMineSongListCell cellWithTableView:tableView]; + cell.model = self.dataArray[indexPath.row]; + return cell; +} +-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ + return YES; +} +-(UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath{ + QXUserSongListModel *model = self.dataArray[indexPath.row]; + MJWeakSelf + UIContextualAction *deletAction = [UIContextualAction contextualActionWithStyle:(UIContextualActionStyleDestructive) title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { + [weakSelf deleteSongWithModel:model]; + completionHandler(YES); + }]; + UIContextualAction *editAction = [UIContextualAction contextualActionWithStyle:(UIContextualActionStyleNormal) title:@"编辑" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { + [weakSelf editSongWithModel:model]; + completionHandler(YES); + }]; + editAction.backgroundColor = RGB16(0x3665F9); + UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[deletAction,editAction]]; + return config; +} + + +-(void)deleteSongWithModel:(QXUserSongListModel*)model{ + QXCustomAlertView *alertView = [[QXCustomAlertView alloc] init]; + [alertView showInView:self.view title:@"您确定要删除歌曲吗" message:[NSString stringWithFormat:@"歌曲名称:%@\n礼物信息:%@ x%@",model.song_name,model.gift_name,model.gift_num] cancleTitle:@"取消" commitTitle:@"确定"]; + MJWeakSelf + alertView.commitBlock = ^{ + [QXMineNetwork mineUserAddAndDeleteAndEditWithType:2 Id:model.id songName:model.song_name giftId:model.gift_id giftNum:model.gift_num successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"删除成功"); + weakSelf.page = 1; + [weakSelf getSongList]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(@"删除失败"); + }]; + }; +} + +-(void)editSongWithModel:(QXUserSongListModel*)model{ + self.addSongView = [[QXMineAddSongView alloc] initWithFrame:[UIScreen mainScreen].bounds]; + self.addSongView.delegate = self; + self.addSongView.songModel = model; + [self.addSongView showInView:self.view]; +} + +-(UITableView *)tableView{ + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(16, self.countLabel.bottom+5, SCREEN_WIDTH-32, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStylePlain)]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = [UIColor whiteColor]; + [_tableView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + _tableView.rowHeight = 45; +// _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + if (@available(iOS 15.0, *)) { + _tableView.sectionHeaderTopPadding = 0; + } else { + // Fallback on earlier versions + } + MJWeakSelf + _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ + weakSelf.page = 1; + [weakSelf getSongList]; + }]; + _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ + weakSelf.page++; + [weakSelf getSongList]; + }]; + } + return _tableView; +} +@end diff --git a/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.h b/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.h new file mode 100644 index 0000000..a39207b --- /dev/null +++ b/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.h @@ -0,0 +1,17 @@ +// +// QXRoomSingerAuthViewController.h +// QXLive +// +// Created by 启星 on 2025/11/12. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomSingerAuthViewController : QXBaseViewController +/// 当前状态:-1 未认证歌手, 0待审核 1已认证 2被拒绝 +@property (nonatomic,strong)NSString *singer_status; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.m b/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.m new file mode 100644 index 0000000..ddd39f5 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.m @@ -0,0 +1,153 @@ +// +// QXRoomSingerAuthViewController.m +// QXLive +// +// Created by 启星 on 2025/11/12. +// + +#import "QXRoomSingerAuthViewController.h" +#import "QXAudioRecorderView.h" +#import "QXMineNetwork.h" + +@interface QXRoomSingerAuthViewController () +@property (nonatomic,strong)UIView *contentView; +@property (nonatomic,strong)UIImageView *contentImageView; + +@property (nonatomic,strong)UIImageView *myAuthImageView; +@property (nonatomic,strong)UIImageView *authStatusImageView; +@property (nonatomic,strong)UILabel *authStatusLabel; + +@property (nonatomic,strong)QXAudioRecorderView *audioRecorderView; +@end + +@implementation QXRoomSingerAuthViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)}; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)}; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationTintColor = RGB16(0xffffff); + self.navigationItem.title = @"歌手认证"; + UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; + [recordBtn setImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)]; + recordBtn.titleLabel.font = [UIFont systemFontOfSize:16]; + [recordBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recordBtn]; +} + +- (void)initSubViews{ + [self updateBgImage:@"singer_auth_bg"]; + self.contentView = [[UIView alloc] initWithFrame:CGRectMake(16, ScaleWidth(300), SCREEN_WIDTH-32, ScaleWidth(140))]; + [self.view addSubview:self.contentView]; + self.contentImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_auth_center_bg"]]; + self.contentImageView.contentMode = UIViewContentModeScaleToFill; + self.contentImageView.frame = self.contentView.bounds; + [self.contentView addSubview:self.contentImageView]; + + self.myAuthImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_auth_title_image"]]; + self.myAuthImageView.frame = CGRectMake((self.contentView.width-ScaleWidth(69))/2, ScaleWidth(10), ScaleWidth(69), ScaleWidth(24)); + [self.contentView addSubview:self.myAuthImageView]; + + self.authStatusImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_auth_status_no"]]; + self.authStatusImageView.frame = CGRectMake((self.contentView.width-ScaleWidth(52))/2, self.myAuthImageView.bottom+ScaleWidth(22), ScaleWidth(52), ScaleWidth(52)); + [self.contentView addSubview:self.authStatusImageView]; + + self.authStatusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.authStatusImageView.bottom+4, self.contentView.width, 17)]; + self.authStatusLabel.text = @"暂未认证"; + self.authStatusLabel.textColor = RGB16A(0x000000, 0.45); + self.authStatusLabel.font = [UIFont systemFontOfSize:12]; + self.authStatusLabel.textAlignment = NSTextAlignmentCenter; + [self.contentView addSubview:self.authStatusLabel]; + + + self.audioRecorderView = [[QXAudioRecorderView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-kSafeAreaBottom-246, SCREEN_WIDTH, 246+kSafeAreaBottom) maxDuration:300]; + self.audioRecorderView.delegate = self; + self.audioRecorderView.hidden = YES; + [self.view addSubview:self.audioRecorderView]; + [self conifgViews]; +} +-(void)conifgViews{ + if ([self.singer_status isEqualToString:@"-1"] || [self.singer_status isEqualToString:@"2"]) { + self.audioRecorderView.hidden = NO; + }else{ + self.audioRecorderView.hidden = YES; + } + if ([self.singer_status isEqualToString:@"-1"]) { + self.authStatusLabel.text = @"暂未认证"; + self.authStatusLabel.textColor = RGB16A(0x000000, 0.45); + }else if ([self.singer_status isEqualToString:@"0"]) { + self.authStatusLabel.text = @"待审核"; + self.authStatusLabel.textColor = RGB16(0xFF8832); + }else if ([self.singer_status isEqualToString:@"1"]) { + self.authStatusLabel.text = @"已认证"; + self.authStatusLabel.textColor = QXConfig.themeColor; + }else if ([self.singer_status isEqualToString:@"2"]) { + self.authStatusLabel.text = @"已拒绝"; + self.authStatusLabel.textColor = RGB16(0xFF2424); + } +} +-(void)helpAction{ + NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"33"]; + QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; + vc.urlStr = urlString; + [self.navigationController pushViewController:vc animated:YES]; +} +#pragma mark - AudioRecorderViewDelegate + +- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didChangeState:(AudioRecorderState)state{ + NSLog(@"录音状态改变: %ld", (long)state); + +} + +- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didFinishRecordingWithMP3File:(NSURL *)mp3FileURL duration:(NSTimeInterval)duration{ + NSLog(@"录音完成,MP3文件: %@, 总时长: %.1f秒", mp3FileURL, duration); + + // 这里可以上传文件或进行其他处理 + NSData *audioData = [NSData dataWithContentsOfURL:mp3FileURL]; + NSLog(@"MP3文件大小: %.2f KB", audioData.length / 1024.0); +} + +- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didFailWithError:(NSError *)error{ + NSLog(@"录音失败: %@", error); + +} + +- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didUpdateProgress:(NSTimeInterval)progress totalDuration:(NSTimeInterval)totalDuration{ + // 实时更新进度 + +} +-(void)didClickAuthWithFileUrl:(NSURL *)audioFileUrl{ + NSData *data = [NSData dataWithContentsOfURL:audioFileUrl]; + @weakify(self) + showLoadingInView(self.view); + [[QXCOSUploadManager shareManager] audioUploadFile:data withObjectKey:audioFileUrl.lastPathComponent complete:^(NSString * _Nonnull fileUrl, QXCOSUploadImageState state) { + @strongify(self); + dispatch_async(dispatch_get_main_queue(), ^{ + hideLoadingInView(self.view); + if ([fileUrl isExist]) { + [QXMineNetwork singerAuthWithSong:fileUrl successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"上传成功"); + self.singer_status = @"0"; + [self conifgViews]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(@"上传失败"); + }]; + }else{ + showToast(@"上传失败"); + } + }); + }]; +} +@end diff --git a/QXLive/Mine(音域)/Controller/每日任务/QXTaskGiftRecordVC.m b/QXLive/Mine(音域)/Controller/每日任务/QXTaskGiftRecordVC.m index 5fbaf71..6b0d259 100644 --- a/QXLive/Mine(音域)/Controller/每日任务/QXTaskGiftRecordVC.m +++ b/QXLive/Mine(音域)/Controller/每日任务/QXTaskGiftRecordVC.m @@ -25,6 +25,10 @@ self.page = 1; [self getHistorySubsidy]; } +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} -(void)getHistorySubsidy{ MJWeakSelf [QXMineNetwork dayTaskGiftBoxRecordSuccessBlock:^(NSArray * _Nonnull list) { diff --git a/QXLive/Mine(音域)/Controller/每日任务/QXTaskViewController.m b/QXLive/Mine(音域)/Controller/每日任务/QXTaskViewController.m index 6648ac8..ca5a92e 100644 --- a/QXLive/Mine(音域)/Controller/每日任务/QXTaskViewController.m +++ b/QXLive/Mine(音域)/Controller/每日任务/QXTaskViewController.m @@ -74,15 +74,22 @@ if (self.model == nil) { return 0; } - return 3; + if (self.model.tasks.teacher_tasks.count > 0) { + return 4; + }else{ + return 3; + } + } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (section == 0) { return self.model.tasks.daily_tasks.count; }else if(section == 1){ return self.model.tasks.daily_tasks_special.count; - }else{ + }else if(section == 2){ return self.model.tasks.usual_tasks.count; + }else{ + return self.model.tasks.teacher_tasks.count; } } @@ -93,8 +100,10 @@ model = self.model.tasks.daily_tasks[indexPath.row]; }else if(indexPath.section == 1){ model = self.model.tasks.daily_tasks_special[indexPath.row]; - }else{ + }else if(indexPath.section == 2){ model = self.model.tasks.usual_tasks[indexPath.row]; + }else{ + model = self.model.tasks.teacher_tasks[indexPath.row]; } cell.model = model; return cell; @@ -110,8 +119,10 @@ titleLabel.text = QXText(@"每日任务"); }else if(section == 1){ titleLabel.text = QXText(@"特殊任务"); - }else{ + }else if(section == 2){ titleLabel.text = QXText(@"平台任务"); + }else{ + titleLabel.text = QXText(@"师徒任务"); } [header addSubview:titleLabel]; return header; diff --git a/QXLive/Mine(音域)/Controller/爵位/QXBuyNobilitySuccessViewController.h b/QXLive/Mine(音域)/Controller/爵位/QXBuyNobilitySuccessViewController.h new file mode 100644 index 0000000..325a5a6 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/爵位/QXBuyNobilitySuccessViewController.h @@ -0,0 +1,16 @@ +// +// QXBuyNobilitySuccessViewController.h +// QXLive +// +// Created by 启星 on 2025/11/10. +// + +#import "QXBaseViewController.h" +#import "QXNobilityGetPriceModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface QXBuyNobilitySuccessViewController : QXBaseViewController +@property (nonatomic,strong)QXNobilityGetPriceModel *model; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/爵位/QXBuyNobilitySuccessViewController.m b/QXLive/Mine(音域)/Controller/爵位/QXBuyNobilitySuccessViewController.m new file mode 100644 index 0000000..2c7c5b9 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/爵位/QXBuyNobilitySuccessViewController.m @@ -0,0 +1,142 @@ +// +// QXBuyNobilitySuccessViewController.m +// QXLive +// +// Created by 启星 on 2025/11/10. +// + +#import "QXBuyNobilitySuccessViewController.h" +#import "QXNobilityBuyDesCell.h" + +@interface QXBuyNobilitySuccessViewController () +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)UIView *headerView; +@property (nonatomic,strong)UIImageView *resultImageView; +@property (nonatomic,strong)UILabel *resultLabel; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,strong)UIImageView *nobilityImageView; +@end + +@implementation QXBuyNobilitySuccessViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; +} + +-(void)initSubViews{ + self.titleLabel.text = [NSString stringWithFormat:@"恭喜您已经成功开通%@爵位",self.model.nobility_name]; + [self.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:self.model.nobility_image]]; + self.tableView.tableHeaderView = self.headerView; + [self.view addSubview:self.tableView]; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return self.model.power_list.count; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + QXNobilityBuyDesCell *cell = [QXNobilityBuyDesCell cellWithTableView:tableView]; + QXNobilityGetPricePowerList *md = self.model.power_list[indexPath.row]; + cell.titleLabel.text = md.content; + return cell; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + return 36; +} + +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 42)]; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, SCREEN_WIDTH-32, 30)]; + label.font = [UIFont boldSystemFontOfSize:16]; + label.text = @"骑士特权"; + label.textColor = RGB16A(0x000000, 0.85); + [header addSubview:label]; + return header; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + return 42; +} + +-(UITableView *)tableView{ + if (!_tableView) { + self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:UITableViewStyleGrouped]; + self.tableView.backgroundColor = [UIColor clearColor]; + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + } + return _tableView; +} + + +-(UIView *)headerView{ + if (!_headerView) { + _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, 280)]; + [_headerView addSubview:self.resultImageView]; + [_headerView addSubview:self.resultLabel]; + [_headerView addSubview:self.titleLabel]; + [_headerView addSubview:self.nobilityImageView]; + + [self.resultImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(68); + make.height.mas_equalTo(60); + make.top.mas_equalTo(25); + make.centerX.equalTo(_headerView); + }]; + [self.resultLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(22); + make.centerX.equalTo(_headerView); + make.top.equalTo(self.resultImageView.mas_bottom).offset(7); + }]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(20); + make.centerX.equalTo(_headerView); + make.top.equalTo(self.resultLabel.mas_bottom).offset(7); + }]; + [self.nobilityImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(104); + make.height.mas_equalTo(104); + make.top.equalTo(self.titleLabel.mas_bottom).offset(36); + make.centerX.equalTo(_headerView); + }]; + } + return _headerView; +} + +-(UIImageView *)resultImageView{ + if (!_resultImageView) { + _resultImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_pay_result_successs"]]; + } + return _resultImageView; +} +-(UILabel *)resultLabel{ + if (!_resultLabel) { + _resultLabel = [[UILabel alloc] init]; + _resultLabel.textColor = RGB16(0x333333); + _resultLabel.font = [UIFont boldSystemFontOfSize:20]; + _resultLabel.text = @"支付成功"; + } + return _resultLabel; +} +-(UILabel *)titleLabel{ + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.textColor = RGB16A(0x000000,0.65); + _titleLabel.font = [UIFont systemFontOfSize:14]; + } + return _titleLabel; +} +-(UIImageView *)nobilityImageView{ + if (!_nobilityImageView) { + _nobilityImageView = [[UIImageView alloc] init]; + } + return _nobilityImageView; +} +@end diff --git a/QXLive/Mine(音域)/Controller/爵位/QXNobilityBuyViewController.h b/QXLive/Mine(音域)/Controller/爵位/QXNobilityBuyViewController.h new file mode 100644 index 0000000..e7217aa --- /dev/null +++ b/QXLive/Mine(音域)/Controller/爵位/QXNobilityBuyViewController.h @@ -0,0 +1,17 @@ +// +// QXNobilityBuyViewController.h +// QXLive +// +// Created by 启星 on 2025/11/7. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXNobilityBuyViewController : QXBaseViewController +/// 购买id +@property (nonatomic,strong)NSString *nobility_id; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/爵位/QXNobilityBuyViewController.m b/QXLive/Mine(音域)/Controller/爵位/QXNobilityBuyViewController.m new file mode 100644 index 0000000..a4602ed --- /dev/null +++ b/QXLive/Mine(音域)/Controller/爵位/QXNobilityBuyViewController.m @@ -0,0 +1,346 @@ +// +// QXNobilityBuyViewController.m +// QXLive +// +// Created by 启星 on 2025/11/7. +// + +#import "QXNobilityBuyViewController.h" +#import "QXNobilityBuyDesCell.h" +#import "QXRechargePayTypeTableCell.h" +#import "QXNobilityPriceView.h" +#import "QXMineNetwork.h" +#import "QXBuyNobilitySuccessViewController.h" +#import +#import + +@interface QXNobilityBuyViewController () +@property (nonatomic,strong)UITableView *tableView; +@property (nonatomic,strong)QXNobilityGetPriceModel *model; +@property (nonatomic,strong)NSMutableArray* payTypeArray; +@property (nonatomic,strong)QXNobilityPriceView *priceView; + +@property (nonatomic,strong)UIView *footerView; + +@property (nonatomic,strong)UIView *tableFooterView; + +@property (nonatomic,assign)BOOL isSelectedAgreement; +@property (nonatomic,strong)QXPayTypeModel* selectedPayTypeModel; +@end + +@implementation QXNobilityBuyViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationItem.title = @"支付"; +} +- (void)initSubViews{ + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(paySuccess) name:noticeAlipayResult object:nil]; + self.tableView.tableHeaderView = self.priceView; + self.tableView.tableFooterView = self.tableFooterView; + [self.view addSubview:self.tableView]; + [self getRechargeList]; +} + +-(void)setNobility_id:(NSString *)nobility_id{ + _nobility_id = nobility_id; + MJWeakSelf + [QXMineNetwork getNobilityPriceWithId:nobility_id successBlock:^(QXNobilityGetPriceModel * _Nonnull model) { + weakSelf.model = model; + weakSelf.priceView.model = model; + [weakSelf.tableView reloadData]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [weakSelf.navigationController popViewControllerAnimated:YES]; + }); + }]; +} + +-(void)getRechargeList{ + MJWeakSelf + + [QXMineNetwork walletPayTypeWithUserId:QXGlobal.shareGlobal.loginModel.user_id successBlock:^(QXPayTypeStatusModel * _Nonnull model) { + [weakSelf.payTypeArray removeAllObjects]; + if (model.wx.is_pay_open.intValue == 1) { + [weakSelf.payTypeArray addObject:model.wx]; + } + if (model.ali.is_pay_open.intValue == 1) { + [weakSelf.payTypeArray addObject:model.ali]; + } + if (model.wx_tl.is_pay_open.intValue == 1) { + [weakSelf.payTypeArray addObject:model.wx_tl]; + } + if (model.ali_tl.is_pay_open.intValue == 1) { + [weakSelf.payTypeArray addObject:model.ali_tl]; + } + [weakSelf.tableView reloadData]; + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + +-(void)payAction{ + if (!self.isSelectedAgreement) { + showToast(@"请先阅读并同意爵位用户协议"); + return; + } + if (self.selectedPayTypeModel == nil) { + showToast(@"请选择支付方式"); + return; + } + @weakify(self) + [QXMineNetwork rechargePayWithMoney:self.model.price coin:@"" type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id typeId:@"" nobility_id:self.nobility_id successBlock:^(NSDictionary * _Nonnull dict) { + @strongify(self) + if (self.selectedPayTypeModel.type.intValue == 2) { + NSDictionary *resultDict = dict[@"data"]; + NSString *order = [NSString stringWithFormat:@"%@",resultDict[@"ali"]]; + [[AlipaySDK defaultService] payOrder:order fromScheme:AppScheme callback:^(NSDictionary *resultDic) { + NSLog(@"支付宝H5支付回调 - %@", resultDic); + + }]; + }else if (self.selectedPayTypeModel.type.intValue == 1) { + NSDictionary *resultDict = dict[@"data"][@"wx"]; + NSString *appid = resultDict[@"appid"]; + NSString *partnerId = resultDict[@"partnerid"]; + NSString *prepayId = [NSString stringWithFormat:@"%@",resultDict[@"prepayid"]]; + NSString *nonceStr = resultDict[@"noncestr"]; + UInt32 timeStamp = (UInt32)[resultDict[@"timestamp"] intValue]; + NSString *package = resultDict[@"package"]; + NSString *sign = resultDict[@"sign"]; + PayReq *req = [[PayReq alloc] init]; + req.openID = appid; + req.partnerId = partnerId; + req.prepayId = prepayId; + req.nonceStr = nonceStr; + req.timeStamp = timeStamp; + req.package = package; + req.sign = sign; + [WXApi sendReq:req completion:^(BOOL success) { + + }]; + } + else if (self.selectedPayTypeModel.type.intValue == 4) { + NSMutableDictionary*dic = [NSMutableDictionary dictionaryWithDictionary:dict[@"data"][@"tl"]]; + [dic removeObjectForKey:@"json_data"]; + NSString *json = [dic jsonStringEncoded]; + NSString *thirdPartSchema = [NSString stringWithFormat:@"thirdPartSchema=%@://",AppScheme]; + NSString *json1 = [json stringByReplacingOccurrencesOfString:@"\\" withString:@""]; + NSCharacterSet *customSet1 = [[NSCharacterSet characterSetWithCharactersInString:@"!*'();:@&=+$,/?%#[]{}\""] invertedSet]; +// NSCharacterSet *customSet2 = [[NSCharacterSet characterSetWithCharactersInString:@"!*'();:@&=+$,/?%#[]{}\""] invertedSet]; + NSCharacterSet *customSet3 = [[NSCharacterSet characterSetWithCharactersInString:@"!*'();:@&=+$,/?%#[]{}\""] invertedSet]; + NSString *json2 = [json1 stringByAddingPercentEncodingWithAllowedCharacters:customSet1]; + NSString *encodedString = [thirdPartSchema stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + NSString *queryString = [NSString stringWithFormat:@"payinfo=%@", json2]; + NSString *doubleEncodedQuery = [queryString stringByAddingPercentEncodingWithAllowedCharacters:customSet3]; + NSString *jumpStr = [NSString stringWithFormat:@"alipays://platformapi/startapp?appId=2021001104615521&page=pages/orderDetail/orderDetail&%@&query=%@",encodedString,doubleEncodedQuery]; + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:jumpStr] options:@{} completionHandler:nil]; + }else if (self.selectedPayTypeModel.type.intValue == 5) { + WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object]; + launchMiniProgramReq.userName = @"gh_e64a1a89a0ad"; + NSDictionary *dic = dict[@"data"][@"tl"]; + NSString *param = @""; + for (NSString*key in dic.allKeys) { + if (param.length == 0) { + param = [param stringByAppendingFormat:@"%@=%@",key,dic[key]]; + }else{ + param = [param stringByAppendingFormat:@"&%@=%@",key,dic[key]]; + } + } + launchMiniProgramReq.path = [NSString stringWithFormat:@"pages/orderDetail/orderDetail?%@",param]; + launchMiniProgramReq.miniProgramType = WXMiniProgramTypeRelease; + [WXApi sendReq:launchMiniProgramReq completion:nil]; + } + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + + +-(void)paySuccess{ + QXBuyNobilitySuccessViewController *vc = [[QXBuyNobilitySuccessViewController alloc] init]; + vc.model = self.model; + [self.navigationController pushViewController:vc animated:YES]; +} +-(void)agreementAction{ + // id = 30; + NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"30"]; + QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; + vc.urlStr = urlString; + [self.navigationController pushViewController:vc animated:YES]; +} +-(void)selectedAction:(UIButton*)sender{ + sender.selected = !sender.selected; + self.isSelectedAgreement = sender.isSelected; +} + +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ + return 2; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + if (section == 0) { + return self.payTypeArray.count; + }else{ + return self.model.power_list.count; + } +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + QXRechargePayTypeTableCell *cell = [QXRechargePayTypeTableCell cellWithTableView:tableView]; + cell.model = self.payTypeArray[indexPath.row]; + return cell; + }else{ + QXNobilityBuyDesCell *cell = [QXNobilityBuyDesCell cellWithTableView:tableView]; + QXNobilityGetPricePowerList *md = self.model.power_list[indexPath.row]; + cell.titleLabel.text = md.content; + return cell; + } +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + return 36; +} + +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + if (section == 0) { + UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 42)]; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, SCREEN_WIDTH-32, 30)]; + label.font = [UIFont boldSystemFontOfSize:16]; + label.text = @"支付方式"; + label.textColor = RGB16A(0x000000, 0.85); + [header addSubview:label]; + return header; + }else{ + return nil; + } +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + if (section == 0) { + return 42; + }else{ + return 0; + } +} +-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ + if (section == 0) { + return self.footerView; + } + return nil; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ + if (section == 0) { + return self.footerView.height; + } + return 0; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath.section == 0) { + QXPayTypeModel *model = self.payTypeArray[indexPath.row]; + if (model == self.selectedPayTypeModel) { + return; + } + if (self.selectedPayTypeModel) { + self.selectedPayTypeModel.isSelected = NO; + } + model.isSelected = YES; + self.selectedPayTypeModel = model; + [tableView reloadData]; + } +} + + +-(UITableView *)tableView{ + if (!_tableView) { + self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:UITableViewStyleGrouped]; + self.tableView.backgroundColor = [UIColor clearColor]; + self.tableView.delegate = self; + self.tableView.dataSource = self; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + } + return _tableView; +} +-(QXNobilityPriceView *)priceView{ + if (!_priceView) { + _priceView = [[QXNobilityPriceView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 187)]; + } + return _priceView; +} +-(UIView *)footerView{ + if (!_footerView) { + _footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 120)]; + UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(37, 28, SCREEN_WIDTH-37*2, 42)]; + payBtn.backgroundColor = QXConfig.themeColor; + [payBtn addRoundedCornersWithRadius:21]; + [payBtn setTitle:@"立即支付" forState:(UIControlStateNormal)]; + [payBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + payBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [payBtn addTarget:self action:@selector(payAction) forControlEvents:(UIControlEventTouchUpInside)]; + [_footerView addSubview:payBtn]; + + UILabel *titleLabel = [[UILabel alloc] init]; + NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:@"点击支付即表示您同意《爵位用户协议》"]; + [attr yy_setColor:QXConfig.textColor range:NSMakeRange(0, attr.length)]; + [attr yy_setColor:QXConfig.themeColor range:NSMakeRange(attr.length-8, 8)]; + [attr yy_setFont:[UIFont systemFontOfSize:12] range:NSMakeRange(0, attr.length)]; + titleLabel.attributedText = attr; + [titleLabel sizeToFit]; + titleLabel.x = (SCREEN_WIDTH-titleLabel.width)/2+15; + titleLabel.y = payBtn.bottom+9; + titleLabel.height = 30; + [_footerView addSubview:titleLabel]; + + + UIButton *agreementBtn = [[UIButton alloc] initWithFrame:CGRectMake(titleLabel.right-100, titleLabel.top, 100, 30)]; + [agreementBtn addTarget:self action:@selector(agreementAction) forControlEvents:(UIControlEventTouchUpInside)]; + [_footerView addSubview:agreementBtn]; + + UIButton *selectedBtn = [[UIButton alloc] initWithFrame:CGRectMake(titleLabel.left-30, titleLabel.top, 30, 30)]; + [selectedBtn setImage:[UIImage imageNamed:@"login_agreement_nor"] forState:(UIControlStateNormal)]; + [selectedBtn setImage:[UIImage imageNamed:@"login_agreement_sel"] forState:(UIControlStateSelected)]; + [selectedBtn addTarget:self action:@selector(selectedAction:) forControlEvents:(UIControlEventTouchUpInside)]; + [_footerView addSubview:selectedBtn]; + } + return _footerView; +} + +-(UIView *)tableFooterView{ + if (!_tableFooterView) { + _tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 90)]; + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_desc_icon"]]; + imageView.frame = CGRectMake(16, 15, 18, 18); + [_tableFooterView addSubview:imageView]; + + UILabel *titleLabel =[[ UILabel alloc] initWithFrame:CGRectMake(imageView.right+5, 15, 100, 18)]; + titleLabel.textColor = QXConfig.textColor; + titleLabel.text = @"升级说明"; + titleLabel.font = [UIFont boldSystemFontOfSize:16]; + [_tableFooterView addSubview:titleLabel]; + + UILabel *bottomLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, imageView.bottom+10, SCREEN_WIDTH-16*2, 42)]; + bottomLabel.numberOfLines = 0; + bottomLabel.textColor = QXConfig.textColor; + bottomLabel.font = [UIFont systemFontOfSize:14]; + bottomLabel.text = @"如果您当前已有爵位,升级时将自动计算剩余价值抵扣新爵位费用"; + [_tableFooterView addSubview:bottomLabel]; + } + return _tableFooterView; +} +-(NSMutableArray *)payTypeArray{ + if (!_payTypeArray) { + _payTypeArray = [NSMutableArray array]; + } + return _payTypeArray; +} +@end diff --git a/QXLive/Mine(音域)/Controller/爵位/QXNobilityDetailViewController.h b/QXLive/Mine(音域)/Controller/爵位/QXNobilityDetailViewController.h new file mode 100644 index 0000000..3922ed0 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/爵位/QXNobilityDetailViewController.h @@ -0,0 +1,16 @@ +// +// QXNobilityDetailViewController.h +// QXLive +// +// Created by 启星 on 2025/11/8. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXNobilityDetailViewController : QXBaseViewController +@property (nonatomic,strong)NSString *cruuent_nobility_id; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/爵位/QXNobilityDetailViewController.m b/QXLive/Mine(音域)/Controller/爵位/QXNobilityDetailViewController.m new file mode 100644 index 0000000..1704861 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/爵位/QXNobilityDetailViewController.m @@ -0,0 +1,257 @@ +// +// QXNobilityDetailViewController.m +// QXLive +// +// Created by 启星 on 2025/11/8. +// + +#import "QXNobilityDetailViewController.h" +#import "GKCycleScrollView.h" +#import "QXNobilityDetailTopCell.h" +#import "QXMineNetwork.h" +#import "QXNobilityDetailCell.h" +#import "QXNobilityBuyViewController.h" + +@interface QXNobilityDetailViewController () +@property (nonatomic,strong)GKCycleScrollView *cycleScrollView; +@property (nonatomic,strong)UIView *headerView; +@property (nonatomic,strong)UIImageView *headerImageView; +@property (nonatomic,strong)UILabel *headerLabel; +@property (nonatomic,strong)UICollectionView *collectionView; +@property (nonatomic,strong)QXNobilityListModel *currentModel; + +@property (nonatomic,strong)UIView *bottomView; +@property (nonatomic,strong)UIImageView *bottomImageView; +@property (nonatomic,strong)UILabel *bottomLabel; +@property (nonatomic,strong)UIButton *openBtn; + +@property (nonatomic,assign)NSInteger currentIndex; +@end + +@implementation QXNobilityDetailViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)}; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)}; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationTintColor = RGB16(0xffffff); + self.navigationItem.title = @"爵位详情"; + UIButton*createBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; + [createBtn setImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)]; + createBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing; + [createBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:createBtn]; +} + +-(void)helpAction{ + NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"29"]; + QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; + vc.urlStr = urlString; + [self.navigationController pushViewController:vc animated:YES]; +} + +-(void)getData{ + MJWeakSelf + [QXMineNetwork getNobilityListSuccessBlock:^(NSArray * _Nonnull list) { + [weakSelf.dataArray removeAllObjects]; + [weakSelf.dataArray addObjectsFromArray:list]; + weakSelf.currentModel = weakSelf.dataArray.firstObject; + weakSelf.headerLabel.text = [NSString stringWithFormat:@"专属特权%@",self.currentModel.power.count_str]; + [weakSelf setPirce]; + for (NSInteger i = 0;i +@property (nonatomic,strong)QXNobilityHeaderView *topView; +@property (nonatomic,strong)UIView *nobilityBgView; +@property (nonatomic,strong)UIView *nobilityContentView; +@property (nonatomic,strong)UILabel *nobilityTitleLabel; +//@property (nonatomic,strong)JXCategoryTitleView *categoryView; +//@property (nonatomic,strong)JXCategoryListContainerView *containerView; +@property (nonatomic,strong)UIView *bottomView; +@property (nonatomic,strong)QXSeatHeaderView *userAvatarView; +@property (nonatomic,strong)UILabel *bottomNickNameLabel; +@property (nonatomic,strong)UIButton *bottomBuyBtn; +@property (nonatomic,strong)NSMutableArray *titles; + +@property (nonatomic,strong)QXNobilityContentView *contentView;; + +@property (nonatomic,strong)QXNobilityModel* model; + +@end + +@implementation QXNobilityViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)}; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)}; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationTintColor = RGB16(0xffffff); + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_nav_icon"]]; + imageView.frame = CGRectMake(0, 0, 71, 18); + self.navigationItem.titleView = imageView; + UIButton*createBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)]; + [createBtn setImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)]; + createBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing; + [createBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:createBtn]; + +} +- (void)initSubViews{ + [self updateBgImage:@"home_rank_vc_bg"]; + self.topView = [[QXNobilityHeaderView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH,0)]; + self.topView.delegate = self; + [self.view addSubview:self.topView]; + + self.nobilityBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.topView.bottom, SCREEN_WIDTH-32, SCREEN_HEIGHT-self.topView.bottom-80)]; + self.nobilityBgView.backgroundColor = RGB16(0x1E2127); + self.nobilityBgView.layer.borderWidth = 1; + self.nobilityBgView.layer.borderColor = RGB16A(0xF5E9D1, 0.2).CGColor; + [self.nobilityBgView addRoundedCornersWithRadius:12]; + [self.view addSubview:self.nobilityBgView]; + + self.nobilityContentView = [[UIView alloc] initWithFrame:CGRectMake(12, 12, self.nobilityBgView.width-24, self.nobilityBgView.height-24)]; + [self.nobilityContentView addRoundedCornersWithRadius:6]; + [self.nobilityBgView addSubview:self.nobilityContentView]; + + [self.view addSubview:self.bottomView]; + self.contentView = [[QXNobilityContentView alloc] initWithFrame:self.nobilityContentView.bounds]; + [self.nobilityContentView addSubview:self.contentView]; +} + +-(void)getData{ + MJWeakSelf + [QXMineNetwork getUserNobilitSuccessBlock:^(QXNobilityModel * _Nonnull model) { + weakSelf.model = model; + weakSelf.topView.model = model; + weakSelf.contentView.model = model; + [weakSelf.contentView reloadData]; + if (weakSelf.model.nobility_info.status.intValue == 0) { + weakSelf.bottomView.hidden = YES;; + }else{ + [weakSelf.userAvatarView setHeadIcon:model.user_info.avatar dress:@""]; + weakSelf.bottomNickNameLabel.text = [NSString stringWithFormat:@"%@的当前爵位状态是%@",model.user_info.nickname,model.nobility_info.name]; + weakSelf.bottomView.hidden = NO;; + } + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} + + +-(void)helpAction{ + NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"29"]; + QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; + vc.urlStr = urlString; + [self.navigationController pushViewController:vc animated:YES]; +} +-(void)buyAction{ + QXNobilityDetailViewController *vc = [[QXNobilityDetailViewController alloc] init]; + vc.cruuent_nobility_id = self.model.nobility_info.lid; + [self.navigationController pushViewController:vc animated:YES]; +} + + +/// 去开通 +-(void)didOpenNobility{ + QXNobilityDetailViewController *vc = [[QXNobilityDetailViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; +} +/// 去续费 +-(void)didRenewNobility{ + QXNobilityBuyViewController *vc = [[QXNobilityBuyViewController alloc] init]; + vc.nobility_id = self.model.nobility_info.lid; + [self.navigationController pushViewController:vc animated:YES]; +} + + +-(NSMutableArray *)titles{ + if (!_titles) { + _titles = [NSMutableArray array]; + } + return _titles; +} +-(UIView *)bottomView{ + if (!_bottomView) { + _bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-57, SCREEN_WIDTH, 57)]; + [_bottomView addRoundedCornersWithRadius:20 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_my_info_bg"]]; + imageView.frame = _bottomView.bounds; + [_bottomView addSubview:imageView]; + [_bottomView addSubview:self.userAvatarView]; + [_bottomView addSubview:self.bottomNickNameLabel]; + [_bottomView addSubview:self.bottomBuyBtn]; + } + return _bottomView; +} +-(QXSeatHeaderView *)userAvatarView{ + if (!_userAvatarView) { + _userAvatarView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(12, 12, 30, 30)]; +// [_userAvatarView setHeadIcon:QXGlobal.shareGlobal.loginModel.avatar dress:@""]; + } + return _userAvatarView; +} + +-(UIButton *)bottomBuyBtn{ + if (!_bottomBuyBtn) { + _bottomBuyBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-14-118, (57-36)/2, 118, 36)]; + [_bottomBuyBtn setBackgroundImage:[UIImage imageNamed:@"nobility_update_btn"] forState:(UIControlStateNormal)]; + [_bottomBuyBtn addTarget:self action:@selector(buyAction) forControlEvents:(UIControlEventTouchUpInside)]; + } + return _bottomBuyBtn; +} +-(UILabel *)bottomNickNameLabel{ + if (!_bottomNickNameLabel) { + _bottomNickNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userAvatarView.right+6, 0, self.bottomBuyBtn.left-self.userAvatarView.right-20, 57)]; +// _bottomNickNameLabel.text = QXGlobal.shareGlobal.loginModel.nickname; + _bottomNickNameLabel.textColor = RGB16(0xF5E9D1); + _bottomNickNameLabel.font = [UIFont systemFontOfSize:12]; + } + return _bottomNickNameLabel; +} +@end diff --git a/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallSubViewController.h b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallSubViewController.h new file mode 100644 index 0000000..e0f191c --- /dev/null +++ b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallSubViewController.h @@ -0,0 +1,19 @@ +// +// QXGiftWallSubViewController.h +// QXLive +// +// Created by 启星 on 2025/11/5. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXGiftWallSubViewController : UIViewController +/// 是否为已点亮 +@property(nonatomic,assign)BOOL isLight; +/// 数据源 +@property(nonatomic,strong)NSArray *giftArray; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallSubViewController.m b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallSubViewController.m new file mode 100644 index 0000000..a3719a4 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallSubViewController.m @@ -0,0 +1,62 @@ +// +// QXGiftWallSubViewController.m +// QXLive +// +// Created by 启星 on 2025/11/5. +// + +#import "QXGiftWallSubViewController.h" +#import "QXMineGiftWallCell.h" + +@interface QXGiftWallSubViewController () +@property (nonatomic,strong)UICollectionView *collectionView; +@end + +@implementation QXGiftWallSubViewController +-(UIView *)listView{ + return self.view; +} +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. + [self initSubViews]; +} +- (void)initSubViews{ + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + int itemWidth = (SCREEN_WIDTH-16*2-12*2)/3; + layout.itemSize = CGSizeMake(itemWidth, ScaleWidth(143)); + layout.minimumLineSpacing = 12; + layout.minimumInteritemSpacing = 12; + layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + [self.collectionView registerNib:[UINib nibWithNibName:@"QXMineGiftWallCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXMineGiftWallCell"]; + self.collectionView.delegate = self; + self.collectionView.dataSource = self; + self.collectionView.showsHorizontalScrollIndicator = NO; + self.collectionView.bounces = NO; + self.collectionView.pagingEnabled = NO; + self.collectionView.backgroundColor = [UIColor clearColor]; + [self.view addSubview:self.collectionView]; + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(0); + make.top.mas_equalTo(0); + make.bottom.mas_equalTo(0); + make.right.mas_equalTo(0); + }]; +} +-(void)setGiftArray:(NSArray *)giftArray{ + _giftArray = giftArray; + [self.collectionView reloadData]; +} +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + return self.giftArray.count; +} +-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + QXMineGiftWallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMineGiftWallCell" forIndexPath:indexPath]; + cell.isLight = self.isLight; + cell.model = self.giftArray[indexPath.row]; + return cell; +} + +@end diff --git a/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.h b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.h new file mode 100644 index 0000000..6726a8d --- /dev/null +++ b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.h @@ -0,0 +1,16 @@ +// +// QXGiftWallViewController.h +// QXLive +// +// Created by 启星 on 2025/11/5. +// + +#import "QXBaseViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface QXGiftWallViewController : QXBaseViewController +@property (nonatomic,strong)NSString*userId; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.m b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.m new file mode 100644 index 0000000..890b127 --- /dev/null +++ b/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.m @@ -0,0 +1,119 @@ +// +// QXGiftWallViewController.m +// QXLive +// +// Created by 启星 on 2025/11/5. +// + +#import "QXGiftWallViewController.h" +#import "QXGiftWallSubViewController.h" +#import "QXMineNetwork.h" + +@interface QXGiftWallViewController () +@property (nonatomic,strong)JXCategoryTitleView *categoryView; +@property (nonatomic,strong)JXCategoryListContainerView *containerView; +@property (nonatomic,strong)NSMutableArray *listVCArray; +@property (nonatomic,strong)NSArray*titles; +@property (nonatomic,strong)QXGiftWallSubViewController *lightVC; +@property (nonatomic,strong)QXGiftWallSubViewController *grayVC; +@end + +@implementation QXGiftWallViewController + +- (void)viewDidLoad { + self.isNoChangeBgImage = YES; + [super viewDidLoad]; + // Do any additional setup after loading the view. +} +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:YES]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)}; +} +-(void)viewWillDisappear:(BOOL)animated{ + [super viewWillDisappear:animated]; + self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)}; +} +-(void)setNavgationItems{ + [super setNavgationItems]; + self.navigationItem.title = @"礼物墙"; + +} + +-(void)initSubViews{ +// if ([QXConfig.backgroundImage hasPrefix:@"http"] || [QXConfig.backgroundImage hasPrefix:@"https"]) { +// [self updateBgImage:QXConfig.backgroundImage]; +// }else{ + [self updateBgImage:@"home_rank_vc_bg"]; +// } + self.navigationTintColor = RGB16(0xffffff); + self.view.backgroundColor = [UIColor clearColor]; +// self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"]; + self.titles = @[@"已点亮", @"未点亮"]; + self.listVCArray = [NSMutableArray array]; + self.categoryView = [[JXCategoryTitleView alloc] init]; + self.categoryView.frame = CGRectMake(16, NavContentHeight, SCREEN_WIDTH, 44); + self.categoryView.delegate = self; + self.categoryView.titles = self.titles; + self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#ffffff"]; + self.categoryView.titleColor = [UIColor colorWithHexString:@"#ffffff"]; + JXCategoryIndicatorImageView *indicatorImageView = [[JXCategoryIndicatorImageView alloc] init]; + indicatorImageView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"]; + indicatorImageView.indicatorWidth = (SCREEN_WIDTH-100)/self.titles.count; + indicatorImageView.indicatorHeight = 5; + self.categoryView.indicators = @[indicatorImageView]; + self.categoryView.cellWidth = JXCategoryViewAutomaticDimension; + self.categoryView.contentEdgeInsetLeft = 5; + self.categoryView.cellSpacing = 20; + self.categoryView.titleLabelZoomScale = 1.1; + self.categoryView.titleLabelZoomEnabled = YES; + self.categoryView.titleFont = [UIFont systemFontOfSize:14]; + self.categoryView.averageCellSpacingEnabled = NO; + + self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self]; + self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom); + [self.view addSubview: self.categoryView]; + [self.view addSubview:self.containerView]; + self.categoryView.listContainer = self.containerView; + [self getGiftWall]; +} + +-(void)getGiftWall{ + MJWeakSelf + [QXMineNetwork userGiftWallithUserId:self.userId successBlock:^(NSArray * _Nonnull lightList, NSArray * _Nonnull grayList) { + weakSelf.lightVC.giftArray = lightList; + weakSelf.grayVC.giftArray = grayList; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} +-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{ + return self.titles.count; +} +-(id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{ + if (index == 0) { + return self.lightVC; + }else{ + return self.grayVC; + } +} +-(QXGiftWallSubViewController *)lightVC{ + if (!_lightVC) { + _lightVC = [[QXGiftWallSubViewController alloc] init]; + _lightVC.isLight = YES; + } + return _lightVC; +} + +-(QXGiftWallSubViewController *)grayVC{ + if (!_grayVC) { + _grayVC = [[QXGiftWallSubViewController alloc] init]; + _grayVC.isLight = NO; + } + return _grayVC; +} +- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { + self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0); +} + +@end diff --git a/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.h b/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.h index 603b467..a2dfd1d 100644 --- a/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.h +++ b/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.h @@ -10,7 +10,8 @@ NS_ASSUME_NONNULL_BEGIN @interface QXSettingViewController : QXBaseViewController -@property (nonatomic,copy)void(^logOutBlock)(BOOL isCancel); +@property (nonatomic,copy)void(^logOutBlock)(BOOL isCancel,NSString*code); +@property (nonatomic,assign)BOOL haveNobility; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.m b/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.m index c872f6d..d22dc50 100644 --- a/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.m +++ b/QXLive/Mine(音域)/Controller/设置/QXSettingViewController.m @@ -9,6 +9,7 @@ #import "QXSettingCell.h" #import "QXMineNetwork.h" #import "QXAlertView.h" +#import "QXReVerificationPopView.h" #import "QXTimer.h" static NSInteger maxClickCount = 6; @interface QXSettingViewController () @@ -17,6 +18,7 @@ static NSInteger maxClickCount = 6; @property (nonatomic,strong)NSDictionary *valueDict; @property (nonatomic,strong)NSDictionary *controllerDict; @property (nonatomic,strong)QXAlertView *alertView; +@property (nonatomic,strong)QXReVerificationPopView *codeAlertView; @property (nonatomic,strong)QXTimer *timer; @property (nonatomic,assign)NSInteger clickCount; @end @@ -36,15 +38,27 @@ static NSInteger maxClickCount = 6; self.navigationItem.title = QXText(@"设置"); } -(void)initSubViews{ - NSArray *section1 = @[ -// QXText(@"消息通知"), -// QXText(@"未成年人模式"), - QXText(@"黑名单"), - QXText(@"设置密码"), - QXText(@"手机绑定"), - QXText(@"关于我们"), - QXText(@"版本号") - ]; + NSArray *section1; + if (self.haveNobility) { + section1 = @[ + QXText(@"隐身进入房间"), + QXText(@"黑名单"), + QXText(@"设置密码"), + QXText(@"手机绑定"), + QXText(@"关于我们"), + QXText(@"版本号") + ]; + }else{ + section1 = @[ +// QXText(@"消息通知"), + QXText(@"黑名单"), + QXText(@"设置密码"), + QXText(@"手机绑定"), + QXText(@"关于我们"), + QXText(@"版本号") + ]; + } + NSArray *section2 = @[ QXText(@"切换账号"), @@ -62,7 +76,8 @@ static NSInteger maxClickCount = 6; QXText(@"切换账号"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow], QXText(@"实名认证"):[NSNumber numberWithInteger:QXSettingCellTypeNormal], QXText(@"账号注销"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow], - QXText(@"退出登录"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow] + QXText(@"退出登录"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow], + QXText(@"隐身进入房间"):[NSNumber numberWithInteger:QXSettingCellTypeSwitch] }; self.controllerDict = @{ @@ -89,7 +104,8 @@ static NSInteger maxClickCount = 6; QXText(@"切换账号"):@"", QXText(@"实名认证"):@"", QXText(@"账号注销"):@"", - QXText(@"退出登录"):@"" + QXText(@"退出登录"):@"", + QXText(@"隐身进入房间"):QXGlobal.shareGlobal.loginModel.hide_status }; [self.dataArray addObject:section1]; [self.dataArray addObject:section2]; @@ -111,10 +127,27 @@ static NSInteger maxClickCount = 6; NSString *value = self.valueDict[text]; cell.titleLabel.text = text; cell.detailLabel.text = value; + cell.btnSwitch.selected = value.intValue==1; + [cell.btnSwitch addTarget:self action:@selector(setHideJoinRoom:) forControlEvents:(UIControlEventTouchUpInside)]; cell.cellType = [self.cellTypeDict[text] integerValue]; cell.needLine = (indexPath.row>=0) && (indexPath.row < arr.count-1); return cell; } + +-(void)setHideJoinRoom:(UIButton *)sender{ + sender.selected = !sender.selected; + __block NSString *status = QXGlobal.shareGlobal.loginModel.hide_status; + if ([status isEqualToString:@"0"]) { + status = @"1"; + }else{ + status = @"0"; + } + [QXMineNetwork getNobilityPriceWithHideStatus:status successBlock:^(NSDictionary * _Nonnull dict) { + QXGlobal.shareGlobal.loginModel.hide_status = status; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + + }]; +} -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ return [UIView new]; } @@ -143,14 +176,22 @@ static NSInteger maxClickCount = 6; } if ([text isEqualToString:QXText(@"账号注销")]) { - [[QXGlobal shareGlobal] showView:self.alertView controller:self popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{ - - }]; + UIView *view; + if ([QXGlobal.shareGlobal.loginModel.mobile isExist]) { + [[QXGlobal shareGlobal] showView:self.codeAlertView controller:self popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{ + + }]; + }else{ + [[QXGlobal shareGlobal] showView:self.alertView controller:self popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{ + + }]; + } + return; } if ([text isEqualToString:QXText(@"退出登录")]) { if (self.logOutBlock) { - self.logOutBlock(NO); + self.logOutBlock(NO,@""); } [self.navigationController popViewControllerAnimated:YES]; return; @@ -183,14 +224,40 @@ static NSInteger maxClickCount = 6; _alertView.message = @"注销后您当前的账户金币及钻石将无法找回\n30天内本账号将无法登录,请谨慎操作!"; MJWeakSelf _alertView.commitBlock = ^{ - [weakSelf.navigationController popViewControllerAnimated:YES]; - if (weakSelf.logOutBlock) { - weakSelf.logOutBlock(YES); - } + [weakSelf cancelAccountWithCode:@""]; }; } return _alertView; } +-(void)cancelAccountWithCode:(NSString*)code{ + MJWeakSelf + [QXMineNetwork cancelAccountWithCode:code successBlock:^(NSDictionary * _Nonnull dict) { + [[QXGlobal shareGlobal] hideViewBlock:^{ + [weakSelf.navigationController popViewControllerAnimated:YES]; + if (weakSelf.logOutBlock) { + weakSelf.logOutBlock(YES,code); + } + }]; + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +- (QXReVerificationPopView *)codeAlertView{ + if (!_codeAlertView) { + _codeAlertView = [[QXReVerificationPopView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(240))]; + _codeAlertView.isCancelAccount = YES; + MJWeakSelf + _codeAlertView.commitBlock = ^(NSString * _Nonnull code) { + if (code.length == 0) { + showToast(@"请输入验证码"); + return; + } + [weakSelf cancelAccountWithCode:code]; + }; + } + return _codeAlertView; +} /* #pragma mark - Navigation diff --git a/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m b/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m index a369af0..8fea8b3 100644 --- a/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m +++ b/QXLive/Mine(音域)/Controller/钱包/QXCornRecordSubViewController.m @@ -40,22 +40,33 @@ // [self.dataArray addObject:@""]; // [self.tableView reloadData]; // - MJWeakSelf + __weak typeof(self) weakSelf = self; [QXMineNetwork roomCoinOrDiamondDetailWithPage:self.page in_out_type:[NSString stringWithFormat:@"%ld",self.type+1] start_time:self.startTime end_time:self.endTime gift_type:[NSString stringWithFormat:@"%ld",self.waterType+1] successBlock:^(NSArray * _Nonnull list) { - if (weakSelf.page == 1) { - [weakSelf.dataArray removeAllObjects]; + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + NSLog(@"⚠️ self has been deallocated, skipping hide operation"); + return; } - [weakSelf.dataArray addObjectsFromArray:list]; - [weakSelf.tableView reloadData]; + if (strongSelf.page == 1) { + [strongSelf.dataArray removeAllObjects]; + } + [strongSelf.dataArray addObjectsFromArray:list]; + [strongSelf.tableView reloadData]; if (list.count == 0) { - weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + strongSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; }else{ - [weakSelf.tableView.mj_footer endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; } - [weakSelf.tableView.mj_header endRefreshing]; + [strongSelf.tableView.mj_header endRefreshing]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - [weakSelf.tableView.mj_header endRefreshing]; - [weakSelf.tableView.mj_footer endRefreshing]; + dispatch_async(dispatch_get_main_queue(), ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (strongSelf) { + [strongSelf.tableView.mj_header endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; + } + }); + }]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ @@ -91,7 +102,8 @@ _tableView.backgroundColor = [UIColor whiteColor]; _tableView.tableFooterView = [UIView new]; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - _tableView.rowHeight = 66; + _tableView.estimatedRowHeight = 66; + _tableView.rowHeight = UITableViewAutomaticDimension; MJWeakSelf _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ weakSelf.page = 1; diff --git a/QXLive/Mine(音域)/Controller/钱包/QXWithDrawRecordVC.m b/QXLive/Mine(音域)/Controller/钱包/QXWithDrawRecordVC.m index a44c112..bf09c76 100644 --- a/QXLive/Mine(音域)/Controller/钱包/QXWithDrawRecordVC.m +++ b/QXLive/Mine(音域)/Controller/钱包/QXWithDrawRecordVC.m @@ -43,22 +43,32 @@ self.page = 1; } -(void)getData{ - MJWeakSelf + __weak typeof(self) weakSelf = self; [QXMineNetwork walletWithDrawRecordWithPage:self.page start_time:self.startTime end_time:self.endTime SuccessBlock:^(NSArray * _Nonnull list) { - if (weakSelf.page == 1) { - [weakSelf.dataArray removeAllObjects]; + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + NSLog(@"⚠️ self has been deallocated, skipping hide operation"); + return; } - [weakSelf.dataArray addObjectsFromArray:list]; - [weakSelf.tableView reloadData]; + if (strongSelf.page == 1) { + [strongSelf.dataArray removeAllObjects]; + } + [strongSelf.dataArray addObjectsFromArray:list]; + [strongSelf.tableView reloadData]; if (list.count == 0) { - weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; + strongSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData; }else{ - [weakSelf.tableView.mj_footer endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; } - [weakSelf.tableView.mj_header endRefreshing]; + [strongSelf.tableView.mj_header endRefreshing]; } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { - [weakSelf.tableView.mj_header endRefreshing]; - [weakSelf.tableView.mj_footer endRefreshing]; + dispatch_async(dispatch_get_main_queue(), ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (strongSelf) { + [strongSelf.tableView.mj_header endRefreshing]; + [strongSelf.tableView.mj_footer endRefreshing]; + } + }); }]; } diff --git a/QXLive/Mine(音域)/Model/QXDayTaskModel.h b/QXLive/Mine(音域)/Model/QXDayTaskModel.h index fcf2215..4ace523 100644 --- a/QXLive/Mine(音域)/Model/QXDayTaskModel.h +++ b/QXLive/Mine(音域)/Model/QXDayTaskModel.h @@ -48,6 +48,7 @@ NS_ASSUME_NONNULL_BEGIN /// 平台任务列表 @property(nonatomic,strong)NSArray *usual_tasks; +@property(nonatomic,strong)NSArray *teacher_tasks; @end @@ -74,6 +75,8 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,strong)NSString *from_id; /// 0 记录次数 1 计时 @property(nonatomic,strong)NSString *is_time; +/// 奖励类型 1金币 2钻石 +@property(nonatomic,strong)NSString *reward_type; @end diff --git a/QXLive/Mine(音域)/Model/QXDayTaskModel.m b/QXLive/Mine(音域)/Model/QXDayTaskModel.m index c9acecd..9ef7e3f 100644 --- a/QXLive/Mine(音域)/Model/QXDayTaskModel.m +++ b/QXLive/Mine(音域)/Model/QXDayTaskModel.m @@ -28,6 +28,7 @@ @"daily_tasks" : @"QXDayTaskListModel", @"usual_tasks" : @"QXDayTaskListModel", @"daily_tasks_special": @"QXDayTaskListModel", + @"teacher_tasks": @"QXDayTaskListModel", }; } diff --git a/QXLive/Mine(音域)/Model/QXFamilyModel.h b/QXLive/Mine(音域)/Model/QXFamilyModel.h new file mode 100644 index 0000000..e089724 --- /dev/null +++ b/QXLive/Mine(音域)/Model/QXFamilyModel.h @@ -0,0 +1,92 @@ +// +// QXFamilyModel.h +// QXLive +// +// Created by 启星 on 2025/11/27. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXFamilyMemberModel; +@interface QXFamilyModel : NSObject +/// 群组id +@property(nonatomic,strong)NSString *group_id; +/// 家族名称 +@property(nonatomic,strong)NSString *name; +/// 族长id(群主id) +@property(nonatomic,strong)NSString *user_id; +/// 签约次数(群组人数) +@property(nonatomic,strong)NSString *group_members_num; +/// 总计收益 +@property(nonatomic,strong)NSString *group_earnings; +/// 族长信息 +@property(nonatomic,strong)QXUserModel *group_owner_info; +/// 家族成员 +@property(nonatomic,strong)NSArray *group_members_lists; + +@end + + +@interface QXFamilyMemberModel : NSObject +/// 身价 +@property(nonatomic,strong)NSString *market_value; +/// 2离线 1 在线 +@property(nonatomic,assign)NSInteger is_online; +/// 昵称 +@property(nonatomic,strong)NSString *nickname; +/// 头像 +@property(nonatomic,strong)NSString *avatar; +/// 用户code +@property(nonatomic,strong)NSString *user_code; +/// 用户id +@property(nonatomic,strong)NSString *user_id; +/// 剩余多少天 +@property(nonatomic,strong)NSString *end_time; +/// 剩余多少天 +@property(nonatomic,strong)NSString *end_day; +/// 头像框 +@property(nonatomic,strong)NSString *dress; +/// 头像框 +@property(nonatomic,strong)NSArray *icon; +/// 麦圈 +@property(nonatomic,strong)NSString *mic_cycle; +/// 爵位 +@property(nonatomic,strong)NSString *nobility_image; +/// 昵称颜色 +@property(nonatomic,strong)NSString *nickname_color; +/// 免费续签次数 +@property(nonatomic,strong)NSString *free_renewal; +/// 今日收礼收益 +@property(nonatomic,strong)NSString *today_earnings; +/// 昨日收礼收益 +@property(nonatomic,strong)NSString *yesterday_earnings; +/// 是否显示续约按钮 1:显示 0:不显示 +@property(nonatomic,strong)NSString *is_show_sign; +/// 续约身价的百分比 +@property(nonatomic,strong)NSString *sign_user_ratio; +/// 续约时长 +@property(nonatomic,strong)NSString *sign_times; +/// 续约免费时长 +@property(nonatomic,strong)NSString *free_re_sign_day; +@end + +@interface QXFamilyEarningModel : NSObject +/// 列表 id +@property(nonatomic,strong)NSString *id; +/// 用户昵称 +@property(nonatomic,strong)NSString *nickname; +/// 头像 +@property(nonatomic,strong)NSString *avatar; +/// 用户code +@property(nonatomic,strong)NSString *user_code; +/// 收益 +@property(nonatomic,strong)NSString *earnings; +/// 时间 +@property(nonatomic,strong)NSString *createtime; +/// 礼物名称 +@property(nonatomic,strong)NSString *gift_name; +/// 礼物价格 +@property(nonatomic,strong)NSString *gift_price; +@end +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/QXFamilyModel.m b/QXLive/Mine(音域)/Model/QXFamilyModel.m new file mode 100644 index 0000000..a89aab0 --- /dev/null +++ b/QXLive/Mine(音域)/Model/QXFamilyModel.m @@ -0,0 +1,31 @@ +// +// QXFamilyModel.m +// QXLive +// +// Created by 启星 on 2025/11/27. +// + +#import "QXFamilyModel.h" + +@implementation QXFamilyModel ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"group_owner_info" : @"QXFamilyMemberModel", + @"group_members_lists" : @"QXFamilyMemberModel", + }; +} + +@end + + +@implementation QXFamilyMemberModel + + + +@end + +@implementation QXFamilyEarningModel + + + +@end diff --git a/QXLive/Mine(音域)/Model/QXGiftModel.h b/QXLive/Mine(音域)/Model/QXGiftModel.h index c7c5a77..007d6ca 100644 --- a/QXLive/Mine(音域)/Model/QXGiftModel.h +++ b/QXLive/Mine(音域)/Model/QXGiftModel.h @@ -30,6 +30,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *activities_id; /// 活动类型 10 天空之境 11 岁月之城 12时空之巅 @property (nonatomic,strong)NSString *gift_bag; +/// 是否为爵位礼物 0 打开 1 锁住 +@property (nonatomic,strong)NSString *is_lock; + +/// 是否为爵位礼物 0 打开 1 锁住 +@property (nonatomic,strong)NSString *is_cp; @property (nonatomic,assign)BOOL isSelected; @end diff --git a/QXLive/Mine(音域)/Model/QXRoomListModel.h b/QXLive/Mine(音域)/Model/QXRoomListModel.h index 831c984..6d9a601 100644 --- a/QXLive/Mine(音域)/Model/QXRoomListModel.h +++ b/QXLive/Mine(音域)/Model/QXRoomListModel.h @@ -105,5 +105,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString*id; /// 房间密码 @property (nonatomic,strong)NSString*label_name; +/// 默认选中 1 选中 0 未选中 +@property (nonatomic,strong)NSString*default_index; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/QXRoomModel.h b/QXLive/Mine(音域)/Model/QXRoomModel.h index ff44f06..18448f1 100644 --- a/QXLive/Mine(音域)/Model/QXRoomModel.h +++ b/QXLive/Mine(音域)/Model/QXRoomModel.h @@ -8,9 +8,10 @@ #import #import "QXGiftModel.h" #import "QXSongListModel.h" +#import "QXUserSongListModel.h" NS_ASSUME_NONNULL_BEGIN -@class QXRoomInfoModel,QXRoomPitModel,QXRoomOwnerModel,QXHeadLineModel,QXRoomAuction,QXRoomAuctionUser,QXRoomCpUser,QXRoomPkInfo,QXRoomFriendInfo,QXRoomFriendHeartListModel,QXRoomActivitySubModel,QXRoomActivityModel; +@class QXRoomInfoModel,QXRoomPitModel,QXRoomOwnerModel,QXHeadLineModel,QXRoomAuction,QXRoomAuctionUser,QXRoomCpUser,QXRoomPkInfo,QXRoomFriendInfo,QXRoomFriendHeartListModel,QXRoomActivitySubModel,QXRoomActivityModel,QXSingerInfo,QXRoomSignInfo; @interface QXRoomModel : NSObject /// 房间信息 @property (nonatomic,strong)QXRoomInfoModel *room_info; @@ -20,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXRoomOwnerModel *user_info; /// 当前演唱者信息 @property (nonatomic,strong)QXSongListModel *song_user_info; +/// 点唱房演唱者信息 +@property (nonatomic,strong)QXSingerInfo *singer_info; /// 下一首歌曲信息 @property (nonatomic,strong)QXSongListModel *nextInfo; /// 拍卖房信息 @@ -30,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXRoomPkInfo *pk_info; /// 交友房信息 @property (nonatomic,strong)QXRoomFriendInfo *friend_info; +/// 签约房信息 +@property (nonatomic,strong)QXRoomSignInfo *sign_info; /// k歌麦位 @property (nonatomic,strong)NSArray< QXRoomPitModel*> *song_pit_list; /// 活动 @@ -115,6 +120,15 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *is_host; /// 是否是管理 1是管理员 0不是 @property (nonatomic,strong)NSString *is_management; +/// 麦圈 +@property (nonatomic,strong)NSString *mic_cycle; +/// 爵位图片 +@property (nonatomic,strong)NSString *nobility_image; +/// 用户昵称颜色 +@property (nonatomic,strong)NSString *nickname_color; + +@property (nonatomic,strong)NSString *is_online; + @property (nonatomic,assign)BOOL isSelected; @end @@ -154,6 +168,9 @@ NS_ASSUME_NONNULL_BEGIN /// 装扮 @property (nonatomic,strong)NSString *dress; +/// 麦圈 +@property (nonatomic,strong)NSString *mic_cycle; + @end @interface QXRoomOnlineList : NSObject @@ -268,6 +285,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *base_image; /// 礼物价值 @property (nonatomic,strong)NSString *gift_price; +/// 礼物名称 +@property (nonatomic,strong)NSString *nobility_image; +/// 礼物图标 +@property (nonatomic,strong)NSString *nickname_color; +/// 礼物价值 +@property (nonatomic,strong)NSString *mic_cycle; /// 关系拍卖时间 @property (nonatomic,strong)NSString *time_day; /// 头像装扮 @@ -359,4 +382,26 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *xlh_status; @property (nonatomic,assign)long end_time; @end + + +@interface QXSingerInfo : NSObject +/// 心动值 +@property (nonatomic,strong)QXUserSongListModel *song_info; +@property (nonatomic,strong)QXUserSongListModel *next_song_info; +@end + + +@interface QXRoomSignInfo :NSObject +/// 0 未开始 1进行中 +@property (nonatomic,strong)NSString *sign_status; +/// 签约天数 +@property (nonatomic,strong)NSString *sign_day; +/// 当前身价 +@property (nonatomic,strong)NSString *current_body_value; +/// 倒计时 时间戳 +@property (nonatomic,strong)NSString *end_time; +/// 签约场次id +@property (nonatomic,strong)NSString *sign_id; + +@end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/QXRoomModel.m b/QXLive/Mine(音域)/Model/QXRoomModel.m index c973c90..f944364 100644 --- a/QXLive/Mine(音域)/Model/QXRoomModel.m +++ b/QXLive/Mine(音域)/Model/QXRoomModel.m @@ -21,6 +21,8 @@ @"song_pit_list":@"QXRoomPitModel", @"friend_info":@"QXRoomFriendInfo", @"gift_cycle":@"QXRoomActivityModel", + @"singer_info":@"QXSingerInfo", + @"sign_info":@"QXRoomSignInfo", }; } @@ -143,4 +145,22 @@ @implementation QXRoomActivitySubModel +@end + + +@implementation QXSingerInfo ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"song_info" : @"QXUserSongListModel", + @"next_song_info" : @"QXUserSongListModel", + }; +} + +@end + + +@implementation QXRoomSignInfo + + + @end diff --git a/QXLive/Mine(音域)/Model/QXServiceModel.h b/QXLive/Mine(音域)/Model/QXServiceModel.h new file mode 100644 index 0000000..339d239 --- /dev/null +++ b/QXLive/Mine(音域)/Model/QXServiceModel.h @@ -0,0 +1,21 @@ +// +// QXServiceModel.h +// QXLive +// +// Created by 启星 on 2025/11/4. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXServiceModel : NSObject +/// 标题 +@property (nonatomic,strong)NSString *title; +/// 类型 +@property (nonatomic,assign)NSInteger type; + +@property (nonatomic,strong)NSString* icon; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/QXServiceModel.m b/QXLive/Mine(音域)/Model/QXServiceModel.m new file mode 100644 index 0000000..02ff9fd --- /dev/null +++ b/QXLive/Mine(音域)/Model/QXServiceModel.m @@ -0,0 +1,12 @@ +// +// QXServiceModel.m +// QXLive +// +// Created by 启星 on 2025/11/4. +// + +#import "QXServiceModel.h" + +@implementation QXServiceModel + +@end diff --git a/QXLive/Mine(音域)/Model/QXSongListModel.h b/QXLive/Mine(音域)/Model/QXSongListModel.h index a0bb079..735d762 100644 --- a/QXLive/Mine(音域)/Model/QXSongListModel.h +++ b/QXLive/Mine(音域)/Model/QXSongListModel.h @@ -36,6 +36,13 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, copy)NSString *dress; /// 用户魅力 @property(nonatomic, copy)NSString *charm; + +/// 歌曲名称 +@property(nonatomic, copy)NSString *nobility_image; +/// 演唱者 +@property(nonatomic, copy)NSString *mic_cycle; +/// 歌曲封面 +@property(nonatomic, copy)NSString *nickname_color; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/QXUserDressModel.h b/QXLive/Mine(音域)/Model/QXUserDressModel.h index 21b07b8..24b6ffc 100644 --- a/QXLive/Mine(音域)/Model/QXUserDressModel.h +++ b/QXLive/Mine(音域)/Model/QXUserDressModel.h @@ -32,6 +32,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *type; /// 剩余时间 (天) @property (nonatomic,strong)NSString *remaining_day; +/// 多少个 +@property (nonatomic,strong)NSString *num; +/// 降身卡 +@property (nonatomic,strong)NSString *ext_value; @end diff --git a/QXLive/Mine(音域)/Model/QXUserModel.h b/QXLive/Mine(音域)/Model/QXUserModel.h index d17b44c..22604ec 100644 --- a/QXLive/Mine(音域)/Model/QXUserModel.h +++ b/QXLive/Mine(音域)/Model/QXUserModel.h @@ -7,7 +7,7 @@ #import -@class QXRelationshipListModel; +@class QXRelationshipListModel,QXUserCpInfoModel,QXUserHeartBeatSpaceLogModel; NS_ASSUME_NONNULL_BEGIN @interface QXUserModel : NSObject @@ -39,12 +39,28 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *auth; /// 是否使用靓号 0未使用 1 已使用 @property (nonatomic,strong)NSString *is_use_code; -/// 在线状态 -@property (nonatomic,assign)BOOL is_online; +/// 爵位图片 +@property (nonatomic,strong)NSString *nobility_image; +/// 昵称颜色 +@property (nonatomic,strong)NSString *nickname_color; +/// 是否可以设置隐身进入的状态:0-不行,1-可以 +@property (nonatomic,strong)NSString *is_hide; +/// 当前状态:0-取消隐身,1-隐身进入 +@property (nonatomic,strong)NSString *hide_status; +/// 当前状态:-1 未认证歌手, 0待审核 1已认证 2被拒绝 +@property (nonatomic,strong)NSString *singer_status; +/// 在线状态 1 在线 2 离线 +@property (nonatomic,assign)NSInteger is_online; /// 1 能聊天 0不能聊天 @property (nonatomic,assign)NSInteger is_can_chat; /// 需要充值金额 @property (nonatomic,strong)NSString* can_chat_money; +/// 身价 +@property (nonatomic,strong)NSString* market_value; +/// 身价配置 多少金币数 +@property (nonatomic,strong)NSString* market_value_coin; +/// 身价配置 多少身价数 +@property (nonatomic,strong)NSString* market_value_market; @end @@ -68,6 +84,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *dress; /// 聊天气泡 @property (nonatomic,strong)NSString *chat_bubble; +/// 爵位飘屏背景图 +@property (nonatomic,strong)NSString *enter_image; +/// 爵位飘屏背景图 +@property (nonatomic,strong)NSString *enter_text; /// ip @property (nonatomic,strong)NSString *loginip; /// 昵称 @@ -82,13 +102,19 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *room_id; /// 各种等级 爵位 。。。图片数组 @property (nonatomic,strong)NSArray *icon; +/// 爵位图片 +@property (nonatomic,strong)NSString *nobility_image; +/// 昵称颜色 +@property (nonatomic,strong)NSString *nickname_color; +/// 麦圈 +@property (nonatomic,strong)NSString *mic_cycle; /// 是否关注 0 未关注 1 已关注 @property (nonatomic,assign)NSInteger is_follow; /// 魅力 @property (nonatomic,strong)NSString* charm; -/// 是否在线 +/// 是否在线 1在线 2离线 @property (nonatomic,assign)NSInteger is_online; /// 礼物墙数量 @@ -101,11 +127,15 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *total_price; /// 公会 -@property (nonatomic,strong)NSString *guild; +@property (nonatomic,strong)NSString *guild_name; /// 是否使用靓号 0未使用 1 已使用 @property (nonatomic,strong)NSString *is_use_code; +@property (nonatomic,strong)QXUserCpInfoModel *cp_info; + +@property (nonatomic,strong)QXUserHomeModel *master; + -(instancetype)copyModel; @end @@ -170,7 +200,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *gift_num; /// 公会 -@property (nonatomic,strong)NSString *guild; +@property (nonatomic,strong)NSString *guild_id; +@property (nonatomic,strong)NSString *guild_name; + +/// 公会 +@property (nonatomic,strong)NSString *me_guild_id; +@property (nonatomic,strong)NSString *me_guild_name; /// 是否已关注 0 未关注 1 已关注 @property (nonatomic,strong)NSString *is_follow; @@ -181,13 +216,21 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSArray *icon; /// 麦位 @property (nonatomic,strong)NSString *pit_number; +/// 爵位图片 +@property (nonatomic,strong)NSString *nobility_image; +/// 爵位图片 +@property (nonatomic,strong)NSString *nickname_color; /// 是否拥有转币权限 0 未开启 1 已开启 @property (nonatomic,strong)NSString *red_status; /// 角色 1-房主 > 2-管理员 > 3主持人 >4 普通用户 排序 @property (nonatomic,strong)NSString *role; -@property (nonatomic,strong)QXRelationshipListModel *qinmi; -@property (nonatomic,strong)QXRelationshipListModel *zhenai; +@property (nonatomic,strong)QXUserCpInfoModel *cp_info; + +@property (nonatomic,strong)QXUserHomeModel *master; + +//@property (nonatomic,strong)QXRelationshipListModel *qinmi; +//@property (nonatomic,strong)QXRelationshipListModel *zhenai; @end @@ -232,7 +275,43 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSString *image; /// 亲密拍心动值 @property (nonatomic,strong)NSString *heart_value; +@property (nonatomic,strong)NSString *sex2; +@property (nonatomic,strong)NSString *sex1; /// 1-置顶,0-不置顶 @property (nonatomic,strong)NSString *is_top; @end + +@interface QXUserCpInfoModel : NSObject +@property (nonatomic,strong)NSString *name; +@property (nonatomic,strong)NSString *user_id1; +@property (nonatomic,strong)NSString *user_id2; +@property (nonatomic,strong)NSString *level; +@property (nonatomic,strong)NSString *exp; +@property (nonatomic,strong)NSString *next_level_exp; +@property (nonatomic,strong)NSString *createtime; +/// 挂件(装扮)地址 +@property (nonatomic,strong)NSString *pendant; +/// 挂件上的头像位置:0-上,1-右上,2-右,3-右下,4-下,5-左下,6-左,7-左上' +@property (nonatomic,strong)NSString *direction; +@property (nonatomic,strong)QXUserModel *user_info1; +@property (nonatomic,strong)QXUserModel *user_info2; +@property (nonatomic,strong)NSArray< QXUserHeartBeatSpaceLogModel *>*gift_log; +@end + +@interface QXUserHeartBeatSpaceLogModel : NSObject +@property (nonatomic,strong)NSString *id; +@property (nonatomic,strong)NSString *room_id; +@property (nonatomic,strong)NSString *from_user_id; +@property (nonatomic,strong)NSString *to_user_id; +@property (nonatomic,strong)NSString *gift_id; +@property (nonatomic,strong)NSString *cp_zone_id; +@property (nonatomic,strong)NSString *exp; +@property (nonatomic,strong)NSString *exp_total; +@property (nonatomic,strong)NSString *createtime; +@property (nonatomic,strong)NSString *gift_name; +@property (nonatomic,strong)NSString *num; +@property (nonatomic,strong)NSString *remark; +@property (nonatomic,strong)QXUserModel *from_user_info; +@property (nonatomic,strong)QXUserModel *to_user_info; +@end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/QXUserModel.m b/QXLive/Mine(音域)/Model/QXUserModel.m index 8552c91..b64991e 100644 --- a/QXLive/Mine(音域)/Model/QXUserModel.m +++ b/QXLive/Mine(音域)/Model/QXUserModel.m @@ -16,7 +16,11 @@ +(NSDictionary *)modelContainerPropertyGenericClass{ - return @{@"tag_list" : @"QXUserTag"}; + return @{ + @"tag_list" : @"QXUserTag", + @"cp_info": @"QXUserCpInfoModel", + @"master": @"QXUserHomeModel", + }; } @@ -56,8 +60,10 @@ +(NSDictionary *)modelContainerPropertyGenericClass{ return @{ - @"qinmi" : @"QXRelationshipListModel", - @"zhenai" : @"QXRelationshipListModel" +// @"qinmi" : @"QXRelationshipListModel", +// @"zhenai" : @"QXRelationshipListModel" + @"cp_info": @"QXUserCpInfoModel", + @"master": @"QXUserHomeModel", }; } @@ -78,4 +84,33 @@ @implementation QXRelationshipListModel +@end + + +@implementation QXUserCpInfoModel + ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ +// @"qinmi" : @"QXRelationshipListModel", +// @"zhenai" : @"QXRelationshipListModel" + @"user_info1": @"QXUserModel", + @"user_info2": @"QXUserModel", + @"gift_log" : @"QXUserHeartBeatSpaceLogModel" + }; +} + +@end + +@implementation QXUserHeartBeatSpaceLogModel + ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ +// @"qinmi" : @"QXRelationshipListModel", +// @"zhenai" : @"QXRelationshipListModel" + @"from_user_info": @"QXUserModel", + @"to_user_info": @"QXUserModel", + }; +} + + @end diff --git a/QXLive/Mine(音域)/Model/爵位/QXNobilityGetPriceModel.h b/QXLive/Mine(音域)/Model/爵位/QXNobilityGetPriceModel.h new file mode 100644 index 0000000..ab8204d --- /dev/null +++ b/QXLive/Mine(音域)/Model/爵位/QXNobilityGetPriceModel.h @@ -0,0 +1,27 @@ +// +// QXNobilityGetPriceModel.h +// QXLive +// +// Created by 启星 on 2025/11/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXNobilityGetPricePowerList; +@interface QXNobilityGetPriceModel : NSObject +@property (nonatomic,strong)NSString *lid; +@property (nonatomic,strong)NSString *nobility_name; +@property (nonatomic,strong)NSString *nobility_image; +@property (nonatomic,strong)NSString *price; +@property (nonatomic,strong)NSString *pay_price; +@property (nonatomic,strong)NSString *day; +@property (nonatomic,strong)NSArray *power_list; +@end + +@interface QXNobilityGetPricePowerList : NSObject +@property (nonatomic,strong)NSString *id; +@property (nonatomic,strong)NSString *content; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/爵位/QXNobilityGetPriceModel.m b/QXLive/Mine(音域)/Model/爵位/QXNobilityGetPriceModel.m new file mode 100644 index 0000000..d9ab54c --- /dev/null +++ b/QXLive/Mine(音域)/Model/爵位/QXNobilityGetPriceModel.m @@ -0,0 +1,23 @@ +// +// QXNobilityGetPriceModel.m +// QXLive +// +// Created by 启星 on 2025/11/8. +// + +#import "QXNobilityGetPriceModel.h" + +@implementation QXNobilityGetPriceModel ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"power_list" : @"QXNobilityGetPricePowerList", + }; +} +@end + + +@implementation QXNobilityGetPricePowerList + + + +@end diff --git a/QXLive/Mine(音域)/Model/爵位/QXNobilityListModel.h b/QXLive/Mine(音域)/Model/爵位/QXNobilityListModel.h new file mode 100644 index 0000000..4292613 --- /dev/null +++ b/QXLive/Mine(音域)/Model/爵位/QXNobilityListModel.h @@ -0,0 +1,37 @@ +// +// QXNobilityListModel.h +// QXLive +// +// Created by 启星 on 2025/11/8. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class QXNobilityPower,QXNobilityPowerList; +@interface QXNobilityListModel : NSObject +@property (nonatomic,strong)NSString *name; +@property (nonatomic,strong)NSString *image; +@property (nonatomic,strong)NSString *pay_price; +@property (nonatomic,strong)NSString *lid; +@property (nonatomic,strong)NSString *day; +@property (nonatomic,strong)QXNobilityPower *power; +@end + + + +@interface QXNobilityPower : NSObject +@property (nonatomic,strong)NSString *power_count; +@property (nonatomic,strong)NSString *this_power_count; +@property (nonatomic,strong)NSString *count_str; +@property (nonatomic,strong)NSArray*list; +@end + + +@interface QXNobilityPowerList :NSObject +@property (nonatomic,strong)NSString *id; +@property (nonatomic,strong)NSString *name; +@property (nonatomic,strong)NSString *content; +@property (nonatomic,strong)NSString *image; +@end +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/爵位/QXNobilityListModel.m b/QXLive/Mine(音域)/Model/爵位/QXNobilityListModel.m new file mode 100644 index 0000000..7535d8e --- /dev/null +++ b/QXLive/Mine(音域)/Model/爵位/QXNobilityListModel.m @@ -0,0 +1,32 @@ +// +// QXNobilityListModel.m +// QXLive +// +// Created by 启星 on 2025/11/8. +// + +#import "QXNobilityListModel.h" + +@implementation QXNobilityListModel ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"power" : @"QXNobilityPower", + }; +} +@end + + +@implementation QXNobilityPower ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"list" : @"QXNobilityPowerList", + }; +} +@end + + +@implementation QXNobilityPowerList + + + +@end diff --git a/QXLive/Mine(音域)/Model/爵位/QXNobilityModel.h b/QXLive/Mine(音域)/Model/爵位/QXNobilityModel.h new file mode 100644 index 0000000..7a3fcfb --- /dev/null +++ b/QXLive/Mine(音域)/Model/爵位/QXNobilityModel.h @@ -0,0 +1,61 @@ +// +// QXNobilityModel.h +// QXLive +// +// Created by 启星 on 2025/11/7. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class QXUserNobility,QXNobilityLevel,QXNobilityInfo; +@interface QXNobilityModel : NSObject +/// 爵位信息 +@property (nonatomic,strong)QXUserModel *user_info; + +@property (nonatomic,strong)QXUserNobility *nobility_info; + +@property (nonatomic,strong)NSArray* nobility_power_list; +@end + + +@interface QXUserNobility : NSObject +///状态: 0去开通 1去续费 +@property (nonatomic,strong)NSString *status; +///权限ID +@property (nonatomic,strong)NSString *lid; +///爵位ID +@property (nonatomic,strong)NSString *id; +/// 爵位名称 +@property (nonatomic,strong)NSString *name; +///爵位图片 +@property (nonatomic,strong)NSString *image; +///结束时间 +@property (nonatomic,strong)NSString *end_time; +///显示类型 1状态 2文字 +@property (nonatomic,strong)NSString *type; +///昵称颜色名称 +@property (nonatomic,strong)NSString *nick_name_color_name; +///昵称颜色 +@property (nonatomic,strong)NSString *nick_name_color; +@end + +@interface QXNobilityLevel : NSObject +///爵位ID +@property (nonatomic,strong)NSString *lid; +///爵位名称 +@property (nonatomic,strong)NSString *name; +///权限ID +@property (nonatomic,strong)NSString *power_ids; +///昵称颜色 +@property (nonatomic,strong)NSString *nick_name_color; +///昵称颜色名称 +@property (nonatomic,strong)NSString *nick_name_color_name; +///爵位名称 +@property (nonatomic,strong)NSArray *nobility_list; + +@end + + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/Model/爵位/QXNobilityModel.m b/QXLive/Mine(音域)/Model/爵位/QXNobilityModel.m new file mode 100644 index 0000000..f66c1e3 --- /dev/null +++ b/QXLive/Mine(音域)/Model/爵位/QXNobilityModel.m @@ -0,0 +1,38 @@ +// +// QXNobilityModel.m +// QXLive +// +// Created by 启星 on 2025/11/7. +// + +#import "QXNobilityModel.h" + +@implementation QXNobilityModel + ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"user_info" : @"QXUserModel", + @"nobility_info" : @"QXUserNobility", + @"nobility_power_list": @"QXNobilityLevel", + }; +} + +@end + + +@implementation QXUserNobility + + + + +@end + + +@implementation QXNobilityLevel ++(NSDictionary *)modelContainerPropertyGenericClass{ + return @{ + @"nobility_list" : @"QXUserNobility", + }; +} + +@end diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.h b/QXLive/Mine(音域)/Services/QXMineNetwork.h index 291b4f6..56939d7 100644 --- a/QXLive/Mine(音域)/Services/QXMineNetwork.h +++ b/QXLive/Mine(音域)/Services/QXMineNetwork.h @@ -25,6 +25,12 @@ #import "QXRoomHourRankModel.h" #import "QXRedPacketModel.h" #import "QXEmojiTypeModel.h" +#import "QXNobilityModel.h" +#import "QXNobilityListModel.h" +#import "QXNobilityGetPriceModel.h" +#import "QXUserSongListModel.h" +#import "QXRoomBestFriendModel.h" +#import "QXFamilyModel.h" NS_ASSUME_NONNULL_BEGIN @@ -164,8 +170,9 @@ NS_ASSUME_NONNULL_BEGIN /** 账号注销 */ -+(void)cancelAccountSuccessBlock:(void (^)(NSDictionary* dict))successBlock - failBlock:(void (^)(NSError * error, NSString * msg))failBlock; ++(void)cancelAccountWithCode:(NSString*)cancelCode + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; /** 获得钱包余额 @@ -289,6 +296,7 @@ NS_ASSUME_NONNULL_BEGIN */ +(void)joinRoomWithRoomId:(NSString*)room_id successBlock:(void (^)(QXRoomModel* roomModel))successBlock + roomErrorBlock:(void (^)(NSString * roomId, NSString * msg))roomErrorBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @@ -350,7 +358,7 @@ NS_ASSUME_NONNULL_BEGIN */ +(void)roomOnlineListWithRoomId:(NSString*)room_id page:(NSInteger)page - successBlock:(void(^)(NSArray*onPitList,NSArray*offPitList))successBlock + successBlock:(void(^)(NSArray*onPitList,NSArray*offPitList,NSString*count))successBlock failBlock:(void(^)(NSError* error,NSString*msg))failBlock; @@ -846,6 +854,7 @@ NS_ASSUME_NONNULL_BEGIN type:(NSString*)type userId:(NSString*)userId typeId:(NSString*)typeId + nobility_id:(NSString*)nobility_id successBlock:(void (^)(NSDictionary* dict))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @@ -1155,6 +1164,244 @@ NS_ASSUME_NONNULL_BEGIN successBlock:(void (^)(NSArray * list))successBlock failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 获取爵位 + */ ++(void)getUserNobilitSuccessBlock:(void (^)(QXNobilityModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 获取爵位列表 + */ ++(void)getNobilityListSuccessBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 购买爵位 + */ ++(void)getNobilityPriceWithId:(NSString*)Id + successBlock:(void (^)(QXNobilityGetPriceModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 开启隐身 + */ ++(void)getNobilityPriceWithHideStatus:(NSString*)hide_status + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 歌手认证 + */ ++(void)singerAuthWithSong:(NSString*)song + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 用户歌单 + */ ++(void)getUserSongListWithRoomId:(NSString*)room_id + user_id:(NSString*)user_id + page:(NSInteger)page + SuccessBlock:(void (^)(NSArray* list,NSString*count))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 用户添加/修改/删除歌曲 + type 0 添加 1 修改 2 删除 + */ ++(void)mineUserAddAndDeleteAndEditWithType:(NSInteger)type + Id:(NSString*)Id + songName:(NSString*)songName + giftId:(NSString*)giftId + giftNum:(NSString*)giftNum + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 点歌 + */ ++(void)requestSongWithSongId:(NSString*)songId + roomId:(NSString*)roomId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 点歌列表 + */ ++(void)requestSongWithRoomId:(NSString*)roomId + type:(NSInteger)type + page:(NSInteger)page + successBlock:(void (^)(NSArray* list,NSString*count))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 歌曲置顶 + */ ++(void)requestSongToTopWithId:(NSString*)Id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 获取点歌房歌曲数量 + */ ++(void)requestSongCountWithRoomId:(NSString*)roomId + successBlock:(void (^)(QXUserSongListCount*model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 点唱房切歌 + */ ++(void)requsetSongNextActionWithId:(NSString*)Id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; +/** + cp礼物回赠 + */ ++(void)userCpReSendWithGiftId:(NSString *)giftId + userId:(NSString*)userId + roomId:(NSString*)roomId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; +/** + 获取挚友列表 + */ ++(void)userBestFriendsListWithUserId:(NSString*)userId + page:(NSInteger)page + successBlock:(void (^)(QXRoomBestFriendModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 更多挚友列表 + */ ++(void)userBestFriendsMoreListWithUserId:(NSString*)userId + relation_id:(NSString*)relation_id + successBlock:(void (^)(NSArray< QXRelationshipListModel*>* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 亲密空间 + */ ++(void)heartBeatUserInfoWithUserId:(NSString*)userId + page:(NSInteger)page + successBlock:(void (^)(QXUserCpInfoModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 我的家族|我加入的家族 + */ ++(void)getMyFamilyIsJoin:(BOOL)isJoin + successBlock:(void (^)(QXFamilyModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 家族收益详情 + */ ++(void)getFamilyEarningWithUserId:(NSString*)userId + page:(NSInteger)page + start_time:(NSString*)start_time + end_time:(NSString*)end_time + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 签约出价价格列表 + userId 当前在签约麦位的用户ID + + */ ++(void)signCoinListWithSignId:(NSString*)signId + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 签约出价 + userId 当前在签约麦位的用户ID + sign_value 出价价格 + sign_id 场次id + */ ++(void)signCoinWithSign_value:(NSString*)sign_value + sign_id:(NSString*)sign_id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 签约开始 + userId 当前在签约麦位的用户ID + + */ ++(void)signStartWithRoomId:(NSString*)roomId + userId:(NSString*)userId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 签约结束 + userId 当前在签约麦位的用户ID + signId 场次id + */ ++(void)signEndWithSignId:(NSString*)signId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 签约延时 + userId 当前在签约麦位的用户ID + signId 场次id + */ ++(void)signDelayWithSignId:(NSString*)signId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 才艺列表 + */ ++(void)signGeyPlayListSuccessBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 免费续约 + userId 当前在签约麦位的用户ID + */ ++(void)signFreeResignWithUserId:(NSString*)userId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 续签 + userId 当前在签约麦位的用户ID + */ ++(void)signCoinResignWithUserId:(NSString*)userId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + +/** + 申请加入公会 + */ + ++(void)joinGuildWithGuildId:(NSString*)guild_id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; + + +/** + 在线 + */ ++(void)appKeepAliveWithRoomId:(NSString*)room_id; + +/** + 签约房间主持邀请上签约麦用户拒绝 + */ ++(void)signRoomRefuseSignWithRoomId:(NSString*)roomId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock; @end diff --git a/QXLive/Mine(音域)/Services/QXMineNetwork.m b/QXLive/Mine(音域)/Services/QXMineNetwork.m index a76febc..3c84149 100644 --- a/QXLive/Mine(音域)/Services/QXMineNetwork.m +++ b/QXLive/Mine(音域)/Services/QXMineNetwork.m @@ -18,6 +18,11 @@ [QXGlobal shareGlobal].loginModel.dress = userModel.dress; [QXGlobal shareGlobal].loginModel.auth = userModel.auth.intValue; [QXGlobal shareGlobal].loginModel.chat_bubble = userModel.chat_bubble; + [QXGlobal shareGlobal].loginModel.nobility_image = userModel.nobility_image; + [QXGlobal shareGlobal].loginModel.nickname_color = userModel.nickname_color; + [QXGlobal shareGlobal].loginModel.is_hide = userModel.is_hide; + [QXGlobal shareGlobal].loginModel.hide_status = userModel.hide_status; + [QXGlobal shareGlobal].loginModel.singer_status = userModel.singer_status; [[QXGlobal shareGlobal] updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel]; BOOL api_version = [responseObject[@"api_version"] boolValue]; [QXGlobal shareGlobal].isAppStore = api_version; @@ -68,7 +73,7 @@ successBlock:(void (^)(QXUserHomeModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ - @"user_id":user_id, + @"user_id":user_id?:@"", }; [[QXRequset shareInstance] postWithUrl:QXGetUserInfo parameters:parameters needCache:NO success:^(id responseObject) { if (successBlock) { @@ -280,7 +285,7 @@ successBlock:(void (^)(NSArray * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ - @"user_id":user_id, + @"user_id":user_id?:@"", @"page":[NSNumber numberWithInteger:page] }; [[QXRequset shareInstance] postWithUrl:QXUserDynamic parameters:parameters needCache:NO success:^(id responseObject) { @@ -344,9 +349,10 @@ /** 账号注销 */ -+(void)cancelAccountSuccessBlock:(void (^)(NSDictionary* dict))successBlock - failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ - [[QXRequset shareInstance] getWithUrl:QXAccountCancel parameters:@{@"token":[QXGlobal shareGlobal].loginModel.token?[QXGlobal shareGlobal].loginModel.token:@""} needCache:NO success:^(id responseObject) { ++(void)cancelAccountWithCode:(NSString *)cancelCode + successBlock:(void (^)(NSDictionary * _Nonnull))successBlock + failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXAccountCancel parameters:@{@"token":[QXGlobal shareGlobal].loginModel.token?[QXGlobal shareGlobal].loginModel.token:@"",@"sms_code":cancelCode?:@""} needCache:NO success:^(id responseObject) { if (successBlock) { successBlock(responseObject[@"data"]); } @@ -583,15 +589,30 @@ }]; } -+(void)joinRoomWithRoomId:(NSString *)room_id successBlock:(void (^)(QXRoomModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ ++(void)joinRoomWithRoomId:(NSString *)room_id successBlock:(nonnull void (^)(QXRoomModel * _Nonnull))successBlock roomErrorBlock:(nonnull void (^)(NSString * _Nonnull, NSString * _Nonnull))roomErrorBlock failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ @"room_id":room_id }; [[QXRequset shareInstance] postWithUrl:QXJoinRoom parameters:parameters needCache:NO success:^(id responseObject) { - if (successBlock) { - QXRoomModel *model = [QXRoomModel yy_modelWithJSON:responseObject[@"data"]]; - successBlock(model); + int code = [responseObject[@"code"] intValue]; + if(code == 202){ + id object = responseObject[@"data"]; + NSString *roomId = @""; + NSString*content = @""; + if ([object isKindOfClass:[NSDictionary class]]) { + roomId = [NSString stringWithFormat:@"%@",object[@"room_id"]]; + content = [NSString stringWithFormat:@"%@",object[@"msg"]]; + } + if (roomErrorBlock) { + roomErrorBlock(roomId,content); + } + }else{ + if (successBlock) { + QXRoomModel *model = [QXRoomModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { failBlock(error,msg); }]; @@ -683,10 +704,30 @@ @"pit_number":pit_number?pit_number:@"", @"heart_id":heart_id?heart_id:@"" }; + __block NSString *userId = to_uid; [[QXRequset shareInstance] postWithUrl:QXSendGift parameters:parameters needCache:NO success:^(id responseObject) { if (successBlock) { successBlock(responseObject[@"data"]); } +// NSDictionary *cp_type = [NSDictionary stringWithFormat:@"%@",responseObject[@"data"][@"cp_type"]]; + id object = responseObject[@"data"][@"cp_type"]; + if ([object isKindOfClass:[NSDictionary class]]) { + NSDictionary *cpDict = (NSDictionary *)object; + NSString *cp_type = [NSString stringWithFormat:@"%@",cpDict[@"cp_type"]]; + if (cp_type.intValue == 1) { + /// 单向送cp礼物 + NSString *jsonStr = [cpDict jsonStringEncoded]; + [[QXRoomMessageManager shared] sendC2CMessage:jsonStr messageType:(QXRoomMessageTypeSendAndRecieveCpHeartSignal) userId:userId]; + }else if (cp_type.intValue == 2){ + /// cp礼物已达成双向绑定 + NSString *jsonStr = [cpDict jsonStringEncoded]; + [[QXRoomMessageManager shared] sendC2CMessage:jsonStr messageType:(QXRoomMessageTypeCpHeartFinished) userId:userId]; + [[QXRoomMessageManager shared] showCpFinishedAlertViewWithText:[NSString stringWithFormat:@"%@",cpDict[@"text"]]]; + }else{ + + } + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { failBlock(error,msg); }]; @@ -708,7 +749,7 @@ failBlock(error,msg); }]; } -+(void)roomOnlineListWithRoomId:(NSString *)room_id page:(NSInteger)page successBlock:(nonnull void (^)(NSArray * _Nonnull, NSArray * _Nonnull))successBlock failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ ++(void)roomOnlineListWithRoomId:(NSString *)room_id page:(NSInteger)page successBlock:(nonnull void (^)(NSArray * _Nonnull, NSArray * _Nonnull, NSString * _Nonnull))successBlock failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ @"room_id":room_id?room_id:@"", @"page":[NSNumber numberWithInteger:page] @@ -717,7 +758,8 @@ if (successBlock) { NSArray *onPitlist = [NSArray yy_modelArrayWithClass:[QXRoomUserInfoModel class] json:responseObject[@"data"][@"on_pit"]]; NSArray *offPitlist = [NSArray yy_modelArrayWithClass:[QXRoomUserInfoModel class] json:responseObject[@"data"][@"off_pit"]]; - successBlock(onPitlist,offPitlist); + NSString *count = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"count"]]; + successBlock(onPitlist,offPitlist,count); } } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { failBlock(error,msg); @@ -1630,13 +1672,20 @@ }]; } -+(void)rechargePayWithMoney:(NSString *)money coin:(NSString *)coin type:(NSString *)type userId:(NSString*)userId typeId:(NSString*)typeId successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ ++(void)rechargePayWithMoney:(NSString *)money + coin:(NSString *)coin + type:(NSString *)type + userId:(NSString*)userId + typeId:(NSString*)typeId + nobility_id:(NSString*)nobility_id + successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ NSDictionary *parameters =@{ @"coin":coin?coin:@"", @"money":money?money:@"", @"type":type?type:@"", @"user_id":userId?userId:@"", - @"type_id":typeId?typeId:@"" + @"type_id":typeId?typeId:@"", + @"nobility_id":nobility_id?:@"" }; [[QXRequset shareInstance] postWithUrl:QXRechargePay parameters:parameters needCache:NO success:^(id responseObject) { if (successBlock) { @@ -2250,4 +2299,531 @@ failBlock(error,msg); }]; } + + ++(void)getUserNobilitSuccessBlock:(void (^)(QXNobilityModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXGetUserNobility parameters:@{} needCache:NO success:^(id responseObject) { + if (successBlock) { + QXNobilityModel*model = [QXNobilityModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)getNobilityListSuccessBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXGetNobilityList parameters:@{} needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray *list = [NSArray yy_modelArrayWithClass:[QXNobilityListModel class] json:responseObject[@"data"]]; + successBlock(list); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)getNobilityPriceWithId:(NSString*)Id + successBlock:(void (^)(QXNobilityGetPriceModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + [[QXRequset shareInstance] getWithUrl:QXNobilityBuy parameters:@{@"id":Id?:@""} needCache:NO success:^(id responseObject) { + if (successBlock) { + QXNobilityGetPriceModel *model = [QXNobilityGetPriceModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + ++(void)getNobilityPriceWithHideStatus:(NSString *)hide_status successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"hide_status":hide_status?hide_status:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXNobilityHideJoinRoom parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)singerAuthWithSong:(NSString*)song + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"song":song?song:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXMineSingerAuth parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)getUserSongListWithRoomId:(NSString *)room_id + user_id:(NSString *)user_id + page:(NSInteger)page + SuccessBlock:(void (^)(NSArray* list,NSString*count))successBlock + failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"room_id":room_id?room_id:@"", + @"user_id":user_id?user_id:@"", + @"page":[NSNumber numberWithInteger:page] + }; + [[QXRequset shareInstance] postWithUrl:QXMineGetSingerSongList parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray*list = [NSArray yy_modelArrayWithClass:[QXUserSongListModel class] json:responseObject[@"data"][@"lists"]]; + NSString*count = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"count"]]; + successBlock(list,count); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)mineUserAddAndDeleteAndEditWithType:(NSInteger)type + Id:(NSString*)Id + songName:(NSString*)songName + giftId:(NSString*)giftId + giftNum:(NSString*)giftNum + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSString *url = QXMineSingerAddSong; + if (type == 0) { + url = QXMineSingerAddSong; + }else if(type == 1){ + url = QXMineSingerEidtSong; + }else{ + url = QXMineSingerDeleteSong; + } + + NSDictionary *parameters =@{ + @"id":Id?:@"", + @"song_name":songName?:@"", + @"gift_id":giftId?:@"", + @"gift_num":giftNum?:@"", + }; + [[QXRequset shareInstance] postWithUrl:url parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} +/** + 点歌 + */ ++(void)requestSongWithSongId:(NSString*)songId + roomId:(NSString*)roomId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"song_id":songId?:@"", + @"room_id":roomId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXRoomRequestSong parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + +/** + 点歌列表 + */ ++(void)requestSongWithRoomId:(NSString*)roomId + type:(NSInteger)type + page:(NSInteger)page + successBlock:(void (^)(NSArray* list,NSString*count))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"type":[NSNumber numberWithInteger:type], + @"room_id":roomId?:@"", + @"page":[NSNumber numberWithInteger:page] + }; + [[QXRequset shareInstance] postWithUrl:QXRoomAllSongList parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray*list = [NSArray yy_modelArrayWithClass:[QXUserSongListModel class] json:responseObject[@"data"][@"lists"]]; + NSString*count = [NSString stringWithFormat:@"%@",responseObject[@"data"][@"count"]]; + successBlock(list,count); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 歌曲置顶 + */ ++(void)requestSongToTopWithId:(NSString*)Id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"id":Id?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXRoomRequestSongTop parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)requestSongCountWithRoomId:(NSString*)roomId + successBlock:(void (^)(QXUserSongListCount*model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXRoomRequestSongCount parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + QXUserSongListCount *countModel = [QXUserSongListCount yy_modelWithJSON:responseObject[@"data"]]; + successBlock(countModel); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + ++(void)requsetSongNextActionWithId:(NSString *)Id successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"id":Id?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXRoomRequestSongNext parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + ++(void)userCpReSendWithGiftId:(NSString *)giftId userId:(NSString*)userId roomId:(NSString*)roomId successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"gift_id":giftId?:@"", + @"user_id":userId?:@"", + @"room_id":roomId?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXUserCpResend parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} ++(void)userBestFriendsListWithUserId:(NSString*)userId + page:(NSInteger)page + successBlock:(void (^)(QXRoomBestFriendModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + @"page":[NSNumber numberWithInteger:page] + }; + [[QXRequset shareInstance] postWithUrl:QXBestFriendsList parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + QXRoomBestFriendModel *model = [QXRoomBestFriendModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)userBestFriendsMoreListWithUserId:(NSString*)userId + relation_id:(NSString*)relation_id + successBlock:(void (^)(NSArray< QXRelationshipListModel*>* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + @"relation_id":relation_id?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXBestFriendsMoreList parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray *list = [NSArray yy_modelArrayWithClass:[QXRelationshipListModel class] json:responseObject[@"data"]]; + successBlock(list); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} +/** + 亲密空间 + */ ++(void)heartBeatUserInfoWithUserId:(NSString*)userId + page:(NSInteger)page + successBlock:(void (^)(QXUserCpInfoModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + @"page":[NSNumber numberWithInteger:page] + }; + [[QXRequset shareInstance] postWithUrl:QXHeartBeatSpace parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + QXUserCpInfoModel *model = [QXUserCpInfoModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} +/** + 我的家族|我加入的家族 + */ ++(void)getMyFamilyIsJoin:(BOOL)isJoin + successBlock:(void (^)(QXFamilyModel* model))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSString *urlString = isJoin?QXMyJoinFamily:QXMyFamily; + [[QXRequset shareInstance] getWithUrl:urlString parameters:@{} needCache:NO success:^(id responseObject) { + if (successBlock) { + QXFamilyModel *model = [QXFamilyModel yy_modelWithJSON:responseObject[@"data"]]; + successBlock(model); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + +/** + 家族收益详情 + */ ++(void)getFamilyEarningWithUserId:(NSString*)userId + page:(NSInteger)page + start_time:(NSString*)start_time + end_time:(NSString*)end_time + successBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + @"page":[NSNumber numberWithInteger:page] + }; + [[QXRequset shareInstance] postWithUrl:QXMyFamilyEarnings parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + NSArray *list = [NSArray yy_modelArrayWithClass:[QXFamilyEarningModel class] json:responseObject[@"data"]]; + successBlock(list); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 签约出价价格列表 + userId 当前在签约麦位的用户ID + + */ ++(void)signCoinListWithSignId:(NSString *)signId successBlock:(void (^)(NSArray * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{ + NSDictionary *parameters =@{ + @"sign_id":signId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXSignCoinList parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + id object = responseObject[@"data"]; + if ([object isKindOfClass:[NSArray class]]) { + successBlock(object); + }else{ + successBlock([NSArray array]); + } + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 签约出价 + userId 当前在签约麦位的用户ID + sign_value 出价价格 + sign_id 场次id + */ ++(void)signCoinWithSign_value:(NSString*)sign_value + sign_id:(NSString*)sign_id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"sign_value":sign_value?:@"", + @"sign_id":sign_id?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXSignSignCoin parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 签约开始 + userId 当前在签约麦位的用户ID + + */ ++(void)signStartWithRoomId:(NSString*)roomId + userId:(NSString*)userId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + @"user_id":userId?:@"" + }; + [[QXRequset shareInstance] postWithUrl:QXSignStartSign parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 签约结束 + userId 当前在签约麦位的用户ID + signId 场次id + */ ++(void)signEndWithSignId:(NSString*)signId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"sign_id":signId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXSignEndSign parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 签约延时 + userId 当前在签约麦位的用户ID + signId 场次id + */ ++(void)signDelayWithSignId:(NSString*)signId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"sign_id":signId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXSignDelaySign parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 才艺列表 + */ ++(void)signGeyPlayListSuccessBlock:(void (^)(NSArray* list))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + + [[QXRequset shareInstance] getWithUrl:QXSignPlayList parameters:@{} needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + +/** + 免费续约 + userId 当前在签约麦位的用户ID + */ ++(void)signFreeResignWithUserId:(NSString*)userId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXSignFreeResign parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + +/** + 续签 + userId 当前在签约麦位的用户ID + */ ++(void)signCoinResignWithUserId:(NSString*)userId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"user_id":userId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXSignCoinResign parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} +/** + 申请加入公会 + */ + ++(void)joinGuildWithGuildId:(NSString*)guild_id + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"guild_id":guild_id?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXApplyJoinGuild parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + ++(void)appKeepAliveWithRoomId:(NSString *)room_id{ + [[QXRequset shareInstance] getWithUrl:QXKeepAlive parameters:@{@"room_id":room_id?:@""} needCache:NO success:^(id responseObject) { + + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + + }]; +} + ++(void)signRoomRefuseSignWithRoomId:(NSString*)roomId + successBlock:(void (^)(NSDictionary* dict))successBlock + failBlock:(void (^)(NSError * error, NSString * msg))failBlock{ + NSDictionary *parameters =@{ + @"room_id":roomId?:@"", + }; + [[QXRequset shareInstance] postWithUrl:QXRefuseSign parameters:parameters needCache:NO success:^(id responseObject) { + if (successBlock) { + successBlock(responseObject[@"data"]); + } + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + failBlock(error,msg); + }]; +} + + @end diff --git a/QXLive/Mine(音域)/View/QXBodyPriceRuleView.h b/QXLive/Mine(音域)/View/QXBodyPriceRuleView.h new file mode 100644 index 0000000..5681f5e --- /dev/null +++ b/QXLive/Mine(音域)/View/QXBodyPriceRuleView.h @@ -0,0 +1,24 @@ +// +// QXBodyPriceRuleView.h +// QXLive +// +// Created by 启星 on 2025/11/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXBodyPriceRuleView : UIView +@property (weak, nonatomic) IBOutlet UILabel *currentPriceLabel; +@property (weak, nonatomic) IBOutlet UILabel *beyoundPriceLabel; +@property (weak, nonatomic) IBOutlet UILabel *recievePriceLabel; +@property (weak, nonatomic) IBOutlet UILabel *realPriceLabel; +@property (weak, nonatomic) IBOutlet UIButton *commitBtn; +@property (weak, nonatomic) IBOutlet UIButton *closeBtn; +@property (weak, nonatomic) IBOutlet UIView *bgView; +@property (weak, nonatomic) IBOutlet UILabel *bodyPriceLabel; ++(void)showInView:(UIView*)view currentBodyValue:(NSString*)currentBodyValue coin:(NSString*)coin bodyValue:(NSString*)bodyValue; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/View/QXBodyPriceRuleView.m b/QXLive/Mine(音域)/View/QXBodyPriceRuleView.m new file mode 100644 index 0000000..4823879 --- /dev/null +++ b/QXLive/Mine(音域)/View/QXBodyPriceRuleView.m @@ -0,0 +1,45 @@ +// +// QXBodyPriceRuleView.m +// QXLive +// +// Created by 启星 on 2025/11/25. +// + +#import "QXBodyPriceRuleView.h" + +@implementation QXBodyPriceRuleView + + ++(void)showInView:(UIView *)view currentBodyValue:(NSString *)currentBodyValue coin:(NSString *)coin bodyValue:(NSString *)bodyValue{ + UINib *nib = [UINib nibWithNibName:@"QXBodyPriceRuleView" bundle:[NSBundle mainBundle]]; + QXBodyPriceRuleView *ruleView = [nib instantiateWithOwner:nil options:nil].firstObject; + ruleView.frame = UIScreen.mainScreen.bounds; + ruleView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + ruleView.bgView.alpha = 0; + ruleView.currentPriceLabel.text = currentBodyValue; + ruleView.bodyPriceLabel.text = [NSString stringWithFormat:@"收礼身价,等于通过累计收礼的价值,每%@个金币等于%@身价",coin,bodyValue]; + [view addSubview:ruleView]; + [UIView animateWithDuration:0.2 animations:^{ + ruleView.bgView.alpha = 1; + }completion:^(BOOL finished) { + + }]; +} + + +- (IBAction)closeAction:(id)sender { + [UIView animateWithDuration:0.2 animations:^{ + self.bgView.alpha = 0; + }completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} + +- (IBAction)commitAction:(id)sender { + [UIView animateWithDuration:0.3 animations:^{ + self.bgView.alpha = 0; + }completion:^(BOOL finished) { + [self removeFromSuperview]; + }]; +} +@end diff --git a/QXLive/Mine(音域)/View/QXBodyPriceRuleView.xib b/QXLive/Mine(音域)/View/QXBodyPriceRuleView.xib new file mode 100644 index 0000000..ba8f605 --- /dev/null +++ b/QXLive/Mine(音域)/View/QXBodyPriceRuleView.xib @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QXLive/Mine(音域)/View/QXMainHeaderView.h b/QXLive/Mine(音域)/View/QXMainHeaderView.h index 0df04a4..657c114 100644 --- a/QXLive/Mine(音域)/View/QXMainHeaderView.h +++ b/QXLive/Mine(音域)/View/QXMainHeaderView.h @@ -11,21 +11,11 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger) { /// 个人主页 QXMainHeaderOptionTypeGotoHome = 0, - - /// 实名认证 - QXMainHeaderOptionTypeRealName = 1, - - /// 主播中心 - QXMainHeaderOptionTypeAnchorCenter = 2, - - /// 开启直播 - QXMainHeaderOptionTypeStartLive = 3, - /// 编辑 - QXMainHeaderOptionTypeGotoEdit = 4, + QXMainHeaderOptionTypeGotoEdit = 1, + /// 贵族 + QXMainHeaderOptionTypeNobility = 2, - /// 房间 - QXMainHeaderOptionTypeRoom = 5, /// 关注 QXMainHeaderOptionTypeFocus = 20, @@ -36,10 +26,27 @@ typedef NS_ENUM(NSInteger) { /// 访客 QXMainHeaderOptionTypeVisitor = 22, - /// 好友 - QXMainHeaderOptionTypeFriend = 23, + /// 充值 + QXMainHeaderOptionTypeRecharge = 30, + /// 商城 + QXMainHeaderOptionTypeShop = 31, + + /// 公会 + QXMainHeaderOptionTypeGuild = 32, + + /// 挚友 + QXMainHeaderOptionTypeFriend = 33, + + /// 房间 + QXMainHeaderOptionTypeRoom = 34, + /// 钱包 + QXMainHeaderOptionTypeWallet = 35, + /// 礼物墙 + QXMainHeaderOptionTypeGiftWall = 36, + /// 身价 + QXMainHeaderOptionTypeBodyPrice = 37, }QXMainHeaderOptionType; @protocol QXMainHeaderViewDelegate @@ -50,6 +57,11 @@ typedef NS_ENUM(NSInteger) { @interface QXMainHeaderView : UIView @property (nonatomic,weak)iddelegate; @property (nonatomic,strong)QXUserModel *userModel; +@property (nonatomic,strong)NSArray *bannerArray; +@property (nonatomic,strong)NSString *earnings; +@property (nonatomic,strong)NSString *coin; +-(void)reloadData; +-(CGFloat)getHeight; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/View/QXMainHeaderView.m b/QXLive/Mine(音域)/View/QXMainHeaderView.m index 7ef9aa9..bd8d650 100644 --- a/QXLive/Mine(音域)/View/QXMainHeaderView.m +++ b/QXLive/Mine(音域)/View/QXMainHeaderView.m @@ -8,27 +8,63 @@ #import "QXMainHeaderView.h" #import "QXSeatHeaderView.h" #import "CKShimmerLabel.h" +#import "QXMineHomeToolsCell.h" +#import "QXServiceModel.h" +#import "QXBanner.h" +#import +#import "QXUserHomePageViewController.h" -@interface QXMainHeaderView() +@interface QXMainHeaderView() @property (nonatomic, strong) QXSeatHeaderView *userHeaderView; @property (nonatomic, strong) UIImageView *sexImageView; //@property (nonatomic, strong) UILabel *nameLabel; @property (nonatomic, strong) CKShimmerLabel *nameLabel; @property (nonatomic, strong) UILabel *idLabel; @property (nonatomic, strong) UIButton *idCopyBtn; -@property (nonatomic, strong) UIView *userTagView; + +// 贵族 +@property (nonatomic, strong) UIView *nobilityBgView; +@property (nonatomic, strong) UIImageView *nobilityImageView; + + @property (nonatomic, strong) UIView *userHomeView; -@property (nonatomic, strong) UILabel *userHomeTitleLabel; -@property (nonatomic, strong) UIImageView *userHomeImageView; +@property (nonatomic, strong) UILabel *userNobilityTitleLabel; +@property (nonatomic, strong) UIImageView *userNobilityImageView; @property (nonatomic, strong) UIButton *userHomeBtn; @property (nonatomic, strong) UIImageView *useCodeImageView; -//@property (nonatomic, strong) UIButton *leftBtn; -//@property (nonatomic, strong) UIButton *rightBtn; +/// 顶部工具栏 +@property (nonatomic, strong) UIView *topBgView; +@property (nonatomic, strong) UICollectionView *collectionView; + @property (nonatomic, strong) UIButton *roomBtn; /// 标签是否已经创建过了 @property (nonatomic, strong) NSMutableArray *iconArray; + +/// 工具栏 +@property (nonatomic, strong) NSMutableArray *toolsArray; +@property (nonatomic, strong)QXServiceModel *rechargeModel; + +@property (nonatomic, strong)SDCycleScrollView *cycleScrollView; + + +@property (nonatomic, strong)UIView *walletBgView; +@property (nonatomic, strong)UILabel *walletTitleLabel; +@property (nonatomic, strong)UIImageView *walletBgImageView; +@property (nonatomic, strong)UILabel *walletBottomLabel; +@property (nonatomic, strong)UILabel *walletMoneyLabel; +@property (nonatomic, strong)UIButton *walletBtn; + +@property (nonatomic, strong)UIImageView *bodyPriceBgImageView; +@property (nonatomic, strong)UILabel *bodyPriceBottomLabel; +@property (nonatomic, strong)UILabel *bodyPriceMoneyLabel; +@property (nonatomic, strong)UIButton *bodyPriceBtn; + +@property (nonatomic, strong)UIImageView *giftWallBgImageView; +@property (nonatomic, strong)UILabel *giftWallTitleLabel; +@property (nonatomic, strong)UIButton *giftWallBtn; +@property (nonatomic, strong)NSMutableArray *bannerImages; @end @implementation QXMainHeaderView @@ -42,7 +78,7 @@ } -(void)initSubviews{ MJWeakSelf - self.userHeaderView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(16, 40, 68, 68)]; + self.userHeaderView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(16, 18, 76, 91)]; [self.userHeaderView addTapBlock:^(id _Nonnull obj) { if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickOptionType:)]) { [weakSelf.delegate didClickOptionType:QXMainHeaderOptionTypeGotoHome]; @@ -50,25 +86,29 @@ }]; [self addSubview:self.userHeaderView]; - self.sexImageView = [[UIImageView alloc] init]; - [self addSubview:self.sexImageView]; - [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.bottom.equalTo(self.userHeaderView); - make.height.width.mas_equalTo(16); - }]; + // self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.userHeaderView.top, self.width-self.userHeaderView.right-16-6, 23)]; - self.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.userHeaderView.top, self.width-self.userHeaderView.right-16-6, 23)]; + self.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.userHeaderView.top+5, self.width-self.userHeaderView.right-16-6, 22)]; self.nameLabel.shimmerWidth = 20; self.nameLabel.shimmerRadius = 20; - self.nameLabel.shimmerColor = [UIColor yellowColor]; + self.nameLabel.durationTime = 1; + self.nameLabel.text = @"羽声语音"; +// self.nameLabel.shimmerColor = [UIColor yellowColor]; self.nameLabel.repeat = YES; - self.nameLabel.textColor = QXConfig.textColor; + self.nameLabel.textColor = RGB16A(0xffffff,0.85); self.nameLabel.font = [UIFont boldSystemFontOfSize:18]; // [self.nameLabel startShimmer]; [self addSubview:self.nameLabel]; - self.idLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.nameLabel.bottom+5, 80, 17)]; + self.sexImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.nameLabel.bottom+4, 17, 17)]; + [self addSubview:self.sexImageView]; +// [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.right.bottom.equalTo(self.userHeaderView); +// make.height.width.mas_equalTo(16); +// }]; + + self.idLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.sexImageView.right+6, self.nameLabel.bottom+6, 80, 17)]; self.idLabel.textColor = RGB16(0x666666); self.idLabel.font = [UIFont systemFontOfSize:12]; self.idLabel.text = @"ID:"; @@ -86,7 +126,7 @@ [self addSubview:self.idCopyBtn]; - self.userHomeView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-60-16, 0, 60, 23)]; + self.userHomeView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-60-16, 0, 54, 23)]; self.userHomeView.layer.cornerRadius = self.userHomeView.height/2.0; self.userHomeView.layer.shadowColor = [UIColor grayColor].CGColor; self.userHomeView.layer.shadowOpacity = 0.3; @@ -98,20 +138,10 @@ self.userHomeView.backgroundColor = [UIColor whiteColor]; [self addSubview:self.userHomeView]; - self.userHomeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrowRight"]]; - self.userHomeImageView.frame = CGRectMake(self.userHomeView.width-10-16, (23-16)/2.0, 16, 16); - [self.userHomeView addSubview:self.userHomeImageView]; - - self.userHomeTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 20, 20)]; - self.userHomeTitleLabel.text = QXText(@"编辑"); - self.userHomeTitleLabel.font = [UIFont systemFontOfSize:12]; - self.userHomeTitleLabel.textColor = [UIColor colorWithHexString:@"#333333"]; - [self.userHomeTitleLabel sizeToFit]; - self.userHomeTitleLabel.x = 10; - self.userHomeTitleLabel.y =( self.userHomeView.height - self.userHomeTitleLabel.height)/2.0; - [self.userHomeView addSubview:self.userHomeTitleLabel]; + self.userHomeBtn = [[UIButton alloc] initWithFrame:self.userHomeView.bounds]; + [self.userHomeBtn setBackgroundImage:[UIImage imageNamed:@"mine_edit_btn"] forState:(UIControlStateNormal)]; [self.userHomeBtn addTarget:self action:@selector(gotoUserHomePageClick) forControlEvents:(UIControlEventTouchUpInside)]; [self.userHomeView addSubview:self.userHomeBtn]; @@ -122,73 +152,255 @@ NSArray* nameArr = @[ QXText(@"关注"), QXText(@"粉丝"),QXText(@"访客") ]; - CGFloat width = (SCREEN_WIDTH-32)/4; + CGFloat width = (SCREEN_WIDTH-60)/3; for (int i = 0; i < nameArr.count; i ++) { - UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16+width*i, self.userHeaderView.bottom+19, width, 22)]; - titleLabel.textColor = RGB16(0x666666); + UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(30+width*i, self.userHeaderView.bottom+10, width, 25)]; + countLabel.textAlignment = NSTextAlignmentCenter; + countLabel.textColor = RGB16(0xCCCDC8); + countLabel.tag = 10 + i; + countLabel.font = [UIFont fontWithName:@"DIN Condensed" size:22]; + countLabel.text = @"0"; + [self addSubview:countLabel]; + + UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(countLabel.left, countLabel.bottom+5, width, 18)]; + titleLabel.textColor = RGB16(0XCCCDC8); titleLabel.font = [UIFont systemFontOfSize:12]; titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.text = nameArr[i]; - [titleLabel sizeToFit]; - titleLabel.x = 16+width*i; - titleLabel.y = self.userHeaderView.bottom+16; - titleLabel.height = 22; [self addSubview:titleLabel]; - UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(titleLabel.right+5, titleLabel.top, width-10-titleLabel.width, 22)]; - countLabel.textAlignment = NSTextAlignmentCenter; - countLabel.textColor = QXConfig.textColor; - countLabel.tag = 10 + i; - countLabel.font = [UIFont boldSystemFontOfSize:16]; - countLabel.text = @"0"; - countLabel.centerY = titleLabel.centerY; - [self addSubview:countLabel]; - UIControl *c = [[UIControl alloc] initWithFrame:CGRectMake(titleLabel.left, titleLabel.top-10, width, titleLabel.height+20)]; + + UIControl *c = [[UIControl alloc] initWithFrame:CGRectMake(countLabel.left, countLabel.top, width, countLabel.height+titleLabel.height+5)]; c.tag = 20 + i; [c addTarget:self action:@selector(viewClick:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:c]; } -// self.leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(16, self.userHeaderView.bottom+54, width*2-7.5, 67)]; -// [self.leftBtn setBackgroundImage:[UIImage imageNamed:@"start_live"] forState:(UIControlStateNormal)]; -// [self.leftBtn addTarget:self action:@selector(leftAction) forControlEvents:(UIControlEventTouchUpInside)]; -// [self addSubview:self.leftBtn]; -// -// self.rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.leftBtn.right+7.5, self.userHeaderView.bottom+54, self.leftBtn.width, 67)]; -// [self.rightBtn setBackgroundImage:[UIImage imageNamed:@"become_anchor"] forState:(UIControlStateNormal)]; -// [self.rightBtn addTarget:self action:@selector(rightAction) forControlEvents:(UIControlEventTouchUpInside)]; -// [self addSubview:self.rightBtn]; - self.roomBtn = [[UIButton alloc] initWithFrame:CGRectMake(16, self.userHeaderView.bottom+54, self.width-32, ScaleWidth(67))]; - [self.roomBtn setBackgroundImage:[UIImage imageNamed:@"mine_header_room"] forState:(UIControlStateNormal)]; - [self.roomBtn addTarget:self action:@selector(roomAction) forControlEvents:(UIControlEventTouchUpInside)]; - [self addSubview:self.roomBtn]; + self.nobilityBgView = [[UIView alloc] initWithFrame:CGRectMake(30, self.userHeaderView.bottom+80, SCREEN_WIDTH-60, ScaleWidth(40))]; + [self.nobilityBgView addTapBlock:^(id _Nonnull obj) { + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickOptionType:)]) { + [weakSelf.delegate didClickOptionType:QXMainHeaderOptionTypeNobility]; + } + }]; + self.nobilityBgView.hidden = YES; + [self addSubview:self.nobilityBgView]; + + self.nobilityImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_nobility_bg"]]; + self.nobilityImageView.frame = self.nobilityBgView.bounds; + self.nobilityImageView.contentMode = UIViewContentModeScaleToFill; + [self.nobilityBgView addSubview:self.nobilityImageView]; + + self.userNobilityImageView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"arrowRight"] imageByTintColor:RGB16(0xEECE72)]]; + self.userNobilityImageView.frame = CGRectMake(self.nobilityImageView.width-10-16, (self.nobilityBgView.height-16)/2.0, 16, 16); + [self.nobilityBgView addSubview:self.userNobilityImageView]; + + self.userNobilityTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userNobilityImageView.left-32, (self.nobilityBgView.height-20)/2, 32, 20)]; + self.userNobilityTitleLabel.text = QXText(@"更多"); + self.userNobilityTitleLabel.font = [UIFont systemFontOfSize:14]; + self.userNobilityTitleLabel.textColor = [UIColor colorWithHexString:@"#EECE72"]; + [self.nobilityBgView addSubview:self.userNobilityTitleLabel]; + + + self.topBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.nobilityBgView.bottom, SCREEN_WIDTH-32, 90)]; + [self.topBgView addRoundedCornersWithRadius:8]; + self.topBgView.backgroundColor = RGB16A(0xffffff, 0.06); + [self addSubview:self.topBgView]; + + NSInteger maxCount = 5; + CGFloat btnWith = (int)(SCREEN_WIDTH-32-1)/maxCount; + CGFloat btnHeight = self.topBgView.height; + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(btnWith, btnHeight); + layout.minimumLineSpacing = 0; + layout.minimumInteritemSpacing = 0; + layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0); + layout.scrollDirection = UICollectionViewScrollDirectionVertical; + self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + [self.collectionView registerNib:[UINib nibWithNibName:@"QXMineHomeToolsCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXMineHomeToolsCell"]; + self.collectionView.delegate = self; + self.collectionView.dataSource = self; + self.collectionView.showsHorizontalScrollIndicator = NO; + self.collectionView.bounces = NO; + self.collectionView.backgroundColor = UIColor.clearColor; + [self.topBgView addSubview:self.collectionView]; + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.top.bottom.right.equalTo(self.topBgView); + }]; + + self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(self.topBgView.left, self.topBgView.bottom+12, self.topBgView.width, 64) delegate:self placeholderImage:nil]; + self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill; + self.cycleScrollView.backgroundColor = UIColor.clearColor; + [self.cycleScrollView addRoundedCornersWithRadius:8]; + [self addSubview:self.cycleScrollView]; + + + self.walletBgView = [[UIView alloc] initWithFrame:CGRectMake(self.topBgView.left, self.cycleScrollView.bottom+12, self.topBgView.width, 108)]; + self.walletBgView.backgroundColor = RGB16(0x231F2C); + [self.walletBgView addRoundedCornersWithRadius:8]; + [self addSubview:self.walletBgView]; + + self.walletTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 12, 200, 16)]; + self.walletTitleLabel.text = @"我的钱包"; + self.walletTitleLabel.font = [UIFont systemFontOfSize:14]; + self.walletTitleLabel.textColor = RGB16(0x929196); + [self.walletBgView addSubview:self.walletTitleLabel]; + + CGFloat walletWidth = (self.topBgView.width - 16*4) / 3; + self.walletBgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.topBgView.left, self.walletTitleLabel.bottom+8, walletWidth, 60)]; + self.walletBgImageView.backgroundColor = RGB16(0xFFE38E); + [self.walletBgImageView addRoundedCornersWithRadius:8]; + [self.walletBgView addSubview:self.walletBgImageView]; + + self.walletBottomLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.walletBgImageView.left, self.walletBgImageView.bottom-14-11, walletWidth, 14)]; + self.walletBottomLabel.text = @"钱包"; + self.walletBottomLabel.textAlignment = NSTextAlignmentCenter; + self.walletBottomLabel.font = [UIFont systemFontOfSize:12]; + self.walletBottomLabel.textColor = RGB16(0x333333); + [self.walletBgView addSubview:self.walletBottomLabel]; + + + self.walletMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.walletBgImageView.left, self.walletBgImageView.top+11, walletWidth, 27)]; + self.walletMoneyLabel.text = @"0"; + self.walletMoneyLabel.textAlignment = NSTextAlignmentCenter; + self.walletMoneyLabel.font = [UIFont fontWithName:@"DIN Condensed" size:25]; + self.walletMoneyLabel.textColor = RGB16(0x222222); + [self.walletBgView addSubview:self.walletMoneyLabel]; + + self.bodyPriceBgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.walletBgImageView.right+16, self.walletBgImageView.top, walletWidth, self.walletBgImageView.height)]; + self.bodyPriceBgImageView.backgroundColor = RGB16(0xFFB68F); + [self.bodyPriceBgImageView addRoundedCornersWithRadius:8]; + [self.walletBgView addSubview:self.bodyPriceBgImageView]; + + self.bodyPriceBottomLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.bodyPriceBgImageView.left, self.bodyPriceBgImageView.bottom-14-11, walletWidth, 14)]; + self.bodyPriceBottomLabel.text = @"身价"; + self.bodyPriceBottomLabel.textAlignment = NSTextAlignmentCenter; + self.bodyPriceBottomLabel.font = [UIFont systemFontOfSize:12]; + self.bodyPriceBottomLabel.textColor = RGB16(0x333333); + [self.walletBgView addSubview:self.bodyPriceBottomLabel]; + + + self.bodyPriceMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.bodyPriceBgImageView.left, self.walletBgImageView.top+11, walletWidth, 27)]; + self.bodyPriceMoneyLabel.text = @"1"; + self.bodyPriceMoneyLabel.textAlignment = NSTextAlignmentCenter; + self.bodyPriceMoneyLabel.font = [UIFont fontWithName:@"DIN Condensed" size:25]; + self.bodyPriceMoneyLabel.textColor = RGB16(0x222222); + [self.walletBgView addSubview:self.bodyPriceMoneyLabel]; + + + self.giftWallBgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.bodyPriceBgImageView.right+16, self.walletBgImageView.top, walletWidth, self.walletBgImageView.height)]; + self.giftWallBgImageView.backgroundColor = RGB16(0xF1B3FF); + [self.giftWallBgImageView addRoundedCornersWithRadius:8]; + [self.walletBgView addSubview:self.giftWallBgImageView]; + + self.giftWallTitleLabel = [[UILabel alloc] initWithFrame:self.giftWallBgImageView.frame]; + self.giftWallTitleLabel.text = @"礼物墙"; + self.giftWallTitleLabel.textAlignment = NSTextAlignmentCenter; + self.giftWallTitleLabel.font = [UIFont fontWithName:@"DIN Condensed" size:20]; + self.giftWallTitleLabel.textColor = RGB16(0x222222); + [self.walletBgView addSubview:self.giftWallTitleLabel]; + + self.walletBtn = [[UIButton alloc] initWithFrame:self.walletBgImageView.frame]; + [self.walletBtn addTarget:self action:@selector(walletAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.walletBgView addSubview:self.walletBtn]; + + self.giftWallBtn = [[UIButton alloc] initWithFrame:self.giftWallBgImageView.frame]; + [self.giftWallBtn addTarget:self action:@selector(giftWalltAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.walletBgView addSubview:self.giftWallBtn]; + + self.bodyPriceBtn = [[UIButton alloc] initWithFrame:self.bodyPriceBgImageView.frame]; + [self.bodyPriceBtn addTarget:self action:@selector(bodyPriceAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.walletBgView addSubview:self.bodyPriceBtn]; +} +-(CGFloat)getHeight{ + return self.walletBgView.bottom+6; +} +-(void)setCoin:(NSString *)coin{ + _coin = coin; + self.walletMoneyLabel.text = [NSString stringWithFormat:@"%.2f",coin.doubleValue]; +} +-(void)setBannerArray:(NSArray *)bannerArray{ + _bannerArray = bannerArray; + [self.bannerImages removeAllObjects]; + for (QXBanner *banner in bannerArray) { + [self.bannerImages addObject:banner.image]; + } + self.cycleScrollView.imageURLStringsGroup = self.bannerImages; +} +-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{ + if (!QXGlobal.shareGlobal.isLogin) { + [[QXGlobal shareGlobal] logOut]; + return; + } + QXBanner *banner = self.bannerArray[index]; + if ([banner.type isEqualToString:@"2"]) { + QXBaseWebViewController *webVc = [[QXBaseWebViewController alloc] init]; + webVc.urlStr = banner.url; + [self.navigationController pushViewController:webVc animated:YES]; + }else if ([banner.type isEqualToString:@"3"]){ + [[QXGlobal shareGlobal] joinRoomWithRoomId:banner.aid isRejoin:NO navagationController:self.navigationController]; + }else if ([banner.type isEqualToString:@"4"]){ + QXUserHomePageViewController *userHomePage = [[QXUserHomePageViewController alloc] init]; + userHomePage.user_id = banner.aid; + [self.viewController.navigationController pushViewController:userHomePage animated:YES]; + } +} + +-(void)reloadData{ + if (QXGlobal.shareGlobal.isOpenRecharge) { + self.nobilityBgView.hidden = NO; + if ([self.toolsArray containsObject:self.rechargeModel]) { + return; + } + [self.toolsArray insertObject:self.rechargeModel atIndex:0]; + [self.collectionView reloadData]; + }else{ + self.nobilityBgView.hidden = YES; + } } +-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ + return self.toolsArray.count; +} +-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ + QXMineHomeToolsCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMineHomeToolsCell" forIndexPath:indexPath]; + cell.model = self.toolsArray[indexPath.row]; + return cell; +} + +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { + QXServiceModel *model = self.toolsArray[indexPath.row]; + [self.delegate didClickOptionType:model.type]; + } +} + -(void)viewClick:(UIControl*)sender{ if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { [self.delegate didClickOptionType:sender.tag]; } } --(void)roomAction{ + +-(void)walletAction{ if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { - [self.delegate didClickOptionType:QXMainHeaderOptionTypeRoom]; + [self.delegate didClickOptionType:QXMainHeaderOptionTypeWallet]; + } +} +-(void)giftWalltAction{ + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { + [self.delegate didClickOptionType:QXMainHeaderOptionTypeGiftWall]; } } --(void)leftAction{ +-(void)bodyPriceAction{ if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { - [self.delegate didClickOptionType:QXMainHeaderOptionTypeStartLive]; + [self.delegate didClickOptionType:QXMainHeaderOptionTypeBodyPrice]; } } --(void)rightAction{ - if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { - [self.delegate didClickOptionType:QXMainHeaderOptionTypeRealName]; - } -} + -(void)gotoUserHomePageClick{ if (self.delegate && [self.delegate respondsToSelector:@selector(didClickOptionType:)]) { [self.delegate didClickOptionType:QXMainHeaderOptionTypeGotoEdit]; @@ -196,9 +408,19 @@ } -(void)setUserModel:(QXUserModel *)userModel{ _userModel = userModel; + self.nameLabel.text = userModel.market_value; [self.userHeaderView setHeadIcon:userModel.avatar dress:userModel.dress]; + [self.userHeaderView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:userModel.nobility_image]]; + if ([userModel.nickname_color isExist]) { + self.nameLabel.shimmerColor = [UIColor colorWithHexString:userModel.nickname_color]; + [self.nameLabel startShimmer]; + }else{ + self.nameLabel.shimmerColor = [UIColor clearColor]; + [self.nameLabel stopShimmer]; + } self.nameLabel.text = userModel.nickname; self.idLabel.text = [NSString stringWithFormat:@"ID:%@",userModel.user_code]; + self.bodyPriceMoneyLabel.text = userModel.market_value; UILabel *followLabel = [self viewWithTag:10]; UILabel *fansLabel = [self viewWithTag:11]; UILabel *lookLabel = [self viewWithTag:12]; @@ -210,7 +432,7 @@ } for (int i = 0;i +#import "QXServiceModel.h" +NS_ASSUME_NONNULL_BEGIN + +@interface QXMineHomeToolsCell : UICollectionViewCell +@property (weak, nonatomic) IBOutlet UIImageView *imageView; +@property (weak, nonatomic) IBOutlet UILabel *titleLabel; +@property (nonatomic,strong)QXServiceModel *model; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Mine(音域)/View/QXMineHomeToolsCell.m b/QXLive/Mine(音域)/View/QXMineHomeToolsCell.m new file mode 100644 index 0000000..7a6614e --- /dev/null +++ b/QXLive/Mine(音域)/View/QXMineHomeToolsCell.m @@ -0,0 +1,22 @@ +// +// QXMineHomeToolsCell.m +// QXLive +// +// Created by 启星 on 2025/11/4. +// + +#import "QXMineHomeToolsCell.h" + +@implementation QXMineHomeToolsCell +-(void)setModel:(QXServiceModel *)model{ + _model = model; + self.titleLabel.text = model.title; + self.imageView.image = [UIImage imageNamed:model.icon]; +} +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code + self.backgroundColor = UIColor.clearColor; +} + +@end diff --git a/QXLive/Mine(音域)/View/QXMineHomeToolsCell.xib b/QXLive/Mine(音域)/View/QXMineHomeToolsCell.xib new file mode 100644 index 0000000..2af2824 --- /dev/null +++ b/QXLive/Mine(音域)/View/QXMineHomeToolsCell.xib @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QXLive/Mine(音域)/View/QXMineServiceCell.h b/QXLive/Mine(音域)/View/QXMineServiceCell.h index be53940..79e73b6 100644 --- a/QXLive/Mine(音域)/View/QXMineServiceCell.h +++ b/QXLive/Mine(音域)/View/QXMineServiceCell.h @@ -6,17 +6,44 @@ // #import - +#import "QXServiceModel.h" NS_ASSUME_NONNULL_BEGIN +typedef NS_ENUM(NSInteger) { + /// 等级 + QXMineServiceTypeLevel = 40, + /// 个性装扮 + QXMineServiceTypeDress = 41, + /// 我的背包 + QXMineServiceTypeBackpack = 42, + /// 设置 + QXMineServiceTypeSetting = 43, + /// 家族 + QXMineServiceTypeFamily = 80, + /// 帮助中心 + QXMineServiceTypeHelp = 44, + /// 邀请 + QXMineServiceTypeInvite = 45, + /// 每日任务 + QXMineServiceTypeDayTask = 46, + /// 意见反馈 + QXMineServiceTypeReport = 47, + /// 个税客服 + QXMineServiceTypeCustomerService = 48, + /// 歌手认证 + QXMineServiceTypeSingerAuth = 49, + /// 我的歌单 + QXMineServiceTypeSongList = 50, +}QXMineServiceType; @protocol QXMineServiceCellDelegate @optional --(void)didClickServiceWithBtn:(UIButton*)button title:(NSString*)title; +-(void)didClickServiceWithType:(QXMineServiceType)type; @end @interface QXMineServiceCell : UITableViewCell @property (nonatomic,weak)iddelegate; --(void)cellReload; +@property (nonatomic,assign)BOOL isMore; +@property (nonatomic,assign)BOOL singerIsAuth; +(instancetype)cellWithTableView:(UITableView *)tableView; @end @@ -24,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)UIImageView *imageView; @property (nonatomic,strong)UILabel *titleLabel; - +@property (nonatomic,strong)QXServiceModel *model; @end diff --git a/QXLive/Mine(音域)/View/QXMineServiceCell.m b/QXLive/Mine(音域)/View/QXMineServiceCell.m index dc99230..43a42cd 100644 --- a/QXLive/Mine(音域)/View/QXMineServiceCell.m +++ b/QXLive/Mine(音域)/View/QXMineServiceCell.m @@ -6,13 +6,17 @@ // #import "QXMineServiceCell.h" + @class QXMineServiceSubCell; @interface QXMineServiceCell() @property (nonatomic,strong)UIView *bgView; @property (nonatomic,strong)UILabel *titleLabel; @property (nonatomic,strong)UICollectionView *collectionView; @property (nonatomic,strong)NSMutableArray *serviceArray; -@property (nonatomic,strong)NSMutableArray *serviceImageArray; +@property (nonatomic,strong)NSMutableArray *moreArray; +@property (nonatomic,strong)QXServiceModel *inviteModel; +@property (nonatomic,strong)QXServiceModel *singerAuthModel; +@property (nonatomic,strong)QXServiceModel *songListModel; @end @implementation QXMineServiceCell @@ -34,24 +38,25 @@ } -(void)createViews{ self.bgView = [[UIView alloc] init]; - self.bgView.backgroundColor = [UIColor whiteColor]; + self.bgView.backgroundColor = RGB16(0x231F2C); [self.bgView addRoundedCornersWithRadius:10]; [self.contentView addSubview:self.bgView]; [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16); make.right.mas_equalTo(-16); - make.top.bottom.equalTo(self); + make.top.mas_equalTo(6); + make.bottom.mas_equalTo(-6); }]; self.titleLabel = [[UILabel alloc] init]; - self.titleLabel.font = [UIFont boldSystemFontOfSize:16]; - self.titleLabel.textColor = QXConfig.textColor; + self.titleLabel.font = [UIFont boldSystemFontOfSize:14]; + self.titleLabel.textColor = RGB16(0x929196); self.titleLabel.text = QXText(@"更多服务"); [self.bgView addSubview:self.titleLabel];; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.left.mas_equalTo(12); make.right.mas_equalTo(-12); - make.height.mas_equalTo(24); + make.height.mas_equalTo(16); }]; @@ -69,14 +74,13 @@ self.collectionView.delegate = self; self.collectionView.dataSource = self; self.collectionView.showsHorizontalScrollIndicator = NO; - self.collectionView.bounces = NO; + self.collectionView.scrollEnabled = NO; self.collectionView.backgroundColor = UIColor.clearColor; [self.bgView addSubview:self.collectionView]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.bgView); - make.top.equalTo(self.titleLabel.mas_bottom).offset(22); - make.height.mas_equalTo(btnHeight*2+10); -// make.right.mas_equalTo(-12); + make.top.equalTo(self.titleLabel.mas_bottom).offset(12); + make.bottom.mas_equalTo(-12); }]; @@ -101,23 +105,59 @@ // // } } --(void)serviceClick:(UIButton*)sender{ - if (self.delegate && [self.delegate respondsToSelector:@selector(didClickServiceWithBtn:title:)]) { - [self.delegate didClickServiceWithBtn:sender title:sender.titleLabel.text]; + +-(void)setIsMore:(BOOL)isMore{ + _isMore = isMore; + self.titleLabel.text = isMore?@"更多":@"常用服务"; + if (isMore) { + if ([self.moreArray containsObject:self.inviteModel]) { + + }else{ + if (QXGlobal.shareGlobal.isOpenRecharge) { + [self.moreArray insertObject:self.inviteModel atIndex:1]; + } + } + if (self.singerIsAuth) { + if ([self.moreArray containsObject:self.singerAuthModel]) { + [self.moreArray removeObject:self.singerAuthModel]; + } + if ([self.moreArray containsObject:self.songListModel]) { + + }else{ + NSInteger index = self.moreArray.count-1; + [self.moreArray insertObject:self.songListModel atIndex:index]; + } + }else{ + if ([self.moreArray containsObject:self.songListModel]) { + [self.moreArray removeObject:self.songListModel]; + } + if ([self.moreArray containsObject:self.singerAuthModel]) { + + }else{ + NSInteger index = self.moreArray.count-1; + [self.moreArray insertObject:self.singerAuthModel atIndex:index]; + } + } } + [self.collectionView reloadData]; +} +-(void)setSingerIsAuth:(BOOL)singerIsAuth{ + _singerIsAuth = singerIsAuth; + } -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ - return self.serviceArray.count; + return self.isMore?self.moreArray.count:self.serviceArray.count; } -(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ QXMineServiceSubCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXMineServiceSubCell" forIndexPath:indexPath]; - cell.imageView.image = [UIImage imageNamed:self.serviceImageArray[indexPath.row]]; - cell.titleLabel.text = self.serviceArray[indexPath.row]; + QXServiceModel *model = self.isMore?self.moreArray[indexPath.row]:self.serviceArray[indexPath.row]; + cell.model = model; return cell; } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ - if (self.delegate && [self.delegate respondsToSelector:@selector(didClickServiceWithBtn:title:)]) { - [self.delegate didClickServiceWithBtn:nil title:self.serviceArray[indexPath.row]]; + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickServiceWithType:)]) { + QXServiceModel *model = self.isMore?self.moreArray[indexPath.row]:self.serviceArray[indexPath.row]; + [self.delegate didClickServiceWithType:model.type]; } } @@ -133,32 +173,113 @@ } -(NSMutableArray *)serviceArray{ if (!_serviceArray) { + QXServiceModel *md1 = [[QXServiceModel alloc] init]; + md1.title = @"等级"; + md1.icon = @"service_level"; + md1.type = QXMineServiceTypeLevel; + + QXServiceModel *md2 = [[QXServiceModel alloc] init]; + md2.title = @"个性装扮"; + md2.icon = @"service_dress"; + md2.type = QXMineServiceTypeDress; + + QXServiceModel *md3 = [[QXServiceModel alloc] init]; + md3.title = @"我的背包"; + md3.icon = @"service_bag"; + md3.type = QXMineServiceTypeBackpack; + + + QXServiceModel *md4 = [[QXServiceModel alloc] init]; + md4.title = @"我的家族"; + md4.icon = @"service_my_family"; + md4.type = QXMineServiceTypeFamily; + _serviceArray = [NSMutableArray arrayWithArray:@[ - QXText(@"钱包"), - QXText(@"段位"), - QXText(@"公会中心"), - QXText(@"个性装扮"), - QXText(@"道具商城"), - QXText(@"我的背包"), - QXText(@"每日任务") + md4, + md1, + md2, + md3, ]]; } return _serviceArray; } --(NSMutableArray *)serviceImageArray{ - if (!_serviceImageArray) { - _serviceImageArray = [NSMutableArray arrayWithArray:@[ - @"service_wallet", - @"service_level", - @"service_guild", - @"service_dress", - @"service_shop", - @"service_bag", - @"service_task" +-(NSMutableArray *)moreArray{ + if (!_moreArray) { + QXServiceModel *md1 = [[QXServiceModel alloc] init]; + md1.title = @"帮助中心"; + md1.icon = @"service_help"; + md1.type = QXMineServiceTypeHelp; + + QXServiceModel *md2 = [[QXServiceModel alloc] init]; + md2.title = @"每日任务"; + md2.icon = @"service_task"; + md2.type = QXMineServiceTypeDayTask; + + QXServiceModel *md3 = [[QXServiceModel alloc] init]; + md3.title = @"意见反馈"; + md3.icon = @"service_report"; + md3.type = QXMineServiceTypeReport; + + QXServiceModel *md4 = [[QXServiceModel alloc] init]; + md4.title = @"个税客服"; + md4.icon = @"service_customer_service"; + md4.type = QXMineServiceTypeCustomerService; + +// QXServiceModel *md5 = [[QXServiceModel alloc] init]; +// md5.title = @"歌手认证"; +// md5.icon = @"service_singer_auth"; +// md5.type = QXMineServiceTypeSingerAuth; +// +// QXServiceModel *md6 = [[QXServiceModel alloc] init]; +// md6.title = @"我的歌单"; +// md6.icon = @"service_songlist"; +// md6.type = QXMineServiceTypeSongList; + + QXServiceModel *md7 = [[QXServiceModel alloc] init]; + md7.title = @"设置"; + md7.icon = @"service_setting"; + md7.type = QXMineServiceTypeSetting; + + _moreArray = [NSMutableArray arrayWithArray:@[ + md1, + md2, +// md3, +// md4, +// md5, +// md6, + md7 ]]; } - return _serviceImageArray; + return _moreArray; +} +-(QXServiceModel *)inviteModel{ + if (!_inviteModel) { + _inviteModel = [[QXServiceModel alloc] init]; + _inviteModel.title = @"邀请"; + _inviteModel.icon = @"service_invite"; + _inviteModel.type = QXMineServiceTypeInvite; + } + return _inviteModel; +} +-(QXServiceModel *)singerAuthModel{ + if (!_singerAuthModel) { + _singerAuthModel = [[QXServiceModel alloc] init]; + _singerAuthModel.title = @"歌手认证"; + _singerAuthModel.icon = @"service_singer_auth"; + _singerAuthModel.type = QXMineServiceTypeSingerAuth; + } + return _singerAuthModel; +} + +-(QXServiceModel *)songListModel{ + if (!_songListModel) { + _songListModel = [[QXServiceModel alloc] init]; + _songListModel.title = @"我的歌单"; + _songListModel.icon = @"service_songlist"; + _songListModel.type = QXMineServiceTypeSongList; + } + return _songListModel; } - (void)awakeFromNib { [super awakeFromNib]; @@ -184,17 +305,22 @@ } return self; } +-(void)setModel:(QXServiceModel *)model{ + _model = model; + self.imageView.image = [UIImage imageNamed:model.icon]; + self.titleLabel.text = model.title; +} -(void)initSubviews{ UIImageView *imageView = [[UIImageView alloc] init]; [self.contentView addSubview:imageView]; self.imageView = imageView; [imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.centerX.equalTo(self.contentView); - make.height.width.mas_equalTo(18); + make.height.width.mas_equalTo(ScaleWidth(24)); }]; UILabel *titleLabel = [[UILabel alloc] init]; - titleLabel.textColor = QXConfig.textColor; + titleLabel.textColor = RGB16(0x929196); titleLabel.font = [UIFont systemFontOfSize:12]; [self.contentView addSubview:titleLabel]; self.titleLabel = titleLabel; diff --git a/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.h b/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.h index 34c12ed..8176570 100644 --- a/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.h +++ b/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.h @@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN @interface QXUserHomeHeaderView : UIView @property (nonatomic,strong)QXUserHomeModel *model; +@property (nonatomic,strong)NSString *userId; +-(void)headerStartPlay; @end @interface QXTagImageCell : UICollectionViewCell diff --git a/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m b/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m index 8f4fa70..25ccadb 100644 --- a/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m +++ b/QXLive/Mine(音域)/View/个人主页/QXUserHomeHeaderView.m @@ -12,24 +12,46 @@ #import "NSString+QX.h" #import "QXDynamicNetwork.h" #import "QXChatViewController.h" +#import "CKShimmerLabel.h" +#import "QXUserCpDressView.h" +#import "QXUserCpCardView.h" +#import "QXGiftWallViewController.h" +#import "QXHeartBeatSpaceViewController.h" +#import "QXUserHomePageViewController.h" +#import "QXHeartBeatSpaceViewController.h" -@interface QXUserHomeHeaderView() +@interface QXUserHomeHeaderView() +//@property (nonatomic,strong) CKShimmerLabel * tempName; @property (nonatomic,strong) QXSeatHeaderView* headerView; +/// 师傅 +@property (nonatomic,strong)UIView *masterView; +/// 师傅 +@property (nonatomic,strong)QXSeatHeaderView *masterHeaderView; +/// 师傅 +@property (nonatomic,strong)UIImageView *masterViewIcon; +/// 师傅 +@property (nonatomic,strong)UIButton *masterViewButton; + @property (nonatomic,strong) UIView * whiteBgView; @property (nonatomic,strong) UIView * grayBgView; -@property (nonatomic,strong) UILabel * nameLabel; +@property (nonatomic,strong) CKShimmerLabel * nameLabel; @property (nonatomic,strong) UILabel * idLabel; -@property (nonatomic,strong) UILabel * ageLabel; +//@property (nonatomic,strong) UILabel * ageLabel; +@property (nonatomic,strong) UIImageView * guildBgImageView; @property (nonatomic,strong) UILabel * guildLabel; @property (nonatomic,strong) UICollectionView * collectionView; @property (nonatomic,strong) NSMutableArray * tagArray; @property (nonatomic,strong) UILabel *introduceLabel; @property (nonatomic,strong) UICollectionView *inCollectionView; @property (nonatomic, strong) UIImageView *useCodeImageView; -@property (nonatomic, strong)UIImageView *sexImageView; +//@property (nonatomic, strong)UIImageView *sexImageView; @property (nonatomic,strong) UIButton *followBtn; @property (nonatomic,strong) UIButton *playBtn; +@property (nonatomic,strong) QXUserCpDressView *cpDressView; +@property (nonatomic,strong) QXUserCpCardView *cpCardView; + +@property (nonatomic,strong) UIButton *giftWallBtn; @end @implementation QXUserHomeHeaderView @@ -45,41 +67,100 @@ -(void)initSubviews{ self.backgroundColor = [UIColor clearColor]; - - self.headerView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(32, 46, 70, 70)]; - [self.headerView addRoundedCornersWithRadius:35]; + self.headerView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(32, 26, 70, 84)]; [self addSubview:self.headerView]; [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(32); - make.height.width.mas_equalTo(70); + make.width.mas_equalTo(70); + make.height.mas_equalTo(84); make.top.mas_equalTo(26); }]; - self.sexImageView = [[UIImageView alloc] init]; - [self addSubview:self.sexImageView]; - [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.bottom.equalTo(self.headerView); - make.height.width.mas_equalTo(16); + self.masterView = [[UIView alloc] init]; + self.masterView.hidden = YES; + [self addSubview:self.masterView]; + [self.masterView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.headerView); + make.left.equalTo(self.headerView.mas_right); + make.size.mas_equalTo(CGSizeMake(ScaleWidth(45), ScaleWidth(45+16))); }]; - self.nameLabel = [[UILabel alloc] init]; + self.masterHeaderView = [[QXSeatHeaderView alloc] init]; + self.masterHeaderView.contentMode = UIViewContentModeScaleAspectFill; + [self.masterView addSubview:self.masterHeaderView]; +// + [self.masterHeaderView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.equalTo(self.masterView); + make.height.equalTo(self.masterHeaderView.mas_width); + }]; + + self.masterViewIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_info_master_icon"]]; + [self.masterView insertSubview:self.masterViewIcon aboveSubview:self.masterHeaderView]; + [self.masterViewIcon mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.masterHeaderView.mas_bottom).offset(-8); + make.centerX.equalTo(self.masterView); + make.size.mas_equalTo(CGSizeMake(ScaleWidth(30), ScaleWidth(16))); + }]; + self.masterViewButton = [[UIButton alloc] init]; + [self.masterViewButton addTarget:self action:@selector(toMasterUserHome) forControlEvents:(UIControlEventTouchUpInside)]; + [self.masterView addSubview:self.masterViewButton]; + [self.masterViewButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.masterView); + }]; + + self.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(32, self.headerView.bottom+4, 200, 24)]; +// self.nameLabel.text = @"羽声语音"; + self.nameLabel.shimmerWidth = 20; + self.nameLabel.shimmerRadius = 20; + self.nameLabel.durationTime = 1; + self.nameLabel.repeat = YES; self.nameLabel.textColor = QXConfig.textColor; - self.nameLabel.font = [UIFont boldSystemFontOfSize:16]; +// self.nameLabel.shimmerColor = [UIColor yellowColor]; + self.nameLabel.font = [UIFont boldSystemFontOfSize:18]; +// [self.nameLabel startShimmer]; [self addSubview:self.nameLabel]; [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.headerView); make.height.mas_equalTo(24); make.top.equalTo(self.headerView.mas_bottom).offset(4); + make.width.mas_greaterThanOrEqualTo(200); }]; + self.followBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 12)]; + [self.followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)]; + [self.followBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)]; + [self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + [self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)]; + [self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal]; + [self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected]; + self.followBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.followBtn addRoundedCornersWithRadius:12]; + self.followBtn.hidden = YES; + [self.followBtn addTarget:self action:@selector(followAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.followBtn]; + [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.nameLabel.mas_right).offset(10); + make.width.mas_equalTo(55); + make.height.mas_equalTo(24); + make.centerY.equalTo(self.nameLabel); + }]; + +// self.sexImageView = [[UIImageView alloc] init]; +// [self addSubview:self.sexImageView]; +// [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.equalTo(self.nameLabel.mas_right).offset(5); +// make.centerY.equalTo(self.nameLabel); +// make.height.width.mas_equalTo(16); +// }]; + self.idLabel = [[UILabel alloc] init]; self.idLabel.textColor = RGB16(0x999999); self.idLabel.font = [UIFont boldSystemFontOfSize:12]; [self addSubview:self.idLabel]; [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.nameLabel.mas_right).offset(12); - make.height.mas_equalTo(24); - make.centerY.equalTo(self.nameLabel); + make.left.equalTo(self.nameLabel); + make.height.mas_equalTo(18); + make.top.equalTo(self.nameLabel.mas_bottom).offset(5); }]; self.useCodeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_usercode_isLiang"]]; @@ -92,16 +173,16 @@ make.centerY.equalTo(self.idLabel); }]; - self.ageLabel = [[UILabel alloc] init]; - self.ageLabel.textColor = RGB16(0x999999); - self.ageLabel.font = [UIFont boldSystemFontOfSize:12]; - [self addSubview:self.ageLabel]; - [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.headerView); - make.height.mas_equalTo(18); - make.top.equalTo(self.nameLabel.mas_bottom).offset(8); - make.width.mas_greaterThanOrEqualTo(35); - }]; +// self.ageLabel = [[UILabel alloc] init]; +// self.ageLabel.textColor = RGB16(0x999999); +// self.ageLabel.font = [UIFont boldSystemFontOfSize:12]; +// [self addSubview:self.ageLabel]; +// [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.equalTo(self.headerView); +// make.height.mas_equalTo(18); +// make.top.equalTo(self.nameLabel.mas_bottom).offset(8); +// make.width.mas_greaterThanOrEqualTo(35); +// }]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; layout.itemSize = CGSizeMake(UserIconWidth, UserIconHeight); @@ -114,25 +195,13 @@ [self.collectionView registerClass:[QXTagImageCell class] forCellWithReuseIdentifier:@"QXTagImageCell"]; [self addSubview:self.collectionView]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.ageLabel.mas_right).offset(8); + make.left.equalTo(self.nameLabel); make.height.mas_equalTo(18); - make.centerY.equalTo(self.ageLabel); - make.width.mas_equalTo(300); + make.top.equalTo(self.idLabel.mas_bottom).offset(5); + make.width.mas_equalTo(ScaleWidth(240)); }]; - self.guildLabel = [[UILabel alloc] init]; - self.guildLabel.textColor = RGB16(0x999999); - self.guildLabel.text = @"所属公会"; - self.guildLabel.font = [UIFont boldSystemFontOfSize:12]; - [self addSubview:self.guildLabel]; - [self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.headerView); - make.height.mas_equalTo(18); - make.top.equalTo(self.ageLabel.mas_bottom).offset(8); - make.width.mas_greaterThanOrEqualTo(35); - }]; - self.introduceLabel = [[UILabel alloc] init]; self.introduceLabel.textColor = QXConfig.textColor; self.introduceLabel.font = [UIFont systemFontOfSize:14]; @@ -140,9 +209,9 @@ [self addSubview:self.introduceLabel]; [self.introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.headerView); - make.top.equalTo(self.guildLabel.mas_bottom).offset(4); + make.top.equalTo(self.collectionView.mas_bottom).offset(6); make.width.mas_equalTo(SCREEN_WIDTH-64); - make.height.mas_greaterThanOrEqualTo(22); + make.height.mas_greaterThanOrEqualTo(17); }]; UICollectionViewFlowLayout *inlayout = [[UICollectionViewFlowLayout alloc] init]; @@ -160,70 +229,128 @@ make.left.equalTo(self.headerView); make.height.mas_equalTo(22); make.top.equalTo(self.introduceLabel.mas_bottom).offset(4); - make.width.mas_equalTo(SCREEN_WIDTH-64); + make.right.mas_equalTo(-32); }]; self.whiteBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 46, self.width, 167)]; - self.whiteBgView.backgroundColor = [UIColor whiteColor]; + self.whiteBgView.backgroundColor = RGB16(0xffffff); [self.whiteBgView addRoundedCornersWithRadius:16]; [self insertSubview:self.whiteBgView belowSubview:self.headerView]; [self.whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.mas_equalTo(16); - make.width.mas_equalTo(SCREEN_WIDTH-32); + make.left.mas_equalTo(0); + make.right.mas_equalTo(0); make.top.equalTo(self.headerView.mas_top).offset(20); - make.bottom.equalTo(self); + make.bottom.equalTo(self.inCollectionView).offset(10); }]; + self.guildBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_home_guild_bg"]]; + [self.whiteBgView addSubview:self.guildBgImageView]; + [self.guildBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-8); + make.height.mas_equalTo(31); + make.top.mas_equalTo(6); + make.width.mas_equalTo(94); + }]; + + self.guildLabel = [[UILabel alloc] init]; + self.guildLabel.textColor = RGB16(0xffffff); + self.guildLabel.textAlignment = NSTextAlignmentCenter; + self.guildLabel.lineBreakMode = NSLineBreakByClipping; + self.guildLabel.font = [UIFont boldSystemFontOfSize:10]; + [self.whiteBgView addSubview:self.guildLabel]; + [self.guildLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.guildBgImageView).offset(6); + make.height.mas_equalTo(14); + make.top.equalTo(self.guildBgImageView).offset(6); + make.right.equalTo(self.guildBgImageView).offset(-28); + }]; + + self.grayBgView = [[UIView alloc] initWithFrame:CGRectMake(0, self.whiteBgView.top+75, self.width, 92)]; - self.grayBgView.backgroundColor = RGB16(0xF6F6F6); - [self.grayBgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; + self.grayBgView.backgroundColor = RGB16(0xF3F3F3); +// [self.grayBgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)]; [self insertSubview:self.grayBgView belowSubview:self.whiteBgView]; [self.grayBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self); - make.height.mas_equalTo(92); - make.bottom.equalTo(self.whiteBgView); + make.top.equalTo(self.whiteBgView).offset(16); + make.bottom.equalTo(self); }]; - self.playBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 35)]; + self.playBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 24)]; // [self.playBtn setTitle:QXText(@"私信") forState:(UIControlStateNormal)]; // [self.playBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)]; // self.playBtn.backgroundColor = RGB16(0x333333); self.playBtn.hidden = YES; self.playBtn.titleLabel.font = [UIFont systemFontOfSize:14]; - [self.playBtn addRoundedCornersWithRadius:17.5]; + [self.playBtn addRoundedCornersWithRadius:12]; [self.playBtn addTarget:self action:@selector(playAction) forControlEvents:(UIControlEventTouchUpInside)]; - [self addSubview:self.playBtn]; + [self.whiteBgView addSubview:self.playBtn]; [self.playBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(-27); - make.width.mas_equalTo(91); - make.height.mas_equalTo(35); - make.top.equalTo(self.whiteBgView).offset(10); + make.right.equalTo(self.guildBgImageView.mas_left).offset(-6); + make.width.mas_equalTo(59); + make.height.mas_equalTo(24); + make.centerY.equalTo(self.guildBgImageView).offset(-2); }]; - self.followBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.playBtn.left-6-91, self.whiteBgView.top+10, 91, 35)]; - [self.followBtn setTitle:QXText(@"关注") forState:(UIControlStateNormal)]; - [self.followBtn setTitle:QXText(@"已关注") forState:(UIControlStateSelected)]; - [self.followBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; - [self.followBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateSelected)]; - [self.followBtn setBackgroundImage:[UIImage imageWithColor:QXConfig.themeColor] forState:UIControlStateNormal]; - [self.followBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xF1F2F3)] forState:UIControlStateSelected]; - self.followBtn.titleLabel.font = [UIFont systemFontOfSize:14]; - [self.followBtn addRoundedCornersWithRadius:17.5]; - self.followBtn.hidden = YES; - [self.followBtn addTarget:self action:@selector(followAction) forControlEvents:(UIControlEventTouchUpInside)]; - [self addSubview:self.followBtn]; - [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.playBtn.mas_left).offset(-6); - make.width.mas_equalTo(91); - make.height.mas_equalTo(35); - make.centerY.equalTo(self.playBtn); - }]; + // self.nameLabel.text = @"张三"; // self.idLabel.text = @"313213213"; // self.ageLabel.text = @"36岁"; // self.introduceLabel.text = @"个人简介个人简介个人简介个人简个人简介"; [self.inCollectionView reloadData]; + + self.cpDressView = [[QXUserCpDressView alloc] initWithFrame:CGRectMake(self.width-15-ScaleWidth(120), 0, ScaleWidth(120), ScaleWidth(194))]; + self.cpDressView.hidden = YES; + [self.whiteBgView addSubview:self.cpDressView]; + + self.cpCardView = [[QXUserCpCardView alloc] init]; + self.cpCardView.delegate = self; + self.cpCardView.hidden = YES; + MJWeakSelf + [self.cpCardView addTapBlock:^(id _Nonnull obj) { + QXHeartBeatSpaceViewController*vc = [[QXHeartBeatSpaceViewController alloc] init]; + vc.userId = weakSelf.userId; + [weakSelf.viewController.navigationController pushViewController:vc animated:YES]; + }]; + [self addSubview:self.cpCardView]; + [self.cpCardView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(17); + make.right.mas_equalTo(-17); + make.top.equalTo(self.whiteBgView.mas_bottom).offset(14); + make.height.mas_equalTo(ScaleWidth(100)); + }]; + + self.giftWallBtn = [[UIButton alloc] init]; + [self.giftWallBtn addTarget:self action:@selector(giftWallAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.giftWallBtn setBackgroundImage:[UIImage imageNamed:@"user_home_gift_wall"] forState:(UIControlStateNormal)]; + [self addSubview:self.giftWallBtn]; + [self.giftWallBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(17); + make.right.mas_equalTo(-17); + make.height.mas_equalTo(ScaleWidth(40)); + make.top.equalTo(self.cpCardView.mas_bottom).offset(8); + }]; + [self.whiteBgView bringSubviewToFront:self.playBtn]; + [self bringSubviewToFront:self.followBtn]; + +} +-(void)headerStartPlay{ + [self.headerView playHWDMP4]; + [self.cpCardView headerStartPlay]; + [self.cpDressView headerStartPlay]; +} +-(void)giftWallAction{ + QXGiftWallViewController *vc = [[QXGiftWallViewController alloc] init]; + vc.userId = self.userId; + [self.viewController.navigationController pushViewController:vc animated:YES]; +} + +-(void)toMasterUserHome{ + QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; + NSString *userId = self.model.master.user_id; + vc.user_id = userId; + [self.viewController.navigationController pushViewController:vc animated:YES]; } -(void)followAction{ @@ -243,6 +370,21 @@ [[QXGlobal shareGlobal] chatWithUserID:self.model.user_id nickname:self.model.nickname avatar:self.model.avatar navagationController:self.navigationController]; } } +-(void)didClickHeaderViewUserId:(NSString*)userId{ + if ([userId isEqualToString:self.userId]) { + return; + } + QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init]; + vc.user_id = userId; + [self.viewController.navigationController pushViewController:vc animated:YES]; +} + +-(void)didClickHeaderCardViewWithUserId:(NSString*)userId{ + QXHeartBeatSpaceViewController *vc = [[QXHeartBeatSpaceViewController alloc] init]; + vc.userId = userId; + [self.viewController.navigationController pushViewController:vc animated:YES]; +} + -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ if (collectionView == self.collectionView) { @@ -264,12 +406,72 @@ } } +-(void)setUserId:(NSString *)userId{ + _userId = userId; + self.cpCardView.userId = self.userId; +} -(void)setModel:(QXUserHomeModel *)model{ _model = model; +// model.nickname = @"大家好撒客户端撒大厦尽快"; +// self.tempName.text = model.nickname; [self.headerView setHeadIcon:model.avatar dress:model.dress]; + [self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]]; + + if (model.master) { + self.masterView.hidden = NO; + [self.masterHeaderView setHeadIcon:model.master.avatar dress:model.master.dress]; + }else{ + self.masterView.hidden = YES; + } + + if ([model.nickname_color isExist]) { + self.nameLabel.shimmerColor = [UIColor colorWithHexString:model.nickname_color]; + [self.nameLabel startShimmer]; +// self.tempName.shimmerColor = UIColor.redColor; +// [self.tempName startShimmer]; + }else{ + [self.nameLabel stopShimmer]; + } self.nameLabel.text = model.nickname; - self.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code]; - self.ageLabel.text = [NSString stringWithFormat:@"%@|%ld岁",model.sex.intValue==1?QXText(@"男"):QXText(@"女"),[model.birthday ageWithDateOfBirth]]; + [self.nameLabel.contentLabel sizeToFit]; + [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.headerView); + make.height.mas_equalTo(24); + make.top.equalTo(self.headerView.mas_bottom).offset(4); + make.width.mas_equalTo(self.nameLabel.contentLabel.width); + }]; + if (model.cp_info != nil) { + self.cpDressView.hidden = NO; + self.cpCardView.hidden = NO; + self.cpDressView.model = model.cp_info; + self.cpCardView.model = model.cp_info; + [self.giftWallBtn mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(17); + make.right.mas_equalTo(-17); + make.height.mas_equalTo(ScaleWidth(40)); + make.top.equalTo(self.cpCardView.mas_bottom).offset(8); + }]; + }else{ + self.cpDressView.hidden = YES; + self.cpCardView.hidden = YES; + [self.giftWallBtn mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(17); + make.right.mas_equalTo(-17); + make.height.mas_equalTo(ScaleWidth(40)); + make.top.equalTo(self.whiteBgView.mas_bottom).offset(8); + }]; + } +// self.tempName.text = model.nickname; +// [self.tempName.contentLabel sizeToFit]; +// [self.tempName mas_remakeConstraints:^(MASConstraintMaker *make) { +// make.top.left.mas_equalTo(0); +// make.height.mas_equalTo(24); +// make.width.mas_equalTo(self.tempName.contentLabel.width); +// }]; + +// self.tempName.text = model.nickname; +// self.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code]; + self.idLabel.text = [NSString stringWithFormat:@"%@|%ld岁 ID:%@",model.sex.intValue==1?QXText(@"男"):QXText(@"女"),[model.birthday ageWithDateOfBirth],model.user_code]; self.introduceLabel.text = model.profile; [self.inCollectionView reloadData]; [self.collectionView reloadData]; @@ -288,18 +490,18 @@ [self.playBtn setBackgroundImage:[UIImage imageNamed:@"expansion_call"] forState:(UIControlStateNormal)]; } } - if ([model.guild isExist]) { - self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",model.guild]; + if ([model.guild_name isExist]) { + self.guildLabel.text = model.guild_name; }else{ - self.guildLabel.text = [NSString stringWithFormat:@"所属公会:%@",@"无"]; + self.guildLabel.text = @"无"; } if (model.is_use_code.intValue == 1) { self.useCodeImageView.hidden = NO; }else{ self.useCodeImageView.hidden = YES; } - UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"]; - self.sexImageView.image = sexImage; +// UIImage *sexImage = [UIImage imageNamed:model.sex.intValue==1?@"user_sex_boy":@"user_sex_girl"]; +// self.sexImageView.image = sexImage; } -(NSMutableArray *)tagArray{ diff --git a/QXLive/Mine(音域)/View/个性装扮/QXDressCell.m b/QXLive/Mine(音域)/View/个性装扮/QXDressCell.m index 889ef98..b1c753c 100644 --- a/QXLive/Mine(音域)/View/个性装扮/QXDressCell.m +++ b/QXLive/Mine(音域)/View/个性装扮/QXDressCell.m @@ -19,7 +19,11 @@ _model = model; self.nameLabel.text = model.title; [self.dressImageView sd_setImageWithURL:[NSURL URLWithString:model.base_image]]; - self.timeLabel.text = [NSString stringWithFormat:@"%@%@",model.remaining_day,QXText(@"天")]; + if ([model.type isEqualToString:@"12"]) { + self.timeLabel.text = [NSString stringWithFormat:@"x%@",model.num]; + }else{ + self.timeLabel.text = [NSString stringWithFormat:@"%@%@",model.remaining_day,QXText(@"天")]; + } // if (model.is_using.intValue == 1) { // self.selecteBtn.selected = NO; // }else{ diff --git a/QXLive/Mine(音域)/View/个性装扮/QXDressCell.xib b/QXLive/Mine(音域)/View/个性装扮/QXDressCell.xib index c946303..f65183d 100644 --- a/QXLive/Mine(音域)/View/个性装扮/QXDressCell.xib +++ b/QXLive/Mine(音域)/View/个性装扮/QXDressCell.xib @@ -11,21 +11,21 @@ - + - + - + - + @@ -58,9 +58,9 @@ - + - + - + + + + @@ -44,9 +63,13 @@ + + + + diff --git a/QXLive/Room(房间)/View/表情/QXRoomEmojiContentView.m b/QXLive/Room(房间)/View/表情/QXRoomEmojiContentView.m index a864551..07d3382 100644 --- a/QXLive/Room(房间)/View/表情/QXRoomEmojiContentView.m +++ b/QXLive/Room(房间)/View/表情/QXRoomEmojiContentView.m @@ -76,6 +76,10 @@ } -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ QXEmojiModel *md = self.dataArray[indexPath.row]; + if (md.is_lock.intValue == 1) { + showToast(@"请先开通爵位"); + return; + } QXEmojiModel *result = [self randomResultWithEmoji:md]; if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectedEmoji:)]) { [self.delegate didSelectedEmoji:result]; diff --git a/QXLive/Room(房间)/View/设置/QXRoomSettingView.h b/QXLive/Room(房间)/View/设置/QXRoomSettingView.h index 3488660..1871002 100644 --- a/QXLive/Room(房间)/View/设置/QXRoomSettingView.h +++ b/QXLive/Room(房间)/View/设置/QXRoomSettingView.h @@ -10,7 +10,7 @@ typedef NS_ENUM(NSInteger) { /// 房间类型 - /// 点唱房 + /// 聊天房 QXRoomSettingTypeRoomTypeSing = 10, /// 拍卖房 QXRoomSettingTypeRoomTypeAuction = 11, @@ -24,6 +24,10 @@ typedef NS_ENUM(NSInteger) { QXRoomSettingTypeRoomTypeFunny = 100, /// 练歌房 QXRoomSettingTypeRoomTypeKSing = 200, + /// 点唱房 + QXRoomSettingTypeRoomTypeSinger = 300, + /// 签约房 + QXRoomSettingTypeRoomTypeSign = 400, /// 常用工具 /// 房间补贴 diff --git a/QXLive/Room(房间)/View/设置/QXRoomSettingView.m b/QXLive/Room(房间)/View/设置/QXRoomSettingView.m index 9dcd606..9d054f5 100644 --- a/QXLive/Room(房间)/View/设置/QXRoomSettingView.m +++ b/QXLive/Room(房间)/View/设置/QXRoomSettingView.m @@ -44,6 +44,10 @@ @property (nonatomic,strong)QXRoomSettingModel *roomTypeFunny; /// 练歌房 @property (nonatomic,strong)QXRoomSettingModel *roomTypeKSing; +/// 练歌房 +@property (nonatomic,strong)QXRoomSettingModel *roomTypeSinger; +/// 签约房 +@property (nonatomic,strong)QXRoomSettingModel *roomTypeSign; @@ -174,6 +178,7 @@ NSArray *roomTypeArr; NSArray *toolsArr; NSArray *moreArr; + roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFriend,self.roomTypeKSing,self.roomTypeSinger,self.roomTypeSign]; switch (roleType) { // 主持 case QXRoomRoleTypeCompere:{ @@ -181,13 +186,11 @@ // toolsArr = @[self.roomSubsidy,self.roomMessage,self.roomOrderMic,self.roomBgImage]; /// 暂时不需要房间补贴 toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage]; - roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend,self.roomTypeKSing]; moreArr = @[self.redBag,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; }else{ // toolsArr = @[self.roomSubsidy,self.roomMessage,self.roomOrderMic,self.roomBgMusic,self.roomBgImage]; /// 暂时不需要房间补贴 toolsArr = @[self.roomMessage,self.roomOrderMic,self.roomBgImage]; - roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend]; moreArr = @[self.redBag,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; } @@ -219,7 +222,6 @@ /// 暂时不需要房间补贴 toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage]; } - roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend,self.roomTypeKSing]; moreArr = @[self.redBag,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; // roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend]; self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")]; @@ -243,7 +245,6 @@ toolsArr = @[self.roomCompere,self.roomMessage,self.roomOrderMic,self.roomBgImage]; } // roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeBoy,self.roomTypeGirl,self.roomTypeFriend]; - roomTypeArr = @[self.roomTypeSing,self.roomTypeAuction,self.roomTypeFunny,self.roomTypeFriend,self.roomTypeKSing]; moreArr = @[self.redBag,self.roomSetting,self.roomEffects,self.drifPop,self.roomReport]; self.titles = @[QXText(@"房间类型"),QXText(@"常用工具"),QXText(@"更多操作")]; } @@ -307,7 +308,7 @@ } if (model.type == QXRoomSettingTypeRoomLeave) { [self.navigationController popViewControllerAnimated:YES]; - [[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id]; + [[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id removeListener:YES]; return; } if (model.type == QXRoomSettingTypeRoomCompere) { @@ -325,7 +326,15 @@ // [self.welcomeView showInView:self.viewController.view]; return; } - if (model.type == QXRoomSettingTypeRoomTypeAuction || model.type == QXRoomSettingTypeRoomTypeSing || model.type == QXRoomSettingTypeRoomTypeBoy || model.type == QXRoomSettingTypeRoomTypeGirl || model.type == QXRoomSettingTypeRoomTypeFriend || model.type == QXRoomSettingTypeRoomTypeFunny || model.type == QXRoomSettingTypeRoomTypeKSing) { + if (model.type == QXRoomSettingTypeRoomTypeAuction + || model.type == QXRoomSettingTypeRoomTypeSing + || model.type == QXRoomSettingTypeRoomTypeBoy + || model.type == QXRoomSettingTypeRoomTypeGirl + || model.type == QXRoomSettingTypeRoomTypeFriend + || model.type == QXRoomSettingTypeRoomTypeFunny + || model.type == QXRoomSettingTypeRoomTypeKSing + || model.type == QXRoomSettingTypeRoomTypeSinger + || model.type == QXRoomSettingTypeRoomTypeSign) { self.alertView.message = [NSString stringWithFormat:@"您确定要修改为%@房吗?",model.name]; [[QXGlobal shareGlobal] showView:self.alertView controller:self.viewController popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{ @@ -364,7 +373,12 @@ type = @"7"; }else if (roomType == QXRoomSettingTypeRoomTypeFunny) { type = @"8"; + }else if (roomType == QXRoomSettingTypeRoomTypeSinger) { + type = @"9"; + }else if (roomType == QXRoomSettingTypeRoomTypeSign) { + type = @"10"; } + [QXMineNetwork changeRoomTypeWithRoomId:self.roomModel.room_info.room_id type:type successBlock:^(NSDictionary * _Nonnull dict) { } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { @@ -391,9 +405,9 @@ -(QXRoomSettingModel *)roomTypeSing{ if (!_roomTypeSing) { _roomTypeSing = [[QXRoomSettingModel alloc] init]; - _roomTypeSing.name = QXText(@"点唱"); + _roomTypeSing.name = QXText(@"交友"); _roomTypeSing.type = QXRoomSettingTypeRoomTypeSing; - _roomTypeSing.icon = @"room_set_room_type_sing"; + _roomTypeSing.icon = @"room_set_room_type_funny"; } return _roomTypeSing; } @@ -452,6 +466,26 @@ } return _roomTypeFunny; } +-(QXRoomSettingModel *)roomTypeSinger{ + if (!_roomTypeSinger) { + _roomTypeSinger = [[QXRoomSettingModel alloc] init]; + _roomTypeSinger.name = QXText(@"点唱"); + _roomTypeSinger.type = QXRoomSettingTypeRoomTypeSinger; + _roomTypeSinger.icon = @"room_set_room_type_sing"; + } + return _roomTypeSinger; +} + +-(QXRoomSettingModel *)roomTypeSign{ + if (!_roomTypeSign) { + _roomTypeSign = [[QXRoomSettingModel alloc] init]; + _roomTypeSign.name = QXText(@"签约"); + _roomTypeSign.type = QXRoomSettingTypeRoomTypeSign; + _roomTypeSign.icon = @"room_set_room_type_sign"; + } + return _roomTypeSign; +} + -(QXRoomSettingModel *)roomSubsidy{ if (!_roomSubsidy) { _roomSubsidy = [[QXRoomSettingModel alloc] init]; diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.h index 13da031..cd2113c 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.h @@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXRoomPitModel *pitModel; @property (nonatomic,assign)BOOL onlyShowHeader; @property (nonatomic,assign) BOOL isSeatSpeaking; +/// 不显示麦圈 +@property (nonatomic,assign) BOOL noMicCycle; @property (nonatomic,strong)NSString *is_lock; @property (nonatomic,strong)UIImageView *noUserImageView; @@ -42,15 +44,25 @@ NS_ASSUME_NONNULL_BEGIN /// 是否展示离线状态 需求暂定二卡八不展示离线状态 @property (nonatomic,assign)BOOL noOffLine; -//@property (nonatomic,strong)QXRoomOwnerModel *userModel ; +@property (nonatomic,assign)NSString *tagViewBgColor; + +@property (nonatomic,assign)CGFloat nameToHeaderSpace; + +@property (nonatomic,assign)CGFloat charmToNameSpace; + +@property (nonatomic,assign)CGFloat nameFontSize; +/// name是否超出显示 +@property (nonatomic,assign)BOOL nameBeyound; -(void)updateUserCharm:(NSString*)charm; - (void)startAudioAnimation ; /// 暂停麦位动画 - (void)stopAudioAnimation ; - +/// 隐藏魅力 -(void)hideCharm; +/// 隐藏名称 +-(void)hideName; -(void)destroyViews; diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.m index fcd9d30..833cc12 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatContentView.m @@ -202,19 +202,25 @@ } NSDictionary *parm = notice.object; NSString *uid = [NSString stringWithFormat:@"%@",[parm objectForKey:@"user_id"]]; - BOOL isOnline = [[parm objectForKey:@"is_online"] boolValue]; - [QXGlobal.shareGlobal.offLineDict setObject:[NSNumber numberWithBool:!isOnline] forKey:uid]; - if ([uid isEqualToString:self.pitModel.user_id]) { - if (isOnline) { - self.offlineImageView.hidden = YES; - }else{ - self.offlineImageView.hidden = NO; - [self stopAudioAnimation]; + NSInteger isOnline = [[parm objectForKey:@"is_online"] integerValue]; + if ([uid isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.offlineImageView.hidden = YES; + }else{ + if ([uid isEqualToString:self.pitModel.user_id]) { + if (isOnline==1) { + self.offlineImageView.hidden = YES; + }else{ + self.offlineImageView.hidden = NO; + [self stopAudioAnimation]; + } } } QXLOG(@"在线状态%@",QXGlobal.shareGlobal.offLineDict); } -(void)speakInfo:(NSNotification*)notice{ + if (self.noMicCycle) { + return; + } id object = notice.object; if ([object isKindOfClass:[AgoraRtcAudioVolumeInfo class]]) { AgoraRtcAudioVolumeInfo *info = (AgoraRtcAudioVolumeInfo*)object; @@ -238,6 +244,9 @@ -(void)setNoOffLine:(BOOL)noOffLine{ _noOffLine = noOffLine; } +-(void)setNoMicCycle:(BOOL)noMicCycle{ + _noMicCycle = noMicCycle; +} -(void)setIsPK:(BOOL)isPK{ _isPK = isPK; self.nameLabel.font = [UIFont systemFontOfSize:10]; @@ -263,6 +272,11 @@ } self.isSeatSpeaking = YES; [self.micSvgaView setHidden:NO]; + if ([self.pitModel.mic_cycle isExist]) { + [self.micSvgaView loadSVGAPlayerWith:self.pitModel.mic_cycle inBundle:NO loop:10000000]; + }else{ + [self.micSvgaView loadSVGAPlayerWith:@"mic" inBundle:YES loop:10000000]; + } [self.micSvgaView startEffectSvgaPlay]; } /// 暂停麦位动画 @@ -277,16 +291,21 @@ -(void)setTagString:(NSString *)tagString{ _tagString = tagString; - self.tagLabel.hidden = NO; - self.numberLabel.hidden = YES; - self.tagLabel.text = tagString; - [self.tagLabel sizeToFit]; - [self.tagLabel mas_remakeConstraints:^(MASConstraintMaker *make) { - make.centerX.equalTo(self.noUserImageView); - make.top.equalTo(self.noUserImageView.mas_bottom).offset(-8); - make.height.mas_equalTo(ScaleWidth(13)); - make.width.mas_equalTo(self.tagLabel.width+16); - }]; + if ([tagString isExist]) { + self.tagLabel.hidden = NO; + self.numberLabel.hidden = YES; + self.tagLabel.text = tagString; + [self.tagLabel sizeToFit]; + [self.tagLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.noUserImageView); + make.top.equalTo(self.noUserImageView.mas_bottom).offset(-8); + make.height.mas_equalTo(ScaleWidth(13)); + make.width.mas_equalTo(self.tagLabel.width+16); + }]; + }else{ + self.tagLabel.hidden = YES; + } + } -(void)setType:(QXRoomSeatContentViewType)type{ _type = type; @@ -369,8 +388,10 @@ } if (pitModel.user_id.longValue > 0) { - BOOL is_offline = [[[QXGlobal shareGlobal].offLineDict objectForKey:pitModel.user_id?pitModel.user_id:@"0"] boolValue]; - if (is_offline) { + NSInteger is_offline = [[[QXGlobal shareGlobal].offLineDict objectForKey:pitModel.user_id?pitModel.user_id:@"0"] integerValue]; + if (is_offline==1) { + self.offlineImageView.hidden = YES; + }else if(is_offline == 2){ if (self.noOffLine) { self.offlineImageView.hidden = YES; }else{ @@ -379,6 +400,9 @@ }else{ self.offlineImageView.hidden = YES; } + if ([pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.offlineImageView.hidden = YES; + } self.numberLabel.hidden = YES; self.headerView.hidden = NO; self.nameLabel.hidden = NO; @@ -443,12 +467,56 @@ self.lockImageView.hidden = YES; } } +-(void)hideName{ + self.numberLabel.hidden = YES; + self.nameLabel.hidden = YES; +} -(void)setIsAutionSeat:(BOOL)isAutionSeat{ _isAutionSeat = isAutionSeat; self.noUserImageView.image = [UIImage imageNamed:@"room_seat_auction_icon"]; self.charmBgView.hidden = YES; } + +-(void)setTagViewBgColor:(NSString *)tagViewBgColor{ + _tagViewBgColor = tagViewBgColor; + self.tagLabel.backgroundColor = [UIColor colorWithHexString:tagViewBgColor]; +} +-(void)setNameToHeaderSpace:(CGFloat)nameToHeaderSpace{ + _nameToHeaderSpace = nameToHeaderSpace; + [self.nameLabel mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.noUserImageView.mas_bottom).offset(nameToHeaderSpace); + }]; +} + +-(void)setCharmToNameSpace:(CGFloat)charmToNameSpace{ + _charmToNameSpace = charmToNameSpace; + [self.charmBgView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.nameLabel.mas_bottom).offset(charmToNameSpace); + }]; +} + +-(void)setNameFontSize:(CGFloat)nameFontSize{ + self.nameLabel.font = [UIFont systemFontOfSize:nameFontSize]; +} +-(void)setNameBeyound:(BOOL)nameBeyound{ + _nameBeyound = nameBeyound; + if (nameBeyound) { + [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.noUserImageView.mas_bottom).offset(self.nameToHeaderSpace); + make.centerX.equalTo(self.noUserImageView); + make.height.mas_equalTo(18); + }]; + }else{ + [self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.noUserImageView.mas_bottom).offset(5); + make.height.mas_equalTo(18); + make.left.right.equalTo(self); + }]; + } + +} + -(void)setNumberString:(NSString *)numberString{ self.numberLabel.text = numberString; } @@ -505,9 +573,8 @@ } - (QXEffectSvgaView *)micSvgaView { if (!_micSvgaView) { - _micSvgaView = [[QXEffectSvgaView alloc] initWithFrame:CGRectZero isAutoPlay:NO]; + _micSvgaView = [[QXEffectSvgaView alloc] initWithFrame:CGRectZero isAutoPlay:YES]; _micSvgaView.hidden = YES; - [_micSvgaView loadSVGAPlayerWith:@"mic" inBundle:[NSBundle mainBundle] loop:10000000]; __weak typeof(self)weakSelf = self; _micSvgaView.didFinishedDisplay = ^(QXEffectSvgaView * _Nonnull svgaView) { weakSelf.isSeatSpeaking = NO; diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m index 0b01d8f..253042f 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeAuctionView.m @@ -573,6 +573,9 @@ model.dress = self.roomModel.room_auction.auction_user.dress; model.sex = self.roomModel.room_auction.auction_user.sex; model.charm = self.roomModel.room_auction.auction_user.charm; + model.nobility_image = self.roomModel.room_auction.auction_user.nobility_image; + model.nickname_color = self.roomModel.room_auction.auction_user.nickname_color; + model.mic_cycle = self.roomModel.room_auction.auction_user.mic_cycle; self.auctionView.pitModel = model; [self.auctionView hideCharm]; self.auctionCharmView.hidden = NO; @@ -697,6 +700,9 @@ model.nickname = user.nickname; model.user_code = user.user_code; model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; }else{ model.user_id = @"0"; model.avatar = @""; @@ -705,6 +711,9 @@ model.nickname = @""; model.user_code = @""; model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; if (contentView.isSeatSpeaking) { [contentView stopAudioAnimation]; } @@ -747,6 +756,9 @@ model.nickname = user.nickname; model.user_code = user.user_code; model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; self.auctionCharmView.hidden = NO; self.charmLabel.text = [NSString qx_showHotCountNumDouble:model.charm.longLongValue]; }else{ @@ -757,6 +769,9 @@ model.nickname = @""; model.user_code = @""; model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; if (contentView.isSeatSpeaking) { [contentView stopAudioAnimation]; } @@ -976,6 +991,9 @@ pitModel.nickname = user.nickname; pitModel.sex = user.sex; pitModel.avatar = user.avatar; + pitModel.nobility_image = user.nobility_image; + pitModel.nickname_color = user.nickname_color; + pitModel.mic_cycle = user.mic_cycle; self.auctionView.pitModel = pitModel; } @@ -985,6 +1003,9 @@ pitModel.nickname = user.nickname; pitModel.sex = user.sex; pitModel.avatar = user.avatar; + pitModel.nobility_image = user.nobility_image; + pitModel.nickname_color = user.nickname_color; + pitModel.mic_cycle = user.mic_cycle; self.compereView.pitModel = pitModel; } for (QXRoomSeatContentView *seatView in self.seatArray) { @@ -994,6 +1015,9 @@ md.nickname = user.nickname; md.sex = user.sex; md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; seatView.pitModel = md; break; } diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeCabinView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeCabinView.m index d73ad42..e30df89 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeCabinView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeCabinView.m @@ -330,7 +330,7 @@ -(void)leaveRoom{ UINavigationController *na = (UINavigationController *)KEYWINDOW.rootViewController; if ([self.roomModel.room_info.type_id isEqualToString:@"6"] && [self.roomModel.room_info.label_id isEqualToString:@"5"]) { - [[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomModel.room_info.room_id]; + [[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id removeListener:YES]; NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:na.viewControllers]; for (int i = 0; i < viewControllers.count; i++) { UIViewController *vc = [viewControllers objectAtIndex:i]; @@ -346,7 +346,7 @@ [na popViewControllerAnimated:YES]; QXGlobal.shareGlobal.superRoomId = @""; }else{ - [[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomModel.room_info.room_id]; + [[QXGlobal shareGlobal]quitRoomWithRoomId:self.roomModel.room_info.room_id removeListener:YES]; // self.navigationController.interactivePopGestureRecognizer.enabled = YES; [na popViewControllerAnimated:YES]; } diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m index 0f9e5c3..6d45143 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeFrientView.m @@ -837,6 +837,9 @@ model.nickname = user.nickname; model.user_code = user.user_code; model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; }else{ model.user_id = @"0"; model.avatar = @""; @@ -845,6 +848,9 @@ model.nickname = @""; model.user_code = @""; model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; if (contentView.isSeatSpeaking) { [contentView stopAudioAnimation]; } @@ -1051,6 +1057,9 @@ md.nickname = model.nickname; md.user_code = model.user_code; md.charm = model.charm; + md.nobility_image = model.nobility_image; + md.nickname_color = model.nickname_color; + md.mic_cycle = model.mic_cycle; contentView.pitModel = md; if (contentView.isSeatSpeaking) { [contentView stopAudioAnimation]; @@ -1158,6 +1167,9 @@ md.nickname = user.nickname; md.sex = user.sex; md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; contentView.pitModel = md; break; } @@ -1168,7 +1180,7 @@ if ([model.room_id isExist]) { QXGlobal.shareGlobal.superRoomId = self.roomModel.room_info.room_id; if ([model.user1_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id] || [model.user2_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { - [[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id]; + [[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomModel.room_info.room_id removeListener:YES]; [[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.viewController.navigationController]; } } @@ -1392,6 +1404,10 @@ _heartTopLineParser = nil; _heartCenterLineParser = nil; _heartBottomLineParser = nil; + if (_timer) { + [_timer invalidate]; + _timer = nil; + } } @end diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m index e43ebbc..5f2a43c 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeNormalView.m @@ -74,7 +74,7 @@ static NSInteger maxSeat = 8; for (int i = 0 ; i < maxSeat ; i++) { QXRoomSeatContentView *contentView = [[QXRoomSeatContentView alloc] init]; contentView.number = i+1; - contentView.noOffLine = YES; +// contentView.noOffLine = YES; // [contentView addTapBlock:^(id _Nonnull obj) { // [weakSelf didClickSeatView:obj]; // }]; @@ -89,8 +89,8 @@ static NSInteger maxSeat = 8; } [self.seatArray addObject:self.compereView]; [self.seatArray addObject:self.guestView]; - self.compereView.noOffLine = YES; - self.guestView.noOffLine = YES; +// self.compereView.noOffLine = YES; +// self.guestView.noOffLine = YES; } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ @@ -204,6 +204,9 @@ static NSInteger maxSeat = 8; model.nickname = user.nickname; model.user_code = user.user_code; model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; }else{ model.user_id = @"0"; model.avatar = @""; @@ -212,6 +215,9 @@ static NSInteger maxSeat = 8; model.nickname = @""; model.user_code = @""; model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; if (contentView.isSeatSpeaking) { [contentView stopAudioAnimation]; } @@ -429,6 +435,9 @@ static NSInteger maxSeat = 8; md.nickname = user.nickname; md.sex = user.sex; md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; seatView.pitModel = md; break; } diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h new file mode 100644 index 0000000..bf281f4 --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.h @@ -0,0 +1,53 @@ +// +// QXRoomSeatTypeSignView.h +// QXLive +// +// Created by 启星 on 2025/11/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomSeatTypeSignView : UIView +@property (nonatomic,weak)iddelegate; +@property (nonatomic,strong)QXRoomModel *roomModel; +/// seatArray +@property (nonatomic,strong,readonly)NSMutableArray *seatArray; +@property (nonatomic,assign)NSInteger myPitNumber; +@property (nonatomic,strong)QXRoomSeatContentView* mySeatView; + +/// 上下麦 +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +/// 清除魅力 +-(void)clearCharm; +/// 清除个人魅力 +-(void)roomClearUserCharmWithUserId:(NSString *)userId; +/// 设置魅力 +-(void)setSeatCharmWithUser:(QXUserHomeModel *)model; +/// 设置多人魅力 +-(void)setSeatCharmWithUsers:(NSArray*)users; + +/// 房间内用户信息发生变化 +-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user; + +/// 房间内换麦 +-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK; + + +/// 签约开始 +-(void)signDidStartWithEndTime:(NSString *)endTime signId:(NSString *)signId signDay:(NSString*)signDay signValue:(NSString*)signValue; +/// 签约结束 +-(void)signDidEndWithUserInfo1:(QXUserHomeModel*)userInfo1 userInfo2:(QXUserHomeModel*)userInfo2 sign_value:(NSString*)sign_value; +/// 签约身价变化 +-(void)signValueDidChangedWithSignUserInfo:(QXUserHomeModel*)signUserInfo sign_value:(NSString*)sign_value signId:(NSString*)signId sign_coin_list:(NSArray*)sign_coin_list; +/// 签约发生延时 +-(void)signTimeDelayWithEndTime:(NSString*)endTime; + +-(void)stopHWDMP4; +-(void)playHWDMP4; + +-(void)destroyViews; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m new file mode 100644 index 0000000..be76e06 --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSignView.m @@ -0,0 +1,916 @@ +// +// QXRoomSeatTypeSignView.m +// QXLive +// +// Created by 启星 on 2025/11/25. +// + +#import "QXRoomSeatTypeSignView.h" +#import "QXSignShowTimeView.h" +#import "QXSignCoinListView.h" +#import "QXMineNetwork.h" +#import "QXCustomAlertView.h" +#import "QXRechargeView.h" +#import "QXSignAlertView.h" + +@interface QXRoomSeatTypeSignView() +@property (nonatomic,strong)UIImageView *bgImageView; +/// 主持 +@property (nonatomic,strong)QXRoomSeatContentView *compereView; +/// 标题 +@property (nonatomic,strong)UILabel *titleLabel; +/// 帮助按钮 +@property (nonatomic,strong)UIButton *helpBtn; + +@property (nonatomic,strong)UILabel *timeLabel; + +@property (nonatomic,strong)UIButton *delayBtn; +@property (nonatomic,strong)UIButton *endBtn; +@property (nonatomic,strong)UIButton *startBtn; +/// 被签约人 +@property (nonatomic,strong)QXRoomSeatContentView *signView; + +/// 价格视图 +@property (nonatomic,strong)UIView *priceView; +@property (nonatomic,strong)UIView *priceBottomView; +@property (nonatomic,strong)UIImageView *priceTitleImageView; +@property (nonatomic,strong)UIImageView *priceImageView; +@property (nonatomic,strong)UILabel *priceLabel; + +@property (nonatomic,strong)UIImageView *dayImageView; +@property (nonatomic,strong)UILabel *dayLabel; + +/// 申请上麦 +@property (nonatomic,strong)UIButton *applyBtn; +@property (nonatomic,strong)UIButton *signBtn; +@property (nonatomic,strong)UIButton *showTimeBtn; +/// 师傅视图 +@property (nonatomic,strong)UIView *masterView; +@property (nonatomic,strong)UIImageView *masterBgImageView; +@property (nonatomic,strong)QXRoomSeatContentView *masterSeatView; + +/// 老板视图 +@property (nonatomic,strong)UIView *bossView; +@property (nonatomic,strong)UIImageView *bossBgImageView; +@property (nonatomic,strong)QXRoomSeatContentView *bossSeatView1; +@property (nonatomic,strong)QXRoomSeatContentView *bossSeatView2; +@property (nonatomic,strong)QXRoomSeatContentView *bossSeatView3; + +@property (nonatomic,strong)NSMutableArray *seatArray; + + +/// 定时器 +@property (nonatomic,strong)QXTimer *timer; +@property (nonatomic,assign)NSInteger startTime; +@property (nonatomic,strong)UILabel *tenSecondLabel; + +@property (nonatomic,strong)QXSignCoinListView *coinView; +@end + +@implementation QXRoomSeatTypeSignView + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self initSubviews]; + } + return self; +} +-(void)initSubviews{ + self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_content_bg"]]; + self.bgImageView.contentMode = UIViewContentModeScaleToFill; + [self addSubview:self.bgImageView]; + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(10); + make.left.mas_equalTo(16); + make.right.mas_equalTo(-16); + make.height.mas_equalTo(ScaleWidth(315)); + }]; + + self.compereView = [[QXRoomSeatContentView alloc] init]; + self.compereView.delegate = self; + self.compereView.tagString = QXText(@"主持"); + self.compereView.number = 9; + [self addSubview:self.compereView]; + [self.compereView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.bgImageView).offset(5); + make.width.mas_equalTo(ScaleWidth(50)); + make.height.mas_equalTo(ScaleWidth(50-10)+51); + make.left.equalTo(self.bgImageView).offset(20); + }]; + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:18]; + self.titleLabel.textColor = RGB16(0xffffff); + self.titleLabel.text = @"签约房"; + [self addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.top.equalTo(self.bgImageView).offset(8); + make.height.mas_equalTo(20); + }]; + + self.helpBtn = [[UIButton alloc] init]; + [self.helpBtn setImage:[UIImage imageNamed:@"room_auction_help"] forState:(UIControlStateNormal)]; + [self.helpBtn addTarget:self action:@selector(helpAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.helpBtn]; + [self.helpBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(10); + make.right.mas_equalTo(-15); + make.height.width.mas_equalTo(45); + }]; + + self.timeLabel = [[UILabel alloc] init]; + self.timeLabel.font = [UIFont systemFontOfSize:11]; + self.timeLabel.textColor = RGB16(0xffffff); + self.timeLabel.text = @"倒计时 00:00"; + self.timeLabel.hidden = YES; + [self addSubview:self.timeLabel]; + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.top.equalTo(self.titleLabel.mas_bottom); + make.height.mas_equalTo(12); + }]; + + self.startBtn = [[UIButton alloc] init]; + [self.startBtn setTitle:@"开始" forState:(UIControlStateNormal)]; + [self.startBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.startBtn.titleLabel.font = [UIFont systemFontOfSize:12]; + [self.startBtn addRoundedCornersWithRadius:ScaleWidth(9)]; + [self.startBtn addTarget:self action:@selector(startAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.startBtn.backgroundColor = QXConfig.themeColor; + self.startBtn.hidden = NO; + [self addSubview:self.startBtn]; + [self.startBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.top.equalTo(self.titleLabel.mas_bottom); + make.height.mas_equalTo(ScaleWidth(18)); + make.width.mas_equalTo(ScaleWidth(40)); + }]; + + self.delayBtn = [[UIButton alloc] init]; + [self.delayBtn setTitle:@"延时" forState:(UIControlStateNormal)]; + [self.delayBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.delayBtn.titleLabel.font = [UIFont systemFontOfSize:12]; + [self.delayBtn addRoundedCornersWithRadius:ScaleWidth(9)]; + [self.delayBtn addTarget:self action:@selector(delayAction) forControlEvents:(UIControlEventTouchUpInside)]; + self.delayBtn.backgroundColor = QXConfig.themeColor; + self.delayBtn.hidden = YES; + [self addSubview:self.delayBtn]; + [self.delayBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.timeLabel.mas_left).offset(-4); + make.height.mas_equalTo(ScaleWidth(18)); + make.width.mas_equalTo(ScaleWidth(40)); + make.centerY.equalTo(self.timeLabel); + }]; + + self.endBtn = [[UIButton alloc] init]; + [self.endBtn setTitle:@"结束" forState:(UIControlStateNormal)]; + [self.endBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)]; + self.endBtn.titleLabel.font = [UIFont systemFontOfSize:12]; + [self.endBtn addTarget:self action:@selector(endAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.endBtn addRoundedCornersWithRadius:ScaleWidth(9)]; + self.endBtn.backgroundColor = RGB16(0x333333); + self.endBtn.hidden = YES; + [self addSubview:self.endBtn]; + [self.endBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.timeLabel.mas_right).offset(4); + make.height.mas_equalTo(ScaleWidth(18)); + make.centerY.equalTo(self.timeLabel); + make.width.mas_equalTo(ScaleWidth(40)); + }]; + + self.signView = [[QXRoomSeatContentView alloc] init]; + self.signView.delegate = self; + self.signView.number = 1; + self.signView.numberString = @"虚位以待"; + [self addSubview:self.signView]; + [self.signView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(ScaleWidth(78)+10-5); + make.width.mas_equalTo(ScaleWidth(55)); + make.height.mas_equalTo(ScaleWidth(55-10)+51); + make.centerX.mas_equalTo(self); + }]; + + self.applyBtn = [[UIButton alloc] init]; + [self.applyBtn addTarget:self action:@selector(applyAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.applyBtn setBackgroundImage:[UIImage imageNamed:@"room_sign_apply_seat"] forState:(UIControlStateNormal)]; + [self addSubview:self.applyBtn]; + [self.applyBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self); + make.width.mas_equalTo(ScaleWidth(83)); + make.height.mas_equalTo(ScaleWidth(28)); + make.top.mas_equalTo(ScaleWidth(152)+10); + }]; + + self.masterView = [[UIView alloc] init]; + [self addSubview:self.masterView]; + [self.masterView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bgImageView).offset(8); + make.bottom.mas_equalTo(-8); + make.width.mas_equalTo(ScaleWidth(88)); + make.height.mas_equalTo(ScaleWidth(111)); + }]; + + self.masterBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_master_bg"]]; + [self.masterView addSubview:self.masterBgImageView]; + [self.masterBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.masterView); + }]; + + self.masterSeatView = [[QXRoomSeatContentView alloc] init]; + self.masterSeatView.delegate = self; + self.masterSeatView.number = 2; + self.masterSeatView.numberString = @"虚位以待"; + [self.masterView addSubview:self.masterSeatView]; + [self.masterSeatView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(ScaleWidth(26)); + make.width.mas_equalTo(ScaleWidth(55)); + make.height.mas_equalTo(ScaleWidth(55-10)+30); + make.centerX.equalTo(self.masterView); + }]; + + self.bossView = [[UIView alloc] init]; + [self addSubview:self.bossView]; + [self.bossView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.masterView.mas_right).offset(8); + make.bottom.top.equalTo(self.masterView); + make.right.equalTo(self.bgImageView).offset(-8); + }]; + + self.bossBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_boss_bg"]]; + [self.bossView addSubview:self.bossBgImageView]; + [self.bossBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.bossView); + }]; + + + self.bossSeatView2 = [[QXRoomSeatContentView alloc] init]; + self.bossSeatView2.delegate = self; + self.bossSeatView2.number = 4; + self.bossSeatView2.numberString = @"虚位以待"; + [self.bossView addSubview:self.bossSeatView2]; + [self.bossSeatView2 mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(ScaleWidth(32)); + make.centerX.equalTo(self.bossView); + make.width.mas_equalTo(ScaleWidth(55)); + make.height.mas_equalTo(ScaleWidth(55-10)+30); + }]; + + self.bossSeatView1 = [[QXRoomSeatContentView alloc] init]; + self.bossSeatView1.delegate = self; + self.bossSeatView1.number = 3; + self.bossSeatView1.numberString = @"虚位以待"; + [self.bossView addSubview:self.bossSeatView1]; + [self.bossSeatView1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.bossSeatView2.mas_left).offset(-20); + make.centerY.equalTo(self.bossSeatView2); + make.width.mas_equalTo(ScaleWidth(55)); + make.height.mas_equalTo(ScaleWidth(55-10)+30); + }]; + + self.bossSeatView3 = [[QXRoomSeatContentView alloc] init]; + self.bossSeatView3.delegate = self; + self.bossSeatView3.number = 5; + self.bossSeatView3.numberString = @"虚位以待"; + [self.bossView addSubview:self.bossSeatView3]; + [self.bossSeatView3 mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bossSeatView2.mas_right).offset(20); + make.centerY.equalTo(self.bossSeatView2); + make.width.mas_equalTo(ScaleWidth(55)); + make.height.mas_equalTo(ScaleWidth(55-10)+30); + }]; + + self.priceView = [[UIView alloc] init]; + [self addSubview:self.priceView]; + [self.priceView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bgImageView).offset(22); + make.width.mas_equalTo(ScaleWidth(84)); + make.height.mas_equalTo(ScaleWidth(80)); + make.top.mas_equalTo(ScaleWidth(100)); + }]; + + self.priceTitleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_title_image"]]; + [self.priceView addSubview:self.priceTitleImageView]; + [self.priceTitleImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.priceView); + make.width.mas_equalTo(ScaleWidth(56)); + make.height.mas_equalTo(ScaleWidth(15)); + make.top.equalTo(self.priceView); + }]; + + self.priceBottomView = [[UIView alloc] init]; + self.priceBottomView.backgroundColor = RGB16A(0x000000,0.4); + [self.priceBottomView addRoundedCornersWithRadius:4]; + [self.priceView insertSubview:self.priceBottomView belowSubview:self.priceTitleImageView]; + [self.priceBottomView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.equalTo(self.priceView); + make.top.mas_equalTo(ScaleWidth(8)); + }]; + + self.priceImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"wallet_corn"]]; + [self.priceBottomView addSubview:self.priceImageView]; + [self.priceImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.priceView); + make.width.mas_equalTo(ScaleWidth(40)); + make.height.mas_equalTo(ScaleWidth(40)); + make.top.mas_equalTo(12); + }]; + + self.priceLabel = [[UILabel alloc] init]; + self.priceLabel.font = [UIFont systemFontOfSize:12]; + self.priceLabel.textColor = RGB16(0xffffff); + self.priceLabel.text = @"0"; + [self.priceBottomView addSubview:self.priceLabel]; + [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.priceBottomView); + make.top.equalTo(self.priceImageView.mas_bottom); + make.height.mas_equalTo(14); + }]; + + self.dayLabel = [[UILabel alloc] init]; + self.dayLabel.font = [UIFont systemFontOfSize:13]; + self.dayLabel.textColor = RGB16(0xffffff); +// self.dayLabel.text = @"签约7天"; + [self addSubview:self.dayLabel]; + [self.dayLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.bgImageView.mas_right).offset(-18); + make.top.equalTo(self.priceView).offset(8); + make.height.mas_equalTo(15); + }]; + + self.dayImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_sign_time_image"]]; + [self addSubview:self.dayImageView]; + [self.dayImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self.dayLabel); + make.width.mas_equalTo(ScaleWidth(13)); + make.height.mas_equalTo(ScaleWidth(13)); + make.right.equalTo(self.dayLabel.mas_left); + }]; + + self.signBtn = [[UIButton alloc] init]; + [self addSubview:self.signBtn]; + self.signBtn.hidden = YES; + [self.signBtn setBackgroundImage:[UIImage imageNamed:@"room_sign_btn"] forState:(UIControlStateNormal)]; + [self.signBtn addTarget:self action:@selector(signAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.signBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bossView.mas_top); + make.width.mas_equalTo(ScaleWidth(86)); + make.height.mas_equalTo(ScaleWidth(34)); + make.centerX.equalTo(self); + }]; + + self.showTimeBtn = [[UIButton alloc] init]; + self.showTimeBtn.hidden = YES; + [self addSubview:self.showTimeBtn]; + [self.showTimeBtn setBackgroundImage:[UIImage imageNamed:@"room_sign_show_time"] forState:(UIControlStateNormal)]; + [self.showTimeBtn addTarget:self action:@selector(showTimeAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.showTimeBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.signBtn); + }]; + + [self addSubview:self.tenSecondLabel]; + [self.tenSecondLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.centerY.equalTo(self); + }]; + + /// 1 号麦 + [self.seatArray addObject:self.signView]; + /// 2号麦 + [self.seatArray addObject:self.masterSeatView]; + /// 3号麦 + [self.seatArray addObject:self.bossSeatView1]; + /// 4号麦 + [self.seatArray addObject:self.bossSeatView2]; + /// 5号麦 + [self.seatArray addObject:self.bossSeatView3]; + ///6 号麦 (占位) + [self.seatArray addObject:[QXRoomSeatContentView new]]; + ///7 号麦 (占位) + [self.seatArray addObject:[QXRoomSeatContentView new]]; + ///8 号麦 (占位) + [self.seatArray addObject:[QXRoomSeatContentView new]]; + /// 主持麦 9号麦 + [self.seatArray addObject:self.compereView]; + [self resetviews]; +} + +-(void)resetviews{ + self.signBtn.hidden = YES; + self.showTimeBtn.hidden = YES; + self.priceView.hidden = YES; + self.priceLabel.text = @"0"; + self.endBtn.hidden = YES; + self.timeLabel.hidden = YES; + self.delayBtn.hidden = YES; + + self.applyBtn.hidden = NO; + self.startBtn.hidden = NO; +} + +-(void)setRoomModel:(QXRoomModel *)roomModel{ + _roomModel = roomModel; + for (int i = 0 ; i < roomModel.room_info.pit_list.count;i++) { + QXRoomPitModel *pitModel = roomModel.room_info.pit_list[i]; + if (pitModel.pit_number.intValue == 6 || pitModel.pit_number.intValue == 7 || pitModel.pit_number.intValue == 8 || pitModel.pit_number.intValue > 9) { + continue; + } + QXRoomSeatContentView *contentView = self.seatArray[i]; + contentView.pitModel = pitModel; + if (pitModel.pit_number.intValue == 9 || pitModel.pit_number.intValue == 1) { + continue; + }else{ + [contentView hideCharm]; + } + } + self.priceLabel.text = self.roomModel.sign_info.current_body_value; + self.dayLabel.text = [NSString stringWithFormat:@"签约%@天",self.roomModel.sign_info.sign_day]; + self.myPitNumber = roomModel.user_info.pit_number.integerValue; + [self configStatus]; + if (self.roomModel.sign_info.sign_status.intValue == 1) { + [self startTimer]; + } +} +-(void)configStatus{ + if (self.roomModel.sign_info.sign_status.intValue == 0) { + /// 未开始 + if (self.myPitNumber == 9) { + if (self.signView.pitModel.user_id.longLongValue>0) { + self.startBtn.hidden = NO; + self.endBtn.hidden = YES; + self.delayBtn.hidden = YES; + self.timeLabel.hidden = YES; + }else{ + self.startBtn.hidden = YES; + self.endBtn.hidden = YES; + self.delayBtn.hidden = YES; + self.timeLabel.hidden = YES; + } + }else{ + self.startBtn.hidden = YES; + self.endBtn.hidden = YES; + self.delayBtn.hidden = YES; + self.timeLabel.hidden = YES; + } + self.priceView.hidden = YES; + self.dayImageView.hidden = YES; + self.dayLabel.hidden = YES; + if (self.myPitNumber>0) { + self.applyBtn.hidden = YES; + }else{ + if (self.signView.pitModel.user_id.longLongValue > 0) { + self.applyBtn.hidden = YES; + }else{ + self.applyBtn.hidden = NO; + } + } + self.showTimeBtn.hidden = YES; + self.signBtn.hidden = YES; + }else{ + if (self.myPitNumber == 9 || self.roomModel.user_info.is_host.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1 || self.roomModel.user_info.is_room_owner.intValue == 1) { + self.endBtn.hidden = NO; + self.delayBtn.hidden = NO; + }else{ + self.endBtn.hidden = YES; + self.delayBtn.hidden = YES; + } + self.applyBtn.hidden = YES; + self.startBtn.hidden = YES; + self.timeLabel.hidden = NO; + self.priceView.hidden = NO; + self.dayImageView.hidden = NO; + self.dayLabel.hidden = NO; + [self cofignBtn]; + } + +} + +-(void)cofignBtn{ + if (self.myPitNumber == 1) { + self.showTimeBtn.hidden = NO; + self.signBtn.hidden = YES; + }else{ + self.showTimeBtn.hidden = YES; + self.signBtn.hidden = NO; + } + +} +-(void)helpAction{ + NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",ServerUrl,@"32"]; + QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init]; + vc.urlStr = urlString; + [self.viewController.navigationController pushViewController:vc animated:YES]; +} +-(void)startAction{ + if (self.signView.pitModel.user_id.longLongValue <= 0) { + showToast(@"签约座位暂无人员"); + return; + } + [QXMineNetwork signStartWithRoomId:self.roomModel.room_info.room_id userId:self.signView.pitModel.user_id successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)delayAction{ + [QXMineNetwork signDelayWithSignId:self.roomModel.sign_info.sign_id successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)endAction{ + QXCustomAlertView *alert = [[QXCustomAlertView alloc] init]; + [alert showInView:self.viewController.view title:@"您确定要结束本场签约吗" message:@"" cancleTitle:@"取消" commitTitle:@"确定"]; + + __weak typeof(self) weakSelf = self; + alert.commitBlock = ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + NSLog(@"⚠️ self has been deallocated, skipping hide operation"); + return; + } + [strongSelf signEndNetwork]; + }; +} + +-(void)signEndNetwork{ + [QXMineNetwork signEndWithSignId:self.roomModel.sign_info.sign_id successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)applyAction{ + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"1" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)signAction{ + self.coinView.signId = self.roomModel.sign_info.sign_id; + self.coinView.pitModel = self.signView.pitModel; + [self.coinView showInView:self.viewController.view]; +} + +-(void)coinListDidClickRecharge{ + if (_coinView) { + [_coinView hide]; + } + QXRechargeView *recharge = [[QXRechargeView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)]; + recharge.isPop = YES; + [recharge showInView:self.viewController.view]; +} + +-(void)coinListDidSignWithCoin:(NSString *)coin{ + [QXProjectTools vibrationFeedback]; + [QXMineNetwork signCoinWithSign_value:coin sign_id:self.roomModel.sign_info.sign_id successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} + +-(void)showTimeAction{ + QXSignShowTimeView *view = [[QXSignShowTimeView alloc] init]; + [view showInView:self.viewController.view]; +} +-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel seatView:(QXRoomSeatContentView *)seatView{ + NSString *pit_number = [NSString stringWithFormat:@"%ld",seatView.number] ; + QXLOG(@"点击了%ld麦位",seatView.number); + if (seatView.pitModel.user_id.longLongValue > 0) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:userModel:isPkRoom:pkRoomId:isNoTakeOff:)]) { + [self.delegate didClickUserHeaderWithPitModel:seatView.pitModel userModel:nil isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO]; + } + }else{ + if (seatView.number == 9) { + /// 麦位没人时点9号麦直接请求上麦 + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + return; + }else if(seatView.number == 2){ + return; + }else if (seatView.number == 1 || seatView.number == 3 || seatView.number == 4 || seatView.number == 5) { + if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { + [self.delegate didHugSeatWithPitNumber:pitModel.pit_number]; + } + } + return; + }else{ + + } + } + +} +-(void)previewRoomUserCharmListWithUserId:(NSString *)userId{ + if (self.delegate && [self.delegate respondsToSelector:@selector(previewRoomUserCharmListWithUserId:)]) { + [self.delegate previewRoomUserCharmListWithUserId:userId]; + } +} +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ + if (pit_number > 10 || pit_number == 6 || pit_number == 7 || pit_number == 8) { + return; + } + QXRoomSeatContentView *contentView = self.seatArray[pit_number-1]; + QXRoomPitModel *model = contentView.pitModel; + if (isUpSeat) { + model.user_id = user.user_id; + model.avatar = user.avatar; + model.dress = user.dress; + model.sex = user.sex; + model.nickname = user.nickname; + model.user_code = user.user_code; + model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; + }else{ + model.user_id = @"0"; + model.avatar = @""; + model.dress = @""; + model.sex = @""; + model.nickname = @""; + model.user_code = @""; + model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; + if (contentView.isSeatSpeaking) { + [contentView stopAudioAnimation]; + } + } + if ([user.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { + if (isUpSeat) { + self.myPitNumber = pit_number; + }else{ + self.myPitNumber = -1; + } + }else{ + + } + contentView.pitModel = model; + if (contentView.number == 9 || contentView.number == 1) { + + }else{ + [contentView hideCharm]; + } + /// 有人上了1号麦的话中间申请上麦按钮隐藏 + if (pit_number == 1 && isUpSeat) { + self.applyBtn.hidden = YES; + }else{ + self.applyBtn.hidden = NO; + } + [self configStatus]; +} +-(void)clearCharm{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *model = seatView.pitModel; + model.charm = @"0"; + [seatView updateUserCharm:model.charm]; + } +} +-(void)roomClearUserCharmWithUserId:(NSString *)userId{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *model = seatView.pitModel; + if ([model.user_id isEqualToString:userId]) { + model.charm = @"0"; + [seatView updateUserCharm:model.charm]; + break; + } + } +} +-(void)setSeatCharmWithUser:(QXUserHomeModel *)model{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *md = seatView.pitModel; + if ([model.user_id isEqualToString:md.user_id]) { + [seatView updateUserCharm:model.charm]; + break; + } + } +} +-(void)setSeatCharmWithUsers:(NSArray *)users{ + for (QXUserHomeModel*model in users) { + [self setSeatCharmWithUser:model]; + } +} + +-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK{ + if (fromPitNumber == 0 || toPitNumber == 0) { + return; + } + if (toPitNumber > 10 || toPitNumber == 6 || toPitNumber == 7 || toPitNumber == 8) { + return; + } + QXRoomSeatContentView *fromSeatView = self.seatArray[fromPitNumber-1]; + QXRoomSeatContentView *toSeatView = self.seatArray[toPitNumber-1]; + QXRoomPitModel *fromPitModel = fromSeatView.pitModel; + QXRoomPitModel *totModel = toSeatView.pitModel; + + NSString* tmpPitNum = [NSString stringWithFormat:@"%@",fromPitModel.pit_number]; + fromPitModel.pit_number = totModel.pit_number; + totModel.pit_number = tmpPitNum; + NSMutableArray*arr = [NSMutableArray arrayWithArray:self.roomModel.room_info.pit_list]; + if (toPitNumber <= arr.count) { + [arr exchangeObjectAtIndex:fromPitNumber-1 withObjectAtIndex:toPitNumber-1]; + } + self.roomModel.room_info.pit_list = arr; + toSeatView.pitModel = fromPitModel; + fromSeatView.pitModel = totModel; + if (toSeatView.number == 9 || toSeatView.number == 1) { + + }else{ + [toSeatView hideCharm]; + } + if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.myPitNumber = toPitNumber; + } + [self configStatus]; +} +-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *md = seatView.pitModel; + if ([user.user_id isEqualToString:md.user_id]) { + md.dress = user.dress; + md.nickname = user.nickname; + md.sex = user.sex; + md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; + seatView.pitModel = md; + if (seatView.number == 9 || seatView.number == 1) { + + }else{ + [seatView hideCharm]; + } + break; + } + } +} + +-(void)signDidStartWithEndTime:(NSString *)endTime signId:(NSString *)signId signDay:(NSString*)signDay signValue:(NSString*)signValue{ + QXSignAlertView *startView = [[QXSignAlertView alloc] initWithType:(QXSignAlerTypeStart)]; + [startView showInView:self.viewController.view]; + self.roomModel.sign_info.sign_id = signId; + self.roomModel.sign_info.sign_status = @"1"; + self.roomModel.sign_info.end_time = endTime; + self.roomModel.sign_info.sign_day = signDay; + self.roomModel.sign_info.current_body_value = signValue; + self.dayLabel.text = [NSString stringWithFormat:@"签约%@天",self.roomModel.sign_info.sign_day]; + self.priceLabel.text = self.roomModel.sign_info.current_body_value; + [self configStatus]; + [self startTimer]; +} +/// 签约结束 +-(void)signDidEndWithUserInfo1:(QXUserHomeModel*)userInfo1 userInfo2:(QXUserHomeModel*)userInfo2 sign_value:(NSString*)sign_value{ + if (userInfo1 && userInfo2) { + QXSignAlertView *startView = [[QXSignAlertView alloc] initWithType:(QXSignAlerTypeSuccess)]; + [startView showInView:self.viewController.view]; + }else{ + QXSignAlertView *startView = [[QXSignAlertView alloc] initWithType:(QXSignAlerTypeFail)]; + [startView showInView:self.viewController.view]; + } + self.roomModel.sign_info.sign_id = @""; + self.roomModel.sign_info.sign_status = @"0"; + [self configStatus]; + [self stopTimer]; + if (_coinView) { + [_coinView hide]; + } +} +/// 签约身价变化 +-(void)signValueDidChangedWithSignUserInfo:(QXUserHomeModel*)signUserInfo sign_value:(NSString*)sign_value signId:(NSString*)signId sign_coin_list:(NSArray*)sign_coin_list{ + if (![self.roomModel.sign_info.sign_id isEqualToString:signId]) { + showToast(@"场次错误"); + return; + } +// self.priceLabel.text = sign_value; + if (_coinView) { + [_coinView refreshCoinListWith:sign_coin_list]; + } +} +/// 签约发生延时 +-(void)signTimeDelayWithEndTime:(NSString*)endTime{ + self.roomModel.sign_info.end_time = endTime; + [self startTimer]; +} + +-(void)startTimer{ + + NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970]; + // 将秒转换为毫秒 + long long milliseconds = (long long)(timeInterval); + self.startTime = self.roomModel.sign_info.end_time.longLongValue - milliseconds; + if (self.startTime <= 0) { + //时间错误不进行倒计时 + self.timeLabel.text = @"倒计时:00:00:00"; + return; + } + [self stopTimer]; + __weak typeof(self) weakSelf = self; + _timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + NSLog(@"⚠️ self has been deallocated"); + return; + } + strongSelf.startTime--; + NSInteger hour = strongSelf.startTime/60/60; + NSInteger min = (strongSelf.startTime % 3600) / 60; + NSInteger second = strongSelf.startTime % 60; + if (strongSelf.startTime <= 10) { + strongSelf.tenSecondLabel.text = [NSString stringWithFormat:@"%ld",weakSelf.startTime]; + strongSelf.tenSecondLabel.hidden = NO; + [strongSelf addBoomAnimateWithView:weakSelf.tenSecondLabel isRepeat:NO duration:0.3 removedOnCompletion:YES]; + }else{ + strongSelf.tenSecondLabel.hidden = YES; + } + strongSelf.timeLabel.text = [NSString stringWithFormat:@"倒计时:%02ld:%02ld:%02ld",hour,min,(long)second]; + if (strongSelf.startTime<=0) { + [strongSelf stopTimer]; + strongSelf.tenSecondLabel.hidden = YES; + strongSelf.timeLabel.text = @"00:00:00"; + } + }); + }]; +} +-(void)addBoomAnimateWithView:(UIView*)view isRepeat:(BOOL)isRepeat duration:(CGFloat)duration removedOnCompletion:(BOOL)removedOnCompletion{ + CABasicAnimation *anima = [CABasicAnimation animation]; + anima.keyPath = @"transform.scale"; + anima.fromValue = @1.0; + anima.toValue = @1.3; + if (isRepeat) { + anima.repeatCount = 99999; + }else{ + anima.repeatCount = 1; + } + anima.duration = duration==0?0.15:duration; + anima.autoreverses = YES; + anima.removedOnCompletion = removedOnCompletion; + [view.layer addAnimation:anima forKey:nil]; +} +-(void)stopTimer{ + if (_timer) { + [self->_timer invalidate]; + self->_timer= nil; + } + self.tenSecondLabel.hidden = YES; +} + +-(void)stopHWDMP4{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + if (seatView.pitModel) { + [seatView stopHWDMP4]; + } + } +} +-(void)playHWDMP4{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + if (seatView.pitModel) { + [seatView playHWDMP4]; + } + } +} + + +-(void)destroyViews{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + [seatView destroyViews]; + } + if (_timer) { + [_timer invalidate]; + _timer = nil; + } +} + +-(NSMutableArray *)seatArray{ + if (!_seatArray) { + _seatArray = [NSMutableArray array]; + } + return _seatArray; +} +-(UILabel *)tenSecondLabel{ + if (!_tenSecondLabel) { + _tenSecondLabel = [[UILabel alloc] init]; + _tenSecondLabel.font = [UIFont boldSystemFontOfSize:110]; + _tenSecondLabel.textColor = [UIColor whiteColor]; + _tenSecondLabel.hidden = YES; + _tenSecondLabel.textAlignment = NSTextAlignmentCenter; + } + return _tenSecondLabel; +} +-(QXSignCoinListView *)coinView{ + if (!_coinView) { + _coinView = [[QXSignCoinListView alloc] init]; + _coinView.delegate = self; + } + return _coinView; +} +@end diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h new file mode 100644 index 0000000..362de83 --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.h @@ -0,0 +1,65 @@ +// +// QXRoomSeatTypeSingerView.h +// QXLive +// +// Created by 启星 on 2025/11/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXRoomSeatTypeSingerView : UIView +@property (nonatomic,weak)iddelegate; +@property (nonatomic,assign)NSInteger myPitNumber; +@property (nonatomic,strong)QXRoomSeatContentView* mySeatView; +@property (nonatomic,strong)QXRoomModel *roomModel; + +/// 上下麦 +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK; +/// 清除魅力 +-(void)clearCharm; +/// 清除个人魅力 +-(void)roomClearUserCharmWithUserId:(NSString *)userId; +/// 设置魅力 +-(void)setSeatCharmWithUser:(QXUserHomeModel *)model; +/// 设置多人魅力 +-(void)setSeatCharmWithUsers:(NSArray*)users; +/// 设置麦位锁麦状态 +-(void)setSeatIsLock:(NSString*)isLock pitNumber:(NSString*)pitNumber; + +/// 房间内用户信息发生变化 +-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user; + +/// 房间内换麦 +-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK; + +/// 点唱房当前歌曲信息发生变化 +-(void)singerSongCurrentSongInfoDidChanged:(QXUserSongListModel*)model; +/// 点唱房下一首歌信息发生变化 +-(void)singerSongNextSongInfoDidChanged:(QXUserSongListModel*)model; +/// 已点歌曲数量发生变化 +-(void)singerSongCountDidChanged:(NSString*)count; + +-(void)stopHWDMP4; +-(void)playHWDMP4; +-(void)destroyViews; +@end + +@interface QXRoomSeatTypeSingerCompereView : UIView +@property (nonatomic,strong)UIImageView *bgImageView; +@property (nonatomic,strong)UIButton *contentViewNoBodyBtn; +@property (nonatomic,strong)QXRoomSeatContentView *contentView; +@property (nonatomic,strong)UIImageView *iconImageView; +@property (nonatomic,strong)UIImageView *nextHeaderImageView; +@property (nonatomic,strong)UILabel *nextTitleLabel; +@property (nonatomic,strong)UILabel *nextNameLabel; +@property (nonatomic,strong)QXRoomPitModel *model; +/// 是否为主持 +@property (nonatomic,assign)BOOL isCompere; + +@property (nonatomic,copy)void(^upSeatBlock)(void); +-(void)destroyViews; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m new file mode 100644 index 0000000..0a565d2 --- /dev/null +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSingerView.m @@ -0,0 +1,768 @@ +// +// QXRoomSeatTypeSingerView.m +// QXLive +// +// Created by 启星 on 2025/11/12. +// + +#import "QXRoomSeatTypeSingerView.h" +#import "QXRoomSeatContentView.h" +#import "QXRoomSeatSettingView.h" +#import "QXMineNetwork.h" +#import "QXSingerSongListView.h" + +@interface QXRoomSeatTypeSingerView() +@property (nonatomic,strong)QXRoomSeatSettingView *settingView; +@property (nonatomic,strong)QXRoomSeatTypeSingerCompereView *compereView; +@property (nonatomic,strong)QXRoomSeatTypeSingerCompereView *nextView; +@property (nonatomic,strong)UIView *singerContentView; +@property (nonatomic,strong)UIImageView *singerBgImageView; +@property (nonatomic,strong)QXRoomSeatContentView *bossView; +@property (nonatomic,strong)QXRoomSeatContentView *singerView; + +@property (nonatomic,strong)UIButton *nextBtn; +@property (nonatomic,strong)UIButton *songBtn; +@property (nonatomic,strong)UIImageView *songInfoBgImageView; +@property (nonatomic,strong)UILabel *songInfoLabel; + +@property (nonatomic,strong)NSMutableArray* seatArray; + +@property (nonatomic,strong)QXSingerSongListView *songListView; +@end +@implementation QXRoomSeatTypeSingerView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self initSubviews]; + } + return self; +} + +-(void)initSubviews{ + + + self.singerContentView = [[UIView alloc] init]; + [self addSubview:self.singerContentView]; + [self.singerContentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self); + make.width.mas_equalTo(ScaleWidth(253)); + make.height.mas_equalTo(ScaleWidth(164)+20); + make.centerX.equalTo(self); + }]; + self.compereView = [[QXRoomSeatTypeSingerCompereView alloc] initWithFrame:CGRectMake(0, 28, 98, 78)]; + self.compereView.contentView.delegate = self; + self.compereView.contentView.number = 9; + self.compereView.isCompere = YES; + MJWeakSelf + self.compereView.upSeatBlock = ^{ + [weakSelf upseatCompere]; + }; + [self addSubview:self.compereView]; + + + self.nextView = [[QXRoomSeatTypeSingerCompereView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-98, 28, 98, 78)]; + self.nextView.isCompere = NO; + self.nextView.hidden = YES; + [self.nextView addTapBlock:^(id _Nonnull obj) { + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:userModel:isPkRoom:pkRoomId:isNoTakeOff:)]) { + [weakSelf.delegate didClickUserHeaderWithPitModel:weakSelf.nextView.model userModel:nil isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO]; + } + }]; + [self addSubview:self.nextView]; + + + self.singerBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_type_singer_singer_bg"]]; + [self.singerContentView addSubview:self.singerBgImageView]; + [self.singerBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(10); + make.left.right.equalTo(self.singerContentView); + make.bottom.mas_equalTo(-10); + }]; + + self.bossView = [[QXRoomSeatContentView alloc] init]; + self.bossView.noMicCycle = YES; + self.bossView.tagString = @"老板"; + self.bossView.delegate = self; + self.bossView.number = 10; + self.bossView.tagViewBgColor = @"#04040473"; + [self.bossView hideCharm]; + [self.bossView hideName]; + [self.singerContentView addSubview:self.bossView]; + [self.bossView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.singerContentView); + make.width.mas_equalTo(46); + make.height.mas_equalTo(46-10+30); + make.right.mas_equalTo(-ScaleWidth(52)); + }]; + + self.singerView = [[QXRoomSeatContentView alloc] init]; + [self.singerView hideCharm]; + [self.singerView hideName]; + self.singerView.noUserImageView.image = [UIImage imageNamed:@"room_seat_singer"]; + self.singerView.delegate = self; + [self.singerContentView addSubview:self.singerView]; + [self.singerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(ScaleWidth(63)); + make.height.mas_equalTo(ScaleWidth(63)); + make.centerX.centerY.equalTo(self.singerContentView); + }]; + + self.nextBtn = [[UIButton alloc] init]; + [self.nextBtn setBackgroundImage:[UIImage imageNamed:@"room_type_singer_next_btn"] forState:(UIControlStateNormal)]; + self.nextBtn.hidden = YES; + [self.singerContentView addSubview:self.nextBtn]; + [self.nextBtn addTarget:self action:@selector(nextAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.nextBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.singerContentView); + make.bottom.mas_equalTo(-15); + make.width.mas_equalTo(ScaleWidth(80)); + make.height.mas_equalTo(ScaleWidth(38)); + }]; + + self.songBtn = [[UIButton alloc] init]; + [self.songBtn setBackgroundImage:[UIImage imageNamed:@"room_type_singer_song_btn"] forState:(UIControlStateNormal)]; + [self.singerContentView addSubview:self.songBtn]; + [self.songBtn addTarget:self action:@selector(songAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self.songBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.singerContentView); + make.bottom.mas_equalTo(-15); + make.width.mas_equalTo(ScaleWidth(80)); + make.height.mas_equalTo(ScaleWidth(38)); + }]; + + self.songInfoBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_song_name_bg"]]; + [self.singerContentView addSubview:self.songInfoBgImageView]; + [self.songInfoBgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.equalTo(self.singerContentView); + make.bottom.equalTo(self.singerContentView); + make.height.mas_equalTo(24); + make.width.mas_equalTo(180); + }]; + + self.songInfoLabel = [[UILabel alloc] init]; + self.songInfoLabel.font = [UIFont boldSystemFontOfSize:14]; + self.songInfoLabel.textColor = RGB16(0xFFE100); + self.songInfoLabel.text = @"暂无歌曲"; + self.songInfoLabel.textAlignment = NSTextAlignmentCenter; + [self.singerContentView addSubview:self.songInfoLabel]; + [self.songInfoLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.equalTo(self.singerContentView); + make.bottom.equalTo(self.singerContentView); + make.height.mas_equalTo(24); + }]; + + + NSInteger lineItemCount = 4; + CGFloat leftMargin = 20; + CGFloat topSpace = 0; + CGFloat seatWidth = ScaleWidth(60); + CGFloat seatHeight = ScaleWidth(60-10)+51; + CGFloat itemSpace = (SCREEN_WIDTH-leftMargin*2-seatWidth*lineItemCount)/(lineItemCount-1); + for (int i = 0 ; i < 8 ; i++) { + QXRoomSeatContentView *contentView = [[QXRoomSeatContentView alloc] init]; + contentView.number = i+1; + contentView.noOffLine = NO; + contentView.noUserImageView.image = [UIImage imageNamed:@"room_seat_singer"]; + contentView.delegate = self; + [self addSubview:contentView]; + [contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.singerContentView.mas_bottom).offset(1+(seatHeight+topSpace)*(i/4)); + make.left.equalTo(self).offset(leftMargin+(seatWidth+itemSpace)*(i%4)); + make.size.mas_equalTo(CGSizeMake(seatWidth, seatHeight)); + }]; + [self.seatArray addObject:contentView]; + } + + [self.seatArray addObject:self.compereView.contentView]; +// [self.seatArray addObject:self.bossView]; +} +-(void)nextAction{ + [QXMineNetwork requsetSongNextActionWithId:self.roomModel.singer_info.song_info.id successBlock:^(NSDictionary * _Nonnull dict) { + showToast(@"切歌成功"); + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)songAction{ + NSMutableArray *arr= [NSMutableArray array]; + for (QXRoomSeatContentView*seatView in self.seatArray) { + if (seatView.pitModel.user_id.longLongValue > 0) { + if (![seatView.pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + if (seatView.number != 9) { + [arr addObject:seatView.pitModel]; + } + } + } + } + self.songListView.roomId = self.roomModel.room_info.room_id; + [self.songListView showInView:self.viewController.view pitArray:arr isCompere:self.myPitNumber==9]; +} +-(void)configNextBtn{ + if (self.myPitNumber == 9 || [self.roomModel.singer_info.song_info.singer_user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.nextBtn.hidden = NO; + }else{ + self.nextBtn.hidden = YES; + } +} + +-(void)configSingerSeat{ + for (QXRoomSeatContentView*seatView in self.seatArray) { + if ([seatView.pitModel.user_id isEqualToString:self.roomModel.singer_info.song_info.singer_user_id]) { + if (seatView.pitModel.pit_number.intValue == 9 ) { + seatView.tagString = @""; + }else{ + seatView.tagString = @"演唱者"; + } + }else{ + seatView.tagString = @""; + } + } +} +-(void)setRoomModel:(QXRoomModel *)roomModel{ + _roomModel = roomModel; + for (int i = 0 ; i < roomModel.room_info.pit_list.count;i++) { + QXRoomPitModel *pitModel = roomModel.room_info.pit_list[i]; + if (i > self.seatArray.count -1) { + break; + } + QXRoomSeatContentView *contentView = self.seatArray[i]; + contentView.pitModel = pitModel; + if ([pitModel.pit_number isEqualToString:@"9"]) { + if (pitModel.user_id.longLongValue > 0) { + self.compereView.contentView.hidden = NO; + self.compereView.contentViewNoBodyBtn.hidden = YES; + }else{ + self.compereView.contentView.hidden = YES; + self.compereView.contentViewNoBodyBtn.hidden = NO; + } + } + } + [self singerSongCurrentSongInfoDidChanged:roomModel.singer_info.song_info]; + [self singerSongNextSongInfoDidChanged:roomModel.singer_info.next_song_info]; + self.myPitNumber = roomModel.user_info.pit_number.integerValue; + [self configNextBtn]; +} + +-(void)upseatCompere{ + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:@"9" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; +} +-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel seatView:(QXRoomSeatContentView *)seatView{ + NSString *pit_number = [NSString stringWithFormat:@"%ld",seatView.number] ; + QXLOG(@"点击了%ld麦位",seatView.number); + if (seatView.pitModel.user_id.longLongValue > 0) { + if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:userModel:isPkRoom:pkRoomId:isNoTakeOff:)]) { + [self.delegate didClickUserHeaderWithPitModel:seatView.pitModel userModel:nil isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO]; + } + }else{ + if (seatView == self.singerView) { + return; + } + if (seatView.number == 9) { + /// 麦位没人时点9号麦直接请求上麦 + [self upseatCompere]; + return; + }else if (seatView.number == 10) { +// if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1) { +// if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { +// [self.delegate didHugSeatWithPitNumber:@"10"]; +// } +// }else{ +// showToast(@"请等待主持抱麦"); +// } + showToast(@"暂无老板"); + return; + }else{ + if (self.myPitNumber == 9) { + MJWeakSelf + /// 自己在9号麦 管理麦位 + QXRoomPitModel *pitModel = seatView.pitModel; + self.settingView.roomId = self.roomModel.room_info.room_id; + self.settingView.pitModel = pitModel; + self.settingView.setSuccessBlock = ^(QXRoomPitModel * _Nonnull pitModel) { + seatView.pitModel = pitModel; +// if (self.isPKMyRoom || self.isPKOtherRoom) { +// [seatView hideCharm]; +// } + }; + self.settingView.clickHugBlock = ^(QXRoomPitModel * _Nonnull pitModel) { +// [weakSelf showOnlineListWithPitNumber:pitModel.pit_number]; + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { + [weakSelf.delegate didHugSeatWithPitNumber:pitModel.pit_number]; + } + }; + [self.settingView showInView:self.viewController.view]; + }else{ + if (self.roomModel.room_info.room_up_pit_type.intValue == 2) { + /// 自由麦请求 + [QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) { + + } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) { + showToast(msg); + }]; + }else{ + // 排麦模式 弹出上麦 + if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1 || self.roomModel.user_info.is_host.intValue == 1) { + MJWeakSelf + /// 自己在9号麦 管理麦位 + QXRoomPitModel *pitModel = seatView.pitModel; + self.settingView.roomId = self.roomModel.room_info.room_id; + self.settingView.pitModel = pitModel; + self.settingView.setSuccessBlock = ^(QXRoomPitModel * _Nonnull pitModel) { + seatView.pitModel = pitModel; + // if (self.isPKMyRoom || self.isPKOtherRoom) { + // [seatView hideCharm]; + // } + }; + self.settingView.clickHugBlock = ^(QXRoomPitModel * _Nonnull pitModel) { + // [weakSelf showOnlineListWithPitNumber:pitModel.pit_number]; + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) { + [weakSelf.delegate didHugSeatWithPitNumber:pitModel.pit_number]; + } + }; + [self.settingView showInView:self.viewController.view]; + } + } + } + } + } + +} +-(void)previewRoomUserCharmListWithUserId:(NSString *)userId{ + if (self.delegate && [self.delegate respondsToSelector:@selector(previewRoomUserCharmListWithUserId:)]) { + [self.delegate previewRoomUserCharmListWithUserId:userId]; + } +} +-(void)clearCharm{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *model = seatView.pitModel; + model.charm = @"0"; +// seatView.pitModel = model; + [seatView updateUserCharm:model.charm]; +// if (self.isPKMyRoom || self.isPKOtherRoom) { +// [seatView hideCharm]; +// } + } +} +-(void)roomClearUserCharmWithUserId:(NSString *)userId{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *model = seatView.pitModel; + if ([model.user_id isEqualToString:userId]) { + model.charm = @"0"; +// seatView.pitModel = model; + [seatView updateUserCharm:model.charm]; + break; + } +// if (self.isPKMyRoom || self.isPKOtherRoom) { +// [seatView hideCharm]; +// } + } +} + +-(void)setSeatCharmWithUser:(QXUserHomeModel *)model{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *md = seatView.pitModel; + if ([model.user_id isEqualToString:md.user_id]) { +// md.charm = model.charm; +// seatView.pitModel = md; + [seatView updateUserCharm:model.charm]; +// if (self.isPKMyRoom || self.isPKOtherRoom) { +// [seatView hideCharm]; +// } + break; + } + } +} +-(void)setSeatCharmWithUsers:(NSArray *)users{ + for (QXUserHomeModel*model in users) { + [self setSeatCharmWithUser:model]; + } +} + +-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK{ + if (fromPitNumber == 0 || toPitNumber == 0) { + return; + } + QXRoomSeatContentView *fromSeatView = self.seatArray[fromPitNumber-1]; + QXRoomSeatContentView *toSeatView = self.seatArray[toPitNumber-1]; + QXRoomPitModel *fromPitModel = fromSeatView.pitModel; + QXRoomPitModel *totModel = toSeatView.pitModel; + if (toPitNumber == 9) { + self.compereView.contentView.hidden = NO; + self.compereView.contentViewNoBodyBtn.hidden = YES; + } +// else{ +// self.compereView.contentView.hidden = YES; +// self.compereView.contentViewNoBodyBtn.hidden = NO; +// } + NSString* tmpPitNum = [NSString stringWithFormat:@"%@",fromPitModel.pit_number]; + fromPitModel.pit_number = totModel.pit_number; + totModel.pit_number = tmpPitNum; + NSMutableArray*arr = [NSMutableArray arrayWithArray:self.roomModel.room_info.pit_list]; + if (toPitNumber <= arr.count) { + [arr exchangeObjectAtIndex:fromPitNumber-1 withObjectAtIndex:toPitNumber-1]; + } + self.roomModel.room_info.pit_list = arr; + toSeatView.pitModel = fromPitModel; + fromSeatView.pitModel = totModel; + if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) { + self.myPitNumber = toPitNumber; + } + [self configNextBtn]; + [self configSingerSeat]; +// /// 循环麦位视图数组 +// for (UIView *view in self.seatArray) { +// /// 如果当前视图的类型为麦位视图 +// if ([view isKindOfClass:[QXRoomSeatContentView class]]) { +// QXRoomSeatContentView *seatView = (QXRoomSeatContentView*)view; +// /// 如果换麦的用户id等于视图上当前绑定的用户id +// if ([userInfo.user_id isEqualToString:seatView.pitModel.user_id]) { +// /// 如果视图的麦位号不是目标麦位号 (为了处理后端推送异常是产生多个同一个用户) +// if (seatView.pitModel.pit_number.intValue != toPitNumber) { +// /// 置空麦位用户 +// QXRoomPitModel *model = seatView.pitModel; +// model.user_id = @"0"; +// model.avatar = @""; +// model.dress = @""; +// model.sex = @""; +// model.nickname = @""; +// model.user_code = @""; +// model.charm = @""; +// seatView.pitModel = model; +// } +// } +// } +// } +} + +-(void)setSeatIsLock:(NSString *)isLock pitNumber:(NSString *)pitNumber{ + NSInteger pit_number = pitNumber.integerValue; + QXRoomSeatContentView *contentView = self.seatArray[pit_number-1]; + contentView.is_lock = isLock; +} + +-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + QXRoomPitModel *md = seatView.pitModel; + if ([user.user_id isEqualToString:md.user_id]) { + md.dress = user.dress; + md.nickname = user.nickname; + md.sex = user.sex; + md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; + seatView.pitModel = md; + break; + } + } +} +/// 点唱房当前歌曲信息发生变化 +-(void)singerSongCurrentSongInfoDidChanged:(QXUserSongListModel*)model{ + self.roomModel.singer_info.song_info = model; + QXRoomPitModel *bossPitModel = self.bossView.pitModel; + if (bossPitModel==nil) { + bossPitModel = [[QXRoomPitModel alloc] init]; + } + QXRoomPitModel *singerPitModel = self.singerView.pitModel; + if (singerPitModel==nil) { + singerPitModel = [[QXRoomPitModel alloc] init]; + } + if (model) { + bossPitModel.nickname = model.boss_nickname; + bossPitModel.avatar = model.boss_avatar; + bossPitModel.mic_cycle = model.boss_mic_cycle; + bossPitModel.user_id = model.boss_user_id; + bossPitModel.dress = model.boss_dress; + + singerPitModel.nickname = model.singer_nickname; + singerPitModel.avatar = model.singer_avatar; + singerPitModel.mic_cycle = model.singer_mic_cycle; + singerPitModel.user_id = model.singer_user_id; + singerPitModel.dress = model.singer_dress; + self.songInfoLabel.text = [NSString stringWithFormat:@"演唱歌曲:%@",model.song_name]; + }else{ + bossPitModel.nickname = @""; + bossPitModel.mic_cycle = @""; + bossPitModel.user_id = @"0"; + bossPitModel.avatar = @""; + bossPitModel.dress = @""; + + singerPitModel.nickname = @""; + singerPitModel.mic_cycle = @""; + singerPitModel.user_id = @"0"; + singerPitModel.avatar = @""; + singerPitModel.dress = @""; + self.songInfoLabel.text = [NSString stringWithFormat:@"暂无歌曲"]; + } + self.bossView.pitModel = bossPitModel; + self.singerView.pitModel = singerPitModel; + [self.bossView hideCharm]; + [self.bossView hideName]; + [self.singerView hideCharm]; + [self.singerView hideName]; + [self configNextBtn]; + [self configSingerSeat]; +} +/// 点唱房下一首歌信息发生变化 +-(void)singerSongNextSongInfoDidChanged:(QXUserSongListModel*)model{ + self.roomModel.singer_info.next_song_info = model; + QXRoomPitModel *pitModel = self.nextView.model; + if (pitModel==nil) { + pitModel = [[QXRoomPitModel alloc] init]; + } + if (model) { + pitModel.nickname = model.singer_nickname; + pitModel.avatar = model.singer_avatar; + pitModel.mic_cycle = model.singer_mic_cycle; + pitModel.user_id = model.singer_user_id; + pitModel.dress = model.singer_dress; + self.nextView.hidden = NO; + }else{ + pitModel.nickname = @""; + pitModel.mic_cycle = @""; + pitModel.user_id = @"0"; + pitModel.avatar = @""; + pitModel.dress = @""; + self.nextView.hidden = YES; + } + self.nextView.model = pitModel; +} +/// 已点歌曲数量发生变化 +-(void)singerSongCountDidChanged:(NSString*)count{ + [self.songListView updateAlreadyCountWithCount:count]; +} + + +-(void)stopHWDMP4{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + [seatView stopHWDMP4]; + } +} +-(void)playHWDMP4{ + for (QXRoomSeatContentView *seatView in self.seatArray) { + [seatView playHWDMP4]; + } +} +/// 上下麦 +-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK{ + if (pit_number > 10) { + return; + } + if (pit_number == 9) { + if (isUpSeat) { + self.compereView.contentView.hidden = NO; + self.compereView.contentViewNoBodyBtn.hidden = YES; + }else{ + self.compereView.contentView.hidden = YES; + self.compereView.contentViewNoBodyBtn.hidden = NO; + } + } + QXRoomSeatContentView *contentView = self.seatArray[pit_number-1]; + QXRoomPitModel *model = contentView.pitModel; + if (isUpSeat) { + model.user_id = user.user_id; + model.avatar = user.avatar; + model.dress = user.dress; + model.sex = user.sex; + model.nickname = user.nickname; + model.user_code = user.user_code; + model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; + }else{ + model.user_id = @"0"; + model.avatar = @""; + model.dress = @""; + model.sex = @""; + model.nickname = @""; + model.user_code = @""; + model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; + if (contentView.isSeatSpeaking) { + [contentView stopAudioAnimation]; + } + } + if ([user.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) { + if (isUpSeat) { + self.myPitNumber = pit_number; + }else{ + self.myPitNumber = -1; + } + } + contentView.pitModel = model; + [self configNextBtn]; + [self configSingerSeat]; +} + +-(QXRoomSeatSettingView *)settingView{ + if (!_settingView) { + _settingView = [[QXRoomSeatSettingView alloc] init]; + } + return _settingView; +} +-(QXSingerSongListView *)songListView{ + if (!_songListView) { + _songListView = [[QXSingerSongListView alloc] init]; + } + return _songListView; +} + +-(void)destroyViews{ + [self.compereView destroyViews]; + [self.nextView destroyViews]; + for (QXRoomSeatContentView *contentView in self.seatArray) { + [contentView destroyViews]; + } +} + +-(NSMutableArray *)seatArray{ + if (!_seatArray) { + _seatArray = [NSMutableArray array]; + } + return _seatArray; +} + +@end + + +@implementation QXRoomSeatTypeSingerCompereView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self initSubviews]; + } + return self; +} +-(void)setIsCompere:(BOOL)isCompere{ + _isCompere = isCompere; + self.bgImageView.image = [UIImage imageNamed:isCompere?@"room_type_singer_compere_bg":@"room_type_singer_next_bg"]; + self.iconImageView.image = [UIImage imageNamed:isCompere?@"room_type_singer_compere_icon":@"room_type_singer_next_icon"]; +// self.contentView.hidden = !isCompere; + self.contentViewNoBodyBtn.hidden = !isCompere; + self.nextHeaderImageView.hidden = isCompere; + self.nextNameLabel.hidden = isCompere; + self.nextTitleLabel.hidden = isCompere; + if (isCompere) { + [self.iconImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-11); + make.width.mas_equalTo(30); + make.height.mas_equalTo(16); + make.top.equalTo(self); + }]; + }else{ + [self.iconImageView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(11); + make.width.mas_equalTo(30); + make.height.mas_equalTo(16); + make.top.equalTo(self); + }]; + } +} +-(void)setModel:(QXRoomPitModel *)model{ + _model = model; + if (self.isCompere) { + self.contentView.pitModel = model; + }else{ + [self.nextHeaderImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar]]; + self.nextNameLabel.text = model.nickname; + } +} + +-(void)upseatAction{ + if (self.upSeatBlock) { + self.upSeatBlock(); + } +} + +-(void)initSubviews{ + self.iconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_type_singer_compere_icon"]]; + [self addSubview:self.iconImageView]; + [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-11); + make.width.mas_equalTo(30); + make.height.mas_equalTo(16); + make.top.equalTo(self); + }]; + + self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_type_singer_compere_bg"]]; + [self addSubview:self.bgImageView]; + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.equalTo(self); + make.top.equalTo(self.iconImageView).offset(8); + }]; + + self.contentViewNoBodyBtn = [[UIButton alloc] init]; + [self.contentViewNoBodyBtn setBackgroundImage:[UIImage imageNamed:@"room_seat_icon"] forState:(UIControlStateNormal)]; + [self.contentViewNoBodyBtn addTarget:self action:@selector(upseatAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.contentViewNoBodyBtn]; + [self.contentViewNoBodyBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(36); + make.height.mas_equalTo(36); + make.centerX.centerY.equalTo(self.bgImageView); + }]; + + self.contentView = [[QXRoomSeatContentView alloc] init]; + self.contentView.nameToHeaderSpace = -5; + self.contentView.charmToNameSpace = 0; + self.contentView.nameBeyound = YES; + self.contentView.hidden = YES; + self.contentView.nameFontSize = 12; + [self addSubview:self.contentView]; + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.bgImageView); + make.width.mas_equalTo(46); + make.height.mas_equalTo(46-10+51); + make.centerX.equalTo(self.bgImageView); + }]; + + self.nextTitleLabel = [[UILabel alloc] init]; + self.nextTitleLabel.textColor = RGB16A(0xFFFFFF,0.65); + self.nextTitleLabel.text = @"下一位\n准备"; + self.nextTitleLabel.numberOfLines = 2; + self.nextTitleLabel.font = [UIFont systemFontOfSize:11]; + [self addSubview:self.nextTitleLabel]; + [self.nextTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(10); + make.centerY.equalTo(self.bgImageView); + }]; + + self.nextHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_seat_singer"]]; + [self.nextHeaderImageView addRoundedCornersWithRadius:16]; + self.nextHeaderImageView.contentMode = UIViewContentModeScaleToFill; + [self addSubview:self.nextHeaderImageView]; + [self.nextHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-15); + make.width.height.mas_equalTo(32); + make.top.equalTo (self.bgImageView).offset(10); + }]; + + + self.nextNameLabel = [[UILabel alloc] init]; + self.nextNameLabel.textColor = RGB16(0xEFEAFF); + self.nextNameLabel.font = [UIFont systemFontOfSize:12]; + self.nextNameLabel.text = @"暂无"; + [self addSubview:self.nextNameLabel]; + [self.nextNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.nextHeaderImageView.mas_bottom).offset(2); + make.centerX.equalTo(self.nextHeaderImageView); + }]; + [self bringSubviewToFront:self.iconImageView]; +} + +-(void)destroyViews{ + [self.contentView destroyViews]; +} +@end + + diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m index 1786fde..b1c43b3 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatTypeSongView.m @@ -302,6 +302,9 @@ QXRoomSeatDelegate model.nickname = user.nickname; model.user_code = user.user_code; model.charm = user.charm; + model.nobility_image = user.nobility_image; + model.nickname_color = user.nickname_color; + model.mic_cycle = user.mic_cycle; // [self.dataArray removeAllObjects]; // [self.dataArray addObjectsFromArray:self.roomModel.song_pit_list]; if (contentView == nil) { @@ -315,6 +318,9 @@ QXRoomSeatDelegate model.nickname = @""; model.user_code = @""; model.charm = @""; + model.nobility_image = @""; + model.nickname_color = @""; + model.mic_cycle = @""; if (contentView) { if (contentView.isSeatSpeaking) { [contentView stopAudioAnimation]; @@ -443,6 +449,9 @@ QXRoomSeatDelegate singer.nickname = self.roomModel.song_user_info.nickname; singer.charm = self.roomModel.song_user_info.charm; singer.dress = self.roomModel.song_user_info.dress; + singer.nobility_image = self.roomModel.song_user_info.nobility_image; + singer.nickname_color = self.roomModel.song_user_info.nickname_color; + singer.mic_cycle = self.roomModel.song_user_info.mic_cycle; [self.dataArray removeAllObjects]; self.singerSeatView.pitModel = singer; for (QXRoomPitModel *model in roomModel.room_info.pit_list) { @@ -582,6 +591,9 @@ QXRoomSeatDelegate singerModel.nickname = user.nickname; singerModel.sex = user.sex; singerModel.avatar = user.avatar; + singerModel.nobility_image = user.nobility_image; + singerModel.nickname_color = user.nickname_color; + singerModel.mic_cycle = user.mic_cycle; self.singerSeatView.pitModel = singerModel; } QXRoomPitModel *compereModel = self.compereView.pitModel; @@ -590,6 +602,9 @@ QXRoomSeatDelegate compereModel.nickname = user.nickname; compereModel.sex = user.sex; compereModel.avatar = user.avatar; + compereModel.nobility_image = user.nobility_image; + compereModel.nickname_color = user.nickname_color; + compereModel.mic_cycle = user.mic_cycle; self.compereView.pitModel = compereModel; } QXRoomPitModel *guestModel = self.guestView.pitModel; @@ -598,6 +613,9 @@ QXRoomSeatDelegate guestModel.nickname = user.nickname; guestModel.sex = user.sex; guestModel.avatar = user.avatar; + guestModel.nobility_image = user.nobility_image; + guestModel.nickname_color = user.nickname_color; + guestModel.mic_cycle = user.mic_cycle; self.guestView.pitModel = guestModel; } for (QXRoomPitModel *md in self.dataArray) { @@ -606,6 +624,9 @@ QXRoomSeatDelegate md.nickname = user.nickname; md.sex = user.sex; md.avatar = user.avatar; + md.nobility_image = user.nobility_image; + md.nickname_color = user.nickname_color; + md.mic_cycle = user.mic_cycle; break; } } @@ -714,6 +735,9 @@ QXRoomSeatDelegate singer.nickname = songInfo.nickname; singer.charm = songInfo.charm; singer.dress = songInfo.dress; + singer.nobility_image = songInfo.nobility_image; + singer.nickname_color = songInfo.nickname_color; + singer.mic_cycle = songInfo.mic_cycle; self.singerSeatView.pitModel = singer; // if (singer.user_id.intValue > 0) { // [self.seatDict setObject:self.singerSeatView forKey:singer.user_id]; diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h index 9e01892..14b9e2a 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.h @@ -10,6 +10,7 @@ #import "QXRoomModel.h" #import "QXRoomSeatDelegate.h" #import "QXRoomFriendRelationModel.h" +#import "QXUserSongListModel.h" NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger) { @@ -26,6 +27,10 @@ typedef NS_ENUM(NSInteger) { QXRoomSeatViewTypePK, /// 交友房 QXRoomSeatViewTypeFriend, + /// 点唱 + QXRoomSeatViewTypeSinger, + /// 签约房 + QXRoomSeatViewTypeSign }QXRoomSeatViewType; @@ -116,6 +121,24 @@ typedef NS_ENUM(NSInteger) { -(void)friendCabinRoomIsQuit; /// 私密小屋时间发生延时 -(void)friendCabinRoomTimeDelayWithTime:(NSString*)end_time; + + + +/// 点唱房当前歌曲信息发生变化 +-(void)singerSongCurrentSongInfoDidChanged:(QXUserSongListModel*)model; +/// 点唱房下一首歌信息发生变化 +-(void)singerSongNextSongInfoDidChanged:(QXUserSongListModel*)model; +/// 已点歌曲数量发生变化 +-(void)singerSongCountDidChanged:(NSString*)count; + +/// 签约开始 +-(void)signDidStartWithEndTime:(NSString *)endTime signId:(NSString *)signId signDay:(NSString*)signDay signValue:(NSString*)signValue; +/// 签约结束 +-(void)signDidEndWithUserInfo1:(QXUserHomeModel*)userInfo1 userInfo2:(QXUserHomeModel*)userInfo2 sign_value:(NSString*)sign_value; +/// 签约身价变化 +-(void)signValueDidChangedWithSignUserInfo:(QXUserHomeModel*)signUserInfo sign_value:(NSString*)sign_value signId:(NSString*)signId sign_coin_list:(NSArray*)sign_coin_list; +/// 签约身价变化 +-(void)signTimeDelayWithEndTime:(NSString*)endTime; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m index 38f0754..9f297b6 100644 --- a/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m +++ b/QXLive/Room(房间)/View/麦位视图/QXRoomSeatView.m @@ -14,22 +14,30 @@ #import "QXRoomSeatPKView.h" #import "QXRoomSeatTypeFrientView.h" #import "QXRoomUserCharmView.h" +#import "QXRoomSeatTypeSingerView.h" +#import "QXRoomSeatTypeSignView.h" @interface QXRoomSeatView() +/// 二卡八 @property (nonatomic,strong)QXRoomSeatTypeNormalView *normalSeatView; - +/// K歌房 @property (nonatomic,strong)QXRoomSeatTypeSongView *songView; - +/// 拍卖房 @property (nonatomic,strong)QXRoomSeatTypeAuctionView *auctionView; - +/// 在线列表 @property (nonatomic,strong) QXRoomOnlineUserListView *onlineListView; - +/// 私密小屋 @property (nonatomic,strong)QXRoomSeatTypeCabinView *cabinView; - +/// PK @property (nonatomic,strong)QXRoomSeatPKView *roomPkView; - +/// 交友房 @property (nonatomic,strong)QXRoomSeatTypeFrientView *roomFriendView; +/// 点唱房 +@property (nonatomic,strong)QXRoomSeatTypeSingerView *singerView; +/// 签约房 +@property (nonatomic,strong)QXRoomSeatTypeSignView *signView; + @property (nonatomic,strong)QXRoomUserCharmView *charmListView; @end @@ -48,83 +56,27 @@ //初始化普通视图 -(void)initNomarlView{ -// if (_songView) { -// [_songView removeFromSuperview]; -// _songView = nil; -// } -// + if (_singerView) { + [self hideSinggerViewBlock:^{ + [self showNormalView]; + }]; + return; + } if (_songView) { -// [_normalSeatView removeFromSuperview]; -// _normalSeatView = nil; - [[QXAgoraEngine sharedEngine] ktv_EndSing]; - _songView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_songView destroyViews]; - [self->_songView removeFromSuperview]; - self->_songView = nil; - [self addSubview:self.normalSeatView]; - [self.normalSeatView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.normalSeatView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideSongViewBlock:^{ + [self showNormalView]; }]; return; } if (_auctionView) { -// [_normalSeatView removeFromSuperview]; -// _normalSeatView = nil; - [[QXAgoraEngine sharedEngine] ktv_EndSing]; - _auctionView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - if (self->_auctionView.auctionInfoView != nil) { - [self->_auctionView.auctionInfoView hide]; - } - [self->_auctionView destroyViews]; - [self->_auctionView removeFromSuperview]; - self->_auctionView = nil; - [self addSubview:self.normalSeatView]; - [self.normalSeatView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.normalSeatView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideAuctionViewBlock:^{ + [self showNormalView]; + }]; + return; + } + if (_signView) { + [self hideSignViewBlock:^{ + [self showNormalView]; }]; return; } @@ -142,55 +94,13 @@ [self->_roomPkView destroyViews]; [self->_roomPkView removeFromSuperview]; self->_roomPkView = nil; - [self addSubview:self.normalSeatView]; - [self.normalSeatView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.normalSeatView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self showNormalView]; }]; return; } if (_roomFriendView) { - _roomFriendView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_roomFriendView destroyViews]; - [self->_roomFriendView removeFromSuperview]; - self->_roomFriendView = nil; - [self addSubview:self.normalSeatView]; - [self.normalSeatView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.normalSeatView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideRoomFriendBlock:^{ + [self showNormalView]; }]; return; } @@ -199,143 +109,73 @@ make.left.right.top.bottom.equalTo(self); }]; } +-(void)showNormalView{ + [self addSubview:self.normalSeatView]; + [self.normalSeatView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.normalSeatView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideNormalViewBlock:(void(^)(void))completion{ + _normalSeatView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + [self->_normalSeatView destroyViews]; + [self->_normalSeatView removeFromSuperview]; + self->_normalSeatView = nil; + if (completion) { + completion(); + } + }]; +} //初始化拍卖视图 -(void)initAuctionView{ + if (_singerView) { + [self hideSinggerViewBlock:^{ + [self showAuctionView]; + }]; + return; + } if (_normalSeatView) { -// [_normalSeatView removeFromSuperview]; -// _normalSeatView = nil; - _normalSeatView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_normalSeatView destroyViews]; - [self->_normalSeatView removeFromSuperview]; - self->_normalSeatView = nil; - [self addSubview:self.auctionView]; - [self.auctionView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.auctionView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideNormalViewBlock:^{ + [self showAuctionView]; }]; return; } if (_songView) { -// [_normalSeatView removeFromSuperview]; -// _normalSeatView = nil; - [[QXAgoraEngine sharedEngine] ktv_EndSing]; - _songView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_songView destroyViews]; - [self->_songView removeFromSuperview]; - self->_songView = nil; - [self addSubview:self.auctionView]; - [self.auctionView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.auctionView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; - }]; - return; - } - if (_roomPkView) { - _roomPkView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_roomPkView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_roomPkView destroyViews]; - [self->_roomPkView removeFromSuperview]; - self->_roomPkView = nil; - [self addSubview:self.auctionView]; - [self.auctionView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.auctionView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideSongViewBlock:^{ + [self showAuctionView]; }]; return; } if (_roomFriendView) { - _roomFriendView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_roomFriendView destroyViews]; - [self->_roomFriendView removeFromSuperview]; - self->_roomFriendView = nil; - [self addSubview:self.auctionView]; - [self.auctionView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.auctionView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideRoomFriendBlock:^{ + [self showAuctionView]; + }]; + return; + } + if (_signView) { + [self hideSignViewBlock:^{ + [self showAuctionView]; }]; return; } @@ -344,143 +184,76 @@ make.left.right.top.bottom.equalTo(self); }]; } +-(void)showAuctionView{ + [self addSubview:self.auctionView]; + [self.auctionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.auctionView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideAuctionViewBlock:(void(^)(void))completion{ + _auctionView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + if (self->_auctionView.auctionInfoView != nil) { + [self->_auctionView.auctionInfoView hide]; + } + [self->_auctionView destroyViews]; + [self->_auctionView removeFromSuperview]; + self->_auctionView = nil; + if (completion) { + completion(); + } + }]; +} -//初始化点唱 +//初始化ktv -(void)initSingView{ + if (_singerView) { + [self hideSinggerViewBlock:^{ + [self showSongView]; + }]; + return; + } if (_normalSeatView) { -// [_normalSeatView removeFromSuperview]; -// _normalSeatView = nil; - _normalSeatView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_normalSeatView destroyViews]; - [self->_normalSeatView removeFromSuperview]; - self->_normalSeatView = nil; - [self addSubview:self.songView]; - [self.songView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.songView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideNormalViewBlock:^{ + [self showSongView]; }]; return; } if (_auctionView) { - _auctionView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - if (self->_auctionView.auctionInfoView != nil) { - [self->_auctionView.auctionInfoView hide]; - } - [self->_auctionView destroyViews]; - [self->_auctionView removeFromSuperview]; - self->_auctionView = nil; - [self addSubview:self.songView]; - [self.songView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.songView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; - }]; - return; - } - if (_roomPkView) { - _roomPkView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_roomPkView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_roomPkView destroyViews]; - [self->_roomPkView removeFromSuperview]; - self->_roomPkView = nil; - [self addSubview:self.songView]; - [self.songView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.songView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideAuctionViewBlock:^{ + [self showSongView]; }]; return; } if (_roomFriendView) { - _roomFriendView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_roomFriendView destroyViews]; - [self->_roomFriendView removeFromSuperview]; - self->_roomFriendView = nil; - [self addSubview:self.songView]; - [self.songView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.songView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideRoomFriendBlock:^{ + [self showSongView]; + }]; + return; + } + if (_signView) { + [self hideSignViewBlock:^{ + [self showSongView]; }]; return; } @@ -489,6 +262,44 @@ make.left.right.top.bottom.equalTo(self); }]; } +-(void)showSongView{ + [self addSubview:self.songView]; + [self.songView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.songView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.songView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideSongViewBlock:(void(^)(void))completion{ + [[QXAgoraEngine sharedEngine] ktv_EndSing]; + _songView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_songView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + [self->_songView destroyViews]; + [self->_songView removeFromSuperview]; + self->_songView = nil; + if (completion) { + completion(); + } + }]; +} - (void)initRoomPKView{ if (_normalSeatView) { @@ -526,150 +337,39 @@ }]; return; } - if (_songView) { -// [_normalSeatView removeFromSuperview]; -// _normalSeatView = nil; - [[QXAgoraEngine sharedEngine] ktv_EndSing]; - _songView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_songView destroyViews]; - [self->_songView removeFromSuperview]; - self->_songView = nil; - [self addSubview:self.roomPkView]; - [self.roomPkView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.roomPkView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.roomPkView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; - }]; - return; - } [self addSubview:self.roomPkView]; [self.roomPkView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.equalTo(self); }]; } -(void)initRoomFriendView{ + if (_singerView) { + [self hideSinggerViewBlock:^{ + [self showRoomFriendView]; + }]; + return; + } if (_normalSeatView) { - // [_normalSeatView removeFromSuperview]; - // _normalSeatView = nil; - _normalSeatView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_normalSeatView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_normalSeatView destroyViews]; - [self->_normalSeatView removeFromSuperview]; - self->_normalSeatView = nil; - [self addSubview:self.roomFriendView]; - [self.roomFriendView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.roomFriendView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideNormalViewBlock:^{ + [self showRoomFriendView]; }]; return; } if (_auctionView) { - _auctionView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_auctionView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - if (self->_auctionView.auctionInfoView != nil) { - [self->_auctionView.auctionInfoView hide]; - } - [self->_auctionView destroyViews]; - [self->_auctionView removeFromSuperview]; - self->_auctionView = nil; - [self addSubview:self.roomFriendView]; - [self.roomFriendView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.roomFriendView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideAuctionViewBlock:^{ + [self showRoomFriendView]; }]; return; } if (_songView) { - [[QXAgoraEngine sharedEngine] ktv_EndSing]; - _songView.transform = CGAffineTransformIdentity; - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self->_songView.transform = CGAffineTransformMakeScale(0.01, 0.01); - } completion:^(BOOL finished) { - [self->_songView destroyViews]; - [self->_songView removeFromSuperview]; - self->_songView = nil; - [self addSubview:self.roomFriendView]; - [self.roomFriendView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.top.bottom.equalTo(self); - }]; - self.roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); - // 弹性动画 - [UIView animateWithDuration:0.5 - delay:0 - usingSpringWithDamping:0.9 - initialSpringVelocity:0.1 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - self.roomFriendView.transform = CGAffineTransformIdentity; - } completion:^(BOOL finished) { - - }]; + [self hideSongViewBlock:^{ + [self showRoomFriendView]; + }]; + return; + } + if (_signView) { + [self hideSignViewBlock:^{ + [self showRoomFriendView]; }]; return; } @@ -678,6 +378,118 @@ make.left.right.top.bottom.equalTo(self); }]; } +-(void)showRoomFriendView{ + [self addSubview:self.roomFriendView]; + [self.roomFriendView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.roomFriendView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideRoomFriendBlock:(void(^)(void))completion{ + _roomFriendView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_roomFriendView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + [self->_roomFriendView destroyViews]; + [self->_roomFriendView removeFromSuperview]; + self->_roomFriendView = nil; + if (completion) { + completion(); + } + }]; +} + + +-(void)initSingerView{ + if (_roomFriendView) { + [self hideRoomFriendBlock:^{ + [self showSingerView]; + }]; + return; + } + if (_normalSeatView) { + [self hideNormalViewBlock:^{ + [self showSingerView]; + }]; + return; + } + if (_auctionView) { + [self hideAuctionViewBlock:^{ + [self showSingerView]; + }]; + return; + } + if (_songView) { + [self hideSongViewBlock:^{ + [self showSingerView]; + }]; + return; + } + if (_signView) { + [self hideSignViewBlock:^{ + [self showSingerView]; + }]; + return; + } + [self addSubview:self.singerView]; + [self.singerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; +} +-(void)showSingerView{ + [self addSubview:self.singerView]; + [self.singerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.singerView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.singerView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideSinggerViewBlock:(void(^)(void))completion{ + _singerView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_singerView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + [self->_singerView destroyViews]; + [self->_singerView removeFromSuperview]; + self->_singerView = nil; + if (completion) { + completion(); + } + }]; +} - (void)initCabinView{ self.cabinView = [[QXRoomSeatTypeCabinView alloc] init]; @@ -688,7 +500,80 @@ }]; } +-(void)initSignView{ + if (_roomFriendView) { + [self hideRoomFriendBlock:^{ + [self showSignView]; + }]; + return; + } + if (_normalSeatView) { + [self hideNormalViewBlock:^{ + [self showSignView]; + }]; + return; + } + if (_auctionView) { + [self hideAuctionViewBlock:^{ + [self showSignView]; + }]; + return; + } + if (_songView) { + [self hideSongViewBlock:^{ + [self showSignView]; + }]; + return; + } + if (_singerView) { + [self hideSinggerViewBlock:^{ + [self showSignView]; + }]; + return; + } + [self addSubview:self.signView]; + [self.signView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; +} +-(void)showSignView{ + [self addSubview:self.signView]; + [self.signView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.bottom.equalTo(self); + }]; + self.signView.transform = CGAffineTransformMakeScale(0.01, 0.01); + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self.signView.transform = CGAffineTransformIdentity; + } completion:^(BOOL finished) { + + }]; +} +-(void)hideSignViewBlock:(void(^)(void))completion{ + _signView.transform = CGAffineTransformIdentity; + // 弹性动画 + [UIView animateWithDuration:0.5 + delay:0 + usingSpringWithDamping:0.9 + initialSpringVelocity:0.1 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + self->_signView.transform = CGAffineTransformMakeScale(0.01, 0.01); + } completion:^(BOOL finished) { + [self->_signView destroyViews]; + [self->_signView removeFromSuperview]; + self->_signView = nil; + if (completion) { + completion(); + } + }]; +} -(void)setMyPitNumber:(NSInteger)myPitNumber{ _myPitNumber = myPitNumber; @@ -708,6 +593,12 @@ case QXRoomSeatViewTypeFriend: self.roomFriendView.myPitNumber = myPitNumber; break; + case QXRoomSeatViewTypeSinger: + self.singerView.myPitNumber = myPitNumber; + break; + case QXRoomSeatViewTypeSign: + self.signView.myPitNumber = myPitNumber; + break; default: break; } @@ -747,6 +638,14 @@ [self initRoomFriendView]; } break; + case QXRoomSeatViewTypeSinger:{ + [self initSingerView]; + } + break; + case QXRoomSeatViewTypeSign:{ + [self initSignView]; + } + break; default: break; } @@ -807,6 +706,13 @@ case QXRoomSeatViewTypeFriend: self.roomFriendView.roomModel = roomModel; break; + case QXRoomSeatViewTypeSinger: + self.singerView.roomModel = roomModel; + break; + case QXRoomSeatViewTypeSign:{ + self.signView.roomModel = roomModel; + } + break; default: break; } @@ -886,6 +792,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView clearCharm]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView clearCharm]; + break; + case QXRoomSeatViewTypeSign: + [self.signView clearCharm]; + break; default: break; } @@ -913,6 +825,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView roomClearUserCharmWithUserId:userId]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView roomClearUserCharmWithUserId:userId]; + break; + case QXRoomSeatViewTypeSign: + [self.signView roomClearUserCharmWithUserId:userId]; + break; default: break; } @@ -939,6 +857,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:userInfo isPK:isPK]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:userInfo isPK:isPK]; + break; + case QXRoomSeatViewTypeSign: + [self.signView roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:userInfo isPK:isPK]; + break; default: break; } @@ -966,6 +890,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView setSeatCharmWithUser:model]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView setSeatCharmWithUser:model]; + break; + case QXRoomSeatViewTypeSign: + [self.signView setSeatCharmWithUser:model]; + break; default: break; } @@ -994,6 +924,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView setSeatCharmWithUsers:users]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView setSeatCharmWithUsers:users]; + break; + case QXRoomSeatViewTypeSign: + [self.signView setSeatCharmWithUsers:users]; + break; default: break; } @@ -1019,6 +955,9 @@ case QXRoomSeatViewTypePK: [self.roomPkView setSeatIsLock:isLock pitNumber:pitNumber]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView setSeatIsLock:isLock pitNumber:pitNumber]; + break; default: break; } @@ -1173,18 +1112,6 @@ return _songView; } --(UIView*)getCurrentSeatView{ - if (_normalSeatView) { - return _normalSeatView; - } - if (_songView) { - return _songView; - } - if (_auctionView) { - return _auctionView; - } - return nil; -} -(void)didHugSeatWithPitNumber:(NSString *)pitNumber{ [self showOnlineListWithPitNumber:pitNumber]; @@ -1193,6 +1120,9 @@ if (self.roomModel == nil) { return; } + if (isUpSeat) { + [QXGlobal.shareGlobal.offLineDict setObject:[NSNumber numberWithInteger:user.is_online] forKey:user.user_id]; + } switch (self.type) { case QXRoomSeatViewTypeNormal: [self.normalSeatView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; @@ -1212,6 +1142,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + break; + case QXRoomSeatViewTypeSign: + [self.signView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number isPK:isPK]; + break; default: break; } @@ -1260,24 +1196,50 @@ self.onlineListView.roomId = self.roomModel.room_info.room_id; [self.onlineListView showInView:self.viewController.view]; } +/// 点唱房当前歌曲信息发生变化 +-(void)singerSongCurrentSongInfoDidChanged:(QXUserSongListModel*)model{ + if (_singerView) { + [self.singerView singerSongCurrentSongInfoDidChanged:model]; + } +} +/// 点唱房下一首歌信息发生变化 +-(void)singerSongNextSongInfoDidChanged:(QXUserSongListModel*)model{ + if (_singerView) { + [self.singerView singerSongNextSongInfoDidChanged:model]; + } +} +/// 已点歌曲数量发生变化 +-(void)singerSongCountDidChanged:(NSString*)count{ + if (_singerView) { + [self.singerView singerSongCountDidChanged:count]; + } +} + +-(void)signDidStartWithEndTime:(NSString *)endTime signId:(nonnull NSString *)signId signDay:(nonnull NSString *)signDay signValue:(nonnull NSString *)signValue{ + if (_signView) { + [self.signView signDidStartWithEndTime:endTime signId:signId signDay:signDay signValue:signValue]; + } +} +/// 签约结束 +-(void)signDidEndWithUserInfo1:(QXUserHomeModel*)userInfo1 userInfo2:(QXUserHomeModel*)userInfo2 sign_value:(NSString*)sign_value{ + if (_signView) { + [self.signView signDidEndWithUserInfo1:userInfo1 userInfo2:userInfo2 sign_value:sign_value]; + } +} +/// 签约身价变化 +-(void)signValueDidChangedWithSignUserInfo:(QXUserHomeModel*)signUserInfo sign_value:(NSString*)sign_value signId:(NSString*)signId sign_coin_list:(NSArray*)sign_coin_list{ + if (_signView) { + [self.signView signValueDidChangedWithSignUserInfo:signUserInfo sign_value:sign_value signId:signId sign_coin_list:sign_coin_list]; + } +} +/// 签约发生延时 +-(void)signTimeDelayWithEndTime:(NSString*)endTime{ + if (_signView) { + [self.signView signTimeDelayWithEndTime:endTime]; + } +} -(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{ -// if (_normalSeatView) { -// [self.normalSeatView roomUserInfoDidChanged:user]; -// return; -// } -// if (_songView) { -// [self.songView roomUserInfoDidChanged:user]; -// return; -// } -// if (_auctionView) { -// [self.auctionView roomUserInfoDidChanged:user]; -// return; -// } -// if (_roomPkView) { -// [self.roomPkView roomUserInfoDidChanged:user]; -// return; -// } switch (self.type) { case QXRoomSeatViewTypeNormal: [self.normalSeatView roomUserInfoDidChanged:user]; @@ -1297,6 +1259,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView roomUserInfoDidChanged:user]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView roomUserInfoDidChanged:user]; + break; + case QXRoomSeatViewTypeSign: + [self.signView roomUserInfoDidChanged:user]; + break; default: break; } @@ -1321,6 +1289,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView stopHWDMP4]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView stopHWDMP4]; + break; + case QXRoomSeatViewTypeSign: + [self.signView stopHWDMP4]; + break; default: break; } @@ -1345,6 +1319,12 @@ case QXRoomSeatViewTypeFriend: [self.roomFriendView playHWDMP4]; break; + case QXRoomSeatViewTypeSinger: + [self.singerView playHWDMP4]; + break; + case QXRoomSeatViewTypeSign: + [self.signView playHWDMP4]; + break; default: break; } @@ -1373,6 +1353,13 @@ [self.cabinView destroyViews]; _cabinView = nil; } + if (_singerView) { + [self.singerView destroyViews]; + _singerView = nil; + } + if (_signView) { + [_singerView destroyViews]; + } } -(QXRoomOnlineUserListView *)onlineListView{ @@ -1382,7 +1369,13 @@ } return _onlineListView; } - +-(QXRoomSeatTypeSingerView *)singerView{ + if (!_singerView) { + _singerView = [[QXRoomSeatTypeSingerView alloc] init]; + _singerView.delegate = self; + } + return _singerView; +} -(QXRoomSeatTypeAuctionView *)auctionView{ if (!_auctionView) { _auctionView = [[QXRoomSeatTypeAuctionView alloc] init]; @@ -1404,7 +1397,13 @@ } return _roomFriendView; } - +- (QXRoomSeatTypeSignView *)signView{ + if (!_signView) { + _signView = [[QXRoomSeatTypeSignView alloc] init]; + _signView.delegate = self; + } + return _signView; +} -(QXRoomUserCharmView *)charmListView{ if (!_charmListView) { _charmListView = [[QXRoomUserCharmView alloc] initWithFrame:[UIScreen mainScreen].bounds]; diff --git a/QXLive/Tabbar/QXTabbarController.m b/QXLive/Tabbar/QXTabbarController.m index f26c587..024e703 100644 --- a/QXLive/Tabbar/QXTabbarController.m +++ b/QXLive/Tabbar/QXTabbarController.m @@ -228,7 +228,7 @@ [self presentViewController:na animated:YES completion:nil]; return; } - if (to == 0) { + if (to == 0 || to == 3) { self.customTabBar.backgroundColor = RGB16(0x221E2B); }else{ self.customTabBar.backgroundColor = RGB16(0xffffff); diff --git a/QXLive/Tabbar/弹窗/QXAlertView.h b/QXLive/Tabbar/弹窗/QXAlertView.h index f92b626..c0790cd 100644 --- a/QXLive/Tabbar/弹窗/QXAlertView.h +++ b/QXLive/Tabbar/弹窗/QXAlertView.h @@ -18,7 +18,9 @@ typedef NS_ENUM(NSInteger) { /// pk弹窗 QXAlertViewTypeAgreePK, /// 没有取消 - QXAlertViewTypeNoCancel + QXAlertViewTypeNoCancel, + /// 签约麦 + QXAlertViewTypeSignSeat }QXAlertViewType; NS_ASSUME_NONNULL_BEGIN diff --git a/QXLive/Tabbar/弹窗/QXAlertView.m b/QXLive/Tabbar/弹窗/QXAlertView.m index b08d58f..19e38da 100644 --- a/QXLive/Tabbar/弹窗/QXAlertView.m +++ b/QXLive/Tabbar/弹窗/QXAlertView.m @@ -126,6 +126,23 @@ }]; } break; + case QXAlertViewTypeSignSeat:{ + @weakify(self) + [self.cancelBtn setTitle:QXText(@"拒绝") forState:(UIControlStateNormal)]; + [self.commitBtn setTitle:QXText(@"同意") forState:(UIControlStateNormal)]; + __block int timeCount = 5; + self.timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{ + @strongify(self); + timeCount--; + if (timeCount<=0) { + [self.timer invalidate]; + [self cancelAction]; + }else{ + [self.cancelBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"拒绝"),timeCount] forState:(UIControlStateNormal)]; + } + }]; + } + break; default: break; } diff --git a/QXLive/Tabbar/弹窗/QXCustomAlertView.h b/QXLive/Tabbar/弹窗/QXCustomAlertView.h index eb9425b..bba5d47 100644 --- a/QXLive/Tabbar/弹窗/QXCustomAlertView.h +++ b/QXLive/Tabbar/弹窗/QXCustomAlertView.h @@ -10,6 +10,11 @@ NS_ASSUME_NONNULL_BEGIN @interface QXCustomAlertView : UIView +@property (nonatomic,strong)NSString*title; +@property (nonatomic,strong)NSString*message; +@property (nonatomic,strong)NSString*cancleTitle; +@property (nonatomic,strong)NSString*commitTitle; +@property (nonatomic,assign)BOOL isFromController; @property (nonatomic,copy)void(^commitBlock)(void); @property (nonatomic,copy)void(^cancelBlock)(void); -(void)showInView:(UIView *)view title:(NSString*)title message:(NSString*)message cancleTitle:(NSString*)cancleTitle commitTitle:(NSString*)commitTitle; diff --git a/QXLive/Tabbar/弹窗/QXCustomAlertView.m b/QXLive/Tabbar/弹窗/QXCustomAlertView.m index efe1200..f08f9a4 100644 --- a/QXLive/Tabbar/弹窗/QXCustomAlertView.m +++ b/QXLive/Tabbar/弹窗/QXCustomAlertView.m @@ -27,7 +27,7 @@ -(void)initSubviews{ self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5]; - self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, -self.height, ScaleWidth(275), ScaleWidth(300))]; + self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(275))/2.0, 0, ScaleWidth(275), ScaleWidth(300))]; self.bgView.backgroundColor = [UIColor whiteColor]; self.bgView.layer.masksToBounds = YES; self.bgView.layer.cornerRadius = 16; @@ -44,20 +44,6 @@ make.height.mas_equalTo(24); }]; - self.messageLabel = [[UILabel alloc] init]; - self.messageLabel.font = [UIFont boldSystemFontOfSize:16]; -// self.messageLabel.text = QXText(@"您确定要清空背包吗?"); - self.messageLabel.textColor = RGB16(0x000000); - self.messageLabel.textAlignment = NSTextAlignmentCenter; - self.messageLabel.numberOfLines = 0; - [self.bgView addSubview:self.messageLabel]; - [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.bgView).offset(16); - make.right.equalTo(self.bgView).offset(-16); - make.centerY.equalTo(self.bgView); - }]; - - self.commitBtn = [[UIButton alloc] init]; [self.commitBtn addRoundedCornersWithRadius:21]; self.commitBtn.backgroundColor = QXConfig.themeColor; @@ -88,20 +74,76 @@ make.width.mas_equalTo(ScaleWidth(110)); make.left.mas_equalTo(20); }]; + + self.messageLabel = [[UILabel alloc] init]; + self.messageLabel.font = [UIFont systemFontOfSize:13]; +// self.messageLabel.text = QXText(@"您确定要清空背包吗?"); + self.messageLabel.textColor = RGB16(0x000000); + self.messageLabel.textAlignment = NSTextAlignmentCenter; + self.messageLabel.numberOfLines = 0; + [self.bgView addSubview:self.messageLabel]; + [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bgView).offset(16); + make.right.equalTo(self.bgView).offset(-16); + make.top.equalTo(self.titleLabel.mas_bottom).offset(13); + make.bottom.equalTo(self.commitBtn.mas_top).offset(-14); + }]; + + + +} +-(void)setTitle:(NSString *)title{ + _title = title; + self.titleLabel.text = title; +} + +-(void)setMessage:(NSString *)message{ + _message = message; + CGFloat messageHeight = [message heightForFont:[UIFont systemFontOfSize:13] width:ScaleWidth(275)-1-32]; + CGFloat contentHeight = 16+24+13+42+12+14+messageHeight; + if (contentHeight < 180) { + contentHeight = 180; + } + self.messageLabel.text = message; + self.bgView.height = contentHeight; + self.bgView.top = (SCREEN_HEIGHT-self.bgView.height)/2; +} + +-(void)setCancleTitle:(NSString *)cancleTitle{ + _cancleTitle = cancleTitle; + [self.cancelBtn setTitle:cancleTitle forState:(UIControlStateNormal)]; +} + +-(void)setCommitTitle:(NSString *)commitTitle{ + _commitTitle = commitTitle; + [self.commitBtn setTitle:commitTitle forState:(UIControlStateNormal)]; } -(void)cancelAction{ + if (self.isFromController) { + if (self.cancelBlock) { + self.cancelBlock(); + } + return; + } if (self.cancelBlock) { self.cancelBlock(); } [self hide]; } -(void)commitAction{ + if (self.isFromController) { + if (self.commitBlock) { + self.commitBlock(); + } + return; + } if (self.commitBlock) { self.commitBlock(); } [self hide]; } + -(void)showInView:(UIView *)view title:(NSString *)title message:(NSString *)message cancleTitle:(NSString *)cancleTitle commitTitle:(NSString *)commitTitle{ if ([title isExist]) { self.titleLabel.text = title; @@ -113,11 +155,18 @@ [self.cancelBtn setTitle:cancleTitle forState:(UIControlStateNormal)]; } if (commitTitle) { - [self.commitBtn setTitle:cancleTitle forState:(UIControlStateNormal)]; + [self.commitBtn setTitle:commitTitle forState:(UIControlStateNormal)]; } + CGFloat messageHeight = [message heightForFont:[UIFont systemFontOfSize:13] width:ScaleWidth(275)-1]; + CGFloat contentHeight = 16+24+13+42+12+14+messageHeight; + if (contentHeight < 180) { + contentHeight = 180; + } + self.bgView.height = contentHeight; + self.bgView.y = -view.height; [view addSubview:self]; [UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ - self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(362))/2.0; + self.bgView.y = (view.height-self.bgView.height)/2.0; } completion:^(BOOL finished) { }]; diff --git a/QXLive/Tabbar/弹窗/QXGiftCell.h b/QXLive/Tabbar/弹窗/QXGiftCell.h index c6a1aed..57e9b4f 100644 --- a/QXLive/Tabbar/弹窗/QXGiftCell.h +++ b/QXLive/Tabbar/弹窗/QXGiftCell.h @@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN @property (weak, nonatomic) IBOutlet UIImageView *grayCoverView; @property (weak, nonatomic) IBOutlet UIImageView *giftNumBgImageView; @property (weak, nonatomic) IBOutlet UIImageView *activityImageView; +@property (weak, nonatomic) IBOutlet UIView *nobilityLockView; +@property (weak, nonatomic) IBOutlet UIImageView *cpImageView; @property (strong, nonatomic) QXGiftModel *roomGiftModel; diff --git a/QXLive/Tabbar/弹窗/QXGiftCell.m b/QXLive/Tabbar/弹窗/QXGiftCell.m index 28145f8..97d21ad 100644 --- a/QXLive/Tabbar/弹窗/QXGiftCell.m +++ b/QXLive/Tabbar/弹窗/QXGiftCell.m @@ -97,6 +97,11 @@ -(void)setRoomGiftModel:(QXGiftModel *)roomGiftModel{ _roomGiftModel = roomGiftModel; self.giftNameLabel.text = roomGiftModel.gift_name; + if (roomGiftModel.is_lock.intValue == 1) { + self.nobilityLockView.hidden = NO; + }else{ + self.nobilityLockView.hidden = YES; + } NSString *encodedQuery = [roomGiftModel.base_image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; NSURL *imageUrl = [NSURL URLWithString:encodedQuery]; [self.gitfImageView sd_setImageWithURL:imageUrl]; @@ -114,6 +119,11 @@ [self.cornBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)]; self.giftNameLabel.textColor = RGB16(0xffffff); } + if ([roomGiftModel.is_cp isEqualToString:@"1"]) { + self.cpImageView.hidden = NO; + }else{ + self.cpImageView.hidden = YES; + } if ([roomGiftModel.activities_id isEqualToString:@"5"]) { self.activityImageView.hidden = NO; diff --git a/QXLive/Tabbar/弹窗/QXGiftCell.xib b/QXLive/Tabbar/弹窗/QXGiftCell.xib index 0fbd356..9a96701 100644 --- a/QXLive/Tabbar/弹窗/QXGiftCell.xib +++ b/QXLive/Tabbar/弹窗/QXGiftCell.xib @@ -89,12 +89,36 @@ + + @@ -102,10 +126,15 @@ + + + + + @@ -114,6 +143,7 @@ + @@ -126,7 +156,7 @@ - + @@ -144,11 +174,13 @@ + + @@ -162,6 +194,8 @@ - + + + diff --git a/QXLive/Tabbar/弹窗/QXInvitePopView.h b/QXLive/Tabbar/弹窗/QXInvitePopView.h index a34b2f4..d55c9ea 100644 --- a/QXLive/Tabbar/弹窗/QXInvitePopView.h +++ b/QXLive/Tabbar/弹窗/QXInvitePopView.h @@ -6,10 +6,11 @@ // #import - +#import "QXRoomListModel.h" NS_ASSUME_NONNULL_BEGIN @interface QXInvitePopView : UIView +@property (nonatomic,strong)QXRoomListModel *model; @property (nonatomic,copy)void(^closeActionBlock)(void); @property (nonatomic,copy)void(^agreeActionBlock)(void); @end diff --git a/QXLive/Tabbar/弹窗/QXInvitePopView.m b/QXLive/Tabbar/弹窗/QXInvitePopView.m index a735336..e249688 100644 --- a/QXLive/Tabbar/弹窗/QXInvitePopView.m +++ b/QXLive/Tabbar/弹窗/QXInvitePopView.m @@ -11,9 +11,10 @@ @interface QXInvitePopView() @property (nonatomic,strong)UIImageView *bgImageView; -@property (nonatomic,strong)QXSeatHeaderView *headerView; +@property (nonatomic,strong)UIImageView *headerView; @property (nonatomic,strong)UILabel *inviteLabel; -@property (nonatomic,strong)UIButton *agreeBtn; +@property (nonatomic,strong)UIButton *commitBtn; +@property (nonatomic,strong)UIButton *cancelBtn; @property (nonatomic,strong)QXTimer *timer; @property (nonatomic,strong)UIButton *closeBtn; @end @@ -36,7 +37,11 @@ make.height.mas_equalTo(ScaleWidth(200)); }]; - self.headerView = [[QXSeatHeaderView alloc] init]; + self.headerView = [[UIImageView alloc] init]; + [self.headerView addRoundedCornersWithRadius:35]; + self.headerView.layer.borderColor = QXConfig.themeColor.CGColor; + self.headerView.layer.borderWidth = 2; + self.headerView.contentMode = UIViewContentModeScaleAspectFill; [self addSubview:self.headerView]; [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(70, 70)); @@ -56,19 +61,50 @@ }]; - self.agreeBtn = [[UIButton alloc] init]; - [self.agreeBtn addRoundedCornersWithRadius:21]; - self.agreeBtn.backgroundColor = QXConfig.themeColor; - [self.agreeBtn setTitle:QXText(@"接收邀请") forState:(UIControlStateNormal)]; - [self.agreeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; - self.agreeBtn.titleLabel.font = [UIFont systemFontOfSize:14]; - [self.agreeBtn addTarget:self action:@selector(agreeAction) forControlEvents:(UIControlEventTouchUpInside)]; - [self addSubview:self.agreeBtn]; - [self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) { +// self.agreeBtn = [[UIButton alloc] init]; +// [self.agreeBtn addRoundedCornersWithRadius:21]; +// self.agreeBtn.backgroundColor = RGB16(0x000000); +// [self.agreeBtn setTitle:QXText(@"接收邀请") forState:(UIControlStateNormal)]; +// [self.agreeBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)]; +// self.agreeBtn.titleLabel.font = [UIFont systemFontOfSize:14]; +// [self.agreeBtn addTarget:self action:@selector(agreeAction) forControlEvents:(UIControlEventTouchUpInside)]; +// [self addSubview:self.agreeBtn]; +// [self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) { +// make.bottom.equalTo(self.bgImageView).offset(-12); +// make.height.mas_equalTo(42); +// make.width.mas_equalTo(178); +// make.centerX.equalTo(self.bgImageView); +// }]; + + self.commitBtn = [[UIButton alloc] init]; + [self.commitBtn addRoundedCornersWithRadius:21]; + self.commitBtn.backgroundColor = QXConfig.themeColor; + [self.commitBtn setTitle:QXText(@"接受") forState:(UIControlStateNormal)]; + [self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)]; + self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.commitBtn addTarget:self action:@selector(agreeAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.commitBtn]; + [self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self.bgImageView).offset(-12); make.height.mas_equalTo(42); - make.width.mas_equalTo(178); - make.centerX.equalTo(self.bgImageView); + make.width.mas_equalTo(ScaleWidth(110)); + make.right.mas_equalTo(-20); + }]; + + + self.cancelBtn = [[UIButton alloc] init]; + [self.cancelBtn addRoundedCornersWithRadius:21]; + self.cancelBtn.backgroundColor = RGB16(0xF3F3F3); + [self.cancelBtn setTitle:QXText(@"拒绝") forState:(UIControlStateNormal)]; + [self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)]; + self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14]; + [self.cancelBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)]; + [self addSubview:self.cancelBtn]; + [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.equalTo(self.bgImageView).offset(-12); + make.height.mas_equalTo(42); + make.width.mas_equalTo(ScaleWidth(110)); + make.left.mas_equalTo(20); }]; self.closeBtn = [[UIButton alloc] init]; @@ -82,21 +118,31 @@ }]; __block int timeCount = 10; - MJWeakSelf + __weak typeof(self) weakSelf = self; _timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{ + __strong typeof(weakSelf) strongSelf = weakSelf; + if (!strongSelf) { + QXLOG(@"⚠️ self has been deallocated, skipping hide operation"); + return; + } timeCount--; if (timeCount<=0) { - [weakSelf noAgree]; - [self->_agreeBtn setTitle:[NSString stringWithFormat:@"%@(0)",QXText(@"接收邀请")] forState:(UIControlStateNormal)]; + [strongSelf noAgree]; + [strongSelf.cancelBtn setTitle:[NSString stringWithFormat:@"%@(0)",QXText(@"拒绝")] forState:(UIControlStateNormal)]; [[QXGlobal shareGlobal] hideViewBlock:^{ }]; } - [self->_agreeBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"接收邀请"),timeCount] forState:(UIControlStateNormal)]; + [strongSelf.cancelBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"拒绝"),timeCount] forState:(UIControlStateNormal)]; }]; } -(void)noAgree{ - [self->_timer invalidate]; + [self.timer invalidate]; +} + +-(void)setModel:(QXRoomListModel *)model{ + _model = model; + [self.headerView sd_setImageWithURL:[NSURL URLWithString:model.room_cover]]; } -(void)agreeAction{ diff --git a/QXLive/Tabbar/飘屏/QXDrifNobilityJoinRoomView.h b/QXLive/Tabbar/飘屏/QXDrifNobilityJoinRoomView.h new file mode 100644 index 0000000..c75697a --- /dev/null +++ b/QXLive/Tabbar/飘屏/QXDrifNobilityJoinRoomView.h @@ -0,0 +1,27 @@ +// +// QXDrifNobilityJoinRoomView.h +// QXLive +// +// Created by 启星 on 2025/11/11. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface QXDrifNobilityJoinRoomView : UIView +@property (nonatomic,strong)UIImageView *nobilityImageView; +@property (nonatomic,strong)UIImageView *bgImageView; +@property (nonatomic,strong)UILabel *titleLabel; +@property (nonatomic,assign,readonly)BOOL isPlaying; +@property (nonatomic,strong)QXRoomChatListModel *model; +@property (nonatomic,strong)NSMutableArray *dataArray; +- (void)setupDisplayViewInContainer:(UIView *)container; +-(void)addNobilityUserModel:(QXRoomChatListModel*)model; ++(instancetype)shareView; +-(void)drifPopIsClose:(BOOL)isClose; +-(void)dirfViewDidToBackground; +-(void)dirfViewBecomeToFront; +@end + +NS_ASSUME_NONNULL_END diff --git a/QXLive/Tabbar/飘屏/QXDrifNobilityJoinRoomView.m b/QXLive/Tabbar/飘屏/QXDrifNobilityJoinRoomView.m new file mode 100644 index 0000000..c43a350 --- /dev/null +++ b/QXLive/Tabbar/飘屏/QXDrifNobilityJoinRoomView.m @@ -0,0 +1,173 @@ +// +// QXDrifNobilityJoinRoomView.m +// QXLive +// +// Created by 启星 on 2025/11/11. +// + +#import "QXDrifNobilityJoinRoomView.h" +//nobility_drif_join_room_bg +@interface QXDrifNobilityJoinRoomView() +@property (nonatomic,weak)UIView* containerView; +@property (nonatomic,assign)BOOL isPlaying; +@property (nonatomic,assign)BOOL isClose; +@property (nonatomic,assign)BOOL isBackgroud; +@end +@implementation QXDrifNobilityJoinRoomView + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.frame = CGRectMake(SCREEN_WIDTH, 340, 208, 60); + BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseDrifNobility]; + self.isClose = isClose; + [self initSubviews]; + } + return self; +} ++(instancetype)shareView{ + static QXDrifNobilityJoinRoomView *manager = nil; + static dispatch_once_t predicate; + dispatch_once(&predicate, ^{ + manager = [[QXDrifNobilityJoinRoomView alloc] init]; + }); + return manager; +} +- (void)setupDisplayViewInContainer:(UIView *)container { + self.containerView = container; +} +-(void)initSubviews{ + self.bgImageView = [[UIImageView alloc] init]; + self.bgImageView.contentMode = UIViewContentModeScaleToFill; + [self addSubview:self.bgImageView]; + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(208); + make.height.mas_equalTo(60); + make.centerY.centerX.equalTo(self); + }]; + + self.titleLabel = [[UILabel alloc] init]; + self.titleLabel.font = [UIFont systemFontOfSize:12]; + self.titleLabel.textColor = RGB16(0xFFFFFF); + [self addSubview:self.titleLabel];; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.bgImageView).offset(57); + make.centerY.equalTo(self.bgImageView); + }]; + self.userInteractionEnabled = YES; +// MJWeakSelf +// [self addTapBlock:^(id _Nonnull obj) { +// if ([weakSelf.model.room_id isExist]) { +// [[QXGlobal shareGlobal] joinRoomWithRoomId:weakSelf.model.room_id isRejoin:NO navagationController:weakSelf.viewController.navigationController]; +// } +// }]; +} +-(void)addNobilityUserModel:(QXRoomChatListModel *)model{ + if (self.isClose) { + return; + } + [self.dataArray addObject:model]; + [self giftAction]; +} + + +-(void)giftAction{ + if (self.isPlaying) { + return; + } + if (self.isBackgroud) { + return; + } + MJWeakSelf + [QXDrifNobilityJoinRoomView shareView].isPlaying = YES; + [QXDrifNobilityJoinRoomView shareView].model = [QXDrifNobilityJoinRoomView shareView].dataArray.firstObject; +// [KEYWINDOW addSubview:[QXDrifNobilityJoinRoomView shareView]]; + [self.containerView addSubview:[QXDrifNobilityJoinRoomView shareView]]; +// [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ +// [QXDrifNobilityJoinRoomView shareView].x = (SCREEN_WIDTH-ScaleWidth(358))/2; +// } completion:^(BOOL finished) { +// [weakSelf performSelector:@selector(dissmissAnimate) afterDelay:5]; +// }]; + [QXDrifNobilityJoinRoomView shareView].alpha = 0; + // 第一阶段:快速进入(0.3秒) + [UIView animateWithDuration:0.3 + delay:0 + options:UIViewAnimationOptionCurveEaseOut + animations:^{ + [QXDrifNobilityJoinRoomView shareView].x = 36; + [QXDrifNobilityJoinRoomView shareView].alpha = 1; + } completion:^(BOOL finished) { + if (finished) { + // 第二阶段:非常慢速停留 + [UIView animateWithDuration:1.8 + delay:0 + options:UIViewAnimationOptionCurveLinear + animations:^{ + // 微小的水平移动,创造缓慢移动效果 + [QXDrifNobilityJoinRoomView shareView].x = 16; + } completion:^(BOOL finished) { + if (finished) { + [self dissmissAnimate]; + } + }]; + } + }]; +} +-(void)dissmissAnimate{ + [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{ + [QXDrifNobilityJoinRoomView shareView].x = -SCREEN_WIDTH; + } completion:^(BOOL finished) { + [QXDrifNobilityJoinRoomView shareView].x = SCREEN_WIDTH; + [[QXDrifNobilityJoinRoomView shareView] removeFromSuperview]; + [[QXDrifNobilityJoinRoomView shareView].dataArray removeFirstObject]; + [QXDrifNobilityJoinRoomView shareView].isPlaying = NO; + if ([QXDrifNobilityJoinRoomView shareView].dataArray.count>0) { + [[QXDrifNobilityJoinRoomView shareView] giftAction]; + } + }]; +} + +-(void)setModel:(QXRoomChatListModel *)model{ + _model = model; + self.titleLabel.text = model.FromUserInfo.enter_text; + [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:model.FromUserInfo.enter_image]]; +} +-(void)drifPopIsClose:(BOOL)isClose{ + _isClose = isClose; + self.hidden = self.isClose; + [[NSUserDefaults standardUserDefaults] setBool:isClose forKey:kIsCloseDrifNobility]; + [[NSUserDefaults standardUserDefaults] synchronize]; + if (isClose) { + [QXDrifNobilityJoinRoomView shareView].x = SCREEN_WIDTH; + [[QXDrifNobilityJoinRoomView shareView] removeFromSuperview]; + [[QXDrifNobilityJoinRoomView shareView].dataArray removeAllObjects]; + [QXDrifNobilityJoinRoomView shareView].isPlaying = NO; + } +} +-(void)dirfViewDidToBackground{ + self.isBackgroud = YES; + dispatch_async(dispatch_get_main_queue(), ^{ + [QXDrifNobilityJoinRoomView shareView].x = SCREEN_WIDTH; + [[QXDrifNobilityJoinRoomView shareView] removeFromSuperview]; + [[QXDrifNobilityJoinRoomView shareView].dataArray removeAllObjects]; + [QXDrifNobilityJoinRoomView shareView].isPlaying = NO; + }); +} + +-(void)dirfViewBecomeToFront{ + self.isBackgroud = NO; + if ([QXDrifNobilityJoinRoomView shareView].isPlaying == NO) { + [QXDrifNobilityJoinRoomView shareView].x = SCREEN_WIDTH; + [[QXDrifNobilityJoinRoomView shareView] removeFromSuperview]; + } +} + +-(NSMutableArray *)dataArray{ + if (!_dataArray) { + _dataArray = [NSMutableArray array]; + } + return _dataArray; +} + +@end diff --git a/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.h b/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.h index 27d8954..7e31726 100644 --- a/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.h +++ b/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.h @@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN -(void)addActivityModel:(QXRoomHourDriftModel*)model; -(void)addActivityModelList:(NSArray*)list; -(void)drifPopIsClose:(BOOL)isClose; +-(void)dirfViewDidToBackground; +-(void)dirfViewBecomeToFront; +(instancetype)shareView; @end diff --git a/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.m b/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.m index 6a5b978..26ed4be 100644 --- a/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.m +++ b/QXLive/Tabbar/飘屏/QXDrifRoomHourRankView.m @@ -153,6 +153,16 @@ [QXDrifRoomHourRankView shareView].isPlaying = NO; } } +-(void)dirfViewDidToBackground{ + [QXDrifRoomHourRankView shareView].x = SCREEN_WIDTH; + [[QXDrifRoomHourRankView shareView] removeFromSuperview]; + [[QXDrifRoomHourRankView shareView].dataArray removeAllObjects]; + [QXDrifRoomHourRankView shareView].isPlaying = NO; +} + +-(void)dirfViewBecomeToFront{ + +} -(NSMutableArray *)dataArray{ if (!_dataArray) { diff --git a/QXLive/Tabbar/飘屏/QXGiftDriftView.h b/QXLive/Tabbar/飘屏/QXGiftDriftView.h index c406609..5d59ac3 100644 --- a/QXLive/Tabbar/飘屏/QXGiftDriftView.h +++ b/QXLive/Tabbar/飘屏/QXGiftDriftView.h @@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN -(void)addGiftModel:(QXGiftScrollModel*)model; -(void)addGiftModelList:(NSArray*)list; -(void)drifPopIsClose:(BOOL)isClose; +-(void)dirfViewDidToBackground; +-(void)dirfViewBecomeToFront; +(instancetype)shareView; @end diff --git a/QXLive/Tabbar/飘屏/QXGiftDriftView.m b/QXLive/Tabbar/飘屏/QXGiftDriftView.m index 96f8c59..040cd6e 100644 --- a/QXLive/Tabbar/飘屏/QXGiftDriftView.m +++ b/QXLive/Tabbar/飘屏/QXGiftDriftView.m @@ -126,6 +126,16 @@ [[QXGiftDriftView shareView].dataArray removeAllObjects]; [QXGiftDriftView shareView].isPlaying = NO; } +} +-(void)dirfViewDidToBackground{ + [QXGiftDriftView shareView].x = SCREEN_WIDTH; + [[QXGiftDriftView shareView] removeFromSuperview]; + [[QXGiftDriftView shareView].dataArray removeAllObjects]; + [QXGiftDriftView shareView].isPlaying = NO; +} + +-(void)dirfViewBecomeToFront{ + } -(NSMutableArray *)dataArray{ if (!_dataArray) { diff --git a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h index 2aefc7d..53dd878 100644 --- a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h +++ b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.h @@ -31,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)QXMeetActivityDriftModel *model; -(void)addActivityModel:(QXMeetActivityDriftModel*)model; -(void)drifPopIsClose:(BOOL)isClose; +-(void)dirfViewDidToBackground; +-(void)dirfViewBecomeToFront; +(instancetype)shareView; @end diff --git a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m index 272bcd5..bd234a4 100644 --- a/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m +++ b/QXLive/Tabbar/飘屏/QXMeetActivityDriftView.m @@ -134,7 +134,16 @@ [QXMeetActivityDriftView shareView].isPlaying = NO; } } +-(void)dirfViewDidToBackground{ + [QXMeetActivityDriftView shareView].x = SCREEN_WIDTH; + [[QXMeetActivityDriftView shareView] removeFromSuperview]; + [[QXMeetActivityDriftView shareView].dataArray removeAllObjects]; + [QXMeetActivityDriftView shareView].isPlaying = NO; +} +-(void)dirfViewBecomeToFront{ + +} -(NSMutableArray *)dataArray{ if (!_dataArray) { _dataArray = [NSMutableArray array]; diff --git a/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h index 4bb11f4..9c1d1de 100644 --- a/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h +++ b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.h @@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,strong)NSMutableArray *dataArray; -(void)addRedpacketModel:(QXRedPacketDriftModel*)model; -(void)drifPopIsClose:(BOOL)isClose; +-(void)dirfViewDidToBackground; +-(void)dirfViewBecomeToFront; +(instancetype)shareView; @end diff --git a/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m index 777d020..22940f5 100644 --- a/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m +++ b/QXLive/Tabbar/飘屏/QXRedPacketDriftView.m @@ -121,7 +121,16 @@ [QXRedPacketDriftView shareView].isPlaying = NO; } } +-(void)dirfViewDidToBackground{ + [QXRedPacketDriftView shareView].x = SCREEN_WIDTH; + [[QXRedPacketDriftView shareView] removeFromSuperview]; + [[QXRedPacketDriftView shareView].dataArray removeAllObjects]; + [QXRedPacketDriftView shareView].isPlaying = NO; +} +-(void)dirfViewBecomeToFront{ + +} -(NSMutableArray *)dataArray{ if (!_dataArray) { _dataArray = [NSMutableArray array]; diff --git a/QXLive/Tools/COS/QXCOSUploadManager.h b/QXLive/Tools/COS/QXCOSUploadManager.h index 4e270a3..54a5725 100644 --- a/QXLive/Tools/COS/QXCOSUploadManager.h +++ b/QXLive/Tools/COS/QXCOSUploadManager.h @@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN @class QXCOSUploadCredentialsModel; @interface QXCOSUploadManager : NSObject +(instancetype)shareManager; +-(void)audioUploadFile:(id)file withObjectKey:(NSString *)key complete:(void (^)(NSString * fileUrl, QXCOSUploadImageState))complete; - (void)uploadFile:(NSArray *_Nonnull)files withObjectKey:(NSArray *)objectKeys isAsync:(BOOL)isAsync complete:(void(^)(NSArray * names, QXCOSUploadImageState state))complete; - (void)activityUploadFile:(NSArray *)files withObjectKey:(NSArray *)objectKeys isAsync:(BOOL)isAsync complete:(void(^)(NSArray *names, QXCOSUploadImageState state))complete; - (NSString *)currentDate; diff --git a/QXLive/Tools/COS/QXCOSUploadManager.m b/QXLive/Tools/COS/QXCOSUploadManager.m index 4c92f05..c721257 100644 --- a/QXLive/Tools/COS/QXCOSUploadManager.m +++ b/QXLive/Tools/COS/QXCOSUploadManager.m @@ -27,6 +27,77 @@ } return self; } + +-(void)audioUploadFile:(id)file withObjectKey:(NSString *)key complete:(void (^)(NSString * fileUrl, QXCOSUploadImageState state))complete{ + [[QXRequset shareInstance] getWithUrl:[NSString stringWithFormat:@"%@%@",ServerUrl,QXGetCosTempKeys] parameters:@{} needCache:NO success:^(id responseObject) { + QXCOSUploadModel *model = [QXCOSUploadModel yy_modelWithJSON:responseObject[@"data"]]; + if (![model.region isExist] || ![model.bucket isExist] || ![model.credentials.sessionToken isExist] || ![model.credentials.tmpSecretId isExist] || ![model.credentials.tmpSecretKey isExist]) { + QXLOG(@"服务端配置错误"); + complete(@"",QXCOSUploadImageFailed); + return; + } + NSString *region = model.region; + QCloudServiceConfiguration* configuration = [QCloudServiceConfiguration new]; + QCloudCOSXMLEndPoint* endpoint = [[QCloudCOSXMLEndPoint alloc] init]; + endpoint.regionName = region; + // 使用 HTTPS + endpoint.useHTTPS = true; + configuration.endpoint = endpoint; + // 初始化 COS 服务示例 + [QCloudCOSXMLService registerDefaultCOSXMLWithConfiguration:configuration]; + [QCloudCOSTransferMangerService registerDefaultCOSTransferMangerWithConfiguration:configuration]; + + NSString *bucket = model.bucket; + + + QCloudCOSXMLUploadObjectRequest* put = [QCloudCOSXMLUploadObjectRequest new]; + QCloudCredential * credential = [QCloudCredential new]; + credential.secretID = model.credentials.tmpSecretId; + credential.secretKey = model.credentials.tmpSecretKey; + credential.token = model.credentials.sessionToken; + // 设置临时密钥 + put.credential = credential; + put.bucket = bucket; + put.object = [NSString stringWithFormat:@"%@%@",AUDIO_FILE_BASE_PATH,key]; + if ([file isKindOfClass:[UIImage class]]) { + NSData *data = UIImageJPEGRepresentation(file, 0.3); + put.body = data; + }else if ([file isKindOfClass:[NSData class]]){ + put.body = file; + }else if ([file isKindOfClass:[NSURL class]]){ + put.body = (NSURL *)file; + } + // 监听上传进度 + [put setSendProcessBlock:^(int64_t bytesSent, + int64_t totalBytesSent, + int64_t totalBytesExpectedToSend) { + // bytesSent 本次要发送的字节数(一个大文件可能要分多次发送) + // totalBytesSent 已发送的字节数 + // totalBytesExpectedToSend 本次上传要发送的总字节数(即一个文件大小) + }]; + + // 监听上传结果 + [put setFinishBlock:^(QCloudUploadObjectResult *result, NSError *error) { + if (!error) { + NSLog(@"upload object success!"); + if (complete) { + complete(result.location ,QXCOSUploadImageSuccess); + } + } else { + NSLog(@"upload object failed, error: %@" , error); + if (complete) { + complete(@"",QXCOSUploadImageFailed); + } + } + }]; + [[QCloudCOSTransferMangerService defaultCOSTransferManager] UploadObject:put]; + + + } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { + + }]; +} + -(void)uploadFile:(NSArray *)files withObjectKey:(NSArray *)objectKeys isAsync:(BOOL)isAsync complete:(void (^)(NSArray * _Nullable, QXCOSUploadImageState))complete{ [[QXRequset shareInstance] getWithUrl:[NSString stringWithFormat:@"%@%@",ServerUrl,QXGetCosTempKeys] parameters:@{} needCache:NO success:^(id responseObject) { QXCOSUploadModel *model = [QXCOSUploadModel yy_modelWithJSON:responseObject[@"data"]]; diff --git a/QXLive/Tools/Category/NSString+QX.h b/QXLive/Tools/Category/NSString+QX.h index e4f8208..5b3186e 100644 --- a/QXLive/Tools/Category/NSString+QX.h +++ b/QXLive/Tools/Category/NSString+QX.h @@ -178,6 +178,11 @@ NS_ASSUME_NONNULL_BEGIN - (NSInteger)ageWithDateOfBirth; /// 传入秒 得到 几天 几小时 + (NSString*)getTimeWithSecond:(long long)second; +/// 传入秒 得到 几天 ++(NSString *)getTimeWithDay:(long long)second; + +// 方法2:更严谨的实现,包含边界条件处理 ++ (NSInteger)convertTimestampToHoursWithPrecision:(long long)endTime; @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Tools/Category/NSString+QX.m b/QXLive/Tools/Category/NSString+QX.m index 40817a2..d3ccd69 100644 --- a/QXLive/Tools/Category/NSString+QX.m +++ b/QXLive/Tools/Category/NSString+QX.m @@ -399,7 +399,38 @@ } +(NSString *)getTimeWithSecond:(long long)second{ NSInteger day = second/(60*60*24); - NSInteger hour = second%(60*60*24)/(60*60); + double hourT = second%(60*60*24)/3600.0; + NSInteger hour = (NSInteger)ceil(hourT); return [NSString stringWithFormat:@"%ld天%ld小时",day,hour]; } ++(NSString *)getTimeWithDay:(long long)second{ + double day = (double)second/(60*60*24.0); + NSInteger datT = (NSInteger)ceil(day); + return [NSString stringWithFormat:@"%ld天",datT]; +} +// 方法2:更严谨的实现,包含边界条件处理 ++ (NSInteger)convertTimestampToHoursWithPrecision:(long long)endTime { + NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970]; + // 将秒转换为毫秒 + long long milliseconds = (long long)(currentTime); + NSInteger timestamp = endTime - currentTime; + + if (timestamp <= 0) { + return 0; + } + + // 处理极小的时间值(小于1秒) + if (timestamp < 1) { + return 1; // 即使小于1秒也按1小时计算 + } + + // 计算小时数 + double hours = timestamp / 3600.0; + + // 使用ceil函数向上取整 + NSInteger roundedHours = (NSInteger)ceil(hours); + + // 确保至少为1小时 + return MAX(1, roundedHours); +} @end diff --git a/QXLive/Tools/Category/UIImage+QX.h b/QXLive/Tools/Category/UIImage+QX.h index b1d78c3..f097589 100644 --- a/QXLive/Tools/Category/UIImage+QX.h +++ b/QXLive/Tools/Category/UIImage+QX.h @@ -31,7 +31,13 @@ typedef NS_ENUM(NSUInteger, GradientType) { + (UIImage *)qx_convertViewToImageWith:(UIView *)view; + (UIImage *)qx_gradientColorImageFromColors:(NSArray*)colors gradientType:(GradientType)gradientType imgSize:(CGSize)imgSize; +/** + 传入一张图片将图片改为灰色 + @param inputImage 传入图片 + @return 生成的UIImage + */ ++ (UIImage *)qx_convertImageToGrayWithCoreImage:(UIImage *)inputImage; /** 根据颜色,生成UIImage对象 diff --git a/QXLive/Tools/Category/UIImage+QX.m b/QXLive/Tools/Category/UIImage+QX.m index 647c90a..a5358d7 100644 --- a/QXLive/Tools/Category/UIImage+QX.m +++ b/QXLive/Tools/Category/UIImage+QX.m @@ -42,7 +42,24 @@ return image; } - ++ (UIImage *)qx_convertImageToGrayWithCoreImage:(UIImage *)inputImage { + CIImage *ciImage = [[CIImage alloc] initWithImage:inputImage]; + + // 使用黑白滤镜 + CIFilter *grayFilter = [CIFilter filterWithName:@"CIColorControls"]; + [grayFilter setValue:ciImage forKey:kCIInputImageKey]; + [grayFilter setValue:@(0.0) forKey:kCIInputSaturationKey]; // 饱和度设为0即为灰色 + + CIImage *outputImage = [grayFilter valueForKey:kCIOutputImageKey]; + + CIContext *context = [CIContext contextWithOptions:nil]; + CGImageRef cgImage = [context createCGImage:outputImage fromRect:[outputImage extent]]; + + UIImage *grayImage = [UIImage imageWithCGImage:cgImage]; + CGImageRelease(cgImage); + + return grayImage; +} + (UIImage *)qx_gradientColorImageFromColors:(NSArray *)colors gradientType:(GradientType)gradientType imgSize:(CGSize)imgSize { NSMutableArray *ar = [NSMutableArray array]; for (UIColor *c in colors) { diff --git a/QXLive/Tools/Category/UIView+QX.h b/QXLive/Tools/Category/UIView+QX.h index 2c49762..6544545 100644 --- a/QXLive/Tools/Category/UIView+QX.h +++ b/QXLive/Tools/Category/UIView+QX.h @@ -153,6 +153,17 @@ typedef NS_ENUM(NSUInteger, SRGradientDirection) { - (UINavigationController *)navigationController; +// 开始上下漂浮动画 +- (void)startSimpleFloat; + +// 开始自定义上下漂浮动画 +- (void)startSimpleFloatWithDuration:(NSTimeInterval)duration + amplitude:(CGFloat)amplitude; + +// 停止漂浮动画 +- (void)stopSimpleFloat; + + @end NS_ASSUME_NONNULL_END diff --git a/QXLive/Tools/Category/UIView+QX.m b/QXLive/Tools/Category/UIView+QX.m index 33cbc13..cee9013 100644 --- a/QXLive/Tools/Category/UIView+QX.m +++ b/QXLive/Tools/Category/UIView+QX.m @@ -504,5 +504,32 @@ static const void* tagValue = &tagValue; } return nil; } +- (void)startSimpleFloat { + // 默认参数:3秒周期,10像素幅度 + [self startSimpleFloatWithDuration:2.0 amplitude:10.0]; +} + +- (void)startSimpleFloatWithDuration:(NSTimeInterval)duration amplitude:(CGFloat)amplitude { + // 停止之前的动画 + [self stopSimpleFloat]; + + // 保存原始位置 + CGPoint originalCenter = self.center; + + // 创建上下动画 + CABasicAnimation *floatAnimation = [CABasicAnimation animationWithKeyPath:@"position.y"]; + floatAnimation.fromValue = @(originalCenter.y - amplitude); + floatAnimation.toValue = @(originalCenter.y + amplitude); + floatAnimation.duration = duration; + floatAnimation.repeatCount = HUGE_VALF; // 无限循环 + floatAnimation.autoreverses = YES; // 自动反向,实现一上一下 + floatAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + + [self.layer addAnimation:floatAnimation forKey:@"simpleFloatAnimation"]; +} + +- (void)stopSimpleFloat { + [self.layer removeAnimationForKey:@"simpleFloatAnimation"]; +} @end diff --git a/QXLive/Tools/QXFloatAnimationHelper.h b/QXLive/Tools/QXFloatAnimationHelper.h new file mode 100644 index 0000000..f265e51 --- /dev/null +++ b/QXLive/Tools/QXFloatAnimationHelper.h @@ -0,0 +1,45 @@ +// +// QXFloatAnimationHelper.h +// QXLive +// +// Created by 启星 on 2025/11/22. +// + +#import + +#import + +typedef NS_ENUM(NSInteger, FloatAnimationStyle) { + FloatAnimationStyleSmooth, // 平滑漂浮 + FloatAnimationStyleBounce, // 弹跳漂浮 + FloatAnimationStyleWave, // 波浪漂浮 + FloatAnimationStyleBreath // 呼吸式漂浮 +}; + +@interface QXFloatAnimationHelper : NSObject + +@property (nonatomic, assign) FloatAnimationStyle style; +@property (nonatomic, assign) CGFloat amplitude; // 浮动幅度 +@property (nonatomic, assign) NSTimeInterval duration; // 单次循环时长 +@property (nonatomic, assign) BOOL autoStart; // 是否自动开始 + +// 单例 ++ (instancetype)sharedController; + +// 为视图添加漂浮动画 +- (void)addFloatAnimationToView:(UIView *)view; +- (void)addFloatAnimationToView:(UIView *)view withStyle:(FloatAnimationStyle)style; + +// 为多个视图添加漂浮动画(带随机延迟) +- (void)addFloatAnimationToViews:(NSArray *)views; + +// 移除漂浮动画 +- (void)removeFloatAnimationFromView:(UIView *)view; +- (void)removeAllFloatAnimations; + +// 暂停和恢复动画 +- (void)pauseFloatAnimationForView:(UIView *)view; +- (void)resumeFloatAnimationForView:(UIView *)view; + +@end + diff --git a/QXLive/Tools/QXFloatAnimationHelper.m b/QXLive/Tools/QXFloatAnimationHelper.m new file mode 100644 index 0000000..6cb3d9c --- /dev/null +++ b/QXLive/Tools/QXFloatAnimationHelper.m @@ -0,0 +1,250 @@ +// +// QXFloatAnimationHelper.m +// QXLive +// +// Created by 启星 on 2025/11/22. +// + +#import "QXFloatAnimationHelper.h" +#import + +// 关联对象键 +static void * const kFloatAnimationKey = "kFloatAnimationKey"; + +@interface QXFloatAnimationHelper () +@property (nonatomic, strong) NSMutableSet *animatedViews; +@end + +@implementation QXFloatAnimationHelper + ++ (instancetype)sharedController { + static QXFloatAnimationHelper *instance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [[QXFloatAnimationHelper alloc] init]; + }); + return instance; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _animatedViews = [NSMutableSet set]; + _style = FloatAnimationStyleSmooth; + _amplitude = 1.0; + _duration = 3.0; + _autoStart = YES; + } + return self; +} + +- (void)addFloatAnimationToView:(UIView *)view { + [self addFloatAnimationToView:view withStyle:self.style]; +} + +- (void)addFloatAnimationToView:(UIView *)view withStyle:(FloatAnimationStyle)style { + if (!view || [self.animatedViews containsObject:view]) { + return; + } + + [self.animatedViews addObject:view]; + + // 保存原始位置 + CGPoint originalCenter = view.center; + objc_setAssociatedObject(view, kFloatAnimationKey, [NSValue valueWithCGPoint:originalCenter], OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // 根据样式创建不同的动画 + switch (style) { + case FloatAnimationStyleSmooth: + [self addSmoothFloatAnimationToView:view]; + break; + case FloatAnimationStyleBounce: + [self addBounceFloatAnimationToView:view]; + break; + case FloatAnimationStyleWave: + [self addWaveFloatAnimationToView:view]; + break; + case FloatAnimationStyleBreath: + [self addBreathFloatAnimationToView:view]; + break; + } +} + +- (void)addSmoothFloatAnimationToView:(UIView *)view { + CGPoint originalCenter = [objc_getAssociatedObject(view, kFloatAnimationKey) CGPointValue]; + + // 创建关键帧动画 + CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; + + NSMutableArray *pathValues = [NSMutableArray array]; + NSInteger frames = 60; + + for (int i = 0; i <= frames; i++) { + CGFloat progress = (CGFloat)i / frames; + CGFloat radians = progress * M_PI * 2; + CGFloat offsetY = sin(radians) * self.amplitude; + + CGPoint point = CGPointMake(originalCenter.x, originalCenter.y + offsetY); + [pathValues addObject:[NSValue valueWithCGPoint:point]]; + } + + animation.values = pathValues; + animation.duration = self.duration; + animation.repeatCount = HUGE_VALF; + animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + + // 随机延迟,避免所有视图同步 + animation.beginTime = CACurrentMediaTime() + (arc4random_uniform(1000) / 1000.0) * 1.0; + + [view.layer addAnimation:animation forKey:@"smoothFloatAnimation"]; +} + +- (void)addBounceFloatAnimationToView:(UIView *)view { + CGPoint originalCenter = [objc_getAssociatedObject(view, kFloatAnimationKey) CGPointValue]; + + CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.y"]; + + // 弹跳效果的值 + NSArray *values = @[ + @(originalCenter.y), + @(originalCenter.y - self.amplitude * 0.3), + @(originalCenter.y - self.amplitude), + @(originalCenter.y - self.amplitude * 0.7), + @(originalCenter.y - self.amplitude * 0.3), + @(originalCenter.y), + @(originalCenter.y + self.amplitude * 0.2), + @(originalCenter.y + self.amplitude * 0.5), + @(originalCenter.y + self.amplitude * 0.2), + @(originalCenter.y) + ]; + + animation.values = values; + animation.duration = self.duration; + animation.repeatCount = HUGE_VALF; + + // 弹跳的时间函数 + animation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.5 :1.8 :0.8 :0.8]; + animation.beginTime = CACurrentMediaTime() + (arc4random_uniform(1000) / 1000.0) * 1.0; + + [view.layer addAnimation:animation forKey:@"bounceFloatAnimation"]; +} + +- (void)addWaveFloatAnimationToView:(UIView *)view { + CGPoint originalCenter = [objc_getAssociatedObject(view, kFloatAnimationKey) CGPointValue]; + + CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.y"]; + + NSMutableArray *values = [NSMutableArray array]; + NSInteger frames = 60; + + // 波浪效果 - 多个正弦波叠加 + for (int i = 0; i <= frames; i++) { + CGFloat progress = (CGFloat)i / frames; + + // 主波 + CGFloat wave1 = sin(progress * M_PI * 2) * self.amplitude; + // 次波 + CGFloat wave2 = sin(progress * M_PI * 4) * self.amplitude * 0.3; + + CGFloat offsetY = wave1 + wave2; + [values addObject:@(originalCenter.y + offsetY)]; + } + + animation.values = values; + animation.duration = self.duration; + animation.repeatCount = HUGE_VALF; + animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + animation.beginTime = CACurrentMediaTime() + (arc4random_uniform(1000) / 1000.0) * 1.0; + + [view.layer addAnimation:animation forKey:@"waveFloatAnimation"]; +} + +- (void)addBreathFloatAnimationToView:(UIView *)view { + CGPoint originalCenter = [objc_getAssociatedObject(view, kFloatAnimationKey) CGPointValue]; + + // 组合动画:位置 + 透明度 + CAKeyframeAnimation *positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position.y"]; + CAKeyframeAnimation *alphaAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"]; + + NSMutableArray *positionValues = [NSMutableArray array]; + NSMutableArray *alphaValues = [NSMutableArray array]; + NSInteger frames = 60; + + for (int i = 0; i <= frames; i++) { + CGFloat progress = (CGFloat)i / frames; + CGFloat radians = progress * M_PI * 2; + + // 位置变化 + CGFloat offsetY = sin(radians) * self.amplitude; + [positionValues addObject:@(originalCenter.y + offsetY)]; + + // 透明度变化 (0.8 - 1.0) + CGFloat alpha = 0.9 + 0.1 * sin(radians); + [alphaValues addObject:@(alpha)]; + } + + positionAnimation.values = positionValues; + positionAnimation.duration = self.duration; + positionAnimation.repeatCount = HUGE_VALF; + + alphaAnimation.values = alphaValues; + alphaAnimation.duration = self.duration; + alphaAnimation.repeatCount = HUGE_VALF; + + CAAnimationGroup *group = [CAAnimationGroup animation]; + group.animations = @[positionAnimation, alphaAnimation]; + group.duration = self.duration; + group.repeatCount = HUGE_VALF; + group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + group.beginTime = CACurrentMediaTime() + (arc4random_uniform(1000) / 1000.0) * 1.0; + + [view.layer addAnimation:group forKey:@"breathFloatAnimation"]; +} + +- (void)addFloatAnimationToViews:(NSArray *)views { + for (UIView *view in views) { + [self addFloatAnimationToView:view]; + } +} + +- (void)removeFloatAnimationFromView:(UIView *)view { + if (!view) return; + + [self.animatedViews removeObject:view]; + + // 移除所有漂浮动画 + [view.layer removeAnimationForKey:@"smoothFloatAnimation"]; + [view.layer removeAnimationForKey:@"bounceFloatAnimation"]; + [view.layer removeAnimationForKey:@"waveFloatAnimation"]; + [view.layer removeAnimationForKey:@"breathFloatAnimation"]; + + // 恢复原始位置 + NSValue *originalCenterValue = objc_getAssociatedObject(view, kFloatAnimationKey); + if (originalCenterValue) { + view.center = [originalCenterValue CGPointValue]; + } +} + +- (void)removeAllFloatAnimations { + for (UIView *view in self.animatedViews) { + [self removeFloatAnimationFromView:view]; + } + [self.animatedViews removeAllObjects]; +} + +- (void)pauseFloatAnimationForView:(UIView *)view { + CFTimeInterval pausedTime = [view.layer convertTime:CACurrentMediaTime() fromLayer:nil]; + view.layer.speed = 0.0; + view.layer.timeOffset = pausedTime; +} + +- (void)resumeFloatAnimationForView:(UIView *)view { + CFTimeInterval pausedTime = view.layer.timeOffset; + view.layer.speed = 1.0; + view.layer.timeOffset = 0.0; + view.layer.beginTime = 0.0; + CFTimeInterval timeSincePause = [view.layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; + view.layer.beginTime = timeSincePause; +} + +@end diff --git a/QXLive/活动/天空之境/QXSkyPraizeView.m b/QXLive/活动/天空之境/QXSkyPraizeView.m index 427ceee..12c9357 100644 --- a/QXLive/活动/天空之境/QXSkyPraizeView.m +++ b/QXLive/活动/天空之境/QXSkyPraizeView.m @@ -536,74 +536,98 @@ static NSInteger toSlowCount = 4; dispatch_source_set_event_handler(_fastTimer, ^{ __strong typeof(weakSelf) strongSelf = weakSelf; if (!strongSelf) return; + + // 将需要的数据提前捕获到局部变量中 + __block NSInteger roundCount = strongSelf.roundCount; + __block NSInteger currentIndex = strongSelf.currentIndex; + NSArray *finishTargetArrayIndex = [strongSelf.finishTargetArrayIndex copy]; + NSMutableArray *targetArrayIndex = [strongSelf.targetArrayIndex mutableCopy]; + __block QXSkyDrawBtnType startType = strongSelf.startType; + // 如果需要更新UI,切换到主线程 dispatch_async(dispatch_get_main_queue(), ^{ - strongSelf.roundCount++; - if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != QXSkyDrawBtnTypeOne) { + // 再次检查 strongSelf 是否存在 + __strong typeof(weakSelf) strongSelfInMain = weakSelf; + if (!strongSelfInMain) return; + + // 使用局部变量进行计算,避免频繁访问属性 + roundCount++; + NSInteger newCurrentIndex = roundCount % giftMaxCount; + + if ((roundCount / giftMaxCount == minRoundCount) && startType != QXSkyDrawBtnTypeOne) { BOOL has = NO; - for (NSNumber *index in self.finishTargetArrayIndex) { - if (index.integerValue == self.currentIndex) { + for (NSNumber *index in finishTargetArrayIndex) { + if (index.integerValue == currentIndex) { has = YES; break; } } - self.currentGiftView.isSelected = NO; + + strongSelfInMain.currentGiftView.isSelected = NO; + + QXSkyPraizeSubView *giftView = strongSelfInMain.allViewsArray[newCurrentIndex]; if (has) { - QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; giftView.isSelected = YES; - }else{ - QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + } else { giftView.isSelected = NO; } - }else{ + } else { /// 把上一个选中状态置为未选中 - strongSelf.currentGiftView.isSelected = NO; + strongSelfInMain.currentGiftView.isSelected = NO; } + /// 计算当前下标 - strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount; + strongSelfInMain.currentIndex = newCurrentIndex; + strongSelfInMain.roundCount = roundCount; + /// 获取当前选中的view 并设置为选中状态 - QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; - giftView.isSelected = YES; + QXSkyPraizeSubView *currentGiftView = strongSelfInMain.allViewsArray[newCurrentIndex]; + currentGiftView.isSelected = YES; /// 重新赋值给选中view - strongSelf.currentGiftView = giftView; + strongSelfInMain.currentGiftView = currentGiftView; - if (strongSelf.roundCount / giftMaxCount == minRoundCount) { - for (NSNumber *index in strongSelf.targetArrayIndex) { - if (strongSelf.currentIndex == index.integerValue) { - QXSkyPraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue]; - giftView.isSelected = YES; - giftView.resultView.hidden = NO; - [giftView startPulseAnimationWithLayer]; - [strongSelf.targetArrayIndex removeObject:index]; - [strongSelf.finishTargetArrayIndex addObject:index]; + if (roundCount / giftMaxCount == minRoundCount) { + for (NSNumber *index in targetArrayIndex) { + if (newCurrentIndex == index.integerValue) { + QXSkyPraizeSubView *targetGiftView = strongSelfInMain.allViewsArray[index.integerValue]; + targetGiftView.isSelected = YES; + targetGiftView.resultView.hidden = NO; + [targetGiftView startPulseAnimationWithLayer]; + + // 在主线程安全地修改数组 + [strongSelfInMain.targetArrayIndex removeObject:index]; + [strongSelfInMain.finishTargetArrayIndex addObject:index]; break; } } - dispatch_source_set_timer(strongSelf.fastTimer, - dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC), - DISPATCH_TIME_FOREVER, - 0.01 * NSEC_PER_SEC); - if (strongSelf.targetArrayIndex.count == 0) { - strongSelf.isDrawing = NO; - [strongSelf stopFastAnimate]; - [strongSelf animateFinishedSendGift]; + + dispatch_source_set_timer(strongSelfInMain.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + + if (strongSelfInMain.targetArrayIndex.count == 0) { + strongSelfInMain.isDrawing = NO; + [strongSelfInMain stopFastAnimate]; + [strongSelfInMain animateFinishedSendGift]; } - // } - }else{ - strongSelf.delayTime = strongSelf.delayTime-0.02; - if (strongSelf.delayTime <= 0.03) { - strongSelf.delayTime = 0.03; + } else { + // 使用局部变量避免频繁访问属性 + NSTimeInterval delayTime = strongSelfInMain.delayTime - 0.02; + if (delayTime <= 0.03) { + delayTime = 0.03; } - dispatch_source_set_timer(strongSelf.fastTimer, - dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC), - DISPATCH_TIME_FOREVER, - 0.01 * NSEC_PER_SEC); + strongSelfInMain.delayTime = delayTime; + + dispatch_source_set_timer(strongSelfInMain.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, delayTime * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); } - - }); }); + dispatch_resume(_fastTimer); } -(void)animateFinishedSendGift{ @@ -724,6 +748,13 @@ static NSInteger toSlowCount = 4; -(void)destroyViews{ [[NSNotificationCenter defaultCenter] removeObserver:self]; } +- (void)dealloc { + if (_fastTimer) { + dispatch_source_cancel(_fastTimer); + _fastTimer = nil; + } + NSLog(@"%@ dealloc", NSStringFromClass([self class])); +} @end diff --git a/QXLive/活动/岁月之城/QXAgePraizeView.m b/QXLive/活动/岁月之城/QXAgePraizeView.m index 132997a..57d7cb2 100644 --- a/QXLive/活动/岁月之城/QXAgePraizeView.m +++ b/QXLive/活动/岁月之城/QXAgePraizeView.m @@ -568,74 +568,98 @@ static NSInteger toSlowCount = 4; dispatch_source_set_event_handler(_fastTimer, ^{ __strong typeof(weakSelf) strongSelf = weakSelf; if (!strongSelf) return; + + // 将需要的数据提前捕获到局部变量中 + __block NSInteger roundCount = strongSelf.roundCount; + __block NSInteger currentIndex = strongSelf.currentIndex; + NSArray *finishTargetArrayIndex = [strongSelf.finishTargetArrayIndex copy]; + NSMutableArray *targetArrayIndex = [strongSelf.targetArrayIndex mutableCopy]; + __block QXAgeDrawBtnType startType = strongSelf.startType; + // 如果需要更新UI,切换到主线程 dispatch_async(dispatch_get_main_queue(), ^{ - strongSelf.roundCount++; - if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != QXAgeDrawBtnTypeOne) { + // 再次检查 strongSelf 是否存在 + __strong typeof(weakSelf) strongSelfInMain = weakSelf; + if (!strongSelfInMain) return; + + // 使用局部变量进行计算,避免频繁访问属性 + roundCount++; + NSInteger newCurrentIndex = roundCount % giftMaxCount; + + if ((roundCount / giftMaxCount == minRoundCount) && startType != QXSkyDrawBtnTypeOne) { BOOL has = NO; - for (NSNumber *index in strongSelf.finishTargetArrayIndex) { - if (index.integerValue == strongSelf.currentIndex) { + for (NSNumber *index in finishTargetArrayIndex) { + if (index.integerValue == currentIndex) { has = YES; break; } } - self.currentGiftView.isSelected = NO; + + strongSelfInMain.currentGiftView.isSelected = NO; + + QXAgePraizeSubView *giftView = strongSelfInMain.allViewsArray[newCurrentIndex]; if (has) { - QXAgePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; giftView.isSelected = YES; - }else{ - QXAgePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + } else { giftView.isSelected = NO; } - }else{ + } else { /// 把上一个选中状态置为未选中 - strongSelf.currentGiftView.isSelected = NO; + strongSelfInMain.currentGiftView.isSelected = NO; } + /// 计算当前下标 - strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount; + strongSelfInMain.currentIndex = newCurrentIndex; + strongSelfInMain.roundCount = roundCount; + /// 获取当前选中的view 并设置为选中状态 - QXAgePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; - giftView.isSelected = YES; + QXAgePraizeSubView *currentGiftView = strongSelfInMain.allViewsArray[newCurrentIndex]; + currentGiftView.isSelected = YES; /// 重新赋值给选中view - strongSelf.currentGiftView = giftView; + strongSelfInMain.currentGiftView = currentGiftView; - if (strongSelf.roundCount / giftMaxCount == minRoundCount) { - for (NSNumber *index in strongSelf.targetArrayIndex) { - if (strongSelf.currentIndex == index.integerValue) { - QXAgePraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue]; - giftView.isSelected = YES; - giftView.resultView.hidden = NO; - [giftView startPulseAnimationWithLayer]; - [strongSelf.targetArrayIndex removeObject:index]; - [strongSelf.finishTargetArrayIndex addObject:index]; + if (roundCount / giftMaxCount == minRoundCount) { + for (NSNumber *index in targetArrayIndex) { + if (newCurrentIndex == index.integerValue) { + QXAgePraizeSubView *targetGiftView = strongSelfInMain.allViewsArray[index.integerValue]; + targetGiftView.isSelected = YES; + targetGiftView.resultView.hidden = NO; + [targetGiftView startPulseAnimationWithLayer]; + + // 在主线程安全地修改数组 + [strongSelfInMain.targetArrayIndex removeObject:index]; + [strongSelfInMain.finishTargetArrayIndex addObject:index]; break; } } - dispatch_source_set_timer(strongSelf.fastTimer, - dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC), - DISPATCH_TIME_FOREVER, - 0.01 * NSEC_PER_SEC); - if (strongSelf.targetArrayIndex.count == 0) { - strongSelf.isDrawing = NO; - [strongSelf stopFastAnimate]; - [strongSelf animateFinishedSendGift]; + + dispatch_source_set_timer(strongSelfInMain.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + + if (strongSelfInMain.targetArrayIndex.count == 0) { + strongSelfInMain.isDrawing = NO; + [strongSelfInMain stopFastAnimate]; + [strongSelfInMain animateFinishedSendGift]; } - // } - }else{ - strongSelf.delayTime = strongSelf.delayTime-0.02; - if (strongSelf.delayTime <= 0.03) { - strongSelf.delayTime = 0.03; + } else { + // 使用局部变量避免频繁访问属性 + NSTimeInterval delayTime = strongSelfInMain.delayTime - 0.02; + if (delayTime <= 0.03) { + delayTime = 0.03; } - dispatch_source_set_timer(strongSelf.fastTimer, - dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC), - DISPATCH_TIME_FOREVER, - 0.01 * NSEC_PER_SEC); + strongSelfInMain.delayTime = delayTime; + + dispatch_source_set_timer(strongSelfInMain.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, delayTime * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); } - - }); }); + dispatch_resume(_fastTimer); } -(void)animateFinishedSendGift{ diff --git a/QXLive/活动/时空之巅/QXTimePraizeView.m b/QXLive/活动/时空之巅/QXTimePraizeView.m index ac446f2..5da93f0 100644 --- a/QXLive/活动/时空之巅/QXTimePraizeView.m +++ b/QXLive/活动/时空之巅/QXTimePraizeView.m @@ -569,74 +569,98 @@ static NSInteger toSlowCount = 4; dispatch_source_set_event_handler(_fastTimer, ^{ __strong typeof(weakSelf) strongSelf = weakSelf; if (!strongSelf) return; + + // 将需要的数据提前捕获到局部变量中 + __block NSInteger roundCount = strongSelf.roundCount; + __block NSInteger currentIndex = strongSelf.currentIndex; + NSArray *finishTargetArrayIndex = [strongSelf.finishTargetArrayIndex copy]; + NSMutableArray *targetArrayIndex = [strongSelf.targetArrayIndex mutableCopy]; + __block QXTimeDrawBtnType startType = strongSelf.startType; + // 如果需要更新UI,切换到主线程 dispatch_async(dispatch_get_main_queue(), ^{ - strongSelf.roundCount++; - if ((strongSelf.roundCount / giftMaxCount == minRoundCount) && strongSelf.startType != QXTimeDrawBtnTypeOne) { + // 再次检查 strongSelf 是否存在 + __strong typeof(weakSelf) strongSelfInMain = weakSelf; + if (!strongSelfInMain) return; + + // 使用局部变量进行计算,避免频繁访问属性 + roundCount++; + NSInteger newCurrentIndex = roundCount % giftMaxCount; + + if ((roundCount / giftMaxCount == minRoundCount) && startType != QXSkyDrawBtnTypeOne) { BOOL has = NO; - for (NSNumber *index in strongSelf.finishTargetArrayIndex) { - if (index.integerValue == strongSelf.currentIndex) { + for (NSNumber *index in finishTargetArrayIndex) { + if (index.integerValue == currentIndex) { has = YES; break; } } - self.currentGiftView.isSelected = NO; + + strongSelfInMain.currentGiftView.isSelected = NO; + + QXTimePraizeSubView *giftView = strongSelfInMain.allViewsArray[newCurrentIndex]; if (has) { - QXTimePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; giftView.isSelected = YES; - }else{ - QXTimePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; + } else { giftView.isSelected = NO; } - }else{ + } else { /// 把上一个选中状态置为未选中 - strongSelf.currentGiftView.isSelected = NO; + strongSelfInMain.currentGiftView.isSelected = NO; } + /// 计算当前下标 - strongSelf.currentIndex = strongSelf.roundCount%giftMaxCount; + strongSelfInMain.currentIndex = newCurrentIndex; + strongSelfInMain.roundCount = roundCount; + /// 获取当前选中的view 并设置为选中状态 - QXTimePraizeSubView *giftView = strongSelf.allViewsArray[strongSelf.currentIndex]; - giftView.isSelected = YES; + QXTimePraizeSubView *currentGiftView = strongSelfInMain.allViewsArray[newCurrentIndex]; + currentGiftView.isSelected = YES; /// 重新赋值给选中view - strongSelf.currentGiftView = giftView; + strongSelfInMain.currentGiftView = currentGiftView; - if (strongSelf.roundCount / giftMaxCount == minRoundCount) { - for (NSNumber *index in strongSelf.targetArrayIndex) { - if (strongSelf.currentIndex == index.integerValue) { - QXTimePraizeSubView *giftView = strongSelf.allViewsArray[index.integerValue]; - giftView.isSelected = YES; - giftView.resultView.hidden = NO; - [giftView startPulseAnimationWithLayer]; - [strongSelf.targetArrayIndex removeObject:index]; - [strongSelf.finishTargetArrayIndex addObject:index]; + if (roundCount / giftMaxCount == minRoundCount) { + for (NSNumber *index in targetArrayIndex) { + if (newCurrentIndex == index.integerValue) { + QXTimePraizeSubView *targetGiftView = strongSelfInMain.allViewsArray[index.integerValue]; + targetGiftView.isSelected = YES; + targetGiftView.resultView.hidden = NO; + [targetGiftView startPulseAnimationWithLayer]; + + // 在主线程安全地修改数组 + [strongSelfInMain.targetArrayIndex removeObject:index]; + [strongSelfInMain.finishTargetArrayIndex addObject:index]; break; } } - dispatch_source_set_timer(strongSelf.fastTimer, - dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC), - DISPATCH_TIME_FOREVER, - 0.01 * NSEC_PER_SEC); - if (strongSelf.targetArrayIndex.count == 0) { - strongSelf.isDrawing = NO; - [strongSelf stopFastAnimate]; - [strongSelf animateFinishedSendGift]; + + dispatch_source_set_timer(strongSelfInMain.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, 0.03 * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); + + if (strongSelfInMain.targetArrayIndex.count == 0) { + strongSelfInMain.isDrawing = NO; + [strongSelfInMain stopFastAnimate]; + [strongSelfInMain animateFinishedSendGift]; } - // } - }else{ - strongSelf.delayTime = strongSelf.delayTime-0.02; - if (strongSelf.delayTime <= 0.03) { - strongSelf.delayTime = 0.03; + } else { + // 使用局部变量避免频繁访问属性 + NSTimeInterval delayTime = strongSelfInMain.delayTime - 0.02; + if (delayTime <= 0.03) { + delayTime = 0.03; } - dispatch_source_set_timer(strongSelf.fastTimer, - dispatch_time(DISPATCH_TIME_NOW, strongSelf.delayTime * NSEC_PER_SEC), - DISPATCH_TIME_FOREVER, - 0.01 * NSEC_PER_SEC); + strongSelfInMain.delayTime = delayTime; + + dispatch_source_set_timer(strongSelfInMain.fastTimer, + dispatch_time(DISPATCH_TIME_NOW, delayTime * NSEC_PER_SEC), + DISPATCH_TIME_FOREVER, + 0.01 * NSEC_PER_SEC); } - - }); }); + dispatch_resume(_fastTimer); } -(void)animateFinishedSendGift{ diff --git a/TUIKit/TIMCommon/Resources/TIMCommon.bundle/default_c2c_head@2x.png b/TUIKit/TIMCommon/Resources/TIMCommon.bundle/default_c2c_head@2x.png index 0918848..2ba770a 100644 Binary files a/TUIKit/TIMCommon/Resources/TIMCommon.bundle/default_c2c_head@2x.png and b/TUIKit/TIMCommon/Resources/TIMCommon.bundle/default_c2c_head@2x.png differ diff --git a/TUIKit/TUIChat/UI_Classic/Chat/TUIC2CChatViewController.m b/TUIKit/TUIChat/UI_Classic/Chat/TUIC2CChatViewController.m index 8cc2056..dba3081 100644 --- a/TUIKit/TUIChat/UI_Classic/Chat/TUIC2CChatViewController.m +++ b/TUIKit/TUIChat/UI_Classic/Chat/TUIC2CChatViewController.m @@ -21,6 +21,7 @@ // If one sendTypingBaseCondation is satisfied, sendTypingBaseCondationInVC is used until the current session exits @property(nonatomic, assign) BOOL sendTypingBaseCondationInVC; +@property(nonatomic, strong) UIButton *bottomToolBtn; @end @@ -35,7 +36,9 @@ // Do any additional setup after loading the view. self.sendTypingBaseCondationInVC = NO; self.view.backgroundColor = [UIColor clearColor]; - + self.bottomToolBtn = [[UIButton alloc] init]; + [self.bottomToolBtn addTarget:self action:@selector(alertChat) forControlEvents:(UIControlEventTouchUpInside)]; + [self.view addSubview:self.bottomToolBtn]; // notify NSDictionary *param = @{TUICore_TUIChatNotify_ChatVC_ViewDidLoadSubKey_UserID: self.conversationData.userID ? : @""}; [TUICore notifyEvent:TUICore_TUIChatNotify @@ -43,6 +46,43 @@ object:nil param:param]; } +-(void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; + if (isCanChat != 1) { + self.bottomToolBtn.hidden = NO; + }else{ + self.bottomToolBtn.hidden = YES; + } +} +-(void)viewDidLayoutSubviews{ + [super viewDidLayoutSubviews]; + self.bottomToolBtn.frame = CGRectMake(0, self.view.bounds.size.height - TabBar_Height , Screen_Width, TabBar_Height); +} +-(void)alertChat{ + NSString* canChatMoney = [[NSUserDefaults standardUserDefaults] objectForKey:@"kIsCanChatMoney"]; + UIWindow*keyWindow = nil; + NSArray *windows = [UIApplication sharedApplication].windows; + for (UIWindow *window in windows){ + if(window.isKeyWindow){ + keyWindow = window; + break; + } + } + UINavigationController*na = (UINavigationController*)keyWindow.rootViewController; + NSString *title = [NSString stringWithFormat:@"充值不足%@元,您无法发送消息",canChatMoney]; + UIAlertController *al = [UIAlertController alertControllerWithTitle:title message:@"" preferredStyle:(UIAlertControllerStyleAlert)]; + [al addAction:[UIAlertAction actionWithTitle:@"去充值" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { + UIViewController *vc = [[NSClassFromString(@"QXRechargeViewcController") alloc] init]; + UINavigationController *naV = [[UINavigationController alloc] initWithRootViewController:vc]; + naV.modalPresentationStyle = UIModalPresentationFullScreen; + [na presentViewController:naV animated:YES completion:nil]; + }]]; + [al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { + + }]]; + [na presentViewController:al animated:YES completion:nil]; +} #pragma mark - Override Methods diff --git a/TUIKit/TUIChat/UI_Classic/Input/TUIInputBar.m b/TUIKit/TUIChat/UI_Classic/Input/TUIInputBar.m index 9fb38d2..2fd7426 100644 --- a/TUIKit/TUIChat/UI_Classic/Input/TUIInputBar.m +++ b/TUIKit/TUIChat/UI_Classic/Input/TUIInputBar.m @@ -213,14 +213,14 @@ #pragma mark - Event response - (void)onMicButtonClicked:(UIButton *)sender { - NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; -#if DEBUG - isCanChat = 1; -#endif - if (isCanChat != 1) { - [self alertChat]; - return; - } +// NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; +//#if DEBUG +// isCanChat = 1; +//#endif +// if (isCanChat != 1) { +// [self alertChat]; +// return; +// } _recordButton.hidden = NO; _inputTextView.hidden = YES; _micButton.hidden = YES; @@ -237,14 +237,14 @@ } - (void)onKeyboardButtonClicked:(UIButton *)sender { - NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; -#if DEBUG - isCanChat = 1; -#endif - if (isCanChat != 1) { - [self alertChat]; - return; - } +// NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; +//#if DEBUG +// isCanChat = 1; +//#endif +// if (isCanChat != 1) { +// [self alertChat]; +// return; +// } _micButton.hidden = NO; _keyboardButton.hidden = YES; _recordButton.hidden = YES; @@ -257,14 +257,14 @@ } - (void)onFaceEmojiButtonClicked:(UIButton *)sender { - NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; -#if DEBUG - isCanChat = 1; -#endif - if (isCanChat != 1) { - [self alertChat]; - return; - } +// NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; +//#if DEBUG +// isCanChat = 1; +//#endif +// if (isCanChat != 1) { +// [self alertChat]; +// return; +// } _micButton.hidden = NO; _faceButton.hidden = YES; _keyboardButton.hidden = NO; @@ -279,14 +279,14 @@ } - (void)onMoreButtonClicked:(UIButton *)sender { - NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; -#if DEBUG - isCanChat = 1; -#endif - if (isCanChat != 1) { - [self alertChat]; - return; - } +// NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; +//#if DEBUG +// isCanChat = 1; +//#endif +// if (isCanChat != 1) { +// [self alertChat]; +// return; +// } if (_delegate && [_delegate respondsToSelector:@selector(inputBarDidTouchMore:)]) { [_delegate inputBarDidTouchMore:self]; } @@ -371,45 +371,45 @@ } } --(void)alertChat{ - NSString* canChatMoney = [[NSUserDefaults standardUserDefaults] objectForKey:@"kIsCanChatMoney"]; - UIWindow*keyWindow = nil; - NSArray *windows = [UIApplication sharedApplication].windows; - for (UIWindow *window in windows){ - if(window.isKeyWindow){ - keyWindow = window; - break; - } - } - UINavigationController*na = (UINavigationController*)keyWindow.rootViewController; - NSString *title = [NSString stringWithFormat:@"充值不足%@元,您无法发送消息",canChatMoney]; - UIAlertController *al = [UIAlertController alertControllerWithTitle:title message:@"" preferredStyle:(UIAlertControllerStyleAlert)]; - [al addAction:[UIAlertAction actionWithTitle:@"去充值" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { - UIViewController *vc = [[NSClassFromString(@"QXRechargeViewcController") alloc] init]; - UINavigationController *naV = [[UINavigationController alloc] initWithRootViewController:vc]; - naV.modalPresentationStyle = UIModalPresentationFullScreen; - [na presentViewController:naV animated:YES completion:nil]; - }]]; - [al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { - - }]]; - [na presentViewController:al animated:YES completion:nil]; -} +//-(void)alertChat{ +// NSString* canChatMoney = [[NSUserDefaults standardUserDefaults] objectForKey:@"kIsCanChatMoney"]; +// UIWindow*keyWindow = nil; +// NSArray *windows = [UIApplication sharedApplication].windows; +// for (UIWindow *window in windows){ +// if(window.isKeyWindow){ +// keyWindow = window; +// break; +// } +// } +// UINavigationController*na = (UINavigationController*)keyWindow.rootViewController; +// NSString *title = [NSString stringWithFormat:@"充值不足%@元,您无法发送消息",canChatMoney]; +// UIAlertController *al = [UIAlertController alertControllerWithTitle:title message:@"" preferredStyle:(UIAlertControllerStyleAlert)]; +// [al addAction:[UIAlertAction actionWithTitle:@"去充值" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { +// UIViewController *vc = [[NSClassFromString(@"QXRechargeViewcController") alloc] init]; +// UINavigationController *naV = [[UINavigationController alloc] initWithRootViewController:vc]; +// naV.modalPresentationStyle = UIModalPresentationFullScreen; +// [na presentViewController:naV animated:YES completion:nil]; +// }]]; +// [al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) { +// +// }]]; +// [na presentViewController:al animated:YES completion:nil]; +//} #pragma mark - Text input #pragma mark-- UITextViewDelegate - (void)textViewDidBeginEditing:(UITextView *)textView { - NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; +// NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"]; //#if DEBUG // isCanChat = 1; //#endif - if (TUIChatConfig.defaultConfig.isAppStore) { - isCanChat = 1; - } - if (isCanChat != 1) { - [self.inputTextView resignFirstResponder]; - [self alertChat]; - return; - } +// if (TUIChatConfig.defaultConfig.isAppStore) { +// isCanChat = 1; +// } +// if (isCanChat != 1) { +// [self.inputTextView resignFirstResponder]; +// [self alertChat]; +// return; +// } self.keyboardButton.hidden = YES; self.micButton.hidden = NO; self.faceButton.hidden = NO; diff --git a/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.h b/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.h index 4a77af2..32cfc98 100644 --- a/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.h +++ b/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.h @@ -56,6 +56,8 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic) BOOL isShowConversationGroup; - (void)startConversation:(V2TIMConversationType)type; + +-(void)reloadConversationList; @end NS_ASSUME_NONNULL_END diff --git a/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.m b/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.m index 81455e5..66f6f31 100644 --- a/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.m +++ b/TUIKit/TUIConversation/UI_Classic/UI/TUIConversationListController.m @@ -63,7 +63,47 @@ - (TUIConversationListBaseDataProvider *)dataProvider { return self.settingDataProvider; } +-(void)reloadConversationList{ + self.settingDataProvider.delegate = nil; + self.settingDataProvider = nil; + [_tableViewForAll removeFromSuperview]; + _tableViewForAll.delegate = nil; + _tableViewForAll = nil; + + TUIConversationListDataProvider *dataProvider = [[TUIConversationListDataProvider alloc] init]; + self.settingDataProvider = dataProvider; + [self.tableViewContainer addSubview:self.tableViewForAll]; + if (self.isShowConversationGroup) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + NSArray *extensionList = [TUICore getExtensionList:TUICore_TUIConversationExtension_ConversationGroupListBanner_ClassicExtensionID param:nil]; + @weakify(self); + [[[RACObserve(self, actualShowConversationGroup) distinctUntilChanged] skip:0] subscribeNext:^(NSNumber *showConversationGroup) { + @strongify(self); + if ([showConversationGroup boolValue]) { + [self.tableViewContainer setFrame:CGRectMake(0, self.groupView.mm_maxY, self.view.mm_w, self.viewHeight - self.groupView.mm_maxY)]; + self.groupItemList = [NSMutableArray array]; + [self addGroup:self.allGroupItem]; + + for (TUIExtensionInfo *info in extensionList) { + TUIConversationGroupItem *groupItem = info.data[TUICore_TUIConversationExtension_ConversationGroupListBanner_GroupItemKey]; + if (groupItem) { + [self addGroup:groupItem]; + } + } + [self onSelectGroup:self.allGroupItem]; + } else { + self.tableViewContainer.frame = CGRectMake(0, self.bannerView.mm_maxY, self.view.mm_w, self.viewHeight - self.bannerView.mm_maxY); + self.tableViewForAll.frame = self.tableViewContainer.bounds; + } + }]; + self.actualShowConversationGroup = (extensionList.count > 0); + }); + } else { + self.tableViewContainer.frame = CGRectMake(0, 0, self.view.mm_w, self.viewHeight - TabBar_Height-NavBar_Height-StatusBar_Height); + self.tableViewForAll.frame = self.tableViewContainer.bounds; + } +} #pragma mark - Life Cycle - (void)viewDidLoad { [super viewDidLoad];