Commit 6eba11ea cgx

完成举报模块

1 个父辈 ec1615bb
正在显示 21 个修改的文件 包含 395 行增加92 行删除
......@@ -95,6 +95,9 @@
D051032F282A4E9200560A0D /* fse.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = D051032D282A4E9200560A0D /* fse.mp3 */; };
D0534F092835D90400F8892E /* DSNaviBarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0534F082835D90400F8892E /* DSNaviBarViewController.m */; };
D053BEE9280F9E310028CCFC /* CloseAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053BEE8280F9E310028CCFC /* CloseAlertView.m */; };
D053D0D628F3BAD500BB2B84 /* ReportController.m in Sources */ = {isa = PBXBuildFile; fileRef = D053D0D528F3BAD500BB2B84 /* ReportController.m */; };
D053D0D928F3BB0F00BB2B84 /* ReportView.m in Sources */ = {isa = PBXBuildFile; fileRef = D053D0D828F3BB0F00BB2B84 /* ReportView.m */; };
D053D0DC28F3C23200BB2B84 /* ReportViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D053D0DB28F3C23200BB2B84 /* ReportViewModel.m */; };
D05416F7288A57BD0035060B /* AVAudioSession+SXAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */; };
D054CCB52830DE5600420DC4 /* NoisePlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D054CCB42830DE5600420DC4 /* NoisePlayerManager.m */; };
D054CCB82830E3AC00420DC4 /* NoisePlayItem.m in Sources */ = {isa = PBXBuildFile; fileRef = D054CCB72830E3AC00420DC4 /* NoisePlayItem.m */; };
......@@ -462,6 +465,12 @@
D0534F082835D90400F8892E /* DSNaviBarViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DSNaviBarViewController.m; sourceTree = "<group>"; };
D053BEE7280F9E310028CCFC /* CloseAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CloseAlertView.h; sourceTree = "<group>"; };
D053BEE8280F9E310028CCFC /* CloseAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CloseAlertView.m; sourceTree = "<group>"; };
D053D0D428F3BAD500BB2B84 /* ReportController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReportController.h; sourceTree = "<group>"; };
D053D0D528F3BAD500BB2B84 /* ReportController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReportController.m; sourceTree = "<group>"; };
D053D0D728F3BB0F00BB2B84 /* ReportView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReportView.h; sourceTree = "<group>"; };
D053D0D828F3BB0F00BB2B84 /* ReportView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReportView.m; sourceTree = "<group>"; };
D053D0DA28F3C23200BB2B84 /* ReportViewModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReportViewModel.h; sourceTree = "<group>"; };
D053D0DB28F3C23200BB2B84 /* ReportViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReportViewModel.m; sourceTree = "<group>"; };
D05416F5288A57BD0035060B /* AVAudioSession+SXAudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AVAudioSession+SXAudioSession.h"; sourceTree = "<group>"; };
D05416F6288A57BD0035060B /* AVAudioSession+SXAudioSession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AVAudioSession+SXAudioSession.m"; sourceTree = "<group>"; };
D054CCB32830DE5600420DC4 /* NoisePlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NoisePlayerManager.h; sourceTree = "<group>"; };
......@@ -1516,6 +1525,8 @@
D08EE4AE28F2CFC300B76FF9 /* MajorCommentCell.m */,
D08EE4B028F2CFD300B76FF9 /* ReplyCell.h */,
D08EE4B128F2CFD300B76FF9 /* ReplyCell.m */,
D053D0D728F3BB0F00BB2B84 /* ReportView.h */,
D053D0D828F3BB0F00BB2B84 /* ReportView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -1541,6 +1552,8 @@
D0078C5A28E13D4C00054804 /* DynamicDetailController.m */,
D08EE4A728F2C82D00B76FF9 /* ReplyListController.h */,
D08EE4A828F2C82D00B76FF9 /* ReplyListController.m */,
D053D0D428F3BAD500BB2B84 /* ReportController.h */,
D053D0D528F3BAD500BB2B84 /* ReportController.m */,
D02B7E6028E2D33900218EF7 /* comList.plist */,
);
path = Controller;
......@@ -1574,6 +1587,8 @@
D0B836EE28F100B3006E76C0 /* ComDetailViewModel.m */,
D070A78C28DF02DE0039C5A7 /* DynamicViewModel.h */,
D070A78D28DF02DE0039C5A7 /* DynamicViewModel.m */,
D053D0DA28F3C23200BB2B84 /* ReportViewModel.h */,
D053D0DB28F3C23200BB2B84 /* ReportViewModel.m */,
);
path = ViewModel;
sourceTree = "<group>";
......@@ -2474,6 +2489,7 @@
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */,
D0FAC41F281B817D00D4B859 /* UIScrollView+GKPhotoBrowser.m in Sources */,
D055BEC2282526B700BC11A4 /* CourseDetailController.m in Sources */,
D053D0D928F3BB0F00BB2B84 /* ReportView.m in Sources */,
D0AEFE79281781CF00230DC6 /* MyFeedModel.m in Sources */,
D0506B0C280503A800229278 /* UIButton+Extras.m in Sources */,
D0C50B3F27FD381000DC68F0 /* UIView+Extras.m in Sources */,
......@@ -2513,6 +2529,7 @@
D0078C6228E1425500054804 /* InteractView.m in Sources */,
D0C50B4627FD66FB00DC68F0 /* DSConstUtil.m in Sources */,
D01DC95128701ECD0035B78B /* MyPointView.m in Sources */,
D053D0DC28F3C23200BB2B84 /* ReportViewModel.m in Sources */,
D0B836FB28F1655E006E76C0 /* CommentCell.m in Sources */,
D0B836EF28F100B3006E76C0 /* ComDetailViewModel.m in Sources */,
D091E66B283F120100D3279E /* MyScoreModel.m in Sources */,
......@@ -2633,6 +2650,7 @@
D091E677283F614900D3279E /* ScoreDetailCell.m in Sources */,
D0F808FE280421C20097899F /* UnityGameController.m in Sources */,
D0691E02287FB331008BFFAB /* XLCircleProgress.m in Sources */,
D053D0D628F3BAD500BB2B84 /* ReportController.m in Sources */,
D07A4B27280E9BAA00BA0EC0 /* AccountController.m in Sources */,
D062A09E281838B800B4F48A /* FeedbackRequestModel.m in Sources */,
D0B836F828F1232F006E76C0 /* ComReplyModel.m in Sources */,
......
......@@ -10,6 +10,7 @@
#import "ComListViewModel.h"
#import "DynamicController.h"
#import "TestFlutterController.h"
#import "ReportController.h"
#import "DynamicDetailController.h"
@interface CommunityController () <CommunityViewDelegate, DynamicControllerDelegate, DynamicDetailControllerDelegate>
......@@ -17,6 +18,8 @@
@property (nonatomic, strong) TestFlutterController *flutterEngine;
@property (nonatomic, assign) int offset;
@property (nonatomic, strong) NSURLSessionDataTask *likeDataTask;
/// 存储动态id
@property (nonatomic, assign) int talkID;
@end
@implementation CommunityController
......@@ -104,18 +107,20 @@
[self.navigationController pushViewController:dyController animated:YES];
}
- (void)didTapInformItem:(int)userID {
- (void)didTapInformItem:(int)talkID {
if (![LoginUtils getUserLoginData]) {
[LoginUtils jumpToLoginControllerWithTarget:self];
return;
}
// 弹出举报框
self.talkID = talkID;
[self.communityView showInformCancelView];
}
- (void)didSubmitInformContent {
// 1、提交举报请求
- (void)jumpToReportPage {
ReportController *reportVC = [ReportController new];
reportVC.talkID = self.talkID;
[self.navigationController pushViewController:reportVC animated:YES];
}
- (void)didSelectItemWithModel:(ComDynModel *)comDynModel {
......
//
// ReportController.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 举报页面
@interface ReportController : UIViewController
@property (nonatomic, assign) int talkID;
@end
NS_ASSUME_NONNULL_END
//
// ReportController.m
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "ReportController.h"
#import "ReportView.h"
#import "FeedbackRequestModel.h"
#import "TZImagePickerController.h"
// 最大图片上传数量
static int MaxUpdateImgCount = 3;
// 相册显示列数
static int AlbumColumnCount = 4;
@interface ReportController () <ReportViewDelegate, TZImagePickerControllerDelegate>
@property (nonatomic, strong) ReportView *reportView;
@property (nonatomic, strong) ReportViewModel *reportVM;
@property (nonatomic, assign) BOOL isSelectOriginalPhoto;
@property (nonatomic, copy) NSString *result_imgurls;
@end
@implementation ReportController
- (void)loadView {
self.view = self.reportView;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"举报证据";
}
#pragma mark - ReportViewDelegate
- (void)openAlbum {
if (MaxUpdateImgCount <= 0) { return; }
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:MaxUpdateImgCount columnNumber:AlbumColumnCount delegate:self pushPhotoPickerVc:NO];
imagePickerVc.isSelectOriginalPhoto = self.isSelectOriginalPhoto;
imagePickerVc.naviBgColor = [self.dk_manager.themeVersion isEqualToString:DKThemeVersionNight] ? SubNaviDarkColor : BrandColor;
// 设置目前已经选中的图片数组
if (MaxUpdateImgCount > 1) { imagePickerVc.selectedAssets = self.reportVM.selectedAssets; }
// 在内部显示拍照按钮
imagePickerVc.allowTakePicture = YES;
imagePickerVc.iconThemeColor = ColorFromRGBA(31.0, 185.0, 34.0, 1.0);
imagePickerVc.showPhotoCannotSelectLayer = YES;
imagePickerVc.cannotSelectLayerColor = [DSWhite colorWithAlphaComponent:0.8];
// 设置是否可以选择视频/图片/原图
imagePickerVc.allowPickingVideo = NO;
imagePickerVc.allowPickingImage = YES;
imagePickerVc.allowPickingOriginalPhoto = NO;
imagePickerVc.allowPickingGif = NO;
// 是否可以多选视频
imagePickerVc.allowPickingMultipleVideo = NO;
// 照片排列按修改时间升序
imagePickerVc.sortAscendingByModificationDate = YES;
imagePickerVc.showSelectBtn = NO;
imagePickerVc.allowCrop = NO;
imagePickerVc.needCircleCrop = NO;
// 设置竖屏下的裁剪尺寸
NSInteger left = 30;
NSInteger widthHeight = self.view.width - 2 * left;
NSInteger top = (self.view.height - widthHeight) / 2;
imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight);
// 设置是否显示图片序号
imagePickerVc.showSelectedIndex = YES;
imagePickerVc.autoDismiss = NO;
// 你可以通过block或者代理,来得到用户选择的照片.
__weak TZImagePickerController *weakPicker = imagePickerVc;
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
if (photos.count) { [self uploadImgsWithPhotos:photos picker:weakPicker]; }
}];
[self presentViewController:imagePickerVc animated:YES completion:nil];
}
- (void)previewPicture:(NSIndexPath *)indexPath {
id asset = self.reportVM.selectedAssets[(indexPath.row - 1)];
BOOL isVideo = NO;
if ([asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = asset;
isVideo = phAsset.mediaType == PHAssetMediaTypeVideo;
}
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:self.reportVM.selectedAssets selectedPhotos:self.reportVM.selectedPhotos index:(indexPath.row - 1)];
__weak TZImagePickerController * weakPicker = imagePickerVc;
imagePickerVc.maxImagesCount = MaxUpdateImgCount;
imagePickerVc.allowPickingOriginalPhoto = NO;
imagePickerVc.allowPickingMultipleVideo = NO;
imagePickerVc.showSelectedIndex = YES;
imagePickerVc.isSelectOriginalPhoto = self.isSelectOriginalPhoto;
WS(weakSelf);
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
weakSelf.reportVM.selectedPhotos = [NSMutableArray arrayWithArray:photos];
weakSelf.reportVM.selectedAssets = [NSMutableArray arrayWithArray:assets];
weakSelf.isSelectOriginalPhoto = isSelectOriginalPhoto;
[weakSelf.reportView refreshImageContentView];
[weakPicker dismissViewControllerAnimated:YES completion:nil];
}];
[self presentViewController:imagePickerVc animated:YES completion:nil];
}
- (void)deletePicture:(NSInteger)tag {
[self.reportVM.selectedPhotos removeObjectAtIndex:tag];
[self.reportVM.selectedAssets removeObjectAtIndex:tag];
[self.reportView refreshAfterDelete:tag];
}
- (void)submitReport {
[DSProgressHUD showProgressHUDWithInfo:@""];
[self.reportVM userReportDynamicWithTalkID:self.talkID completion:^(ReportViewModel * _Nonnull viewModel) {
[DSProgressHUD dissmissProgressHUD];
if (viewModel.resCode == DSResCodeSuccess) {
[self.navigationController popViewControllerAnimated:YES];
} else {
[DSProgressHUD showToast:viewModel.errMessage];
}
}];
}
#pragma mark - TZImagePickerControllerDelegate
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos {
self.reportVM.selectedPhotos = [NSMutableArray arrayWithArray:photos];
self.reportVM.selectedAssets = [NSMutableArray arrayWithArray:assets];
self.isSelectOriginalPhoto = isSelectOriginalPhoto;
[self.reportView refreshImageContentView];
}
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(id)asset {
self.reportVM.selectedPhotos = [NSMutableArray arrayWithArray:@[animatedImage]];
self.reportVM.selectedAssets = [NSMutableArray arrayWithArray:@[asset]];
[self.reportView refreshImageContentView];
}
- (BOOL)isAlbumCanSelect:(NSString *)albumName result:(id)result {
return YES;
}
- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - 图片上传
- (void)uploadImgsWithPhotos:(NSArray<UIImage *> *)photos picker:(TZImagePickerController *)picker {
// 1、处理图片
NSMutableString *mstr = [NSMutableString string];
[mstr appendString:@"["];
for (int index = 0; index < photos.count; index++) {
UIImage *img = photos[index];
NSString *base64Str = [UIImage imageToBase64Str:img];
NSString *sepStr = (index == (photos.count - 1)) ? @"" : @",";
[mstr appendString:[NSString stringWithFormat:@"\"%@\"%@", base64Str, sepStr]];
}
[mstr appendString:@"]"];
// 2、上传图片
[DSProgressHUD showProgressHUDWithInfo:@""];
[FeedbackRequestModel uploadBulkImagesWithImgStr:[mstr copy] completion:^(FeedbackRequestModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) {
self.reportVM.imgUrls = [requestModel.result_imgurls stringByReplacingOccurrencesOfString:@"," withString:@"|"];
[picker dismissViewControllerAnimated:YES completion:nil];
}
}];
}
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
#pragma mark - lazy
- (ReportView *)reportView {
if (!_reportView) {
_reportView = [[ReportView alloc] initWithDelegate:self reportViewModel:self.reportVM];
}
return _reportView;
}
- (ReportViewModel *)reportVM {
if (!_reportVM) {
_reportVM = [ReportViewModel new];
}
return _reportVM;
}
@end
......@@ -31,11 +31,11 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didTapLikeItem:(ComDynModel *)comDynModel cell:(ComDynamicCell *)cell;
/// 点击举报
/// @param userID 用户ID
- (void)didTapInformItem:(int)userID;
/// @param talkID 动态id
- (void)didTapInformItem:(int)talkID;
/// 提交举报内容
- (void)didSubmitInformContent;
/// 跳转到举报页面
- (void)jumpToReportPage;
@end
/// 社区主视图
......
......@@ -127,7 +127,7 @@
__weak ComDynamicCell * weakCell = (ComDynamicCell *)cell;
cell.tapInformBlock = ^{
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didTapInformItem:)]) {
[weakSelf.delegate didTapInformItem:model.userID];
[weakSelf.delegate didTapInformItem:model.dynamicID];
}
};
cell.tapLikeBlock = ^{
......@@ -149,9 +149,9 @@
}
#pragma mark - InformCancelAlertViewDelegate
- (void)submitInformContent {
if (self.delegate && [self.delegate respondsToSelector:@selector(didSubmitInformContent)]) {
[self.delegate didSubmitInformContent];
- (void)tapInformBtn {
if (self.delegate && [self.delegate respondsToSelector:@selector(jumpToReportPage)]) {
[self.delegate jumpToReportPage];
}
}
......
......@@ -110,7 +110,7 @@
[attStr addAttribute:NSForegroundColorAttributeName value:fixColor range:NSMakeRange(changeStr.length, fixStr.length)];
self.wordLimitLab.attributedText = attStr;
self.dynamicVM.content = self.textView.text;
self.dynamicVM.content = [NSString transferSpecialCharacters:self.textView.text];
}
#pragma mark - UICollectionViewDataSource && UICollectionViewDelegate
......@@ -148,7 +148,7 @@
}
#pragma mark - lazy
- (UITextView *)textView {
- (MKPPlaceholderTextView *)textView {
if (!_textView) {
_textView = [[MKPPlaceholderTextView alloc] init];
_textView.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xf0f0f0), CornerViewDarkColor, DSWhite);
......@@ -156,6 +156,7 @@
_textView.font = SysFont(14);
_textView.delegate = self;
[_textView cornerRadius:12];
_textView.textContainerInset = UIEdgeInsetsMake(15, 8, 40, 8);
_textView.placeholder = @"请文明发言,不可涉及黄、赌、毒、国家政治相关动态!";
_textView.placeholderLabel.dk_textColorPicker = DKColorPickerWithColors(UIColor.lightGrayColor, DSWhite, DSWhite);
}
......@@ -193,7 +194,8 @@
- (UIButton *)publishBtn {
if (!_publishBtn) {
_publishBtn = [UIButton btnWithTitle:@"发布" titleColor:DSWhite font:BoldFont(16) bgColor:BrandColor];
_publishBtn = [UIButton btnWithTitle:@"发布" titleColor:DSWhite font:BoldFont(16)];
_publishBtn.dk_backgroundColorPicker = DKColorPickerWithKey(BrandBG);
[_publishBtn addTarget:self action:@selector(publishAction) forControlEvents:UIControlEventTouchUpInside];
[_publishBtn cornerRadius:20];
}
......
......@@ -10,8 +10,8 @@
NS_ASSUME_NONNULL_BEGIN
@protocol InformCancelAlertViewDelegate <NSObject>
/// 提交举报内容
- (void)submitInformContent;
/// 点击举报按钮回调
- (void)tapInformBtn;
@end
/// 举报、取消弹框
......
......@@ -10,7 +10,6 @@
@interface InformCancelAlertView ()
@property (nonatomic, strong) UIButton *informBtn;
@property (nonatomic, strong) UIButton *cancelBtn;
@property (nonatomic, strong) UIView *informDetailView;
@end
@implementation InformCancelAlertView
......@@ -21,7 +20,7 @@
self.backgroundColor = ColorFromHexA(0x161E38, .6);
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismiss)];
[self addGestureRecognizer:tapGR];
[self addSubview:self.informBtn];
......@@ -43,40 +42,28 @@
}
- (void)display {
self.informBtn.hidden = NO;
self.cancelBtn.hidden = NO;
self.informDetailView.hidden = YES;
[DSKeyWindow addSubview:self];
}
- (void)tapAction:(UITapGestureRecognizer *)gesture {
if (!CGRectContainsPoint(self.informDetailView.frame, [gesture locationInView:self])) {
[self dismiss];
}
}
- (void)dismiss {
[self removeFromSuperview];
}
- (void)tapInformBtn {
self.informBtn.hidden = YES;
self.cancelBtn.hidden = YES;
self.informDetailView.hidden = NO;
[self dismiss];
[self addSubview:self.informDetailView];
[self.informDetailView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self);
make.size.mas_equalTo(CGSizeMake(280, 291));
}];
if (self.delegate && [self.delegate respondsToSelector:@selector(tapInformBtn)]) {
[self.delegate tapInformBtn];
}
}
#pragma mark - lazy
- (UIButton *)informBtn {
if (!_informBtn) {
_informBtn = [UIButton dkBtnTitle:@"举报" font:BoldFont(15)];
[_informBtn cornerRadius:12];
_informBtn = [UIButton btnWithTitle:@"举报" font:BoldFont(15)];
_informBtn.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
[_informBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
[_informBtn cornerRadius:12];
[_informBtn addTarget:self action:@selector(tapInformBtn) forControlEvents:UIControlEventTouchUpInside];
}
return _informBtn;
......@@ -84,63 +71,13 @@
- (UIButton *)cancelBtn {
if (!_cancelBtn) {
_cancelBtn = [UIButton dkBtnTitle:@"取消" font:BoldFont(15)];
[_cancelBtn cornerRadius:12];
_cancelBtn = [UIButton btnWithTitle:@"取消" font:BoldFont(15)];
_cancelBtn.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
[_cancelBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
[_cancelBtn cornerRadius:12];
[_cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
}
return _cancelBtn;
}
- (UIView *)informDetailView {
if (!_informDetailView) {
_informDetailView = [UIView new];
[_informDetailView cornerRadius:24];
_informDetailView.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
UILabel *titleLab = [UILabel dkLabWithText:@"举报原因" font:BoldFont(16)];
titleLab.textAlignment = NSTextAlignmentCenter;
[_informDetailView addSubview:titleLab];
NSArray *itemNames = @[@"色情低俗", @"广告骚扰", @"政治宗教", @"虚假欺骗", @"违禁内容", @"其他原因"];
NSMutableArray *itemBtns = [NSMutableArray array];
for (int idx = 0; idx < itemNames.count; idx++) {
UIButton *itemBtn = [UIButton dkBtnTitle:itemNames[idx] font:SysFont(15)];
__weak UIButton * weakBtn = itemBtn;
[itemBtn dk_setImage:DKImagePickerWithNames(@"ic_ai_jianyi_unsel", @"ic_ai_jianyi_unsel", @"ic_ai_jianyi_unsel") forState:UIControlStateNormal];
[itemBtn dk_setImage:DKImagePickerWithNames(@"ic_ai_jianyi_sel", @"ic_ai_jianyi_sel", @"ic_ai_jianyi_sel") forState:UIControlStateSelected];
itemBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 14, 0, 0);
[itemBtn addTouchUpInsideHandler:^(NSInteger tag) {
weakBtn.selected = !weakBtn.selected;
}];
[_informDetailView addSubview:itemBtn];
[itemBtns addObject:itemBtn];
}
[titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(_informDetailView);
make.top.equalTo(_informDetailView).offset(20);
}];
[itemBtns mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedSpacing:13 leadSpacing:60 tailSpacing:20];
[itemBtns mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(_informDetailView);
make.width.mas_equalTo(100);
}];
WS(weakSelf);
UIButton *submitBtn = [UIButton btnWithTitle:@"提交" titleColor:BrandColor font:BoldFont(14)];
[submitBtn addTouchUpInsideHandler:^(NSInteger tag) {
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(submitInformContent)]) {
[weakSelf.delegate submitInformContent];
}
}];
[_informDetailView addSubview:submitBtn];
[submitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(titleLab);
make.right.equalTo(_informDetailView).offset(-20);
}];
}
return _informDetailView;
}
@end
......@@ -61,12 +61,14 @@
- (void)layoutSubviews {
[super layoutSubviews];
UIEdgeInsets insets = self.textContainerInset;
self.placeholderLabel.x = insets.left == 0 ? 8 : insets.left + 3;
self.placeholderLabel.y = insets.top == 0 ? 8 : insets.top;
self.placeholderLabel.width = self.width - 2 * self.placeholderLabel.x;
[self.placeholderLabel sizeToFit];
}
#pragma mark - 重写setter
- (void)setPlaceholderColor:(UIColor *)placeholderColor {
_placeholderColor = placeholderColor;
self.placeholderLabel.textColor = placeholderColor;
......
//
// ReportView.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import <UIKit/UIKit.h>
#import "ReportViewModel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol ReportViewDelegate <NSObject>
/// 打开相册
- (void)openAlbum;
/// 预览图片
- (void)previewPicture:(NSIndexPath *)indexPath;
/// 删除图片
- (void)deletePicture:(NSInteger)tag;
/// 提交举报信息
- (void)submitReport;
@end
/// 举报主视图
@interface ReportView : UIView
@property (nonatomic, weak) id<ReportViewDelegate> delegate;
- (instancetype)initWithDelegate:(id<ReportViewDelegate>)delegate reportViewModel:(ReportViewModel *)reportVM;
- (void)refreshImageContentView;
- (void)refreshAfterDelete:(NSInteger)tag;
@end
NS_ASSUME_NONNULL_END
//
// ReportViewModel.h
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "DSNetworkTool.h"
NS_ASSUME_NONNULL_BEGIN
/// 举报viewModel
@interface ReportViewModel : DSNetworkTool
@property (nonatomic, strong) NSMutableArray *selectedPhotos;
@property (nonatomic, strong) NSMutableArray *selectedAssets;
/// 举报选项内容
@property (nonatomic, copy) NSString *content;
/// 举报具体说明
@property (nonatomic, copy) NSString *remark;
/// 举报图片地址,最多支持三张图片,采用|分隔
@property (nonatomic, copy) NSString *imgUrls;
/// 用户-举报动态接口
/// @param talkID 动态id
/// @param completion completion
- (NSURLSessionDataTask *)userReportDynamicWithTalkID:(int)talkID completion:(void (^)(ReportViewModel *viewModel))completion;
@end
NS_ASSUME_NONNULL_END
//
// ReportViewModel.m
// DreamSleep
//
// Created by peter on 2022/10/10.
//
#import "ReportViewModel.h"
@implementation ReportViewModel
- (instancetype)init {
if (self = [super init]) {
self.selectedPhotos = [NSMutableArray array];
self.selectedAssets = [NSMutableArray array];
self.content = @"";
self.remark = @"";
self.imgUrls = @"";
}
return self;
}
- (NSURLSessionDataTask *)userReportDynamicWithTalkID:(int)talkID completion:(void (^)(ReportViewModel *viewModel))completion {
NSString *api = @"user_report_dynamic";
NSString *argStr = [NSString stringWithFormat:@"mutation{%@(talk_id:%d,content:\"%@\",remark:\"%@\",img_url:\"%@\")}", api, talkID, self.content, self.remark, self.imgUrls];
return [ReportViewModel httpPostBodyRequestWithAPI:api params:@{@"query" : argStr} view:nil hasNetActivity:YES loadingInfo:nil hasFailInfo:NO success:^(NSDictionary * _Nonnull apiDic) {
DSLog(@"用户-举报动态接口apiDic:%@", apiDic);
self.resCode = DSResCodeSuccess;
completion(self);
} failure:^(id _Nonnull failureInfo) {
self.resCode = [failureInfo[@"errorCode"] integerValue];
self.errMessage = failureInfo[@"errMessage"];
completion(self);
}];
}
@end
......@@ -327,6 +327,7 @@ static int AlbumColumnCount = 4;
_feedTV.font = SysFont(14);
_feedTV.delegate = self;
[_feedTV cornerRadius:12];
_feedTV.textContainerInset = UIEdgeInsetsMake(15, 8, 40, 8);
}
return _feedTV;
}
......
......@@ -33,6 +33,7 @@
UIColor *bgColor = BrandColor;
// 二级导航栏需要适配白天和黑夜模式(最后才告诉我有这个需求)
if (vc.navigationController.viewControllers.count > 1) {
titleColor = [vc.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? DSWhite : DkTitleColor;
bgColor = [vc.dk_manager.themeVersion isEqualToString:DKThemeVersionNormal] ? BrandColor : SubNaviDarkColor;
}
UIColor *barTintColor = BrandColor;
......
{
"images" : [
{
"filename" : "ic_xinhao.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_xinhao@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_xinhao@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -3,6 +3,7 @@ NORMAL NIGHT RED
#F5F7FA #161E38 #FAF5F5 VCViewBG
#F0F2F5 #161E38 #000000 LeadViewBG
#FFFFFF #1F263F #000000 CornerViewBG
#62C3D5 #45A4B5 #000000 BrandBG
#E5E5E5 #FFFFFF #000000 LeadPageIndicator
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!