SourceHomeVC.m 59 KB

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