YOUPAIZYUserZiLiaoVC.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. //
  2. // YOUPAIZYUserZiLiaoVC.m
  3. // VQU
  4. //
  5. // Created by 肖浩然的mac on 2021/7/10.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAIZYUserZiLiaoVC.h"
  9. #import "YOUPAILCGuardModel.h"
  10. #import "YOUPAILCUserShowModel.h"
  11. #import "YOUPAIZYUserZiLiaoDTCell.h"
  12. #import "YOUPAIZYUserZiLiaoPJCell.h"
  13. #import "YOUPAIZYUserZiLiaoBHCell.h"
  14. #import "YOUPAIZYUserZiLiaoSHCell.h"
  15. #import "YOUPAIZYUserZiLiaoLWCell.h"
  16. #import "YOUPAIZYSearchVC.h"
  17. #import "YOUPAIZYUserDynamicVC.h"
  18. #import "YOUPAILPGuardBordeVC.h"
  19. #import "YOUPAIZYAsylumListVC.h"
  20. #import "YOUPAILCReceiveGiftVC.h"
  21. #import "YOUPAIZYUserZiLiaoBHNoDataCell.h"
  22. #import "YOUPAIZYUserZiLiaoSHNoDataCell.h"
  23. #import "YOUPAIZYBiHuVC.h"
  24. #import "YOUPAILPGuardHerVC.h"
  25. #import "UIViewController+TFPresent.h"
  26. #import "YOUPAIZYUserZiLiaoXZCell.h"
  27. #import "YOUPAILCDynamicArrayModel.h"
  28. #import "YOUPAIZYUserZiLiaoGRTopCell.h"
  29. #import "YOUPAIZYUserZiLiaoGRXXCell.h"
  30. typedef enum : NSUInteger {
  31. ZYUserZiLiaoCellType_SY,//声音和个性
  32. ZYUserZiLiaoCellType_MS,//信息详情
  33. ZYUserZiLiaoCellType_XZ,//勋章
  34. ZYUserZiLiaoCellType_DT,//动态
  35. ZYUserZiLiaoCellType_PJ,//评价
  36. ZYUserZiLiaoCellType_BH,//庇护
  37. ZYUserZiLiaoCellType_SH,//守护
  38. ZYUserZiLiaoCellType_LW//礼物
  39. } ZYUserZiLiaoCellType;
  40. @interface ZYUserZiLiaoModel : NSObject
  41. // 类型
  42. @property (nonatomic, assign) ZYUserZiLiaoCellType youpaiptype;
  43. // cell高
  44. @property (nonatomic, assign) CGFloat youpaipcellHeight;
  45. //是否展示更多(标签)
  46. @property (assign, nonatomic) BOOL youpaipisOpen;
  47. @end
  48. @implementation ZYUserZiLiaoModel
  49. @end
  50. @interface YOUPAIZYUserZiLiaoVC ()<UICollectionViewDelegate,UICollectionViewDataSource,ZYLabelViewDelegate,ZYDidCellOrBtnDelegate,ZYDidBHCellOrBtnDelegate,ZYDidSHCellOrBtnDelegate,ZYDidLWCellOrBtnDelegate,ZYBiHuDelegate,LPGuardHerDelegate>
  51. @property (strong, nonatomic) UICollectionView *youpaipcollectionView;
  52. @property(nonatomic,strong)NSMutableArray* youpaipalbumArray;//顶部相册
  53. @property(nonatomic,strong)NSMutableArray* youpaipdynamicArray;//动态
  54. @property(nonatomic,strong)NSMutableArray* youpaipgiftArray;//礼物
  55. @property(nonatomic,assign)UIStatusBarStyle youpaipbarStatus;
  56. @property(nonatomic,strong)YOUPAILCGuardModel *youpaipguardInfo;
  57. @property(nonatomic,strong)NSMutableArray *youpaipguardImageArray;//守护
  58. @property(nonatomic,strong)NSMutableArray *youpaipasylumImageArray;//庇护
  59. @property(nonatomic,strong)NSMutableArray *youpaiplabel_list;//标签
  60. @property(nonatomic,strong)NSMutableArray *youpaipbadge_all;//勋章
  61. @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
  62. /* cell的数组 */
  63. @property (strong, nonatomic) NSMutableArray *youpaipcellDataArr;
  64. @property(nonatomic,strong)YOUPAILCUserShowModel* youpaipshowModel;
  65. /* 返回便签的高度 */
  66. @property (assign, nonatomic) CGFloat youpaippjHeight;
  67. @property (assign, nonatomic) BOOL youpaipisOpen;
  68. @property (strong, nonatomic) NSMutableArray *youpaipbasic_info;
  69. @end
  70. @implementation YOUPAIZYUserZiLiaoVC
  71. - (void)viewDidLoad {
  72. [super viewDidLoad];
  73. self.youpaipalbumArray = [NSMutableArray array];
  74. self.youpaipbasic_info = [NSMutableArray array];
  75. self.youpaipdynamicArray = [NSMutableArray array];
  76. self.youpaipgiftArray = [NSMutableArray array];
  77. self.youpaipguardImageArray = [NSMutableArray array];
  78. self.youpaipasylumImageArray = [NSMutableArray array];
  79. self.youpaiplabel_list = [NSMutableArray array];
  80. self.youpaipcellDataArr = [NSMutableArray array];
  81. self.youpaipbadge_all = [NSMutableArray array];
  82. [self youpaipcollectionView];
  83. [self youpaifinitData];
  84. }
  85. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  86. ZYUserZiLiaoModel *model = self.youpaipcellDataArr[indexPath.section];
  87. return CGSizeMake(KScreenWidth, model.youpaipcellHeight);
  88. }
  89. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
  90. return self.youpaipcellDataArr.count;
  91. }
  92. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
  93. return 1;
  94. }
  95. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
  96. YOUPAIZYLabelModel *model = self.youpaipcellDataArr[indexPath.section];
  97. switch (model.youpaiptype) {
  98. case ZYUserZiLiaoCellType_DT:
  99. {
  100. YOUPAIZYUserZiLiaoDTCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoDTCell class]) forIndexPath:indexPath];
  101. cell.youpaipdelegate = self;
  102. cell.youpaipalbumArray = self.youpaipdynamicArray;
  103. cell.backgroundColor = LCWhiteColor;
  104. cell.youpaiptitleLabel.attributedText = [LCTools setRichTextWithTitle:@"最新动态" subTitle:[NSString stringWithFormat:@"(%ld)",self.youpaipshowModel.youpaipdynamic_num] titleColor:HexColorFromRGB(0x363D50) subTitleColor:HexColorFromRGB(0xA3AABE) titleFontSize:14 subTitleFontSize:10 IsfirstFontBlod:YES];
  105. return cell;
  106. }
  107. break;
  108. case ZYUserZiLiaoCellType_SY:
  109. {
  110. YOUPAIZYUserZiLiaoGRTopCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoGRTopCell class]) forIndexPath:indexPath];
  111. cell.backgroundColor = LCWhiteColor;
  112. cell.youpaiptitleLabel.text = @"个人信息";
  113. cell.youpaipmodel = self.youpaipshowModel;
  114. return cell;
  115. }
  116. break;
  117. case ZYUserZiLiaoCellType_MS://个人信息详情item
  118. {
  119. YOUPAIZYUserZiLiaoGRXXCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoGRXXCell class]) forIndexPath:indexPath];
  120. cell.backgroundColor = LCWhiteColor;
  121. cell.youpaipaArr = self.youpaipbasic_info;
  122. return cell;
  123. }
  124. break;
  125. case ZYUserZiLiaoCellType_PJ:
  126. {
  127. YOUPAIZYUserZiLiaoPJCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoPJCell class]) forIndexPath:indexPath];
  128. cell.youpaiplabelArray = self.youpaiplabel_list;
  129. cell.backgroundColor = LCWhiteColor;
  130. cell.youpaiptitleLabel.text = @"标签";
  131. cell.youpaipmodel = self.youpaipshowModel;
  132. cell.youpaipdelegate = self;
  133. return cell;
  134. }
  135. break;
  136. case ZYUserZiLiaoCellType_XZ:
  137. {
  138. YOUPAIZYUserZiLiaoXZCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoXZCell class]) forIndexPath:indexPath];
  139. cell.youpaipdataArr = self.youpaipbadge_all;
  140. cell.backgroundColor = LCWhiteColor;
  141. cell.youpaiptitleLabel.text = @"勋章墙";
  142. // cell.delegate = self;
  143. return cell;
  144. }
  145. break;
  146. case ZYUserZiLiaoCellType_BH:
  147. {
  148. if (self.youpaipasylumImageArray.count>0) {
  149. YOUPAIZYUserZiLiaoBHCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoBHCell class]) forIndexPath:indexPath];
  150. cell.youpaipdelegate = self;
  151. cell.youpaipdataArr = self.youpaipasylumImageArray;
  152. cell.backgroundColor = LCWhiteColor;
  153. return cell;
  154. }else{
  155. YOUPAIZYUserZiLiaoBHNoDataCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoBHNoDataCell class]) forIndexPath:indexPath];
  156. // cell.delegate = self;
  157. cell.youpaipuserId = self.youpaipshowModel.youpaipuserid;
  158. cell.youpaipdataArr = self.youpaipasylumImageArray;
  159. cell.backgroundColor = LCWhiteColor;
  160. __weak __typeof(self)wself = self;
  161. [cell setYoupaipdidClickBH:^{
  162. [wself youpaifsetSelectBiHu];
  163. }];
  164. return cell;
  165. }
  166. }
  167. break;
  168. case ZYUserZiLiaoCellType_SH:
  169. {
  170. if (self.youpaipguardImageArray.count>0) {
  171. YOUPAIZYUserZiLiaoSHCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoSHCell class]) forIndexPath:indexPath];
  172. cell.youpaipdelegate = self;
  173. cell.youpaipdataArr = self.youpaipguardImageArray;
  174. cell.backgroundColor = LCWhiteColor;
  175. return cell;
  176. }else{
  177. YOUPAIZYUserZiLiaoSHNoDataCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoSHNoDataCell class]) forIndexPath:indexPath];
  178. cell.youpaipuserId = self.youpaipshowModel.youpaipuserid;
  179. // cell.delegate = self;
  180. cell.youpaipdataArr = self.youpaipguardImageArray;
  181. cell.backgroundColor = LCWhiteColor;
  182. __weak __typeof(self)wself = self;
  183. return cell;
  184. }
  185. }
  186. break;
  187. case ZYUserZiLiaoCellType_LW:
  188. {
  189. YOUPAIZYUserZiLiaoLWCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoLWCell class]) forIndexPath:indexPath];
  190. cell.youpaipdelegate = self;
  191. cell.youpaipdataArr = self.youpaipgiftArray;
  192. cell.backgroundColor = LCWhiteColor;
  193. cell.youpaiptitleLabel.attributedText = [LCTools setRichTextWithTitle:@"收到礼物" subTitle:[NSString stringWithFormat:@"(%ld)",self.youpaipshowModel.youpaipgift_list.count] titleColor:HexColorFromRGB(0x363D50) subTitleColor:HexColorFromRGB(0xA3AABE) titleFontSize:14 subTitleFontSize:10 IsfirstFontBlod:YES];
  194. return cell;
  195. }
  196. break;
  197. default:
  198. break;
  199. }
  200. return nil;
  201. }
  202. -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  203. YOUPAIZYLabelModel *model = self.youpaipcellDataArr[indexPath.section];
  204. switch (model.youpaiptype) {
  205. case ZYUserZiLiaoCellType_DT:
  206. {
  207. YOUPAIZYUserDynamicVC *vc = [YOUPAIZYUserDynamicVC new];
  208. vc.youpaipuserId = self.youpaipuserId;
  209. [self.navigationController pushViewController:vc animated:YES];
  210. }
  211. break;
  212. case ZYUserZiLiaoCellType_PJ:
  213. {
  214. }
  215. break;
  216. case ZYUserZiLiaoCellType_BH:
  217. {
  218. YOUPAIZYAsylumListVC* VC = [[YOUPAIZYAsylumListVC alloc]init];
  219. VC.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  220. [self.navigationController pushViewController:VC animated:YES];
  221. }
  222. break;
  223. case ZYUserZiLiaoCellType_SH:
  224. {
  225. YOUPAILPGuardBordeVC* userDynamic = [[YOUPAILPGuardBordeVC alloc]init];
  226. userDynamic.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  227. [self.navigationController pushViewController:userDynamic animated:YES];
  228. }
  229. break;
  230. case ZYUserZiLiaoCellType_LW:
  231. {
  232. YOUPAILCReceiveGiftVC* receiveGift = [[YOUPAILCReceiveGiftVC alloc]init];
  233. receiveGift.youpaipuserId = self.youpaipshowModel.youpaipuserid;
  234. [self.navigationController pushViewController:receiveGift animated:YES];
  235. }
  236. break;
  237. default:
  238. break;
  239. }
  240. }
  241. #pragma mark-ZYDelegate
  242. //动态
  243. - (void)youpaifDTDidCellOrBtnclick{
  244. YOUPAIZYUserDynamicVC *vc = [YOUPAIZYUserDynamicVC new];
  245. vc.youpaipuserId = self.youpaipuserId;
  246. [self.navigationController pushViewController:vc animated:YES];
  247. }
  248. //庇护
  249. - (void)youpaifBHDidCellOrBtnclick:(BOOL)isBiHu{
  250. if (isBiHu) {
  251. [self youpaifsetSelectBiHu];
  252. }else{
  253. YOUPAIZYAsylumListVC* VC = [[YOUPAIZYAsylumListVC alloc]init];
  254. VC.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  255. [self.navigationController pushViewController:VC animated:YES];
  256. }
  257. }
  258. -(void)youpaifsetSelectBiHu{
  259. YOUPAIZYBiHuVC *VC= [[YOUPAIZYBiHuVC alloc]init];
  260. VC.youpaipdelegate = self;
  261. VC.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  262. VC.vWidth = KScreenWidth *(320.0/375.0);
  263. VC.vHeight = (VC.vWidth*165)/320.0+195;
  264. VC.isTouchDismiss = YES;
  265. [self TFPresentVC:VC completion:^{
  266. }];
  267. }
  268. -(void)youpaifsetSelectShouHu{
  269. YOUPAILPGuardHerVC *VC= [[YOUPAILPGuardHerVC alloc]init];
  270. VC.youpaipdelegate = self;
  271. VC.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  272. VC.vWidth = KScreenWidth-54;
  273. VC.vHeight = ((KScreenWidth-54)*165)/321.0+261.5;
  274. VC.youpaipinfoModel = self.youpaipguardInfo;
  275. VC.isTouchDismiss = YES;
  276. if(VC.youpaipinfoModel!=nil)
  277. [self TFPresentVC:VC completion:^{
  278. }];
  279. }
  280. //守护
  281. - (void)youpaifSHDidCellOrBtnclick:(BOOL)isShouHu{
  282. if (isShouHu) {
  283. [self youpaifsetSelectShouHu];
  284. }else{
  285. YOUPAILPGuardBordeVC* userDynamic = [[YOUPAILPGuardBordeVC alloc]init];
  286. userDynamic.youpaipuser_id = self.youpaipshowModel.youpaipuserid;
  287. [self.navigationController pushViewController:userDynamic animated:YES];
  288. }
  289. }
  290. -(void)youpaifaddBiHuSuccess{
  291. }
  292. //守护成功
  293. -(void)youpaifaddGuardSuccess
  294. {
  295. [LCHttpHelper requestWithURLString:UserShowPage parameters:@{@"user_id":self.youpaipuserId,@"no_visitor":@"1"} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  296. NSDictionary* dict = (NSDictionary*)responseObject;
  297. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  298. if (code==0) {//成功
  299. self.youpaipshowModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
  300. self.youpaipguardInfo = self.youpaipshowModel.youpaipguard;
  301. //守护数组
  302. if(self.youpaipguardInfo!=nil)
  303. {
  304. [self.youpaipguardImageArray removeAllObjects];
  305. for(NSString *urlStr in self.youpaipguardInfo.youpaiplist)
  306. {
  307. [self.youpaipguardImageArray addObject:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,urlStr]];
  308. }
  309. }
  310. // [self.headView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
  311. // [self setupInfoView];
  312. //守护成功以后 刷新介绍页面
  313. }
  314. } failure:^(NSError *error) {
  315. }];
  316. }
  317. ////礼物
  318. //- (void)youpaifLWDidCellOrBtnclick{
  319. //
  320. // YOUPAILCReceiveGiftVC* receiveGift = [[YOUPAILCReceiveGiftVC alloc]init];
  321. // receiveGift.youpaipuserId = self.youpaipshowModel.youpaipinfo.youpaipuserid;
  322. // [self.navigationController pushViewController:receiveGift animated:YES];
  323. //}
  324. -(void)youpaifclickLabel:(YOUPAIZYLabelModel *)labelModel{
  325. // YOUPAIZYSearchVC* seach = [[YOUPAIZYSearchVC alloc]init];
  326. // seach.isLabelSearch = YES;
  327. // seach.isSearch = YES;
  328. // seach.label_id = labelModel.tag_id;
  329. // seach.label_name = labelModel.name;
  330. // [self pushEffectPresentToVC:seach];
  331. }
  332. -(void)youpaifupdateShowCells{
  333. @synchronized (self) {
  334. [self.youpaipcellDataArr removeAllObjects];
  335. if (self.youpaipdynamicArray.count) {//动态
  336. ZYUserZiLiaoModel *model = [ZYUserZiLiaoModel new];
  337. model.youpaiptype = ZYUserZiLiaoCellType_DT;
  338. model.youpaipcellHeight = 92+17+9;
  339. [self.youpaipcellDataArr addObject:model];
  340. }
  341. NSString *content = self.youpaipshowModel.youpaipsign;
  342. CGFloat height = [content boundingRectWithSize:CGSizeMake(KScreenWidth - 28.0f, MAXFLOAT)
  343. options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
  344. attributes:@{ NSFontAttributeName : LCFont12 } context:nil].size.height;
  345. height+=26;
  346. CGFloat voiceHeight = 0;
  347. if (self.youpaipshowModel.youpaipvoice.youpaipvoice_status == 1){
  348. voiceHeight = 61;
  349. }
  350. //声音展示和个性签名
  351. ZYUserZiLiaoModel *symodel = [ZYUserZiLiaoModel new];
  352. symodel.youpaiptype = ZYUserZiLiaoCellType_SY;
  353. symodel.youpaipcellHeight = height+9+17+voiceHeight+10;
  354. [self.youpaipcellDataArr addObject:symodel];
  355. //个人信息item
  356. NSInteger rowCount = (self.youpaipbasic_info.count/3);
  357. if ((self.youpaipbasic_info.count%3)!=0) {
  358. rowCount+=1;
  359. }
  360. ZYUserZiLiaoModel *msmodel = [ZYUserZiLiaoModel new];
  361. msmodel.youpaiptype = ZYUserZiLiaoCellType_MS;
  362. msmodel.youpaipcellHeight = rowCount*49+rowCount*9+20;;
  363. [self.youpaipcellDataArr addObject:msmodel];
  364. if (self.youpaiplabel_list.count) {//评价
  365. ZYUserZiLiaoModel *model = [ZYUserZiLiaoModel new];
  366. model.youpaiptype = ZYUserZiLiaoCellType_PJ;
  367. if (self.youpaipshowModel.youpaiplabel_list.count>5) {
  368. model.youpaipcellHeight= 49+9+20+30;
  369. }else{
  370. model.youpaipcellHeight= 24.5+20+30;
  371. }
  372. [self.youpaipcellDataArr addObject:model];
  373. }
  374. // if (self.asylumImageArray.count) {//庇护
  375. // ZYUserZiLiaoModel *model = [ZYUserZiLiaoModel new];
  376. // model.youpaiptype = ZYUserZiLiaoCellType_BH;
  377. // model.youpaipcellHeight = 43+72;
  378. // [self.youpaipcellDataArr addObject:model];
  379. // }
  380. // if (self.guardImageArray.count) {//守护
  381. // ZYUserZiLiaoModel *guardModel = [ZYUserZiLiaoModel new];
  382. // guardModel.youpaiptype = ZYUserZiLiaoCellType_SH;
  383. // guardModel.youpaipcellHeight = 43+72;
  384. // [self.youpaipcellDataArr addObject:guardModel];
  385. // }
  386. if (self.youpaipgiftArray.count) {//礼物
  387. ZYUserZiLiaoModel *model = [ZYUserZiLiaoModel new];
  388. model.youpaiptype = ZYUserZiLiaoCellType_LW;
  389. model.youpaipcellHeight = 95+9+17+30;
  390. [self.youpaipcellDataArr addObject:model];
  391. }
  392. // if (self.badge_all.count) {//勋章
  393. // if (self.showModel.is_user == 1) {
  394. // ZYUserZiLiaoModel *model = [ZYUserZiLiaoModel new];
  395. // model.type = ZYUserZiLiaoCellType_XZ;
  396. // model.cellHeight = 43+52;
  397. //
  398. // [self.cellDataArr addObject:model];
  399. //
  400. // }else{
  401. // ZYUserZiLiaoModel *model = [ZYUserZiLiaoModel new];
  402. // model.type = ZYUserZiLiaoCellType_XZ;
  403. // model.cellHeight = 43+52;
  404. //
  405. // [self.cellDataArr addObject:model];
  406. // }
  407. //
  408. // }
  409. [self.youpaipcollectionView reloadData];
  410. }
  411. }
  412. //懒加载tableView
  413. - (UICollectionView *)youpaipcollectionView{
  414. if (_youpaipcollectionView == nil) {
  415. _youpaipcollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:[[UICollectionViewFlowLayout alloc]init]];
  416. _youpaipcollectionView.backgroundColor = LCWhiteColor;
  417. _youpaipcollectionView.delegate = self;
  418. _youpaipcollectionView.dataSource = self;
  419. [self.view addSubview:_youpaipcollectionView ];
  420. [_youpaipcollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
  421. make.left.mas_equalTo(0);
  422. make.right.mas_equalTo(0);
  423. make.top.mas_equalTo(0);
  424. make.bottom.mas_equalTo(0);
  425. }];
  426. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoDTCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoDTCell class])];
  427. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoPJCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoPJCell class])];
  428. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoBHCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoBHCell class])];
  429. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoSHCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoSHCell class])];
  430. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoLWCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoLWCell class])];
  431. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoBHNoDataCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoBHNoDataCell class])];
  432. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoSHNoDataCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoSHNoDataCell class])];
  433. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoXZCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoXZCell class])];
  434. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoGRTopCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoGRTopCell class])];
  435. [_youpaipcollectionView registerClass:[YOUPAIZYUserZiLiaoGRXXCell class] forCellWithReuseIdentifier:NSStringFromClass([YOUPAIZYUserZiLiaoGRXXCell class])];
  436. }
  437. return _youpaipcollectionView;
  438. }
  439. - (void)youpaifinitData{
  440. NSLog(@"%@",self.youpaipuserId);
  441. [LCHttpHelper requestWithURLString:GetUserInfo parameters:@{@"user_id":self.youpaipuserId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  442. NSDictionary* dict = (NSDictionary*)responseObject;
  443. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  444. if (code==0) {//成功
  445. self.youpaipshowModel = [YOUPAILCUserShowModel mj_objectWithKeyValues:[dict objectForKey:@"data"]];
  446. self.youpaipguardInfo = self.youpaipshowModel.youpaipguard;
  447. //守护数组
  448. if(self.youpaipguardInfo!=nil)
  449. for(NSString *urlStr in self.youpaipguardInfo.youpaiplist)
  450. {
  451. [self.youpaipguardImageArray addObject:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,urlStr]];
  452. }
  453. for (YOUPAIBasicInfo *model in self.youpaipshowModel.youpaibasic_info) {
  454. [self.youpaipbasic_info addObject:model];
  455. }
  456. for (YOUPAIAlbumModel *model in self.youpaipshowModel.youpaipalbum) {
  457. [self.youpaipalbumArray addObject:model];
  458. }
  459. for (YOUPAILCDynamicArrayModel* model in self.youpaipshowModel.youpaipdynamic) {
  460. [self.youpaipdynamicArray addObject:model];
  461. }
  462. for (YOUPAILCGiftModel* giftModel in self.youpaipshowModel.youpaipgift_list) {
  463. [self.youpaipgiftArray addObject:giftModel];
  464. }
  465. for (YOUPAILZVipCarModel* badgeModel in self.youpaipshowModel.youpaipbadge_all) {
  466. [self.youpaipbadge_all addObject:badgeModel];
  467. }
  468. for (YOUPAIZYLabelModel* labelModel in self.youpaipshowModel.youpaiplabel_list) {
  469. [self.youpaiplabel_list addObject:labelModel];
  470. }
  471. for (YOUPAIZYAsylumModel* asylumModel in self.youpaipshowModel.youpaipasylum_list) {
  472. [self.youpaipasylumImageArray addObject:[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,asylumModel.youpaipavatar]];
  473. NSLog(@"%@",[NSString stringWithFormat:@"%@/%@",[LCSaveData getImageUrl]?[LCSaveData getImageUrl]:BaseImgUrl,asylumModel.youpaipavatar]);
  474. }
  475. [self youpaifupdateShowCells];
  476. }
  477. } failure:^(NSError *error) {
  478. }];
  479. }
  480. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  481. !self.scrollCallback ?: self.scrollCallback(scrollView);
  482. }
  483. #pragma mark - JXPagingViewListViewDelegate
  484. - (UIView *)listView{
  485. return self.view;
  486. }
  487. - (UIScrollView *)listScrollView{
  488. return self.youpaipcollectionView;
  489. }
  490. - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
  491. self.scrollCallback = callback;
  492. }
  493. @end