Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 267a0e14
由
cgx
编写于
2022-10-09 18:28:22 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
完成动态评论页面及评论回复列表页面
1 个父辈
15d26e9d
隐藏空白字符变更
内嵌
并排
正在显示
26 个修改的文件
包含
917 行增加
和
70 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Class/CommunityModule/Controller/DynamicDetailController.m
DreamSleep/DreamSleep/Class/CommunityModule/Controller/ReplyListController.h
DreamSleep/DreamSleep/Class/CommunityModule/Controller/ReplyListController.m
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.h
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.m
DreamSleep/DreamSleep/Class/CommunityModule/Model/CommentModel.h
DreamSleep/DreamSleep/Class/CommunityModule/Model/CommentModel.m
DreamSleep/DreamSleep/Class/CommunityModule/Model/ReplyModel.h
DreamSleep/DreamSleep/Class/CommunityModule/Model/ReplyModel.m
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.h
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.m
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicDetailView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicDetailView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/InteractView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/InteractView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/MajorCommentCell.h
DreamSleep/DreamSleep/Class/CommunityModule/View/MajorCommentCell.m
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyCell.h
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyCell.m
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyDetailView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyDetailView.m
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInputAlertView.h
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInputAlertView.m
DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/ComDetailViewModel.h
DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/ComDetailViewModel.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
267a0e1
...
@@ -146,6 +146,10 @@
...
@@ -146,6 +146,10 @@
D0878F4F280C087E005F1B7F /* LoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0878F4E280C087E005F1B7F /* LoginController.m */; };
D0878F4F280C087E005F1B7F /* LoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = D0878F4E280C087E005F1B7F /* LoginController.m */; };
D08DBF742864099100681FD4 /* UnityFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0FFCD402853421900A01707 /* UnityFramework.framework */; };
D08DBF742864099100681FD4 /* UnityFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0FFCD402853421900A01707 /* UnityFramework.framework */; };
D08DBF752864099100681FD4 /* UnityFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D0FFCD402853421900A01707 /* UnityFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D08DBF752864099100681FD4 /* UnityFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D0FFCD402853421900A01707 /* UnityFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D08EE4A928F2C82D00B76FF9 /* ReplyListController.m in Sources */ = {isa = PBXBuildFile; fileRef = D08EE4A828F2C82D00B76FF9 /* ReplyListController.m */; };
D08EE4AC28F2CB1500B76FF9 /* ReplyDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = D08EE4AB28F2CB1500B76FF9 /* ReplyDetailView.m */; };
D08EE4AF28F2CFC300B76FF9 /* MajorCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D08EE4AE28F2CFC300B76FF9 /* MajorCommentCell.m */; };
D08EE4B228F2CFD300B76FF9 /* ReplyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D08EE4B128F2CFD300B76FF9 /* ReplyCell.m */; };
D08F79E6281A198E000D99DD /* FeedImageCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D08F79E5281A198E000D99DD /* FeedImageCollectionCell.m */; };
D08F79E6281A198E000D99DD /* FeedImageCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D08F79E5281A198E000D99DD /* FeedImageCollectionCell.m */; };
D091BBB72808F9DA00487A50 /* BreathTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D091BBB62808F9DA00487A50 /* BreathTextView.m */; };
D091BBB72808F9DA00487A50 /* BreathTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D091BBB62808F9DA00487A50 /* BreathTextView.m */; };
D091BBBB2809079600487A50 /* NSString+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D091BBBA2809079600487A50 /* NSString+Extras.m */; };
D091BBBB2809079600487A50 /* NSString+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = D091BBBA2809079600487A50 /* NSString+Extras.m */; };
...
@@ -556,6 +560,14 @@
...
@@ -556,6 +560,14 @@
D0878F4B280BEFF9005F1B7F /* UILabel+YBAttributeTextTapAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+YBAttributeTextTapAction.m"; sourceTree = "<group>"; };
D0878F4B280BEFF9005F1B7F /* UILabel+YBAttributeTextTapAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+YBAttributeTextTapAction.m"; sourceTree = "<group>"; };
D0878F4D280C087E005F1B7F /* LoginController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginController.h; sourceTree = "<group>"; };
D0878F4D280C087E005F1B7F /* LoginController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginController.h; sourceTree = "<group>"; };
D0878F4E280C087E005F1B7F /* LoginController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginController.m; sourceTree = "<group>"; };
D0878F4E280C087E005F1B7F /* LoginController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginController.m; sourceTree = "<group>"; };
D08EE4A728F2C82D00B76FF9 /* ReplyListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReplyListController.h; sourceTree = "<group>"; };
D08EE4A828F2C82D00B76FF9 /* ReplyListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReplyListController.m; sourceTree = "<group>"; };
D08EE4AA28F2CB1500B76FF9 /* ReplyDetailView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReplyDetailView.h; sourceTree = "<group>"; };
D08EE4AB28F2CB1500B76FF9 /* ReplyDetailView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReplyDetailView.m; sourceTree = "<group>"; };
D08EE4AD28F2CFC300B76FF9 /* MajorCommentCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MajorCommentCell.h; sourceTree = "<group>"; };
D08EE4AE28F2CFC300B76FF9 /* MajorCommentCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MajorCommentCell.m; sourceTree = "<group>"; };
D08EE4B028F2CFD300B76FF9 /* ReplyCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReplyCell.h; sourceTree = "<group>"; };
D08EE4B128F2CFD300B76FF9 /* ReplyCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReplyCell.m; sourceTree = "<group>"; };
D08F79E4281A198E000D99DD /* FeedImageCollectionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedImageCollectionCell.h; sourceTree = "<group>"; };
D08F79E4281A198E000D99DD /* FeedImageCollectionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedImageCollectionCell.h; sourceTree = "<group>"; };
D08F79E5281A198E000D99DD /* FeedImageCollectionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedImageCollectionCell.m; sourceTree = "<group>"; };
D08F79E5281A198E000D99DD /* FeedImageCollectionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedImageCollectionCell.m; sourceTree = "<group>"; };
D091BBB52808F9DA00487A50 /* BreathTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BreathTextView.h; sourceTree = "<group>"; };
D091BBB52808F9DA00487A50 /* BreathTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BreathTextView.h; sourceTree = "<group>"; };
...
@@ -1498,6 +1510,12 @@
...
@@ -1498,6 +1510,12 @@
D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */,
D0078C5728E13A1200054804 /* MKPPlaceholderTextView.m */,
D0078C6D28E19C9F00054804 /* TextInputAlertView.h */,
D0078C6D28E19C9F00054804 /* TextInputAlertView.h */,
D0078C6E28E19C9F00054804 /* TextInputAlertView.m */,
D0078C6E28E19C9F00054804 /* TextInputAlertView.m */,
D08EE4AA28F2CB1500B76FF9 /* ReplyDetailView.h */,
D08EE4AB28F2CB1500B76FF9 /* ReplyDetailView.m */,
D08EE4AD28F2CFC300B76FF9 /* MajorCommentCell.h */,
D08EE4AE28F2CFC300B76FF9 /* MajorCommentCell.m */,
D08EE4B028F2CFD300B76FF9 /* ReplyCell.h */,
D08EE4B128F2CFD300B76FF9 /* ReplyCell.m */,
);
);
path = View;
path = View;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1521,6 +1539,8 @@
...
@@ -1521,6 +1539,8 @@
D070A78728DEED640039C5A7 /* DynamicController.m */,
D070A78728DEED640039C5A7 /* DynamicController.m */,
D0078C5928E13D4C00054804 /* DynamicDetailController.h */,
D0078C5928E13D4C00054804 /* DynamicDetailController.h */,
D0078C5A28E13D4C00054804 /* DynamicDetailController.m */,
D0078C5A28E13D4C00054804 /* DynamicDetailController.m */,
D08EE4A728F2C82D00B76FF9 /* ReplyListController.h */,
D08EE4A828F2C82D00B76FF9 /* ReplyListController.m */,
D02B7E6028E2D33900218EF7 /* comList.plist */,
D02B7E6028E2D33900218EF7 /* comList.plist */,
);
);
path = Controller;
path = Controller;
...
@@ -2503,6 +2523,7 @@
...
@@ -2503,6 +2523,7 @@
D07A4B2D280EA73B00BA0EC0 /* UserInfoView.m in Sources */,
D07A4B2D280EA73B00BA0EC0 /* UserInfoView.m in Sources */,
D0878F48280BD18F005F1B7F /* LoginView.m in Sources */,
D0878F48280BD18F005F1B7F /* LoginView.m in Sources */,
D0A75111282E3D0D00589B0E /* NoisePlayCell.m in Sources */,
D0A75111282E3D0D00589B0E /* NoisePlayCell.m in Sources */,
D08EE4AC28F2CB1500B76FF9 /* ReplyDetailView.m in Sources */,
D0E660052807D02C006562F2 /* UserRequestModel.m in Sources */,
D0E660052807D02C006562F2 /* UserRequestModel.m in Sources */,
D0F82286280C44D10039F586 /* SetTableView.m in Sources */,
D0F82286280C44D10039F586 /* SetTableView.m in Sources */,
D0930F1B2801874B006B497A /* UINavigationController+Pop.m in Sources */,
D0930F1B2801874B006B497A /* UINavigationController+Pop.m in Sources */,
...
@@ -2512,6 +2533,7 @@
...
@@ -2512,6 +2533,7 @@
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */,
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */,
D037B11228752A7E00236753 /* IndividualController.m in Sources */,
D037B11228752A7E00236753 /* IndividualController.m in Sources */,
D037B1172875635F00236753 /* DarwArcView.swift in Sources */,
D037B1172875635F00236753 /* DarwArcView.swift in Sources */,
D08EE4A928F2C82D00B76FF9 /* ReplyListController.m in Sources */,
D0078C5B28E13D4C00054804 /* DynamicDetailController.m in Sources */,
D0078C5B28E13D4C00054804 /* DynamicDetailController.m in Sources */,
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D091E671283F2E6F00D3279E /* ScoreDetailListController.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
D07DACAB2810557D0067A1BF /* RSKImageScrollView.m in Sources */,
...
@@ -2533,6 +2555,7 @@
...
@@ -2533,6 +2555,7 @@
D04B3DAC27F6EEB50022F8DF /* DSTabBarController.m in Sources */,
D04B3DAC27F6EEB50022F8DF /* DSTabBarController.m in Sources */,
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D0AEFE822817DD1500230DC6 /* MyFeedListController.m in Sources */,
D043A8BC287EC71400226176 /* RingingTools.m in Sources */,
D043A8BC287EC71400226176 /* RingingTools.m in Sources */,
D08EE4B228F2CFD300B76FF9 /* ReplyCell.m in Sources */,
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */,
D055BEC828252D8200BC11A4 /* AudioCourseCell.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D0AEFE7C2817D13400230DC6 /* UITableViewCell+CardRadius.m in Sources */,
D01DC957287023C20035B78B /* RankHeadView.m in Sources */,
D01DC957287023C20035B78B /* RankHeadView.m in Sources */,
...
@@ -2577,6 +2600,7 @@
...
@@ -2577,6 +2600,7 @@
D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */,
D0506B1B2805500E00229278 /* SafeHelperCollectionViewCell.m in Sources */,
D0DB33A828224D5100E15914 /* PromotionModel.m in Sources */,
D0DB33A828224D5100E15914 /* PromotionModel.m in Sources */,
D055BECB28252E4000BC11A4 /* SubAudioModel.m in Sources */,
D055BECB28252E4000BC11A4 /* SubAudioModel.m in Sources */,
D08EE4AF28F2CFC300B76FF9 /* MajorCommentCell.m in Sources */,
D02B7E6428E2D76D00218EF7 /* ComListViewModel.m in Sources */,
D02B7E6428E2D76D00218EF7 /* ComListViewModel.m in Sources */,
D01814DC27FFD92200583D4E /* DSDataSource.m in Sources */,
D01814DC27FFD92200583D4E /* DSDataSource.m in Sources */,
D0A1C48D28C1A42A000975DC /* TestFlutterController.m in Sources */,
D0A1C48D28C1A42A000975DC /* TestFlutterController.m in Sources */,
...
...
DreamSleep/DreamSleep/Class/CommunityModule/Controller/DynamicDetailController.m
查看文件 @
267a0e1
...
@@ -8,9 +8,11 @@
...
@@ -8,9 +8,11 @@
#import "DynamicDetailController.h"
#import "DynamicDetailController.h"
#import "DynamicDetailView.h"
#import "DynamicDetailView.h"
#import "ComDetailViewModel.h"
#import "ComDetailViewModel.h"
#import "ReplyListController.h"
@interface
DynamicDetailController
()
<
DynamicDetailViewDelegate
>
@interface
DynamicDetailController
()
<
DynamicDetailViewDelegate
>
@property
(
nonatomic
,
strong
)
DynamicDetailView
*
detailView
;
@property
(
nonatomic
,
strong
)
DynamicDetailView
*
detailView
;
@property
(
nonatomic
,
strong
)
ComDetailViewModel
*
comDetailViewModel
;
@end
@end
@implementation
DynamicDetailController
@implementation
DynamicDetailController
...
@@ -24,11 +26,12 @@
...
@@ -24,11 +26,12 @@
self
.
navigationItem
.
title
=
@"正文"
;
self
.
navigationItem
.
title
=
@"正文"
;
self
.
comDetailViewModel
=
[
ComDetailViewModel
new
];
[
self
.
detailView
updateBottomView
:
self
.
comDynModel
];
[
self
.
detailView
updateBottomView
:
self
.
comDynModel
];
[
C
omDetailViewModel
queryDynamicCommentListWithTalkID
:
self
.
comDynModel
.
dynamicID
completion
:
^
(
ComDetailViewModel
*
_Nonnull
requestModel
)
{
[
self
.
c
omDetailViewModel
queryDynamicCommentListWithTalkID
:
self
.
comDynModel
.
dynamicID
completion
:
^
(
ComDetailViewModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
DSLog
(
@"groupDatas:%@"
,
requestModel
.
groupDatas
.
yy_modelDescription
);
[
self
.
detailView
updateDetailView
:
requestModel
.
groupDatas
];
[
self
.
detailView
updateDetailView
:
requestModel
.
groupDatas
];
}
else
{
}
else
{
...
@@ -37,7 +40,27 @@
...
@@ -37,7 +40,27 @@
}
}
#pragma mark - DynamicDetailViewDelegate
#pragma mark - DynamicDetailViewDelegate
-
(
void
)
fireCommentOrReply
:
(
NSInteger
)
tag
content
:
(
NSString
*
)
content
{
if
(
tag
==
1
)
{
// 发布评论
[
DSProgressHUD
showProgressHUDWithInfo
:
@""
];
[
self
.
comDetailViewModel
userCommentDynamicWithTalkID
:
self
.
comDynModel
.
dynamicID
content
:
content
completion
:^
(
ComDetailViewModel
*
_Nonnull
requestModel
)
{
[
DSProgressHUD
dissmissProgressHUD
];
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
[
self
.
detailView
updateCommentSection
:
requestModel
.
groupDatas
];
}
else
{
}
}];
}
else
if
(
tag
==
2
)
{
// 回复评论
}
}
-
(
void
)
jumpReplyListView
:
(
int
)
commentID
{
ReplyListController
*
replyList
=
[
ReplyListController
new
];
replyList
.
commentID
=
commentID
;
[
self
.
navigationController
pushViewController
:
replyList
animated
:
YES
];
}
#pragma mark - 品牌模式
#pragma mark - 品牌模式
-
(
NaviStyle
)
navigationBarStyle
{
-
(
NaviStyle
)
navigationBarStyle
{
...
...
DreamSleep/DreamSleep/Class/CommunityModule/Controller/ReplyListController.h
0 → 100644
查看文件 @
267a0e1
//
// ReplyListController.h
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// 评论回复列表页面
@interface
ReplyListController
:
UIViewController
@property
(
nonatomic
,
assign
)
int
commentID
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Controller/ReplyListController.m
0 → 100644
查看文件 @
267a0e1
//
// ReplyListController.m
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import "ReplyListController.h"
#import "ReplyDetailView.h"
#import "ComDetailViewModel.h"
@interface
ReplyListController
()
<
ReplyDetailViewDelegate
>
@property
(
nonatomic
,
strong
)
ReplyDetailView
*
replyDetailView
;
@property
(
nonatomic
,
strong
)
ComDetailViewModel
*
comDetailViewModel
;
@end
@implementation
ReplyListController
-
(
void
)
loadView
{
self
.
view
=
self
.
replyDetailView
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
navigationItem
.
title
=
@"评论详情页"
;
self
.
comDetailViewModel
=
[
ComDetailViewModel
new
];
[
self
.
comDetailViewModel
queryCommentRelpyListWithCommentID
:
self
.
commentID
completion
:
^
(
ComDetailViewModel
*
_Nonnull
requestModel
)
{
if
(
requestModel
.
resCode
==
DSResCodeSuccess
)
{
[
self
.
replyDetailView
updateReplyDetailView
:
requestModel
.
replyGroupDatas
];
}
}];
}
#pragma mark - ReplyDetailViewDelegate
#pragma mark - 品牌模式
-
(
NaviStyle
)
navigationBarStyle
{
return
NaviStyleDefault
;
}
#pragma mark - lazy
-
(
ReplyDetailView
*
)
replyDetailView
{
if
(
!
_replyDetailView
)
{
_replyDetailView
=
[[
ReplyDetailView
alloc
]
initWithDelegate
:
self
];
}
return
_replyDetailView
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.h
查看文件 @
267a0e1
...
@@ -9,18 +9,37 @@
...
@@ -9,18 +9,37 @@
#import "CommentModel.h"
#import "CommentModel.h"
#import "ReplyModel.h"
#import "ReplyModel.h"
#define kContentLeftMargin 84
#define kContentRightMargin 30
#define kMaxContentHeight 40
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXTERN
UIFont
*
const
CommentContentFont
;
/// 评论回复model
/// 评论回复model
@interface
ComReplyModel
:
NSObject
@interface
ComReplyModel
:
NSObject
/// 评论model
/// 评论model
@property
(
nonatomic
,
strong
)
CommentModel
*
commentModel
;
@property
(
nonatomic
,
strong
)
CommentModel
*
commentModel
;
/// 回复model
/// 回复model
@property
(
nonatomic
,
strong
)
ReplyModel
*
replyModel
;
@property
(
nonatomic
,
strong
)
ReplyModel
*
replyModel
;
/// 是否展开全部评论内容
@property
(
nonatomic
,
assign
)
BOOL
isShowAllCommentContent
;
-
(
NSString
*
)
replyNickName
;
+
(
UIFont
*
)
commentContentFont
;
+
(
UIFont
*
)
replayNickNameFont
;
+
(
UIFont
*
)
replayContentFont
;
-
(
CGFloat
)
commentContentHeight
;
-
(
CGFloat
)
commentContentHeight
;
-
(
CGFloat
)
showAllBtnHeight
;
-
(
CGFloat
)
replayNickNameW
;
-
(
CGSize
)
replayContentSize
;
-
(
CGFloat
)
replyViewHeight
;
-
(
CGFloat
)
replyViewHeight
;
-
(
CGFloat
)
commentCellHeight
;
-
(
CGFloat
)
commentCellHeight
;
-
(
BOOL
)
isHiddenShowAllBtn
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Model/ComReplyModel.m
查看文件 @
267a0e1
...
@@ -15,22 +15,49 @@
...
@@ -15,22 +15,49 @@
};
};
}
}
-
(
NSString
*
)
replyNickName
{
return
[
NSString
stringWithFormat
:
@"%@:"
,
self
.
replyModel
.
nick_name
];
}
+
(
UIFont
*
)
commentContentFont
{
return
SysFont
(
14
);
}
+
(
UIFont
*
)
replayNickNameFont
{
return
SysFont
(
15
);
}
+
(
UIFont
*
)
replayContentFont
{
return
SysFont
(
14
);
}
-
(
CGFloat
)
commentContentHeight
{
-
(
CGFloat
)
commentContentHeight
{
CGFloat
contentW
=
kScreenWidth
-
84
-
30
;
CGFloat
contentW
=
kScreenWidth
-
kContentLeftMargin
-
kContentRightMargin
;
NSString
*
content
=
self
.
commentModel
.
content
;
NSString
*
content
=
self
.
commentModel
.
content
;
CGFloat
commentH
=
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
SysFont
(
14
)];
CGFloat
commentH
=
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
[
ComReplyModel
commentContentFont
]];
return
commentH
>=
40
?
40
:
commentH
;
return
self
.
isShowAllCommentContent
?
commentH
:
(
commentH
>
kMaxContentHeight
?
kMaxContentHeight
:
commentH
);
}
-
(
CGFloat
)
showAllBtnHeight
{
return
[
self
isHiddenShowAllBtn
]
?
0
:
10
;
}
-
(
CGFloat
)
replayNickNameW
{
CGFloat
replayNameLabW
=
[
UILabel
getWidthWithText
:[
self
replyNickName
]
font
:[
ComReplyModel
replayNickNameFont
]];
return
replayNameLabW
>
75
?
75
:
replayNameLabW
;
}
-
(
CGSize
)
replayContentSize
{
CGFloat
replayContentW
=
kScreenWidth
-
kContentLeftMargin
-
kContentRightMargin
-
[
self
replayNickNameW
]
-
16
;
CGFloat
replayContentH
=
[
UILabel
getHeightByWidth
:
replayContentW
text
:
self
.
replyModel
.
content
font
:
[
ComReplyModel
replayContentFont
]];
replayContentH
=
replayContentH
>
kMaxContentHeight
?
:
replayContentH
;
return
CGSizeMake
(
replayContentW
,
replayContentH
);
}
}
-
(
CGFloat
)
replyViewHeight
{
-
(
CGFloat
)
replyViewHeight
{
CGFloat
replayViewH
=
0
;
CGFloat
replayViewH
=
0
;
if
(
self
.
replyModel
)
{
if
(
self
.
replyModel
)
{
CGFloat
replayNickNameW
=
[
UILabel
getWidthWithText
:
self
.
replyModel
.
nick_name
font
:
SysFont
(
15
)];
replayViewH
=
9
+
[
self
replayContentSize
].
height
+
(
self
.
commentModel
.
total_replys
>
1
?
37
:
9
);
replayNickNameW
=
replayNickNameW
>
75
?
75
:
replayNickNameW
;
CGFloat
replayContentW
=
kScreenWidth
-
84
-
30
-
replayNickNameW
-
16
;
CGFloat
replayContentH
=
[
UILabel
getHeightByWidth
:
replayContentW
text
:
self
.
replyModel
.
content
font
:
SysFont
(
14
)];
replayContentH
=
replayContentH
>=
40
?
40
:
replayContentH
;
replayViewH
=
9
+
replayContentH
+
37
;
}
}
return
replayViewH
;
return
replayViewH
;
}
}
...
@@ -40,7 +67,20 @@
...
@@ -40,7 +67,20 @@
CGFloat
commentH
=
[
self
commentContentHeight
];
CGFloat
commentH
=
[
self
commentContentHeight
];
CGFloat
replayViewH
=
[
self
replyViewHeight
]
+
(
self
.
replyModel
?
12
:
0
);
CGFloat
replayViewH
=
[
self
replyViewHeight
]
+
(
self
.
replyModel
?
12
:
0
);
CGFloat
bottomMargin
=
15
;
CGFloat
bottomMargin
=
15
;
return
topH
+
commentH
+
replayViewH
+
bottomMargin
;
CGFloat
showAllBtnH
=
[
self
showAllBtnHeight
];
return
topH
+
commentH
+
showAllBtnH
+
replayViewH
+
bottomMargin
;
}
-
(
BOOL
)
isHiddenShowAllBtn
{
if
(
self
.
isShowAllCommentContent
)
{
return
YES
;
}
// 只有评论没有回复并且评论内容只显示一部分,则"显示全部"按钮显示
CGFloat
contentW
=
kScreenWidth
-
kContentLeftMargin
-
kContentRightMargin
;
NSString
*
content
=
self
.
commentModel
.
content
;
CGFloat
commentH
=
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
[
ComReplyModel
commentContentFont
]];
BOOL
isGreaterMax
=
commentH
>
kMaxContentHeight
;
return
!
(
self
.
commentModel
&&
self
.
replyModel
==
nil
&&
isGreaterMax
);
}
}
@end
@end
DreamSleep/DreamSleep/Class/CommunityModule/Model/CommentModel.h
查看文件 @
267a0e1
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#define kContentMargin 30
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 评论数据model
/// 评论数据model
...
@@ -25,6 +27,10 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -25,6 +27,10 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
copy
)
NSString
*
user_profile
;
@property
(
nonatomic
,
copy
)
NSString
*
user_profile
;
/// 发布时间
/// 发布时间
@property
(
nonatomic
,
copy
)
NSString
*
publish_time
;
@property
(
nonatomic
,
copy
)
NSString
*
publish_time
;
+
(
UIFont
*
)
commentContentFont
;
-
(
CGFloat
)
commentContentHeight
;
-
(
CGFloat
)
cellHeight
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Model/CommentModel.m
查看文件 @
267a0e1
...
@@ -14,4 +14,18 @@
...
@@ -14,4 +14,18 @@
};
};
}
}
+
(
UIFont
*
)
commentContentFont
{
return
SysFont
(
14
);
}
-
(
CGFloat
)
commentContentHeight
{
CGFloat
contentW
=
kScreenWidth
-
kContentMargin
-
kContentMargin
;
NSString
*
content
=
self
.
content
;
return
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
[
CommentModel
commentContentFont
]];
}
-
(
CGFloat
)
cellHeight
{
return
67
+
[
self
commentContentHeight
]
+
15
;
}
@end
@end
DreamSleep/DreamSleep/Class/CommunityModule/Model/ReplyModel.h
查看文件 @
267a0e1
...
@@ -7,6 +7,9 @@
...
@@ -7,6 +7,9 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
#define kReplyLeftMargin 84
#define kReplyRightMargin 30
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 回复数据model
/// 回复数据model
...
@@ -21,6 +24,12 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -21,6 +24,12 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
assign
)
int
user_id
;
@property
(
nonatomic
,
assign
)
int
user_id
;
/// 头像
/// 头像
@property
(
nonatomic
,
copy
)
NSString
*
user_profile
;
@property
(
nonatomic
,
copy
)
NSString
*
user_profile
;
/// 回复时间
@property
(
nonatomic
,
copy
)
NSString
*
publish_time
;
+
(
UIFont
*
)
replayContentFont
;
-
(
CGFloat
)
replyContentHeight
;
-
(
CGFloat
)
cellHeight
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/Model/ReplyModel.m
查看文件 @
267a0e1
...
@@ -14,4 +14,18 @@
...
@@ -14,4 +14,18 @@
};
};
}
}
+
(
UIFont
*
)
replayContentFont
{
return
SysFont
(
14
);
}
-
(
CGFloat
)
replyContentHeight
{
CGFloat
contentW
=
kScreenWidth
-
kReplyLeftMargin
-
kReplyRightMargin
;
NSString
*
content
=
self
.
content
;
return
[
UILabel
getHeightByWidth
:
contentW
text
:
content
font
:
[
ReplyModel
replayContentFont
]];
}
-
(
CGFloat
)
cellHeight
{
return
48
+
[
self
replyContentHeight
]
+
15
;
}
@end
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.h
查看文件 @
267a0e1
...
@@ -8,11 +8,22 @@
...
@@ -8,11 +8,22 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "ComReplyModel.h"
#import "ComReplyModel.h"
/// 用户点击评论内容回调
typedef
void
(
^
TapCommentContentLabBlock
)(
void
);
/// 显示全部评论内容回调
typedef
void
(
^
TapAllCommentContentBlock
)(
void
);
/// 查看评论所有回复内容回调
typedef
void
(
^
LookAllRelpyListBlock
)(
void
);
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 评论、部分回复cell
/// 评论、部分回复cell
@interface
CommentCell
:
UITableViewCell
@interface
CommentCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
ComReplyModel
*
comReplyModel
;
@property
(
nonatomic
,
strong
)
ComReplyModel
*
comReplyModel
;
@property
(
nonatomic
,
copy
)
TapCommentContentLabBlock
tapCommentContentLabBlock
;
@property
(
nonatomic
,
copy
)
TapAllCommentContentBlock
tapAllCommentContentBlock
;
@property
(
nonatomic
,
copy
)
LookAllRelpyListBlock
lookAllRelpyListBlock
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/CommentCell.m
查看文件 @
267a0e1
...
@@ -11,8 +11,12 @@
...
@@ -11,8 +11,12 @@
@property
(
nonatomic
,
strong
)
UIImageView
*
userIcon
;
@property
(
nonatomic
,
strong
)
UIImageView
*
userIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
userNameLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
userNameLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
timeLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
timeLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
contentLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
commentContentLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
showAllBtn
;
@property
(
nonatomic
,
strong
)
UIView
*
replyView
;
@property
(
nonatomic
,
strong
)
UIView
*
replyView
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyUserLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyContentLab
;
@property
(
nonatomic
,
strong
)
UIButton
*
totalReplyBtn
;
@end
@end
@implementation
CommentCell
@implementation
CommentCell
...
@@ -21,11 +25,12 @@
...
@@ -21,11 +25,12 @@
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
[
self
.
contentView
addSubview
:
self
.
userIcon
];
[
self
.
contentView
addSubview
:
self
.
userIcon
];
[
self
.
contentView
addSubview
:
self
.
userNameLab
];
[
self
.
contentView
addSubview
:
self
.
userNameLab
];
[
self
.
contentView
addSubview
:
self
.
timeLab
];
[
self
.
contentView
addSubview
:
self
.
timeLab
];
[
self
.
contentView
addSubview
:
self
.
contentLab
];
[
self
.
contentView
addSubview
:
self
.
commentContentLab
];
[
self
.
contentView
addSubview
:
self
.
showAllBtn
];
[
self
.
contentView
addSubview
:
self
.
replyView
];
[
self
.
contentView
addSubview
:
self
.
replyView
];
[
self
.
userIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
userIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
...
@@ -52,19 +57,52 @@
...
@@ -52,19 +57,52 @@
[
self
.
userIcon
yy_setImageWithURL
:[
NSURL
URLWithString
:
comReplyModel
.
commentModel
.
user_profile
]
placeholder
:[
UIImage
defaultPlaceholderWithSize
:
CGSizeMake
(
40
,
40
)]];
[
self
.
userIcon
yy_setImageWithURL
:[
NSURL
URLWithString
:
comReplyModel
.
commentModel
.
user_profile
]
placeholder
:[
UIImage
defaultPlaceholderWithSize
:
CGSizeMake
(
40
,
40
)]];
self
.
userNameLab
.
text
=
comReplyModel
.
commentModel
.
nick_name
;
self
.
userNameLab
.
text
=
comReplyModel
.
commentModel
.
nick_name
;
self
.
timeLab
.
text
=
comReplyModel
.
commentModel
.
publish_time
;
self
.
timeLab
.
text
=
comReplyModel
.
commentModel
.
publish_time
;
self
.
contentLab
.
text
=
comReplyModel
.
commentModel
.
content
;
self
.
commentContentLab
.
text
=
comReplyModel
.
commentModel
.
content
;
self
.
showAllBtn
.
hidden
=
[
comReplyModel
isHiddenShowAllBtn
];
self
.
replyUserLab
.
text
=
[
comReplyModel
replyNickName
];
self
.
replyContentLab
.
text
=
comReplyModel
.
replyModel
.
content
;
[
self
.
totalReplyBtn
setTitle
:[
NSString
stringWithFormat
:
@"共%d条回复>"
,
comReplyModel
.
commentModel
.
total_replys
]
forState
:
UIControlStateNormal
];
self
.
totalReplyBtn
.
hidden
=
comReplyModel
.
commentModel
.
total_replys
>
1
?
NO
:
YES
;
[
self
.
contentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
co
mmentCo
ntentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
userIcon
.
mas_bottom
).
offset
(
8
);
make
.
top
.
equalTo
(
self
.
userIcon
.
mas_bottom
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
84
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
kContentLeftMargin
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
30
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
kContentRightMargin
);
make
.
height
.
equalTo
(
@
([
comReplyModel
commentContentHeight
]));
make
.
height
.
equalTo
(
@
([
comReplyModel
commentContentHeight
]));
}];
}];
[
self
.
showAllBtn
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
commentContentLab
.
mas_bottom
);
make
.
right
.
equalTo
(
self
.
commentContentLab
);
make
.
height
.
equalTo
(
@
([
comReplyModel
showAllBtnHeight
]));
}];
[
self
.
replyView
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
replyView
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
contentLab
.
mas_bottom
).
offset
(
12
);
make
.
top
.
equalTo
(
self
.
showAllBtn
.
mas_bottom
).
offset
(
12
);
make
.
left
.
right
.
equalTo
(
self
.
contentLab
);
make
.
left
.
right
.
equalTo
(
self
.
co
mmentCo
ntentLab
);
make
.
height
.
equalTo
(
@
([
comReplyModel
replyViewHeight
]));
make
.
height
.
equalTo
(
@
([
comReplyModel
replyViewHeight
]));
}];
}];
[
self
.
replyUserLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
replyView
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
replyView
).
offset
(
8
);
make
.
width
.
equalTo
(
@
([
comReplyModel
replayNickNameW
]));
}];
[
self
.
replyContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
replyView
).
offset
(
9
);
make
.
left
.
equalTo
(
self
.
replyUserLab
.
mas_right
);
make
.
size
.
mas_equalTo
([
comReplyModel
replayContentSize
]);
}];
[
self
.
totalReplyBtn
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
replyUserLab
);
make
.
bottom
.
equalTo
(
self
.
replyView
).
offset
(
-
8
);
}];
}
#pragma mark - private
-
(
void
)
popReplyInputView
{
if
(
self
.
tapCommentContentLabBlock
)
{
self
.
tapCommentContentLabBlock
();
}
}
}
#pragma mark - lazy
#pragma mark - lazy
...
@@ -93,13 +131,29 @@
...
@@ -93,13 +131,29 @@
return
_timeLab
;
return
_timeLab
;
}
}
-
(
UILabel
*
)
contentLab
{
-
(
UILabel
*
)
commentContentLab
{
if
(
!
_contentLab
)
{
if
(
!
_commentContentLab
)
{
_contentLab
=
[
UILabel
labWithFont
:
SysFont
(
14
)];
_commentContentLab
=
[
UILabel
labWithFont
:[
ComReplyModel
commentContentFont
]];
_contentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
_commentContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
_contentLab
.
numberOfLines
=
0
;
_commentContentLab
.
numberOfLines
=
0
;
_commentContentLab
.
userInteractionEnabled
=
YES
;
UITapGestureRecognizer
*
tapGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
popReplyInputView
)];
[
_commentContentLab
addGestureRecognizer
:
tapGR
];
}
return
_commentContentLab
;
}
-
(
UIButton
*
)
showAllBtn
{
if
(
!
_showAllBtn
)
{
WS
(
weakSelf
);
_showAllBtn
=
[
UIButton
btnWithTitle
:
@"显示全部"
titleColor
:
BrandColor
font
:
SysFont
(
10
)];
[
_showAllBtn
addTouchUpInsideHandler
:
^
(
NSInteger
tag
)
{
if
(
weakSelf
.
tapAllCommentContentBlock
)
{
weakSelf
.
tapAllCommentContentBlock
();
}
}];
}
}
return
_
contentLab
;
return
_
showAllBtn
;
}
}
-
(
UIView
*
)
replyView
{
-
(
UIView
*
)
replyView
{
...
@@ -107,6 +161,28 @@
...
@@ -107,6 +161,28 @@
_replyView
=
[
UIView
new
];
_replyView
=
[
UIView
new
];
[
_replyView
cornerRadius
:
12
];
[
_replyView
cornerRadius
:
12
];
_replyView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
CornerViewDarkColor
,
BGColor
);
_replyView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
CornerViewDarkColor
,
BGColor
);
UILabel
*
replyUserLab
=
[
UILabel
labWithFont
:[
ComReplyModel
replayNickNameFont
]];
replyUserLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SubTitleColor
,
DkTitleColor
,
DSWhite
);
[
_replyView
addSubview
:
replyUserLab
];
self
.
replyUserLab
=
replyUserLab
;
UILabel
*
replyContentLab
=
[
UILabel
labWithFont
:[
ComReplyModel
replayContentFont
]];
replyContentLab
.
numberOfLines
=
0
;
replyContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
[
_replyView
addSubview
:
replyContentLab
];
self
.
replyContentLab
=
replyContentLab
;
WS
(
weakSelf
);
UIButton
*
totalReplyBtn
=
[
UIButton
btnWithTitle
:
@""
font
:
SysFont
(
15
)];
[
totalReplyBtn
setTitleColor
:
BrandColor
forState
:
UIControlStateNormal
];
[
totalReplyBtn
addTouchUpInsideHandler
:
^
(
NSInteger
tag
)
{
if
(
weakSelf
.
lookAllRelpyListBlock
)
{
weakSelf
.
lookAllRelpyListBlock
();
}
}];
[
_replyView
addSubview
:
totalReplyBtn
];
self
.
totalReplyBtn
=
totalReplyBtn
;
}
}
return
_replyView
;
return
_replyView
;
}
}
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicDetailView.h
查看文件 @
267a0e1
...
@@ -11,6 +11,10 @@
...
@@ -11,6 +11,10 @@
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@protocol
DynamicDetailViewDelegate
<
NSObject
>
@protocol
DynamicDetailViewDelegate
<
NSObject
>
-
(
void
)
fireCommentOrReply
:
(
NSInteger
)
tag
content
:
(
NSString
*
)
content
;
/// 进入回复列表页
/// @param commentID 评论id
-
(
void
)
jumpReplyListView
:(
int
)
commentID
;
@end
@end
/// 动态详情自定义view
/// 动态详情自定义view
...
@@ -25,6 +29,10 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -25,6 +29,10 @@ NS_ASSUME_NONNULL_BEGIN
/// 更新动态详情页面
/// 更新动态详情页面
/// @param groupData 分组数据
/// @param groupData 分组数据
-
(
void
)
updateDetailView
:(
NSArray
*
)
groupData
;
-
(
void
)
updateDetailView
:(
NSArray
*
)
groupData
;
/// 更新评论区
/// @param groupData 分组数据
-
(
void
)
updateCommentSection
:(
NSArray
*
)
groupData
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/DynamicDetailView.m
查看文件 @
267a0e1
...
@@ -10,7 +10,10 @@
...
@@ -10,7 +10,10 @@
#import "ComDynamicCell.h"
#import "ComDynamicCell.h"
#import "CommentCell.h"
#import "CommentCell.h"
@interface
DynamicDetailView
()
<
UITableViewDelegate
,
UITableViewDataSource
>
#define kSectionHeaderHeight 48
#define kSectionFooterHeight 8
@interface
DynamicDetailView
()
<
UITableViewDelegate
,
UITableViewDataSource
,
InteractViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
dynamicDetailView
;
@property
(
nonatomic
,
strong
)
UITableView
*
dynamicDetailView
;
@property
(
nonatomic
,
strong
)
InteractView
*
interactView
;
@property
(
nonatomic
,
strong
)
InteractView
*
interactView
;
@property
(
nonatomic
,
strong
)
NSArray
*
detailListArr
;
@property
(
nonatomic
,
strong
)
NSArray
*
detailListArr
;
...
@@ -53,6 +56,21 @@
...
@@ -53,6 +56,21 @@
}
}
}
}
-
(
void
)
updateCommentSection
:(
NSArray
*
)
groupData
{
if
(
groupData
.
count
)
{
self
.
detailListArr
=
groupData
;
[
self
.
dynamicDetailView
reloadSections
:[
NSIndexSet
indexSetWithIndex
:
1
]
withRowAnimation
:
UITableViewRowAnimationNone
];
}
[
self
.
interactView
dismissKeyboard
];
}
#pragma mark - InteractViewDelegate
-
(
void
)
commentOrReply
:(
NSInteger
)
tag
content
:(
NSString
*
)
content
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
fireCommentOrReply
:
content
:
)])
{
[
self
.
delegate
fireCommentOrReply
:
tag
content
:
content
];
}
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
#pragma mark - UITableViewDelegate, UITableViewDataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
return
self
.
detailListArr
.
count
;
return
self
.
detailListArr
.
count
;
...
@@ -79,28 +97,36 @@
...
@@ -79,28 +97,36 @@
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForHeaderInSection
:(
NSInteger
)
section
{
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForHeaderInSection
:(
NSInteger
)
section
{
return
section
==
0
?
CGFLOAT_MIN
:
48
;
return
section
==
0
?
CGFLOAT_MIN
:
kSectionHeaderHeight
;
}
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
UIView
*
header
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
section
==
0
?
0
:
48
)];
UIView
*
header
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
0
)];
header
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
header
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
UILabel
*
secLab
=
[
UILabel
dkLabWithFont
:
BoldFont
(
15
)];
if
(
section
==
0
)
{
secLab
.
text
=
section
==
0
?
@""
:
@"全部评论(4)"
;
header
.
height
=
0
;
[
secLab
sizeToFit
];
}
else
{
secLab
.
origin
=
CGPointMake
(
30
,
15
);
UILabel
*
totalCommentCountLab
=
[
UILabel
labWithFont
:
BoldFont
(
15
)];
[
header
addSubview
:
secLab
];
totalCommentCountLab
.
dk_textColorPicker
=
DKColorPickerWithKey
(
Dk_TITLE
);
totalCommentCountLab
.
origin
=
CGPointMake
(
30
,
15
);
[
header
addSubview
:
totalCommentCountLab
];
header
.
height
=
kSectionHeaderHeight
;
NSArray
*
comment_reply_arr
=
self
.
detailListArr
[
section
];
totalCommentCountLab
.
text
=
comment_reply_arr
.
count
?
[
NSString
stringWithFormat
:
@"全部评论(%ld)"
,
comment_reply_arr
.
count
]
:
@"暂无评论"
;
[
totalCommentCountLab
sizeToFit
];
}
return
header
;
return
header
;
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForFooterInSection
:(
NSInteger
)
section
{
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForFooterInSection
:(
NSInteger
)
section
{
return
section
==
self
.
detailListArr
.
count
-
1
?
0
.
01
:
8
;
return
section
==
self
.
detailListArr
.
count
-
1
?
CGFLOAT_MIN
:
kSectionFooterHeight
;
}
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForFooterInSection
:(
NSInteger
)
section
{
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForFooterInSection
:(
NSInteger
)
section
{
UIView
*
footer
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
section
==
self
.
detailListArr
.
count
-
1
?
0
.
01
:
8
)];
UIView
*
footer
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
section
==
self
.
detailListArr
.
count
-
1
?
CGFLOAT_MIN
:
kSectionFooterHeight
)];
footer
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
AlertDarkColor
,
DSWhite
);
footer
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
AlertDarkColor
,
DSWhite
);
return
footer
;
return
footer
;
}
}
...
@@ -118,6 +144,32 @@
...
@@ -118,6 +144,32 @@
NSArray
*
comment_reply_arr
=
self
.
detailListArr
[
indexPath
.
section
];
NSArray
*
comment_reply_arr
=
self
.
detailListArr
[
indexPath
.
section
];
ComReplyModel
*
comReplyModel
=
comment_reply_arr
[
indexPath
.
row
];
ComReplyModel
*
comReplyModel
=
comment_reply_arr
[
indexPath
.
row
];
cell
.
comReplyModel
=
comReplyModel
;
cell
.
comReplyModel
=
comReplyModel
;
WS
(
weakSelf
);
cell
.
tapCommentContentLabBlock
=
^
{
/*
// 1、自己不能回复自己
if ([LoginUtils getUserID] == comReplyModel.commentModel.user_id) {
[DSProgressHUD showToast:@"不能对自己发布的评论进行回复!"];
return;
}
// 2、动态发布者才能进行回复
ComDynModel *talkModel = self.detailListArr[0];
if ([LoginUtils getUserID] == talkModel.userID) {
[weakSelf.interactView popReplyInputBoxWithCommentUser:comReplyModel.commentModel.nick_name];
} else {
[DSProgressHUD showToast:@"只有动态发布者才能回复!"];
}
*/
};
cell
.
tapAllCommentContentBlock
=
^
{
comReplyModel
.
isShowAllCommentContent
=
YES
;
[
weakSelf
.
dynamicDetailView
reloadSections
:[
NSIndexSet
indexSetWithIndex
:
1
]
withRowAnimation
:
UITableViewRowAnimationNone
];
};
cell
.
lookAllRelpyListBlock
=
^
{
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
jumpReplyListView
:)])
{
[
self
.
delegate
jumpReplyListView
:
comReplyModel
.
commentModel
.
comment_id
];
}
};
return
cell
;
return
cell
;
}
}
}
}
...
@@ -133,7 +185,7 @@
...
@@ -133,7 +185,7 @@
_dynamicDetailView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
_dynamicDetailView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
[
_dynamicDetailView
registerClass
:[
CommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
CommentCell
class
])];
[
_dynamicDetailView
registerClass
:[
CommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
CommentCell
class
])];
_dynamicDetailView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
_dynamicDetailView
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
0
.
1
)];
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
CGFLOAT_MIN
)];
_dynamicDetailView
.
tableFooterView
=
footView
;
_dynamicDetailView
.
tableFooterView
=
footView
;
}
}
return
_dynamicDetailView
;
return
_dynamicDetailView
;
...
@@ -142,6 +194,7 @@
...
@@ -142,6 +194,7 @@
-
(
InteractView
*
)
interactView
{
-
(
InteractView
*
)
interactView
{
if
(
!
_interactView
)
{
if
(
!
_interactView
)
{
_interactView
=
[
InteractView
new
];
_interactView
=
[
InteractView
new
];
_interactView
.
delegate
=
self
;
}
}
return
_interactView
;
return
_interactView
;
}
}
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/InteractView.h
查看文件 @
267a0e1
...
@@ -9,11 +9,23 @@
...
@@ -9,11 +9,23 @@
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
@protocol
InteractViewDelegate
<
NSObject
>
-
(
void
)
commentOrReply
:
(
NSInteger
)
tag
content
:
(
NSString
*
)
content
;
@end
/// 互动区域(点赞、评论)
/// 互动区域(点赞、评论)
@interface
InteractView
:
UIView
@interface
InteractView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
InteractViewDelegate
>
delegate
;
-
(
void
)
updateLikeCount
:(
int
)
likeCount
remarkCount
:(
int
)
remarkCount
;
-
(
void
)
updateLikeCount
:(
int
)
likeCount
remarkCount
:(
int
)
remarkCount
;
/// 弹出回复输入框
/// @param commentUser @评论者
-
(
void
)
popReplyInputBoxWithCommentUser
:(
NSString
*
)
commentUser
;
-
(
void
)
dismissKeyboard
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/InteractView.m
查看文件 @
267a0e1
...
@@ -55,6 +55,14 @@
...
@@ -55,6 +55,14 @@
[
self
.
remarkCountBtn
setTitle
:[
NSString
stringWithFormat
:
@"%d"
,
remarkCount
]
forState
:
UIControlStateNormal
];
[
self
.
remarkCountBtn
setTitle
:[
NSString
stringWithFormat
:
@"%d"
,
remarkCount
]
forState
:
UIControlStateNormal
];
}
}
-
(
void
)
popReplyInputBoxWithCommentUser
:
(
NSString
*
)
commentUser
{
[
self
.
textInputAlertView
showReplyTextAlertWithCommentUser
:
commentUser
];
}
-
(
void
)
dismissKeyboard
{
[
self
.
textInputAlertView
dismiss
];
}
#pragma mark - lazy
#pragma mark - lazy
-
(
UILabel
*
)
tapLab
{
-
(
UILabel
*
)
tapLab
{
if
(
!
_tapLab
)
{
if
(
!
_tapLab
)
{
...
@@ -91,7 +99,13 @@
...
@@ -91,7 +99,13 @@
-
(
TextInputAlertView
*
)
textInputAlertView
{
-
(
TextInputAlertView
*
)
textInputAlertView
{
if
(
!
_textInputAlertView
)
{
if
(
!
_textInputAlertView
)
{
WS
(
weakSelf
);
_textInputAlertView
=
[[
TextInputAlertView
alloc
]
initWithFrame
:[
UIScreen
mainScreen
].
bounds
];
_textInputAlertView
=
[[
TextInputAlertView
alloc
]
initWithFrame
:[
UIScreen
mainScreen
].
bounds
];
_textInputAlertView
.
tapFinishBlock
=
^
(
NSInteger
tag
,
NSString
*
content
)
{
if
(
weakSelf
.
delegate
&&
[
weakSelf
.
delegate
respondsToSelector
:
@selector
(
commentOrReply
:
content
:
)])
{
[
weakSelf
.
delegate
commentOrReply
:
tag
content
:
content
];
}
};
}
}
return
_textInputAlertView
;
return
_textInputAlertView
;
}
}
...
...
DreamSleep/DreamSleep/Class/CommunityModule/View/MajorCommentCell.h
0 → 100644
查看文件 @
267a0e1
//
// MajorCommentCell.h
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import <UIKit/UIKit.h>
#import "CommentModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 主评论cell
@interface
MajorCommentCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
CommentModel
*
commentModel
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/MajorCommentCell.m
0 → 100644
查看文件 @
267a0e1
//
// MajorCommentCell.m
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import "MajorCommentCell.h"
@interface
MajorCommentCell
()
@property
(
nonatomic
,
strong
)
UIImageView
*
userIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
userNameLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
timeLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
commentContentLab
;
@end
@implementation
MajorCommentCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
[
self
.
contentView
addSubview
:
self
.
userIcon
];
[
self
.
contentView
addSubview
:
self
.
userNameLab
];
[
self
.
contentView
addSubview
:
self
.
timeLab
];
[
self
.
contentView
addSubview
:
self
.
commentContentLab
];
[
self
.
userIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
30
);
make
.
top
.
equalTo
(
self
.
contentView
).
offset
(
15
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
40
,
40
));
}];
[
self
.
userNameLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
userIcon
.
mas_right
).
offset
(
14
);
make
.
top
.
equalTo
(
self
.
userIcon
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
30
);
}];
[
self
.
timeLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
userNameLab
);
make
.
bottom
.
equalTo
(
self
.
userIcon
);
}];
}
return
self
;
}
-
(
void
)
setCommentModel
:(
CommentModel
*
)
commentModel
{
_commentModel
=
commentModel
;
[
self
.
userIcon
yy_setImageWithURL
:[
NSURL
URLWithString
:
commentModel
.
user_profile
]
placeholder
:[
UIImage
defaultPlaceholderWithSize
:
CGSizeMake
(
40
,
40
)]];
self
.
userNameLab
.
text
=
commentModel
.
nick_name
;
self
.
timeLab
.
text
=
commentModel
.
publish_time
;
self
.
commentContentLab
.
text
=
commentModel
.
content
;
[
self
.
commentContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
userIcon
.
mas_bottom
).
offset
(
12
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
kContentMargin
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
kContentMargin
);
make
.
height
.
equalTo
(
@
([
commentModel
commentContentHeight
]));
}];
}
#pragma mark - lazy
-
(
UIImageView
*
)
userIcon
{
if
(
!
_userIcon
)
{
_userIcon
=
[
UIImageView
new
];
[
_userIcon
cornerRadius
:
20
];
_userIcon
.
dk_alphaPicker
=
DKAlphaPickerWithAlphas
(
1
.
f
,
0
.
5
f
,
0
.
1
f
);
}
return
_userIcon
;
}
-
(
UILabel
*
)
userNameLab
{
if
(
!
_userNameLab
)
{
_userNameLab
=
[
UILabel
labWithFont
:
BoldFont
(
15
)];
_userNameLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
DkTitleColor
,
DSWhite
);
}
return
_userNameLab
;
}
-
(
UILabel
*
)
timeLab
{
if
(
!
_timeLab
)
{
_timeLab
=
[
UILabel
labWithFont
:
SysFont
(
12
)];
_timeLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SmallTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
3
),
DSWhite
);
}
return
_timeLab
;
}
-
(
UILabel
*
)
commentContentLab
{
if
(
!
_commentContentLab
)
{
_commentContentLab
=
[
UILabel
labWithFont
:[
CommentModel
commentContentFont
]];
_commentContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
_commentContentLab
.
numberOfLines
=
0
;
}
return
_commentContentLab
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyCell.h
0 → 100644
查看文件 @
267a0e1
//
// ReplyCell.h
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import <UIKit/UIKit.h>
#import "ReplyModel.h"
NS_ASSUME_NONNULL_BEGIN
/// 回复cell
@interface
ReplyCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
ReplyModel
*
replyModel
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyCell.m
0 → 100644
查看文件 @
267a0e1
//
// ReplyCell.m
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import "ReplyCell.h"
@interface
ReplyCell
()
@property
(
nonatomic
,
strong
)
UIImageView
*
userIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
userNameLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
timeLab
;
@property
(
nonatomic
,
strong
)
UILabel
*
replyContentLab
;
@end
@implementation
ReplyCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
])
{
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
[
self
.
contentView
addSubview
:
self
.
userIcon
];
[
self
.
contentView
addSubview
:
self
.
userNameLab
];
[
self
.
contentView
addSubview
:
self
.
timeLab
];
[
self
.
contentView
addSubview
:
self
.
replyContentLab
];
[
self
.
userIcon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
30
);
make
.
top
.
equalTo
(
self
.
contentView
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
40
,
40
));
}];
[
self
.
userNameLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
userIcon
.
mas_right
).
offset
(
14
);
make
.
top
.
equalTo
(
self
.
userIcon
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
30
);
}];
[
self
.
timeLab
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
userNameLab
);
make
.
bottom
.
equalTo
(
self
.
userIcon
);
}];
}
return
self
;
}
-
(
void
)
setReplyModel
:(
ReplyModel
*
)
replyModel
{
_replyModel
=
replyModel
;
[
self
.
userIcon
yy_setImageWithURL
:[
NSURL
URLWithString
:
replyModel
.
user_profile
]
placeholder
:[
UIImage
defaultPlaceholderWithSize
:
CGSizeMake
(
40
,
40
)]];
self
.
userNameLab
.
text
=
replyModel
.
nick_name
;
self
.
timeLab
.
text
=
replyModel
.
publish_time
;
self
.
replyContentLab
.
text
=
replyModel
.
content
;
[
self
.
replyContentLab
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
userIcon
.
mas_bottom
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
kReplyLeftMargin
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
kReplyRightMargin
);
make
.
height
.
equalTo
(
@
([
replyModel
replyContentHeight
]));
}];
}
#pragma mark - lazy
-
(
UIImageView
*
)
userIcon
{
if
(
!
_userIcon
)
{
_userIcon
=
[
UIImageView
new
];
[
_userIcon
cornerRadius
:
20
];
_userIcon
.
dk_alphaPicker
=
DKAlphaPickerWithAlphas
(
1
.
f
,
0
.
5
f
,
0
.
1
f
);
}
return
_userIcon
;
}
-
(
UILabel
*
)
userNameLab
{
if
(
!
_userNameLab
)
{
_userNameLab
=
[
UILabel
labWithFont
:
BoldFont
(
15
)];
_userNameLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
DkTitleColor
,
DSWhite
);
}
return
_userNameLab
;
}
-
(
UILabel
*
)
timeLab
{
if
(
!
_timeLab
)
{
_timeLab
=
[
UILabel
labWithFont
:
SysFont
(
12
)];
_timeLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
SmallTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
3
),
DSWhite
);
}
return
_timeLab
;
}
-
(
UILabel
*
)
replyContentLab
{
if
(
!
_replyContentLab
)
{
_replyContentLab
=
[
UILabel
labWithFont
:[
ReplyModel
replayContentFont
]];
_replyContentLab
.
dk_textColorPicker
=
DKColorPickerWithColors
(
MainTextColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
),
DSWhite
);
_replyContentLab
.
numberOfLines
=
0
;
}
return
_replyContentLab
;
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyDetailView.h
0 → 100644
查看文件 @
267a0e1
//
// ReplyDetailView.h
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import <UIKit/UIKit.h>
@protocol
ReplyDetailViewDelegate
<
NSObject
>
@end
NS_ASSUME_NONNULL_BEGIN
/// 回复详情视图(主评论和该评论下所有回复)
@interface
ReplyDetailView
:
UITableView
@property
(
nonatomic
,
weak
)
id
<
ReplyDetailViewDelegate
>
replyDelegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
ReplyDetailViewDelegate
>
)
replyDelegate
;
/// 更新回复详情页面
/// @param replyGroupData 分组数据
-
(
void
)
updateReplyDetailView
:(
NSArray
*
)
replyGroupData
;
@end
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/ReplyDetailView.m
0 → 100644
查看文件 @
267a0e1
//
// ReplyDetailView.m
// DreamSleep
//
// Created by peter on 2022/10/9.
//
#import "ReplyDetailView.h"
#import "MajorCommentCell.h"
#import "ReplyCell.h"
#define kSectionHeaderHeight 48
#define kSectionFooterHeight 8
@interface
ReplyDetailView
()
<
UITableViewDelegate
,
UITableViewDataSource
>
@property
(
nonatomic
,
strong
)
NSArray
*
detailListArr
;
@end
@implementation
ReplyDetailView
-
(
instancetype
)
initWithDelegate
:(
id
<
ReplyDetailViewDelegate
>
)
replyDelegate
{
if
(
self
=
[
super
initWithFrame
:
CGRectZero
style
:
UITableViewStyleGrouped
])
{
self
.
replyDelegate
=
replyDelegate
;
self
.
detailListArr
=
[
NSArray
array
];
self
.
delegate
=
self
;
self
.
dataSource
=
self
;
self
.
backgroundColor
=
DSClearColor
;
self
.
showsVerticalScrollIndicator
=
NO
;
self
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
[
self
registerClass
:[
MajorCommentCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
MajorCommentCell
class
])];
[
self
registerClass
:[
ReplyCell
class
]
forCellReuseIdentifier
:
NSStringFromClass
([
ReplyCell
class
])];
self
.
contentInsetAdjustmentBehavior
=
UIScrollViewContentInsetAdjustmentNever
;
UIView
*
footView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
CGFLOAT_MIN
)];
self
.
tableFooterView
=
footView
;
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
}
return
self
;
}
#pragma mark - public
-
(
void
)
updateReplyDetailView
:(
NSArray
*
)
replyGroupData
{
if
(
replyGroupData
.
count
)
{
self
.
detailListArr
=
replyGroupData
;
[
self
reloadData
];
}
}
#pragma mark - UITableViewDelegate, UITableViewDataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
return
self
.
detailListArr
.
count
;
}
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
1
;
}
else
{
NSArray
*
replyList
=
self
.
detailListArr
[
section
];
return
replyList
.
count
;
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
CommentModel
*
commentModel
=
self
.
detailListArr
[
0
];
return
[
commentModel
cellHeight
];
}
else
{
NSArray
*
replyList
=
self
.
detailListArr
[
indexPath
.
section
];
ReplyModel
*
replyModel
=
replyList
[
indexPath
.
row
];
return
[
replyModel
cellHeight
];
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForHeaderInSection
:(
NSInteger
)
section
{
return
section
==
0
?
CGFLOAT_MIN
:
kSectionHeaderHeight
;
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
UIView
*
header
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
0
)];
header
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
if
(
section
==
0
)
{
header
.
height
=
0
;
}
else
{
UILabel
*
totalReplyCountLab
=
[
UILabel
labWithFont
:
BoldFont
(
15
)];
totalReplyCountLab
.
dk_textColorPicker
=
DKColorPickerWithKey
(
Dk_TITLE
);
totalReplyCountLab
.
origin
=
CGPointMake
(
30
,
15
);
[
header
addSubview
:
totalReplyCountLab
];
header
.
height
=
kSectionHeaderHeight
;
NSArray
*
replyList
=
self
.
detailListArr
[
section
];
totalReplyCountLab
.
text
=
replyList
.
count
?
[
NSString
stringWithFormat
:
@"全部回复(%ld)"
,
replyList
.
count
]
:
@"暂无回复"
;
[
totalReplyCountLab
sizeToFit
];
}
return
header
;
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForFooterInSection
:(
NSInteger
)
section
{
return
section
==
self
.
detailListArr
.
count
-
1
?
CGFLOAT_MIN
:
kSectionFooterHeight
;
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForFooterInSection
:(
NSInteger
)
section
{
UIView
*
footer
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
section
==
self
.
detailListArr
.
count
-
1
?
CGFLOAT_MIN
:
kSectionFooterHeight
)];
footer
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BGColor
,
AlertDarkColor
,
DSWhite
);
return
footer
;
}
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
MajorCommentCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
NSStringFromClass
([
MajorCommentCell
class
])
forIndexPath
:
indexPath
];
cell
.
commentModel
=
self
.
detailListArr
[
indexPath
.
section
];
return
cell
;
}
else
{
ReplyCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
NSStringFromClass
([
ReplyCell
class
])
forIndexPath
:
indexPath
];
NSArray
*
replyList
=
self
.
detailListArr
[
indexPath
.
section
];
ReplyModel
*
replyModel
=
replyList
[
indexPath
.
row
];
cell
.
replyModel
=
replyModel
;
return
cell
;
}
}
@end
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInputAlertView.h
查看文件 @
267a0e1
...
@@ -9,11 +9,19 @@
...
@@ -9,11 +9,19 @@
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 发布获取回复block
typedef
void
(
^
TapFinishBlock
)(
NSInteger
tag
,
NSString
*
content
);
/// 文本评论弹框
/// 文本评论弹框
@interface
TextInputAlertView
:
UIView
@interface
TextInputAlertView
:
UIView
@property
(
nonatomic
,
copy
)
TapFinishBlock
tapFinishBlock
;
-
(
void
)
showTextInputAlertView
;
-
(
void
)
showTextInputAlertView
;
-
(
void
)
showReplyTextAlertWithCommentUser
:(
NSString
*
)
commentUser
;
-
(
void
)
dismiss
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/View/TextInputAlertView.m
查看文件 @
267a0e1
...
@@ -15,13 +15,14 @@
...
@@ -15,13 +15,14 @@
@property
(
nonatomic
,
strong
)
UIButton
*
cancelBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
cancelBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
replyBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
replyBtn
;
@property
(
nonatomic
,
assign
)
CGFloat
duration
;
@property
(
nonatomic
,
assign
)
CGFloat
duration
;
@property
(
nonatomic
,
copy
)
NSString
*
commentUserFlag
;
@end
@end
@implementation
TextInputAlertView
@implementation
TextInputAlertView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
if
(
self
=
[
super
initWithFrame
:
frame
])
{
self
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHexA
(
0x161E38
,
.
6
),
DSClearColor
,
DSWhite
);
self
.
backgroundColor
=
ColorFromHexA
(
0x161E38
,
.
6
);
[
self
addSubview
:
self
.
alertView
];
[
self
addSubview
:
self
.
alertView
];
[
self
.
alertView
addSubview
:
self
.
cancelBtn
];
[
self
.
alertView
addSubview
:
self
.
cancelBtn
];
...
@@ -85,18 +86,36 @@
...
@@ -85,18 +86,36 @@
-
(
void
)
showTextInputAlertView
{
-
(
void
)
showTextInputAlertView
{
[
DSKeyWindow
addSubview
:
self
];
[
DSKeyWindow
addSubview
:
self
];
[
self
.
textView
becomeFirstResponder
];
[
self
.
textView
becomeFirstResponder
];
self
.
replyBtn
.
tag
=
1
;
[
self
.
replyBtn
setTitle
:
@"发布"
forState
:
UIControlStateNormal
];
}
-
(
void
)
showReplyTextAlertWithCommentUser
:
(
NSString
*
)
commentUser
{
[
self
showTextInputAlertView
];
self
.
replyBtn
.
tag
=
2
;
[
self
.
replyBtn
setTitle
:
@"回复"
forState
:
UIControlStateNormal
];
self
.
commentUserFlag
=
[
NSString
stringWithFormat
:
@"@%@,"
,
commentUser
];
self
.
textView
.
text
=
self
.
commentUserFlag
;
}
-
(
void
)
dismiss
{
[
self
cancelAction
];
}
}
#pragma mark - private
#pragma mark - private
-
(
void
)
cancelAction
{
-
(
void
)
cancelAction
{
[
self
.
textView
endEditing
:
YES
];
[
self
.
textView
endEditing
:
YES
];
self
.
textView
.
text
=
@""
;
}
}
-
(
void
)
replyAction
{
-
(
void
)
replyAction
:
(
UIButton
*
)
sender
{
// 1、调用回复接口
NSString
*
content
=
self
.
textView
.
text
;
if
(
sender
.
tag
==
2
)
{
// 2、隐藏输入框
content
=
[
content
componentsSeparatedByString
:
self
.
commentUserFlag
].
lastObject
;
[
self
.
textView
endEditing
:
YES
];
}
if
(
self
.
tapFinishBlock
)
{
self
.
tapFinishBlock
(
sender
.
tag
,
content
);
}
}
}
#pragma mark - lazy
#pragma mark - lazy
...
@@ -104,7 +123,7 @@
...
@@ -104,7 +123,7 @@
if
(
!
_alertView
)
{
if
(
!
_alertView
)
{
_alertView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
kScreenHeight
,
kScreenWidth
,
201
)];
_alertView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
kScreenHeight
,
kScreenWidth
,
201
)];
[
_alertView
setCornerRadiusRect
:
UIRectCornerTopLeft
|
UIRectCornerTopRight
cornerRadius
:
24
];
[
_alertView
setCornerRadiusRect
:
UIRectCornerTopLeft
|
UIRectCornerTopRight
cornerRadius
:
24
];
_alertView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
DarkColor
,
DSWhite
);
_alertView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
DSWhite
,
Alert
DarkColor
,
DSWhite
);
}
}
return
_alertView
;
return
_alertView
;
}
}
...
@@ -115,7 +134,7 @@
...
@@ -115,7 +134,7 @@
_textView
.
font
=
SysFont
(
14
);
_textView
.
font
=
SysFont
(
14
);
[
_textView
cornerRadius
:
12
];
[
_textView
cornerRadius
:
12
];
_textView
.
textContainerInset
=
UIEdgeInsetsMake
(
15
,
8
,
33
,
8
);
_textView
.
textContainerInset
=
UIEdgeInsetsMake
(
15
,
8
,
33
,
8
);
_textView
.
dk_textColorPicker
=
DKColorPickerWithColors
(
S
mallTextColor
,
DSWhite
,
DSWhite
);
_textView
.
dk_textColorPicker
=
DKColorPickerWithColors
(
S
ubTitleColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
)
,
DSWhite
);
_textView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHex
(
0xF0F0F0
),
CornerViewDarkColor
,
DSWhite
);
_textView
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
ColorFromHex
(
0xF0F0F0
),
CornerViewDarkColor
,
DSWhite
);
}
}
return
_textView
;
return
_textView
;
...
@@ -124,7 +143,7 @@
...
@@ -124,7 +143,7 @@
-
(
UIButton
*
)
cancelBtn
{
-
(
UIButton
*
)
cancelBtn
{
if
(
!
_cancelBtn
)
{
if
(
!
_cancelBtn
)
{
_cancelBtn
=
[
UIButton
btnWithTitle
:
@"取消"
font
:
SysFont
(
14
)];
_cancelBtn
=
[
UIButton
btnWithTitle
:
@"取消"
font
:
SysFont
(
14
)];
[
_cancelBtn
dk_setTitleColorPicker
:
DKColorPickerWithColors
(
SubTitleColor
,
DSWhite
,
DSWhite
)
forState
:
UIControlStateNormal
];
[
_cancelBtn
dk_setTitleColorPicker
:
DKColorPickerWithColors
(
SubTitleColor
,
ColorFromHexA
(
0xFFFFFF
,
.
5
)
,
DSWhite
)
forState
:
UIControlStateNormal
];
[
_cancelBtn
addTarget
:
self
action
:
@selector
(
cancelAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_cancelBtn
addTarget
:
self
action
:
@selector
(
cancelAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
}
return
_cancelBtn
;
return
_cancelBtn
;
...
@@ -132,9 +151,10 @@
...
@@ -132,9 +151,10 @@
-
(
UIButton
*
)
replyBtn
{
-
(
UIButton
*
)
replyBtn
{
if
(
!
_replyBtn
)
{
if
(
!
_replyBtn
)
{
_replyBtn
=
[
UIButton
btnWithTitle
:
@"回复"
titleColor
:
DSWhite
font
:
SysFont
(
12
)
bgColor
:
BrandColor
];
_replyBtn
=
[
UIButton
btnWithTitle
:
@"发布"
titleColor
:
DSWhite
font
:
SysFont
(
12
)];
_replyBtn
.
dk_backgroundColorPicker
=
DKColorPickerWithColors
(
BrandColor
,
SubNaviDarkColor
,
DSWhite
);
[
_replyBtn
cornerRadius
:
13
];
[
_replyBtn
cornerRadius
:
13
];
[
_replyBtn
addTarget
:
self
action
:
@selector
(
replyAction
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_replyBtn
addTarget
:
self
action
:
@selector
(
replyAction
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
}
return
_replyBtn
;
return
_replyBtn
;
}
}
...
...
DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/ComDetailViewModel.h
查看文件 @
267a0e1
...
@@ -15,16 +15,24 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -15,16 +15,24 @@ NS_ASSUME_NONNULL_BEGIN
/// 动态详情和评论回复分组数据
/// 动态详情和评论回复分组数据
@property
(
nonatomic
,
strong
)
NSArray
*
groupDatas
;
@property
(
nonatomic
,
strong
)
NSArray
*
groupDatas
;
/// 评论和所有回复列表分组数据
@property
(
nonatomic
,
strong
)
NSArray
*
replyGroupDatas
;
/// 查询动态评论列表接口
/// 查询动态评论列表接口
/// @param talkID 动态id
/// @param talkID 动态id
/// @param completion completion
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
queryDynamicCommentListWithTalkID
:(
int
)
talkID
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
;
-
(
NSURLSessionDataTask
*
)
queryDynamicCommentListWithTalkID
:(
int
)
talkID
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
;
/// 用户-发布评论接口
/// 用户-发布评论接口
/// @param talkID 动态id
/// @param talkID 动态id
/// @param content 评论内容
/// @param content 评论内容
/// @param completion completion
/// @param completion completion
+
(
NSURLSessionDataTask
*
)
userCommentDynamicWithTalkID
:(
int
)
talkID
content
:(
NSString
*
)
content
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
;
-
(
NSURLSessionDataTask
*
)
userCommentDynamicWithTalkID
:(
int
)
talkID
content
:(
NSString
*
)
content
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
;
/// 查询评论回复列表
/// @param commentID 动态评论id
/// @param completion completion
-
(
NSURLSessionDataTask
*
)
queryCommentRelpyListWithCommentID
:(
int
)
commentID
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
DreamSleep/DreamSleep/Class/CommunityModule/ViewModel/ComDetailViewModel.m
查看文件 @
267a0e1
...
@@ -13,13 +13,19 @@
...
@@ -13,13 +13,19 @@
@implementation
ComDetailViewModel
@implementation
ComDetailViewModel
+
(
NSURLSessionDataTask
*
)
queryDynamicCommentListWithTalkID
:(
int
)
talkID
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
{
-
(
instancetype
)
init
{
ComDetailViewModel
*
requestModel
=
[[
ComDetailViewModel
alloc
]
init
];
if
(
self
=
[
super
init
])
{
self
.
groupDatas
=
@[];
}
return
self
;
}
-
(
NSURLSessionDataTask
*
)
queryDynamicCommentListWithTalkID
:
(
int
)
talkID
completion
:
(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
{
NSString
*
api
=
@"query_dynamic_comment_list"
;
NSString
*
api
=
@"query_dynamic_comment_list"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@(talk_id:%d)}"
,
api
,
talkID
];
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@(talk_id:%d)}"
,
api
,
talkID
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
return
[
ComDetailViewModel
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"查询动态评论列表接口apiDic:%@"
,
apiDic
);
DSLog
(
@"查询动态评论列表接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
self
.
resCode
=
DSResCodeSuccess
;
NSDictionary
*
resultDic
=
apiDic
[
@"result"
];
NSDictionary
*
resultDic
=
apiDic
[
@"result"
];
ComDynModel
*
talkModel
=
[
ComDynModel
yy_modelWithDictionary
:
resultDic
[
@"talk"
]];
ComDynModel
*
talkModel
=
[
ComDynModel
yy_modelWithDictionary
:
resultDic
[
@"talk"
]];
NSArray
*
comment_list
=
resultDic
[
@"comment_list"
];
NSArray
*
comment_list
=
resultDic
[
@"comment_list"
];
...
@@ -29,27 +35,58 @@
...
@@ -29,27 +35,58 @@
ComReplyModel
*
comReplyModel
=
[
ComReplyModel
yy_modelWithDictionary
:
comment_reply_dic
];
ComReplyModel
*
comReplyModel
=
[
ComReplyModel
yy_modelWithDictionary
:
comment_reply_dic
];
[
tmpArr
addObject
:
comReplyModel
];
[
tmpArr
addObject
:
comReplyModel
];
}
}
requestModel
.
groupDatas
=
@[
talkModel
,
tmpArr
.
copy
];
self
.
groupDatas
=
@[
talkModel
,
tmpArr
.
copy
];
completion
(
requestModel
);
completion
(
self
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
self
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
self
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
completion
(
self
);
}];
}];
}
}
+
(
NSURLSessionDataTask
*
)
userCommentDynamicWithTalkID
:(
int
)
talkID
content
:(
NSString
*
)
content
completion
:(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
{
-
(
NSURLSessionDataTask
*
)
userCommentDynamicWithTalkID
:
(
int
)
talkID
content
:
(
NSString
*
)
content
completion
:
(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
{
ComDetailViewModel
*
requestModel
=
[[
ComDetailViewModel
alloc
]
init
];
NSString
*
api
=
@"user_comment_dynamic"
;
NSString
*
api
=
@"user_comment_dynamic"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(talk_id:%d,content:
%@
)}"
,
api
,
talkID
,
content
];
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"mutation{%@(talk_id:%d,content:
\"
%@
\"
)}"
,
api
,
talkID
,
content
];
return
[
self
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
return
[
ComDetailViewModel
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"用户-发布评论接口apiDic:%@"
,
apiDic
);
DSLog
(
@"用户-发布评论接口apiDic:%@"
,
apiDic
);
requestModel
.
resCode
=
DSResCodeSuccess
;
self
.
resCode
=
DSResCodeSuccess
;
completion
(
requestModel
);
NSDictionary
*
resultDic
=
apiDic
[
@"result"
];
CommentModel
*
commentModel
=
[
CommentModel
yy_modelWithDictionary
:
resultDic
];
// 插入新的评论数据
ComReplyModel
*
newComReplyModel
=
[[
ComReplyModel
alloc
]
init
];
newComReplyModel
.
commentModel
=
commentModel
;
ComDynModel
*
talkModel
=
self
.
groupDatas
.
firstObject
;
NSMutableArray
*
tmpArr
=
[
NSMutableArray
arrayWithArray
:
self
.
groupDatas
.
lastObject
];
[
tmpArr
addObject
:
newComReplyModel
];
self
.
groupDatas
=
@[
talkModel
,
tmpArr
.
copy
];
completion
(
self
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
self
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
self
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
self
);
}];
}
-
(
NSURLSessionDataTask
*
)
queryCommentRelpyListWithCommentID
:
(
int
)
commentID
completion
:
(
void
(
^
)(
ComDetailViewModel
*
requestModel
))
completion
{
NSString
*
api
=
@"query_comment_relpy_list"
;
NSString
*
argStr
=
[
NSString
stringWithFormat
:
@"query{%@(comment_id:%d)}"
,
api
,
commentID
];
return
[
ComDetailViewModel
httpPostBodyRequestWithAPI
:
api
params
:@{
@"query"
:
argStr
}
view
:
nil
hasNetActivity
:
YES
loadingInfo
:
nil
hasFailInfo
:
NO
success
:^
(
NSDictionary
*
_Nonnull
apiDic
)
{
DSLog
(
@"查询评论回复列表接口apiDic:%@"
,
apiDic
);
self
.
resCode
=
DSResCodeSuccess
;
NSDictionary
*
resultDic
=
apiDic
[
@"result"
];
CommentModel
*
commentModel
=
[
CommentModel
yy_modelWithDictionary
:
resultDic
[
@"comment"
]];
NSArray
*
reply_list
=
resultDic
[
@"reply_list"
];
NSMutableArray
*
tmpArr
=
[
NSMutableArray
array
];
for
(
int
i
=
0
;
i
<
reply_list
.
count
;
i
++
)
{
ReplyModel
*
replyModel
=
[
ReplyModel
yy_modelWithDictionary
:
reply_list
[
i
]];
[
tmpArr
addObject
:
replyModel
];
}
self
.
replyGroupDatas
=
@[
commentModel
,
tmpArr
.
copy
];
completion
(
self
);
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
}
failure
:^
(
id
_Nonnull
failureInfo
)
{
requestModel
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
self
.
resCode
=
[
failureInfo
[
@"errorCode"
]
integerValue
];
requestModel
.
errMessage
=
failureInfo
[
@"errMessage"
];
self
.
errMessage
=
failureInfo
[
@"errMessage"
];
completion
(
requestModel
);
completion
(
self
);
}];
}];
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论