CommonNoteVC.m 93 KB

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