HMVideoControlView.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. //
  2. // HMVideoControlView.m
  3. // BuguLive
  4. //
  5. // Created by 范东 on 2018/12/27.
  6. // Copyright © 2018 xfg. All rights reserved.
  7. //
  8. #import "HMVideoControlView.h"
  9. #import "PersonCenterModel.h"
  10. #import "CommentModel.h"
  11. #import "BogoShopKit.h"
  12. @interface HMVideoControlView ()
  13. @property (nonatomic, strong) UIImageView *iconView;
  14. @property (nonatomic, strong) QMUIButton *praiseBtn;
  15. @property (nonatomic, strong) QMUIButton *shareBtn;
  16. @property (nonatomic, strong) QMUIButton *oneOnOneBtn;
  17. //@property (nonatomic, strong) QMUIButton *giftBtn;
  18. @property (nonatomic, strong) UILabel *nameLabel;
  19. @property (nonatomic, strong) UILabel *contentLabel;
  20. @property (nonatomic, strong) UIActivityIndicatorView *loadingView;
  21. @property (nonatomic, strong) UIButton *playBtn;
  22. @property (nonatomic, assign) int currentPage; //当前页数
  23. @property (nonatomic, assign) int has_next; //是否还有下一页1代表有
  24. @property (nonatomic, strong) NSMutableArray *dataArray;
  25. @property (nonatomic, strong) NSMutableDictionary *shareDict;
  26. @property (nonatomic, strong) PersonCenterModel *detailModel;
  27. @property (nonatomic, strong) UIButton *focusBtn;
  28. @property(nonatomic, strong) BogoVideoGoodControl *goodControl;
  29. @property (nonatomic, strong) UIStackView *stackView;
  30. @property (nonatomic, strong) UIView *avatarView;
  31. @end
  32. @implementation HMVideoControlView
  33. - (instancetype)initWithIsPushed:(BOOL)isPushed {
  34. if (self = [super init]) {
  35. self.isPushed = isPushed;
  36. [self addSubview:self.coverImgView];
  37. [self addSubview:self.stackView];
  38. [self addSubview:self.nameLabel];
  39. [self addSubview:self.contentLabel];
  40. [self addSubview:self.loadingView];
  41. [self addSubview:self.playBtn];
  42. [self.coverImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.edges.equalTo(self);
  44. }];
  45. CGFloat bottomM = TABBAR_HEIGHT + 64+50;
  46. if ([GlobalVariables sharedInstance].appModel.short_video.integerValue && !self.isPushed) {
  47. bottomM = TABBAR_HEIGHT;
  48. }
  49. if (self.isPushed){
  50. bottomM = TABBAR_HEIGHT;
  51. }
  52. [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.left.equalTo(self).offset(kRealValue(12));
  54. make.bottom.mas_offset(kRealValue(-18));
  55. make.width.mas_lessThanOrEqualTo(kRealValue(275));
  56. }];
  57. [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.left.equalTo(self.contentLabel);
  59. make.bottom.equalTo(self.contentLabel.mas_top).offset(-8);
  60. }];
  61. [self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.center.equalTo(self);
  63. }];
  64. [self.playBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.center.equalTo(self);
  66. }];
  67. [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.bottom.mas_equalTo(self.contentLabel);
  69. make.right.mas_offset(kRealValue(-12));
  70. }];
  71. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(controlViewDidClick:)];
  72. [self addGestureRecognizer:tap];
  73. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeFocusStatus:) name:@"liveIsShowFollow" object:nil];
  74. }
  75. return self;
  76. }
  77. - (void)setModel:(SmallVideoListModel *)model {
  78. _model = model;
  79. if ([model.user_id isEqualToString:[[IMAPlatform sharedInstance].host imUserId]]) {
  80. // self.giftBtn.hidden = YES;
  81. }else{
  82. // self.giftBtn.hidden = NO;
  83. }
  84. //
  85. [self.coverImgView sd_setImageWithURL:[NSURL URLWithString:model.photo_image] placeholderImage:[UIImage imageNamed:@"placeholderimg"]];
  86. //
  87. self.nameLabel.text = [NSString stringWithFormat:@"@%@", model.nick_name];
  88. [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.head_image] placeholderImage:[UIImage imageNamed:@"placeholderimg"]];
  89. //
  90. self.contentLabel.text = model.content;
  91. //
  92. [self.praiseBtn setTitle:model.digg_count forState:UIControlStateNormal];
  93. [self.commentBtn setTitle:model.comment_count forState:UIControlStateNormal];
  94. // [self.shareBtn setTitle:model.share_num forState:UIControlStateNormal];
  95. if (![self.model.user_id isEqualToString:[BGIMLoginManager sharedInstance].loginParam.identifier]){
  96. [self.focusBtn setHidden:[model.has_focus isEqualToString:@"1"]];
  97. }else{
  98. self.focusBtn.hidden = NO;
  99. }
  100. [self loadNetDataWithPage:1];
  101. if (model.weibo_id.integerValue) {
  102. [self addPlayNumWithWeiBoId:model.weibo_id];
  103. }else{
  104. [self addPlayNumWithWeiBoId:model.id];
  105. }
  106. if (![GlobalVariables sharedInstance].userModel.is_open_young.integerValue) {
  107. if (StrValid(model.shop_id) && model.shop_title.length) {
  108. [self addSubview:self.goodControl];
  109. [self.goodControl.titleLabel setText:SafeStr(model.shop_title)];
  110. [self.goodControl mas_makeConstraints:^(MASConstraintMaker *make) {
  111. make.left.equalTo(self).offset(15);
  112. make.height.mas_equalTo(@30);
  113. make.bottom.equalTo(self.nameLabel.mas_top).offset(-30);
  114. make.right.lessThanOrEqualTo(self).offset(-60);
  115. }];
  116. }else{
  117. [self.goodControl removeFromSuperview];
  118. }
  119. }
  120. }
  121. - (void)changeFocusStatus:(NSNotification *)noti{
  122. NSDictionary *dict = noti.object;
  123. NSString *isShowFollow = dict[@"isShowFollow"];
  124. NSString *userId = dict[@"userId"];
  125. if ([userId isEqualToString:self.model.user_id]) {
  126. self.focusBtn.hidden = ![isShowFollow isEqualToString:@"1"];
  127. }
  128. }
  129. #pragma mark 加载详情数据
  130. -(void)loadNetDataWithPage:(int)page
  131. {
  132. NSMutableDictionary *MDict = [NSMutableDictionary new];
  133. [MDict setObject:@"weibo" forKey:@"ctl"];
  134. [MDict setObject:@"index" forKey:@"act"];
  135. [MDict setObject:@"xr" forKey:@"itype"];
  136. if (self.model.weibo_id.length)
  137. {
  138. [MDict setObject:self.model.weibo_id forKey:@"weibo_id"];
  139. }
  140. if (self.model.id.length)
  141. {
  142. [MDict setObject:self.model.id forKey:@"weibo_id"];
  143. }
  144. FWWeakify(self)
  145. [self.httpsManager POSTWithParameters:MDict SuccessBlock:^(NSDictionary *responseJson)
  146. {
  147. FWStrongify(self)
  148. _has_next = [responseJson toInt:@"has_next"];
  149. _currentPage = [responseJson toInt:@"page"];
  150. if (_currentPage == 1)
  151. {
  152. [_dataArray removeAllObjects];
  153. }
  154. if ([responseJson toInt:@"status"]== 1)
  155. {
  156. // self.praiseBtn.selected = [responseJson[@"info"][@"has_digg"] isEqual:@(1)];
  157. if ([responseJson[@"info"][@"has_digg"] isEqual:@(1)]) {
  158. _praiseBtn.selected = YES;
  159. }else{
  160. _praiseBtn.selected = NO;
  161. }
  162. [self.praiseBtn setTitle:responseJson[@"info"][@"digg_count"] forState:UIControlStateNormal];
  163. [self.commentBtn setTitle:responseJson[@"info"][@"comment_count"] forState:UIControlStateNormal];
  164. NSDictionary *shareD = [responseJson objectForKey:@"invite_info"];
  165. if (shareD && [shareD isKindOfClass:[NSDictionary class]]) {
  166. if ([shareD count])
  167. {
  168. if ([[shareD objectForKey:@"clickUrl"] length])
  169. {
  170. [self.shareDict setObject:[shareD objectForKey:@"clickUrl"] forKey:@"share_url"];
  171. }else
  172. {
  173. [self.shareDict setObject:@"" forKey:@"share_url"];
  174. }
  175. if ([[shareD objectForKey:@"content"] length])
  176. {
  177. [self.shareDict setObject:[shareD objectForKey:@"content"] forKey:@"share_content"];
  178. }else
  179. {
  180. [self.shareDict setObject:@"" forKey:@"share_content"];
  181. }
  182. if ([[shareD objectForKey:@"imageUrl"] length])
  183. {
  184. [self.shareDict setObject:[shareD objectForKey:@"imageUrl"] forKey:@"share_imageUrl"];
  185. }else
  186. {
  187. [self.shareDict setObject:@"" forKey:@"share_imageUrl"];
  188. }
  189. if ([[shareD objectForKey:@"title"] length])
  190. {
  191. [self.shareDict setObject:[shareD objectForKey:@"title"] forKey:@"share_title"];
  192. }else
  193. {
  194. [self.shareDict setObject:@"" forKey:@"share_title"];
  195. }
  196. }
  197. }
  198. _detailModel = [PersonCenterModel mj_objectWithKeyValues:responseJson];
  199. // [self.focusBtn setHidden:_detailModel.has_focus == 1];
  200. //动态
  201. NSArray *comment_listArray = [responseJson objectForKey:@"comment_list"];
  202. if (comment_listArray && [comment_listArray isKindOfClass:[NSArray class]])
  203. {
  204. if (comment_listArray.count)
  205. {
  206. for (NSDictionary *dict in comment_listArray)
  207. {
  208. CommentModel *CModel = [CommentModel mj_objectWithKeyValues:dict];
  209. [self.dataArray addObject:CModel];
  210. }
  211. }
  212. }
  213. }else
  214. {
  215. [[BGHUDHelper sharedInstance] tipMessage:[responseJson toString:@"error"]];
  216. }
  217. } FailureBlock:^(NSError *error)
  218. {
  219. NSLog(@"error==%@",error);
  220. }];
  221. }
  222. #pragma mark 播放视频加1
  223. - (void)addPlayNumWithWeiBoId:(NSString *)weiBoId
  224. {
  225. NSMutableDictionary *MDict = [NSMutableDictionary new];
  226. [MDict setObject:@"weibo" forKey:@"ctl"];
  227. [MDict setObject:@"add_video_count" forKey:@"act"];
  228. [MDict setObject:@"xr" forKey:@"itype"];
  229. if (weiBoId.length)
  230. {
  231. [MDict setObject:weiBoId forKey:@"weibo_id"];
  232. }
  233. FWWeakify(self)
  234. [self.httpsManager POSTWithParameters:MDict SuccessBlock:^(NSDictionary *responseJson)
  235. {
  236. FWStrongify(self)
  237. if ([responseJson toInt:@"status"]== 1)
  238. {
  239. _detailModel.info.video_count = [responseJson toString:@"video_count"];
  240. NSMutableDictionary *postDict = [[NSMutableDictionary alloc]init];
  241. [postDict setObject:@"video" forKey:@"type"];
  242. [postDict setObject:[NSString stringWithFormat:@"%d",[responseJson toInt:@"video_count"]] forKey:@"count"];
  243. [[NSNotificationCenter defaultCenter] postNotificationName:@"changeTableViewStatus" object:postDict];
  244. }else{
  245. [[BGHUDHelper sharedInstance] tipMessage:[responseJson toString:@"error"]];
  246. }
  247. } FailureBlock:^(NSError *error)
  248. {
  249. NSLog(@"error==%@",error);
  250. }];
  251. }
  252. #pragma mark - Public Methods
  253. - (void)setProgress:(float)progress {
  254. }
  255. - (void)startLoading {
  256. [self.loadingView startAnimating];
  257. }
  258. - (void)stopLoading {
  259. [self.loadingView stopAnimating];
  260. }
  261. - (void)showPlayBtn {
  262. self.playBtn.hidden = NO;
  263. }
  264. - (void)hidePlayBtn {
  265. self.playBtn.hidden = YES;
  266. }
  267. #pragma mark - Action
  268. - (void)controlViewDidClick:(id)sender {
  269. if ([self.delegate respondsToSelector:@selector(controlViewDidClickSelf:)]) {
  270. [self.delegate controlViewDidClickSelf:self];
  271. }
  272. }
  273. - (void)iconDidClick:(id)sender {
  274. if (![GlobalVariables sharedInstance].userModel.is_open_young.integerValue) {
  275. if ([self.delegate respondsToSelector:@selector(controlViewDidClickIcon:)]) {
  276. [self.delegate controlViewDidClickIcon:self];
  277. }
  278. }
  279. }
  280. - (void)praiseBtnClick:(id)sender {
  281. if ([self.delegate respondsToSelector:@selector(controlViewDidClickPriase:)]) {
  282. [self.delegate controlViewDidClickPriase:self];
  283. }
  284. }
  285. - (void)commentBtnClick:(id)sender {
  286. if ([self.delegate respondsToSelector:@selector(controlViewDidClickComment:DataArray:)]) {
  287. [self.delegate controlViewDidClickComment:self DataArray:self.dataArray];
  288. }
  289. }
  290. - (void)oneOnOneBtnClick:(UIButton *)sender{
  291. [self showPlayBtn];
  292. if (self.delegate && [self.delegate respondsToSelector:@selector(controlViewDidClickOneOnOne:)]) {
  293. [self.delegate controlViewDidClickOneOnOne:self];
  294. }
  295. }
  296. - (void)shareBtnClick:(id)sender {
  297. if ([self.delegate respondsToSelector:@selector(controlViewDidClickShare:ShareDict:)]) {
  298. [self.delegate controlViewDidClickShare:self ShareDict:self.shareDict];
  299. }
  300. }
  301. -(void)giftBtnClick:(UIButton *)sender{
  302. if ([self.delegate respondsToSelector:@selector(controlViewDidClickGift:)]) {
  303. [self.delegate controlViewDidClickGift:self];
  304. }
  305. }
  306. - (void)setiIsPraise:(BOOL)isPraise diggcount:(nonnull NSString *)diggcount{
  307. // if (isPraise) {
  308. // [_praiseBtn setImage:[UIImage imageNamed:@"me_icon_star_selected"] forState:UIControlStateNormal];
  309. // }else{
  310. // [_praiseBtn setImage:[UIImage imageNamed:@"me_icon_star_normal"] forState:UIControlStateNormal];
  311. // }
  312. _praiseBtn.selected = isPraise;
  313. // self.praiseBtn.selected = isPraise;
  314. [self.praiseBtn setTitle:diggcount forState:UIControlStateNormal];
  315. }
  316. - (void)commentBtnAction{
  317. //点击了想撩TA按钮
  318. if ([self.delegate respondsToSelector:@selector(controlViewDidClickBottomComment:)]) {
  319. [self.delegate controlViewDidClickBottomComment:self];
  320. }
  321. }
  322. - (void)focusBtnAction{
  323. NSMutableDictionary *dictM = [[NSMutableDictionary alloc]init];
  324. [dictM setObject:@"user" forKey:@"ctl"];
  325. [dictM setObject:@"follow" forKey:@"act"];
  326. [dictM setObject:[NSString stringWithFormat:@"%@",self.model.user_id] forKey:@"to_user_id"];
  327. [self.httpsManager POSTWithParameters:dictM SuccessBlock:^(NSDictionary *responseJson)
  328. {
  329. if ([responseJson toInt:@"status"] == 1)
  330. {
  331. int has_focus = [responseJson toInt:@"has_focus"];
  332. if ([responseJson toInt:@"status"] == 1)
  333. {
  334. if (has_focus == 1)//已关注
  335. {
  336. self.focusBtn.hidden = YES;
  337. }else if (has_focus == 0)//关注
  338. {
  339. self.focusBtn.hidden = NO;
  340. }
  341. self.model.has_focus = [NSString stringWithFormat:@"%@",[responseJson valueForKey:@"has_focus"]];
  342. }
  343. }
  344. } FailureBlock:^(NSError *error)
  345. {
  346. }];
  347. }
  348. #pragma mark - 懒加载
  349. - (UIStackView *)stackView {
  350. if (!_stackView) {
  351. NSMutableArray *buttons = [[NSMutableArray alloc] initWithArray:@[
  352. self.avatarView, self.praiseBtn, self.commentBtn, self.shareBtn, self.oneOnOneBtn
  353. ]];
  354. _stackView = [[UIStackView alloc] initWithArrangedSubviews:buttons];
  355. _stackView.axis = UILayoutConstraintAxisVertical;
  356. _stackView.distribution = UIStackViewDistributionEqualSpacing;
  357. _stackView.alignment = UIStackViewAlignmentCenter;
  358. _stackView.spacing = 10;
  359. }
  360. return _stackView;
  361. }
  362. - (UIView *)avatarView {
  363. if (!_avatarView) {
  364. _avatarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(48), kRealValue(58))];
  365. [_avatarView addSubview:self.iconView];
  366. [_avatarView addSubview:self.focusBtn];
  367. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  368. make.size.mas_equalTo(self.iconView.size);
  369. make.top.centerX.mas_offset(0);
  370. }];
  371. [self.focusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  372. make.centerX.mas_offset(0);
  373. make.centerY.equalTo(self.iconView.mas_bottom);
  374. make.size.mas_equalTo(kRealValue(20));
  375. }];
  376. [_avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
  377. make.size.mas_equalTo(self.avatarView.size);
  378. }];
  379. }
  380. return _avatarView;
  381. }
  382. - (UIImageView *)coverImgView {
  383. if (!_coverImgView) {
  384. _coverImgView = [UIImageView new];
  385. _coverImgView.contentMode = UIViewContentModeScaleAspectFill;
  386. _coverImgView.clipsToBounds = YES;
  387. }
  388. return _coverImgView;
  389. }
  390. - (UIImageView *)iconView {
  391. if (!_iconView) {
  392. _iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kRealValue(48), kRealValue(48))];
  393. _iconView.layer.cornerRadius = _iconView.height/2;
  394. _iconView.layer.masksToBounds = YES;
  395. _iconView.layer.borderColor = [UIColor whiteColor].CGColor;
  396. _iconView.layer.borderWidth = 1.0f;
  397. _iconView.userInteractionEnabled = YES;
  398. UITapGestureRecognizer *iconTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(iconDidClick:)];
  399. [_iconView addGestureRecognizer:iconTap];
  400. }
  401. return _iconView;
  402. }
  403. - (QMUIButton *)praiseBtn {
  404. if (!_praiseBtn) {
  405. _praiseBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  406. [_praiseBtn setImage:[UIImage imageNamed:@"icon22x22-2"] forState:UIControlStateNormal];
  407. [_praiseBtn setImage:[UIImage imageNamed:@"icon22x22-2"] forState:UIControlStateSelected];
  408. [_praiseBtn setTitle:@"0" forState:UIControlStateNormal];
  409. _praiseBtn.imagePosition = QMUIButtonImagePositionTop;
  410. _praiseBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  411. [_praiseBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  412. [_praiseBtn addTarget:self action:@selector(praiseBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  413. }
  414. return _praiseBtn;
  415. }
  416. - (QMUIButton *)commentBtn {
  417. if (!_commentBtn) {
  418. _commentBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  419. [_commentBtn setImage:[UIImage imageNamed:@"icon22x22"] forState:UIControlStateNormal];
  420. [_commentBtn setTitle:@"0" forState:UIControlStateNormal];
  421. _commentBtn.imagePosition = QMUIButtonImagePositionTop;
  422. _commentBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  423. [_commentBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  424. [_commentBtn addTarget:self action:@selector(commentBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  425. }
  426. return _commentBtn;
  427. }
  428. - (QMUIButton *)shareBtn {
  429. if (!_shareBtn) {
  430. _shareBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  431. [_shareBtn setImage:[UIImage imageNamed:@"icon22x22-3"] forState:UIControlStateNormal];
  432. [_shareBtn setTitle:@"0" forState:UIControlStateNormal];
  433. _shareBtn.imagePosition = QMUIButtonImagePositionTop;
  434. _shareBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  435. [_shareBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  436. [_shareBtn addTarget:self action:@selector(shareBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  437. }
  438. return _shareBtn;
  439. }
  440. //-(HMVideoItemButton *)giftBtn{
  441. // if (!_giftBtn) {
  442. // _giftBtn = [HMVideoItemButton new];
  443. // [_giftBtn setImage:[UIImage imageNamed:@"mg_video_gift"] forState:UIControlStateNormal];
  444. // _giftBtn.titleLabel.font = [UIFont systemFontOfSize:13.0f];
  445. // [_giftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  446. // [_giftBtn addTarget:self action:@selector(giftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  447. // if (kIsCheckingVersion())
  448. // {
  449. // _giftBtn.hidden = YES;
  450. // }
  451. // }
  452. // return _giftBtn;
  453. //}
  454. - (QMUIButton *)oneOnOneBtn {
  455. if (!_oneOnOneBtn) {
  456. _oneOnOneBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  457. [_oneOnOneBtn setImage:[UIImage imageNamed:@"容器 2590"] forState:UIControlStateNormal];
  458. [_oneOnOneBtn addTarget:self action:@selector(oneOnOneBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  459. }
  460. return _oneOnOneBtn;
  461. }
  462. - (UILabel *)nameLabel {
  463. if (!_nameLabel) {
  464. _nameLabel = [UILabel new];
  465. _nameLabel.textColor = [UIColor whiteColor];
  466. _nameLabel.font = [UIFont boldSystemFontOfSize:15.0f];
  467. _nameLabel.userInteractionEnabled = YES;
  468. UITapGestureRecognizer *nameTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(iconDidClick:)];
  469. [_nameLabel addGestureRecognizer:nameTap];
  470. }
  471. return _nameLabel;
  472. }
  473. - (UILabel *)contentLabel {
  474. if (!_contentLabel) {
  475. _contentLabel = [UILabel new];
  476. _contentLabel.numberOfLines = 0;
  477. _contentLabel.textColor = [UIColor whiteColor];
  478. _contentLabel.font = [UIFont systemFontOfSize:14.0f];
  479. }
  480. return _contentLabel;
  481. }
  482. - (UIActivityIndicatorView *)loadingView {
  483. if (!_loadingView) {
  484. _loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
  485. _loadingView.hidesWhenStopped = YES;
  486. }
  487. return _loadingView;
  488. }
  489. - (UIButton *)playBtn {
  490. if (!_playBtn) {
  491. _playBtn = [UIButton new];
  492. [_playBtn setImage:[UIImage imageNamed:@"me_icon_pause"] forState:UIControlStateNormal];
  493. _playBtn.userInteractionEnabled = NO;
  494. _playBtn.hidden = YES;
  495. }
  496. return _playBtn;
  497. }
  498. -(void)clickMoreBtn:(UIButton *)sender{
  499. if ([self.delegate respondsToSelector:@selector(controlViewDidClickMoreBtn:)]) {
  500. [self.delegate controlViewDidClickMoreBtn:self];
  501. }
  502. }
  503. - (UIButton *)focusBtn{
  504. if (!_focusBtn) {
  505. _focusBtn = [[UIButton alloc]initWithFrame:CGRectZero];
  506. [_focusBtn setImage:[UIImage imageNamed:@"容器 2584"] forState:UIControlStateNormal];
  507. [_focusBtn addTarget:self action:@selector(focusBtnAction) forControlEvents:UIControlEventTouchUpInside];
  508. }
  509. return _focusBtn;
  510. }
  511. - (NSMutableDictionary *)shareDict{
  512. if (!_shareDict) {
  513. _shareDict = [NSMutableDictionary dictionary];
  514. }
  515. return _shareDict;
  516. }
  517. - (BogoVideoGoodControl *)goodControl{
  518. if (!_goodControl) {
  519. // _goodControl = [kShopKitBundle loadNibNamed:@"BogoVideoGoodControl" owner:self options:nil].firstObject;
  520. _goodControl = [kShopKitBundle loadNibNamed:@"BogoVideoGoodControl" owner:nil options:nil].lastObject;
  521. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(toGoodDetailVC)];
  522. _goodControl.userInteractionEnabled = YES;
  523. [_goodControl addGestureRecognizer:tap];
  524. }
  525. return _goodControl;
  526. }
  527. - (void)toGoodDetailVC{
  528. if (self.model.model_id.integerValue == 1) {
  529. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.model.link_url]];
  530. }else{
  531. BogoGoodDetailViewController *detailVC = [[BogoGoodDetailViewController alloc]init];
  532. detailVC.gid = self.model.shop_id;
  533. [[AppDelegate sharedAppDelegate] pushViewController:detailVC animated:YES];
  534. }
  535. }
  536. @end