Commit 585ab770 cgx

完成我的动态模块

1 个父辈 9ae20ac7
正在显示 39 个修改的文件 包含 247 行增加239 行删除
...@@ -303,6 +303,9 @@ ...@@ -303,6 +303,9 @@
D0FE45BC28FF80AA0020710A /* MyDynamicController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45BB28FF80AA0020710A /* MyDynamicController.m */; }; D0FE45BC28FF80AA0020710A /* MyDynamicController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45BB28FF80AA0020710A /* MyDynamicController.m */; };
D0FE45BF28FF814C0020710A /* MyDynamicView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45BE28FF814C0020710A /* MyDynamicView.m */; }; D0FE45BF28FF814C0020710A /* MyDynamicView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45BE28FF814C0020710A /* MyDynamicView.m */; };
D0FE45C528FF862F0020710A /* MyDynamicListResultModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */; }; D0FE45C528FF862F0020710A /* MyDynamicListResultModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */; };
D0FE45C828FFCC640020710A /* ArticleModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45C728FFCC640020710A /* ArticleModel.m */; };
D0FE45CB28FFD2CD0020710A /* ArticleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45CA28FFD2CD0020710A /* ArticleCell.m */; };
D0FE45CE28FFE8E20020710A /* ConfirmBox.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FE45CD28FFE8E20020710A /* ConfirmBox.m */; };
D0FEE7D128854967006C2B67 /* SleepReadyDoneView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FEE7D028854967006C2B67 /* SleepReadyDoneView.m */; }; D0FEE7D128854967006C2B67 /* SleepReadyDoneView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FEE7D028854967006C2B67 /* SleepReadyDoneView.m */; };
D0FEE7D428855483006C2B67 /* SRFinishModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FEE7D328855483006C2B67 /* SRFinishModel.m */; }; D0FEE7D428855483006C2B67 /* SRFinishModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D0FEE7D328855483006C2B67 /* SRFinishModel.m */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -894,6 +897,12 @@ ...@@ -894,6 +897,12 @@
D0FE45BE28FF814C0020710A /* MyDynamicView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDynamicView.m; sourceTree = "<group>"; }; D0FE45BE28FF814C0020710A /* MyDynamicView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDynamicView.m; sourceTree = "<group>"; };
D0FE45C328FF862F0020710A /* MyDynamicListResultModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDynamicListResultModel.h; sourceTree = "<group>"; }; D0FE45C328FF862F0020710A /* MyDynamicListResultModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDynamicListResultModel.h; sourceTree = "<group>"; };
D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDynamicListResultModel.m; sourceTree = "<group>"; }; D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDynamicListResultModel.m; sourceTree = "<group>"; };
D0FE45C628FFCC640020710A /* ArticleModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArticleModel.h; sourceTree = "<group>"; };
D0FE45C728FFCC640020710A /* ArticleModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArticleModel.m; sourceTree = "<group>"; };
D0FE45C928FFD2CD0020710A /* ArticleCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ArticleCell.h; sourceTree = "<group>"; };
D0FE45CA28FFD2CD0020710A /* ArticleCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArticleCell.m; sourceTree = "<group>"; };
D0FE45CC28FFE8E20020710A /* ConfirmBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConfirmBox.h; sourceTree = "<group>"; };
D0FE45CD28FFE8E20020710A /* ConfirmBox.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConfirmBox.m; sourceTree = "<group>"; };
D0FEE7CF28854967006C2B67 /* SleepReadyDoneView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepReadyDoneView.h; sourceTree = "<group>"; }; D0FEE7CF28854967006C2B67 /* SleepReadyDoneView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SleepReadyDoneView.h; sourceTree = "<group>"; };
D0FEE7D028854967006C2B67 /* SleepReadyDoneView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepReadyDoneView.m; sourceTree = "<group>"; }; D0FEE7D028854967006C2B67 /* SleepReadyDoneView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SleepReadyDoneView.m; sourceTree = "<group>"; };
D0FEE7D228855483006C2B67 /* SRFinishModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SRFinishModel.h; sourceTree = "<group>"; }; D0FEE7D228855483006C2B67 /* SRFinishModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SRFinishModel.h; sourceTree = "<group>"; };
...@@ -1584,6 +1593,10 @@ ...@@ -1584,6 +1593,10 @@
D0A3BB9528D9B43700F58781 /* ArticleController.m */, D0A3BB9528D9B43700F58781 /* ArticleController.m */,
D0A1C49028C2084B000975DC /* ArticleRequestModel.h */, D0A1C49028C2084B000975DC /* ArticleRequestModel.h */,
D0A1C49128C2084B000975DC /* ArticleRequestModel.m */, D0A1C49128C2084B000975DC /* ArticleRequestModel.m */,
D0FE45C628FFCC640020710A /* ArticleModel.h */,
D0FE45C728FFCC640020710A /* ArticleModel.m */,
D0FE45C928FFD2CD0020710A /* ArticleCell.h */,
D0FE45CA28FFD2CD0020710A /* ArticleCell.m */,
); );
path = Article; path = Article;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1597,6 +1610,8 @@ ...@@ -1597,6 +1610,8 @@
D0FE45BB28FF80AA0020710A /* MyDynamicController.m */, D0FE45BB28FF80AA0020710A /* MyDynamicController.m */,
D0FE45BD28FF814C0020710A /* MyDynamicView.h */, D0FE45BD28FF814C0020710A /* MyDynamicView.h */,
D0FE45BE28FF814C0020710A /* MyDynamicView.m */, D0FE45BE28FF814C0020710A /* MyDynamicView.m */,
D0FE45CC28FFE8E20020710A /* ConfirmBox.h */,
D0FE45CD28FFE8E20020710A /* ConfirmBox.m */,
D0FE45C328FF862F0020710A /* MyDynamicListResultModel.h */, D0FE45C328FF862F0020710A /* MyDynamicListResultModel.h */,
D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */, D0FE45C428FF862F0020710A /* MyDynamicListResultModel.m */,
); );
...@@ -2757,6 +2772,7 @@ ...@@ -2757,6 +2772,7 @@
D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */, D00291892816CD4500C0573B /* DsCacheUtils.m in Sources */,
D07DAC902810546A0067A1BF /* DSImagePickerController.m in Sources */, D07DAC902810546A0067A1BF /* DSImagePickerController.m in Sources */,
D0E3564928F56115007190EE /* BaseTableViewCell.m in Sources */, D0E3564928F56115007190EE /* BaseTableViewCell.m in Sources */,
D0FE45C828FFCC640020710A /* ArticleModel.m in Sources */,
D070A78E28DF02DE0039C5A7 /* DynamicViewModel.m in Sources */, D070A78E28DF02DE0039C5A7 /* DynamicViewModel.m in Sources */,
D0A1C49228C2084B000975DC /* ArticleRequestModel.m in Sources */, D0A1C49228C2084B000975DC /* ArticleRequestModel.m in Sources */,
D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */, D0DF90AE2814390000FC0F64 /* BannerModel.m in Sources */,
...@@ -2883,6 +2899,7 @@ ...@@ -2883,6 +2899,7 @@
D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */, D0A72E42282B8BA600EED7BE /* CourseMusicCell.m in Sources */,
D02B7E5C28E2A28500218EF7 /* ComDynamicCell.m in Sources */, D02B7E5C28E2A28500218EF7 /* ComDynamicCell.m in Sources */,
D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */, D0A72E39282B566200EED7BE /* HomeBasicCell.m in Sources */,
D0FE45CB28FFD2CD0020710A /* ArticleCell.m in Sources */,
D091E665283F0C4800D3279E /* ScoreTaskRequestModel.m in Sources */, D091E665283F0C4800D3279E /* ScoreTaskRequestModel.m in Sources */,
D01BD42B282C03FC00BA86B3 /* NoiseAudioModel.m in Sources */, D01BD42B282C03FC00BA86B3 /* NoiseAudioModel.m in Sources */,
D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */, D01814EE28002DC700583D4E /* HeaderDataModel.m in Sources */,
...@@ -2896,6 +2913,7 @@ ...@@ -2896,6 +2913,7 @@
D07DACA92810557D0067A1BF /* UIImage+RSKImageCropper.m in Sources */, D07DACA92810557D0067A1BF /* UIImage+RSKImageCropper.m in Sources */,
D053D0E828F41FB300BB2B84 /* MessageComReplyCell.m in Sources */, D053D0E828F41FB300BB2B84 /* MessageComReplyCell.m in Sources */,
D01DC95A28702F270035B78B /* RankViewCell.m in Sources */, D01DC95A28702F270035B78B /* RankViewCell.m in Sources */,
D0FE45CE28FFE8E20020710A /* ConfirmBox.m in Sources */,
D0B5ECC827F2E97A003EDFE3 /* MacroFuncUtil.m in Sources */, D0B5ECC827F2E97A003EDFE3 /* MacroFuncUtil.m in Sources */,
D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */, D055BEB928250D3400BC11A4 /* CourseCollectionCell.m in Sources */,
D01814E227FFDBB800583D4E /* HomeHeaderView.m in Sources */, D01814E227FFDBB800583D4E /* HomeHeaderView.m in Sources */,
......
...@@ -40,11 +40,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -40,11 +40,6 @@ NS_ASSUME_NONNULL_BEGIN
/// 社区动态cell内容(不展开)和社区详情cell内容(全部展开)展开标识 /// 社区动态cell内容(不展开)和社区详情cell内容(全部展开)展开标识
@property (nonatomic, assign) DynModelType modelType; @property (nonatomic, assign) DynModelType modelType;
/// 我的动态编辑状态
@property (nonatomic, assign) BOOL isEdited;
/// 我的动态选中状态
@property (nonatomic, assign) BOOL selected;
+ (UIFont *)contentFont; + (UIFont *)contentFont;
+ (CGFloat)contentMargin:(DynModelType)type; + (CGFloat)contentMargin:(DynModelType)type;
- (NSAttributedString *)contentAttriStr; - (NSAttributedString *)contentAttriStr;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
typedef void(^TapInformBlock)(void); typedef void(^TapInformBlock)(void);
typedef void(^TapLikeBlock)(void); typedef void(^TapLikeBlock)(void);
typedef void(^TapRemarkBlock)(void); typedef void(^TapRemarkBlock)(void);
typedef void(^TapSelectBlock)(BOOL selected); typedef void(^TapDeleteBlock)(void);
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
...@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) TapInformBlock tapInformBlock; @property (nonatomic, copy) TapInformBlock tapInformBlock;
@property (nonatomic, copy) TapLikeBlock tapLikeBlock; @property (nonatomic, copy) TapLikeBlock tapLikeBlock;
@property (nonatomic, copy) TapRemarkBlock tapRemarkBlock; @property (nonatomic, copy) TapRemarkBlock tapRemarkBlock;
@property (nonatomic, copy) TapSelectBlock tapSelectBlock; @property (nonatomic, copy) TapDeleteBlock tapDeleteBlock;
/// 启动点赞动画 /// 启动点赞动画
- (void)fireLikeAnimate; - (void)fireLikeAnimate;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
@property (nonatomic, strong) UILabel *contentLab; @property (nonatomic, strong) UILabel *contentLab;
@property (nonatomic, strong) LikeButton *likeBtn; @property (nonatomic, strong) LikeButton *likeBtn;
@property (nonatomic, strong) UIButton *remarkCountBtn; @property (nonatomic, strong) UIButton *remarkCountBtn;
@property (nonatomic, strong) UIButton *selectBtn; @property (nonatomic, strong) UIButton *deleteBtn;
@property (nonatomic, strong) NSMutableArray *photos; @property (nonatomic, strong) NSMutableArray *photos;
@end @end
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
self.informBtn.hidden = YES; self.informBtn.hidden = YES;
self.remarkCountBtn.userInteractionEnabled = NO; self.remarkCountBtn.userInteractionEnabled = NO;
[self.contentView addSubview:self.selectBtn]; [self.contentView addSubview:self.deleteBtn];
[self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) { [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView).offset(-self.margin); make.right.equalTo(self.contentView).offset(-self.margin);
make.top.equalTo(self.contentView).offset(self.margin); make.top.equalTo(self.contentView).offset(self.margin);
}]; }];
...@@ -119,7 +119,6 @@ ...@@ -119,7 +119,6 @@
self.contentLab.attributedText = [model contentAttriStr]; self.contentLab.attributedText = [model contentAttriStr];
[self.likeBtn updateLikeBtnState:model.isLike likeCount:model.likeCount]; [self.likeBtn updateLikeBtnState:model.isLike likeCount:model.likeCount];
[self.remarkCountBtn setTitle:[NSString stringWithFormat:@"%d", model.remarkCount] forState:UIControlStateNormal]; [self.remarkCountBtn setTitle:[NSString stringWithFormat:@"%d", model.remarkCount] forState:UIControlStateNormal];
self.selectBtn.hidden = !model.isEdited;
[self.contentLab mas_remakeConstraints:^(MASConstraintMaker *make) { [self.contentLab mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.userIcon.mas_bottom).offset(12); make.top.equalTo(self.userIcon.mas_bottom).offset(12);
...@@ -174,11 +173,9 @@ ...@@ -174,11 +173,9 @@
[browser showFromVC:self.ds_viewController]; [browser showFromVC:self.ds_viewController];
} }
- (void)selectAction:(UIButton *)sender { - (void)deleteBtnAction {
sender.selected = !sender.selected; if (self.tapDeleteBlock) {
self.tapDeleteBlock();
if (self.tapSelectBlock) {
self.tapSelectBlock(sender.selected);
} }
} }
...@@ -265,15 +262,13 @@ ...@@ -265,15 +262,13 @@
return _remarkCountBtn; return _remarkCountBtn;
} }
- (UIButton *)selectBtn { - (UIButton *)deleteBtn {
if (!_selectBtn) { if (!_deleteBtn) {
_selectBtn = [UIButton new]; _deleteBtn = [UIButton new];
_selectBtn.hidden = YES; [_deleteBtn addTarget:self action:@selector(deleteBtnAction) forControlEvents:UIControlEventTouchUpInside];
[_selectBtn addTarget:self action:@selector(selectAction:) forControlEvents:UIControlEventTouchUpInside]; [_deleteBtn dk_setImage:DKImagePickerWithNames(@"delete_feed_icon", @"dk_delete_feed_icon", @"delete_feed_icon") forState:UIControlStateNormal];
[_selectBtn dk_setImage:DKImagePickerWithNames(@"ic_person_xuanze", @"dk_ic_person_xuanze", @"ic_person_xuanze") forState:UIControlStateNormal];
[_selectBtn dk_setImage:DKImagePickerWithNames(@"ic_person_xuanzhong", @"dk_ic_person_xuanzhong", @"ic_person_xuanzhong") forState:UIControlStateSelected];
} }
return _selectBtn; return _deleteBtn;
} }
@end @end
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
} }
} else { } else {
ReplyListController *replyList = [ReplyListController new]; ReplyListController *replyList = [ReplyListController new];
replyList.commentID = (int)[self.messageCenterVM getUserCommentIDWithIndexPath:indexPath];
[self.navigationController pushViewController:replyList animated:YES]; [self.navigationController pushViewController:replyList animated:YES];
} }
} }
......
...@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSInteger talkID; @property (nonatomic, assign) NSInteger talkID;
/// 评论id /// 评论id
@property (nonatomic, assign) NSInteger commentID; @property (nonatomic, assign) NSInteger commentID;
/// 0:动态评论 1 评论回复 /// 0:动态评论 1:评论回复
@property (nonatomic, assign) NSInteger type; @property (nonatomic, assign) NSInteger type;
/// 发布评论或回复的用户 Id /// 发布评论或回复的用户 Id
@property (nonatomic, assign) NSInteger userID; @property (nonatomic, assign) NSInteger userID;
......
...@@ -24,6 +24,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -24,6 +24,10 @@ NS_ASSUME_NONNULL_BEGIN
/// @param userMessageModel 消息model /// @param userMessageModel 消息model
/// @param completion completion /// @param completion completion
+ (NSURLSessionDataTask *)userReplyCommentWithContent:(NSString *)content userMessageModel:(id)userMessageModel completion:(void (^)(MessageCenterViewModel *requestModel))completion; + (NSURLSessionDataTask *)userReplyCommentWithContent:(NSString *)content userMessageModel:(id)userMessageModel completion:(void (^)(MessageCenterViewModel *requestModel))completion;
/// 获取消息中心评论回复用户评论id
/// @param indexPath indexPath
- (NSInteger)getUserCommentIDWithIndexPath:(NSIndexPath *)indexPath;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -93,6 +93,12 @@ ...@@ -93,6 +93,12 @@
}]; }];
} }
- (NSInteger)getUserCommentIDWithIndexPath:(NSIndexPath *)indexPath {
NSArray *userNotiList = self.messageListArr[indexPath.section];
MessageComReplyModel *model = userNotiList[indexPath.row];
return model.commentID;
}
#pragma mark - private #pragma mark - private
- (NSURLSessionDataTask *)queryUserMessageCountWithCompletion:(void (^)(MessageCenterViewModel *requestModel))completion { - (NSURLSessionDataTask *)queryUserMessageCountWithCompletion:(void (^)(MessageCenterViewModel *requestModel))completion {
MessageCenterViewModel *requestModel = [MessageCenterViewModel new]; MessageCenterViewModel *requestModel = [MessageCenterViewModel new];
......
//
// ConfirmBox.h
// DreamSleep
//
// Created by peter on 2022/10/19.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol ConfirmBoxDelegate <NSObject>
/// 执行确认删除操作
/// @param indexPath indexPath
- (void)excuteDeleteAction:(NSIndexPath *)indexPath;
@end
/// 确认框
@interface ConfirmBox : UIView
@property (nonatomic, weak) id<ConfirmBoxDelegate> delegate;
- (instancetype)initWithDelegate:(id<ConfirmBoxDelegate>)delegate;
- (void)showConfirmBox:(NSIndexPath *)indexPath;
- (void)dismiss;
@end
NS_ASSUME_NONNULL_END
//
// ConfirmBox.m
// DreamSleep
//
// Created by peter on 2022/10/19.
//
#import "ConfirmBox.h"
@interface ConfirmBox ()
@property (nonatomic, strong) UIView *alertView;
@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UILabel *detailLab;
@property (nonatomic, strong) UIButton *cancelBtn;
@property (nonatomic, strong) UIButton *sureBtn;
@end
@implementation ConfirmBox {
NSIndexPath * _tmpIndexPath;
}
- (instancetype)initWithDelegate:(id<ConfirmBoxDelegate>)delegate {
if (self = [super initWithFrame:[UIScreen mainScreen].bounds]) {
_delegate = delegate;
self.backgroundColor = ColorFromHexA(0x161E38, .6);
[self addSubview:self.alertView];
[self.alertView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self);
make.width.equalTo(@280);
make.height.equalTo(@174);
}];
}
return self;
}
#pragma mark - public
- (void)showConfirmBox:(NSIndexPath *)indexPath {
_tmpIndexPath = indexPath;
[DSKeyWindow addSubview:self];
}
- (void)dismiss {
[self removeFromSuperview];
}
#pragma mark - private
- (void)sureAction {
if (self.delegate && [self.delegate respondsToSelector:@selector(excuteDeleteAction:)]) {
[self.delegate excuteDeleteAction:_tmpIndexPath];
}
}
#pragma mark - lazy
- (UIView *)alertView {
if (!_alertView) {
_alertView = [UIView new];
[_alertView cornerRadius:24.0];
_alertView.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
[_alertView addSubview:self.titleLab];
[_alertView addSubview:self.detailLab];
[_alertView addSubview:self.cancelBtn];
[_alertView addSubview:self.sureBtn];
UIView *line = [UIView new];
line.dk_backgroundColorPicker = DKColorPickerWithColors(ColorFromHex(0xE6E6E6), DarkColor, DSWhite);
[_alertView addSubview:line];
[self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(_alertView);
make.top.equalTo(_alertView).offset(20);
}];
[self.detailLab mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(_alertView);
make.top.equalTo(_alertView).offset(62);
}];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.bottom.equalTo(_alertView);
make.height.equalTo(@64);
}];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(_alertView);
make.centerY.equalTo(self.cancelBtn);
make.size.mas_equalTo(CGSizeMake(1, 40));
}];
[self.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.bottom.equalTo(_alertView);
make.width.height.equalTo(self.cancelBtn);
make.left.equalTo(self.cancelBtn.mas_right);
}];
}
return _alertView;
}
- (UILabel *)titleLab {
if (!_titleLab) {
_titleLab = [UILabel labWithText:@"提示" font:BoldFont(16) fit:YES];
_titleLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
_titleLab.textAlignment = NSTextAlignmentCenter;
}
return _titleLab;
}
- (UILabel *)detailLab {
if (!_detailLab) {
_detailLab = [UILabel labWithText:@"您确定要删除该动态吗?" font:SysFont(15) fit:YES];
_detailLab.dk_textColorPicker = DKColorPickerWithKey(Dk_TITLE);
_detailLab.textAlignment = NSTextAlignmentCenter;
}
return _detailLab;
}
- (UIButton *)cancelBtn {
if (!_cancelBtn) {
_cancelBtn = [UIButton btnWithTitle:@"取消" font:SysFont(15)];
[_cancelBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
[_cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
}
return _cancelBtn;
}
- (UIButton *)sureBtn {
if (!_sureBtn) {
_sureBtn = [UIButton btnWithTitle:@"确定" font:SysFont(15)];
[_sureBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
[_sureBtn addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside];
}
return _sureBtn;
}
@end
...@@ -30,33 +30,6 @@ ...@@ -30,33 +30,6 @@
self.offset = 1; self.offset = 1;
self.navigationItem.title = @"我的动态"; self.navigationItem.title = @"我的动态";
self.edgesForExtendedLayout = UIRectEdgeNone; self.edgesForExtendedLayout = UIRectEdgeNone;
UIButton *manageBtn = [UIButton btnWithTitle:@"管理" font:BoldFont(15)];
[manageBtn dk_setTitleColorPicker:DKColorPickerWithColors(DSWhite, DkTitleColor, DSWhite) forState:UIControlStateNormal];
[manageBtn addTarget:self action:@selector(manageAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:manageBtn];
}
- (void)testDynDeleteAPI {
#warning - 测试删除接口
self.myDynVM = [PersonDynViewModel new];
self.myDynVM.oper_type = @"comment";
self.myDynVM.delete_id = 18;
[self.myDynVM communityDeleteOperationWithCompletion:^(PersonDynViewModel * _Nonnull requestModel) {
if (requestModel.resCode == DSResCodeSuccess) {
[self.myDynVM deleteComDynWithDynamicID:self.myDynVM.delete_id];
[self.myDynamicView updateListView];
} else {
[DSProgressHUD showToast:requestModel.errMessage];
}
}];
}
#pragma mark - private
- (void)manageAction {
[self.myDynVM beginEditMode];
[self.myDynamicView updateListView];
} }
#pragma mark - MyDynamicViewDelegate #pragma mark - MyDynamicViewDelegate
...@@ -116,6 +89,22 @@ ...@@ -116,6 +89,22 @@
}]; }];
} }
- (void)startDeleteDynamicRquest:(int)dynamicID {
self.myDynVM.oper_type = @"dynamic";
self.myDynVM.delete_id = dynamicID;
[DSProgressHUD showProgressHUDWithInfo:@""];
[self.myDynVM communityDeleteOperationWithCompletion:^(PersonDynViewModel * _Nonnull requestModel) {
[DSProgressHUD dissmissProgressHUD];
if (requestModel.resCode == DSResCodeSuccess) {
[self.myDynVM deleteComDynWithDynamicID:self.myDynVM.delete_id];
[self.myDynamicView deleteSuccess];
[self.myDynamicView updateListView];
} else {
[DSProgressHUD showToast:requestModel.errMessage];
}
}];
}
#pragma mark - DynamicDetailControllerDelegate #pragma mark - DynamicDetailControllerDelegate
- (void)updateLikeOrRemark { - (void)updateLikeOrRemark {
[self.myDynamicView updateListView]; [self.myDynamicView updateListView];
......
...@@ -23,6 +23,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -23,6 +23,10 @@ NS_ASSUME_NONNULL_BEGIN
/// @param comDynModel 动态数据model /// @param comDynModel 动态数据model
/// @param cell cell /// @param cell cell
- (void)didTapLikeItem:(ComDynModel *)comDynModel cell:(ComDynamicCell *)cell; - (void)didTapLikeItem:(ComDynModel *)comDynModel cell:(ComDynamicCell *)cell;
/// 删除动态请求
/// @param dynamicID 动态id
- (void)startDeleteDynamicRquest:(int)dynamicID;
@end @end
/// 我的动态主视图 /// 我的动态主视图
...@@ -43,6 +47,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -43,6 +47,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 更新列表 /// 更新列表
- (void)updateListView; - (void)updateListView;
/// 删除成功取消确认框
- (void)deleteSuccess;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
// //
#import "MyDynamicView.h" #import "MyDynamicView.h"
#import "ConfirmBox.h"
@interface MyDynamicView () <UITableViewDelegate, UITableViewDataSource> @interface MyDynamicView () <UITableViewDelegate, UITableViewDataSource, ConfirmBoxDelegate>
@property (nonatomic, strong) UITableView *listView; @property (nonatomic, strong) UITableView *listView;
@property (nonatomic, strong) PersonDynViewModel *myDynVM; @property (nonatomic, strong) PersonDynViewModel *myDynVM;
@property (nonatomic, strong) UIView *deleteView; @property (nonatomic, strong) ConfirmBox *deleteConfirmBox;
@property (nonatomic, strong) UIButton *allSelectBtn;
@end @end
@implementation MyDynamicView @implementation MyDynamicView
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG); self.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
[self addSubview:self.listView]; [self addSubview:self.listView];
// [self addSubview:self.deleteView];
} }
return self; return self;
} }
...@@ -56,9 +55,17 @@ ...@@ -56,9 +55,17 @@
[self.listView reloadData]; [self.listView reloadData];
} }
#pragma mark - private - (void)deleteSuccess {
- (void)allSelectAction { [self.deleteConfirmBox dismiss];
}
#pragma mark - ConfirmBoxDelegate
- (void)excuteDeleteAction:(NSIndexPath *)indexPath {
ComDynModel *model = self.myDynVM.listArr[indexPath.section];
if (self.delegate && [self.delegate respondsToSelector:@selector(startDeleteDynamicRquest:)]) {
[self.delegate startDeleteDynamicRquest:model.dynamicID];
}
} }
#pragma mark - UITableViewDelegate, UITableViewDataSource #pragma mark - UITableViewDelegate, UITableViewDataSource
...@@ -108,8 +115,8 @@ ...@@ -108,8 +115,8 @@
cell.tapRemarkBlock = ^{ cell.tapRemarkBlock = ^{
[weakSelf tableView:tableView didSelectRowAtIndexPath:indexPath]; [weakSelf tableView:tableView didSelectRowAtIndexPath:indexPath];
}; };
cell.tapSelectBlock = ^(BOOL selected) { cell.tapDeleteBlock = ^{
[weakSelf.myDynVM updateMyDynamicModel:model selected:selected]; [weakSelf.deleteConfirmBox showConfirmBox:indexPath];
}; };
return cell; return cell;
} }
...@@ -149,30 +156,11 @@ ...@@ -149,30 +156,11 @@
return _listView; return _listView;
} }
- (UIView *)deleteView { - (ConfirmBox *)deleteConfirmBox {
if (!_deleteView) { if (!_deleteConfirmBox) {
_deleteView = [UIView new]; _deleteConfirmBox = [[ConfirmBox alloc] initWithDelegate:self];
_deleteView.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
UIButton *allSelectBtn = [UIButton btnWithTitle:@"全选" font:SysFont(15)];
[allSelectBtn dk_setTitleColorPicker:DKColorPickerWithKey(Dk_TITLE) forState:UIControlStateNormal];
[allSelectBtn addTarget:self action:@selector(allSelectAction) forControlEvents:UIControlEventTouchUpInside];
[allSelectBtn dk_setImage:DKImagePickerWithNames(@"ic_person_xuanze", @"dk_ic_person_xuanze", @"ic_person_xuanze") forState:UIControlStateNormal];
[allSelectBtn dk_setImage:DKImagePickerWithNames(@"ic_person_xuanzhong", @"dk_ic_person_xuanzhong", @"ic_person_xuanzhong") forState:UIControlStateSelected];
allSelectBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 7);
[_deleteView addSubview:allSelectBtn];
self.allSelectBtn = allSelectBtn;
UIButton *deleteBtn = [UIButton btnWithTitle:@"删除" font:BoldFont(18)];
[deleteBtn dk_setTitleColorPicker:DKColorPickerWithKey(Sub_Navi_TITLE) forState:UIControlStateNormal];
deleteBtn.dk_backgroundColorPicker = DKColorPickerWithKey(BrandBG);
[_deleteView addSubview:deleteBtn];
[allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
}];
} }
return _deleteView; return _deleteConfirmBox;
} }
@end @end
...@@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN
dynamic:删除动态 comment:删除评论 reply:删除回复 dynamic:删除动态 comment:删除评论 reply:删除回复
*/ */
@property (nonatomic, copy) NSString *oper_type; @property (nonatomic, copy) NSString *oper_type;
/* /*
被删除对象id 被删除对象id
动态Id 评论Id 回复Id 动态Id 评论Id 回复Id
...@@ -42,12 +41,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -42,12 +41,6 @@ NS_ASSUME_NONNULL_BEGIN
/// 删除个人社区动态 /// 删除个人社区动态
/// @param dynamicID 动态id /// @param dynamicID 动态id
- (void)deleteComDynWithDynamicID:(int)dynamicID; - (void)deleteComDynWithDynamicID:(int)dynamicID;
/// 开启编辑模式
- (void)beginEditMode;
- (void)updateMyDynamicModel:(id)model selected:(BOOL)selected;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -70,15 +70,4 @@ ...@@ -70,15 +70,4 @@
self.listArr = tmpListArr.copy; self.listArr = tmpListArr.copy;
} }
- (void)beginEditMode {
[self.listArr enumerateObjectsUsingBlock:^(ComDynModel * obj, NSUInteger idx, BOOL * _Nonnull stop) {
obj.isEdited = YES;
}];
}
- (void)updateMyDynamicModel:(id)model selected:(BOOL)selected {
ComDynModel *obj = model;
obj.selected = selected;
}
@end @end
{
"images" : [
{
"filename" : "dk_ic_person_xuanze.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ic_person_xuanze@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ic_person_xuanze@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "dk_ic_person_xuanzhong.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "dk_ic_person_xuanzhong@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "dk_ic_person_xuanzhong@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_ai_jianyi_sel.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_ai_jianyi_sel@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_ai_jianyi_sel@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_ai_jianyi_unsel.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_ai_jianyi_unsel@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_ai_jianyi_unsel@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_person_xuanze.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_person_xuanze@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_person_xuanze@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_person_xuanzhong.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_person_xuanzhong@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_person_xuanzhong@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!