CommonHomeVC.m 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. //
  2. // CommonHomeVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/4/28.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "CommonHomeVC.h"
  9. #import "CommonListCell.h"
  10. #import "MyTDGroupView.h"
  11. #import "GHRefreshCollectionView.h"
  12. #import "CommonBarCell.h"
  13. #import "CommonBarModel.h"
  14. #import "CommonWorkVC.h"
  15. #import "CommonToolVC.h"
  16. #import "MyFavoriteVC.h"
  17. #import "CommonNoteVC.h"
  18. #import "ChatMsgListCell.h"
  19. #import "ChatMsgCollectionCell.h"
  20. #import "MoveViewController.h"
  21. #import "MyFavoriteVC.h"
  22. #import "CommonNoteVC.h"
  23. #import "MyFavoriteVC.h"
  24. #import "NoteBookVC.h"
  25. #import "OtherFavoriteVC.h"
  26. #import "OtherNoteBookVC.h"
  27. #import "DownFileViewController.h"
  28. #import "WorkFlowDetailsController.h"
  29. #import "MyApprovalPageDetail.h"
  30. #import "CountDataVC.h"
  31. #import "CommomSearchVC.h"
  32. #import "NoteBookShareVC.h"
  33. #import "MyTDGroupViewController.h"
  34. #import "TDGroupInfoListVC.h"
  35. #import "MailListVC.h"
  36. #import "ShareListVC.h"
  37. #import "BookWCDetailVC.h"
  38. #import "BookListenVC.h"
  39. #import "BookTeacherDetailVC.h"
  40. #import "HomeSCDetailVC.h"
  41. @interface CommonHomeVC ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource,NoteBookShareVCDelegate>
  42. @property (weak, nonatomic) IBOutlet UIView *NavBar;
  43. @property (strong, nonatomic) UIView *HeadView;
  44. @property (strong, nonatomic) UITableView *tableView;
  45. @property (strong, nonatomic) MyTDGroupView *SearchView;
  46. @property (strong, nonatomic) GHRefreshCollectionView *collectionView;
  47. @property (strong, nonatomic) NSMutableArray *collectionDataSource;
  48. @property (strong, nonatomic) NSMutableArray *dataArray;
  49. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  50. @property (strong, nonatomic) MyFavoriteSubModel *sendModel;
  51. @property (nonatomic,assign) NSInteger currentPage;
  52. @property (nonatomic,assign) NSInteger totalPage;
  53. @property (nonatomic,strong) NSData *fileData;
  54. @end
  55. @implementation CommonHomeVC
  56. - (UIView *)HeadView
  57. {
  58. if (!_HeadView) {
  59. _HeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 46)];
  60. _HeadView.backgroundColor = [UIColor whiteColor];
  61. }
  62. return _HeadView;
  63. }
  64. //- (void)setTableRefresh
  65. //{
  66. // WS(weakSelf);
  67. // self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  68. // [weakSelf headRefresh];
  69. // }];
  70. // self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  71. // [weakSelf footerRefresh];
  72. // }];
  73. // [self.tableView.mj_header beginRefreshing];
  74. //}
  75. //- (void)headRefresh{
  76. // self.currentPage = 1;
  77. // self.totalPage = 1;
  78. // [self.dataArray removeAllObjects];
  79. // [self getDataList];
  80. //}
  81. //- (void)footerRefresh{
  82. // self.currentPage += 1;
  83. // if (self.totalPage == self.dataArray.count) {
  84. // self.currentPage --;
  85. // [self.tableView.mj_footer resetNoMoreData];
  86. // return ;
  87. // }
  88. // [self getDataList];
  89. //}
  90. - (void)viewWillAppear:(BOOL)animated
  91. {
  92. [super viewWillAppear:animated];
  93. self.tabBarController.tabBar.hidden = NO;
  94. [self getDataList];
  95. }
  96. - (void)viewDidLoad {
  97. [super viewDidLoad];
  98. // [self setTableRefresh];
  99. self.fd_prefersNavigationBarHidden = YES;
  100. self.view.backgroundColor = UIColorHex(0xffffff);
  101. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  102. [self.HeadView addSubview:self.SearchView];
  103. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  104. make.top.mas_offset(5);
  105. make.left.right.mas_equalTo(self.HeadView);
  106. make.height.mas_offset(36);
  107. }];
  108. [self.view addSubview:self.tableView];
  109. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  110. make.left.right.mas_equalTo(self.view);
  111. make.top.mas_equalTo(self.NavBar.mas_bottom);
  112. if (@available(iOS 11.0, *)) {
  113. make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
  114. } else {
  115. make.bottom.equalTo(self.view.mas_bottom);
  116. }
  117. }];
  118. self.tableView.tableHeaderView = self.HeadView;
  119. [self setBarData];
  120. WS(weakSelf);
  121. [self.SearchView.button setAction:^{
  122. CommomSearchVC * vc = [[CommomSearchVC alloc] init];
  123. vc.hidesBottomBarWhenPushed = YES;
  124. [weakSelf.navigationController pushViewController:vc animated:YES];
  125. }];
  126. self.tableView.delegate = self;
  127. self.tableView.dataSource = self;
  128. self.tableView.backgroundColor = [UIColor clearColor];
  129. [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
  130. [[UtilsTools getWindow] bringSubviewToFront:self.noteBookShareVC.view];
  131. }
  132. - (void)getDataList {
  133. WS(weakSelf);
  134. SHOWLOADING
  135. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Collection_List) parameters:@{@"FolderId":@(0),@"Page":@(1),@"PerPage":@(99999999),@"VisitUserId":@(0)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  136. REMOVESHOW
  137. [weakSelf.dataArray removeAllObjects];
  138. MyFavoriteModel *listModel = [[MyFavoriteModel alloc] initWithDictionary:responseObject error:nil];
  139. weakSelf.totalPage = listModel.Total;
  140. [weakSelf.dataArray addObjectsFromArray:listModel.Items];
  141. for (MyFavoriteSubModel *model in weakSelf.dataArray) {
  142. if (model.CollectionType == CollectModel_Text) {
  143. model.CollectionType = CollectModel_Aritle;
  144. }
  145. }
  146. [weakSelf changeMessageStatusWithNumber:weakSelf.dataArray.count];
  147. dispatch_async(dispatch_get_main_queue(), ^{
  148. [weakSelf.tableView reloadData];
  149. });
  150. } failure:^(NSError * _Nonnull error) {
  151. REMOVESHOW
  152. }];
  153. }
  154. - (BOOL)hidesBottomBarWhenPushed{
  155. return NO;
  156. }
  157. #pragma mark - UITableViewDelegate
  158. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  159. return 2;
  160. }
  161. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  162. switch (section) {
  163. case 0:{
  164. return 1;
  165. }break;
  166. default:{
  167. return self.dataArray.count;
  168. }break;
  169. }
  170. }
  171. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  172. switch (indexPath.section) {
  173. case 0:{
  174. return 74.f;
  175. }break;
  176. default:{
  177. return UITableViewAutomaticDimension;
  178. }break;
  179. }
  180. }
  181. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  182. {
  183. switch (section) {
  184. case 0:{
  185. return 0.f;
  186. }break;
  187. default:{
  188. return 36.f;
  189. }break;
  190. }
  191. }
  192. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  193. {
  194. switch (section) {
  195. case 0:{
  196. UIView * view = [UIView new];
  197. return view;
  198. }break;
  199. default:{
  200. UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  201. view.backgroundColor = UIColorHex(0xF5F5F5);
  202. UILabel * label = [UILabel new];
  203. label.font = [UIFont systemFontOfSize:14];
  204. label.textColor = UIColorHex(0x888888);
  205. label.text = @"最新收藏";
  206. [view addSubview:label];
  207. [label mas_makeConstraints:^(MASConstraintMaker *make) {
  208. make.left.mas_offset(15);
  209. make.centerY.mas_equalTo(view);
  210. }];
  211. return view;
  212. }break;
  213. }
  214. }
  215. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  216. switch (indexPath.section) {
  217. case 0:
  218. {
  219. ChatMsgListCell *cell = [ChatMsgListCell configCell1:tableView indexPath:indexPath];
  220. [cell.cell1ContentBgView addSubview:self.collectionView];
  221. self.collectionView.frame = CGRectMake(0, 0, SCREEN_WIDTH, cell.cell1ContentBgView.height);
  222. [self.collectionView reloadData];
  223. return cell;
  224. }
  225. break;
  226. default:
  227. {
  228. MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
  229. if (model.CollectionType == CollectModel_TopicBooK) {
  230. CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
  231. [cell setCellTopicBookData:model];
  232. WS(weakSelf);
  233. [cell.desBtn setAction:^{
  234. MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
  235. vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  236. vc.FolderId = model.FolderId;
  237. vc.myTitle = model.FolderName;
  238. [weakSelf.navigationController pushViewController:vc animated:YES];
  239. }];
  240. return cell;
  241. }else{
  242. switch (model.CollectionType) {
  243. case CollectModel_Teacher:
  244. {
  245. CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
  246. [cell setCellNoAuthorData:model];
  247. WS(weakSelf);
  248. [cell.desBtn setAction:^{
  249. MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
  250. vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  251. vc.FolderId = model.FolderId;
  252. vc.myTitle = model.FolderName;
  253. [weakSelf.navigationController pushViewController:vc animated:YES];
  254. }];
  255. return cell;
  256. }
  257. break;
  258. case CollectModel_Organization:
  259. {
  260. CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
  261. [cell setCellNoAuthorData:model];
  262. WS(weakSelf);
  263. [cell.desBtn setAction:^{
  264. MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
  265. vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  266. vc.FolderId = model.FolderId;
  267. vc.myTitle = model.FolderName;
  268. [weakSelf.navigationController pushViewController:vc animated:YES];
  269. }];
  270. return cell;
  271. }
  272. break;
  273. default:
  274. {
  275. if (model.CollectionType != CollectModel_Toipc && model.Data.Author.length == 0) {
  276. CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
  277. [cell setCellNoAuthorData:model];
  278. WS(weakSelf);
  279. [cell.desBtn setAction:^{
  280. MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
  281. vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  282. vc.FolderId = model.FolderId;
  283. vc.myTitle = model.FolderName;
  284. [weakSelf.navigationController pushViewController:vc animated:YES];
  285. }];
  286. return cell;
  287. }else{
  288. CommonListCell *cell = [CommonListCell configCell1:tableView indexPath:indexPath];
  289. [cell setCell1Data:model];
  290. WS(weakSelf);
  291. [cell.desBtn setAction:^{
  292. MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
  293. vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  294. vc.FolderId = model.FolderId;
  295. vc.myTitle = model.FolderName;
  296. [weakSelf.navigationController pushViewController:vc animated:YES];
  297. }];
  298. if (model.CollectionType == CollectModel_Toipc) {
  299. [cell.comeBtn setAction:^{
  300. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  301. vc.GroupId = model.Data.GroupId;
  302. vc.titleStr = model.Data.GroupName;
  303. [weakSelf.navigationController pushViewController:vc animated:YES];
  304. }];
  305. }
  306. return cell;
  307. }
  308. }
  309. break;
  310. }
  311. }
  312. }
  313. break;
  314. }
  315. }
  316. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  317. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  318. if (indexPath.section > 0) {
  319. MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
  320. switch (model.CollectionType) {
  321. case CollectModel_Aritle:{
  322. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  323. vc.type = CollectModel_Aritle;
  324. vc.Id = model.CollectionDataId;
  325. [self.navigationController pushViewController:vc animated:YES];
  326. }break;
  327. case CollectModel_MediaAritle:{
  328. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  329. vc.type = CollectModel_MediaAritle;
  330. vc.Id = model.CollectionDataId;
  331. [self.navigationController pushViewController:vc animated:YES];
  332. }break;
  333. case CollectModel_Toipc:
  334. {
  335. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  336. vc.type = CollectModel_Toipc;
  337. vc.Id = model.CollectionDataId;
  338. [self.navigationController pushViewController:vc animated:YES];
  339. }break;
  340. case CollectModel_NewTopic:
  341. {
  342. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  343. vc.type = CollectModel_NewTopic;
  344. vc.Id = model.CollectionDataId;
  345. [self.navigationController pushViewController:vc animated:YES];
  346. }break;
  347. case CollectModel_Collect:{
  348. }break;
  349. case CollectModel_NoteBook:{
  350. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  351. vc.type = CollectModel_NoteBook;
  352. vc.Id = model.CollectionDataId;
  353. vc.isNoteBook = YES;
  354. [self.navigationController pushViewController:vc animated:YES];
  355. }break;
  356. case CollectModel_CollectFile:{
  357. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
  358. MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
  359. vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  360. vc.FolderId = model.CollectionDataId;
  361. vc.myTitle = model.Title;
  362. [self.navigationController pushViewController:vc animated:YES];
  363. }else{
  364. OtherFavoriteVC * vc = [OtherFavoriteVC initOtherFavoriteVC];
  365. vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  366. vc.FolderId = model.CollectionDataId;
  367. vc.CollectionDataId = model.CollectionDataId;
  368. vc.CollectionType = model.CollectionType;
  369. vc.Author = model.Data.Author;
  370. vc.myTitle = model.Title;
  371. vc.VisitUserId = model.SourceUserId;
  372. [self.navigationController pushViewController:vc animated:YES];
  373. }
  374. }break;
  375. case CollectModel_NoteFile: {
  376. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
  377. NoteBookVC * vc = [NoteBookVC initNoteBookVC];
  378. vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  379. vc.FolderId = model.CollectionDataId;
  380. vc.myTitle = model.Title;
  381. [self.navigationController pushViewController:vc animated:YES];
  382. }else{
  383. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  384. vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  385. vc.FolderId = model.CollectionDataId;
  386. vc.CollectionDataId = model.CollectionDataId;
  387. vc.CollectionType = model.CollectionType;
  388. vc.Author = model.Data.Author;
  389. vc.myTitle = model.Title;
  390. vc.VisitUserId = model.SourceUserId;
  391. [self.navigationController pushViewController:vc animated:YES];
  392. }
  393. }break;
  394. case CollectModel_TopicBooK:{
  395. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
  396. NoteBookVC * vc = [NoteBookVC initNoteBookVC];
  397. vc.listType = MyFavoriteListLevelTypeA;
  398. vc.FolderId = model.CollectionDataId;
  399. vc.TypeValue = 1;
  400. vc.myTitle = model.Title;
  401. [self.navigationController pushViewController:vc animated:YES];
  402. }else{
  403. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  404. vc.listType = MyFavoriteListLevelTypeA ;
  405. vc.FolderId = model.CollectionDataId;
  406. vc.CollectionDataId = model.CollectionDataId;
  407. vc.CollectionType = model.CollectionType;
  408. vc.Author = model.Data.Author;
  409. vc.TypeValue = 1;
  410. vc.myTitle = model.Title;
  411. vc.VisitUserId = model.SourceUserId;
  412. [self.navigationController pushViewController:vc animated:YES];
  413. }
  414. }break;
  415. case CollectModel_TopicSubBooK:{
  416. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
  417. NoteBookVC * vc = [NoteBookVC initNoteBookVC];
  418. vc.listType = MyFavoriteListLevelTypeB;
  419. vc.FolderId = model.CollectionDataId;
  420. vc.TypeValue = 1;
  421. vc.myTitle = model.Title;
  422. [self.navigationController pushViewController:vc animated:YES];
  423. }else{
  424. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  425. vc.listType = MyFavoriteListLevelTypeB;
  426. vc.FolderId = model.CollectionDataId;
  427. vc.CollectionDataId = model.CollectionDataId;
  428. vc.CollectionType = model.CollectionType;
  429. vc.Author = model.Data.Author;
  430. vc.TypeValue = 1;
  431. vc.myTitle = model.Title;
  432. vc.VisitUserId = model.SourceUserId;
  433. [self.navigationController pushViewController:vc animated:YES];
  434. }
  435. }break;
  436. case CollectModel_Notice:{
  437. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  438. vc.type = CollectModel_Notice;
  439. vc.Id = model.CollectionDataId;
  440. [self.navigationController pushViewController:vc animated:YES];
  441. }break;
  442. case CollectModel_InterMail:{
  443. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  444. vc.type = CollectModel_InterMail;
  445. vc.Id = model.CollectionDataId;
  446. [self.navigationController pushViewController:vc animated:YES];
  447. }break;
  448. case CollectModel_file:{
  449. FlowAttachmentsModel *wMdoel = [[FlowAttachmentsModel alloc]init];
  450. wMdoel.Url = model.Data.File;
  451. wMdoel.MinUrl = model.Data.File;
  452. wMdoel.Title = model.Data.FileName;
  453. wMdoel.SoureId = model.Data.Id;
  454. wMdoel.SoureTypeId = CollectModel_file;
  455. wMdoel.Size = model.Data.FileSize;
  456. DownFileViewController *downFileViewController = [[DownFileViewController alloc]init];
  457. downFileViewController.model = wMdoel;
  458. [self.navigationController pushViewController:downFileViewController animated:YES];
  459. }break;
  460. case CollectModel_meetDetail:
  461. {
  462. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.CollectionDataId];
  463. [self.navigationController pushViewController:vc animated:YES];
  464. }
  465. break;
  466. case CollectModel_work:
  467. {
  468. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  469. vc.pageType = Type_ONEC;
  470. vc.indexId = model.CollectionDataId;
  471. vc.title = model.Data.Title;
  472. vc.TodoId = model.CollectionDataId;
  473. [self.navigationController pushViewController:vc animated:YES];
  474. }
  475. break;
  476. case CollectModel_StoreSound:
  477. {
  478. BookListenVC * vc = [BookListenVC initBookListenVC];
  479. vc.Id = model.CollectionDataId;
  480. vc.MediaType = MediaMusicType;
  481. [self.navigationController pushViewController:vc animated:YES];
  482. }
  483. break;
  484. case CollectModel_StoreVideo:
  485. {
  486. BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
  487. vc.Id = model.CollectionDataId;
  488. [self.navigationController pushViewController:vc animated:YES];
  489. }
  490. break;
  491. case CollectModel_Teacher:
  492. {
  493. BookTeacherDetailVC * vc = [BookTeacherDetailVC initBookTeacherDetailVC];
  494. vc.Id = model.CollectionDataId;
  495. [self.navigationController pushViewController:vc animated:YES];
  496. }
  497. break;
  498. case CollectModel_Organization:
  499. {
  500. HomeSCDetailVC * vc = [[HomeSCDetailVC alloc] init];
  501. vc.Id = model.CollectionDataId;
  502. vc.hidesBottomBarWhenPushed = YES;
  503. [self.navigationController pushViewController:vc animated:YES];
  504. }
  505. break;
  506. case CollectModel_meetMian:{
  507. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  508. vc.Id = model.CollectionDataId;
  509. vc.type = CollectModel_meetMian;
  510. [self.navigationController pushViewController:vc animated:YES];
  511. }break;
  512. case CollectModel_financeCount:{
  513. CountDataVC *vc = [CountDataVC initCountDataVC];
  514. vc.index = 0;
  515. vc.titleStr = @"财务统计";
  516. [self.navigationController pushViewController:vc animated:YES];
  517. }break;
  518. case CollectModel_affairsCount:{
  519. CountDataVC *vc = [CountDataVC initCountDataVC];
  520. vc.index = 1;
  521. vc.titleStr = @"人事统计";
  522. [self.navigationController pushViewController:vc animated:YES];
  523. }break;
  524. case CollectModel_publishCount:{
  525. CountDataVC *vc = [CountDataVC initCountDataVC];
  526. vc.index = 2;
  527. vc.titleStr = @"出版统计";
  528. [self.navigationController pushViewController:vc animated:YES];
  529. }break;
  530. default:
  531. {
  532. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  533. vc.Id = model.CollectionDataId;
  534. vc.type = CollectModel_Toipc;
  535. [self.navigationController pushViewController:vc animated:YES];
  536. }
  537. break;
  538. }
  539. }
  540. }
  541. #pragma mark - load
  542. - (UITableView *)tableView
  543. {
  544. if (!_tableView) {
  545. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  546. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  547. }
  548. return _tableView;
  549. }
  550. - (MyTDGroupView *)SearchView
  551. {
  552. if (!_SearchView) {
  553. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  554. }
  555. return _SearchView;
  556. }
  557. -(NSMutableArray *)dataArray{
  558. if(!_dataArray){
  559. _dataArray = [[NSMutableArray alloc] init];
  560. }
  561. return _dataArray;
  562. }
  563. -(NSMutableArray *)collectionDataSource{
  564. if(!_collectionDataSource){
  565. _collectionDataSource = [[NSMutableArray alloc] init];
  566. }
  567. return _collectionDataSource;
  568. }
  569. - (GHRefreshCollectionView *)collectionView {
  570. if (!_collectionView) {
  571. UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  572. layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  573. layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
  574. _collectionView = [[GHRefreshCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
  575. _collectionView.delegate = self;
  576. _collectionView.dataSource = self;
  577. _collectionView.showsHorizontalScrollIndicator = NO;
  578. [_collectionView registerNib:[UINib nibWithNibName:@"ChatMsgCollectionCell" bundle:nil] forCellWithReuseIdentifier:@"ChatMsgCollectionCell"];
  579. _collectionView.backgroundColor = [UIColor whiteColor];
  580. }
  581. return _collectionView;
  582. }
  583. #pragma mark UICollectionView
  584. - (NSInteger)numberOfSectionsInCollectionView:(GHRefreshCollectionView *)collectionView{
  585. return 1;
  586. }
  587. /**********************************************************************/
  588. #pragma mark -UICollectionViewDataSource
  589. /**********************************************************************/
  590. - (NSInteger)collectionView:(GHRefreshCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  591. return self.collectionDataSource.count;
  592. }
  593. - (UICollectionViewCell *)collectionView:(GHRefreshCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  594. {
  595. MoreAppInfoModel *bean = [self.collectionDataSource objectAtIndex:indexPath.item];
  596. ChatMsgCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ChatMsgCollectionCell" forIndexPath:indexPath];
  597. cell.cell0IconImg.image = [UIImage imageNamed:bean.imgName];
  598. cell.cell0TitleLabel.text = bean.title;
  599. cell.imagH.constant = 25.f;
  600. cell.imagW.constant = 25.f;
  601. cell.titleConstant.constant = 8.f;
  602. switch (indexPath.item) {
  603. case 0:
  604. {
  605. cell.cell0ReadNumLabel.hidden = YES;
  606. NSString * count = @"0";
  607. cell.cell0ReadNumLabel.text = count;
  608. UILabel * label = [UILabel new];
  609. label.font = [UIFont systemFontOfSize:12];
  610. label.text = count;
  611. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  612. if ((width + 5) < 16) {
  613. cell.constant.constant = 16;
  614. }else{
  615. cell.constant.constant = width + 8;
  616. }
  617. }
  618. break;
  619. case 1:
  620. {
  621. cell.cell0ReadNumLabel.hidden = YES;
  622. NSString * count = @"0";
  623. cell.cell0ReadNumLabel.text = count;
  624. UILabel * label = [UILabel new];
  625. label.font = [UIFont systemFontOfSize:12];
  626. label.text = count;
  627. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  628. if ((width + 5) < 16) {
  629. cell.constant.constant = 16;
  630. }else{
  631. cell.constant.constant = width + 8;
  632. }
  633. }
  634. break;
  635. case 2:
  636. {
  637. cell.cell0ReadNumLabel.hidden = YES;
  638. NSString * count = @"0";
  639. cell.cell0ReadNumLabel.text = count;
  640. UILabel * label = [UILabel new];
  641. label.font = [UIFont systemFontOfSize:12];
  642. label.text = count;
  643. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  644. if ((width + 5) < 16) {
  645. cell.constant.constant = 16;
  646. }else{
  647. cell.constant.constant = width + 8;
  648. }
  649. }
  650. break;
  651. case 3:
  652. {
  653. cell.cell0ReadNumLabel.hidden = YES;
  654. NSString * count = @"0";
  655. cell.cell0ReadNumLabel.text = count;
  656. UILabel * label = [UILabel new];
  657. label.font = [UIFont systemFontOfSize:12];
  658. label.text = count;
  659. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  660. if ((width + 5) < 16) {
  661. cell.constant.constant = 16;
  662. }else{
  663. cell.constant.constant = width + 8;
  664. }
  665. }
  666. break;
  667. default:
  668. {
  669. cell.cell0ReadNumLabel.hidden = YES ;
  670. }
  671. break;
  672. }
  673. cell.cell0MengCengView.hidden = YES;
  674. return cell;
  675. }
  676. /****************************************************/
  677. #pragma mark --UICollectionViewDelegateFlowLayout
  678. /****************************************************/
  679. - (CGSize)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  680. {
  681. CGFloat width = (SCREEN_WIDTH - 20) / self.collectionDataSource.count;
  682. CGFloat height = 80;
  683. return CGSizeMake(width, height);
  684. }
  685. -(UIEdgeInsets)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  686. {
  687. CGFloat W = 10;
  688. return UIEdgeInsetsMake(0,W,0,W);
  689. }
  690. - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
  691. return 0;
  692. }
  693. - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
  694. return 0;
  695. }
  696. - (void)collectionView:(GHRefreshCollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  697. [collectionView deselectItemAtIndexPath:indexPath animated:YES];
  698. switch (indexPath.item) {
  699. case 0:
  700. {
  701. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  702. vc.listType = MyFavoriteListLevelTypeA;
  703. vc.FolderId = 0;
  704. vc.operationStateEnum = OperationStateEnum0;
  705. vc.myTitle = @"我的收藏";
  706. vc.hidesBottomBarWhenPushed = YES;
  707. [self.navigationController pushViewController:vc animated:YES];
  708. }
  709. break;
  710. case 1:
  711. {
  712. CommonNoteVC * vc = [CommonNoteVC initCommonNoteVC];
  713. vc.hidesBottomBarWhenPushed = YES;
  714. [self.navigationController pushViewController:vc animated:YES];
  715. }
  716. break;
  717. case 2:
  718. {
  719. CommonToolVC * vc = [CommonToolVC initCommonToolVC];
  720. vc.hidesBottomBarWhenPushed = YES;
  721. [self.navigationController pushViewController:vc animated:YES];
  722. }
  723. break;
  724. default:
  725. {
  726. CommonWorkVC * vc = [CommonWorkVC initCommonWorkVC];
  727. vc.hidesBottomBarWhenPushed = YES;
  728. [self.navigationController pushViewController:vc animated:YES];
  729. }
  730. break;
  731. }
  732. }
  733. - (void)setBarData
  734. {
  735. [self.collectionDataSource removeAllObjects];
  736. NSArray * titleArray = @[@"收藏",@"笔记",@"工具箱",@"工作台"];
  737. NSArray * imageArray = @[@"Common_collect",@"Common_note",@"Common_gjxiang",@"Common_gztai"];
  738. for (NSInteger i = 0; i < titleArray.count; i ++) {
  739. MoreAppInfoModel * model = [[MoreAppInfoModel alloc] init];
  740. model.title = titleArray[i];
  741. model.imgName = imageArray[i];
  742. [self.collectionDataSource addObject:model];
  743. }
  744. }
  745. #pragma Mark 左滑按钮 iOS8以上
  746. - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){
  747. if (indexPath.section == 0) {
  748. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  749. actions.performsFirstActionWithFullSwipe = NO;
  750. return actions;
  751. }else{
  752. WEAKSELF
  753. MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
  754. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"转发" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  755. [tableView setEditing:NO animated:YES];
  756. weakSelf.sendModel = model;
  757. if (model.CollectionType == CollectModel_StoreSound || weakSelf.sendModel.CollectionType == CollectModel_StoreVideo) {
  758. weakSelf.sendModel.Data.MinFile = weakSelf.sendModel.Data.ArticleImgUrl.firstObject;
  759. weakSelf.sendModel.Data.File = weakSelf.sendModel.Data.ArticleImgUrl.firstObject;
  760. }
  761. [weakSelf shareHander];
  762. }];
  763. action1.backgroundColor = UIColorHex(#FF923A);
  764. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:model.IsTop ? @"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  765. [weakSelf topFind:model];
  766. }];
  767. action2.backgroundColor = UIColorHex(#9BA9CB);
  768. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  769. [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  770. completionHandler(YES);
  771. }];
  772. action3.backgroundColor = UIColorHex(#589AF1);
  773. UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  774. [tableView setEditing:NO animated:YES];
  775. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  776. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  777. [weakSelf.tableView reloadData];
  778. }];
  779. [ok setValue:k9 forKey:@"_titleTextColor"];
  780. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  781. [weakSelf deleteFind:@[model].mutableCopy indexPath:indexPath];
  782. }];
  783. [alertVC addAction:ok];
  784. [alertVC addAction:noOk];
  785. completionHandler(YES);
  786. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  787. }];
  788. action4.backgroundColor = UIColorHex(#F64A33);
  789. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action4,action3,action2,action1]];
  790. actions.performsFirstActionWithFullSwipe = NO;
  791. return actions;
  792. }
  793. }
  794. - (void)topFind:(MyFavoriteSubModel*)findModel{
  795. WEAKSELF
  796. [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  797. [weakSelf getDataList];
  798. } failure:^(NSError * _Nonnull error) {
  799. SHOWERROR([ZYCTool handerResultData:error]);
  800. }];
  801. }
  802. - (void)deleteFind:(NSMutableArray<MyFavoriteSubModel *>*)findModelArray indexPath:(NSIndexPath *)indexPath{
  803. NSMutableArray *MiddleIds = [NSMutableArray array];
  804. for (MyFavoriteSubModel *model in findModelArray) {
  805. [MiddleIds addObject:@(model.Id)];
  806. }
  807. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  808. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  809. [dic setValue:@(3) forKey:@"FolderType"];
  810. WS(weakSelf);
  811. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  812. [weakSelf.dataArray removeObjectAtIndex:indexPath.row];
  813. dispatch_async(dispatch_get_main_queue(), ^{
  814. [weakSelf.tableView reloadData];
  815. });
  816. } failure:^(NSError * _Nonnull error) {
  817. SHOWERROR([ZYCTool handerResultData:error]);
  818. }];
  819. }
  820. - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
  821. MoveViewController * vc = [MoveViewController initMoveViewController];
  822. vc.TypeId = CreateCollectionType;
  823. vc.collectType = CollectHanderType_Move;
  824. vc.CollectionType = CollectModel_Collect;
  825. vc.ParentId = 0;
  826. vc.FolderIds = selectIDArray;
  827. vc.titleStr = @"移动";
  828. [self.navigationController pushViewController:vc animated:YES];
  829. }
  830. #pragma mark - 转发
  831. - (void)shareHander{
  832. [self.noteBookShareVC initNoteBookShareData];
  833. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  834. }
  835. - (NoteBookShareVC *)noteBookShareVC{
  836. if (_noteBookShareVC == nil) {
  837. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  838. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  839. [_noteBookShareVC.view setHidden:YES];
  840. _noteBookShareVC.delegate = self;
  841. }
  842. return _noteBookShareVC;
  843. }
  844. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  845. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  846. if ([typeName isEqualToString:@"发给微信好友"]) {
  847. [self returnToWechatSession];
  848. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  849. [self returnToWechatTimeLine];
  850. }else if ([typeName isEqualToString:@"发到微博"]){
  851. [self returnToSina];
  852. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  853. [self returnToQQ];
  854. }else if ([typeName isEqualToString:@"发到消息"]){
  855. [self returnToMessage];
  856. }else if ([typeName isEqualToString:@"发到小组"]){
  857. [self returnToGroup];
  858. }else if ([typeName isEqualToString:@"发到笔记"]){
  859. [self returnToNote];
  860. }else if ([typeName isEqualToString:@"发到话题"]){
  861. [self returnToTopic];
  862. }else{
  863. }
  864. }
  865. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType
  866. {
  867. NSString * url = [self.sendModel.Data.File stringByRemovingPercentEncoding];
  868. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  869. messageObject.title = self.sendModel.Title;
  870. //创建文件内容对象
  871. UMShareFileObject * fileObject = [UMShareFileObject shareObjectWithTitle:self.sendModel.Title descr:@"" thumImage:[UIImage imageNamed:[ZYCTool getFileNameImage:self.sendModel.Title]]];
  872. fileObject.fileData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
  873. fileObject.fileExtension = [self.sendModel.Title pathExtension];
  874. //分享消息对象设置分享内容对象
  875. messageObject.shareObject = fileObject;
  876. //调用分享接口
  877. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  878. if (error) {
  879. SHOWERROR([ZYCTool handerResultData:error]);
  880. NSLog(@"************Share fail with error %@*********",error);
  881. }else{
  882. NSLog(@"response data is %@",data);
  883. }
  884. }];
  885. }
  886. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url image:(NSString *)image
  887. {
  888. //创建分享消息对象
  889. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  890. messageObject.title = title;
  891. //创建网页内容对象
  892. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(image)];
  893. //设置网页地址
  894. shareObject.webpageUrl = url;
  895. //分享消息对象设置分享内容对象
  896. messageObject.shareObject = shareObject;
  897. //调用分享接口
  898. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  899. if (error) {
  900. NSLog(@"************Share fail with error %@*********",error);
  901. }else{
  902. NSLog(@"response data is %@",data);
  903. }
  904. }];
  905. }
  906. - (void)returnToWechatSession
  907. {
  908. NSString * name = self.sendModel.Data.Author;
  909. if (self.sendModel.CollectionType == CollectModel_Toipc) {
  910. name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
  911. }
  912. if (self.sendModel.CollectionType == CollectModel_file) {
  913. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession];
  914. }else{
  915. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
  916. }
  917. }
  918. - (void)returnToWechatTimeLine
  919. {
  920. NSString * name = self.sendModel.Data.Author;
  921. if (self.sendModel.CollectionType == CollectModel_Toipc) {
  922. name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
  923. }
  924. if (self.sendModel.CollectionType == CollectModel_file) {
  925. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine];
  926. }else{
  927. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
  928. }
  929. }
  930. - (void)returnToSina
  931. {
  932. NSString * name = self.sendModel.Data.Author;
  933. if (self.sendModel.CollectionType == CollectModel_Toipc) {
  934. name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
  935. }
  936. if (self.sendModel.CollectionType == CollectModel_file) {
  937. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina];
  938. }else{
  939. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
  940. }
  941. }
  942. - (void)returnToQQ
  943. {
  944. NSString * name = self.sendModel.Data.Author;
  945. if (self.sendModel.CollectionType == CollectModel_Toipc) {
  946. name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
  947. }
  948. if (self.sendModel.CollectionType == CollectModel_file) {
  949. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ];
  950. }else{
  951. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
  952. }
  953. }
  954. - (NSString *)returnUrl
  955. {
  956. switch (self.sendModel.Data.Type) {
  957. case CollectModel_Group:
  958. {
  959. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/topicDetailsWx?"),(long)self.sendModel.CollectionDataId];
  960. return url;
  961. }
  962. break;
  963. case CollectModel_Toipc:
  964. {
  965. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/topicDetailsWx?"),(long)self.sendModel.CollectionDataId];
  966. return url;
  967. }
  968. break;
  969. case CollectModel_NewTopic:
  970. {
  971. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.CollectionDataId];
  972. return url;
  973. }
  974. break;
  975. case CollectModel_Notice:
  976. {
  977. // NSString * url = [NSString stringWithFormat:@"%@%ld",@"http://192.168.0.119:8080/admin/mobile/noticeDetailsWx?",(long)self.currentNoteModel.Id];
  978. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noticeDetailsWx?"),(long)self.sendModel.CollectionDataId];
  979. return url;
  980. }
  981. break;
  982. case CollectModel_NoteBook:
  983. {
  984. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.CollectionDataId];
  985. return url;
  986. }
  987. break;
  988. case CollectModel_InterMail:
  989. {
  990. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/mailWx?"),(long)self.sendModel.CollectionDataId];
  991. return url;
  992. }
  993. break;
  994. case CollectModel_NoSignMail:
  995. {
  996. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/mailWx?"),(long)self.sendModel.CollectionDataId];
  997. return url;
  998. }
  999. break;
  1000. case CollectModel_meetMian:
  1001. {
  1002. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/minutesMeetingWx?"),(long)self.sendModel.CollectionDataId];
  1003. return url;
  1004. }
  1005. break;
  1006. case CollectModel_meetDetail:
  1007. {
  1008. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/meetingWx?"),(long)self.sendModel.CollectionDataId];
  1009. return url;
  1010. }
  1011. break;
  1012. case CollectModel_NoteFile:
  1013. {
  1014. NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=13&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.sendModel.CollectionDataId,self.sendModel.SourceUserId,self.sendModel.Title,@"笔记文件夹"];
  1015. return url;
  1016. }
  1017. break;
  1018. case CollectModel_CollectFile:
  1019. {
  1020. NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=12&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.sendModel.CollectionDataId,self.sendModel.SourceUserId,self.sendModel.Title,@"收藏文件夹"];
  1021. return url;
  1022. }
  1023. break;
  1024. case CollectModel_TopicBooK:
  1025. {
  1026. NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=41&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.sendModel.CollectionDataId,self.sendModel.SourceUserId,self.sendModel.Title,@"话题本"];
  1027. return url;
  1028. }
  1029. break;
  1030. case CollectModel_TopicSubBooK:
  1031. {
  1032. NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=42&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.sendModel.CollectionDataId,self.sendModel.SourceUserId,self.sendModel.Title,@"话题文件夹"];
  1033. return url;
  1034. }
  1035. break;
  1036. case CollectModel_work:
  1037. {
  1038. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.sendModel.CollectionDataId];
  1039. return url;
  1040. }
  1041. break;
  1042. case CollectModel_Aritle:
  1043. {
  1044. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/mainText?"),(long)self.sendModel.CollectionDataId];
  1045. return url;
  1046. }
  1047. break;
  1048. default:
  1049. {
  1050. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noticeDetailsWx?"),(long)self.sendModel.CollectionDataId];
  1051. return url;
  1052. }
  1053. break;
  1054. }
  1055. return @"";
  1056. }
  1057. - (NSString *)returnImage
  1058. {
  1059. switch (self.sendModel.CollectionType) {
  1060. case CollectModel_Group:
  1061. {
  1062. NSString * url = @"笔记小组";
  1063. return url;
  1064. }
  1065. break;
  1066. case CollectModel_Toipc:
  1067. {
  1068. NSString * url = @"话题";
  1069. return url;
  1070. }
  1071. break;
  1072. case CollectModel_NewTopic:
  1073. {
  1074. NSString * url = @"话题";
  1075. return url;
  1076. }
  1077. break;
  1078. case CollectModel_Notice:
  1079. {
  1080. NSString * url = @"通知图标";
  1081. return url;
  1082. }
  1083. break;
  1084. case CollectModel_NoteBook:
  1085. {
  1086. NSString * url = @"noteBook_icon";
  1087. return url;
  1088. }
  1089. break;
  1090. case CollectModel_NoteFile:
  1091. {
  1092. NSString * url = @"share_file";
  1093. return url;
  1094. }
  1095. break;
  1096. case CollectModel_CollectFile:
  1097. {
  1098. NSString * url = @"share_file";
  1099. return url;
  1100. }
  1101. break;
  1102. case CollectModel_InterMail:
  1103. {
  1104. NSString * url = @"站内信";
  1105. return url;
  1106. }
  1107. break;
  1108. case CollectModel_NoSignMail:
  1109. {
  1110. NSString * url = @"站内信";
  1111. return url;
  1112. }
  1113. break;
  1114. case CollectModel_meetMian:
  1115. {
  1116. NSString * url = @"会议纪要";
  1117. return url;
  1118. }
  1119. break;
  1120. case CollectModel_meetDetail:
  1121. {
  1122. NSString * url = @"会议";
  1123. return url;
  1124. }
  1125. break;
  1126. case CollectModel_Aritle:
  1127. {
  1128. NSString * url = @"文章";
  1129. return url;
  1130. }
  1131. break;
  1132. case CollectModel_TopicBooK:
  1133. {
  1134. NSString * url = @"topicBook";
  1135. return url;
  1136. }
  1137. break;
  1138. case CollectModel_TopicSubBooK:
  1139. {
  1140. NSString * url = @"share_file";
  1141. return url;
  1142. }
  1143. break;
  1144. default:
  1145. {
  1146. NSString * url = @"笔记文章";
  1147. return url;
  1148. }
  1149. break;
  1150. }
  1151. return @"";
  1152. }
  1153. #pragma mark - 分享功能
  1154. - (void)returnToMessage
  1155. {
  1156. ShareListVC * vc = [ShareListVC initShareListVC];
  1157. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  1158. model.SoureId = self.sendModel.CollectionDataId;
  1159. model.SoureTypeId = self.sendModel.CollectionType;
  1160. model.Title = self.sendModel.Title;
  1161. model.Author = self.sendModel.Data.Author;
  1162. model.SourceUserId = self.sendModel.SourceUserId;
  1163. model.GroupId = self.sendModel.Data.GroupId;
  1164. model.GroupName = self.sendModel.Data.GroupName;
  1165. model.MinUrl = self.sendModel.Data.MinFile;
  1166. model.Url = self.sendModel.Data.File;
  1167. vc.sendModel = model;
  1168. vc.isReturn = YES;
  1169. [self.navigationController pushViewController:vc animated:YES];
  1170. }
  1171. - (void)returnToGroup
  1172. {
  1173. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  1174. vc.type = CollectModel_Toipc;
  1175. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  1176. model.SoureId = self.sendModel.CollectionDataId;
  1177. model.SoureTypeId = self.sendModel.CollectionType;
  1178. model.Title = self.sendModel.Title;
  1179. model.Author = self.sendModel.Data.Author;
  1180. model.SourceUserId = self.sendModel.SourceUserId;
  1181. model.GroupId = self.sendModel.Data.GroupId;
  1182. model.GroupName = self.sendModel.Data.GroupName;
  1183. model.MinUrl = self.sendModel.Data.MinFile;
  1184. model.Url = self.sendModel.Data.File;
  1185. vc.sendModel = model;
  1186. vc.isReturn = YES;
  1187. [self.navigationController pushViewController:vc animated:YES];
  1188. }
  1189. - (void)returnToNote
  1190. {
  1191. MoveViewController * vc = [MoveViewController initMoveViewController];
  1192. vc.isFromCreateBookVc = YES;
  1193. vc.TypeId = CreateNotesType;
  1194. vc.CollectionType = CollectModel_NoteBook;
  1195. vc.titleStr = @"我的笔记";
  1196. vc.ParentId = 0;
  1197. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  1198. model.SoureId = self.sendModel.CollectionDataId;
  1199. model.SoureTypeId = self.sendModel.CollectionType;
  1200. model.Title = self.sendModel.Title;
  1201. model.Author = self.sendModel.Data.Author;
  1202. model.SourceUserId = self.sendModel.SourceUserId;
  1203. model.GroupId = self.sendModel.Data.GroupId;
  1204. model.GroupName = self.sendModel.Data.GroupName;
  1205. model.MinUrl = self.sendModel.Data.MinFile;
  1206. model.Url = self.sendModel.Data.File;
  1207. vc.type = CollectModel_NoteBook;
  1208. vc.sendModel = model;
  1209. vc.isReturn = YES;
  1210. [self.navigationController pushViewController:vc animated:YES];
  1211. }
  1212. - (void)returnToTopic
  1213. {
  1214. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1215. vc.type = CollectModel_NewTopic;
  1216. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  1217. model.SoureId = self.sendModel.CollectionDataId;
  1218. model.SoureTypeId = self.sendModel.CollectionType;
  1219. model.Title = self.sendModel.Title;
  1220. model.Author = self.sendModel.Data.Author;
  1221. model.SourceUserId = self.sendModel.SourceUserId;
  1222. model.GroupId = self.sendModel.Data.GroupId;
  1223. model.GroupName = self.sendModel.Data.GroupName;
  1224. model.MinUrl = self.sendModel.Data.MinFile;
  1225. model.Url = self.sendModel.Data.File;
  1226. vc.type = CollectModel_NewTopic;
  1227. vc.sendModel = model;
  1228. vc.isReturn = YES;
  1229. [self.navigationController pushViewController:vc animated:YES];
  1230. }
  1231. - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
  1232. {
  1233. UIPanGestureRecognizer * pan = scrollView.panGestureRecognizer;
  1234. CGFloat v = [pan velocityInView:scrollView].y;
  1235. NSLog(@"%.2f",v);
  1236. if (v < 140) {
  1237. self.HeadView.hidden = YES;
  1238. self.collectionView.hidden = YES;
  1239. }else{
  1240. self.HeadView.hidden = NO;
  1241. self.collectionView.hidden = NO;
  1242. }
  1243. }
  1244. @end