123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917 |
- //
- // YOUPAILZUserShowHeaderView.m
- // VQU
- //
- // Created by CY on 2021/7/10.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZUserShowHeaderView.h"
- #import "SDCycleScrollView.h"
- #import "LCCommonHttp.h"
- #import "LOTAnimationView.h"
- #import "YYImage.h"
- #import "YOUPAILZLiveModel.h"
- #import "YOUPAILZLiveAudienceVC.h"
- #import "YOUPAILZEndLiveHintView.h"
- #import "YOUPAILZLevelView.h"
- #import "YOUPAIHRAgeSexView.h"
- #import "YOUPAILZChatRoomPasswordWindow.h"
- #import "YOUPAILZChatRoomVC.h"
- #import "UIViewController+TFPresent.h"
- #import "YOUPAIRightCollectionView.h"
- #import "YOUPAIShowHeaderBigImageCell.h"
- #import "ZFPlayerControlView.h"
- #import "ZFAVPlayerManager.h"
- #import "YOUPAIZFDouYinControlView.h"
- #import "YOUPAISexView.h"
- #import "YBIBVideoData.h"
- @interface YOUPAILZUserShowHeaderView () <UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,YBImageBrowserDelegate>
- @property (nonatomic, strong)YOUPAILCUserShowModel *youpaipmodel;
- @property (nonatomic,weak) UIImageView *youpaipanimationImgV;
- @property (nonatomic, strong)NSArray *youpaipavatarUrls;
- /* avatarCountL */
- @property (strong, nonatomic) UILabel *youpaipavatarCountL;
- @property (nonatomic,strong) UICollectionView * collectionView;
- @property (nonatomic,strong) UIButton * videoCoverImgV;
- @property(nonatomic,strong)YOUPAIRightCollectionView *rightCollectionView;
- @property (nonatomic, strong) ZFPlayerController *player;
- @property (nonatomic, strong) UIImageView *containerView;
- @property (nonatomic, strong) YOUPAIZFDouYinControlView *youpaipcontrolView;
- @property(nonatomic,strong)UIView *youpaipmemberAvatarBgV;
- @property(nonatomic,strong)NSMutableArray *youpaipmemberAvatars;
- @end
- @implementation YOUPAILZUserShowHeaderView
- - (instancetype)initWithModel:(YOUPAILCUserShowModel *)model{
- if (self = [super init]) {
- _youpaipmodel = model;
-
- [self youpaifinitUI];
- // [self youpaifinitAudioStream];
- }
- return self;
- }
- - (void)youpaifinitUI{
-
- UIView *infoBgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth,458.0f+StatusBarHeight+20)];
- [self addSubview:infoBgV];
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.itemSize = CGSizeMake(KScreenWidth, 375);
- flowLayout.minimumInteritemSpacing = 0.0;
- flowLayout.minimumLineSpacing = 0.0;
- flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
- self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 375) collectionViewLayout:flowLayout];
- self.collectionView.delegate = self;
- self.collectionView.backgroundColor = [UIColor whiteColor];
-
- self.collectionView.pagingEnabled = YES;
- self.collectionView.showsVerticalScrollIndicator = NO;
- self.collectionView.showsHorizontalScrollIndicator = NO;
- self.collectionView.delegate = self;
- self.collectionView.dataSource = self;
- // self.collectionView.zf_scrollViewDirection = ZFPlayerScrollViewDirectionHorizontal;
- [infoBgV addSubview:self.collectionView];
- //右下角小图片
- YOUPAIRightCollectionView *rightCollectionView = [[YOUPAIRightCollectionView alloc]initWithFrame:CGRectMake(12, 302, KScreenWidth-12-96, 44)];
- [infoBgV addSubview:rightCollectionView];
- rightCollectionView.Model = self.youpaipmodel;
- self.rightCollectionView = rightCollectionView;
- @weakify(self)
- [rightCollectionView setDidSelectImageIndex:^(NSInteger index) {
- @strongify(self)
- [self didSelectImageIndex:index];
- }];
-
- UIView *titleView = [[UIView alloc] init];
- [infoBgV addSubview:titleView];
- [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(0);
- make.centerY.mas_equalTo(rightCollectionView).offset(10);
- make.size.mas_equalTo(CGSizeMake(90, 34));
-
- }];
- UIView *statusBgView = [[UIView alloc] init];
- statusBgView.layer.cornerRadius = 8.81f;
- statusBgView.layer.masksToBounds = YES;
- statusBgView.backgroundColor = [HexColorFromRGB(0x1C1D23) colorWithAlphaComponent:0.38f];
- [titleView addSubview:statusBgView];
- [statusBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(titleView.mas_centerX);
- if (self.youpaipmodel.youpaipalbum.count == 0) {
- make.centerY.equalTo(titleView.mas_centerY);
- }else{
- make.top.offset(8.0f);
- }
-
- make.size.mas_offset(CGSizeMake([LCTools widthWithString:self.youpaipmodel.youpaipAddnewMsg withFont:[UIFont systemFontOfSize:11]]+21, 17.62f));
- }];
-
- UIView *statusView = [[UIView alloc] init];
- statusView.layer.cornerRadius = 3.0f;
- statusView.layer.masksToBounds = YES;
- [statusBgView addSubview:statusView];
- [statusView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(statusBgView);
- make.left.offset(6.5f);
- make.size.mas_offset(CGSizeMake(6.0f, 6.0f));
- }];
-
- UILabel *statusL = [[UILabel alloc] init];
- statusL.font = LCFont(11.0f);
- statusL.textColor = [UIColor whiteColor];
- [statusBgView addSubview:statusL];
- [statusL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(statusBgView);
- make.left.equalTo(statusView.mas_right).offset(3.0f);
-
- }];
-
-
- statusView.backgroundColor = kColors(self.youpaipmodel.youpaipAddnewColor);
- statusL.text = self.youpaipmodel.youpaipAddnewMsg;
-
-
- UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0, 360, KScreenWidth, 142)];
- [infoBgV addSubview:bgV];
-
- //142
- bgV.backgroundColor = [UIColor whiteColor];
-
-
- [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(16, 16)];
- CGFloat width = 0;
- if (self.youpaipmodel.youpaipnickname.length>5) {
- NSString *str = [self.youpaipmodel.youpaipnickname substringToIndex:5];
- width = [LCTools widthWithString:str withFont:LCBoldFont(18)]+5;
- }else{
- width = [LCTools widthWithString:self.youpaipmodel.youpaipnickname withFont:LCBoldFont(18)]+5;
- }
- //姓名
- UILabel *nicknameL = [[UILabel alloc] init];
- nicknameL.textColor = LZ273145Color;
- nicknameL.text = self.youpaipmodel.youpaipnickname;
- [bgV addSubview:nicknameL];
- [nicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(12.0f);
- make.top.equalTo(12);
- }];
- YOUPAISexView *sexView = [[YOUPAISexView alloc] init];
- [bgV addSubview:sexView];
- [sexView makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(nicknameL.mas_right).offset(@2);
- make.centerY.equalTo(nicknameL);
- make.size.mas_equalTo(CGSizeMake(30, 15));
- }];
- [sexView youpaifreloadWithSex:self.youpaipmodel.youpaipgender age:self.youpaipmodel.youpaipage];
- //真人图标
- UIImageView *personImageView = [UIImageView new];
- [bgV addSubview:personImageView];
- [personImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(sexView.mas_right).offset(@2);
- make.centerY.equalTo(sexView);
- make.size.mas_equalTo(CGSizeMake(37, 16));
- }];
- if (self.youpaipmodel.youpaipis_anchor ==1) {
- personImageView.image = [UIImage imageNamed:@"vqu_images_zhenrentag"];
- }
-
- // //地址
- // UILabel *cityL = [[UILabel alloc] init];
- // cityL.font = LCFont12;
- // cityL.textColor = [UIColor whiteColor];
- // cityL.text = self.youpaipmodel.youpaipinfo.youpaipcity;
- // [infoBgV addSubview:cityL];
- // [cityL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.offset(48);
- // make.bottom.offset(-10.0f);
- // }];
- //
- // UIView *line1 = [[UIView alloc] init];
- // line1.backgroundColor = [UIColor whiteColor];
- // [infoBgV addSubview:line1];
- // [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(cityL.mas_right).offset(10.0f);
- // make.centerY.equalTo(cityL.mas_centerY);
- // make.size.mas_offset(CGSizeMake(0.5f, 7.0f));
- // }];
- // //粉丝
- // UILabel *fansL = [[UILabel alloc] init];
- // fansL.font = LCFont12;
- // fansL.textColor = [UIColor whiteColor];
- // fansL.text = [NSString stringWithFormat:@"%@ 粉丝",@(self.youpaipmodel.youpaipinfo.youpaipfans_count)];
- // [infoBgV addSubview:fansL];
- // [fansL mas_makeConstraints:^(MASConstraintMaker *make) {
- //
- // make.left.equalTo(line1.mas_right).offset(10.0f);
- // make.centerY.equalTo(cityL.mas_centerY);
- // }];
- //
- // UIView *line2 = [[UIView alloc] init];
- // line2.backgroundColor = [UIColor whiteColor];
- // [infoBgV addSubview:line2];
- // [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(fansL.mas_right).offset(10.0f);
- // make.centerY.equalTo(fansL.mas_centerY);
- // make.size.mas_offset(CGSizeMake(0.5f, 7.0f));
- // }];
- // //复制
- // UIButton *idBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- // idBtn.titleLabel.font = LCFont12;
- // [idBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- // [idBtn setTitle:[NSString stringWithFormat:@"花舞号:%@",self.youpaipmodel.youpaipinfo.youpaipusercode] forState:UIControlStateNormal];
- // [idBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
- // [infoBgV addSubview:idBtn];
- // [idBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(line2.mas_right).offset(10.0f);
- // make.centerY.equalTo(fansL.mas_centerY);
- // make.height.offset(12.0f);
- // }];
- //
- // UIButton *copyIDBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- // [copyIDBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_copy_code"] forState:UIControlStateNormal];
- // [copyIDBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
- // [infoBgV addSubview:copyIDBtn];
- // [copyIDBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(idBtn.mas_right).offset(4.0f);
- // make.centerY.equalTo(idBtn.mas_centerY);
- // make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
- // }];
-
-
-
-
- // 贵族
- UIImageView *vipImgV = [[UIImageView alloc] init];
- [bgV addSubview:vipImgV];
-
- // 勋章
- UIImageView *badgeImgV = [[UIImageView alloc] init];
- [bgV addSubview:badgeImgV];
-
- // 等级
- YOUPAILZLevelView *levelView = [[YOUPAILZLevelView alloc] init];
- [bgV addSubview:levelView];
-
-
- UIView *frontV;
- if (self.youpaipmodel.youpaipvip_icon.length != 0) {
- [vipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.youpaipvip_icon]];
- [vipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(12);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
- make.top.equalTo(nicknameL.mas_bottom).offset(5);
- make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
- }];
- frontV = vipImgV;
- }
- if (self.youpaipmodel.youpaipbadge_info.youpaipfile.length != 0) {
- [badgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.youpaipbadge_info.youpaipfile]];
- [badgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(12);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
- make.top.equalTo(nicknameL.mas_bottom).offset(5);
- make.size.mas_offset(CGSizeMake(self.youpaipmodel.youpaipbadge_info.youpaipwidth, 17.0f));
- }];
- frontV = badgeImgV;
- }
- [levelView youpaifreloadWithIcon:self.youpaipmodel.youpaipgr.youpaipgrade.youpaipimg1 iconWidth:self.youpaipmodel.youpaipgr.youpaipgrade.youpaipicon_width bgImg:self.youpaipmodel.youpaipgr.youpaipgrade.youpaipimg2 bgImgWidth:self.youpaipmodel.youpaipgr.youpaipgrade.youpaipicon1_width levelName:self.youpaipmodel.youpaipgr.youpaipgrade.youpaipgrade_name level:self.youpaipmodel.youpaipgr.youpaipgrade.youpaipgrade];
- [levelView mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(12);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
- make.top.equalTo(nicknameL.mas_bottom).offset(5);
- make.size.mas_offset(levelView.mj_size);
- }];
-
- //关注
- UIButton *followBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [followBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_follow_new"] forState:UIControlStateNormal];
- [followBtn addTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- followBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 6.0f, 0, 0);
- [bgV addSubview:followBtn];
- [followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-14.0f);
- make.top.equalTo(19);
- make.size.mas_offset(CGSizeMake(28.0f, 28.0f));
- }];
- // followBtn.hidden = [@(self.model.info.is_follow) boolValue];
- [followBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_follow_new"] forState:(UIControlStateNormal)];
- [followBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_follow_new_select"] forState:(UIControlStateSelected)];
- if ([self.youpaipmodel.youpaipuserid isEqualToString:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
- followBtn.hidden = YES;
- }else{
- followBtn.hidden = NO;
- }
-
- followBtn.selected = self.youpaipmodel.youpaipis_follow == 1 ? YES : NO;
- //我的守护
- UIView *guardBgView = [UIView new];
- [bgV addSubview:guardBgView];
- [guardBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(12);
- make.bottom.mas_equalTo(-20);
- make.size.mas_equalTo(CGSizeMake(KScreenWidth-85, 44));
- }];
- guardBgView.backgroundColor = HexColorFromRGBA(0x7C69FE, 0.1);
- guardBgView.layer.cornerRadius = 8;
- guardBgView.layer.masksToBounds = YES;
- //title
- UILabel *guardTitle = [UILabel new];
- [guardBgView addSubview:guardTitle];
- [guardTitle mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(12);
- make.centerY.mas_equalTo(0);
-
- }];
- guardTitle.text = @"ta的守护团";
- guardTitle.font = [UIFont systemFontOfSize:13];
- guardTitle.textColor = LZ7C69FEColor;
- //arrow
- UIImageView *arrowImageView = [UIImageView new];
- [guardBgView addSubview:arrowImageView];
- [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-12);
- make.centerY.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(10, 10.5));
- }];
- arrowImageView.image = [UIImage imageNamed:@"vqu_images_arrow_gurad"];
-
- //3个头像
- UIView *youpaipmemberAvatarBgV = [[UIView alloc] init];
- [guardBgView addSubview:youpaipmemberAvatarBgV];
- self.youpaipmemberAvatarBgV = youpaipmemberAvatarBgV;
- [youpaipmemberAvatarBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
- make.centerY.mas_equalTo(arrowImageView);
- make.width.offset(0.0f);
- make.height.offset(30.0f);
- }];
- guardBgView.userInteractionEnabled = YES;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaipmemberAvatarBgVClick)];
- [guardBgView addGestureRecognizer:tap];
-
- [self youpaifeditBtnCountWithCount:self.youpaipmodel.youpaipguard.youpaiplist.count > 3 ? 3 : self.youpaipmodel.youpaipguard.youpaiplist.count];
- [self.youpaipmemberAvatarBgV updateConstraints:^(MASConstraintMaker *make) {
- make.width.offset(self.youpaipmemberAvatars.count * 30.0f - (self.youpaipmemberAvatars.count - 1.0f) * 4.0f);
- }];
- if (self.youpaipmodel.youpaipguard.youpaiplist.count<=0) {
- //暂无守护
- UILabel *guardNoLabel = [UILabel new];
- [guardBgView addSubview:guardNoLabel];
- [guardNoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
- make.centerY.mas_equalTo(arrowImageView);
- }];
- guardNoLabel.text = @"暂无守护";
- guardNoLabel.font = [UIFont systemFontOfSize:10];
- guardNoLabel.textColor = LZA3AABEColor;
- }
-
- for (NSInteger i = 0; i < self.youpaipmemberAvatars.count; i ++) {
- UIImageView *imgV = self.youpaipmemberAvatars[i];
- imgV.layer.cornerRadius = 15.0f;
- imgV.layer.masksToBounds = YES;
- imgV.frame = CGRectMake(i * 30.0f - i * 4.0f, 0.0f, 30.0f, 30.0f);
- NSString *url = [NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,self.youpaipmodel.youpaipguard.youpaiplist[i]];
- [imgV sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil];;
- }
- //守护按钮
- UIButton *guardBtn = [UIButton new];
- [bgV addSubview:guardBtn];
- [guardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-12);
- make.centerY.mas_equalTo(guardBgView);
- make.size.mas_equalTo(CGSizeMake(47, 45));
- }];
- [guardBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_zhuye_guard"] forState:UIControlStateNormal];
- [guardBtn addTarget:self action:@selector(guardBtnClick) forControlEvents:UIControlEventTouchUpInside];
- // if (self.youpaipmodel.youpaipinfo.youpaipvoice_status == 1) {
- // UIView *aBgV = [[UIView alloc] init];
- // aBgV.layer.cornerRadius = 13.5f;
- // aBgV.clipsToBounds = YES;
- // aBgV.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.88f];
- // [infoBgV addSubview:aBgV];
- // [aBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.offset(14.0f);
- // make.bottom.equalTo(nicknameL.mas_top).offset(-14.0f);
- // make.size.mas_offset(CGSizeMake(73.0f, 27.0f));
- // }];
- //// UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaifplayAudioEvent:)];
- //// [aBgV addGestureRecognizer:tapGesture];
- //
- // UIButton *audioPlayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- // [audioPlayBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_audio_none"] forState:UIControlStateSelected];
- // [audioPlayBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_audio_play"] forState:UIControlStateNormal];
- // audioPlayBtn.userInteractionEnabled = NO;
- // [aBgV addSubview:audioPlayBtn];
- //// self.youpaipaudioPlayBtn = audioPlayBtn;
- // [audioPlayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.offset(5.0f);
- // make.centerY.equalTo(aBgV.mas_centerY);
- // make.size.mas_offset(CGSizeMake(19.0f, 19.0f));
- // }];
- //
- // UILabel *timerL = [[UILabel alloc] init];
- // timerL.font = LCFont(12);
- // timerL.textColor = HexColorFromRGB(0x666666);
- // timerL.text = [NSString stringWithFormat:@"%@\"",@(self.youpaipmodel.youpaipinfo.youpaipvoice_time)];
- // [aBgV addSubview:timerL];
- //// self.youpaiptimerL = timerL;
- // [timerL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(audioPlayBtn.mas_right).offset(5.0f);
- // make.centerY.equalTo(aBgV);
- // }];
- //
- // UIImageView *animationImgV = [[UIImageView alloc] init];
- // animationImgV.image = [UIImage imageNamed:@"vqu_images_ic_user_show_audio_animation_3"];
- //
- // NSMutableArray * animationArray = [NSMutableArray array];
- //
- // for (NSInteger i = 0; i < 3; i ++) {
- // [animationArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"vqu_images_ic_user_show_audio_animation_%@",@(i + 1)]]];
- // }
- // //设置动画数组
- // [animationImgV setAnimationImages:animationArray];
- // //设置动画播放次数
- // [animationImgV setAnimationRepeatCount:INT32_MAX];
- // //设置动画播放时间
- // [animationImgV setAnimationDuration:3*0.35];
- //
- // [aBgV addSubview:animationImgV];
- // self.youpaipanimationImgV = animationImgV;
- // [animationImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(timerL.mas_right).offset(5.0f);
- // make.centerY.equalTo(aBgV);
- // make.size.mas_offset(CGSizeMake(19.0f, 19.0f));
- // }];
- // }
- CGFloat totalHeight = 458+StatusBarHeight;
- // CGFloat bottom = 0;
- // NSString *content = self.youpaipmodel.youpaipinfo.youpaipsign;
- // if (content.length != 0) {
- // UILabel *signL = [[UILabel alloc] init];
- // // signL.text = @"说一段话介绍自己,或唱一首歌!";
- // signL.font = LCFont12;
- // signL.textColor = [UIColor whiteColor];
- // signL.numberOfLines = 0;
- //// signL.text = content;
- // [self addSubview:signL];
- // [signL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.offset(14.0f);
- // make.top.equalTo(infoBgV.mas_bottom).offset(10.0f);
- // make.right.offset(-14.0f);
- //// make.bottom.offset(-25.0f);
- // }];
- //
- // NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:content];
- // NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
- // paragraphStyle1.alignment=NSTextAlignmentJustified;
- // NSDictionary * dic =@{
- // NSParagraphStyleAttributeName:paragraphStyle1,
- // NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleNone],
- // };
- // [attributedString1 setAttributes:dic range:NSMakeRange(0, attributedString1.length)];
- // [signL setAttributedText:attributedString1];
- //
- // CGFloat height = [content boundingRectWithSize:CGSizeMake(KScreenWidth - 28.0f, MAXFLOAT)
- // options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
- // attributes:@{ NSFontAttributeName : LCFont12 } context:nil].size.height;
- //
- // totalHeight += height + 35.0f;
- // bottom+=height+35;
- // }
- //页码
- // if (self.youpaipmodel.youpaipalbum.count != 0) {
- // UILabel *avatarCountL = [[UILabel alloc] init];
- // avatarCountL.font = LCFont(9.0f);
- // avatarCountL.textColor = [UIColor whiteColor];
- // avatarCountL.text = [NSString stringWithFormat:@"%@/%@",@(1),@(self.youpaipmodel.youpaipalbum.count)];
- // [self addSubview:avatarCountL];
- // self.youpaipavatarCountL = avatarCountL;
- // [avatarCountL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.equalTo(-14);
- // make.centerY.equalTo(idBtn.mas_centerY);
- // }];
- // }
- // //直播中
- // UIButton *leftTopBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- //
- // leftTopBtn.frame = CGRectMake(0, NavBarHeight, 94.0f, 27.0f);
- // UIImage *bgImage = [LCTools ColorImage:leftTopBtn.mj_size FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight];
- // [leftTopBtn setBackgroundImage:bgImage forState:UIControlStateNormal];
- // [leftTopBtn setBackgroundImage:bgImage forState:UIControlStateHighlighted];
- //// [LCTools clipCorner:UIRectCornerBottomRight View:leftTopBtn size:CGSizeMake(8.0f, 8.0f)];
- // leftTopBtn.layer.cornerRadius = 15;
- // leftTopBtn.layer.masksToBounds = YES;
- // [self addSubview:leftTopBtn];
- // [leftTopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.bottom.mas_equalTo(-(bottom+35));
- // make.right.mas_equalTo(-14.0f);
- // make.size.mas_equalTo(CGSizeMake(94.0f, 27.0f));
- // }];
- // [leftTopBtn addTarget:self action:@selector(leftTopBtnClick) forControlEvents:UIControlEventTouchUpInside];
- //// NSString *path = [[NSBundle mainBundle] pathForResource:@"ic_live_zhibozhong_28" ofType:@"gif"];
- //// YYAnimatedImageView *iconImgV = [[YYAnimatedImageView alloc] init];
- //// iconImgV.image = [YYImage imageWithData:[NSData dataWithContentsOfFile:path]];
- //
- // LOTAnimationView *iconImgV = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:@"ic_chatroom_part" ofType:@"json"]];
- // [leftTopBtn addSubview:iconImgV];
- //// talkingAnimationView.frame = CGRectMake(0.0f, 0.0f, self.mj_w * 1.7f, self.mj_h * 1.7f);
- // iconImgV.loopAnimation = YES;
- // iconImgV.contentMode = UIViewContentModeScaleAspectFill;
- // [iconImgV play];
- // [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.offset(8.0f);
- // make.centerY.equalTo(leftTopBtn.mas_centerY);
- // make.size.mas_offset(CGSizeMake(16.0f, 14.0f));
- // }];
- //
- //// [leftTopBtn addSubview:iconImgV];
- //// [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- //// make.left.offset(3.0f);
- //// make.centerY.equalTo(leftTopBtn.mas_centerY);
- //// make.size.mas_offset(CGSizeMake(12.5f, 12.5f));
- //// }];
- //
- // UIImageView *arrowImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_D_profile_item_arrow_w"]];
- // [leftTopBtn addSubview:arrowImgV];
- // [arrowImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.right.offset(-8.0f);
- // make.centerY.equalTo(leftTopBtn.mas_centerY);
- // make.size.mas_offset(CGSizeMake(8.0f, 8.0f));
- // }];
- //
- // UILabel *textL = [[UILabel alloc] init];
- // textL.font = LCFont(11.0f);
- // textL.textColor = [UIColor whiteColor];
- // textL.text = @"正在房间";
- // [leftTopBtn addSubview:textL];
- // [textL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(iconImgV.mas_right).offset(3.0f);
- // make.right.equalTo(arrowImgV.mas_left).offset(-3.0f);
- // make.centerY.equalTo(leftTopBtn.mas_centerY);
- // }];
- // leftTopBtn.hidden = NO;
- // if (self.youpaipmodel.youpaiptalk_room_id != 0) {
- // leftTopBtn.hidden = NO;
- // }else{
- // leftTopBtn.hidden = YES;
- // }
- // UIView *bgv = [UIView new];
- // [infoBgV addSubview:bgv];
- // [bgv mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.edges.mas_equalTo(0);
- // }];
- // bgv.backgroundColor = [UIColor redColor];
- self.frame = CGRectMake(0, 0, KScreenWidth, totalHeight);
- }
- #pragma mark <UICollectionViewDataSource>
- /**
- 返回区数
-
- @param collectionView 集合视图
- @return 返回区数
- */
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 1;
- }
- /**
- 返回项目数
-
- @param collectionView 集合视图
- @param section 区
- @return 项目数
- */
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-
-
- return self.youpaipmodel.youpaipalbums.count;
- }
- -(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
- NSString *identifier=[NSString stringWithFormat:@"%ld%ld",(long)indexPath.section,(long)indexPath.row];
- [self.collectionView registerClass:[YOUPAIShowHeaderBigImageCell class] forCellWithReuseIdentifier:identifier];
- YOUPAIAlbumModel *model = self.youpaipmodel.youpaipalbums[indexPath.item];
- YOUPAIShowHeaderBigImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
- NSString *url = model.youpaipurl;
-
- if (indexPath.item == 0&&model.youpaipis_video == 1) {//视频
-
- [self setupPlayer:cell.youpaipiconImageView:model.youpaipurl];
- // [cell.youpaipiconImageView sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil];
- }else{
-
- [cell.youpaipiconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,url]] placeholderImage:nil];
- }
-
- return cell;
- }
- -(void)setupPlayer:(UIImageView*)imageView:(NSString*)url{
-
- ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
- playerManager.shouldAutoPlay = YES;
-
- /// 播放器相关
- self.player = [ZFPlayerController playerWithPlayerManager:playerManager containerView:imageView];
- self.player.controlView = self.youpaipcontrolView;
- self.player.disablePanMovingDirection = ZFPlayerDisablePanMovingDirectionAll;
- /// 设置退到后台继续播放
- self.player.pauseWhenAppResignActive = NO;
- self.player.allowOrentitaionRotation = NO;
- @weakify(self)
-
- /// 播放完成
- self.player.playerDidToEnd = ^(id _Nonnull asset) {
- @strongify(self)
- [self.player.currentPlayerManager replay];
- };
-
- self.player.assetURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,url]];
- [self.player playTheIndex:0];
- [self.player.currentPlayerManager setMuted:YES];
-
- }
- -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
- NSInteger current = scrollView.contentOffset.x / KScreenWidth;
- NSLog(@"下标===========%ld",(long)current);
- if (current == 0) {
- [self.player.currentPlayerManager play];
- }else{
- [self.player.currentPlayerManager pause];
- }
- }
- -(void)didSelectImageIndex:(NSInteger)index{
- [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
- }
- - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
- NSInteger index = scrollView.contentOffset.x/KScreenWidth;
- [self.rightCollectionView setScrollToItemAtIndex:index];
- [scrollView zf_scrollViewDidEndDecelerating];
- }
- -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
- NSMutableArray *tempArr = [NSMutableArray array];
- for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
-
-
-
- YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
- if (model1.youpaipis_video == 1) {
- YBIBVideoData *data = [YBIBVideoData new];
- data.videoURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
- data.projectiveView = self.videoCoverImgV;
- [tempArr addObject:data];
-
- }else{
- YBIBImageData *model = [YBIBImageData new];
- model.imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
- model.projectiveView = self.videoCoverImgV;
- [tempArr addObject:model];
- }
-
-
- }
- YBImageBrowser *browser = [YBImageBrowser new];
- browser.delegate = self;
- browser.dataSourceArray = tempArr;
- browser.currentPage = indexPath.item;
- [browser show];
-
- }
- /**
- 开始转场
- @param imageBrowser 图片浏览器
- @param isShow YES 表示入场,NO 表示出场
- */
- - (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser beginTransitioningWithIsShow:(BOOL)isShow{
-
- for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
- YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
- if (model1.youpaipis_video == 1) {
- [self.player.currentPlayerManager pause];
- }
- }
- }
- /**
- 结束转场
- @param imageBrowser 图片浏览器
- @param isShow YES 表示入场,NO 表示出场
- */
- - (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser endTransitioningWithIsShow:(BOOL)isShow{
-
- for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
- YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
- if (model1.youpaipis_video == 1) {
- [self.player.currentPlayerManager play];
- }
- }
-
-
- }
- -(void)DidAvViewShowBrowser{
- // self.player.currentPlayerManager.muted = NO;
-
- NSMutableArray *tempArr = [NSMutableArray array];
- for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
- YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
- if (model1.youpaipis_video == 1) {
- YBIBVideoData *data = [YBIBVideoData new];
- data.videoURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
- data.projectiveView = self.videoCoverImgV;
- [tempArr addObject:data];
-
- }else{
- YBIBImageData *model = [YBIBImageData new];
- model.imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
- model.projectiveView = self.videoCoverImgV;
- [tempArr addObject:model];
- }
- }
-
-
- YBImageBrowser *browser = [YBImageBrowser new];
- browser.dataSourceArray = tempArr;
- browser.currentPage = 0;
- [browser show];
- }
- -(void)didVideoOrImage:(UIButton*)sender{
- if (self.didClickVideoOrImage) {
- self.didClickVideoOrImage(self.youpaipmodel);
- }
-
- }
- -(void)guardBtnClick{
- if (self.youpaipdidClickSh) {
- self.youpaipdidClickSh();
- }
- }
- -(void)youpaipmemberAvatarBgVClick{
- if (self.jumToGuardVCClick) {
- self.jumToGuardVCClick();
- }
-
-
- }
- // 复制ID点击事件
- - (void)youpaifcopyBtnClick{
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- pasteboard.string = self.youpaipmodel.youpaipusercode;
- [ZCHUDHelper showTitle:@"复制成功"];
- }
- // 关注点击事件
- - (void)youpaiffollowBtnClick:(UIButton *)sender{
- sender.selected = !sender.selected;
- [LCCommonHttp followUserId:self.youpaipmodel.youpaipuserid];
- }
- //进入直播
- -(void)leftTopBtnClick{
- NSString *roomId = [NSString stringWithFormat:@"%@",@(self.youpaipmodel.youpaiptalk_room_id)];
- if ([[YOUPAILZChatRoomManager shareManager].chatroomModel.youpaiproom_id isEqual:roomId] && [YOUPAILZChatRoomManager shareManager].chatroomController != nil) {
- [[YOUPAILZChatRoomManager shareManager] youpaifshowChatRoom];
- return;
- }
- [self youpaifshowPasswordWindowWithRoomId:roomId youpaipis_comein_room_hide:0];
- }
- - (void)youpaifshowPasswordWindowWithRoomId:(NSString *)roomId youpaipis_comein_room_hide:(NSInteger)youpaipis_comein_room_hide{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetRoomStatus parameters:@{@"room_id":roomId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {
- NSDictionary *data = [dict objectForKey:@"data"];
- if ([[data objectForKey:@"pwd"] integerValue] == 1) { // 有密码
- YOUPAILZChatRoomPasswordWindow *window = [[YOUPAILZChatRoomPasswordWindow alloc] init];
- [window setYoupaippasswordBlock:^(NSString * _Nonnull password, YOUPAILZChatRoomPasswordWindow * _Nonnull window) {
- @strongify(self);
- [self youpaifgoChatRoomVCWithPwd:password RoomId:roomId youpaipis_comein_room_hide:youpaipis_comein_room_hide window:window];
- }];
- [[LCTools getCurrentVC] TFPresentVC:window completion:^{}];
- }else{
- [self youpaifgoChatRoomVCWithPwd:@"" RoomId:roomId youpaipis_comein_room_hide:youpaipis_comein_room_hide window:nil];
- }
- }
- } failure:^(NSError *error) {
-
- }];
- }
- /// 加入语聊房
- /// @param pwd 密码
- /// @param roomId 房间号
- /// @param youpaipis_comein_room_hide 是否悄悄进房
- /// @param window 密码框
- - (void)youpaifgoChatRoomVCWithPwd:(NSString *)pwd RoomId:(NSString *)roomId youpaipis_comein_room_hide:(NSInteger)youpaipis_comein_room_hide window:(YOUPAILZChatRoomPasswordWindow *)window{
- [ZCHUDHelper show];
- @weakify(self);
- [LCHttpHelper requestWithURLString:JoinTalk parameters:@{@"room_id":roomId,@"pwd":pwd,@"is_comein_room_hide":@(youpaipis_comein_room_hide)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- [ZCHUDHelper dismiss];
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {
- if (window != nil) {
- [window dismissViewControllerAnimated:YES completion:^{}];
- }
- [[YOUPAILZChatRoomManager shareManager] youpaifleaveChannel];
- YOUPAILZChatRoomModel *youpaipchatroomModel = [YOUPAILZChatRoomModel mj_objectWithKeyValues:dict[@"data"]];
- // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- YOUPAILZChatRoomVC *vc = [[YOUPAILZChatRoomVC alloc] init];
- vc.youpaipchatroomModel = youpaipchatroomModel;
- [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:vc animated:YES];
- [YOUPAILZChatRoomManager shareManager].chatroomModel = vc.youpaipchatroomModel;
- [YOUPAILZChatRoomManager shareManager].chatroomController = vc;
- // });
-
- }else{
- if (window != nil) {
- [window youpaifshowHUDWithTitle:[dict objectForKey:@"message"]];
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper dismiss];
- }];
- }
- - (YOUPAIZFDouYinControlView *)youpaipcontrolView {
- if (!_youpaipcontrolView) {
- _youpaipcontrolView = [YOUPAIZFDouYinControlView new];
- _youpaipcontrolView.hideenProgess = YES;
- _youpaipcontrolView.userInteractionEnabled = YES;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DidAvViewShowBrowser)];
- [_youpaipcontrolView addGestureRecognizer:tap];
-
-
- }
- return _youpaipcontrolView;
- }
- - (void)youpaifeditBtnCountWithCount:(NSInteger)count{
- if (count >= self.youpaipmemberAvatars.count) {
- [self youpaifaddBtnWithCount:count - self.youpaipmemberAvatars.count];
- }else{
- [self youpaifdeleteBtnWithCount:self.youpaipmemberAvatars.count - count];
- }
- }
- - (void)youpaifdeleteBtnWithCount:(NSInteger)count{
- if (count != 0) {
- for (NSInteger i = 0; i < count; i ++) {
- UIImageView *btn = self.youpaipmemberAvatars.lastObject;
- [self.youpaipmemberAvatars removeLastObject];
- [btn removeFromSuperview];
- }
- }
- }
- - (void)youpaifaddBtnWithCount:(NSInteger)count{
- for (NSInteger i = 0; i < count; i ++) {
- [self youpaifcreateBtn];
- }
- }
- - (void)youpaifcreateBtn{
- UIImageView *imgV = [[UIImageView alloc] init];
- imgV.contentMode = UIViewContentModeScaleAspectFill;
- [self.youpaipmemberAvatarBgV addSubview:imgV];
- [self.youpaipmemberAvatars addObject:imgV];
- }
- - (NSMutableArray<UIImageView *> *)youpaipmemberAvatars{
- if (_youpaipmemberAvatars == nil) {
- _youpaipmemberAvatars = [NSMutableArray array];
- }
- return _youpaipmemberAvatars;
- }
- @end
|