| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- //
- // MOReportSomeOneView.m
- // MiMoLive
- //
- // Created by SuperC on 2024/1/16.
- //
- #import "MOReportSomeOneView.h"
- #import "MOReportTableViewCell.h"
- @interface MOReportSomeOneView ()<UITableViewDelegate,UITableViewDataSource>
- @property (weak, nonatomic) IBOutlet UIImageView *bgImgView;
- @property (weak, nonatomic) IBOutlet UILabel *titleLab;
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (weak, nonatomic) IBOutlet UITextView *textView;
- @property (weak, nonatomic) IBOutlet UIButton *cancelBtn;
- @property (weak, nonatomic) IBOutlet UIButton *submitBtn;
- @property (nonatomic, strong) NSArray *dataArr;
- @property (nonatomic, assign) NSInteger selectIndex;
- @end
- @implementation MOReportSomeOneView
- + (instancetype)moReportSomeOneView{
- return [[[NSBundle mainBundle] loadNibNamed:@"MOReportSomeOneView" owner:self options:nil] firstObject];
- }
- - (void)awakeFromNib{
- [super awakeFromNib];
-
- self.titleLab.font = [MOTextTools getTheFontWithSize:16.0 AndFontName:kNormalTitleFontStr];
- self.cancelBtn.font = [MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalContentFontStr];
- self.submitBtn.font = [MOTextTools getTheFontWithSize:20.0 AndFontName:kNormalContentFontStr];
-
- self.layer.cornerRadius = 16.0;
- self.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
- self.layer.masksToBounds = YES;
-
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.layer.cornerRadius = 16.0;
- self.tableView.layer.masksToBounds = YES;
-
- [self.tableView registerNib:[UINib nibWithNibName:@"MOReportTableViewCell" bundle:nil] forCellReuseIdentifier:MOReportTableViewCell_ID];
-
- NSArray *bgColorArr = @[[MOTools colorWithHexString:@"#EDF1FD" alpha:1.0],[MOTools colorWithHexString:@"#FAFAFC" alpha:1.0]];
- UIImage *bgImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 120.0, 50.0) Colors:bgColorArr GradientType:0];
- [self.bgImgView setImage:bgImage];
-
- NSArray *colorArr = @[[MOTools colorWithHexString:@"#B0B0B0" alpha:1.0],[MOTools colorWithHexString:@"#B0B0B0" alpha:1.0]];
- UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 120.0, 50.0) Colors:colorArr GradientType:0];
-
- self.cancelBtn.layer.cornerRadius = 40.0 / 2.0;
- self.cancelBtn.layer.masksToBounds = YES;
- [self.cancelBtn setBackgroundImage:image forState:UIControlStateNormal];
-
- NSArray *submitColorArr = @[kBaseBtnBgColor,kBaseBtnBgColor];
- UIImage *submitImage = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 120.0, 50.0) Colors:submitColorArr GradientType:0];
-
- self.submitBtn.layer.cornerRadius = 40.0 / 2.0;
- self.submitBtn.layer.masksToBounds = YES;
- [self.submitBtn setBackgroundImage:submitImage forState:UIControlStateNormal];
-
- self.textView.layer.cornerRadius = 12.0;
- self.textView.layer.masksToBounds = YES;
-
- self.dataArr = @[NSLocalString(@"mimo_Report_sq"),NSLocalString(@"mimo_Report_sj"),NSLocalString(@"mimo_Report_bl"),NSLocalString(@"mimo_Report_wr"),NSLocalString(@"mimo_Report_gg"),NSLocalString(@"mimo_Report_qz")];
- self.selectIndex = 0;
-
- }
- - (IBAction)backBtnClick:(id)sender {
- [self dismissReportSomeOneView];
- }
- - (IBAction)cancelBtnClick:(id)sender {
- [self dismissReportSomeOneView];
- }
- - (IBAction)submitBtnClick:(id)sender {
-
- if(self.userId.length == 0){
- return;
- }
-
- NSString *contentStr = self.textView.text;
- if(contentStr.length == 0){
- contentStr = @"";
- }
-
- WEAKSELF
- NSDictionary *dict = @{@"target":self.userId,
- @"type":@(self.selectIndex + 1),
- @"content":contentStr};
-
- [kHttpManager toSubmitFeedbackReportWithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
- if(kCode_Success){
- [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_success")];
-
- weakSelf.textView.text = @"";
-
- [weakSelf dismissReportSomeOneView];
- }
- else{
- MOLogV(@"getGiftHttpDataWith 接口报错了");
- kShowNetError(data)
- }
- }];
-
- }
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
- {
- UITouch *touch = [touches anyObject];
- if (![touch.view isEqual:self.textView])
- {
- [self.textView resignFirstResponder];
- }
- }
- #pragma mark - UITableViewDelegate,UITableViewDataSource
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.dataArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- NSString *tempStr = self.dataArr[indexPath.row];
- MOReportTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MOReportTableViewCell_ID];
- cell.titleLab.text = tempStr;
-
- if(indexPath.row == self.selectIndex){
- cell.isSelect = YES;
- }
- else{
- cell.isSelect = NO;
- }
-
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 30.0;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- [self.textView resignFirstResponder];
-
- self.selectIndex = indexPath.row;
- [self.tableView reloadData];
- }
- - (void)showReportSomeOneView{
- self.frame = CGRectMake(0, 0, SCREENWIDTH, 445);
-
- if(self.isAnimationTwo){
- CGRect actionViewRect = self.frame;
- actionViewRect.origin.y = SCREENHEIGHT;
- self.frame = actionViewRect;
-
- WEAKSELF
- [UIView animateWithDuration:0.3 animations:^{
- CGRect actionViewRect = weakSelf.frame;
- actionViewRect.origin.y = (SCREENHEIGHT - 445);
- weakSelf.frame = actionViewRect;
- }];
- }
- else{
- CGRect actionViewRect = self.frame;
- actionViewRect.origin.x = SCREENWIDTH;
- self.frame = actionViewRect;
-
- WEAKSELF
- [UIView animateWithDuration:0.3 animations:^{
- CGRect actionViewRect = weakSelf.frame;
- actionViewRect.origin.x = 0;
- weakSelf.frame = actionViewRect;
- }];
- }
-
- [self.tableView reloadData];
- }
- - (void)dismissReportSomeOneView{
-
- [self.textView resignFirstResponder];
-
- self.dismissReportViewBlock ? self.dismissReportViewBlock() : nil;
-
- //完成下移动画
- WEAKSELF
-
- if(self.isAnimationTwo){
- [UIView animateWithDuration:0.3 animations:^
- {
- CGRect actionSheetViewRect = weakSelf.frame;
- actionSheetViewRect.origin.y = SCREENHEIGHT;
- weakSelf.frame = actionSheetViewRect;
- } completion:^(BOOL finished)
- {
- [self removeFromSuperview];
- }];
- }
- else{
- [UIView animateWithDuration:0.3 animations:^
- {
- CGRect actionSheetViewRect = weakSelf.frame;
- actionSheetViewRect.origin.x = SCREENWIDTH;
- weakSelf.frame = actionSheetViewRect;
- } completion:^(BOOL finished)
- {
- [self removeFromSuperview];
- }];
- }
- }
- @end
|