JXReportUserVC.m 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. //
  2. // JXReportUserVC.m
  3. // shiku_im
  4. //
  5. // Created by 1 on 17/6/26.
  6. // Copyright © 2017年 Reese. All rights reserved.
  7. //
  8. #import "JXReportUserVC.h"
  9. @interface JXReportUserVC ()<UITextViewDelegate, UIAlertViewDelegate>
  10. @property (nonatomic,strong) UITextView * reasonView;
  11. @property (nonatomic,strong) UILabel * placeLabel;
  12. @property (nonatomic, strong) NSArray *array;
  13. @property (nonatomic, strong) NSDictionary *currentReason;
  14. @end
  15. @implementation JXReportUserVC
  16. -(instancetype)init{
  17. self = [super init];
  18. if (self) {
  19. self.heightHeader = JX_SCREEN_TOP;
  20. self.heightFooter = 0;
  21. self.isGotoBack = YES;
  22. self.title = Localized(@"JXUserInfoVC_Report");
  23. self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
  24. }
  25. return self;
  26. }
  27. - (void)viewDidLoad {
  28. [super viewDidLoad];
  29. [self createHeadAndFoot];
  30. self.isShowHeaderPull = NO;
  31. self.isShowFooterPull = NO;
  32. if ([self.user.roomFlag intValue] > 0 || self.user.roomId.length > 0) {
  33. _array = @[
  34. @{@"reasonId":@200, @"reasonStr":Localized(@"JX_HaveGamblingBehavior")},
  35. @{@"reasonId":@210, @"reasonStr":Localized(@"JX_CheatedMoney")},
  36. @{@"reasonId":@220, @"reasonStr":Localized(@"JX_Harassment")},
  37. @{@"reasonId":@230, @"reasonStr":Localized(@"JX_SpreadRumors")}
  38. ];
  39. }
  40. else if (self.isUrl) {
  41. _array = @[
  42. @{@"reasonId":@300, @"reasonStr":Localized(@"JX_WebPagesContainFraudulentInformation")},
  43. @{@"reasonId":@301, @"reasonStr":Localized(@"JX_WebPagesContainPornographicInformation")},
  44. @{@"reasonId":@302, @"reasonStr":Localized(@"JX_WebPagesContainViolentTerrorInformation")},
  45. @{@"reasonId":@303, @"reasonStr":Localized(@"JX_WebPagesContainPoliticallySensitiveInformation")},
  46. @{@"reasonId":@304, @"reasonStr":Localized(@"JX_WebPagesAreIncludedInCollectingPersonalPrivacyInformation")},
  47. @{@"reasonId":@305, @"reasonStr":Localized(@"JX_WebPagesContainContentThatInducesSharing/attention")},
  48. @{@"reasonId":@306, @"reasonStr":Localized(@"JX_WebPagesMayContainRumorInformation")},
  49. @{@"reasonId":@307, @"reasonStr":Localized(@"JX_PageContainsGamblingInformation")},
  50. ];
  51. }
  52. else {
  53. _array = @[
  54. @{@"reasonId":@100, @"reasonStr":Localized(@"JX_InappropriateContent")},
  55. @{@"reasonId":@101, @"reasonStr":Localized(@"JX_Pornography")},
  56. @{@"reasonId":@102, @"reasonStr":Localized(@"JX_Posting_illegal")},
  57. @{@"reasonId":@103, @"reasonStr":Localized(@"JX_Gambling")},
  58. @{@"reasonId":@104, @"reasonStr":Localized(@"JX_PoliticalRumors")},
  59. @{@"reasonId":@105, @"reasonStr":Localized(@"JX_Nuisance")},
  60. @{@"reasonId":@106, @"reasonStr":Localized(@"JX_Other_illegal_content")},
  61. @{@"reasonId":@120, @"reasonStr":Localized(@"JX_FraudToCheatMoney")},
  62. @{@"reasonId":@130, @"reasonStr":Localized(@"JX_HaveBeenStolen")},
  63. @{@"reasonId":@140, @"reasonStr":Localized(@"JX_Infringement")},
  64. @{@"reasonId":@150, @"reasonStr":Localized(@"JX_ReleaseCounterfeitInformation")},
  65. ];
  66. }
  67. }
  68. #pragma mark ---------tableView协议----------------
  69. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  70. {
  71. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reportCell"];
  72. if (!cell) {
  73. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"reportCell"];
  74. UIImageView* iv;
  75. iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-15-7, (50-13)/2, 7, 13)];
  76. iv.image = [UIImage imageNamed:@"new_icon_>"];
  77. [cell.contentView addSubview:iv];
  78. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(15, 49.5, JX_SCREEN_WIDTH, LINE_WH)];
  79. line.backgroundColor = THE_LINE_COLOR;
  80. [cell.contentView addSubview:line];
  81. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 25-8, JX_SCREEN_WIDTH-15, 16)];
  82. label.tag = 100;
  83. label.font = SYSFONT(16);
  84. label.textColor = HEXCOLOR(0x333333);
  85. [cell.contentView addSubview:label];
  86. }
  87. UILabel *titleLabel = (UILabel*)[cell.contentView viewWithTag:100];
  88. NSDictionary *dict = _array[indexPath.row];
  89. titleLabel.text = dict[@"reasonStr"];
  90. return cell;
  91. }
  92. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  93. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  94. NSDictionary *dict = _array[indexPath.row];
  95. _currentReason = dict;
  96. [g_App showAlert:Localized(@"JX_ConfirmReportInformation") delegate:self tag:2457 onlyConfirm:NO];
  97. }
  98. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  99. {
  100. return 1;
  101. }
  102. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  103. {
  104. return _array.count;
  105. }
  106. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  107. {
  108. return 50;
  109. }
  110. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  111. if (buttonIndex == 1) {
  112. if (_delegate && [_delegate respondsToSelector:@selector(report:reasonId:)]) {
  113. [_delegate report:_user reasonId:_currentReason[@"reasonId"]];
  114. if (self.isUrl) {
  115. [self.view removeFromSuperview];
  116. }else {
  117. [self actionQuit];
  118. }
  119. }
  120. }
  121. }
  122. //-(void)report{
  123. // if (_reasonView.text.length <= 0) {
  124. // [g_App showAlert:Localized(@"JX_ContentEmpty")];
  125. // return;
  126. // }
  127. // if (_delegate && [_delegate respondsToSelector:@selector(report:text:)]) {
  128. // [_delegate report:_user text:_reasonView.text];
  129. // [self actionQuit];
  130. // }
  131. //}
  132. - (void)didReceiveMemoryWarning {
  133. [super didReceiveMemoryWarning];
  134. // Dispose of any resources that can be recreated.
  135. }
  136. - (void)textViewDidChange:(UITextView *)textView{
  137. _placeLabel.hidden = YES;
  138. }
  139. @end