活动改造

This commit is contained in:
liyuhua
2023-11-15 16:49:59 +08:00
parent 56103bb220
commit 90eab408d0
6 changed files with 262 additions and 13 deletions

View File

@@ -206,6 +206,8 @@
234489082AC3C5DA0070E5D5 /* SudMGP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 234489072AC3C5DA0070E5D5 /* SudMGP.framework */; };
234489092AC3C5FF0070E5D5 /* SudMGP.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 234489072AC3C5DA0070E5D5 /* SudMGP.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
234D821E2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 234D821D2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.m */; };
235A451A2B04A352009753F5 /* PIRoomActivityWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A45192B04A352009753F5 /* PIRoomActivityWebView.m */; };
235A451D2B04A452009753F5 /* PIRoomActivityWebCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 235A451C2B04A452009753F5 /* PIRoomActivityWebCell.m */; };
236896A02AE6720600EED5F2 /* PIRoomGiftBroadcastWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 2368969F2AE6720600EED5F2 /* PIRoomGiftBroadcastWindow.m */; };
2369F9912A89CE0E00563B48 /* PIUserSexView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2369F9902A89CE0E00563B48 /* PIUserSexView.m */; };
2369F9932A8B21EB00563B48 /* pi_treasure_fairy_gift_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 2369F9922A8B21EA00563B48 /* pi_treasure_fairy_gift_bg.svga */; };
@@ -1870,6 +1872,10 @@
234489072AC3C5DA0070E5D5 /* SudMGP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SudMGP.framework; sourceTree = "<group>"; };
234D821C2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "YYTextAsyncLayer+PITextAsyncLayer.h"; path = "YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.h"; sourceTree = SOURCE_ROOT; };
234D821D2AEC57CF0022EFEB /* YYTextAsyncLayer+PITextAsyncLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "YYTextAsyncLayer+PITextAsyncLayer.m"; path = "YuMi/Appdelegate/YYTextAsyncLayer+PITextAsyncLayer.m"; sourceTree = SOURCE_ROOT; };
235A45182B04A352009753F5 /* PIRoomActivityWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebView.h; sourceTree = "<group>"; };
235A45192B04A352009753F5 /* PIRoomActivityWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomActivityWebView.m; sourceTree = "<group>"; };
235A451B2B04A452009753F5 /* PIRoomActivityWebCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomActivityWebCell.h; sourceTree = "<group>"; };
235A451C2B04A452009753F5 /* PIRoomActivityWebCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomActivityWebCell.m; sourceTree = "<group>"; };
2368969E2AE6720600EED5F2 /* PIRoomGiftBroadcastWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomGiftBroadcastWindow.h; sourceTree = "<group>"; };
2368969F2AE6720600EED5F2 /* PIRoomGiftBroadcastWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomGiftBroadcastWindow.m; sourceTree = "<group>"; };
2369F98F2A89CE0E00563B48 /* PIUserSexView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIUserSexView.h; sourceTree = "<group>"; };
@@ -9695,6 +9701,10 @@
E8AE427227153A3500BEEBB2 /* XPRoomActivityContainerView.m */,
9BAC92EC28E6989400147DD8 /* XPRoomActivityPlayView.h */,
9BAC92ED28E6989400147DD8 /* XPRoomActivityPlayView.m */,
235A45182B04A352009753F5 /* PIRoomActivityWebView.h */,
235A45192B04A352009753F5 /* PIRoomActivityWebView.m */,
235A451B2B04A452009753F5 /* PIRoomActivityWebCell.h */,
235A451C2B04A452009753F5 /* PIRoomActivityWebCell.m */,
);
path = ActivityContainerView;
sourceTree = "<group>";
@@ -10826,6 +10836,7 @@
E88C72A02828FCD40047FB2B /* XPMusicLibraryPlayView.m in Sources */,
E823E38E290BE8BD00EADD86 /* WishGiftInfoUpdateModel.m in Sources */,
E80EC80A28ACD84000D133C5 /* QEmotionBoardView.m in Sources */,
235A451A2B04A352009753F5 /* PIRoomActivityWebView.m in Sources */,
E8998D962859DD6F00C68558 /* UIView+Corner.m in Sources */,
E8EEB91126FC6AE2007C6EBA /* XPMineUserInfoEditProtocol.h in Sources */,
E87E625D2A3F5622002F68C9 /* XPNewHomeViewController.m in Sources */,
@@ -11849,6 +11860,7 @@
9B0997A327F19DE500EB8F14 /* QGHWDShaders.metal in Sources */,
E8778AF02988EF0600CF139B /* XPSessionSayHelloViewController.m in Sources */,
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */,
235A451D2B04A452009753F5 /* PIRoomActivityWebCell.m in Sources */,
E8098CA7282E00920090B9F0 /* Api+Monents.m in Sources */,
E896EFA92771AEEC00AD2CC1 /* XPMineAttentionTableViewCell.m in Sources */,
E8F1559328129EBA00EE8C06 /* ContentSecretaryModel.m in Sources */,

