房间活动

This commit is contained in:
fengshuo
2021-12-14 15:53:47 +08:00
parent dffb100a45
commit 1a7f34ca64
6 changed files with 126 additions and 2 deletions

View File

@@ -164,6 +164,7 @@
E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E824546026F5F4E400BE8163 /* XPMineResetPayPwdViewController.m */; };
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E824546326F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m */; };
E824546626F5FF6000BE8163 /* XPMineResetPayPasswordProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E824546526F5FF5100BE8163 /* XPMineResetPayPasswordProtocol.h */; };
E8252FEE27687DF1002B3164 /* ActivityInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8252FED27687DF1002B3164 /* ActivityInfoModel.m */; };
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */ = {isa = PBXBuildFile; fileRef = E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */; };
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; };
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */; };
@@ -653,6 +654,8 @@
E824546226F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineResetPayPasswordPresenter.h; sourceTree = "<group>"; };
E824546326F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineResetPayPasswordPresenter.m; sourceTree = "<group>"; };
E824546526F5FF5100BE8163 /* XPMineResetPayPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineResetPayPasswordProtocol.h; sourceTree = "<group>"; };
E8252FEC27687DF1002B3164 /* ActivityInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ActivityInfoModel.h; sourceTree = "<group>"; };
E8252FED27687DF1002B3164 /* ActivityInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ActivityInfoModel.m; sourceTree = "<group>"; };
E82EE0F6272FDDFA00D15DC1 /* UserPrivacyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserPrivacyView.h; sourceTree = "<group>"; };
E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserPrivacyView.m; sourceTree = "<group>"; };
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = "<group>"; };
@@ -1693,6 +1696,8 @@
children = (
E89D60BF271D64B9001F8895 /* RoomInfoModel.h */,
E89D60C0271D64B9001F8895 /* RoomInfoModel.m */,
E8252FEC27687DF1002B3164 /* ActivityInfoModel.h */,
E8252FED27687DF1002B3164 /* ActivityInfoModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -3042,6 +3047,7 @@
E81C279626EB39CC0031E639 /* LoginForgetPasswordPresent.m in Sources */,
18EE3FF42750FA3700A452BF /* UIView+NIM.m in Sources */,
E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */,
E8252FEE27687DF1002B3164 /* ActivityInfoModel.m in Sources */,
E8AC723526F49939007D6E91 /* XPMineNotificaPresenter.m in Sources */,
18EE3FE22750C29D00A452BF /* NIMBadgeView.m in Sources */,
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */,

View File

@@ -80,6 +80,14 @@ NS_ASSUME_NONNULL_BEGIN
micUid:(NSString *)micUid
position:(NSString *)position
uid:(NSString *)uid;
#pragma mark - 活动
/// 房间活动页的列表
/// @param completion 完成
/// @param roomId 房间的id
/// @param type 类型 2 房间的 1 首页的
+ (void)roomActivityList:(HttpRequestHelperCompletion)completion
roomId:(NSString *)roomId
type:(NSString *)type;
@end
NS_ASSUME_NONNULL_END

View File

@@ -88,5 +88,15 @@
[self makeRequest:@"room/gift/value/up/mic" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, micUid, position, uid, nil];
}
#pragma mark -
///
/// @param completion
/// @param roomId id
/// @param type 2 1
+ (void)roomActivityList:(HttpRequestHelperCompletion)completion roomId:(NSString *)roomId type:(NSString *)type {
[self makeRequest:@"home/banner" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomId, type, nil];
}
@end

View File

@@ -0,0 +1,35 @@
//
// ActivityInfoModel.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/14.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
///跳转的类型
typedef NS_ENUM(NSInteger, ActivitySkipType) {
ActivitySkipType_Room = 2,
ActivitySkipType_Web,
};
///跳转h5的话 是全屏还是半屏
typedef NS_ENUM(NSInteger, ActivityShowType) {
ActivityShowType_Full = 1,
ActivityShowType_Half = 2,
};
@interface ActivityInfoModel : NSObject
///活动的图片
@property (nonatomic, copy)NSString *bannerPic;
///跳转类型
@property (nonatomic, assign)ActivitySkipType skipType;
///如果是跳转房间的话 那就是房主的uid 如果是h5的话 那就是链接
@property (nonatomic, copy)NSString *skipUri;
///跳转h5类型
@property (nonatomic, assign)NSInteger showType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// ActivityInfoModel.m
// xplan-ios
//
// Created by on 2021/12/14.
//
#import "ActivityInfoModel.h"
@implementation ActivityInfoModel
@end

View File

@@ -10,14 +10,19 @@
#import <Masonry/Masonry.h>
#import <SDCycleScrollView/SDCycleScrollView.h>
///Tool
#import "Api+Room.h"
#import "ClientConfig.h"
#import "NetImageView.h"
#import "TTPopup.h"
///Model
#import "UserInfoModel.h"
#import "RoomInfoModel.h"
#import "ActivityInfoModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPCandyTreeViewController.h"
#import "XPWebViewController.h"
#import "XPRoomViewController.h"
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate>
///
@@ -30,6 +35,8 @@
@property (nonatomic,strong) NetImageView *candyTreeImageView;
///host
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
///
@property (nonatomic,copy) NSArray<ActivityInfoModel *> *activityList;
@end
@implementation XPRoomActivityContainerView
@@ -40,6 +47,7 @@
self.hostDelegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
[self requestActivityList];
[self configCandyTree];
}
return self;
@@ -67,6 +75,31 @@
}];
}
- (void)requestActivityList {
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
[Api roomActivityList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
if (array.count <=0) return;
self.cycleScrollView.hidden = NO;
self.activityList = array;
NSMutableArray * picList = [NSMutableArray array];
[array enumerateObjectsUsingBlock:^(ActivityInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.bannerPic.length > 0) {
[picList addObject:obj.bannerPic];
}
}];
self.cycleScrollView.imageURLStringsGroup = picList;
if (array.count > 1) {
[self.cycleScrollView setAutoScroll:YES];
self.cycleScrollView.autoScrollTimeInterval = 3;
} else {
[self.cycleScrollView setAutoScroll:NO];
}
}
} roomId:roomId type:@"2"];
}
- (void)configCandyTree {
UserInfoModel * userInfo = self.hostDelegate.getUserInfo;
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
@@ -86,6 +119,26 @@
- (void)onRoomUpdate {
[self configCandyTree];
}
#pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
if (self.activityList.count > index) {
ActivityInfoModel * info = [self.activityList objectAtIndex:index];
if (info.skipType == ActivitySkipType_Room) {
[self.hostDelegate exitRoom];
[XPRoomViewController openRoom:info.skipUri viewController:self.hostDelegate.getCurrentNav];
} else if(info.skipType == ActivitySkipType_Web) {
if (info.showType == ActivityShowType_Half) {
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = info.skipUri;
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
return;
}
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.url = info.skipUri;
[self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
}
}
}
#pragma mark - Event Response
- (void)candyTreeTapRecognizer {
@@ -128,7 +181,7 @@
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentCenter;
_stackView.spacing = 10;
_stackView.spacing = 5;
}
return _stackView;
}