MyTDTopicViewController.m 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. //
  2. // MyTDTopicViewController.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/10/31.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyTDTopicViewController.h"
  9. #import "MenuListView.h"
  10. #import "MyTDTopicGroupManageVC.h"
  11. #import "SelectModel.h"
  12. #import "TDGroupInfoListModel.h"
  13. #import "TDGroupInfoListCell.h"
  14. #import "TopicListModel.h"
  15. #import "MyTDGroupView.h"
  16. #import "MyTDTopicDetailVC.h"
  17. #import "TopicGroupManageModel.h"
  18. #import "MyTDTopicSearchVC.h"
  19. #import "MyTDTopicCreateVC.h"
  20. #import "NoteBookShareVC.h"
  21. #import "NoteBookVC.h"
  22. #import "MyFavoriteVC.h"
  23. #import "ShowBtn.h"
  24. #import "MyTDGroupViewController.h"
  25. #import "MoveViewController.h"
  26. #import "OtherNoteBookVC.h"
  27. #import "OtherFavoriteVC.h"
  28. #import "HomeDetailController.h"
  29. #import "TDGroupInfoListVC.h"
  30. #import "WorkFlowDetailsController.h"
  31. #import "MyApprovalPageDetail.h"
  32. #import "DownFileViewController.h"
  33. #import "MailListDetailVC.h"
  34. #import "ShareListVC.h"
  35. @interface MyTDTopicViewController ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  36. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  37. @property (weak, nonatomic) IBOutlet UIButton *editBtn;
  38. @property (strong, nonatomic) ShowBtn *titleBtn;
  39. @property (strong, nonatomic) MenuListView * menuListView;
  40. @property (weak, nonatomic) IBOutlet UIView *cusNavBar;
  41. @property (assign, nonatomic) BOOL menuIsShow;
  42. @property (strong, nonatomic) NSMutableArray * groupListArray;
  43. @property (strong, nonatomic) NSMutableArray * dataArray;
  44. @property (strong, nonatomic) NSMutableArray * selectGIdArray;
  45. @property (nonatomic, assign) NSUInteger currentPage;
  46. @property (nonatomic, assign) NSUInteger totalPage;
  47. @property (nonatomic, assign) NSUInteger totalRecord;
  48. @property (strong, nonatomic) NoteBookShareVC * noteBookShareVC;
  49. @property (weak, nonatomic) IBOutlet UIView *noDataView;
  50. @property (weak, nonatomic) IBOutlet UILabel *noDataL;
  51. @end
  52. @implementation MyTDTopicViewController
  53. +(MyTDTopicViewController *)initMyTDTopicViewController;
  54. {
  55. MyTDTopicViewController *controller = [StoryboardManager.shared.myTDTopic instantiateViewControllerWithIdentifier:@"MyTDTopicViewController"];
  56. return controller;
  57. }
  58. - (NoteBookShareVC *)noteBookShareVC{
  59. if (_noteBookShareVC == nil) {
  60. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  61. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  62. [_noteBookShareVC.view setHidden:YES];
  63. _noteBookShareVC.delegate = self;
  64. }
  65. return _noteBookShareVC;
  66. }
  67. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  68. {
  69. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  70. if ([typeName isEqualToString:@"发给微信好友"]) {
  71. [self returnToWechatSession];
  72. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  73. [self returnToWechatTimeLine];
  74. }else if ([typeName isEqualToString:@"发到微博"]){
  75. [self returnToSina];
  76. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  77. [self returnToQQ];
  78. }else if ([typeName isEqualToString:@"发到消息"]){
  79. [self returnToMessage];
  80. }else if ([typeName isEqualToString:@"发到小组"]){
  81. [self returnToGroup];
  82. }else if ([typeName isEqualToString:@"发到笔记"]){
  83. [self returnToNote];
  84. }else if ([typeName isEqualToString:@"发到话题"]){
  85. [self returnToTopic];
  86. }else{
  87. }
  88. }
  89. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  90. {
  91. //创建分享消息对象
  92. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  93. messageObject.title = title;
  94. //创建网页内容对象
  95. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
  96. //设置网页地址
  97. shareObject.webpageUrl = url;
  98. //分享消息对象设置分享内容对象
  99. messageObject.shareObject = shareObject;
  100. //调用分享接口
  101. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  102. if (error) {
  103. NSLog(@"************Share fail with error %@*********",error);
  104. }else{
  105. NSLog(@"response data is %@",data);
  106. }
  107. }];
  108. }
  109. - (void)returnToWechatSession
  110. {
  111. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  112. }
  113. - (void)returnToWechatTimeLine
  114. {
  115. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  116. }
  117. - (void)returnToSina
  118. {
  119. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  120. }
  121. - (void)returnToQQ
  122. {
  123. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  124. }
  125. - (NSString *)returnUrl
  126. {
  127. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.Id];
  128. return url;
  129. }
  130. #pragma mark - 分享功能
  131. - (void)returnToMessage
  132. {
  133. ShareListVC * vc = [ShareListVC initShareListVC];
  134. vc.sendModel = self.sendModel;
  135. vc.isReturn = YES;
  136. [self.navigationController pushViewController:vc animated:YES];
  137. }
  138. - (void)returnToGroup
  139. {
  140. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  141. vc.type = CollectModel_Group;
  142. vc.sendModel = self.sendModel;
  143. vc.isReturn = YES;
  144. [self.navigationController pushViewController:vc animated:YES];
  145. }
  146. - (void)returnToNote
  147. {
  148. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  149. vc.type = CollectModel_NoteBook;
  150. vc.sendModel = self.sendModel;
  151. vc.isReturn = YES;
  152. [self.navigationController pushViewController:vc animated:YES];
  153. }
  154. - (void)returnToTopic
  155. {
  156. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  157. vc.type = CollectModel_NewTopic;
  158. vc.sendModel = self.sendModel;
  159. vc.isReturn = YES;
  160. [self.navigationController pushViewController:vc animated:YES];
  161. }
  162. - (void)viewWillDisappear:(BOOL)animated
  163. {
  164. [super viewWillDisappear:animated];
  165. self.menuIsShow = NO;
  166. }
  167. - (ShowBtn *)titleBtn
  168. {
  169. if (!_titleBtn) {
  170. _titleBtn = [[ShowBtn alloc] init];
  171. }
  172. return _titleBtn;
  173. }
  174. - (void)viewDidLoad {
  175. [super viewDidLoad];
  176. self.fd_prefersNavigationBarHidden = YES;
  177. self.tableView.delegate = self;
  178. self.tableView.dataSource = self;
  179. [self setCusView];
  180. [self.cusNavBar addSubview:self.titleBtn];
  181. [self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  182. make.center.mas_equalTo(self.cusNavBar);
  183. }];
  184. [self autoSizeBtn:@"全部"];
  185. [self getGroupList];
  186. [self setTableViewRefresh];
  187. [self.view addSubview:self.noteBookShareVC.view];
  188. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(headRefresh) name:TOPICDATAUPDATA object:nil];
  189. }
  190. - (void)autoSizeBtn:(NSString *)title
  191. {
  192. [self.titleBtn setLabelTitle:title];
  193. [self.titleBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  194. make.center.mas_equalTo(self.cusNavBar);
  195. }];
  196. [self.cusNavBar layoutIfNeeded];
  197. }
  198. - (void)dealloc
  199. {
  200. [[NSNotificationCenter defaultCenter] removeObserver:self];
  201. }
  202. #pragma mark - UItableView刷新
  203. - (void)setTableViewRefresh{
  204. WeakSelf(self)
  205. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  206. [weakself headRefresh];
  207. }];
  208. // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  209. // [weakself footerRefresh];
  210. // }];
  211. [self.tableView.mj_header beginRefreshing];
  212. }
  213. - (void)headRefresh{
  214. self.currentPage = 1;
  215. self.totalRecord = 0;
  216. self.totalPage = 1;
  217. [self.dataArray removeAllObjects];
  218. [self getData];
  219. }
  220. - (void)footerRefresh{
  221. self.currentPage += 1;
  222. if (self.totalRecord == self.dataArray.count) {
  223. self.currentPage --;
  224. [self.tableView.mj_footer resetNoMoreData];
  225. return ;
  226. }
  227. [self getData];
  228. }
  229. - (void)setCusView
  230. {
  231. self.menuIsShow = NO;
  232. WS(weakSelf);
  233. [self.titleBtn setAction:^{
  234. if (!weakSelf.menuIsShow) {
  235. [weakSelf.menuListView show];
  236. [weakSelf.titleBtn show];
  237. weakSelf.menuListView.SelectBtnblock = ^(NSArray * _Nonnull array) {
  238. [weakSelf.titleBtn dismiss];
  239. [weakSelf.selectGIdArray removeAllObjects];
  240. NSMutableString * showName = [[NSMutableString alloc] init];
  241. for (NSArray * subArray in array) {
  242. for (TopicGroupManageModel * model in subArray) {
  243. if (model.isSelect) {
  244. [showName appendString:model.Name];
  245. [showName appendString:@"、"];
  246. [weakSelf.selectGIdArray addObject:@(model.Id)];
  247. }
  248. }
  249. }
  250. if (showName.length > 1) {
  251. [showName deleteCharactersInRange:NSMakeRange(showName.length - 1, 1)];
  252. if (showName.length >= 10) {
  253. NSRange range1 = NSMakeRange(8, showName.length - 8);
  254. NSString *resultStr1 = [showName stringByReplacingCharactersInRange:range1 withString:@"..."];
  255. [weakSelf autoSizeBtn:resultStr1];
  256. }else{
  257. [weakSelf autoSizeBtn:showName];
  258. }
  259. }
  260. if (weakSelf.selectGIdArray.count > 0) {
  261. dispatch_async(dispatch_get_main_queue(), ^{
  262. [weakSelf headRefresh];
  263. });
  264. }
  265. };
  266. weakSelf.menuListView.dismissBlock = ^{
  267. [weakSelf.titleBtn dismiss];
  268. };
  269. weakSelf.menuListView.SelectGroupblock = ^{
  270. [weakSelf.titleBtn dismiss];
  271. weakSelf.menuIsShow = NO;
  272. [weakSelf.menuListView dismiss];
  273. MyTDTopicGroupManageVC * vc = [MyTDTopicGroupManageVC initMyTDTopicGroupManageVC];
  274. vc.RefreshListBlock = ^{
  275. [weakSelf getGroupList];
  276. };
  277. [weakSelf.navigationController pushViewController:vc animated:YES];
  278. };
  279. weakSelf.menuIsShow = YES;
  280. }else{
  281. weakSelf.menuIsShow = NO;
  282. [weakSelf.titleBtn dismiss];
  283. [weakSelf.menuListView dismiss];
  284. }
  285. }];
  286. [self.editBtn setAction:^{
  287. weakSelf.menuIsShow = NO;
  288. [weakSelf.titleBtn dismiss];
  289. [weakSelf.menuListView dismiss];
  290. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  291. vc.type = CollectModel_NewTopic;
  292. vc.upDateBlock = ^{
  293. [weakSelf headRefresh];
  294. };
  295. [weakSelf.navigationController pushViewController:vc animated:YES];
  296. }];
  297. }
  298. #pragma mark - 网络请求
  299. - (void)getGroupList
  300. {
  301. [self.groupListArray removeAllObjects];
  302. WS(weakSelf);
  303. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Group) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  304. NSLog(@"%@",responseObject);
  305. NSArray * array = responseObject;
  306. TopicGroupManageModel * allModel = [[TopicGroupManageModel alloc] init];
  307. allModel.Name = @"全部";
  308. allModel.Id = 0;
  309. allModel.isSelect = NO;
  310. [weakSelf.groupListArray addObject:allModel];
  311. [array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  312. NSDictionary * dict = (NSDictionary *)obj;
  313. TopicGroupManageModel * model = [TopicGroupManageModel modelWithDictionary:dict];
  314. [weakSelf.groupListArray addObject:model];
  315. }];
  316. dispatch_async(dispatch_get_main_queue(), ^{
  317. weakSelf.menuListView = [MenuListView MenuListViewaddArray:@[weakSelf.groupListArray] showToView:self.cusNavBar MenuType:MenuMoreSelectType];
  318. });
  319. } failure:^(NSError * _Nonnull error) {
  320. }];
  321. }
  322. - (void)getData
  323. {
  324. BOOL isAll = NO;
  325. for (NSInteger i = 0; i < self.selectGIdArray.count; i ++) {
  326. if ([self.selectGIdArray[i] integerValue] == 0) {
  327. isAll = YES;
  328. }
  329. }
  330. if (isAll) {
  331. [self.selectGIdArray removeAllObjects];
  332. }
  333. WS(weakSelf);
  334. NSDictionary * paraDict = @{@"ParentId":@(0),
  335. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  336. @"Keyword": @"",
  337. @"Page":@(self.currentPage),
  338. @"TopicGroupIds": self.selectGIdArray,
  339. @"PerPage": @(99999999),
  340. // @"PerPage": @(10),
  341. @"Sort":@""
  342. };
  343. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_List_Page) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  344. NSLog(@"%@",responseObject);
  345. [weakSelf.tableView.mj_header endRefreshing];
  346. [weakSelf.tableView.mj_footer endRefreshing];
  347. TopicListModel * model = [TopicListModel modelWithDictionary:responseObject];
  348. weakSelf.totalRecord = model.Total;
  349. [weakSelf.dataArray addObjectsFromArray:model.Items];
  350. if (weakSelf.totalRecord == weakSelf.dataArray.count) {
  351. [weakSelf.tableView.mj_footer resetNoMoreData];
  352. }
  353. dispatch_async(dispatch_get_main_queue(), ^{
  354. if (weakSelf.dataArray.count > 0) {
  355. weakSelf.noDataView.hidden = YES;
  356. weakSelf.tableView.hidden = NO;
  357. [weakSelf.tableView reloadData];
  358. }else{
  359. weakSelf.noDataView.hidden = NO;
  360. weakSelf.tableView.hidden = YES;
  361. weakSelf.noDataL.text = @"暂无话题内容";
  362. }
  363. });
  364. } failure:^(NSError * _Nonnull error) {
  365. [weakSelf.tableView.mj_header endRefreshing];
  366. [weakSelf.tableView.mj_footer endRefreshing];
  367. }];
  368. }
  369. #pragma mark - UITableViewDelegate
  370. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  371. {
  372. return self.dataArray.count + 1;
  373. }
  374. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  375. {
  376. if (section == 0) {
  377. return 0;
  378. }
  379. return 1;
  380. }
  381. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  382. {
  383. WS(weakSelf);
  384. TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
  385. switch (model.DataType) {
  386. case TopiclistCellImage:
  387. {
  388. TDGroupInfoListCell * cell;
  389. switch (model.Data.count) {
  390. case 1:
  391. {
  392. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  393. cell.cellImagV1.hidden = NO;
  394. cell.cellImagV2.hidden = YES;
  395. cell.cellImagV3.hidden = YES;
  396. cell.cellImagV4.hidden = YES;
  397. cell.cellImagV5.hidden = YES;
  398. cell.cellImagV6.hidden = YES;
  399. cell.cellImagV7.hidden = YES;
  400. cell.cellImagV8.hidden = YES;
  401. cell.cellImagV9.hidden = YES;
  402. TopicListSubModel * subModel0 = model.Data[0];
  403. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  404. }
  405. break;
  406. case 2:
  407. {
  408. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  409. cell.cellImagV1.hidden = NO;
  410. cell.cellImagV2.hidden = NO;
  411. cell.cellImagV3.hidden = YES;
  412. cell.cellImagV4.hidden = YES;
  413. cell.cellImagV5.hidden = YES;
  414. cell.cellImagV6.hidden = YES;
  415. cell.cellImagV7.hidden = YES;
  416. cell.cellImagV8.hidden = YES;
  417. cell.cellImagV9.hidden = YES;
  418. TopicListSubModel * subModel0 = model.Data[0];
  419. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  420. TopicListSubModel * subModel1 = model.Data[1];
  421. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  422. }
  423. break;
  424. case 3:
  425. {
  426. cell = [TDGroupInfoListCell configCell2:tableView indexPath:indexPath];
  427. cell.cellImagV1.hidden = NO;
  428. cell.cellImagV2.hidden = NO;
  429. cell.cellImagV3.hidden = NO;
  430. cell.cellImagV4.hidden = YES;
  431. cell.cellImagV5.hidden = YES;
  432. cell.cellImagV6.hidden = YES;
  433. cell.cellImagV7.hidden = YES;
  434. cell.cellImagV8.hidden = YES;
  435. cell.cellImagV9.hidden = YES;
  436. TopicListSubModel * subModel0 = model.Data[0];
  437. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  438. TopicListSubModel * subModel1 = model.Data[1];
  439. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  440. TopicListSubModel * subModel2 = model.Data[2];
  441. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  442. }
  443. break;
  444. case 4:
  445. {
  446. cell = [TDGroupInfoListCell configCell3:tableView indexPath:indexPath];
  447. cell.cellImagV1.hidden = NO;
  448. cell.cellImagV2.hidden = NO;
  449. cell.cellImagV3.hidden = NO;
  450. cell.cellImagV4.hidden = NO;
  451. cell.cellImagV5.hidden = YES;
  452. cell.cellImagV6.hidden = YES;
  453. cell.cellImagV7.hidden = YES;
  454. cell.cellImagV8.hidden = YES;
  455. cell.cellImagV9.hidden = YES;
  456. TopicListSubModel * subModel0 = model.Data[0];
  457. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  458. TopicListSubModel * subModel1 = model.Data[1];
  459. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  460. TopicListSubModel * subModel2 = model.Data[2];
  461. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  462. TopicListSubModel * subModel3 = model.Data[3];
  463. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  464. }
  465. break;
  466. case 5:
  467. {
  468. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  469. cell.cellImagV1.hidden = NO;
  470. cell.cellImagV2.hidden = NO;
  471. cell.cellImagV3.hidden = NO;
  472. cell.cellImagV4.hidden = NO;
  473. cell.cellImagV5.hidden = NO;
  474. cell.cellImagV6.hidden = YES;
  475. cell.cellImagV7.hidden = YES;
  476. cell.cellImagV8.hidden = YES;
  477. cell.cellImagV9.hidden = YES;
  478. TopicListSubModel * subModel0 = model.Data[0];
  479. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  480. TopicListSubModel * subModel1 = model.Data[1];
  481. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  482. TopicListSubModel * subModel2 = model.Data[2];
  483. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  484. TopicListSubModel * subModel3 = model.Data[3];
  485. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  486. TopicListSubModel * subModel4 = model.Data[4];
  487. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  488. }
  489. break;
  490. case 6:
  491. {
  492. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  493. cell.cellImagV1.hidden = NO;
  494. cell.cellImagV2.hidden = NO;
  495. cell.cellImagV3.hidden = NO;
  496. cell.cellImagV4.hidden = NO;
  497. cell.cellImagV5.hidden = NO;
  498. cell.cellImagV6.hidden = NO;
  499. cell.cellImagV7.hidden = YES;
  500. cell.cellImagV8.hidden = YES;
  501. cell.cellImagV9.hidden = YES;
  502. TopicListSubModel * subModel0 = model.Data[0];
  503. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  504. TopicListSubModel * subModel1 = model.Data[1];
  505. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  506. TopicListSubModel * subModel2 = model.Data[2];
  507. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  508. TopicListSubModel * subModel3 = model.Data[3];
  509. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  510. TopicListSubModel * subModel4 = model.Data[4];
  511. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  512. TopicListSubModel * subModel5 = model.Data[5];
  513. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  514. }
  515. break;
  516. case 7:
  517. {
  518. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  519. cell.cellImagV1.hidden = NO;
  520. cell.cellImagV2.hidden = NO;
  521. cell.cellImagV3.hidden = NO;
  522. cell.cellImagV4.hidden = NO;
  523. cell.cellImagV5.hidden = NO;
  524. cell.cellImagV6.hidden = NO;
  525. cell.cellImagV7.hidden = NO;
  526. cell.cellImagV8.hidden = YES;
  527. cell.cellImagV9.hidden = YES;
  528. TopicListSubModel * subModel0 = model.Data[0];
  529. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  530. TopicListSubModel * subModel1 = model.Data[1];
  531. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  532. TopicListSubModel * subModel2 = model.Data[2];
  533. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  534. TopicListSubModel * subModel3 = model.Data[3];
  535. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  536. TopicListSubModel * subModel4 = model.Data[4];
  537. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  538. TopicListSubModel * subModel5 = model.Data[5];
  539. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  540. TopicListSubModel * subModel6 = model.Data[6];
  541. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  542. }
  543. break;
  544. case 8:
  545. {
  546. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  547. cell.cellImagV1.hidden = NO;
  548. cell.cellImagV2.hidden = NO;
  549. cell.cellImagV3.hidden = NO;
  550. cell.cellImagV4.hidden = NO;
  551. cell.cellImagV5.hidden = NO;
  552. cell.cellImagV6.hidden = NO;
  553. cell.cellImagV7.hidden = NO;
  554. cell.cellImagV8.hidden = NO;
  555. cell.cellImagV9.hidden = YES;
  556. TopicListSubModel * subModel0 = model.Data[0];
  557. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  558. TopicListSubModel * subModel1 = model.Data[1];
  559. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  560. TopicListSubModel * subModel2 = model.Data[2];
  561. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  562. TopicListSubModel * subModel3 = model.Data[3];
  563. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  564. TopicListSubModel * subModel4 = model.Data[4];
  565. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  566. TopicListSubModel * subModel5 = model.Data[5];
  567. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  568. TopicListSubModel * subModel6 = model.Data[6];
  569. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  570. TopicListSubModel * subModel7 = model.Data[7];
  571. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  572. }
  573. break;
  574. default:
  575. {
  576. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  577. cell.cellImagV1.hidden = NO;
  578. cell.cellImagV2.hidden = NO;
  579. cell.cellImagV3.hidden = NO;
  580. cell.cellImagV4.hidden = NO;
  581. cell.cellImagV5.hidden = NO;
  582. cell.cellImagV6.hidden = NO;
  583. cell.cellImagV7.hidden = NO;
  584. cell.cellImagV8.hidden = NO;
  585. cell.cellImagV9.hidden = NO;
  586. TopicListSubModel * subModel0 = model.Data[0];
  587. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  588. TopicListSubModel * subModel1 = model.Data[1];
  589. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  590. TopicListSubModel * subModel2 = model.Data[2];
  591. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  592. TopicListSubModel * subModel3 = model.Data[3];
  593. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  594. TopicListSubModel * subModel4 = model.Data[4];
  595. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  596. TopicListSubModel * subModel5 = model.Data[5];
  597. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  598. TopicListSubModel * subModel6 = model.Data[6];
  599. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  600. TopicListSubModel * subModel7 = model.Data[7];
  601. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  602. TopicListSubModel * subModel8 = model.Data[8];
  603. [cell.cellImagV9 sd_setImageWithURL:[NSURL URLWithString:subModel8.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  604. }
  605. break;
  606. }
  607. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  608. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  609. [cell.fileBtn setAction:^{
  610. [weakSelf enterFileWithModel:model];
  611. }];
  612. cell.ClickUserBlock = ^{
  613. [weakSelf showUserInfo:model.UserId];
  614. };
  615. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  616. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  617. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  618. cell.cellNameL.text = model.UserName;
  619. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  620. [cell.cellLikeBtn setAction:^{
  621. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  622. }];
  623. if (model.CommentCount > 0) {
  624. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  625. }else{
  626. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  627. }
  628. if (model.PraiseCount > 0) {
  629. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  630. }else{
  631. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  632. }
  633. if (model.IsPraise) {
  634. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  635. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  636. }else{
  637. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  638. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  639. }
  640. [cell.cellPingBtn setAction:^{
  641. [weakSelf CommentPush:model];
  642. }];
  643. [cell.cellSendBtn setAction:^{
  644. [weakSelf reSend:model];
  645. }];
  646. if (model.Title.length == 0) {
  647. cell.TitleConstant.constant = 0;
  648. }else{
  649. cell.TitleConstant.constant = 10.f;
  650. }
  651. if (model.Content.length == 0) {
  652. cell.subTitleContant.constant = 0.f;
  653. }else{
  654. cell.subTitleContant.constant = 7.5f;
  655. }
  656. cell.fileContant.constant = 0.f;
  657. return cell;
  658. }
  659. break;
  660. case TopiclistCellFile:
  661. {
  662. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell6:tableView indexPath:indexPath];
  663. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  664. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  665. [cell.fileBtn setAction:^{
  666. [weakSelf enterFileWithModel:model];
  667. }];
  668. [cell.ClickFileAction setAction:^{
  669. [weakSelf pushFileWithModel:model.Data.firstObject];
  670. }];
  671. cell.cellNameL.text = model.UserName;
  672. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  673. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  674. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  675. [cell setDataWithCell6:model.Data.firstObject];
  676. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  677. [cell.cellLikeBtn setAction:^{
  678. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  679. }];
  680. if (model.CommentCount > 0) {
  681. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  682. }else{
  683. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  684. }
  685. if (model.PraiseCount > 0) {
  686. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  687. }else{
  688. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  689. }
  690. if (model.IsPraise) {
  691. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  692. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  693. }else{
  694. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  695. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  696. }
  697. [cell.cellPingBtn setAction:^{
  698. [weakSelf CommentPush:model];
  699. }];
  700. [cell.cellSendBtn setAction:^{
  701. [weakSelf reSend:model];
  702. }];
  703. if (model.Title.length == 0) {
  704. cell.TitleConstant.constant = 0;
  705. }else{
  706. cell.TitleConstant.constant = 10.f;
  707. }
  708. if (model.Content.length == 0) {
  709. cell.subTitleContant.constant = 0.f;
  710. }else{
  711. cell.subTitleContant.constant = 7.5f;
  712. }
  713. cell.ClickUserBlock = ^{
  714. [weakSelf showUserInfo:model.UserId];
  715. };
  716. return cell;
  717. }
  718. break;
  719. default:///TopiclistCellNone
  720. {
  721. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell0:tableView indexPath:indexPath];
  722. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  723. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  724. [cell.fileBtn setAction:^{
  725. [weakSelf enterFileWithModel:model];
  726. }];
  727. cell.cellNameL.text = model.UserName;
  728. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  729. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  730. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  731. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  732. [cell.cellLikeBtn setAction:^{
  733. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  734. }];
  735. if (model.CommentCount > 0) {
  736. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  737. }else{
  738. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  739. }
  740. if (model.PraiseCount > 0) {
  741. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  742. }else{
  743. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  744. }
  745. if (model.IsPraise) {
  746. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  747. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  748. }else{
  749. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  750. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  751. }
  752. [cell.cellPingBtn setAction:^{
  753. [weakSelf CommentPush:model];
  754. }];
  755. [cell.cellSendBtn setAction:^{
  756. [weakSelf reSend:model];
  757. }];
  758. if (model.Title.length == 0) {
  759. cell.TitleConstant.constant = 0;
  760. }else{
  761. cell.TitleConstant.constant = 10.f;
  762. }
  763. if (model.Content.length == 0) {
  764. cell.subTitleContant.constant = 0.f;
  765. }else{
  766. cell.subTitleContant.constant = 7.5f;
  767. }
  768. cell.ClickUserBlock = ^{
  769. [weakSelf showUserInfo:model.UserId];
  770. };
  771. return cell;
  772. }
  773. break;
  774. }
  775. }
  776. - (void)enterFileWithModel:(TopicListItemModel *)model
  777. {
  778. if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
  779. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  780. vc.listType = MyFavoriteListLevelTypeB;
  781. vc.FolderId = model.FolderResult.Id;
  782. vc.ParentId = model.FolderResult.Id;
  783. vc.myTitle = model.FolderResult.FolderName;
  784. vc.VisitUserId = model.UserId;
  785. [self.navigationController pushViewController:vc animated:YES];
  786. }else{
  787. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  788. vc.listType = MyFavoriteListLevelTypeB;
  789. vc.FolderId = model.FolderResult.Id;
  790. vc.Author = model.UserName;
  791. vc.myTitle = model.FolderResult.FolderName;
  792. vc.VisitUserId = model.UserId;
  793. vc.TypeValue = 1;
  794. [self.navigationController pushViewController:vc animated:YES];
  795. }
  796. }
  797. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  798. {
  799. if (section == 0) {
  800. return 50.f;
  801. }
  802. return 0.01f;
  803. }
  804. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  805. {
  806. if (section == 0) {
  807. return 0.01f;
  808. }
  809. return 8.f;
  810. }
  811. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  812. {
  813. if (section == 0) {
  814. UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
  815. MyTDGroupView * groupView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  816. [view addSubview:groupView];
  817. view.backgroundColor = UIColorHex(FFFFFF);
  818. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSearchVC)];
  819. [view addGestureRecognizer:tap];
  820. view.userInteractionEnabled = YES;
  821. return view;
  822. }else{
  823. return [UIView new];
  824. }
  825. }
  826. - (void)showUserInfo:(NSInteger)userId
  827. {
  828. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  829. vc.indexId = userId;
  830. [self.navigationController pushViewController:vc animated:YES];
  831. }
  832. #pragma mark - 点击文件跳转
  833. - (void)pushFileWithModel:(TopicListSubModel *)model
  834. {
  835. WS(weakSelf);
  836. switch (model.Type) {
  837. case CollectModel_Aritle:
  838. {
  839. SHOWLOADING
  840. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  841. REMOVESHOW;
  842. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  843. // HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  844. // [homeDetail loadCurrentModel:itemModel];
  845. // [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  846. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  847. vc.type = CollectModel_Aritle;
  848. vc.Id = itemModel.Id;
  849. [weakSelf.navigationController pushViewController:vc animated:YES];
  850. } failure:^(NSError * _Nonnull error) {
  851. SHOWERROR([ZYCTool handerResultData:error]);
  852. }];
  853. }
  854. break;
  855. case CollectModel_Toipc:
  856. {
  857. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  858. vc.type = CollectModel_Toipc;
  859. vc.Id = model.Id;
  860. [self.navigationController pushViewController:vc animated:YES];
  861. }
  862. break;
  863. case CollectModel_NewTopic:
  864. {
  865. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  866. vc.type = CollectModel_NewTopic;
  867. vc.Id = model.Id;
  868. [self.navigationController pushViewController:vc animated:YES];
  869. }
  870. break;
  871. case CollectModel_Collect:
  872. {
  873. }
  874. break;
  875. case CollectModel_NoteBook:
  876. {
  877. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  878. vc.type = CollectModel_NoteBook;
  879. vc.Id = model.Id;
  880. [self.navigationController pushViewController:vc animated:YES];
  881. }
  882. break;
  883. case CollectModel_CollectFile:{
  884. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  885. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  886. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  887. vc.ParentId = 0;
  888. vc.FolderId = model.Id;
  889. vc.myTitle = model.Title;
  890. [self.navigationController pushViewController:vc animated:YES];
  891. }else{
  892. OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
  893. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  894. vc.ParentId = 0;
  895. vc.FolderId = model.Id;
  896. vc.myTitle = model.Title;
  897. vc.VisitUserId = model.SourceUserId;
  898. [self.navigationController pushViewController:vc animated:YES];
  899. }
  900. }break;
  901. case CollectModel_NoteFile:{
  902. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  903. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  904. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  905. vc.ParentId = 0;
  906. vc.FolderId = model.Id;
  907. vc.myTitle = model.Title;
  908. vc.VisitUserId = 0;
  909. [self.navigationController pushViewController:vc animated:YES];
  910. }else{
  911. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  912. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  913. vc.FolderId = model.Id;
  914. vc.myTitle = model.Title;
  915. vc.TypeValue = 1;
  916. vc.VisitUserId = model.SourceUserId;
  917. [self.navigationController pushViewController:vc animated:YES];
  918. }
  919. }break;
  920. case CollectModel_Notice:
  921. {
  922. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  923. vc.type = CollectModel_Notice;
  924. vc.Id = model.Id;
  925. [self.navigationController pushViewController:vc animated:YES];
  926. }
  927. break;
  928. case CollectModel_InterMail:
  929. {
  930. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  931. vc.type = CollectModel_InterMail;
  932. vc.Id = model.Id;
  933. [self.navigationController pushViewController:vc animated:YES];
  934. }
  935. break;
  936. case CollectModel_Group:
  937. {
  938. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  939. vc.GroupId = model.Id;
  940. vc.titleStr = model.Title;
  941. [self.navigationController pushViewController:vc animated:YES];
  942. }
  943. break;
  944. case CollectModel_meetMian:
  945. {
  946. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  947. vc.type = CollectModel_meetMian;
  948. vc.Id = model.Id;
  949. [self.navigationController pushViewController:vc animated:YES];
  950. }
  951. break;
  952. case CollectModel_meetDetail:
  953. {
  954. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  955. [self.navigationController pushViewController:vc animated:YES];
  956. }
  957. break;
  958. case CollectModel_work:
  959. {
  960. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  961. vc.pageType = Type_ONEC;
  962. vc.indexId = model.Id;
  963. vc.title = model.Title;
  964. vc.TodoId = model.Id;
  965. [self.navigationController pushViewController:vc animated:YES];
  966. }
  967. break;
  968. default:
  969. {
  970. DownFileViewController *vc = [[DownFileViewController alloc]init];
  971. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  972. fmodel.SoureId = model.Id;
  973. fmodel.Title = model.Title;
  974. fmodel.Url = model.File;
  975. vc.model = fmodel;
  976. [self.navigationController pushViewController:vc animated:YES];
  977. }
  978. break;
  979. }
  980. }
  981. - (void)pushSearchVC
  982. {
  983. MyTDTopicSearchVC * vc = [[MyTDTopicSearchVC alloc] init];
  984. vc.searchType = TDTopicSearch;
  985. [self.navigationController pushViewController:vc animated:YES];
  986. }
  987. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
  988. {
  989. UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 8)];
  990. view.backgroundColor = UIColorHex(#F5F6F8);
  991. return view;
  992. }
  993. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  994. {
  995. WS(weakSelf);
  996. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  997. TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
  998. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  999. vc.type = CollectModel_NewTopic;
  1000. vc.RefreshTopicBlock = ^{
  1001. [weakSelf headRefresh];
  1002. };
  1003. vc.Id = model.Id;
  1004. [self.navigationController pushViewController:vc animated:YES];
  1005. }
  1006. #pragma mark - loadData
  1007. - (NSMutableArray *)groupListArray
  1008. {
  1009. if (!_groupListArray) {
  1010. _groupListArray = [NSMutableArray array];
  1011. }
  1012. return _groupListArray;
  1013. }
  1014. - (NSMutableArray *)selectGIdArray
  1015. {
  1016. if (!_selectGIdArray) {
  1017. _selectGIdArray = [NSMutableArray array];
  1018. }
  1019. return _selectGIdArray;
  1020. }
  1021. - (NSMutableArray *)dataArray
  1022. {
  1023. if (!_dataArray) {
  1024. _dataArray = [NSMutableArray array];
  1025. }
  1026. return _dataArray;
  1027. }
  1028. - (void)backAction:(id)sender
  1029. {
  1030. [super backAction:sender];
  1031. self.menuIsShow = NO;
  1032. [self.menuListView dismiss];
  1033. }
  1034. #pragma mark - 点击评论
  1035. - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
  1036. {
  1037. WS(weakSelf);
  1038. NSDictionary * paraDict = @{@"SourceId":@(model.Id),
  1039. @"TypeValue":@(3),///3 笔记
  1040. @"AnalyzeType":@(1)
  1041. };
  1042. btn.enabled = NO;
  1043. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  1044. btn.enabled = YES;
  1045. model.IsPraise = !model.IsPraise;
  1046. model.PraiseCount = model.IsPraise ? (model.PraiseCount + 1) : (model.PraiseCount - 1);
  1047. dispatch_async(dispatch_get_main_queue(), ^{
  1048. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1049. });
  1050. } failure:^(NSError * _Nonnull error) {
  1051. btn.enabled = YES;
  1052. }];
  1053. }
  1054. - (void)CommentPush:(TopicListItemModel *)model
  1055. {
  1056. WS(weakSelf);
  1057. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1058. vc.type = CollectModel_NewTopic;
  1059. vc.RefreshTopicBlock = ^{
  1060. [weakSelf headRefresh];
  1061. };
  1062. vc.Id = model.Id;
  1063. vc.isComment = YES;
  1064. [self.navigationController pushViewController:vc animated:YES];
  1065. }
  1066. - (void)reSend:(TopicListItemModel *)model
  1067. {
  1068. FlowAttachmentsModel * topicModel = [[FlowAttachmentsModel alloc] init];
  1069. topicModel.SoureTypeId = CollectModel_NewTopic;
  1070. topicModel.Title = model.Title;
  1071. topicModel.SoureId = model.Id;
  1072. topicModel.Title = model.Title;
  1073. topicModel.Author = model.UserName;
  1074. self.sendModel = topicModel;
  1075. [self.noteBookShareVC initNoteBookShareData];
  1076. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1077. }
  1078. - (NSAttributedString *)setTextWithStr:(NSString *)str
  1079. {
  1080. if (str.length == 0) {
  1081. return [[NSAttributedString alloc] initWithString:@""];
  1082. }
  1083. return [[NSAttributedString alloc] initWithString:str];
  1084. // NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1085. // [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
  1086. // [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
  1087. // NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1088. // paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1089. // [paraStyle setLineSpacing:5];//行间距
  1090. // [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1091. // [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1092. // return attributedString;
  1093. }
  1094. - (NSAttributedString *)setTitleWithStr:(NSString *)str
  1095. {
  1096. if (str.length == 0) {
  1097. return [[NSAttributedString alloc] initWithString:@""];
  1098. }
  1099. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1100. [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
  1101. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
  1102. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1103. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1104. [paraStyle setLineSpacing:5];//行间距
  1105. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1106. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1107. return attributedString;
  1108. }
  1109. @end