This commit is contained in:
wu736139669
2015-06-15 12:31:13 +08:00
parent ec2d16a5a4
commit faba5b8c56
13 changed files with 451 additions and 113 deletions
@@ -1833,11 +1833,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Common/CommentTextView.m"
timestampString = "455127399.182315"
timestampString = "456026320.291568"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "26"
endingLineNumber = "26"
startingLineNumber = "27"
endingLineNumber = "27"
landmarkName = "-bgBtnClick:"
landmarkType = "5">
</BreakpointContent>
@@ -1849,31 +1849,15 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Common/CommentTextView.m"
timestampString = "455196891.607978"
timestampString = "456034433.97587"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "148"
endingLineNumber = "148"
startingLineNumber = "154"
endingLineNumber = "154"
landmarkName = "-dealloc"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Common/CommentTableViewCell.m"
timestampString = "455197912.272996"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "43"
endingLineNumber = "43"
landmarkName = "-setCommentInfoViewModel:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -2002,22 +1986,6 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Common/CommentTableViewCell.m"
timestampString = "455197912.272996"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "54"
endingLineNumber = "54"
landmarkName = "+getHeightWithCommentInfoViewModel:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -2210,5 +2178,309 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026339.189984"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "131"
endingLineNumber = "131"
landmarkName = "-loadData"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026339.990015"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "129"
endingLineNumber = "129"
landmarkName = "-loadData"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[NoteCommentViewController loadData]"
moduleName = "Ash_AWord"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/xmfish/Documents/Ash_Soft/Ash_AWord/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026763.384668"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "129"
endingLineNumber = "129"
offsetFromSymbolStart = "189">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__37-[NoteCommentViewController loadData]_block_invoke"
moduleName = "Ash_AWord"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/xmfish/Documents/Ash_Soft/Ash_AWord/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026763.384837"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "129"
endingLineNumber = "129"
offsetFromSymbolStart = "39">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026340.397798"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "128"
endingLineNumber = "128"
landmarkName = "-loadData"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Utility/Network/PropertyEntity.m"
timestampString = "456026464.148809"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "41"
endingLineNumber = "41"
landmarkName = "-encodePro"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026763.299717"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "106"
endingLineNumber = "106"
landmarkName = "-requirePraiseUser"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026804.166129"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "103"
endingLineNumber = "103"
landmarkName = "-requirePraiseUser"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026804.705981"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "104"
endingLineNumber = "104"
landmarkName = "-requirePraiseUser"
landmarkType = "5">
<Locations>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "-[NoteCommentViewController requirePraiseUser]"
moduleName = "Ash_AWord"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/xmfish/Documents/Ash_Soft/Ash_AWord/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456033561.177707"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "104"
endingLineNumber = "104"
offsetFromSymbolStart = "140">
</Location>
<Location
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "__46-[NoteCommentViewController requirePraiseUser]_block_invoke"
moduleName = "Ash_AWord"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/xmfish/Documents/Ash_Soft/Ash_AWord/Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456033561.177998"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "104"
endingLineNumber = "104"
offsetFromSymbolStart = "36">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456026862.111478"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "130"
endingLineNumber = "130"
landmarkName = "-loadData"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewModels/Common/CommentViewModel.m"
timestampString = "456031081.291809"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "56"
endingLineNumber = "56"
landmarkName = "+requireAddCommentWithReconrdId:withContent:WithType:withToUid:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456033743.821291"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "229"
endingLineNumber = "229"
landmarkName = "-tableView:didSelectRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456033875.922867"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "228"
endingLineNumber = "228"
landmarkName = "-tableView:didSelectRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Common/CommentTableViewCell.m"
timestampString = "456034084.470231"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "49"
endingLineNumber = "49"
landmarkName = "-setCommentInfoViewModel:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456034106.040482"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "221"
endingLineNumber = "221"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Note/NoteCommentViewController.m"
timestampString = "456034301.74356"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "37"
endingLineNumber = "37"
landmarkName = "-viewDidLoad"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Common/CommentTextView.m"
timestampString = "456034433.97587"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "120"
endingLineNumber = "120"
landmarkName = "-comment"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
+8
View File
@@ -71,7 +71,15 @@
*/
+(UIImage*)compressImageDownToPhoneScreenSize:(UIImage*)originImage;
/**
* 根据宽度计算htmlsize
*
* @param width控件宽度
* @return 大小size
*/
+(CGSize) calculateSizeWithHtmlstring:(NSString *)htmlstr limitWidth:(CGFloat)width withFontSize:(NSInteger)fontSize;
+(NSDictionary*)getHtmlDicWithFontSize:(NSInteger)fontSize;
@end
@interface UIFont (CustomFont)
+16 -2
View File
@@ -7,7 +7,7 @@
//
#import "Ash_UIUtil.h"
#import <DTCoreText.h>
@implementation Ash_UIUtil
+(CABasicAnimation*)getrotationAnimation
@@ -406,7 +406,21 @@
{
return kScreenWidth/320;
}
+(CGSize)calculateSizeWithHtmlstring:(NSString *)htmlstr limitWidth:(CGFloat)width withFontSize:(NSInteger)fontSize
{
NSDictionary* optionsDic = [Ash_UIUtil getHtmlDicWithFontSize:fontSize];
NSData *data = [htmlstr dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString *string = [[NSAttributedString alloc] initWithHTMLData:data options:optionsDic documentAttributes:nil];
DTAttributedTextContentView *attributedTextContextView = [[DTAttributedTextContentView alloc] initWithFrame:CGRectMake(0, 0, width, 500)];
attributedTextContextView.attributedString = string;
CGSize size = [attributedTextContextView suggestedFrameSizeToFitEntireStringConstraintedToWidth:width];
return size;
}
+(NSDictionary*)getHtmlDicWithFontSize:(NSInteger)fontSize
{
NSDictionary* optionsDic = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:kCTTextAlignmentLeft],DTDefaultTextAlignment,[UIColor blackColor],DTDefaultTextColor,[NSNumber numberWithInteger:fontSize], DTDefaultFontSize,[[UIFont appFontOfSize:1] fontName],DTDefaultFontName,[UIColor appMainColor],DTDefaultLinkColor, nil];
return optionsDic;
}
@end
@implementation UIFont (CustomFont)
@@ -88,6 +88,7 @@
}];
[self.view addSubview:_commentTextView];
_commentTextView.recordId = _text_image.messageId;
_commentTextView.aothourId = _text_image.ownerId;
[_commentTextView setHidden:YES];
@@ -124,7 +125,7 @@
{
[MobClick event:kUmen_note];
PropertyEntity* pro = [CommentViewModel requireLoadCommentWithRecordId:_text_image.messageId withPage:_page withPage_size:DefaultPageSize];
PropertyEntity* pro = [CommentViewModel requireLoadCommentWithRecordId:_text_image.messageId withPage:_page withPage_size:DefaultPageSize WithType:Image_Type];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
if ([viewModel success]) {
@@ -189,7 +190,11 @@
{
CommentInfoViewModel* commentInfoViewModel = [_commentInfoArr objectAtIndex:indexPath.row];
return [CommentTableViewCell getHeightWithCommentInfoViewModel:commentInfoViewModel];
BOOL isReplyOwnew = YES;
if (![commentInfoViewModel.toUserId isEqualToString:_text_image.ownerId]) {
isReplyOwnew = NO;
}
return [CommentTableViewCell getHeightWithCommentInfoViewModel:commentInfoViewModel isReplyOwner:isReplyOwnew];
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
@@ -213,11 +218,7 @@
}
CommentInfoViewModel* commentInfoViewModel = [_commentInfoArr objectAtIndex:indexPath.row];
if ([commentInfoViewModel.ownerId isEqualToString:_text_image.ownerId] ) {
[cell setIsAuthor:YES];
}else{
[cell setIsAuthor:NO];
}
cell.ownerId = _text_image.ownerId;
[cell setCommentInfoViewModel:commentInfoViewModel];
return cell;
@@ -225,6 +226,9 @@
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
CommentInfoViewModel* commentInfoViewModel = [_commentInfoArr objectAtIndex:indexPath.row];
[_commentTextView showWithUid:commentInfoViewModel.ownerId];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
@@ -242,7 +246,7 @@
*/
- (IBAction)commentBtnClick:(id)sender {
[_commentTextView show];
[_commentTextView showWithUid:_text_image.ownerId];
}
@end
@@ -19,7 +19,7 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="eGy-0s-zXs">
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="eGy-0s-zXs">
<rect key="frame" x="0.0" y="0.0" width="320" height="524"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tableView>
@@ -7,7 +7,10 @@
//
#import "BaseViewModel.h"
typedef enum{
Image_Type = 0,
Voice_Type = 1,
}CommentType;
@interface CommentInfoViewModel : BaseViewModel
@property (nonatomic, strong) NSString *commentId;
@property (nonatomic, strong) NSString *ownerId;
@@ -15,12 +18,15 @@
@property (nonatomic, strong) NSString *ownerName;
@property (nonatomic, strong) NSString *content;
@property (nonatomic, strong) NSString *createTime;
@property (nonatomic, strong) NSString *toUserId;
@property (nonatomic, strong) NSString *toUserName;
@property (nonatomic, assign) CommentType commentType;
@end
@interface CommentViewModel : BaseViewModel
@property (nonatomic, strong)NSArray* commentInfoArr;
+(PropertyEntity*)requireAddCommentWithReconrdId:(NSInteger)recordId withContent:(NSString*)content;
+(PropertyEntity*)requireAddCommentWithReconrdId:(NSInteger)recordId withContent:(NSString*)content WithType:(CommentType)commentType withToUid:(NSString*)otherId;
+(PropertyEntity*)requireLoadCommentWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size;
+(PropertyEntity*)requireLoadCommentWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size WithType:(CommentType)commentType;
@end
+22 -14
View File
@@ -17,6 +17,9 @@
@"ownerId" : @"ownerId",
@"ownerFigureurl" : @"ownerFigureurl",
@"ownerName" : @"ownerName",
@"commentType": @"type",
@"toUserId":@"toUserId",
@"toUserName":@"toUserName",
};
}
@end
@@ -36,30 +39,35 @@
return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:CommentInfoViewModel.class];
}
+(PropertyEntity*)requireAddCommentWithReconrdId:(NSInteger)recordId withContent:(NSString *)content
+(PropertyEntity*)requireAddCommentWithReconrdId:(NSInteger)recordId withContent:(NSString *)content WithType:(CommentType)commentType withToUid:(NSString *)otherId
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOST;
pro.reqURL = @"rs/text_image/add_comment";
pro.requireType = HTTPRequestTypeWithPOSTDATA;
pro.responesOBJ = self.class;
pro.pro = @{
@"record_id": [NSString stringWithFormat:@"%ld",recordId],
@"content": content,
NSDictionary* dic = @{
@"recordId": [NSString stringWithFormat:@"%ld",recordId],
@"content": content,
@"type" : [NSString stringWithFormat:@"%u",commentType],
@"toUserId": otherId,
};
pro.pro = @{@"root": dic,
@"command": @"10201",
};
return pro;
}
+(PropertyEntity*)requireLoadCommentWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size
+(PropertyEntity*)requireLoadCommentWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size WithType:(CommentType)commentType
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithGET;
pro.reqURL = @"rs/text_image/load_comment";
pro.requireType = HTTPRequestTypeWithPOSTDATA;
pro.responesOBJ = self.class;
pro.pro = @{@"record_id": [NSString stringWithFormat:@"%ld",recordId],
@"page": [NSString stringWithFormat:@"%ld",page],
@"page_size": [NSString stringWithFormat:@"%ld",page_size],
NSDictionary* dic = @{@"recordId": [NSString stringWithFormat:@"%ld",recordId],
@"page": [NSString stringWithFormat:@"%ld",page],
@"pageSize": [NSString stringWithFormat:@"%ld",page_size],
@"type" : [NSString stringWithFormat:@"%u",commentType],
};
pro.pro = @{@"root": dic,
@"command": @"10203",
};
return pro;
}
@end
+9 -6
View File
@@ -33,14 +33,17 @@
+(PropertyEntity*)requireLoadPraiseUserWithRecordId:(NSInteger)recordId withPage:(NSInteger)page withPage_size:(NSInteger)page_size
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithGET;
pro.reqURL = @"rs/text_image/load_praise_user";
pro.requireType = HTTPRequestTypeWithPOSTDATA;
pro.responesOBJ = self.class;
pro.pro = @{@"record_id": [NSString stringWithFormat:@"%ld",recordId],
@"page": [NSString stringWithFormat:@"%ld",(long)page],
@"page_size": [NSString stringWithFormat:@"%ld",(long)page_size],
};
NSDictionary* dic = @{@"recordId": [NSString stringWithFormat:@"%ld",recordId],
@"page": [NSString stringWithFormat:@"%ld",page],
@"pageSize": [NSString stringWithFormat:@"%ld",page_size],
};
pro.pro = @{@"root": dic,
@"command": @"20008",
};
return pro;
}
@@ -7,16 +7,16 @@
//
#import <UIKit/UIKit.h>
#import <DTCoreText/DTCoreText.h>
@class CommentInfoViewModel;
@interface CommentTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *avatarImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *floorLabel;
@property (weak, nonatomic) IBOutlet UITextView *contentTextView;
@property (weak, nonatomic) IBOutlet DTAttributedTextView *contentTextView;
@property (strong, nonatomic)NSString* ownerId;
-(void)setCommentInfoViewModel:(CommentInfoViewModel*)commentInfoViewModel;
-(void)setIsAuthor:(BOOL)isAuthor;
+(CGFloat)getHeightWithCommentInfoViewModel:(CommentInfoViewModel*)commentInfoViewModel;
+(CGFloat)getHeightWithCommentInfoViewModel:(CommentInfoViewModel*)commentInfoViewModel isReplyOwner:(BOOL)isReplyOwner;
@end
+31 -8
View File
@@ -16,7 +16,6 @@
// Initialization code
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 18.0;
_contentTextView.scrollEnabled = NO;
_floorLabel.layer.masksToBounds = YES;
_floorLabel.layer.cornerRadius = 8.0;
@@ -40,17 +39,41 @@
{
[_avatarImageView sd_setImageWithURL:[NSURL URLWithString:commentInfoViewModel.ownerFigureurl] placeholderImage:DefaultUserIcon];
_nameLabel.text = commentInfoViewModel.ownerName;
_contentTextView.text = commentInfoViewModel.content;
if ([commentInfoViewModel.ownerId isEqualToString:_ownerId] ) {
[self setIsAuthor:YES];
}else{
[self setIsAuthor:NO];
}
NSString* content = commentInfoViewModel.content;
if (![commentInfoViewModel.toUserId isEqualToString:_ownerId]){
content = [CommentTableViewCell getContentWithCommentInfoViewModel:commentInfoViewModel];
}
[self setContent:content];
_timeLabel.text = [CommonUtil timeFromtimeSp:commentInfoViewModel.createTime];
}
+(CGFloat)getHeightWithCommentInfoViewModel:(CommentInfoViewModel *)commentInfoViewModel
+(CGFloat)getHeightWithCommentInfoViewModel:(CommentInfoViewModel *)commentInfoViewModel isReplyOwner:(BOOL)isReplyOwner
{
UIFont *font = [UIFont appFontOfSize:13.0];
CGSize size = CGSizeMake(kScreenWidth - 60,MAXFLOAT);
NSString* content = commentInfoViewModel.content;
if (!isReplyOwner){
content = [CommentTableViewCell getContentWithCommentInfoViewModel:commentInfoViewModel];
}
CGFloat height = [Ash_UIUtil calculateSizeWithHtmlstring:content limitWidth:kScreenWidth-50 withFontSize:13].height;
return height+50;
}
-(void)setContent:(NSString*)content
{
NSData *data = [content dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString *percentString = [[NSAttributedString alloc] initWithHTMLData:data options:[Ash_UIUtil getHtmlDicWithFontSize:13] documentAttributes:nil];
_contentTextView.attributedString = percentString;
}
+(NSString*)getContentWithCommentInfoViewModel:(CommentInfoViewModel*)commentInfoViewModel;
{
NSString* content = commentInfoViewModel.content;
content = [NSString stringWithFormat:@"<font color=\"lightGray\">回复</font> <a href=\"%@\">%@</a>: %@",commentInfoViewModel.toUserId,commentInfoViewModel.toUserName,content];
CGRect labelRect = [commentInfoViewModel.content boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:font} context:nil];
return labelRect.size.height+60;
return content;
}
@end
+19 -25
View File
@@ -22,68 +22,62 @@
<constraint firstAttribute="width" constant="36" id="Hh2-wZ-wBY"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="游客" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HNF-FY-BJ4">
<rect key="frame" x="52" y="8" width="26" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HNF-FY-BJ4">
<rect key="frame" x="52" y="8" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aio-xk-LSD">
<rect key="frame" x="52" y="27" width="0.0" height="0.0"/>
<rect key="frame" x="52" y="11" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GI8-56-N0b">
<rect key="frame" x="46" y="27" width="264" height="71"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="楼主 " textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZiP-RG-jgh">
<rect key="frame" x="83" y="8" width="34" height="16"/>
<rect key="frame" x="57" y="8" width="34" height="16"/>
<color key="backgroundColor" red="0.3803921569" green="0.74901960779999999" blue="0.66274509800000003" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Biq-B6-eAd" customClass="DTAttributedTextView">
<rect key="frame" x="49" y="16" width="271" height="82"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="GI8-56-N0b" secondAttribute="trailing" constant="10" id="BL7-jI-GY8"/>
<constraint firstAttribute="trailing" secondItem="GI8-56-N0b" secondAttribute="trailing" constant="10" id="BsC-Ck-gzg"/>
<constraint firstItem="Biq-B6-eAd" firstAttribute="leading" secondItem="qab-Nl-rao" secondAttribute="trailing" constant="5" id="Ct8-e2-FK1"/>
<constraint firstAttribute="trailing" secondItem="Biq-B6-eAd" secondAttribute="trailing" id="Jxe-1e-ijt"/>
<constraint firstItem="ZiP-RG-jgh" firstAttribute="leading" secondItem="HNF-FY-BJ4" secondAttribute="trailing" constant="5" id="Ms5-W3-KbQ"/>
<constraint firstItem="ZiP-RG-jgh" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="8" id="QDZ-IA-030"/>
<constraint firstItem="GI8-56-N0b" firstAttribute="leading" secondItem="qab-Nl-rao" secondAttribute="trailing" constant="2" id="QWt-hz-dwp"/>
<constraint firstItem="GI8-56-N0b" firstAttribute="bottom" secondItem="H2p-sc-9uM" secondAttribute="bottomMargin" id="Ug2-cK-68b"/>
<constraint firstAttribute="bottom" secondItem="Biq-B6-eAd" secondAttribute="bottom" id="QSp-R5-rwH"/>
<constraint firstAttribute="bottomMargin" secondItem="Biq-B6-eAd" secondAttribute="bottom" constant="6" id="UO4-Ry-Jbt"/>
<constraint firstItem="HNF-FY-BJ4" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="Vtb-ph-9tQ"/>
<constraint firstItem="GI8-56-N0b" firstAttribute="top" secondItem="aio-xk-LSD" secondAttribute="bottom" id="XU6-kE-kV9"/>
<constraint firstItem="qab-Nl-rao" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="Xim-WS-hus"/>
<constraint firstAttribute="bottomMargin" secondItem="GI8-56-N0b" secondAttribute="bottom" constant="10" id="ZZh-WV-fAM"/>
<constraint firstAttribute="trailingMargin" relation="greaterThanOrEqual" secondItem="HNF-FY-BJ4" secondAttribute="trailing" constant="30" id="ZkL-SX-vgZ"/>
<constraint firstAttribute="trailing" secondItem="ZiP-RG-jgh" secondAttribute="trailing" constant="10" id="cGm-cZ-Vir"/>
<constraint firstItem="ZiP-RG-jgh" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="8" id="cwd-an-AyP"/>
<constraint firstItem="GI8-56-N0b" firstAttribute="top" secondItem="HNF-FY-BJ4" secondAttribute="bottom" constant="15" id="fiw-HX-QRQ"/>
<constraint firstItem="aio-xk-LSD" firstAttribute="top" secondItem="HNF-FY-BJ4" secondAttribute="bottom" constant="3" id="gYF-ag-8gr"/>
<constraint firstAttribute="bottom" secondItem="GI8-56-N0b" secondAttribute="bottom" id="gmi-Ab-HgI"/>
<constraint firstAttribute="trailingMargin" secondItem="GI8-56-N0b" secondAttribute="trailing" constant="-8" id="kmA-9A-Nts"/>
<constraint firstItem="Biq-B6-eAd" firstAttribute="top" secondItem="ZiP-RG-jgh" secondAttribute="bottom" id="jTT-zl-ij6"/>
<constraint firstItem="aio-xk-LSD" firstAttribute="leading" secondItem="qab-Nl-rao" secondAttribute="trailing" constant="8" id="oIw-sV-8qp"/>
<constraint firstItem="Biq-B6-eAd" firstAttribute="top" secondItem="aio-xk-LSD" secondAttribute="bottom" constant="5" id="u9J-u2-rUq"/>
<constraint firstItem="HNF-FY-BJ4" firstAttribute="leading" secondItem="qab-Nl-rao" secondAttribute="trailing" constant="8" id="vHk-Qa-UVw"/>
<constraint firstItem="qab-Nl-rao" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="vo4-6n-JGW"/>
<constraint firstAttribute="trailingMargin" secondItem="Biq-B6-eAd" secondAttribute="trailing" constant="10" id="xea-GT-ROG"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="BL7-jI-GY8"/>
<exclude reference="Ug2-cK-68b"/>
<exclude reference="ZZh-WV-fAM"/>
<exclude reference="fiw-HX-QRQ"/>
<exclude reference="kmA-9A-Nts"/>
<exclude reference="QDZ-IA-030"/>
<exclude reference="cGm-cZ-Vir"/>
<exclude reference="UO4-Ry-Jbt"/>
<exclude reference="jTT-zl-ij6"/>
<exclude reference="xea-GT-ROG"/>
</mask>
</variation>
</tableViewCellContentView>
<connections>
<outlet property="avatarImageView" destination="qab-Nl-rao" id="wUN-5h-CDf"/>
<outlet property="contentTextView" destination="GI8-56-N0b" id="gTA-ST-k0w"/>
<outlet property="contentTextView" destination="Biq-B6-eAd" id="Sgg-UY-WKg"/>
<outlet property="floorLabel" destination="ZiP-RG-jgh" id="i5k-Oq-tHp"/>
<outlet property="nameLabel" destination="HNF-FY-BJ4" id="gqu-ya-Fzi"/>
<outlet property="timeLabel" destination="aio-xk-LSD" id="t5S-sR-9vq"/>
+2 -2
View File
@@ -13,7 +13,7 @@ typedef void (^CommentComplete)(void);
@interface CommentTextView : UIView
@property (nonatomic, assign) NSInteger recordId;
@property (nonatomic, strong) NSString* aothourId;
@property (nonatomic, strong) CommentComplete comentComplete;
@property (weak, nonatomic) IBOutlet UITextView *contentTextView;
@property (weak, nonatomic) IBOutlet UILabel *tipLabel;
@@ -23,6 +23,6 @@ typedef void (^CommentComplete)(void);
- (IBAction)bgBtnClick:(id)sender;
-(void)show;
-(void)showWithUid:(NSString*)uid;;
-(void)hide;
@end
+8 -2
View File
@@ -13,6 +13,7 @@
@implementation CommentTextView
{
NSString* _commentId;
}
/*
// Only override drawRect: if you perform custom drawing.
@@ -26,8 +27,9 @@
[self hide];
}
-(void)show
-(void)showWithUid:(NSString *)uid
{
_commentId = uid;
[_contentTextView becomeFirstResponder];
self.hidden = NO;
self.alpha = 1;
@@ -114,7 +116,11 @@
[MBProgressHUD hudWithView:nil label:@"评论中"];
PropertyEntity* pro = [CommentViewModel requireAddCommentWithReconrdId:_recordId withContent:_contentTextView.text];
NSString* commentId = _commentId;
if (!commentId) {
commentId = _aothourId;
}
PropertyEntity* pro = [CommentViewModel requireAddCommentWithReconrdId:_recordId withContent:_contentTextView.text WithType:Image_Type withToUid:commentId];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
[MBProgressHUD hideAllHUDsForView:nil animated:YES];