CommonNoteVC.m 94 KB

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