RQProfileUserAndVipCell.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. //
  2. // RQProfileUserAndVipCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/4/26.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQProfileUserAndVipCell.h"
  9. @interface RQProfileUserAndVipCell () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
  10. @property (nonatomic, readwrite, strong) RQProfileUserAndVipItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIView *vipContentView;
  12. @property (weak, nonatomic) IBOutlet UIImageView *myBgImageView;
  13. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *btnsViewToTop;
  14. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *headImagViewToTop;
  15. @property (weak, nonatomic) IBOutlet QMUIButton *settingBtn;
  16. @property (weak, nonatomic) IBOutlet QMUIButton *messageBtn;
  17. @property (weak, nonatomic) IBOutlet UIImageView *myHeadImageView;
  18. @property (weak, nonatomic) IBOutlet UILabel *userNameLabel;
  19. @property (weak, nonatomic) IBOutlet QMUIButton *telePhoneBtn;
  20. @property (weak, nonatomic) IBOutlet QMUIButton *carTypeBtn;
  21. @property (weak, nonatomic) IBOutlet UIImageView *detailArrowImg;
  22. @property (weak, nonatomic) IBOutlet QMUIButton *schoolNameBtn;
  23. @property (nonatomic, readwrite, assign) CGFloat btnsViewHeight;
  24. @property (nonatomic, readwrite, assign) CGFloat headImageViewHeight;
  25. @property (nonatomic, readwrite, assign) CGFloat headImageViewCornerRadiusHeight;
  26. @property (nonatomic, readwrite, assign) BOOL isScrolling;
  27. @property (nonatomic, readwrite, strong) UICollectionView *vipCollectionView;
  28. @property (nonatomic, readwrite, strong) QMUICollectionViewPagingLayout *vipCollectionViewFlowLayout;
  29. @end
  30. @implementation RQProfileUserAndVipCell
  31. #pragma mark - PublicMethods
  32. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  33. static NSString *ID = @"RQProfileUserAndVipCell";
  34. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  35. RQProfileUserAndVipCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  36. if (!cell) cell = [self rq_viewFromXib];
  37. [cell.vipContentView addSubview:cell.vipCollectionView];
  38. CAShapeLayer *maskLayer = [CAShapeLayer layer];
  39. maskLayer.fillColor = [UIColor redColor].CGColor;
  40. maskLayer.lineWidth = 1;
  41. CGFloat cellHeight = RQ_COMMON_MANAGER.APP_SWITCH? RQ_FIT_HORIZONTAL(158.f) : RQ_FIT_HORIZONTAL(328.f);
  42. CGFloat a = RQ_FIT_HORIZONTAL(22.f);
  43. CGFloat radius = (((RQ_SCREEN_WIDTH / 2.f) * (RQ_SCREEN_WIDTH / 2.f)) - (a * a)) / (2 * a);
  44. UIBezierPath* aPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(RQ_SCREEN_WIDTH / 2.f, cellHeight - radius) radius:radius startAngle:0 endAngle:M_PI * 2 clockwise:YES];
  45. maskLayer.path = aPath.CGPath;
  46. cell.vipContentView.layer.mask = maskLayer;
  47. return cell;
  48. }
  49. - (void)bindViewModel:(RQProfileUserAndVipItemViewModel *)viewModel {
  50. self.viewModel = viewModel;
  51. @weakify(self);
  52. [[RACObserve(viewModel, userModel.photo) takeUntil:self.rac_prepareForReuseSignal] subscribeNext:^(NSString *imageName) {
  53. @strongify(self);
  54. [self.myHeadImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.userModel.photo] placeholder:RQWebAvatarImagePlaceholder() options:RQWebImageOptionAutomatic completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
  55. if(image) {
  56. image = [image qmui_imageResizedInLimitedSize:CGSizeMake(RQ_FIT_HORIZONTAL(70.f), RQ_FIT_HORIZONTAL(70.f)) resizingMode:QMUIImageResizingModeScaleAspectFill];
  57. image = [image qmui_imageWithBorderColor:UIColor.whiteColor borderWidth:1 cornerRadius:RQ_FIT_HORIZONTAL(70.f) / 2.f];
  58. self.myHeadImageView.image = image;
  59. }
  60. }];
  61. }];
  62. RAC(_userNameLabel, text) = [RACObserve(viewModel, userModel.nickName) takeUntil:self.rac_prepareForReuseSignal];
  63. RAC(_telePhoneBtn, rq_titleStr) = [RACObserve(viewModel, userModel.telphone) takeUntil:self.rac_prepareForReuseSignal];
  64. RAC(_carTypeBtn, rq_titleStr) = [RACObserve(viewModel, userModel.carType) takeUntil:self.rac_prepareForReuseSignal];
  65. RAC(_schoolNameBtn, rq_titleStr) = [[RACObserve(viewModel, userModel.schoolName) map:^id _Nullable(id _Nullable value) {
  66. if (RQObjectIsNil(viewModel.userModel.schInfo)) {
  67. return RQStringIsNotEmpty(viewModel.userModel.schoolName)? viewModel.userModel.schoolName : @"未获取到驾校名称";
  68. } else {
  69. return RQStringIsNotEmpty(viewModel.userModel.schInfo.name)? viewModel.userModel.schInfo.name : (RQStringIsNotEmpty(viewModel.userModel.schoolName)? viewModel.userModel.schoolName : @"未获取到驾校名称");
  70. }
  71. }] takeUntil:self.rac_prepareForReuseSignal];
  72. }
  73. #pragma mark - SystemMethods
  74. - (void)awakeFromNib {
  75. [super awakeFromNib];
  76. [self btnsViewHeight];
  77. [self headImageViewCornerRadiusHeight];
  78. _headImagViewToTop.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT + 16.f + (RQ_FIT_HORIZONTAL(20.f) * (17.f / 15.f)) + 16.f;
  79. _btnsViewToTop.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT + 16.f;
  80. [_messageBtn setQmui_badgeInteger:14];
  81. self.myHeadImageView.layer.cornerRadius = self.headImageViewCornerRadiusHeight;
  82. CGFloat myWidth = RQ_SCREEN_WIDTH - 16 - 16 + 10;
  83. RACSignal *signal = [[RACSignal combineLatest:@[RACObserve(self.vipCollectionView, contentOffset), RACObserve(self, isScrolling)] reduce:^id (id _Nullable x, id _Nullable y) {
  84. if (!_isScrolling) {
  85. NSLog(@"%.f-----%f",self.vipCollectionView.contentOffset.x, round(self.vipCollectionView.contentOffset.x / myWidth));
  86. NSInteger a = round(self.vipCollectionView.contentOffset.x / myWidth);
  87. RQ_Profile_Module.profileSubject = a;
  88. switch (a) {
  89. case 0:
  90. self.myBgImageView.image = RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"科一科四 已开通") : RQImageNamed(@"科一科四");
  91. self.userNameLabel.textColor = RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  92. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  93. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  94. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  95. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  96. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject1Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  97. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  98. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  99. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  100. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject1Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  101. break;
  102. case 1:
  103. self.myBgImageView.image = RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"科二 已开通") : RQImageNamed(@"科二");
  104. self.userNameLabel.textColor = RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  105. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  106. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  107. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  108. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  109. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject2Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  110. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  111. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  112. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  113. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject2Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  114. break;
  115. case 2:
  116. self.myBgImageView.image = RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"科三 已开通") : RQImageNamed(@"科三");
  117. self.userNameLabel.textColor = RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  118. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  119. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  120. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  121. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  122. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject3Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  123. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  124. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  125. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  126. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject3Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  127. break;
  128. case 3:
  129. self.myBgImageView.image = RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"科一科四 已开通") : RQImageNamed(@"科一科四");
  130. self.userNameLabel.textColor = RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  131. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  132. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  133. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  134. [self.carTypeBtn setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  135. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubject4Vip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  136. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  137. [self.detailArrowImg setImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  138. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  139. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubject4Vip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  140. break;
  141. case 4:
  142. self.myBgImageView.image = RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"科四 已开通") : RQImageNamed(@"科四");
  143. self.userNameLabel.textColor = RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor;
  144. [self.telePhoneBtn setTitleColor:RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  145. [self.telePhoneBtn setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"手机-黑") : RQImageNamed(@"手机") forState:UIControlStateNormal];
  146. [self.carTypeBtn setTitleColor:RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  147. [self.carTypeBtn setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"驾照类型-黑") : RQImageNamed(@"驾照类型") forState:UIControlStateNormal];
  148. [self.schoolNameBtn setTitleColor:RQ_VIP_Module.isSubjectAllVip? RQ_MAIN_TEXT_COLOR_1 : UIColor.whiteColor forState:UIControlStateNormal];
  149. [self.schoolNameBtn setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"公司-黑") : RQImageNamed(@"公司") forState:UIControlStateNormal];
  150. [self.detailArrowImg setImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"查看详情-黑") : RQImageNamed(@"查看详情")];
  151. [self.settingBtn setBackgroundImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"设置-黑") : RQImageNamed(@"设置") forState:UIControlStateNormal];
  152. [self.messageBtn setBackgroundImage:RQ_VIP_Module.isSubjectAllVip? RQImageNamed(@"消息-黑") : RQImageNamed(@"消息") forState:UIControlStateNormal];
  153. break;
  154. default:
  155. break;
  156. }
  157. }
  158. return @"";
  159. }] takeUntil:self.rac_prepareForReuseSignal];
  160. [signal subscribeNext:^(NSArray *allArr) {
  161. }];
  162. }
  163. - (void)layoutSubviews {
  164. [super layoutSubviews];
  165. @weakify(self)
  166. [self.vipCollectionView mas_remakeConstraints:^(MASConstraintMaker *make) {
  167. @strongify(self)
  168. make.top.mas_equalTo(self.myHeadImageView.mas_bottom).mas_offset(20);
  169. make.left.right.mas_equalTo(self.vipContentView);
  170. make.bottom.mas_equalTo(self.vipContentView.mas_bottom).mas_offset(12);
  171. // make.height.mas_equalTo(RQ_FIT_HORIZONTAL(169.f));
  172. }];
  173. }
  174. #pragma mark - PrivateMethods
  175. - (IBAction)settingAction:(id)sender {
  176. [RQ_APPDELEGATE.services pushViewModel:[[RQSettingViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil] animated:YES];
  177. }
  178. #pragma mark - UICollectionViewDatasource
  179. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  180. return 1;
  181. }
  182. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  183. return 5;
  184. }
  185. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  186. switch (indexPath.row) {
  187. case 0: {
  188. RQProfileSubjectOneVipCell *cell = [RQProfileSubjectOneVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  189. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  190. itemViewModel.profileSubject = indexPath.row;
  191. [cell bindViewModel:itemViewModel];
  192. return cell;
  193. }
  194. case 1: {
  195. RQProfileSubjectTwoVipCell *cell = [RQProfileSubjectTwoVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  196. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  197. itemViewModel.profileSubject = indexPath.row;
  198. [cell bindViewModel:itemViewModel];
  199. return cell;
  200. }
  201. case 2: {
  202. RQProfileSubjectThreeVipCell *cell = [RQProfileSubjectThreeVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  203. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  204. itemViewModel.profileSubject = indexPath.row;
  205. [cell bindViewModel:itemViewModel];
  206. return cell;
  207. }
  208. case 3: {
  209. RQProfileSubjectFourVipCell *cell = [RQProfileSubjectFourVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  210. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  211. itemViewModel.profileSubject = indexPath.row;
  212. [cell bindViewModel:itemViewModel];
  213. return cell;
  214. }
  215. default: {
  216. RQProfileVipCell *cell = [RQProfileVipCell cellWithCollectionView:collectionView forIndexPath:indexPath];
  217. RQProfileVipItemViewModel *itemViewModel = [[RQProfileVipItemViewModel alloc] init];
  218. itemViewModel.profileSubject = indexPath.row;
  219. [cell bindViewModel:itemViewModel];
  220. return cell;
  221. }
  222. }
  223. }
  224. #pragma mark - UICollectionViewDelegate
  225. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  226. [collectionView deselectItemAtIndexPath:indexPath animated:YES];
  227. }
  228. #pragma mark - UICollectionViewDelegateFlowLayout
  229. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  230. CGSize size = CGSizeMake(CGRectGetWidth(self.vipCollectionView.bounds) - UIEdgeInsetsGetHorizontalValue(self.vipCollectionViewFlowLayout.sectionInset), CGRectGetHeight(self.vipCollectionView.bounds) - UIEdgeInsetsGetVerticalValue(self.vipCollectionViewFlowLayout.sectionInset));
  231. return size;
  232. }
  233. - (void)scrollViewDidScroll:(UIScrollView *)sender {
  234. self.isScrolling = YES;
  235. [NSObject cancelPreviousPerformRequestsWithTarget:self];
  236. [self performSelector:@selector(scrollViewDidEndScrollingAnimation:) withObject:sender afterDelay:0.1];
  237. }
  238. - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
  239. self.isScrolling = NO;
  240. [NSObject cancelPreviousPerformRequestsWithTarget:self];
  241. }
  242. #pragma mark - LazyLoad
  243. - (CGFloat)btnsViewHeight {
  244. if (_btnsViewHeight == 0) _btnsViewHeight = (RQ_FIT_HORIZONTAL(60.f) - 16.f) / 2.f;
  245. return _btnsViewHeight;
  246. }
  247. - (CGFloat)headImageViewHeight {
  248. if (_headImageViewHeight == 0) _headImageViewHeight = (RQ_FIT_HORIZONTAL(70.f));
  249. return _headImageViewHeight;
  250. }
  251. - (CGFloat)headImageViewCornerRadiusHeight {
  252. if (_headImageViewCornerRadiusHeight == 0) _headImageViewCornerRadiusHeight = self.headImageViewHeight / 2.f;
  253. return _headImageViewCornerRadiusHeight;
  254. }
  255. - (UICollectionView *)vipCollectionView {
  256. if (!_vipCollectionView) {
  257. _vipCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_myHeadImageView.frame) + 20, RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(169.f)) collectionViewLayout:self.vipCollectionViewFlowLayout];
  258. _vipCollectionView.delegate = self;
  259. _vipCollectionView.dataSource = self;
  260. _vipCollectionView.showsHorizontalScrollIndicator = NO;
  261. _vipCollectionView.backgroundColor = UIColorClear;
  262. [_vipCollectionView registerNib:[UINib nibWithNibName:@"RQProfileVipCell" bundle:nil] forCellWithReuseIdentifier:@"RQProfileVipCell"];
  263. }
  264. return _vipCollectionView;
  265. }
  266. - (QMUICollectionViewPagingLayout *)vipCollectionViewFlowLayout {
  267. if (!_vipCollectionViewFlowLayout) {
  268. _vipCollectionViewFlowLayout = [[QMUICollectionViewPagingLayout alloc] initWithStyle:QMUICollectionViewPagingLayoutStyleDefault];
  269. _vipCollectionViewFlowLayout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
  270. _vipCollectionViewFlowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  271. _vipCollectionViewFlowLayout.allowsMultipleItemScroll = NO;
  272. }
  273. return _vipCollectionViewFlowLayout;
  274. }
  275. @end