123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- //
- // YMReportViewController.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/3/5.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMReportViewController.h"
- #import "YMReportViewModel.h"
- #import "YMReportReasonView.h"
- #import "YMReportEvidenceView.h"
- #import "YMReportRemarkView.h"
- @interface YMReportViewController ()
- /// 举报VM
- @property (nonatomic, strong) YMReportViewModel *viewModel;
- /// 容器滚动视图
- @property (nonatomic, strong) UIScrollView *contentScrollView;
- /// 容器视图
- @property (nonatomic, strong) UIView *contentView;
- /// 举报原因视图
- @property (nonatomic, strong) YMReportReasonView *reportReasonView;
- /// 举报证据视图
- @property (nonatomic, strong) YMReportEvidenceView *reportEvidenceView;
- /// 举报备注视图
- @property (nonatomic, strong) YMReportRemarkView *reportRemarkView;
- /// 提交按钮
- @property (nonatomic, strong) UIButton *submitBtn;
- @end
- @implementation YMReportViewController
- @dynamic viewModel;
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- }
- - (void)ym_setupViews{
- [self.view addSubview:self.contentScrollView];
- [self.contentScrollView addSubview:self.contentView];
- [self.contentView addSubview:self.reportReasonView];
- [self.contentView addSubview:self.reportEvidenceView];
- [self.contentView addSubview:self.reportRemarkView];
- [self.contentView addSubview:self.submitBtn];
- [self.view setNeedsUpdateConstraints];
- [self.view updateConstraintsIfNeeded];
- }
- - (void)updateViewConstraints{
-
- [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.view).offset(kYMNavHeight);
- make.left.equalTo(self.view);
- make.right.equalTo(self.view);
- make.bottom.equalTo(self.view);
- }];
-
- [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.contentScrollView);
- make.width.equalTo(self.contentScrollView.mas_width);
- }];
-
- [self.reportReasonView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentView);
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- }];
-
- [self.reportEvidenceView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.reportReasonView.mas_bottom);
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- }];
-
- [self.reportRemarkView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.reportEvidenceView.mas_bottom);
- make.left.equalTo(self.contentView);
- make.right.equalTo(self.contentView);
- }];
-
- [self.submitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.reportRemarkView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self.contentView).offset(adapt(20));
- make.right.equalTo(self.contentView).offset(adapt(-20));
- make.bottom.equalTo(self.contentView).offset(Is_iPhoneX ? adapt(-32) : adapt(-12));
- make.height.mas_equalTo(adapt(50));
- }];
- [super updateViewConstraints];
- }
- - (void)ym_bindViewModel{
- [self.reportReasonView ym_bindViewModel:self.viewModel];
- [self.reportEvidenceView ym_bindViewModel:self.viewModel];
- [self.viewModel getReportReasonListData];
- }
- - (UIScrollView *)contentScrollView{
- if (!_contentScrollView) {
- _contentScrollView = [[UIScrollView alloc]init];
- _contentScrollView.alwaysBounceVertical = YES;
- _contentScrollView.showsVerticalScrollIndicator = NO;
- _contentScrollView.showsHorizontalScrollIndicator = NO;
- _contentScrollView.backgroundColor = HexColorFromRGB(0xFFFFFF);
- _contentScrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
- }
- return _contentScrollView;
- }
- - (UIView *)contentView{
- if (!_contentView) {
- _contentView = [[UIView alloc]init];
- }
- return _contentView;
- }
- - (YMReportReasonView *)reportReasonView{
- if (!_reportReasonView) {
- _reportReasonView = [[YMReportReasonView alloc]init];
- }
- return _reportReasonView;
- }
- - (YMReportEvidenceView *)reportEvidenceView{
- if (!_reportEvidenceView) {
- _reportEvidenceView = [[YMReportEvidenceView alloc]init];
- }
- return _reportEvidenceView;
- }
- - (YMReportRemarkView *)reportRemarkView{
- if (!_reportRemarkView) {
- _reportRemarkView = [[YMReportRemarkView alloc]init];
- }
- return _reportRemarkView;
- }
- - (UIButton *)submitBtn{
- if (!_submitBtn) {
- _submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _submitBtn.titleLabel.font = LCFont(15);
- [_submitBtn setTitle:@"提交" forState:UIControlStateNormal];
- [_submitBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
- _submitBtn.backgroundColor = HexColorFromRGB(0xF888E7);
- _submitBtn.layer.cornerRadius = adapt(10);
- WS(weakSelf)
- [[[_submitBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(__kindof UIButton * _Nullable sender) {
- YMTipsPopupView *customView = [[YMTipsPopupView alloc]init];
- [customView configutationWithTips:@"确定要进行举报吗?" TipsAlignment:NSTextAlignmentCenter IsHideTitle:YES IsHideSingleButton:YES];
- YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:nil popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade];
- popupView.priority = 999;
- popupView.cornerRadius = adapt(10);
- popupView.rectCorners = UIRectCornerAllCorners;
- popupView.positionStyle = YMPositionStyleCenter;
- popupView.isHideBg = NO;
- popupView.bgAlpha = 0.3;
- @weakify(popupView)
- customView.buttonBlock = ^(BOOL isConfirm) {
- @strongify(popupView)
- if (isConfirm) {
- [weakSelf.viewModel uploadReportEvidenceData];
- }
- [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
- };
- [popupView pop];
-
- }];
- }
- return _submitBtn;
- }
- @end
|