JXLikeListViewController.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //
  2. // JXLikeListViewController.m
  3. // shiku_im
  4. //
  5. // Created by 1 on 2018/12/19.
  6. // Copyright © 2018年 Reese. All rights reserved.
  7. //
  8. #import "JXLikeListViewController.h"
  9. #import "JXUserInfoVC.h"
  10. #import "JXCell.h"
  11. @interface JXLikeListViewController ()
  12. @property (nonatomic, strong) NSArray *data;
  13. @end
  14. @implementation JXLikeListViewController
  15. - (instancetype)init {
  16. if (self = [super init]) {
  17. self.heightHeader = JX_SCREEN_TOP;
  18. self.heightFooter = 0;
  19. self.isGotoBack = YES;
  20. [self createHeadAndFoot];
  21. }
  22. return self;
  23. }
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. self.title = [NSString stringWithFormat:@"%d%@",self.weibo.praiseCount,Localized(@"WeiboData_PerZan1")];
  27. if (self.weibo.praises.count > 20) {
  28. self.weibo.praises = [NSMutableArray arrayWithArray:[self.weibo.praises subarrayWithRange:NSMakeRange(0, 20)]];
  29. }
  30. }
  31. - (void)getServerData {
  32. [g_server listPraise:self.weibo.messageId pageIndex:_page pageSize:20 praiseId:nil toView:self];
  33. }
  34. - (void)scrollToPageDown {
  35. [super scrollToPageDown];
  36. }
  37. #pragma mark - Table view --------代理-------- data source
  38. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  39. return 1;
  40. }
  41. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  42. return self.weibo.praises.count;
  43. }
  44. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  45. return 59;
  46. }
  47. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  48. static NSString *CellIdentifier = @"JXLikeListCell";
  49. JXCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  50. if(cell==nil){
  51. cell = [[JXCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  52. }
  53. WeiboReplyData *data = self.weibo.praises[indexPath.row];
  54. cell.title = data.userNickName;
  55. cell.index = (int)indexPath.row;
  56. cell.delegate = self;
  57. // cell.didTouch = @selector(onHeadImage:);
  58. cell.timeLabel.frame = CGRectMake(JX_SCREEN_WIDTH - 120-20, 9, 115, 20);
  59. cell.userId = data.userId;
  60. [cell.lbTitle setText:cell.title];
  61. [cell headImageViewImageWithUserId:nil roomId:nil];
  62. cell.isSmall = YES;
  63. [self doAutoScroll:indexPath];
  64. return cell;
  65. }
  66. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  67. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  68. WeiboReplyData *data = self.weibo.praises[indexPath.row];
  69. JXUserInfoVC *userVC = [JXUserInfoVC alloc];
  70. userVC.userId = data.userId;
  71. userVC.fromAddType = 6;
  72. userVC = [userVC init];
  73. [g_navigation pushViewController:userVC animated:YES];
  74. }
  75. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  76. [self stopLoading];
  77. [g_wait stop];
  78. if ([aDownload.action isEqualToString:act_PraiseList]) {
  79. if (_page == 0) {
  80. [self.weibo.praises removeAllObjects];
  81. }
  82. for (int i = 0; i < array1.count; i++) {
  83. WeiboReplyData * reply=[[WeiboReplyData alloc]init];
  84. reply.type=reply_data_praise;
  85. [reply getDataFromDict:[array1 objectAtIndex:i]];
  86. [self.weibo.praises addObject:reply];
  87. }
  88. [_table reloadData];
  89. }
  90. }
  91. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  92. [g_wait stop];
  93. return show_error;
  94. }
  95. -(int) didServerConnectError:(JXConnection*)aDownload error:(NSError *)error{//error为空时,代表超时
  96. [g_wait stop];
  97. return show_error;
  98. }
  99. -(void) didServerConnectStart:(JXConnection*)aDownload{
  100. [g_wait start:nil];
  101. }
  102. @end