粉丝团任务弹窗

This commit is contained in:
chenguilong
2022-04-07 21:13:19 +08:00
parent a1cbfcc2af
commit 6c4360ab96
39 changed files with 1224 additions and 114 deletions

View File

@@ -33,6 +33,8 @@
#import "AcrossRoomPKPanelModel.h"
#import "LittleGameInfoModel.h"
#import "XPAnchorFansRelationModel.h"
#import "XPAnchorFansJoinModel.h"
#import "XPAnchorFansTaskModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPAnchorAudienceUpMicView.h"
@@ -80,6 +82,8 @@
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
///
@property (nonatomic,strong) XPLittleGameRoomListView *gameListView;
@property (nonatomic, strong) XPAnchorFansRelationModel *relationFansModel;
@end
@implementation XPRoomFunctionContainerView
@@ -140,9 +144,8 @@
}];
[self.fansTeamEntranceView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contributionButton.mas_bottom).mas_offset(5);
make.left.mas_equalTo(-12);
make.height.mas_equalTo(26);
make.width.mas_equalTo(90);
make.left.mas_equalTo(0);
make.height.mas_equalTo(37);
}];
[self.topicStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
@@ -633,22 +636,49 @@
NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid];
RoomInfoModel *roomInfo = self.delegate.getRoomInfo;
if ([[[AccountInfoStorage instance] getUid] isEqualToString:roomUid]) {///
if (roomInfo.hadOpenAnchorFans) {
// if (!self.relationFansModel) {
// [Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
// XPAnchorFansRelationModel *model = [XPAnchorFansRelationModel modelWithJSON:data.data];
// [self updateFansTeamEntranceView:model];
// } teamUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
// return;
// }
if (self.relationFansModel.isCurrentRoomAnchor) {///
XPWebViewController * webVC =[[XPWebViewController alloc] init];
if (self.relationFansModel.hasFansTeamCurrentRoom) {
webVC.url = URLWithType(kAnchorFansListURL);
} else {
XPWebViewController * webVC =[[XPWebViewController alloc] init];
webVC.url = URLWithType(kAnchorFansOpenURL);
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
}
webVC.roomUid = roomUid;
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
} else {
// XPAnchorFansTeamViewController *fansTeamVc = [[XPAnchorFansTeamViewController alloc] initWithRoomUid:roomUid];
// [self.delegate.getCurrentNav presentViewController:fansTeamVc animated:YES completion:nil];
XPAnchorFansTaskViewController *fansTaskVc = [[XPAnchorFansTaskViewController alloc] initWithRoomUid:roomUid];
[self.delegate.getCurrentNav presentViewController:fansTaskVc animated:YES completion:nil];
if (self.relationFansModel.hasFansTeamCurrentRoom) {//
if (self.relationFansModel.isAnchorFans) {
[Api requestFansTeamTask:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code != 200) {
[XCHUDTool showErrorWithMessage:msg];
return;
}
XPAnchorFansTaskModel *model = [XPAnchorFansTaskModel modelWithJSON:data.data];
XPAnchorFansTaskViewController *fansTaskVc = [[XPAnchorFansTaskViewController alloc] initWithRoomUid:roomUid];
fansTaskVc.model = model;
[self.delegate.getCurrentNav presentViewController:fansTaskVc animated:YES completion:nil];
} teamUid:roomUid];
} else {
[Api requestJoinFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code != 200) {
[XCHUDTool showErrorWithMessage:msg];
return;
}
XPAnchorFansJoinModel *model = [XPAnchorFansJoinModel modelWithJSON:data.data];
XPAnchorFansTeamViewController *fansTeamVc = [[XPAnchorFansTeamViewController alloc] initWithRoomUid:roomUid];
fansTeamVc.model = model;
[self.delegate.getCurrentNav presentViewController:fansTeamVc animated:YES completion:nil];
} teamUid:roomUid];
}
}
}
}
#pragma mark -
@@ -795,18 +825,27 @@
#pragma mark -
- (void)updateFansTeamEntranceView:(XPAnchorFansRelationModel *)model {
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
if ([[[AccountInfoStorage instance] getUid] integerValue] == roomInfo.uid) {
roomInfo.hadOpenAnchorFans = model.hasFansTeamCurrentRoom;
roomInfo.anchorFansRedDot = model.isRedPop;
if (model.hasFansTeamCurrentRoom) {//
self.fansTeamEntranceView.hidden = NO;
} else {
// self.fansTeamEntranceView.hidden = YES;
}
} else {
}
// RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
// roomInfo.anchorFansRedDot = model.isRedPop;
// if ([[[AccountInfoStorage instance] getUid] integerValue] == roomInfo.uid) {///
// if (model.hasFansTeamCurrentRoom) {//
// self.fansTeamEntranceView.title = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
// } else {
// self.fansTeamEntranceView.title = @"开通粉丝团";
// }
// } else {
// if (model.hasFansTeamCurrentRoom) {//
// if (model.isAnchorFans) {
// self.fansTeamEntranceView.title = [NSString stringWithFormat:@"粉丝团(%ld", model.anchorFansNum];
// } else {
// self.fansTeamEntranceView.title = @"加入我的粉丝团吧~";
// }
// } else {
// self.fansTeamEntranceView.title = @"该主播暂未开通粉丝团";
// }
// }
self.fansTeamEntranceView.model = model;
self.relationFansModel = model;
}
#pragma mark - XPRoomLittleGameListViewDelegate
@@ -904,7 +943,6 @@
- (XPAnchorFansTeamEntranceView *)fansTeamEntranceView {
if (!_fansTeamEntranceView) {
_fansTeamEntranceView = [[XPAnchorFansTeamEntranceView alloc]init];
// _fansTeamEntranceView.hidden = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFansTeamRecognizer)];
[_fansTeamEntranceView addGestureRecognizer:tap];
}