CommonHomeVC.m 49 KB

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