房间活动
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user