YOUPAILZUserShowHeaderView.m 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. //
  2. // YOUPAILZUserShowHeaderView.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/7/10.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZUserShowHeaderView.h"
  9. #import "SDCycleScrollView.h"
  10. #import "LCCommonHttp.h"
  11. #import "LOTAnimationView.h"
  12. #import "YYImage.h"
  13. #import "YOUPAILZLiveModel.h"
  14. #import "YOUPAILZLiveAudienceVC.h"
  15. #import "YOUPAILZEndLiveHintView.h"
  16. #import "YOUPAILZLevelView.h"
  17. #import "YOUPAIHRAgeSexView.h"
  18. #import "YOUPAILZChatRoomPasswordWindow.h"
  19. #import "YOUPAILZChatRoomVC.h"
  20. #import "UIViewController+TFPresent.h"
  21. #import "YOUPAIRightCollectionView.h"
  22. #import "YOUPAIShowHeaderBigImageCell.h"
  23. #import "ZFPlayerControlView.h"
  24. #import "ZFAVPlayerManager.h"
  25. #import "YOUPAIZFDouYinControlView.h"
  26. #import "YOUPAISexView.h"
  27. #import "YBIBVideoData.h"
  28. @interface YOUPAILZUserShowHeaderView () <UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,YBImageBrowserDelegate>
  29. @property (nonatomic, strong)YOUPAILCUserShowModel *youpaipmodel;
  30. @property (nonatomic,weak) UIImageView *youpaipanimationImgV;
  31. @property (nonatomic, strong)NSArray *youpaipavatarUrls;
  32. /* avatarCountL */
  33. @property (strong, nonatomic) UILabel *youpaipavatarCountL;
  34. @property (nonatomic,strong) UICollectionView * collectionView;
  35. @property (nonatomic,strong) UIButton * videoCoverImgV;
  36. @property(nonatomic,strong)YOUPAIRightCollectionView *rightCollectionView;
  37. @property (nonatomic, strong) ZFPlayerController *player;
  38. @property (nonatomic, strong) UIImageView *containerView;
  39. @property (nonatomic, strong) YOUPAIZFDouYinControlView *youpaipcontrolView;
  40. @property(nonatomic,strong)UIView *youpaipmemberAvatarBgV;
  41. @property(nonatomic,strong)NSMutableArray *youpaipmemberAvatars;
  42. @end
  43. @implementation YOUPAILZUserShowHeaderView
  44. - (instancetype)initWithModel:(YOUPAILCUserShowModel *)model{
  45. if (self = [super init]) {
  46. _youpaipmodel = model;
  47. [self youpaifinitUI];
  48. // [self youpaifinitAudioStream];
  49. }
  50. return self;
  51. }
  52. - (void)youpaifinitUI{
  53. UIView *infoBgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth,458.0f+StatusBarHeight+20)];
  54. [self addSubview:infoBgV];
  55. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
  56. flowLayout.itemSize = CGSizeMake(KScreenWidth, 375);
  57. flowLayout.minimumInteritemSpacing = 0.0;
  58. flowLayout.minimumLineSpacing = 0.0;
  59. flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  60. self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 375) collectionViewLayout:flowLayout];
  61. self.collectionView.delegate = self;
  62. self.collectionView.backgroundColor = [UIColor whiteColor];
  63. self.collectionView.pagingEnabled = YES;
  64. self.collectionView.showsVerticalScrollIndicator = NO;
  65. self.collectionView.showsHorizontalScrollIndicator = NO;
  66. self.collectionView.delegate = self;
  67. self.collectionView.dataSource = self;
  68. // self.collectionView.zf_scrollViewDirection = ZFPlayerScrollViewDirectionHorizontal;
  69. [infoBgV addSubview:self.collectionView];
  70. //右下角小图片
  71. YOUPAIRightCollectionView *rightCollectionView = [[YOUPAIRightCollectionView alloc]initWithFrame:CGRectMake(12, 302, KScreenWidth-12-96, 44)];
  72. [infoBgV addSubview:rightCollectionView];
  73. rightCollectionView.Model = self.youpaipmodel;
  74. self.rightCollectionView = rightCollectionView;
  75. @weakify(self)
  76. [rightCollectionView setDidSelectImageIndex:^(NSInteger index) {
  77. @strongify(self)
  78. [self didSelectImageIndex:index];
  79. }];
  80. UIView *titleView = [[UIView alloc] init];
  81. [infoBgV addSubview:titleView];
  82. [titleView mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.right.mas_equalTo(0);
  84. make.centerY.mas_equalTo(rightCollectionView).offset(10);
  85. make.size.mas_equalTo(CGSizeMake(90, 34));
  86. }];
  87. UIView *statusBgView = [[UIView alloc] init];
  88. statusBgView.layer.cornerRadius = 8.81f;
  89. statusBgView.layer.masksToBounds = YES;
  90. statusBgView.backgroundColor = [HexColorFromRGB(0x1C1D23) colorWithAlphaComponent:0.38f];
  91. [titleView addSubview:statusBgView];
  92. [statusBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  93. make.centerX.equalTo(titleView.mas_centerX);
  94. if (self.youpaipmodel.youpaipalbum.count == 0) {
  95. make.centerY.equalTo(titleView.mas_centerY);
  96. }else{
  97. make.top.offset(8.0f);
  98. }
  99. make.size.mas_offset(CGSizeMake([LCTools widthWithString:self.youpaipmodel.youpaipAddnewMsg withFont:[UIFont systemFontOfSize:11]]+21, 17.62f));
  100. }];
  101. UIView *statusView = [[UIView alloc] init];
  102. statusView.layer.cornerRadius = 3.0f;
  103. statusView.layer.masksToBounds = YES;
  104. [statusBgView addSubview:statusView];
  105. [statusView mas_makeConstraints:^(MASConstraintMaker *make) {
  106. make.centerY.equalTo(statusBgView);
  107. make.left.offset(6.5f);
  108. make.size.mas_offset(CGSizeMake(6.0f, 6.0f));
  109. }];
  110. UILabel *statusL = [[UILabel alloc] init];
  111. statusL.font = LCFont(11.0f);
  112. statusL.textColor = [UIColor whiteColor];
  113. [statusBgView addSubview:statusL];
  114. [statusL mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.centerY.equalTo(statusBgView);
  116. make.left.equalTo(statusView.mas_right).offset(3.0f);
  117. }];
  118. statusView.backgroundColor = kColors(self.youpaipmodel.youpaipAddnewColor);
  119. statusL.text = self.youpaipmodel.youpaipAddnewMsg;
  120. UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0, 360, KScreenWidth, 142)];
  121. [infoBgV addSubview:bgV];
  122. //142
  123. bgV.backgroundColor = [UIColor whiteColor];
  124. [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(16, 16)];
  125. CGFloat width = 0;
  126. if (self.youpaipmodel.youpaipnickname.length>5) {
  127. NSString *str = [self.youpaipmodel.youpaipnickname substringToIndex:5];
  128. width = [LCTools widthWithString:str withFont:LCBoldFont(18)]+5;
  129. }else{
  130. width = [LCTools widthWithString:self.youpaipmodel.youpaipnickname withFont:LCBoldFont(18)]+5;
  131. }
  132. //姓名
  133. UILabel *nicknameL = [[UILabel alloc] init];
  134. nicknameL.textColor = LZ273145Color;
  135. nicknameL.text = self.youpaipmodel.youpaipnickname;
  136. [bgV addSubview:nicknameL];
  137. [nicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  138. make.left.offset(12.0f);
  139. make.top.equalTo(12);
  140. }];
  141. YOUPAISexView *sexView = [[YOUPAISexView alloc] init];
  142. [bgV addSubview:sexView];
  143. [sexView makeConstraints:^(MASConstraintMaker *make) {
  144. make.left.equalTo(nicknameL.mas_right).offset(@2);
  145. make.centerY.equalTo(nicknameL);
  146. make.size.mas_equalTo(CGSizeMake(30, 15));
  147. }];
  148. [sexView youpaifreloadWithSex:self.youpaipmodel.youpaipgender age:self.youpaipmodel.youpaipage];
  149. //真人图标
  150. UIImageView *personImageView = [UIImageView new];
  151. [bgV addSubview:personImageView];
  152. [personImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  153. make.left.equalTo(sexView.mas_right).offset(@2);
  154. make.centerY.equalTo(sexView);
  155. make.size.mas_equalTo(CGSizeMake(37, 16));
  156. }];
  157. if (self.youpaipmodel.youpaipis_anchor ==1) {
  158. personImageView.image = [UIImage imageNamed:@"vqu_images_zhenrentag"];
  159. }
  160. // //地址
  161. // UILabel *cityL = [[UILabel alloc] init];
  162. // cityL.font = LCFont12;
  163. // cityL.textColor = [UIColor whiteColor];
  164. // cityL.text = self.youpaipmodel.youpaipinfo.youpaipcity;
  165. // [infoBgV addSubview:cityL];
  166. // [cityL mas_makeConstraints:^(MASConstraintMaker *make) {
  167. // make.left.offset(48);
  168. // make.bottom.offset(-10.0f);
  169. // }];
  170. //
  171. // UIView *line1 = [[UIView alloc] init];
  172. // line1.backgroundColor = [UIColor whiteColor];
  173. // [infoBgV addSubview:line1];
  174. // [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
  175. // make.left.equalTo(cityL.mas_right).offset(10.0f);
  176. // make.centerY.equalTo(cityL.mas_centerY);
  177. // make.size.mas_offset(CGSizeMake(0.5f, 7.0f));
  178. // }];
  179. // //粉丝
  180. // UILabel *fansL = [[UILabel alloc] init];
  181. // fansL.font = LCFont12;
  182. // fansL.textColor = [UIColor whiteColor];
  183. // fansL.text = [NSString stringWithFormat:@"%@ 粉丝",@(self.youpaipmodel.youpaipinfo.youpaipfans_count)];
  184. // [infoBgV addSubview:fansL];
  185. // [fansL mas_makeConstraints:^(MASConstraintMaker *make) {
  186. //
  187. // make.left.equalTo(line1.mas_right).offset(10.0f);
  188. // make.centerY.equalTo(cityL.mas_centerY);
  189. // }];
  190. //
  191. // UIView *line2 = [[UIView alloc] init];
  192. // line2.backgroundColor = [UIColor whiteColor];
  193. // [infoBgV addSubview:line2];
  194. // [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
  195. // make.left.equalTo(fansL.mas_right).offset(10.0f);
  196. // make.centerY.equalTo(fansL.mas_centerY);
  197. // make.size.mas_offset(CGSizeMake(0.5f, 7.0f));
  198. // }];
  199. // //复制
  200. // UIButton *idBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  201. // idBtn.titleLabel.font = LCFont12;
  202. // [idBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  203. // [idBtn setTitle:[NSString stringWithFormat:@"花舞号:%@",self.youpaipmodel.youpaipinfo.youpaipusercode] forState:UIControlStateNormal];
  204. // [idBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  205. // [infoBgV addSubview:idBtn];
  206. // [idBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  207. // make.left.equalTo(line2.mas_right).offset(10.0f);
  208. // make.centerY.equalTo(fansL.mas_centerY);
  209. // make.height.offset(12.0f);
  210. // }];
  211. //
  212. // UIButton *copyIDBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  213. // [copyIDBtn setImage:[UIImage imageNamed:@"vqu_images_ic_profile_copy_code"] forState:UIControlStateNormal];
  214. // [copyIDBtn addTarget:self action:@selector(youpaifcopyBtnClick) forControlEvents:UIControlEventTouchUpInside];
  215. // [infoBgV addSubview:copyIDBtn];
  216. // [copyIDBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  217. // make.left.equalTo(idBtn.mas_right).offset(4.0f);
  218. // make.centerY.equalTo(idBtn.mas_centerY);
  219. // make.size.mas_offset(CGSizeMake(12.0f, 12.0f));
  220. // }];
  221. // 贵族
  222. UIImageView *vipImgV = [[UIImageView alloc] init];
  223. [bgV addSubview:vipImgV];
  224. // 勋章
  225. UIImageView *badgeImgV = [[UIImageView alloc] init];
  226. [bgV addSubview:badgeImgV];
  227. // 等级
  228. YOUPAILZLevelView *levelView = [[YOUPAILZLevelView alloc] init];
  229. [bgV addSubview:levelView];
  230. UIView *frontV;
  231. if (self.youpaipmodel.youpaipvip_icon.length != 0) {
  232. [vipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.youpaipvip_icon]];
  233. [vipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  234. if (frontV == nil) {
  235. make.left.equalTo(12);
  236. }else{
  237. make.left.equalTo(frontV.mas_right).offset(3.0f);
  238. }
  239. make.top.equalTo(nicknameL.mas_bottom).offset(5);
  240. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  241. }];
  242. frontV = vipImgV;
  243. }
  244. if (self.youpaipmodel.youpaipbadge_info.youpaipfile.length != 0) {
  245. [badgeImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:self.youpaipmodel.youpaipbadge_info.youpaipfile]];
  246. [badgeImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
  247. if (frontV == nil) {
  248. make.left.equalTo(12);
  249. }else{
  250. make.left.equalTo(frontV.mas_right).offset(3.0f);
  251. }
  252. make.top.equalTo(nicknameL.mas_bottom).offset(5);
  253. make.size.mas_offset(CGSizeMake(self.youpaipmodel.youpaipbadge_info.youpaipwidth, 17.0f));
  254. }];
  255. frontV = badgeImgV;
  256. }
  257. [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];
  258. [levelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  259. if (frontV == nil) {
  260. make.left.equalTo(12);
  261. }else{
  262. make.left.equalTo(frontV.mas_right).offset(3.0f);
  263. }
  264. make.top.equalTo(nicknameL.mas_bottom).offset(5);
  265. make.size.mas_offset(levelView.mj_size);
  266. }];
  267. //关注
  268. UIButton *followBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  269. [followBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_follow_new"] forState:UIControlStateNormal];
  270. [followBtn addTarget:self action:@selector(youpaiffollowBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  271. followBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 6.0f, 0, 0);
  272. [bgV addSubview:followBtn];
  273. [followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  274. make.right.offset(-14.0f);
  275. make.top.equalTo(19);
  276. make.size.mas_offset(CGSizeMake(28.0f, 28.0f));
  277. }];
  278. // followBtn.hidden = [@(self.model.info.is_follow) boolValue];
  279. [followBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_follow_new"] forState:(UIControlStateNormal)];
  280. [followBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_follow_new_select"] forState:(UIControlStateSelected)];
  281. if ([self.youpaipmodel.youpaipuserid isEqualToString:[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id]) {
  282. followBtn.hidden = YES;
  283. }else{
  284. followBtn.hidden = NO;
  285. }
  286. followBtn.selected = self.youpaipmodel.youpaipis_follow == 1 ? YES : NO;
  287. //我的守护
  288. UIView *guardBgView = [UIView new];
  289. [bgV addSubview:guardBgView];
  290. [guardBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  291. make.left.mas_equalTo(12);
  292. make.bottom.mas_equalTo(-20);
  293. make.size.mas_equalTo(CGSizeMake(KScreenWidth-85, 44));
  294. }];
  295. guardBgView.backgroundColor = HexColorFromRGBA(0x7C69FE, 0.1);
  296. guardBgView.layer.cornerRadius = 8;
  297. guardBgView.layer.masksToBounds = YES;
  298. //title
  299. UILabel *guardTitle = [UILabel new];
  300. [guardBgView addSubview:guardTitle];
  301. [guardTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  302. make.left.mas_equalTo(12);
  303. make.centerY.mas_equalTo(0);
  304. }];
  305. guardTitle.text = @"ta的守护团";
  306. guardTitle.font = [UIFont systemFontOfSize:13];
  307. guardTitle.textColor = LZ7C69FEColor;
  308. //arrow
  309. UIImageView *arrowImageView = [UIImageView new];
  310. [guardBgView addSubview:arrowImageView];
  311. [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  312. make.right.mas_equalTo(-12);
  313. make.centerY.mas_equalTo(0);
  314. make.size.mas_equalTo(CGSizeMake(10, 10.5));
  315. }];
  316. arrowImageView.image = [UIImage imageNamed:@"vqu_images_arrow_gurad"];
  317. //3个头像
  318. UIView *youpaipmemberAvatarBgV = [[UIView alloc] init];
  319. [guardBgView addSubview:youpaipmemberAvatarBgV];
  320. self.youpaipmemberAvatarBgV = youpaipmemberAvatarBgV;
  321. [youpaipmemberAvatarBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  322. make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
  323. make.centerY.mas_equalTo(arrowImageView);
  324. make.width.offset(0.0f);
  325. make.height.offset(30.0f);
  326. }];
  327. guardBgView.userInteractionEnabled = YES;
  328. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(youpaipmemberAvatarBgVClick)];
  329. [guardBgView addGestureRecognizer:tap];
  330. [self youpaifeditBtnCountWithCount:self.youpaipmodel.youpaipguard.youpaiplist.count > 3 ? 3 : self.youpaipmodel.youpaipguard.youpaiplist.count];
  331. [self.youpaipmemberAvatarBgV updateConstraints:^(MASConstraintMaker *make) {
  332. make.width.offset(self.youpaipmemberAvatars.count * 30.0f - (self.youpaipmemberAvatars.count - 1.0f) * 4.0f);
  333. }];
  334. if (self.youpaipmodel.youpaipguard.youpaiplist.count<=0) {
  335. //暂无守护
  336. UILabel *guardNoLabel = [UILabel new];
  337. [guardBgView addSubview:guardNoLabel];
  338. [guardNoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  339. make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
  340. make.centerY.mas_equalTo(arrowImageView);
  341. }];
  342. guardNoLabel.text = @"暂无守护";
  343. guardNoLabel.font = [UIFont systemFontOfSize:10];
  344. guardNoLabel.textColor = LZA3AABEColor;
  345. }
  346. for (NSInteger i = 0; i < self.youpaipmemberAvatars.count; i ++) {
  347. UIImageView *imgV = self.youpaipmemberAvatars[i];
  348. imgV.layer.cornerRadius = 15.0f;
  349. imgV.layer.masksToBounds = YES;
  350. imgV.frame = CGRectMake(i * 30.0f - i * 4.0f, 0.0f, 30.0f, 30.0f);
  351. NSString *url = [NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,self.youpaipmodel.youpaipguard.youpaiplist[i]];
  352. [imgV sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil];;
  353. }
  354. //守护按钮
  355. UIButton *guardBtn = [UIButton new];
  356. [bgV addSubview:guardBtn];
  357. [guardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  358. make.right.mas_equalTo(-12);
  359. make.centerY.mas_equalTo(guardBgView);
  360. make.size.mas_equalTo(CGSizeMake(47, 45));
  361. }];
  362. [guardBtn setBackgroundImage:[UIImage imageNamed:@"vqu_images_zhuye_guard"] forState:UIControlStateNormal];
  363. [guardBtn addTarget:self action:@selector(guardBtnClick) forControlEvents:UIControlEventTouchUpInside];
  364. // if (self.youpaipmodel.youpaipinfo.youpaipvoice_status == 1) {
  365. // UIView *aBgV = [[UIView alloc] init];
  366. // aBgV.layer.cornerRadius = 13.5f;
  367. // aBgV.clipsToBounds = YES;
  368. // aBgV.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.88f];
  369. // [infoBgV addSubview:aBgV];
  370. // [aBgV mas_makeConstraints:^(MASConstraintMaker *make) {
  371. // make.left.offset(14.0f);
  372. // make.bottom.equalTo(nicknameL.mas_top).offset(-14.0f);
  373. // make.size.mas_offset(CGSizeMake(73.0f, 27.0f));
  374. // }];
  375. //// UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(youpaifplayAudioEvent:)];
  376. //// [aBgV addGestureRecognizer:tapGesture];
  377. //
  378. // UIButton *audioPlayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  379. // [audioPlayBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_audio_none"] forState:UIControlStateSelected];
  380. // [audioPlayBtn setImage:[UIImage imageNamed:@"vqu_images_ic_user_show_audio_play"] forState:UIControlStateNormal];
  381. // audioPlayBtn.userInteractionEnabled = NO;
  382. // [aBgV addSubview:audioPlayBtn];
  383. //// self.youpaipaudioPlayBtn = audioPlayBtn;
  384. // [audioPlayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  385. // make.left.offset(5.0f);
  386. // make.centerY.equalTo(aBgV.mas_centerY);
  387. // make.size.mas_offset(CGSizeMake(19.0f, 19.0f));
  388. // }];
  389. //
  390. // UILabel *timerL = [[UILabel alloc] init];
  391. // timerL.font = LCFont(12);
  392. // timerL.textColor = HexColorFromRGB(0x666666);
  393. // timerL.text = [NSString stringWithFormat:@"%@\"",@(self.youpaipmodel.youpaipinfo.youpaipvoice_time)];
  394. // [aBgV addSubview:timerL];
  395. //// self.youpaiptimerL = timerL;
  396. // [timerL mas_makeConstraints:^(MASConstraintMaker *make) {
  397. // make.left.equalTo(audioPlayBtn.mas_right).offset(5.0f);
  398. // make.centerY.equalTo(aBgV);
  399. // }];
  400. //
  401. // UIImageView *animationImgV = [[UIImageView alloc] init];
  402. // animationImgV.image = [UIImage imageNamed:@"vqu_images_ic_user_show_audio_animation_3"];
  403. //
  404. // NSMutableArray * animationArray = [NSMutableArray array];
  405. //
  406. // for (NSInteger i = 0; i < 3; i ++) {
  407. // [animationArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"vqu_images_ic_user_show_audio_animation_%@",@(i + 1)]]];
  408. // }
  409. // //设置动画数组
  410. // [animationImgV setAnimationImages:animationArray];
  411. // //设置动画播放次数
  412. // [animationImgV setAnimationRepeatCount:INT32_MAX];
  413. // //设置动画播放时间
  414. // [animationImgV setAnimationDuration:3*0.35];
  415. //
  416. // [aBgV addSubview:animationImgV];
  417. // self.youpaipanimationImgV = animationImgV;
  418. // [animationImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  419. // make.left.equalTo(timerL.mas_right).offset(5.0f);
  420. // make.centerY.equalTo(aBgV);
  421. // make.size.mas_offset(CGSizeMake(19.0f, 19.0f));
  422. // }];
  423. // }
  424. CGFloat totalHeight = 458+StatusBarHeight;
  425. // CGFloat bottom = 0;
  426. // NSString *content = self.youpaipmodel.youpaipinfo.youpaipsign;
  427. // if (content.length != 0) {
  428. // UILabel *signL = [[UILabel alloc] init];
  429. // // signL.text = @"说一段话介绍自己,或唱一首歌!";
  430. // signL.font = LCFont12;
  431. // signL.textColor = [UIColor whiteColor];
  432. // signL.numberOfLines = 0;
  433. //// signL.text = content;
  434. // [self addSubview:signL];
  435. // [signL mas_makeConstraints:^(MASConstraintMaker *make) {
  436. // make.left.offset(14.0f);
  437. // make.top.equalTo(infoBgV.mas_bottom).offset(10.0f);
  438. // make.right.offset(-14.0f);
  439. //// make.bottom.offset(-25.0f);
  440. // }];
  441. //
  442. // NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:content];
  443. // NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
  444. // paragraphStyle1.alignment=NSTextAlignmentJustified;
  445. // NSDictionary * dic =@{
  446. // NSParagraphStyleAttributeName:paragraphStyle1,
  447. // NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleNone],
  448. // };
  449. // [attributedString1 setAttributes:dic range:NSMakeRange(0, attributedString1.length)];
  450. // [signL setAttributedText:attributedString1];
  451. //
  452. // CGFloat height = [content boundingRectWithSize:CGSizeMake(KScreenWidth - 28.0f, MAXFLOAT)
  453. // options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
  454. // attributes:@{ NSFontAttributeName : LCFont12 } context:nil].size.height;
  455. //
  456. // totalHeight += height + 35.0f;
  457. // bottom+=height+35;
  458. // }
  459. //页码
  460. // if (self.youpaipmodel.youpaipalbum.count != 0) {
  461. // UILabel *avatarCountL = [[UILabel alloc] init];
  462. // avatarCountL.font = LCFont(9.0f);
  463. // avatarCountL.textColor = [UIColor whiteColor];
  464. // avatarCountL.text = [NSString stringWithFormat:@"%@/%@",@(1),@(self.youpaipmodel.youpaipalbum.count)];
  465. // [self addSubview:avatarCountL];
  466. // self.youpaipavatarCountL = avatarCountL;
  467. // [avatarCountL mas_makeConstraints:^(MASConstraintMaker *make) {
  468. // make.right.equalTo(-14);
  469. // make.centerY.equalTo(idBtn.mas_centerY);
  470. // }];
  471. // }
  472. // //直播中
  473. // UIButton *leftTopBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  474. //
  475. // leftTopBtn.frame = CGRectMake(0, NavBarHeight, 94.0f, 27.0f);
  476. // UIImage *bgImage = [LCTools ColorImage:leftTopBtn.mj_size FromColors:@[ZYGradientOneColor,ZYGradientTwoColor] ByGradientType:GradientLeftToRight];
  477. // [leftTopBtn setBackgroundImage:bgImage forState:UIControlStateNormal];
  478. // [leftTopBtn setBackgroundImage:bgImage forState:UIControlStateHighlighted];
  479. //// [LCTools clipCorner:UIRectCornerBottomRight View:leftTopBtn size:CGSizeMake(8.0f, 8.0f)];
  480. // leftTopBtn.layer.cornerRadius = 15;
  481. // leftTopBtn.layer.masksToBounds = YES;
  482. // [self addSubview:leftTopBtn];
  483. // [leftTopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  484. // make.bottom.mas_equalTo(-(bottom+35));
  485. // make.right.mas_equalTo(-14.0f);
  486. // make.size.mas_equalTo(CGSizeMake(94.0f, 27.0f));
  487. // }];
  488. // [leftTopBtn addTarget:self action:@selector(leftTopBtnClick) forControlEvents:UIControlEventTouchUpInside];
  489. //// NSString *path = [[NSBundle mainBundle] pathForResource:@"ic_live_zhibozhong_28" ofType:@"gif"];
  490. //// YYAnimatedImageView *iconImgV = [[YYAnimatedImageView alloc] init];
  491. //// iconImgV.image = [YYImage imageWithData:[NSData dataWithContentsOfFile:path]];
  492. //
  493. // LOTAnimationView *iconImgV = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:@"ic_chatroom_part" ofType:@"json"]];
  494. // [leftTopBtn addSubview:iconImgV];
  495. //// talkingAnimationView.frame = CGRectMake(0.0f, 0.0f, self.mj_w * 1.7f, self.mj_h * 1.7f);
  496. // iconImgV.loopAnimation = YES;
  497. // iconImgV.contentMode = UIViewContentModeScaleAspectFill;
  498. // [iconImgV play];
  499. // [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  500. // make.left.offset(8.0f);
  501. // make.centerY.equalTo(leftTopBtn.mas_centerY);
  502. // make.size.mas_offset(CGSizeMake(16.0f, 14.0f));
  503. // }];
  504. //
  505. //// [leftTopBtn addSubview:iconImgV];
  506. //// [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  507. //// make.left.offset(3.0f);
  508. //// make.centerY.equalTo(leftTopBtn.mas_centerY);
  509. //// make.size.mas_offset(CGSizeMake(12.5f, 12.5f));
  510. //// }];
  511. //
  512. // UIImageView *arrowImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_D_profile_item_arrow_w"]];
  513. // [leftTopBtn addSubview:arrowImgV];
  514. // [arrowImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  515. // make.right.offset(-8.0f);
  516. // make.centerY.equalTo(leftTopBtn.mas_centerY);
  517. // make.size.mas_offset(CGSizeMake(8.0f, 8.0f));
  518. // }];
  519. //
  520. // UILabel *textL = [[UILabel alloc] init];
  521. // textL.font = LCFont(11.0f);
  522. // textL.textColor = [UIColor whiteColor];
  523. // textL.text = @"正在房间";
  524. // [leftTopBtn addSubview:textL];
  525. // [textL mas_makeConstraints:^(MASConstraintMaker *make) {
  526. // make.left.equalTo(iconImgV.mas_right).offset(3.0f);
  527. // make.right.equalTo(arrowImgV.mas_left).offset(-3.0f);
  528. // make.centerY.equalTo(leftTopBtn.mas_centerY);
  529. // }];
  530. // leftTopBtn.hidden = NO;
  531. // if (self.youpaipmodel.youpaiptalk_room_id != 0) {
  532. // leftTopBtn.hidden = NO;
  533. // }else{
  534. // leftTopBtn.hidden = YES;
  535. // }
  536. // UIView *bgv = [UIView new];
  537. // [infoBgV addSubview:bgv];
  538. // [bgv mas_makeConstraints:^(MASConstraintMaker *make) {
  539. // make.edges.mas_equalTo(0);
  540. // }];
  541. // bgv.backgroundColor = [UIColor redColor];
  542. self.frame = CGRectMake(0, 0, KScreenWidth, totalHeight);
  543. }
  544. #pragma mark <UICollectionViewDataSource>
  545. /**
  546. 返回区数
  547. @param collectionView 集合视图
  548. @return 返回区数
  549. */
  550. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  551. return 1;
  552. }
  553. /**
  554. 返回项目数
  555. @param collectionView 集合视图
  556. @param section 区
  557. @return 项目数
  558. */
  559. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  560. return self.youpaipmodel.youpaipalbums.count;
  561. }
  562. -(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
  563. NSString *identifier=[NSString stringWithFormat:@"%ld%ld",(long)indexPath.section,(long)indexPath.row];
  564. [self.collectionView registerClass:[YOUPAIShowHeaderBigImageCell class] forCellWithReuseIdentifier:identifier];
  565. YOUPAIAlbumModel *model = self.youpaipmodel.youpaipalbums[indexPath.item];
  566. YOUPAIShowHeaderBigImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
  567. NSString *url = model.youpaipurl;
  568. if (indexPath.item == 0&&model.youpaipis_video == 1) {//视频
  569. [self setupPlayer:cell.youpaipiconImageView:model.youpaipurl];
  570. // [cell.youpaipiconImageView sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil];
  571. }else{
  572. [cell.youpaipiconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,url]] placeholderImage:nil];
  573. }
  574. return cell;
  575. }
  576. -(void)setupPlayer:(UIImageView*)imageView:(NSString*)url{
  577. ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
  578. playerManager.shouldAutoPlay = YES;
  579. /// 播放器相关
  580. self.player = [ZFPlayerController playerWithPlayerManager:playerManager containerView:imageView];
  581. self.player.controlView = self.youpaipcontrolView;
  582. self.player.disablePanMovingDirection = ZFPlayerDisablePanMovingDirectionAll;
  583. /// 设置退到后台继续播放
  584. self.player.pauseWhenAppResignActive = NO;
  585. self.player.allowOrentitaionRotation = NO;
  586. @weakify(self)
  587. /// 播放完成
  588. self.player.playerDidToEnd = ^(id _Nonnull asset) {
  589. @strongify(self)
  590. [self.player.currentPlayerManager replay];
  591. };
  592. self.player.assetURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,url]];
  593. [self.player playTheIndex:0];
  594. [self.player.currentPlayerManager setMuted:YES];
  595. }
  596. -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
  597. NSInteger current = scrollView.contentOffset.x / KScreenWidth;
  598. NSLog(@"下标===========%ld",(long)current);
  599. if (current == 0) {
  600. [self.player.currentPlayerManager play];
  601. }else{
  602. [self.player.currentPlayerManager pause];
  603. }
  604. }
  605. -(void)didSelectImageIndex:(NSInteger)index{
  606. [self.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
  607. }
  608. - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
  609. NSInteger index = scrollView.contentOffset.x/KScreenWidth;
  610. [self.rightCollectionView setScrollToItemAtIndex:index];
  611. [scrollView zf_scrollViewDidEndDecelerating];
  612. }
  613. -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  614. NSMutableArray *tempArr = [NSMutableArray array];
  615. for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
  616. YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
  617. if (model1.youpaipis_video == 1) {
  618. YBIBVideoData *data = [YBIBVideoData new];
  619. data.videoURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
  620. data.projectiveView = self.videoCoverImgV;
  621. [tempArr addObject:data];
  622. }else{
  623. YBIBImageData *model = [YBIBImageData new];
  624. model.imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
  625. model.projectiveView = self.videoCoverImgV;
  626. [tempArr addObject:model];
  627. }
  628. }
  629. YBImageBrowser *browser = [YBImageBrowser new];
  630. browser.delegate = self;
  631. browser.dataSourceArray = tempArr;
  632. browser.currentPage = indexPath.item;
  633. [browser show];
  634. }
  635. /**
  636. 开始转场
  637. @param imageBrowser 图片浏览器
  638. @param isShow YES 表示入场,NO 表示出场
  639. */
  640. - (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser beginTransitioningWithIsShow:(BOOL)isShow{
  641. for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
  642. YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
  643. if (model1.youpaipis_video == 1) {
  644. [self.player.currentPlayerManager pause];
  645. }
  646. }
  647. }
  648. /**
  649. 结束转场
  650. @param imageBrowser 图片浏览器
  651. @param isShow YES 表示入场,NO 表示出场
  652. */
  653. - (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser endTransitioningWithIsShow:(BOOL)isShow{
  654. for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
  655. YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
  656. if (model1.youpaipis_video == 1) {
  657. [self.player.currentPlayerManager play];
  658. }
  659. }
  660. }
  661. -(void)DidAvViewShowBrowser{
  662. // self.player.currentPlayerManager.muted = NO;
  663. NSMutableArray *tempArr = [NSMutableArray array];
  664. for (int i=0; i<self.youpaipmodel.youpaipalbums.count; i++) {
  665. YOUPAIAlbumModel *model1 = self.youpaipmodel.youpaipalbums[i];
  666. if (model1.youpaipis_video == 1) {
  667. YBIBVideoData *data = [YBIBVideoData new];
  668. data.videoURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
  669. data.projectiveView = self.videoCoverImgV;
  670. [tempArr addObject:data];
  671. }else{
  672. YBIBImageData *model = [YBIBImageData new];
  673. model.imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,model1.youpaipurl] ];
  674. model.projectiveView = self.videoCoverImgV;
  675. [tempArr addObject:model];
  676. }
  677. }
  678. YBImageBrowser *browser = [YBImageBrowser new];
  679. browser.dataSourceArray = tempArr;
  680. browser.currentPage = 0;
  681. [browser show];
  682. }
  683. -(void)didVideoOrImage:(UIButton*)sender{
  684. if (self.didClickVideoOrImage) {
  685. self.didClickVideoOrImage(self.youpaipmodel);
  686. }
  687. }
  688. -(void)guardBtnClick{
  689. if (self.youpaipdidClickSh) {
  690. self.youpaipdidClickSh();
  691. }
  692. }
  693. -(void)youpaipmemberAvatarBgVClick{
  694. if (self.jumToGuardVCClick) {
  695. self.jumToGuardVCClick();
  696. }
  697. }
  698. // 复制ID点击事件
  699. - (void)youpaifcopyBtnClick{
  700. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  701. pasteboard.string = self.youpaipmodel.youpaipusercode;
  702. [ZCHUDHelper showTitle:@"复制成功"];
  703. }
  704. // 关注点击事件
  705. - (void)youpaiffollowBtnClick:(UIButton *)sender{
  706. sender.selected = !sender.selected;
  707. [LCCommonHttp followUserId:self.youpaipmodel.youpaipuserid];
  708. }
  709. //进入直播
  710. -(void)leftTopBtnClick{
  711. NSString *roomId = [NSString stringWithFormat:@"%@",@(self.youpaipmodel.youpaiptalk_room_id)];
  712. if ([[YOUPAILZChatRoomManager shareManager].chatroomModel.youpaiproom_id isEqual:roomId] && [YOUPAILZChatRoomManager shareManager].chatroomController != nil) {
  713. [[YOUPAILZChatRoomManager shareManager] youpaifshowChatRoom];
  714. return;
  715. }
  716. [self youpaifshowPasswordWindowWithRoomId:roomId youpaipis_comein_room_hide:0];
  717. }
  718. - (void)youpaifshowPasswordWindowWithRoomId:(NSString *)roomId youpaipis_comein_room_hide:(NSInteger)youpaipis_comein_room_hide{
  719. @weakify(self);
  720. [LCHttpHelper requestWithURLString:GetRoomStatus parameters:@{@"room_id":roomId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  721. @strongify(self);
  722. NSDictionary* dict = (NSDictionary*)responseObject;
  723. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  724. if (code==0) {
  725. NSDictionary *data = [dict objectForKey:@"data"];
  726. if ([[data objectForKey:@"pwd"] integerValue] == 1) { // 有密码
  727. YOUPAILZChatRoomPasswordWindow *window = [[YOUPAILZChatRoomPasswordWindow alloc] init];
  728. [window setYoupaippasswordBlock:^(NSString * _Nonnull password, YOUPAILZChatRoomPasswordWindow * _Nonnull window) {
  729. @strongify(self);
  730. [self youpaifgoChatRoomVCWithPwd:password RoomId:roomId youpaipis_comein_room_hide:youpaipis_comein_room_hide window:window];
  731. }];
  732. [[LCTools getCurrentVC] TFPresentVC:window completion:^{}];
  733. }else{
  734. [self youpaifgoChatRoomVCWithPwd:@"" RoomId:roomId youpaipis_comein_room_hide:youpaipis_comein_room_hide window:nil];
  735. }
  736. }
  737. } failure:^(NSError *error) {
  738. }];
  739. }
  740. /// 加入语聊房
  741. /// @param pwd 密码
  742. /// @param roomId 房间号
  743. /// @param youpaipis_comein_room_hide 是否悄悄进房
  744. /// @param window 密码框
  745. - (void)youpaifgoChatRoomVCWithPwd:(NSString *)pwd RoomId:(NSString *)roomId youpaipis_comein_room_hide:(NSInteger)youpaipis_comein_room_hide window:(YOUPAILZChatRoomPasswordWindow *)window{
  746. [ZCHUDHelper show];
  747. @weakify(self);
  748. [LCHttpHelper requestWithURLString:JoinTalk parameters:@{@"room_id":roomId,@"pwd":pwd,@"is_comein_room_hide":@(youpaipis_comein_room_hide)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  749. [ZCHUDHelper dismiss];
  750. @strongify(self);
  751. NSDictionary* dict = (NSDictionary*)responseObject;
  752. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  753. if (code==0) {
  754. if (window != nil) {
  755. [window dismissViewControllerAnimated:YES completion:^{}];
  756. }
  757. [[YOUPAILZChatRoomManager shareManager] youpaifleaveChannel];
  758. YOUPAILZChatRoomModel *youpaipchatroomModel = [YOUPAILZChatRoomModel mj_objectWithKeyValues:dict[@"data"]];
  759. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  760. YOUPAILZChatRoomVC *vc = [[YOUPAILZChatRoomVC alloc] init];
  761. vc.youpaipchatroomModel = youpaipchatroomModel;
  762. [[LCTools getContainNavigationControllerCurrentVC].navigationController pushViewController:vc animated:YES];
  763. [YOUPAILZChatRoomManager shareManager].chatroomModel = vc.youpaipchatroomModel;
  764. [YOUPAILZChatRoomManager shareManager].chatroomController = vc;
  765. // });
  766. }else{
  767. if (window != nil) {
  768. [window youpaifshowHUDWithTitle:[dict objectForKey:@"message"]];
  769. }else{
  770. [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
  771. }
  772. }
  773. } failure:^(NSError *error) {
  774. [ZCHUDHelper dismiss];
  775. }];
  776. }
  777. - (YOUPAIZFDouYinControlView *)youpaipcontrolView {
  778. if (!_youpaipcontrolView) {
  779. _youpaipcontrolView = [YOUPAIZFDouYinControlView new];
  780. _youpaipcontrolView.hideenProgess = YES;
  781. _youpaipcontrolView.userInteractionEnabled = YES;
  782. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DidAvViewShowBrowser)];
  783. [_youpaipcontrolView addGestureRecognizer:tap];
  784. }
  785. return _youpaipcontrolView;
  786. }
  787. - (void)youpaifeditBtnCountWithCount:(NSInteger)count{
  788. if (count >= self.youpaipmemberAvatars.count) {
  789. [self youpaifaddBtnWithCount:count - self.youpaipmemberAvatars.count];
  790. }else{
  791. [self youpaifdeleteBtnWithCount:self.youpaipmemberAvatars.count - count];
  792. }
  793. }
  794. - (void)youpaifdeleteBtnWithCount:(NSInteger)count{
  795. if (count != 0) {
  796. for (NSInteger i = 0; i < count; i ++) {
  797. UIImageView *btn = self.youpaipmemberAvatars.lastObject;
  798. [self.youpaipmemberAvatars removeLastObject];
  799. [btn removeFromSuperview];
  800. }
  801. }
  802. }
  803. - (void)youpaifaddBtnWithCount:(NSInteger)count{
  804. for (NSInteger i = 0; i < count; i ++) {
  805. [self youpaifcreateBtn];
  806. }
  807. }
  808. - (void)youpaifcreateBtn{
  809. UIImageView *imgV = [[UIImageView alloc] init];
  810. imgV.contentMode = UIViewContentModeScaleAspectFill;
  811. [self.youpaipmemberAvatarBgV addSubview:imgV];
  812. [self.youpaipmemberAvatars addObject:imgV];
  813. }
  814. - (NSMutableArray<UIImageView *> *)youpaipmemberAvatars{
  815. if (_youpaipmemberAvatars == nil) {
  816. _youpaipmemberAvatars = [NSMutableArray array];
  817. }
  818. return _youpaipmemberAvatars;
  819. }
  820. @end