CommonNoteVC.m 94 KB

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