公司电脑
1 year ago
27 changed files with 626 additions and 104 deletions
Binary file not shown.
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
{ |
||||
"images" : [ |
||||
{ |
||||
"idiom" : "universal", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"filename" : "comm_report_select_no@2x.png", |
||||
"idiom" : "universal", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "universal", |
||||
"scale" : "3x" |
||||
} |
||||
], |
||||
"info" : { |
||||
"author" : "xcode", |
||||
"version" : 1 |
||||
} |
||||
} |
After Width: | Height: | Size: 169 B |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
{ |
||||
"images" : [ |
||||
{ |
||||
"idiom" : "universal", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"filename" : "comm_report_select_yes@2x.png", |
||||
"idiom" : "universal", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "universal", |
||||
"scale" : "3x" |
||||
} |
||||
], |
||||
"info" : { |
||||
"author" : "xcode", |
||||
"version" : 1 |
||||
} |
||||
} |
After Width: | Height: | Size: 347 B |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// CommonPopView.h
|
||||
// tongxin
|
||||
//
|
||||
// Created by ecell on 2023/5/26.
|
||||
// Copyright © 2023 xTT. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h> |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
@interface CommonPopView : UIView |
||||
|
||||
+ (instancetype)sharedManager; |
||||
|
||||
#pragma mark 举报弹窗 |
||||
/// 举报弹窗
|
||||
- (void)reportPopView:(NSString *)reportID; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,235 @@
@@ -0,0 +1,235 @@
|
||||
// |
||||
// CommonPopView.m |
||||
// tongxin |
||||
// |
||||
// Created by ecell on 2023/5/26. |
||||
// Copyright © 2023 xTT. All rights reserved. |
||||
// |
||||
|
||||
#import "CommonPopView.h" |
||||
|
||||
#import "User.h" |
||||
#import "ReportTableViewCell.h" |
||||
#import "Circle.h" |
||||
|
||||
@interface CommonPopView ()<UITableViewDelegate,UITableViewDataSource> |
||||
|
||||
/// 背景 |
||||
@property (nonatomic ,weak) UIView *bgView; |
||||
|
||||
@property (nonatomic ,strong) NSArray *titleArr; |
||||
|
||||
@property (nonatomic ,strong) NSMutableArray *selectTitleArr; |
||||
|
||||
|
||||
|
||||
@end |
||||
|
||||
@implementation CommonPopView |
||||
|
||||
+ (instancetype)sharedManager{ |
||||
static dispatch_once_t onceToken; |
||||
static CommonPopView *instance; |
||||
dispatch_once(&onceToken, ^{ |
||||
instance = [[CommonPopView alloc] init]; |
||||
}); |
||||
return instance; |
||||
} |
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame |
||||
{ |
||||
self = [super initWithFrame:frame]; |
||||
if (self) |
||||
{ |
||||
self.frame = [UIScreen mainScreen].bounds; |
||||
self.backgroundColor = RGBA(0, 0, 0, 0.4); |
||||
} |
||||
return self; |
||||
} |
||||
|
||||
|
||||
#pragma mark 举报弹窗 |
||||
/// 举报弹窗 |
||||
- (void)reportPopView:(NSString *)reportID |
||||
{ |
||||
WEAKSELF |
||||
UIView *bgView = [UICommon ui_view:CGRectZero backgroundColor:KKWhiteColorColor cornerRadius:18 borderWidth:0 borderColor:KKWhiteColorColor]; |
||||
self.bgView = bgView; |
||||
[self addSubview:bgView]; |
||||
[bgView mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.centerX.equalTo(self); |
||||
make.centerY.equalTo(self); |
||||
make.size.mas_equalTo(CGSizeMake(331, 520)); |
||||
}]; |
||||
|
||||
UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(20) textColor:KKTextColor text:@"举报" Radius:0]; |
||||
[bgView addSubview:titleLabel]; |
||||
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.centerX.equalTo(bgView); |
||||
make.top.equalTo(bgView).offset(24); |
||||
}]; |
||||
|
||||
UILabel *textsLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(16) textColor:KKTextColor text:@"举报原因" Radius:0]; |
||||
[bgView addSubview:textsLabel]; |
||||
[textsLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.left.equalTo(bgView).offset(20); |
||||
make.top.equalTo(titleLabel.mas_bottom).offset(18); |
||||
}]; |
||||
|
||||
|
||||
|
||||
UIButton *escBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(16) normalColor:KKTextColor normalText:@"取消" click:^(id x) { |
||||
[self dismiss]; |
||||
}]; |
||||
escBtn.layer.borderWidth = 1; |
||||
escBtn.layer.borderColor = RGB(240, 239, 237).CGColor; |
||||
escBtn.layer.cornerRadius = 24; |
||||
//view.layer.masksToBounds = YES; |
||||
[bgView addSubview:escBtn]; |
||||
[escBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.bottom.equalTo(bgView.mas_bottom).inset(28); |
||||
make.left.equalTo(bgView).offset(24); |
||||
make.size.mas_equalTo(CGSizeMake(125, 48)); |
||||
}]; |
||||
|
||||
UIButton *okBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(16) normalColor:KKWhiteColorColor normalText:@"确定" click:^(id x) { |
||||
if (self.selectTitleArr.count <= 0) |
||||
{ |
||||
[SVProgressHUD showErrorWithStatus:@"请选择举报原因"]; |
||||
AfterDispatch(1.5, ^{ |
||||
[SVProgressHUD dismiss]; |
||||
}); |
||||
return; |
||||
} |
||||
[self setReport:reportID]; |
||||
}]; |
||||
okBtn.backgroundColor = mainColor; |
||||
okBtn.layer.cornerRadius = 24; |
||||
okBtn.layer.masksToBounds = YES; |
||||
[bgView addSubview:okBtn]; |
||||
[okBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.centerY.equalTo(escBtn); |
||||
make.right.equalTo(bgView.mas_right).inset(24); |
||||
make.size.mas_equalTo(CGSizeMake(125, 48)); |
||||
}]; |
||||
|
||||
self.titleArr = @[@"谣言",@"有害信息",@"违法信息",@"色情低俗",@"人身攻击",@"垃圾营销",@"政治敏感",@"其他"]; |
||||
|
||||
UITableView *tableView = [UITableView new]; |
||||
tableView.delegate = self; |
||||
tableView.dataSource = self; |
||||
tableView.rowHeight = 40; |
||||
tableView.separatorStyle = UITableViewCellSeparatorStyleNone; |
||||
[tableView registerClass:ReportTableViewCell.class forCellReuseIdentifier:NSStringFromClass(ReportTableViewCell.class)]; |
||||
tableView.showsVerticalScrollIndicator = NO; |
||||
tableView.allowsMultipleSelection = YES; //让CollectionView支持多选 |
||||
tableView.scrollEnabled = NO; |
||||
[bgView addSubview:tableView]; |
||||
[tableView mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.left.right.equalTo(bgView).inset(20); |
||||
make.top.equalTo(textsLabel.mas_bottom).offset(5); |
||||
make.bottom.equalTo(escBtn.mas_top).inset(15); |
||||
}]; |
||||
|
||||
|
||||
[self showPopView]; |
||||
} |
||||
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
||||
{ |
||||
ReportTableViewCell *cell = [ReportTableViewCell cellWithTableView:tableView indexPath:indexPath]; |
||||
cell.cellText = self.titleArr[indexPath.row]; |
||||
return cell; |
||||
} |
||||
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
||||
{ |
||||
NSLog(@"选择-%@",self.titleArr[indexPath.row]); |
||||
NSString *title = self.titleArr[indexPath.row]; |
||||
[self.selectTitleArr addObject:title]; |
||||
} |
||||
|
||||
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath |
||||
{ |
||||
NSLog(@"取消选择-%@",self.titleArr[indexPath.row]); |
||||
NSString *title = self.titleArr[indexPath.row]; |
||||
[self.selectTitleArr removeObject:title]; |
||||
} |
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section |
||||
{ |
||||
return self.titleArr.count; |
||||
} |
||||
|
||||
|
||||
- (void)setReport:(NSString *)reportID |
||||
{ |
||||
[SVProgressHUD showInfoWithStatus:@"举报中"]; |
||||
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init]; |
||||
[parameters setObject:[self.selectTitleArr componentsJoinedByString:@"@"] forKey:@"content"]; |
||||
[parameters setObject:reportID forKey:@"reportID"]; |
||||
[parameters setValue:cUser.accesstoken forKey:@"accesstoken"]; |
||||
Circle *circle = [[Circle alloc] init]; |
||||
[circle reportCircleMessageWithParameters:parameters |
||||
success:^(id responseObject) { |
||||
[self dismiss]; |
||||
[SVProgressHUD dismiss]; |
||||
[SVProgressHUD showSuccessWithStatus:@"举报发送成功"]; |
||||
} failure:^{ |
||||
[SVProgressHUD showErrorWithStatus:@"举报失败"]; |
||||
}]; |
||||
} |
||||
|
||||
|
||||
|
||||
- (void)showPopView |
||||
{ |
||||
[self showWithAlert:self.bgView]; |
||||
[[UIApplication sharedApplication].delegate.window addSubview:self];; |
||||
} |
||||
|
||||
/** |
||||
添加Alert入场动画 |
||||
@param alert 添加动画的View |
||||
*/ |
||||
- (void)showWithAlert:(UIView*)alert |
||||
{ |
||||
CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; |
||||
animation.duration = 0.6; |
||||
NSMutableArray *values = [NSMutableArray array]; |
||||
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)]]; |
||||
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.1, 1.1, 1.0)]]; |
||||
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]]; |
||||
[values addObject:[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)]]; |
||||
animation.values = values; |
||||
[alert.layer addAnimation:animation forKey:nil]; |
||||
} |
||||
|
||||
- (void)dismiss |
||||
{ |
||||
[UICommon resignKeyboard]; |
||||
[UIView animateWithDuration:0.6f animations:^{ |
||||
self.backgroundColor = [UIColor clearColor]; |
||||
self.alpha = 0; |
||||
}completion:^(BOOL finished) { |
||||
[self removeFromSuperview]; |
||||
} ]; |
||||
} |
||||
|
||||
|
||||
- (NSMutableArray *)selectTitleArr |
||||
{ |
||||
if (!_selectTitleArr) _selectTitleArr = [NSMutableArray new]; |
||||
return _selectTitleArr; |
||||
} |
||||
|
||||
/* |
||||
// Only override drawRect: if you perform custom drawing. |
||||
// An empty implementation adversely affects performance during animation. |
||||
- (void)drawRect:(CGRect)rect { |
||||
// Drawing code |
||||
} |
||||
*/ |
||||
|
||||
@end |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ReportTableViewCell.h
|
||||
// tongxin
|
||||
//
|
||||
// Created by ecell on 2023/9/7.
|
||||
// Copyright © 2023 xTT. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ZZTableViewCell.h" |
||||
|
||||
NS_ASSUME_NONNULL_BEGIN |
||||
|
||||
@interface ReportTableViewCell : ZZTableViewCell |
||||
|
||||
@property (nonatomic ,strong) NSString *cellText; |
||||
|
||||
@end |
||||
|
||||
NS_ASSUME_NONNULL_END |
@ -0,0 +1,72 @@
@@ -0,0 +1,72 @@
|
||||
// |
||||
// ReportTableViewCell.m |
||||
// tongxin |
||||
// |
||||
// Created by ecell on 2023/9/7. |
||||
// Copyright © 2023 xTT. All rights reserved. |
||||
// |
||||
|
||||
#import "ReportTableViewCell.h" |
||||
|
||||
@interface ReportTableViewCell () |
||||
|
||||
@property (nonatomic ,weak) UIImageView *leftImg; |
||||
|
||||
@property (nonatomic ,weak) UILabel *textsLabel; |
||||
|
||||
@end |
||||
|
||||
@implementation ReportTableViewCell |
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier |
||||
{ |
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; |
||||
if (self) |
||||
{ |
||||
self.selectionStyle = UITableViewCellSelectionStyleNone; |
||||
self.backgroundColor = KKClearColor; |
||||
[self subCellView]; |
||||
} |
||||
|
||||
return self; |
||||
} |
||||
|
||||
- (void)setCellText:(NSString *)cellText |
||||
{ |
||||
_cellText = cellText; |
||||
self.textsLabel.text = cellText; |
||||
} |
||||
|
||||
- (void)subCellView |
||||
{ |
||||
UIImageView *leftImg = [UICommon ui_imageView:CGRectZero fileName:@"comm_report_select_no"]; |
||||
self.leftImg = leftImg; |
||||
[self.contentView addSubview:leftImg]; |
||||
[leftImg mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.left.equalTo(self.contentView); |
||||
make.centerY.equalTo(self.contentView); |
||||
make.size.mas_equalTo(leftImg.image.size); |
||||
}]; |
||||
|
||||
UILabel *textsLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(16) textColor:KKTextColor text:@"" Radius:0]; |
||||
self.textsLabel = textsLabel; |
||||
[self.contentView addSubview:textsLabel]; |
||||
[textsLabel mas_makeConstraints:^(MASConstraintMaker *make) { |
||||
make.left.equalTo(leftImg.mas_right).offset(15); |
||||
make.centerY.equalTo(self.contentView); |
||||
}]; |
||||
} |
||||
|
||||
- (void)awakeFromNib { |
||||
[super awakeFromNib]; |
||||
// Initialization code |
||||
} |
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { |
||||
[super setSelected:selected animated:animated]; |
||||
|
||||
self.leftImg.image = selected ? ImageName_(@"comm_report_select_yes") : ImageName_(@"comm_report_select_no"); |
||||
// Configure the view for the selected state |
||||
} |
||||
|
||||
@end |
Loading…
Reference in new issue