View File

@@ -0,0 +1,17 @@
//
// PIRoomActivityWebCell.h
// YuMi
//
// Created by duoban on 2023/11/15.
//
#import <UIKit/UIKit.h>
#import "ActivityInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface PIRoomActivityWebCell : UICollectionViewCell
@property(nonatomic,assign) BOOL pi_isChoose;
@property(nonatomic,strong) ActivityInfoModel *infoModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,52 @@
//
// PIRoomActivityWebCell.m
// YuMi
//
// Created by duoban on 2023/11/15.
//
#import "PIRoomActivityWebCell.h"
@interface PIRoomActivityWebCell()
@property(nonatomic,strong) NetImageView *bgImageView;
@end
@implementation PIRoomActivityWebCell
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.bgImageView];
}
-(void)installConstraints{
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.contentView);
}];
}
-(void)setPi_isChoose:(BOOL)pi_isChoose{
_pi_isChoose = pi_isChoose;
_bgImageView.layer.borderWidth = _pi_isChoose ? 2 : 0;
}
-(void)setInfoModel:(ActivityInfoModel *)infoModel{
_infoModel = infoModel;
_bgImageView.imageUrl = _infoModel.bannerPic;
}
#pragma mark -
- (NetImageView *)bgImageView{
if(!_bgImageView){
NetImageConfig *config = [[NetImageConfig alloc]init]; config.placeHolder = [UIImageConstant defalutBannerPlaceholder];
_bgImageView = [[NetImageView alloc]initWithConfig:config];
_bgImageView.contentMode = UIViewContentModeScaleAspectFit;
_bgImageView.layer.cornerRadius = kGetScaleWidth(4);
_bgImageView.layer.masksToBounds = YES;
_bgImageView.layer.borderWidth = 0;
_bgImageView.layer.borderColor = UIColorFromRGB(0x9168FA).CGColor;
}
return _bgImageView;
}
@end

View File

