CommonNoteVC.m 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  1. //
  2. // CommonNoteVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/4/29.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "CommonNoteVC.h"
  9. #import "MyTDGroupView.h"
  10. #import "MyFavoriteViewCell.h"
  11. #import "YCMenuView.h"
  12. #import "ShowNewGroupAlert.h"
  13. #import "MyFavoriteNewFindVC.h"
  14. #import "MyCenterSearchVC.h"
  15. #import "MoveViewController.h"
  16. #import "NoteBookCell.h"
  17. #import "NoteBookDetailVC.h"
  18. #import "NoteBookCommentVC.h"
  19. #import "NoteBookShareVC.h"
  20. #import "MyTDGroupViewController.h"
  21. #import "MyTDTopicCreateVC.h"
  22. #import "MyTDTopicDetailVC.h"
  23. #import "MoveViewController.h"
  24. #import "HomeDetailController.h"
  25. #import "TDGroupInfoListVC.h"
  26. #import "WorkFlowDetailsController.h"
  27. #import "MyApprovalPageDetail.h"
  28. #import "DownFileViewController.h"
  29. #import "MyFavoriteVC.h"
  30. #import "NoteBookSearchVC.h"
  31. #import "OtherFavoriteVC.h"
  32. #import "OtherNoteBookVC.h"
  33. #import "MailListDetailVC.h"
  34. #import "ShareListVC.h"
  35. #import "NoteBookVC.h"
  36. @interface CommonNoteVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  37. @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
  38. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  39. @property (weak, nonatomic) IBOutlet UIView *headerView;
  40. @property (strong, nonatomic) MyTDGroupView *SearchView;
  41. @property (strong, nonatomic) UIView *noteView;
  42. @property (strong,nonatomic) NSMutableArray <MyNoteBookSubModel *>*noteBookArray;
  43. @property (nonatomic, assign) Boolean isFresh;
  44. @property (nonatomic,assign) NSInteger currentPage;
  45. @property (nonatomic,assign) NSInteger totalPage;
  46. @property (strong,nonatomic) NSMutableArray *taskActionArray;
  47. @property(strong,nonatomic)UIImageView *cellImage;
  48. @property(strong,nonatomic)NSIndexPath *currentPath;
  49. @property(assign,nonatomic)CGFloat orignY;
  50. @property (nonatomic,assign) BOOL isBarReturn;
  51. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  52. @property (strong, nonatomic) NoteBookCommentVC *noteBookCommentVC;
  53. @property (strong, nonatomic) FlowAttachmentsModel * returnModel;
  54. @property (nonatomic,assign) NSInteger selectCount;
  55. @end
  56. @implementation CommonNoteVC
  57. +(CommonNoteVC *)initCommonNoteVC{
  58. CommonNoteVC *controller = [StoryboardManager.shared.Common instantiateViewControllerWithIdentifier:@"CommonNoteVC"];
  59. return controller;
  60. }
  61. #pragma mark -loay
  62. - (void)addHeaderSubView
  63. {
  64. [self.headerView addSubview:self.SearchView];
  65. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.top.mas_offset(6);
  67. make.left.right.mas_equalTo(self.headerView);
  68. make.height.mas_offset(36);
  69. }];
  70. [self.headerView addSubview:self.noteView];
  71. [self.noteView mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.top.mas_equalTo(self.SearchView.mas_bottom);
  73. make.left.bottom.right.mas_equalTo(self.headerView);
  74. }];
  75. UIImageView * imgV = [UIImageView new];
  76. imgV.image = IMG(@"Common_note_icon");
  77. [self.noteView addSubview:imgV];
  78. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.left.mas_offset(15);
  80. make.centerY.mas_equalTo(self.noteView);
  81. }];
  82. UILabel * lineL = [UILabel new];
  83. lineL.backgroundColor = LINEBGCOLOR;
  84. [self.noteView addSubview:lineL];
  85. [lineL mas_makeConstraints:^(MASConstraintMaker *make) {
  86. make.left.bottom.right.mas_equalTo(self.noteView);
  87. make.height.mas_offset(0.5);
  88. }];
  89. UILabel * titleL = [UILabel new];
  90. titleL.textColor = UIColorHex(0x0A0A0A);
  91. titleL.font = [UIFont systemFontOfSize:15];
  92. titleL.text = @"笔记本";
  93. [self.noteView addSubview:titleL];
  94. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.centerY.mas_equalTo(self.noteView);
  96. make.left.mas_equalTo(imgV.mas_right).offset(15);
  97. }];
  98. UIImageView * rightImgV = [UIImageView new];
  99. rightImgV.image = IMG(@"chatmsg_rightArrow_icon");
  100. [self.noteView addSubview:rightImgV];
  101. [rightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.centerY.mas_equalTo(self.noteView);
  103. make.right.offset(-15);
  104. }];
  105. WS(weakSelf);
  106. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  107. [weakSelf pushNoteVC];
  108. }];
  109. self.noteView.userInteractionEnabled = YES;
  110. [self.noteView addGestureRecognizer:tap];
  111. }
  112. - (void)pushNoteVC
  113. {
  114. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  115. vc.listType = MyNoteBookListLevelTypeA;
  116. vc.FolderId = 0;
  117. vc.myTitle = @"我的笔记";
  118. vc.VisitUserId = 0;
  119. vc.operationStateEnum = OperationStateEnum0;
  120. [self.navigationController pushViewController:vc animated:YES];
  121. }
  122. - (MyTDGroupView *)SearchView
  123. {
  124. if (!_SearchView) {
  125. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  126. }
  127. return _SearchView;
  128. }
  129. - (UIView *)noteView
  130. {
  131. if (!_noteView) {
  132. _noteView = [UIView new];
  133. }
  134. return _noteView;
  135. }
  136. #pragma mark - UItableView刷新
  137. - (void)setTableRefresh
  138. {
  139. WS(weakSelf);
  140. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  141. [weakSelf headRefresh];
  142. }];
  143. self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  144. [weakSelf footerRefresh];
  145. }];
  146. [self.tableView.mj_header beginRefreshing];
  147. }
  148. - (void)headRefresh{
  149. self.isFresh = YES;
  150. self.currentPage = 1;
  151. self.totalPage = 1;
  152. [self.noteBookArray removeAllObjects];
  153. [self getDataList];
  154. }
  155. - (void)footerRefresh{
  156. self.isFresh = NO;
  157. self.currentPage += 1;
  158. if (self.totalPage == self.noteBookArray.count) {
  159. self.currentPage --;
  160. [self.tableView.mj_footer resetNoMoreData];
  161. return ;
  162. }
  163. [self getDataList];
  164. }
  165. - (void)getDataList{
  166. WS(weakSelf);
  167. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NoteBook) parameters:@{@"FolderId":@(0),@"Page":@(1),@"PerPage":@(99999999),@"VisitUserId":@(0),@"SearchKey":@"",@"Sort":@""} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  168. NSLog(@"笔记列表数据 %@",responseObject);
  169. MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil];
  170. weakSelf.totalPage = listModel.Total;
  171. [weakSelf.noteBookArray addObjectsFromArray:listModel.Items];
  172. dispatch_async(dispatch_get_main_queue(), ^{
  173. [weakSelf.tableView.mj_header endRefreshing];
  174. [weakSelf.tableView.mj_footer endRefreshing];
  175. [weakSelf.tableView reloadData];
  176. });
  177. } failure:^(NSError * _Nonnull error) {
  178. }];
  179. }
  180. - (void)viewDidLoad {
  181. [super viewDidLoad];
  182. self.tableView.delegate = self;
  183. self.tableView.dataSource = self;
  184. self.fd_prefersNavigationBarHidden = YES;
  185. [self addHeaderSubView];
  186. WS(weakSelf);
  187. [self.rightEditBtn setAction:^{
  188. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  189. vc.type = CollectModel_NoteBook;
  190. vc.FolderId = 0;
  191. vc.FolderName = @"根目录";
  192. [weakSelf.navigationController pushViewController:vc animated:YES];
  193. }];
  194. [self.SearchView.button setAction:^{
  195. NoteBookSearchVC * vc = [[NoteBookSearchVC alloc] init];
  196. vc.IsSelected = NO;
  197. [weakSelf.navigationController pushViewController:vc animated:YES];
  198. }];
  199. [self setTableRefresh];
  200. [self.view addSubview:self.noteBookShareVC.view];
  201. }
  202. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  203. return 1;
  204. }
  205. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  206. return self.noteBookArray.count;
  207. }
  208. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  209. WS(weakSelf);
  210. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  211. switch (model.AttributeValue) {
  212. case 1:{
  213. switch (model.DataType) {
  214. case TopiclistCellNone:
  215. {
  216. NoteBookCell *cell = [NoteBookCell configCell6:tableView indexPath:indexPath];
  217. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]];
  218. cell.cell1Title.text = model.Name;
  219. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  220. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  221. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  222. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  223. if ([[self setTitleWithStr:model.Title] length] == 0) {
  224. cell.cell1contentTitleLabel.hidden = YES;
  225. cell.titleHeight.constant = 0.f;
  226. }else{
  227. cell.cell1contentTitleLabel.hidden = NO;
  228. cell.titleHeight.constant = 10.f;
  229. }
  230. if ([[self setTitleWithStr:model.Content] length] == 0) {
  231. cell.cell1contentContentLabel.hidden = YES;
  232. cell.contentHeight.constant = 0.f;
  233. }else{
  234. cell.cell1contentContentLabel.hidden = NO;
  235. cell.contentHeight.constant = 10.f;
  236. }
  237. cell.cellZanButton.selected = model.IsPraise;
  238. if (model.PraiseCount > 0) {
  239. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  240. }else{
  241. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  242. }
  243. if (model.CommentCount > 0) {
  244. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  245. }else{
  246. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  247. }
  248. cell.IsTopV.hidden = !model.IsTop;
  249. [cell.cellCommentButton setAction:^{
  250. [weakSelf CommentHanderIndex:indexPath];
  251. }];
  252. [cell.cellZanButton setAction:^{
  253. [weakSelf zanHanderIndex:indexPath];
  254. }];
  255. [cell.cellShareButton setAction:^{
  256. [weakSelf shareHanderModel:model];
  257. }];
  258. cell.ClickUserBlock = ^{
  259. [weakSelf showUserInfo:model.UserId];
  260. };
  261. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  262. return cell;
  263. }
  264. break;
  265. case TopiclistCellImage:
  266. {
  267. switch (model.Data.count) {
  268. case 1:
  269. {
  270. NoteBookCell *cell = [NoteBookCell configCell0:tableView indexPath:indexPath];
  271. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  272. cell.cell1Title.text = model.Name;
  273. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  274. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  275. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  276. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  277. if ([[self setTitleWithStr:model.Title] length] == 0) {
  278. cell.cell1contentTitleLabel.hidden = YES;
  279. cell.titleHeight.constant = 0.f;
  280. }else{
  281. cell.cell1contentTitleLabel.hidden = NO;
  282. cell.titleHeight.constant = 10.f;
  283. }
  284. if ([[self setTitleWithStr:model.Content] length] == 0) {
  285. cell.cell1contentContentLabel.hidden = YES;
  286. cell.contentHeight.constant = 0.f;
  287. }else{
  288. cell.cell1contentContentLabel.hidden = NO;
  289. cell.contentHeight.constant = 10.f;
  290. }
  291. cell.IsTopV.hidden = !model.IsTop;
  292. MyNoteBookeDataModel * data0Model = model.Data[0];
  293. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  294. cell.cellZanButton.selected = model.IsPraise;
  295. if (model.PraiseCount > 0) {
  296. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  297. }else{
  298. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  299. }
  300. if (model.CommentCount > 0) {
  301. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  302. }else{
  303. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  304. }
  305. [cell.cellCommentButton setAction:^{
  306. [weakSelf CommentHanderIndex:indexPath];
  307. }];
  308. [cell.cellZanButton setAction:^{
  309. [weakSelf zanHanderIndex:indexPath];
  310. }];
  311. [cell.cellShareButton setAction:^{
  312. [weakSelf shareHanderModel:model];
  313. }];
  314. cell.ClickUserBlock = ^{
  315. [weakSelf showUserInfo:model.UserId];
  316. };
  317. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  318. return cell;
  319. }break;
  320. case 2:{
  321. NoteBookCell *cell = [NoteBookCell configCell1:tableView indexPath:indexPath];
  322. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  323. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  324. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  325. if ([[self setTitleWithStr:model.Title] length] == 0) {
  326. cell.cell1contentTitleLabel.hidden = YES;
  327. cell.titleHeight.constant = 0.f;
  328. }else{
  329. cell.cell1contentTitleLabel.hidden = NO;
  330. cell.titleHeight.constant = 10.f;
  331. }
  332. if ([[self setTitleWithStr:model.Content] length] == 0) {
  333. cell.cell1contentContentLabel.hidden = YES;
  334. cell.contentHeight.constant = 0.f;
  335. }else{
  336. cell.cell1contentContentLabel.hidden = NO;
  337. cell.contentHeight.constant = 10.f;
  338. }
  339. cell.cell1Title.text = model.Name;
  340. cell.IsTopV.hidden = !model.IsTop;
  341. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  342. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  343. MyNoteBookeDataModel * data0Model = model.Data[0];
  344. MyNoteBookeDataModel * data1Model = model.Data[1];
  345. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  346. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  347. cell.cellZanButton.selected = model.IsPraise;
  348. if (model.PraiseCount > 0) {
  349. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  350. }else{
  351. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  352. }
  353. if (model.CommentCount > 0) {
  354. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  355. }else{
  356. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  357. }
  358. [cell.cellCommentButton setAction:^{
  359. [weakSelf CommentHanderIndex:indexPath];
  360. }];
  361. [cell.cellZanButton setAction:^{
  362. [weakSelf zanHanderIndex:indexPath];
  363. }];
  364. [cell.cellShareButton setAction:^{
  365. [weakSelf shareHanderModel:model];
  366. }];
  367. cell.ClickUserBlock = ^{
  368. [weakSelf showUserInfo:model.UserId];
  369. };
  370. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  371. return cell;
  372. }break;
  373. case 3:{
  374. NoteBookCell *cell = [NoteBookCell configCell2:tableView indexPath:indexPath];
  375. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  376. cell.cell1Title.text = model.Name;
  377. cell.IsTopV.hidden = !model.IsTop;
  378. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  379. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  380. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  381. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  382. if ([[self setTitleWithStr:model.Title] length] == 0) {
  383. cell.cell1contentTitleLabel.hidden = YES;
  384. cell.titleHeight.constant = 0.f;
  385. }else{
  386. cell.cell1contentTitleLabel.hidden = NO;
  387. cell.titleHeight.constant = 10.f;
  388. }
  389. if ([[self setTitleWithStr:model.Content] length] == 0) {
  390. cell.cell1contentContentLabel.hidden = YES;
  391. cell.contentHeight.constant = 0.f;
  392. }else{
  393. cell.cell1contentContentLabel.hidden = NO;
  394. cell.contentHeight.constant = 10.f;
  395. }
  396. MyNoteBookeDataModel * data0Model = model.Data[0];
  397. MyNoteBookeDataModel * data1Model = model.Data[1];
  398. MyNoteBookeDataModel * data2Model = model.Data[2];
  399. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  400. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  401. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  402. cell.cellZanButton.selected = model.IsPraise;
  403. if (model.PraiseCount > 0) {
  404. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  405. }else{
  406. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  407. }
  408. if (model.CommentCount > 0) {
  409. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  410. }else{
  411. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  412. }
  413. [cell.cellCommentButton setAction:^{
  414. [weakSelf CommentHanderIndex:indexPath];
  415. }];
  416. [cell.cellZanButton setAction:^{
  417. [weakSelf zanHanderIndex:indexPath];
  418. }];
  419. [cell.cellShareButton setAction:^{
  420. [weakSelf shareHanderModel:model];
  421. }];
  422. cell.ClickUserBlock = ^{
  423. [weakSelf showUserInfo:model.UserId];
  424. };
  425. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  426. return cell;
  427. }break;
  428. case 4:{
  429. NoteBookCell *cell = [NoteBookCell configCell3:tableView indexPath:indexPath];
  430. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  431. cell.cell1Title.text = model.Name;
  432. cell.IsTopV.hidden = !model.IsTop;
  433. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  434. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  435. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  436. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  437. if ([[self setTitleWithStr:model.Title] length] == 0) {
  438. cell.cell1contentTitleLabel.hidden = YES;
  439. cell.titleHeight.constant = 0.f;
  440. }else{
  441. cell.cell1contentTitleLabel.hidden = NO;
  442. cell.titleHeight.constant = 10.f;
  443. }
  444. if ([[self setTitleWithStr:model.Content] length] == 0) {
  445. cell.cell1contentContentLabel.hidden = YES;
  446. cell.contentHeight.constant = 0.f;
  447. }else{
  448. cell.cell1contentContentLabel.hidden = NO;
  449. cell.contentHeight.constant = 10.f;
  450. }
  451. MyNoteBookeDataModel * data0Model = model.Data[0];
  452. MyNoteBookeDataModel * data1Model = model.Data[1];
  453. MyNoteBookeDataModel * data2Model = model.Data[2];
  454. MyNoteBookeDataModel * data3Model = model.Data[3];
  455. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  456. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  457. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  458. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  459. cell.cellZanButton.selected = model.IsPraise;
  460. if (model.PraiseCount > 0) {
  461. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  462. }else{
  463. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  464. }
  465. if (model.CommentCount > 0) {
  466. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  467. }else{
  468. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  469. }
  470. [cell.cellCommentButton setAction:^{
  471. [weakSelf CommentHanderIndex:indexPath];
  472. }];
  473. [cell.cellZanButton setAction:^{
  474. [weakSelf zanHanderIndex:indexPath];
  475. }];
  476. [cell.cellShareButton setAction:^{
  477. [weakSelf shareHanderModel:model];
  478. }];
  479. cell.ClickUserBlock = ^{
  480. [weakSelf showUserInfo:model.UserId];
  481. };
  482. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  483. return cell;
  484. }break;
  485. case 5:{
  486. NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath];
  487. cell.cell1Title.text = model.Name;
  488. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  489. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  490. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  491. cell.IsTopV.hidden = !model.IsTop;
  492. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  493. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  494. if ([[self setTitleWithStr:model.Title] length] == 0) {
  495. cell.cell1contentTitleLabel.hidden = YES;
  496. cell.titleHeight.constant = 0.f;
  497. }else{
  498. cell.cell1contentTitleLabel.hidden = NO;
  499. cell.titleHeight.constant = 10.f;
  500. }
  501. if ([[self setTitleWithStr:model.Content] length] == 0) {
  502. cell.cell1contentContentLabel.hidden = YES;
  503. cell.contentHeight.constant = 0.f;
  504. }else{
  505. cell.cell1contentContentLabel.hidden = NO;
  506. cell.contentHeight.constant = 10.f;
  507. }
  508. MyNoteBookeDataModel * data0Model = model.Data[0];
  509. MyNoteBookeDataModel * data1Model = model.Data[1];
  510. MyNoteBookeDataModel * data2Model = model.Data[2];
  511. MyNoteBookeDataModel * data3Model = model.Data[3];
  512. MyNoteBookeDataModel * data4Model = model.Data[4];
  513. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  514. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  515. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  516. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  517. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  518. cell.cellZanButton.selected = model.IsPraise;
  519. if (model.PraiseCount > 0) {
  520. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  521. }else{
  522. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  523. }
  524. if (model.CommentCount > 0) {
  525. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  526. }else{
  527. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  528. }
  529. [cell.cellCommentButton setAction:^{
  530. [weakSelf CommentHanderIndex:indexPath];
  531. }];
  532. [cell.cellZanButton setAction:^{
  533. [weakSelf zanHanderIndex:indexPath];
  534. }];
  535. [cell.cellShareButton setAction:^{
  536. [weakSelf shareHanderModel:model];
  537. }];
  538. cell.ClickUserBlock = ^{
  539. [weakSelf showUserInfo:model.UserId];
  540. };
  541. cell.cell1IconImageView6.hidden = YES;
  542. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  543. return cell;
  544. }break;
  545. case 6:{
  546. NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath];
  547. cell.cell1Title.text = model.Name;
  548. cell.IsTopV.hidden = !model.IsTop;
  549. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  550. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  551. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  552. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  553. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  554. if ([[self setTitleWithStr:model.Title] length] == 0) {
  555. cell.cell1contentTitleLabel.hidden = YES;
  556. cell.titleHeight.constant = 0.f;
  557. }else{
  558. cell.cell1contentTitleLabel.hidden = NO;
  559. cell.titleHeight.constant = 10.f;
  560. }
  561. if ([[self setTitleWithStr:model.Content] length] == 0) {
  562. cell.cell1contentContentLabel.hidden = YES;
  563. cell.contentHeight.constant = 0.f;
  564. }else{
  565. cell.cell1contentContentLabel.hidden = NO;
  566. cell.contentHeight.constant = 10.f;
  567. }
  568. MyNoteBookeDataModel * data0Model = model.Data[0];
  569. MyNoteBookeDataModel * data1Model = model.Data[1];
  570. MyNoteBookeDataModel * data2Model = model.Data[2];
  571. MyNoteBookeDataModel * data3Model = model.Data[3];
  572. MyNoteBookeDataModel * data4Model = model.Data[4];
  573. MyNoteBookeDataModel * data5Model = model.Data[5];
  574. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  575. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  576. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  577. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  578. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  579. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  580. cell.cellZanButton.selected = model.IsPraise;
  581. if (model.PraiseCount > 0) {
  582. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  583. }else{
  584. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  585. }
  586. if (model.CommentCount > 0) {
  587. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  588. }else{
  589. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  590. }
  591. [cell.cellCommentButton setAction:^{
  592. [weakSelf CommentHanderIndex:indexPath];
  593. }];
  594. [cell.cellZanButton setAction:^{
  595. [weakSelf zanHanderIndex:indexPath];
  596. }];
  597. [cell.cellShareButton setAction:^{
  598. [weakSelf shareHanderModel:model];
  599. }];
  600. cell.ClickUserBlock = ^{
  601. [weakSelf showUserInfo:model.UserId];
  602. };
  603. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  604. return cell;
  605. }break;
  606. case 7:{
  607. NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
  608. cell.cell1Title.text = model.Name;
  609. cell.IsTopV.hidden = !model.IsTop;
  610. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  611. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  612. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl]placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  613. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  614. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  615. if ([[self setTitleWithStr:model.Title] length] == 0) {
  616. cell.cell1contentTitleLabel.hidden = YES;
  617. cell.titleHeight.constant = 0.f;
  618. }else{
  619. cell.cell1contentTitleLabel.hidden = NO;
  620. cell.titleHeight.constant = 10.f;
  621. }
  622. if ([[self setTitleWithStr:model.Content] length] == 0) {
  623. cell.cell1contentContentLabel.hidden = YES;
  624. cell.contentHeight.constant = 0.f;
  625. }else{
  626. cell.cell1contentContentLabel.hidden = NO;
  627. cell.contentHeight.constant = 10.f;
  628. }
  629. MyNoteBookeDataModel * data0Model = model.Data[0];
  630. MyNoteBookeDataModel * data1Model = model.Data[1];
  631. MyNoteBookeDataModel * data2Model = model.Data[2];
  632. MyNoteBookeDataModel * data3Model = model.Data[3];
  633. MyNoteBookeDataModel * data4Model = model.Data[4];
  634. MyNoteBookeDataModel * data5Model = model.Data[5];
  635. MyNoteBookeDataModel * data6Model = model.Data[6];
  636. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  637. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  638. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  639. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  640. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  641. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  642. [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  643. cell.cellZanButton.selected = model.IsPraise;
  644. if (model.PraiseCount > 0) {
  645. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  646. }else{
  647. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  648. }
  649. if (model.CommentCount > 0) {
  650. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  651. }else{
  652. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  653. }
  654. [cell.cellCommentButton setAction:^{
  655. [weakSelf CommentHanderIndex:indexPath];
  656. }];
  657. [cell.cellZanButton setAction:^{
  658. [weakSelf zanHanderIndex:indexPath];
  659. }];
  660. [cell.cellShareButton setAction:^{
  661. [weakSelf shareHanderModel:model];
  662. }];
  663. cell.ClickUserBlock = ^{
  664. [weakSelf showUserInfo:model.UserId];
  665. };
  666. cell.cell1IconImageView8.hidden = YES;
  667. cell.cell1IconImageView9.hidden = YES;
  668. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  669. return cell;
  670. }break;
  671. case 8:{
  672. NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
  673. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  674. cell.cell1Title.text = model.Name;
  675. cell.IsTopV.hidden = !model.IsTop;
  676. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  677. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  678. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  679. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  680. if ([[self setTitleWithStr:model.Title] length] == 0) {
  681. cell.cell1contentTitleLabel.hidden = YES;
  682. cell.titleHeight.constant = 0.f;
  683. }else{
  684. cell.cell1contentTitleLabel.hidden = NO;
  685. cell.titleHeight.constant = 10.f;
  686. }
  687. if ([[self setTitleWithStr:model.Content] length] == 0) {
  688. cell.cell1contentContentLabel.hidden = YES;
  689. cell.contentHeight.constant = 0.f;
  690. }else{
  691. cell.cell1contentContentLabel.hidden = NO;
  692. cell.contentHeight.constant = 10.f;
  693. }
  694. MyNoteBookeDataModel * data0Model = model.Data[0];
  695. MyNoteBookeDataModel * data1Model = model.Data[1];
  696. MyNoteBookeDataModel * data2Model = model.Data[2];
  697. MyNoteBookeDataModel * data3Model = model.Data[3];
  698. MyNoteBookeDataModel * data4Model = model.Data[4];
  699. MyNoteBookeDataModel * data5Model = model.Data[5];
  700. MyNoteBookeDataModel * data6Model = model.Data[6];
  701. MyNoteBookeDataModel * data7Model = model.Data[7];
  702. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  703. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  704. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  705. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  706. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  707. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  708. [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  709. [cell.cell1IconImageView8 sd_setImageWithURL:[NSURL URLWithString:data7Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  710. cell.cellZanButton.selected = model.IsPraise;
  711. if (model.PraiseCount > 0) {
  712. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  713. }else{
  714. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  715. }
  716. if (model.CommentCount > 0) {
  717. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  718. }else{
  719. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  720. }
  721. [cell.cellCommentButton setAction:^{
  722. [weakSelf CommentHanderIndex:indexPath];
  723. }];
  724. [cell.cellZanButton setAction:^{
  725. [weakSelf zanHanderIndex:indexPath];
  726. }];
  727. [cell.cellShareButton setAction:^{
  728. [weakSelf shareHanderModel:model];
  729. }];
  730. cell.ClickUserBlock = ^{
  731. [weakSelf showUserInfo:model.UserId];
  732. };
  733. cell.cell1IconImageView9.hidden = YES;
  734. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  735. return cell;
  736. }break;
  737. default:{
  738. NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
  739. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] ];
  740. cell.cell1Title.text = model.Name;
  741. cell.IsTopV.hidden = !model.IsTop;
  742. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  743. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  744. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  745. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  746. if ([[self setTitleWithStr:model.Title] length] == 0) {
  747. cell.cell1contentTitleLabel.hidden = YES;
  748. cell.titleHeight.constant = 0.f;
  749. }else{
  750. cell.cell1contentTitleLabel.hidden = NO;
  751. cell.titleHeight.constant = 10.f;
  752. }
  753. if ([[self setTitleWithStr:model.Content] length] == 0) {
  754. cell.cell1contentContentLabel.hidden = YES;
  755. cell.contentHeight.constant = 0.f;
  756. }else{
  757. cell.cell1contentContentLabel.hidden = NO;
  758. cell.contentHeight.constant = 10.f;
  759. }
  760. MyNoteBookeDataModel * data0Model = model.Data[0];
  761. MyNoteBookeDataModel * data1Model = model.Data[1];
  762. MyNoteBookeDataModel * data2Model = model.Data[2];
  763. MyNoteBookeDataModel * data3Model = model.Data[3];
  764. MyNoteBookeDataModel * data4Model = model.Data[4];
  765. MyNoteBookeDataModel * data5Model = model.Data[5];
  766. MyNoteBookeDataModel * data6Model = model.Data[6];
  767. MyNoteBookeDataModel * data7Model = model.Data[7];
  768. MyNoteBookeDataModel * data8Model = model.Data[8];
  769. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  770. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  771. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  772. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  773. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  774. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  775. [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  776. [cell.cell1IconImageView8 sd_setImageWithURL:[NSURL URLWithString:data7Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  777. [cell.cell1IconImageView9 sd_setImageWithURL:[NSURL URLWithString:data8Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  778. cell.cellZanButton.selected = model.IsPraise;
  779. if (model.PraiseCount > 0) {
  780. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  781. }else{
  782. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  783. }
  784. if (model.CommentCount > 0) {
  785. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  786. }else{
  787. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  788. }
  789. [cell.cellCommentButton setAction:^{
  790. [weakSelf CommentHanderIndex:indexPath];
  791. }];
  792. [cell.cellZanButton setAction:^{
  793. [weakSelf zanHanderIndex:indexPath];
  794. }];
  795. [cell.cellShareButton setAction:^{
  796. [weakSelf shareHanderModel:model];
  797. }];
  798. cell.ClickUserBlock = ^{
  799. [weakSelf showUserInfo:model.UserId];
  800. };
  801. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  802. return cell;
  803. }
  804. break;
  805. }
  806. }
  807. break;
  808. default:///TopiclistCellFile
  809. {
  810. MyNoteBookeDataModel * dataModel = model.Data.firstObject;
  811. NoteBookCell *cell = [NoteBookCell configCell7:tableView indexPath:indexPath];
  812. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  813. [cell setDataWithCell:dataModel];
  814. cell.cell1Title.text = model.Name;
  815. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  816. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  817. if ([[self setTitleWithStr:model.Title] length] == 0) {
  818. cell.cell1contentTitleLabel.hidden = YES;
  819. cell.titleHeight.constant = 0.f;
  820. }else{
  821. cell.cell1contentTitleLabel.hidden = NO;
  822. cell.titleHeight.constant = 10.f;
  823. }
  824. if ([[self setTitleWithStr:model.Content] length] == 0) {
  825. cell.cell1contentContentLabel.hidden = YES;
  826. cell.contentHeight.constant = 0.f;
  827. }else{
  828. cell.cell1contentContentLabel.hidden = NO;
  829. cell.contentHeight.constant = 10.f;
  830. }
  831. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  832. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  833. cell.cellZanButton.selected = model.IsPraise;
  834. if (model.PraiseCount > 0) {
  835. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  836. }else{
  837. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  838. }
  839. if (model.CommentCount > 0) {
  840. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  841. }else{
  842. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  843. }
  844. [cell.cellCommentButton setAction:^{
  845. [weakSelf CommentHanderIndex:indexPath];
  846. }];
  847. [cell.cellZanButton setAction:^{
  848. [weakSelf zanHanderIndex:indexPath];
  849. }];
  850. [cell.cellShareButton setAction:^{
  851. [weakSelf shareHanderModel:model];
  852. }];
  853. [cell.fileAction setAction:^{
  854. [weakSelf pushFileWithModel:dataModel];
  855. }];
  856. cell.ClickUserBlock = ^{
  857. [weakSelf showUserInfo:model.UserId];
  858. };
  859. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  860. return cell;
  861. }
  862. break;
  863. }
  864. }break;
  865. default:{
  866. MyFavoriteViewCell *cell = [MyFavoriteViewCell configCell0:tableView indexPath:indexPath];
  867. switch (model.RoleId) {
  868. case 1:
  869. {
  870. cell.cell0IconImage.image = IMG(@"find_1");
  871. cell.cell0ShareType.text = @"公开";
  872. }
  873. break;
  874. case 2:
  875. {
  876. cell.cell0IconImage.image = IMG(@"find_0");
  877. cell.cell0ShareType.text = @"私有";
  878. }
  879. break;
  880. default:
  881. {
  882. cell.cell0IconImage.image = IMG(@"find_1");
  883. cell.cell0ShareType.text = [NSString stringWithFormat:@"共享给:%@",model.EnjoyUser];
  884. }
  885. break;
  886. }
  887. cell.cell0Number.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
  888. cell.cell0Number.hidden = model.FileCount == 0 ? YES : NO;
  889. cell.cell0Title.text = model.FolderName;
  890. cell.cell0TopImageView.hidden = !model.IsTop;
  891. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  892. return cell;
  893. }break;
  894. }
  895. }
  896. //
  897. //#pragma Mark 左滑按钮 iOS8以上
  898. //#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
  899. //- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){
  900. // MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  901. // switch (model.AttributeValue) {
  902. // case 1:{
  903. // WEAKSELF
  904. // UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  905. // [tableView setEditing:NO animated:YES];
  906. // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  907. // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  908. //
  909. // }];
  910. // [ok setValue:k9 forKey:@"_titleTextColor"];
  911. // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  912. // [weakSelf deleteFind:@[model].mutableCopy];
  913. // }];
  914. // [alertVC addAction:ok];
  915. // [alertVC addAction:noOk];
  916. // completionHandler(YES);
  917. // [weakSelf presentViewController:alertVC animated:YES completion:nil];
  918. // }];
  919. // action1.backgroundColor = RGB(255, 59, 47);
  920. // UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"编辑" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  921. // STRONGSELF
  922. // [tableView setEditing:NO animated:YES];
  923. // [strongSelf eidtorNoteBook:model];
  924. // }];
  925. // action2.backgroundColor = UIColorHex(#FF923A);
  926. // UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  927. // STRONGSELF
  928. // [tableView setEditing:NO animated:YES];
  929. // [strongSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  930. // }];
  931. // action3.backgroundColor = UIColorHex(#589AF1);
  932. // UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  933. // STRONGSELF
  934. // [tableView setEditing:NO animated:YES];
  935. // [strongSelf topFind:model];
  936. // }];
  937. // action4.backgroundColor = UIColorHex(#9BA9CB);
  938. // UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2,action3,action4]];
  939. // actions.performsFirstActionWithFullSwipe = NO;
  940. // return actions;
  941. // }break;
  942. // default:{
  943. // WEAKSELF
  944. // UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  945. // [tableView setEditing:NO animated:YES];
  946. // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  947. // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  948. //
  949. // }];
  950. // [ok setValue:k9 forKey:@"_titleTextColor"];
  951. // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  952. // [weakSelf deleteFind:@[model].mutableCopy];
  953. // }];
  954. // [alertVC addAction:ok];
  955. // [alertVC addAction:noOk];
  956. // [weakSelf presentViewController:alertVC animated:YES completion:nil];
  957. // }];
  958. // action1.backgroundColor = RGB(255, 59, 47);
  959. // UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  960. // MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
  961. // vc.ParentId = model.Id;
  962. // vc.foldId = model.Id;
  963. // vc.createFoldType = CreateNotesType;
  964. // vc.modifyTye = ModifyType;
  965. // vc.fileType = NewOtherFileType;
  966. // vc.titleStr = @"修改文件夹";
  967. // vc.roleId = model.RoleId;
  968. // vc.fileName = model.FolderName;
  969. // [tableView setEditing:NO animated:YES];
  970. // [weakSelf.navigationController pushViewController:vc animated:YES];
  971. // }];
  972. // action2.backgroundColor = UIColorHex(#FF923A);
  973. //
  974. // UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  975. // [tableView setEditing:NO animated:YES];
  976. // [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  977. // }];
  978. // action3.backgroundColor = UIColorHex(#529DF8);
  979. //
  980. // UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  981. // [tableView setEditing:NO animated:YES];
  982. // [weakSelf topFind:model];
  983. // }];
  984. // action4.backgroundColor = UIColorHex(#9BA9CB);
  985. // UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3,action4]];
  986. // actions.performsFirstActionWithFullSwipe = NO;
  987. // return actions;
  988. // }break;
  989. // }
  990. //}
  991. //#else
  992. //- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
  993. // MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  994. // switch (model.AttributeValue) {
  995. // case 1:{
  996. // WEAKSELF
  997. // UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  998. // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  999. // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1000. //
  1001. // }];
  1002. // [ok setValue:k9 forKey:@"_titleTextColor"];
  1003. // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1004. // [weakSelf deleteFind:@[model].mutableCopy];
  1005. // }];
  1006. // [alertVC addAction:ok];
  1007. // [alertVC addAction:noOk];
  1008. // [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1009. // }];
  1010. //
  1011. // action1.backgroundColor = RGB(255, 59, 47);
  1012. // UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"编辑" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1013. // [weakSelf eidtorNoteBook:model];
  1014. // }];
  1015. // action2.backgroundColor = UIColorHex(#FF923A);
  1016. // UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1017. // [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  1018. //
  1019. // }];
  1020. // action3.backgroundColor = UIColorHex(#589AF1);
  1021. // UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1022. // [weakSelf topFind:model];
  1023. // }];
  1024. // action4.backgroundColor =UIColorHex(#9BA9CB);
  1025. //
  1026. // return @[action1, action2, action3,action4];
  1027. // }break;
  1028. // default:{
  1029. // WEAKSELF
  1030. // UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1031. // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  1032. // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1033. //
  1034. // }];
  1035. // [ok setValue:k9 forKey:@"_titleTextColor"];
  1036. // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1037. // [weakSelf deleteFind:@[model].mutableCopy];
  1038. // }];
  1039. // [alertVC addAction:ok];
  1040. // [alertVC addAction:noOk];
  1041. // [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1042. // }];
  1043. // action1.backgroundColor = RGB(255, 59, 47);
  1044. //
  1045. // UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"重命名" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1046. // MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
  1047. // vc.ParentId = model.Id;
  1048. // vc.foldId = model.Id;
  1049. // vc.createFoldType = CreateNotesType;
  1050. // vc.modifyTye = ModifyType;
  1051. // vc.fileType = NewOtherFileType;
  1052. // vc.titleStr = @"修改文件夹";
  1053. // vc.roleId = model.RoleId;
  1054. // vc.fileName = model.FolderName;
  1055. // [weakSelf.navigationController pushViewController:vc animated:YES];
  1056. //
  1057. // }];
  1058. // action2.backgroundColor = UIColorHex(#FF923A);
  1059. // UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1060. // [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  1061. // }];
  1062. // action3.backgroundColor = UIColorHex(#529DF8);
  1063. // UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title: model.IsTop?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1064. // [weakSelf topFind:model];
  1065. // }];
  1066. // action4.backgroundColor = UIColorHex(#9BA9CB);
  1067. // return @[action1, action2, action3,action4];
  1068. // }break;
  1069. // }
  1070. //}
  1071. //#endif
  1072. //- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
  1073. //{
  1074. // return YES;
  1075. //}
  1076. //- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath
  1077. //{
  1078. //}
  1079. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
  1080. {
  1081. return UITableViewCellEditingStyleNone;
  1082. }
  1083. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  1084. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  1085. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  1086. switch (model.AttributeValue) {
  1087. case 1:{
  1088. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1089. vc.Id = model.MiddleId;
  1090. vc.type = CollectModel_NoteBook;
  1091. [self.navigationController pushViewController:vc animated:YES];
  1092. }break;
  1093. case 2:{
  1094. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  1095. if (model.ParentId == 0) {
  1096. vc.listType = MyFavoriteListLevelTypeB;
  1097. }else{
  1098. vc.listType = MyFavoriteListLevelTypeC;
  1099. }
  1100. vc.ParentId = model.ParentId;
  1101. vc.FolderId = model.Id;
  1102. vc.RoleId = model.RoleId;
  1103. vc.myTitle = model.FolderName;
  1104. vc.isSubVC = YES;
  1105. [self.navigationController pushViewController:vc animated:YES];
  1106. }break;
  1107. default:
  1108. break;
  1109. }
  1110. }
  1111. - (void)showUserInfo:(NSInteger)userId
  1112. {
  1113. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  1114. vc.indexId = userId;
  1115. [self.navigationController pushViewController:vc animated:YES];
  1116. }
  1117. - (NSMutableArray <MyNoteBookSubModel*>*)noteBookArray{
  1118. if (!_noteBookArray) {
  1119. _noteBookArray = [NSMutableArray array];
  1120. }
  1121. return _noteBookArray;
  1122. }
  1123. //MARK:截图
  1124. - (UIImage *)getImageWithCell:(UITableViewCell*)cell {
  1125. UIGraphicsBeginImageContextWithOptions(CGSizeMake(kGXScreenWidth, 60), NO, 1.0);
  1126. CGContextRef context=UIGraphicsGetCurrentContext();
  1127. CGContextDrawImage(context, CGRectMake(0, 3, kGXScreenWidth, 60), [UIImage new].CGImage);
  1128. [cell.contentView.layer renderInContext:context];
  1129. UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  1130. UIGraphicsEndImageContext();
  1131. return image;
  1132. }
  1133. #pragma -mark 点赞
  1134. - (void)zanHanderIndex:(NSIndexPath *)indexPath{
  1135. MyNoteBookSubModel *mdoel = self.noteBookArray[indexPath.row];
  1136. SHOWLOADING
  1137. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  1138. [dic setValue:@(mdoel.MiddleId) forKey:@"SourceId"];
  1139. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1140. [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞
  1141. [dic setValue:@(0) forKey:@"CommentId"];
  1142. [dic setValue:@(3) forKey:@"TypeValue"];//笔记 3
  1143. WS(weakSelf);
  1144. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1145. mdoel.IsPraise = !mdoel.IsPraise;
  1146. if (mdoel.IsPraise) {
  1147. SHOWSUCCESS(@"点赞成功");
  1148. ++ mdoel.PraiseCount;
  1149. }else{
  1150. SHOWSUCCESS(@"取消点赞");
  1151. -- mdoel.PraiseCount;
  1152. }
  1153. dispatch_async(dispatch_get_main_queue(), ^{
  1154. [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  1155. });
  1156. } failure:^(NSError * _Nonnull error) {
  1157. SHOWERROR([ZYCTool handerResultData:error]);
  1158. }];
  1159. }
  1160. #pragma -mark 评论
  1161. - (void)CommentHanderIndex:(NSIndexPath *)indexPath{
  1162. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  1163. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1164. vc.Id = model.MiddleId;
  1165. vc.type = CollectModel_NoteBook;
  1166. [self.navigationController pushViewController:vc animated:YES];
  1167. }
  1168. #pragma mark - 点击文件跳转
  1169. - (void)pushFileWithModel:(MyNoteBookeDataModel *)model
  1170. {
  1171. WS(weakSelf);
  1172. switch (model.Type) {
  1173. case CollectModel_Aritle:
  1174. {
  1175. SHOWLOADING
  1176. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  1177. REMOVESHOW;
  1178. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  1179. // HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  1180. // [homeDetail loadCurrentModel:itemModel];
  1181. // [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  1182. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1183. vc.type = CollectModel_Aritle;
  1184. vc.Id = itemModel.Id;
  1185. [weakSelf.navigationController pushViewController:vc animated:YES];
  1186. } failure:^(NSError * _Nonnull error) {
  1187. SHOWERROR([ZYCTool handerResultData:error]);
  1188. }];
  1189. }
  1190. break;
  1191. case CollectModel_Toipc:
  1192. {
  1193. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1194. vc.type = CollectModel_Toipc;
  1195. vc.Id = model.Id;
  1196. [self.navigationController pushViewController:vc animated:YES];
  1197. }
  1198. break;
  1199. case CollectModel_NewTopic:
  1200. {
  1201. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1202. vc.type = CollectModel_NewTopic;
  1203. vc.Id = model.Id;
  1204. [self.navigationController pushViewController:vc animated:YES];
  1205. }
  1206. break;
  1207. case CollectModel_Collect:
  1208. {
  1209. }
  1210. break;
  1211. case CollectModel_CollectFile:{
  1212. OtherFavoriteVC * vc = [OtherFavoriteVC initOtherFavoriteVC];
  1213. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1214. vc.FolderId = model.Id;
  1215. vc.Author = model.Author;
  1216. vc.myTitle = model.Title;
  1217. vc.VisitUserId = model.SourceUserId;
  1218. [self.navigationController pushViewController:vc animated:YES];
  1219. }break;
  1220. case CollectModel_NoteFile: {
  1221. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  1222. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1223. vc.FolderId = model.Id;
  1224. vc.Author = model.Author;
  1225. vc.myTitle = model.Title;
  1226. vc.VisitUserId = model.SourceUserId;
  1227. [self.navigationController pushViewController:vc animated:YES];
  1228. }break;
  1229. case CollectModel_NoteBook:
  1230. {
  1231. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1232. vc.type = CollectModel_NoteBook;
  1233. vc.Id = model.Id;
  1234. [self.navigationController pushViewController:vc animated:YES];
  1235. }
  1236. break;
  1237. case CollectModel_Notice:
  1238. {
  1239. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1240. vc.type = CollectModel_Notice;
  1241. vc.Id = model.Id;
  1242. [self.navigationController pushViewController:vc animated:YES];
  1243. }
  1244. break;
  1245. case CollectModel_InterMail:
  1246. {
  1247. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1248. vc.type = CollectModel_InterMail;
  1249. vc.Id = model.Id;
  1250. [self.navigationController pushViewController:vc animated:YES];
  1251. }
  1252. break;
  1253. case CollectModel_Group:
  1254. {
  1255. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  1256. vc.GroupId = model.Id;
  1257. vc.titleStr = model.Title;
  1258. [self.navigationController pushViewController:vc animated:YES];
  1259. }
  1260. break;
  1261. case CollectModel_meetMian:
  1262. {
  1263. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1264. vc.type = CollectModel_meetMian;
  1265. vc.Id = model.Id;
  1266. [self.navigationController pushViewController:vc animated:YES];
  1267. }
  1268. break;
  1269. case CollectModel_meetDetail:
  1270. {
  1271. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  1272. [self.navigationController pushViewController:vc animated:YES];
  1273. }
  1274. break;
  1275. case CollectModel_work:
  1276. {
  1277. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  1278. vc.pageType = Type_ONEC;
  1279. vc.indexId = model.Id;
  1280. vc.title = model.Title;
  1281. vc.TodoId = model.Id;
  1282. [self.navigationController pushViewController:vc animated:YES];
  1283. }
  1284. break;
  1285. default:
  1286. {
  1287. DownFileViewController *vc = [[DownFileViewController alloc]init];
  1288. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  1289. fmodel.SoureId = model.Id;
  1290. fmodel.Title = model.Title;
  1291. fmodel.Url = model.File;
  1292. vc.model = fmodel;
  1293. [self.navigationController pushViewController:vc animated:YES];
  1294. }
  1295. break;
  1296. }
  1297. }
  1298. #pragma -mark 转发
  1299. - (NoteBookCommentVC *)noteBookCommentVC{
  1300. if (_noteBookCommentVC == nil) {
  1301. _noteBookCommentVC = [NoteBookCommentVC initNoteBookCommentVC];
  1302. [_noteBookCommentVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  1303. [_noteBookCommentVC.view setHidden:YES];
  1304. }
  1305. return _noteBookCommentVC;
  1306. }
  1307. - (void)shareHanderModel:(MyNoteBookSubModel *)model{
  1308. [self.noteBookShareVC initNoteBookShareData];
  1309. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  1310. fmodel.SoureTypeId = CollectModel_NoteBook;
  1311. fmodel.Title = model.Title;
  1312. fmodel.SoureId = model.MiddleId;
  1313. fmodel.Author = model.Name;
  1314. fmodel.SourceUserId = model.SourceUserId;
  1315. self.isBarReturn = NO;
  1316. self.returnModel = fmodel;
  1317. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1318. }
  1319. - (NoteBookShareVC *)noteBookShareVC{
  1320. if (_noteBookShareVC == nil) {
  1321. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  1322. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  1323. [_noteBookShareVC.view setHidden:YES];
  1324. _noteBookShareVC.delegate = self;
  1325. }
  1326. return _noteBookShareVC;
  1327. }
  1328. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  1329. {
  1330. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1331. if ([typeName isEqualToString:@"发给微信好友"]) {
  1332. [self returnToWechatSession];
  1333. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  1334. [self returnToWechatTimeLine];
  1335. }else if ([typeName isEqualToString:@"发到微博"]){
  1336. [self returnToSina];
  1337. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  1338. [self returnToQQ];
  1339. }else if ([typeName isEqualToString:@"发到消息"]){
  1340. [self returnToMessage];
  1341. }else if ([typeName isEqualToString:@"发到小组"]){
  1342. [self returnToGroup];
  1343. }else if ([typeName isEqualToString:@"发到笔记"]){
  1344. [self returnToNote];
  1345. }else if ([typeName isEqualToString:@"发到话题"]){
  1346. [self returnToTopic];
  1347. }else{
  1348. }
  1349. }
  1350. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  1351. {
  1352. //创建分享消息对象
  1353. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  1354. messageObject.title = title;
  1355. //创建网页内容对象
  1356. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
  1357. //设置网页地址
  1358. shareObject.webpageUrl = url;
  1359. //分享消息对象设置分享内容对象
  1360. messageObject.shareObject = shareObject;
  1361. //调用分享接口
  1362. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  1363. if (error) {
  1364. NSLog(@"************Share fail with error %@*********",error);
  1365. }else{
  1366. NSLog(@"response data is %@",data);
  1367. }
  1368. }];
  1369. }
  1370. - (void)returnToWechatSession
  1371. {
  1372. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1373. }
  1374. - (void)returnToWechatTimeLine
  1375. {
  1376. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1377. }
  1378. - (void)returnToSina
  1379. {
  1380. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1381. }
  1382. - (void)returnToQQ
  1383. {
  1384. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1385. }
  1386. - (NSString *)returnUrl
  1387. {
  1388. if (self.isBarReturn) {
  1389. NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=%d&userId=%ld&name=%@&describe=%@",Host(@"/admin/mobile/folderWx?"),(long)self.returnModel.SoureId,CollectModel_NoteFile,(long)self.returnModel.SourceUserId,self.returnModel.Title,self.returnModel.Author];
  1390. return url;
  1391. }else{
  1392. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.returnModel.SoureId];
  1393. return url;
  1394. }
  1395. }
  1396. #pragma mark - 分享功能
  1397. - (void)returnToMessage
  1398. {
  1399. ShareListVC * vc = [ShareListVC initShareListVC];
  1400. vc.sendModel = self.returnModel;
  1401. vc.isReturn = YES;
  1402. [self.navigationController pushViewController:vc animated:YES];
  1403. }
  1404. - (void)returnToGroup
  1405. {
  1406. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  1407. vc.sendModel = self.returnModel;
  1408. vc.type = CollectModel_Group;
  1409. vc.isReturn = YES;
  1410. [self.navigationController pushViewController:vc animated:YES];
  1411. }
  1412. - (void)returnToNote
  1413. {
  1414. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1415. vc.type = CollectModel_NoteBook;
  1416. vc.sendModel = self.returnModel;
  1417. vc.isReturn = YES;
  1418. [self.navigationController pushViewController:vc animated:YES];
  1419. }
  1420. - (void)returnToTopic
  1421. {
  1422. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1423. vc.sendModel = self.returnModel;
  1424. vc.type = CollectModel_NewTopic;
  1425. vc.isReturn = YES;
  1426. [self.navigationController pushViewController:vc animated:YES];
  1427. }
  1428. - (NSAttributedString *)setTextWithStr:(NSString *)str
  1429. {
  1430. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1431. [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
  1432. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
  1433. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1434. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1435. [paraStyle setLineSpacing:5];//行间距
  1436. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1437. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1438. return attributedString;
  1439. }
  1440. - (NSAttributedString *)setTitleWithStr:(NSString *)str
  1441. {
  1442. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1443. [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
  1444. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
  1445. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1446. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1447. [paraStyle setLineSpacing:5];//行间距
  1448. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1449. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1450. return attributedString;
  1451. }
  1452. @end