CommonHomeVC.m 55 KB

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