@@ -0,0 +1,20 @@
//
// PIRoomActivityWebView.h
// YuMi
//
// Created by duoban on 2023/11/15.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface PIRoomActivityWebView : UIView
@property(nonatomic,strong) NSMutableArray *infoList;
///地址
@property (nonatomic,copy) NSString *url;
///房间uid
@property (nonatomic,copy) NSString *roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,147 @@
//
// PIRoomActivityWebView.m
// YuMi
//
// Created by duoban on 2023/11/15.
//
#import "PIRoomActivityWebView.h"
#import "PIRoomActivityWebCell.h"
#import "XPWebViewController.h"
#define kWebViewScale ((CGFloat)KScreenHeight / (CGFloat)812)
@interface PIRoomActivityWebView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property(nonatomic,strong) UIButton *pi_backBtn;
@property(nonatomic,strong) UIView *bgView;
@property(nonatomic,strong) UICollectionView *collectionView;
///h5
@property (nonatomic, strong) XPWebViewController *webVC;
@property(nonatomic,assign) NSInteger path;
@end
@implementation PIRoomActivityWebView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
@kWeakify(self);
self.webVC.CloseWebViewBlock = ^(BOOL result) {
@kStrongify(self);
[self dissViewAction];
};
}
return self;
}
-(void)installUI{
[self addSubview:self.pi_backBtn];
[self addSubview:self.bgView];
[self.bgView addSubview:self.collectionView];
[self.bgView addSubview:self.webVC.view];
}
-(void)installConstraints{
[self.pi_backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.equalTo(self);
make.height.mas_equalTo(643 * kWebViewScale);
}];
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.equalTo(self.bgView);
make.height.mas_equalTo(kGetScaleWidth(42));
make.top.mas_equalTo(kGetScaleWidth(10));
}];
[self.webVC.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.equalTo(self.bgView);
make.top.mas_equalTo(kGetScaleWidth(60));
}];
}
#pragma mark - UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return self.infoList.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
PIRoomActivityWebCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([PIRoomActivityWebCell class]) forIndexPath:indexPath];
cell.infoModel = [self.infoList safeObjectAtIndex1:indexPath.row];
cell.pi_isChoose = self.path == indexPath.row;
return cell;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
ActivityInfoModel *model = [_infoList safeObjectAtIndex1:indexPath.row];
self.webVC.url = model.skipUri;
self.path = indexPath.row;
[self.collectionView reloadData];
}
-(void)dissViewAction{
[UIView animateWithDuration:0.2 animations:^{
self.frame = CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight);
}completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
- (void)setRoomUid:(NSString *)roomUid{
_roomUid = roomUid;
self.webVC.roomUid = _roomUid;
}
- (void)setUrl:(NSString *)url{
_url = url;
self.webVC.url = _url;
}
-(void)setInfoList:(NSMutableArray *)infoList{
_infoList = infoList;
for (int i = 0; i < _infoList.count; i++) {
ActivityInfoModel *model = _infoList[i];
if([model.skipUri isEqualToString:_url]){
self.path = i;
break;
}
}
[self.collectionView reloadData];
}
#pragma mark -
- (UICollectionView *)collectionView{
if (!_collectionView) {
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = kGetScaleWidth(8);
layout.minimumInteritemSpacing = kGetScaleWidth(8);
layout.itemSize = CGSizeMake(kGetScaleWidth(90), kGetScaleWidth(42));
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.sectionInset = UIEdgeInsetsMake(0, kGetScaleWidth(8), 0, kGetScaleWidth(8));
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.backgroundColor = [UIColor clearColor];
[_collectionView registerClass:[PIRoomActivityWebCell class] forCellWithReuseIdentifier:NSStringFromClass([PIRoomActivityWebCell class])];
}
return _collectionView;
}
- (XPWebViewController *)webVC {
if (_webVC == nil) {
_webVC = [[XPWebViewController alloc] init];
_webVC.isProperty = YES;
_webVC.view.backgroundColor = [UIColor clearColor];
CGFloat heigth = 643 * kWebViewScale - kGetScaleWidth(60);
[_webVC.view setCornerWithLeftTopCorner:kGetScaleWidth(10) rightTopCorner:kGetScaleWidth(10) bottomLeftCorner:0 bottomRightCorner:0 size:CGSizeMake(KScreenWidth, heigth)];
}
return _webVC;
}
- (UIView *)bgView{
if(!_bgView){
_bgView = [UIView new];
_bgView.backgroundColor = UIColorFromRGB(0x262629);
[_bgView setCornerWithLeftTopCorner:kGetScaleWidth(8) rightTopCorner:kGetScaleWidth(8) bottomLeftCorner:0 bottomRightCorner:0 size:CGSizeMake(KScreenWidth,642 *kWebViewScale)];
}
return _bgView;
}
- (UIButton *)pi_backBtn{
if(!_pi_backBtn){
_pi_backBtn = [UIButton new];
[_pi_backBtn addTarget:self action:@selector(dissViewAction) forControlEvents:UIControlEventTouchUpInside];
}
return _pi_backBtn;
}
@end

View File

@@ -37,6 +37,7 @@
#import "XPTreasureFairyViewController.h"
#import "PIRoomEnterRedPacketView.h"
#import "BaseNavigationController.h"
#import "PIRoomActivityWebView.h"
UIKIT_EXTERN NSString *kShowFirstRechargeView;
@interface XPRoomActivityContainerView ()<SDCycleScrollViewDelegate,PIRoomEnterRedPacketViewDelegate>
///
@@ -372,11 +373,14 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
NSArray *imageUrlList = cycleScrollView.imageURLStringsGroup;
if (imageUrlList.count > index) {
NSString *pic = imageUrlList[index];
NSMutableArray *inftList = [NSMutableArray array];
ActivityInfoModel * info;
for (ActivityInfoModel * getInfo in self.activityList) {
if([getInfo.bannerPic isEqualToString:pic]){
info = getInfo;
break;;
}
if([getInfo.bannerPic hasPrefix:@"http"]){
[inftList addObject:getInfo];
}
}
if(info == nil)return;
@@ -404,18 +408,15 @@ UIKIT_EXTERN NSString *kShowFirstRechargeView;
[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.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
webView.url = info.skipUri;
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
return;
}
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.isPush = YES;
webVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
webVC.url = info.skipUri;
[self.hostDelegate.getCurrentNav pushViewController:webVC animated:YES];
PIRoomActivityWebView * webView = [[PIRoomActivityWebView alloc]initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight)];
webView.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
webView.url = info.skipUri;
webView.infoList = inftList;
[kWindow addSubview:webView];
[UIView animateWithDuration:0.2 animations:^{
webView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
}];
}
}
}