YMReportViewController.m 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. //
  2. // YMReportViewController.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/5.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMReportViewController.h"
  9. #import "YMReportViewModel.h"
  10. #import "YMReportReasonView.h"
  11. #import "YMReportEvidenceView.h"
  12. #import "YMReportRemarkView.h"
  13. @interface YMReportViewController ()
  14. /// 举报VM
  15. @property (nonatomic, strong) YMReportViewModel *viewModel;
  16. /// 容器滚动视图
  17. @property (nonatomic, strong) UIScrollView *contentScrollView;
  18. /// 容器视图
  19. @property (nonatomic, strong) UIView *contentView;
  20. /// 举报原因视图
  21. @property (nonatomic, strong) YMReportReasonView *reportReasonView;
  22. /// 举报证据视图
  23. @property (nonatomic, strong) YMReportEvidenceView *reportEvidenceView;
  24. /// 举报备注视图
  25. @property (nonatomic, strong) YMReportRemarkView *reportRemarkView;
  26. /// 提交按钮
  27. @property (nonatomic, strong) UIButton *submitBtn;
  28. @end
  29. @implementation YMReportViewController
  30. @dynamic viewModel;
  31. - (void)viewDidLoad {
  32. [super viewDidLoad];
  33. }
  34. - (void)ym_setupViews{
  35. [self.view addSubview:self.contentScrollView];
  36. [self.contentScrollView addSubview:self.contentView];
  37. [self.contentView addSubview:self.reportReasonView];
  38. [self.contentView addSubview:self.reportEvidenceView];
  39. [self.contentView addSubview:self.reportRemarkView];
  40. [self.contentView addSubview:self.submitBtn];
  41. [self.view setNeedsUpdateConstraints];
  42. [self.view updateConstraintsIfNeeded];
  43. }
  44. - (void)updateViewConstraints{
  45. [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.top.equalTo(self.view).offset(kYMNavHeight);
  47. make.left.equalTo(self.view);
  48. make.right.equalTo(self.view);
  49. make.bottom.equalTo(self.view);
  50. }];
  51. [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.edges.equalTo(self.contentScrollView);
  53. make.width.equalTo(self.contentScrollView.mas_width);
  54. }];
  55. [self.reportReasonView mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.top.equalTo(self.contentView);
  57. make.left.equalTo(self.contentView);
  58. make.right.equalTo(self.contentView);
  59. }];
  60. [self.reportEvidenceView mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.top.equalTo(self.reportReasonView.mas_bottom);
  62. make.left.equalTo(self.contentView);
  63. make.right.equalTo(self.contentView);
  64. }];
  65. [self.reportRemarkView mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.top.equalTo(self.reportEvidenceView.mas_bottom);
  67. make.left.equalTo(self.contentView);
  68. make.right.equalTo(self.contentView);
  69. }];
  70. [self.submitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.top.equalTo(self.reportRemarkView.mas_bottom).offset(adapt(10));
  72. make.left.equalTo(self.contentView).offset(adapt(20));
  73. make.right.equalTo(self.contentView).offset(adapt(-20));
  74. make.bottom.equalTo(self.contentView).offset(Is_iPhoneX ? adapt(-32) : adapt(-12));
  75. make.height.mas_equalTo(adapt(50));
  76. }];
  77. [super updateViewConstraints];
  78. }
  79. - (void)ym_bindViewModel{
  80. [self.reportReasonView ym_bindViewModel:self.viewModel];
  81. [self.reportEvidenceView ym_bindViewModel:self.viewModel];
  82. [self.viewModel getReportReasonListData];
  83. }
  84. - (UIScrollView *)contentScrollView{
  85. if (!_contentScrollView) {
  86. _contentScrollView = [[UIScrollView alloc]init];
  87. _contentScrollView.alwaysBounceVertical = YES;
  88. _contentScrollView.showsVerticalScrollIndicator = NO;
  89. _contentScrollView.showsHorizontalScrollIndicator = NO;
  90. _contentScrollView.backgroundColor = HexColorFromRGB(0xFFFFFF);
  91. _contentScrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
  92. }
  93. return _contentScrollView;
  94. }
  95. - (UIView *)contentView{
  96. if (!_contentView) {
  97. _contentView = [[UIView alloc]init];
  98. }
  99. return _contentView;
  100. }
  101. - (YMReportReasonView *)reportReasonView{
  102. if (!_reportReasonView) {
  103. _reportReasonView = [[YMReportReasonView alloc]init];
  104. }
  105. return _reportReasonView;
  106. }
  107. - (YMReportEvidenceView *)reportEvidenceView{
  108. if (!_reportEvidenceView) {
  109. _reportEvidenceView = [[YMReportEvidenceView alloc]init];
  110. }
  111. return _reportEvidenceView;
  112. }
  113. - (YMReportRemarkView *)reportRemarkView{
  114. if (!_reportRemarkView) {
  115. _reportRemarkView = [[YMReportRemarkView alloc]init];
  116. }
  117. return _reportRemarkView;
  118. }
  119. - (UIButton *)submitBtn{
  120. if (!_submitBtn) {
  121. _submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  122. _submitBtn.titleLabel.font = LCFont(15);
  123. [_submitBtn setTitle:@"提交" forState:UIControlStateNormal];
  124. [_submitBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
  125. _submitBtn.backgroundColor = HexColorFromRGB(0xF888E7);
  126. _submitBtn.layer.cornerRadius = adapt(10);
  127. WS(weakSelf)
  128. [[[_submitBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(__kindof UIButton * _Nullable sender) {
  129. YMTipsPopupView *customView = [[YMTipsPopupView alloc]init];
  130. [customView configutationWithTips:@"确定要进行举报吗?" TipsAlignment:NSTextAlignmentCenter IsHideTitle:YES IsHideSingleButton:YES];
  131. YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:nil popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade];
  132. popupView.priority = 999;
  133. popupView.cornerRadius = adapt(10);
  134. popupView.rectCorners = UIRectCornerAllCorners;
  135. popupView.positionStyle = YMPositionStyleCenter;
  136. popupView.isHideBg = NO;
  137. popupView.bgAlpha = 0.3;
  138. @weakify(popupView)
  139. customView.buttonBlock = ^(BOOL isConfirm) {
  140. @strongify(popupView)
  141. if (isConfirm) {
  142. [weakSelf.viewModel uploadReportEvidenceData];
  143. }
  144. [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
  145. };
  146. [popupView pop];
  147. }];
  148. }
  149. return _submitBtn;
  150. }
  151. @end