SourceHomeVC.m 59 KB

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