1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003 |
- //
- // CommonCollectVC.m
- // smartRhino
- //
- // Created by niuzhen on 2020/4/29.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "CommonCollectVC.h"
- #import "CommonListCell.h"
- #import "CommonBarCell.h"
- #import "CommonBarModel.h"
- #import "CommonWorkVC.h"
- #import "CommonToolVC.h"
- #import "MyFavoriteVC.h"
- #import "CommonNoteVC.h"
- #import "ChatMsgListCell.h"
- #import "ChatMsgCollectionCell.h"
- #import "MoveViewController.h"
- #import "NoteBookVC.h"
- #import "OtherFavoriteVC.h"
- #import "OtherNoteBookVC.h"
- #import "DownFileViewController.h"
- #import "WorkFlowDetailsController.h"
- #import "MyApprovalPageDetail.h"
- #import "CountDataVC.h"
- #import "CommomSearchVC.h"
- #import "NoteBookShareVC.h"
- #import "MyTDGroupViewController.h"
- #import "TDGroupInfoListVC.h"
- #import "MailListVC.h"
- #import "ShareListVC.h"
- #import "BookWCDetailVC.h"
- #import "BookListenVC.h"
- #import "BookTeacherDetailVC.h"
- #import "HomeSCDetailVC.h"
- #import "BookMingDetailVC.h"
- #import "BookPeriodicaDetailVC.h"
- #import "BookListDetailVC.h"
- @interface CommonCollectVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
- @property (strong, nonatomic) UITableView *tableView;
- @property (strong, nonatomic) NSMutableArray *collectionDataSource;
- @property (strong, nonatomic) NSMutableArray *dataArray;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- @property (strong, nonatomic) MyFavoriteSubModel *sendModel;
- @property (nonatomic,assign) NSInteger currentPage;
- @property (nonatomic,assign) NSInteger totalPage;
- @property (nonatomic,strong) NSData *fileData;
- @end
- @implementation CommonCollectVC
- #pragma mark -loay
- - (UITableView *)tableView
- {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- _tableView.delegate = self;
- _tableView.dataSource = self;
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- }
- return _tableView;
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self getDataList];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.mas_offset(UIEdgeInsetsZero);
- }];
- [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
- [[UtilsTools getWindow] bringSubviewToFront:self.noteBookShareVC.view];
- }
- - (void)getDataList {
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Collection_List) parameters:@{@"FolderId":@(0),@"Page":@(1),@"PerPage":@(99999999),@"VisitUserId":@(0)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf.dataArray removeAllObjects];
- NSLog(@"%@",responseObject);
- MyFavoriteModel *listModel = [[MyFavoriteModel alloc] initWithDictionary:responseObject error:nil];
- weakSelf.totalPage = listModel.Total;
- [weakSelf.dataArray addObjectsFromArray:listModel.Items];
- for (MyFavoriteSubModel *model in weakSelf.dataArray) {
- if (model.CollectionType == CollectModel_Text) {
- model.CollectionType = CollectModel_Aritle;
- }
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- }
- - (BOOL)hidesBottomBarWhenPushed{
- return NO;
- }
- #pragma mark - UITableViewDelegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.dataArray.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return UITableViewAutomaticDimension;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
- if (model.CollectionType == CollectModel_TopicBooK) {
- CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
- [cell setCellTopicBookData:model];
- WS(weakSelf);
- [cell.desBtn setAction:^{
- MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderId;
- vc.myTitle = model.FolderName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }else{
- switch (model.CollectionType) {
- case CollectModel_Teacher:
- {
- CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
- [cell setCellNoAuthorData:model];
- WS(weakSelf);
- [cell.desBtn setAction:^{
- MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderId;
- vc.myTitle = model.FolderName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }
- break;
- case CollectModel_Organization:
- {
- CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
- [cell setCellNoAuthorData:model];
- WS(weakSelf);
- [cell.desBtn setAction:^{
- MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderId;
- vc.myTitle = model.FolderName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }
- break;
- default:
- {
- if (model.CollectionType != CollectModel_Toipc && model.Data.Author.length == 0) {
- CommonListCell *cell = [CommonListCell configCell2:tableView indexPath:indexPath];
- [cell setCellNoAuthorData:model];
- WS(weakSelf);
- [cell.desBtn setAction:^{
- MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderId;
- vc.myTitle = model.FolderName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }else{
- CommonListCell *cell = [CommonListCell configCell1:tableView indexPath:indexPath];
- [cell setCell1Data:model];
- WS(weakSelf);
- [cell.desBtn setAction:^{
- MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.FolderId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.FolderId;
- vc.myTitle = model.FolderName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- if (model.CollectionType == CollectModel_Toipc) {
- [cell.comeBtn setAction:^{
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = model.Data.GroupId;
- vc.titleStr = model.Data.GroupName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
-
- }];
- }
- return cell;
- }
- }
- break;
- }
- }
-
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
- switch (model.CollectionType) {
- case CollectModel_Aritle:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Aritle;
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_MediaAritle:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_MediaAritle;
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Toipc:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NewTopic:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Collect:{
-
- }break;
- case CollectModel_NoteBook:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NoteBook;
- vc.Id = model.CollectionDataId;
- vc.isNoteBook = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_CollectFile:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
- MyFavoriteVC * vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.CollectionDataId;
- vc.myTitle = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherFavoriteVC * vc = [OtherFavoriteVC initOtherFavoriteVC];
- vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.CollectionDataId;
- vc.CollectionDataId = model.CollectionDataId;
- vc.CollectionType = model.CollectionType;
- vc.Author = model.Data.Author;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_NoteFile: {
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
- NoteBookVC * vc = [NoteBookVC initNoteBookVC];
- vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.CollectionDataId;
- vc.myTitle = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = model.CollectionDataId == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.CollectionDataId;
- vc.CollectionDataId = model.CollectionDataId;
- vc.CollectionType = model.CollectionType;
- vc.Author = model.Data.Author;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_TopicBooK:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
- NoteBookVC * vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA;
- vc.FolderId = model.CollectionDataId;
- vc.TypeValue = 1;
- vc.myTitle = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA ;
- vc.FolderId = model.CollectionDataId;
- vc.CollectionDataId = model.CollectionDataId;
- vc.CollectionType = model.CollectionType;
- vc.Author = model.Data.Author;
- vc.TypeValue = 1;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_TopicSubBooK:{
- if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id || model.SourceUserId == 0) {
- NoteBookVC * vc = [NoteBookVC initNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.FolderId = model.CollectionDataId;
- vc.TypeValue = 1;
- vc.myTitle = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB;
- vc.FolderId = model.CollectionDataId;
- vc.CollectionDataId = model.CollectionDataId;
- vc.CollectionType = model.CollectionType;
- vc.Author = model.Data.Author;
- vc.TypeValue = 1;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_Notice:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Notice;
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_InterMail:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_InterMail;
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_file:{
- FlowAttachmentsModel *wMdoel = [[FlowAttachmentsModel alloc]init];
- wMdoel.Url = model.Data.File;
- wMdoel.MinUrl = model.Data.File;
- wMdoel.Title = model.Data.FileName;
- wMdoel.SoureId = model.Data.Id;
- wMdoel.SoureTypeId = CollectModel_file;
- wMdoel.Size = model.Data.FileSize;
- DownFileViewController *downFileViewController = [[DownFileViewController alloc]init];
- downFileViewController.model = wMdoel;
- downFileViewController.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:downFileViewController animated:YES];
- }break;
- case CollectModel_meetDetail:
- {
- WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.CollectionDataId];
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_work:
- {
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = model.CollectionDataId;
- vc.title = model.Data.Title;
- vc.TodoId = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreSound:
- {
- BookListenVC * vc = [BookListenVC initBookListenVC];
- vc.Id = model.CollectionDataId;
- vc.MediaType = MediaMusicType;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreVideo:
- {
- BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Teacher:
- {
- BookTeacherDetailVC * vc = [BookTeacherDetailVC initBookTeacherDetailVC];
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Organization:
- {
- HomeSCDetailVC * vc = [[HomeSCDetailVC alloc] init];
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetMian:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.CollectionDataId;
- vc.type = CollectModel_meetMian;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_financeCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 0;
- vc.titleStr = @"财务统计";
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_affairsCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 1;
- vc.titleStr = @"人事统计";
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_publishCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 2;
- vc.titleStr = @"出版统计";
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_StoreBook:{
- BookListDetailVC * vc = [BookListDetailVC initBookListDetailVC];
- vc.Id = model.CollectionDataId;
- vc.hidesBottomBarWhenPushed = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_StoreMing:
- {
- BookMingDetailVC * vc = [BookMingDetailVC initBookMingDetailVC];
- vc.gzId = model.CollectionDataId;
- vc.type = model.CollectionType;
- vc.titleStr = model.Data.Title;
- vc.hidesBottomBarWhenPushed = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_StoreQiKan:
- {
- BookPeriodicaDetailVC * vc = [BookPeriodicaDetailVC initBookPeriodicaDetailVC];
- vc.Id = model.CollectionDataId;
- vc.titleStr = model.Title;
- vc.hidesBottomBarWhenPushed = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_StoreGongzh:
- {
- BookMingDetailVC * vc = [BookMingDetailVC initBookMingDetailVC];
- vc.gzId = model.CollectionDataId;
- vc.type = model.CollectionType;
- vc.titleStr = model.Data.Title;
- vc.hidesBottomBarWhenPushed = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.CollectionDataId;
- vc.type = CollectModel_Toipc;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- -(NSMutableArray *)dataArray{
- if(!_dataArray){
- _dataArray = [[NSMutableArray alloc] init];
- }
- return _dataArray;
- }
- #pragma Mark 左滑按钮 iOS8以上
- - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){
-
- WEAKSELF
- MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"转发" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- weakSelf.sendModel = model;
- if (model.CollectionType == CollectModel_StoreSound || weakSelf.sendModel.CollectionType == CollectModel_StoreVideo) {
- weakSelf.sendModel.Data.MinFile = weakSelf.sendModel.Data.ArticleImgUrl.firstObject;
- weakSelf.sendModel.Data.File = weakSelf.sendModel.Data.ArticleImgUrl.firstObject;
- }
- [weakSelf shareHander];
- }];
- action1.backgroundColor = UIColorHex(#FF923A);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:model.IsTop ? @"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf topFind:model];
-
- }];
- action2.backgroundColor = UIColorHex(#9BA9CB);
- UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- completionHandler(YES);
- }];
- action3.backgroundColor = UIColorHex(#589AF1);
-
- UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf.tableView reloadData];
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy indexPath:indexPath];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- completionHandler(YES);
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action4.backgroundColor = UIColorHex(#F64A33);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action4,action3,action2,action1]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- - (void)topFind:(MyFavoriteSubModel*)findModel{
- WEAKSELF
- [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
- [weakSelf getDataList];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)deleteFind:(NSMutableArray<MyFavoriteSubModel *>*)findModelArray indexPath:(NSIndexPath *)indexPath{
- NSMutableArray *MiddleIds = [NSMutableArray array];
-
- for (MyFavoriteSubModel *model in findModelArray) {
- [MiddleIds addObject:@(model.Id)];
- }
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:MiddleIds forKey:@"MiddleIds"];
- [dic setValue:@(3) forKey:@"FolderType"];
-
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- [weakSelf.dataArray removeObjectAtIndex:indexPath.row];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
- MoveViewController * vc = [MoveViewController initMoveViewController];
- vc.TypeId = CreateCollectionType;
- vc.collectType = CollectHanderType_Move;
- vc.CollectionType = CollectModel_Collect;
- vc.ParentId = 0;
- vc.FolderIds = selectIDArray;
- vc.titleStr = @"移动";
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - 转发
- - (void)shareHander{
- [self.noteBookShareVC initNoteBookShareData];
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
- [self returnToWechatSession];
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
- [self returnToWechatTimeLine];
- }else if ([typeName isEqualToString:@"发到微博"]){
- [self returnToSina];
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
- [self returnToQQ];
- }else if ([typeName isEqualToString:@"发到消息"]){
- [self returnToMessage];
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
-
- }
- }
- - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType
- {
- NSString * url = [self.sendModel.Data.File stringByRemovingPercentEncoding];
- UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
-
- messageObject.title = self.sendModel.Title;
- //创建文件内容对象
- UMShareFileObject * fileObject = [UMShareFileObject shareObjectWithTitle:self.sendModel.Title descr:@"" thumImage:[UIImage imageNamed:[ZYCTool getFileNameImage:self.sendModel.Title]]];
-
- fileObject.fileData = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
-
- fileObject.fileExtension = [self.sendModel.Title pathExtension];
-
- //分享消息对象设置分享内容对象
- messageObject.shareObject = fileObject;
-
- //调用分享接口
- [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
- if (error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- NSLog(@"************Share fail with error %@*********",error);
- }else{
- NSLog(@"response data is %@",data);
- }
- }];
- }
- - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url image:(NSString *)image
- {
- //创建分享消息对象
- UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
-
- messageObject.title = title;
- //创建网页内容对象
- UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(image)];
- //设置网页地址
- shareObject.webpageUrl = url;
-
- //分享消息对象设置分享内容对象
- messageObject.shareObject = shareObject;
-
- //调用分享接口
- [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
- if (error) {
- NSLog(@"************Share fail with error %@*********",error);
- }else{
- NSLog(@"response data is %@",data);
- }
- }];
- }
- - (void)returnToWechatSession
- {
- NSString * name = self.sendModel.Data.Author;
- if (self.sendModel.CollectionType == CollectModel_Toipc) {
- name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
- }
- if (self.sendModel.CollectionType == CollectModel_file) {
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession];
- }else{
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
- }
- }
- - (void)returnToWechatTimeLine
- {
- NSString * name = self.sendModel.Data.Author;
- if (self.sendModel.CollectionType == CollectModel_Toipc) {
- name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
- }
- if (self.sendModel.CollectionType == CollectModel_file) {
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine];
- }else{
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
- }
- }
- - (void)returnToSina
- {
- NSString * name = self.sendModel.Data.Author;
- if (self.sendModel.CollectionType == CollectModel_Toipc) {
- name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
- }
- if (self.sendModel.CollectionType == CollectModel_file) {
- [self shareWebPageToPlatformType:UMSocialPlatformType_Sina];
- }else{
- [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
- }
- }
- - (void)returnToQQ
- {
- NSString * name = self.sendModel.Data.Author;
- if (self.sendModel.CollectionType == CollectModel_Toipc) {
- name = [NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Data.Author, self.sendModel.GroupName];
- }
- if (self.sendModel.CollectionType == CollectModel_file) {
- [self shareWebPageToPlatformType:UMSocialPlatformType_QQ];
- }else{
- [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:name url:[self returnUrl] image:[self returnImage]];
- }
- }
- - (NSString *)returnUrl
- {
- switch (self.sendModel.Data.Type) {
- case CollectModel_Group:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/topicDetailsWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_Toipc:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/topicDetailsWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_NewTopic:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_Notice:
- {
- // NSString * url = [NSString stringWithFormat:@"%@%ld",@"http://192.168.0.119:8080/admin/mobile/noticeDetailsWx?",(long)self.currentNoteModel.Id];
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noticeDetailsWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_NoteBook:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_InterMail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/mailWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_NoSignMail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/mailWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_meetMian:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/minutesMeetingWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_meetDetail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/meetingWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_NoteFile:
- {
- 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,@"笔记文件夹"];
- return url;
- }
- break;
- case CollectModel_CollectFile:
- {
- 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,@"收藏文件夹"];
- return url;
- }
- break;
- case CollectModel_TopicBooK:
- {
- 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,@"话题本"];
- return url;
- }
- break;
- case CollectModel_TopicSubBooK:
- {
- 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,@"话题文件夹"];
- return url;
- }
- break;
- case CollectModel_work:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- case CollectModel_Aritle:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/mainText?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- default:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noticeDetailsWx?"),(long)self.sendModel.CollectionDataId];
- return url;
- }
- break;
- }
- }
- - (NSString *)returnImage
- {
- switch (self.sendModel.CollectionType) {
- case CollectModel_Group:
- {
- NSString * url = @"笔记小组";
- return url;
- }
- break;
- case CollectModel_Toipc:
- {
- NSString * url = @"话题";
- return url;
- }
- break;
- case CollectModel_NewTopic:
- {
- NSString * url = @"话题";
- return url;
- }
- break;
- case CollectModel_Notice:
- {
- NSString * url = @"通知图标";
- return url;
- }
- break;
- case CollectModel_NoteBook:
- {
- NSString * url = @"noteBook_icon";
- return url;
- }
- break;
- case CollectModel_NoteFile:
- {
- NSString * url = @"share_file";
- return url;
- }
- break;
- case CollectModel_CollectFile:
- {
- NSString * url = @"share_file";
- return url;
- }
- break;
- case CollectModel_InterMail:
- {
- NSString * url = @"站内信";
- return url;
- }
- break;
- case CollectModel_NoSignMail:
- {
- NSString * url = @"站内信";
- return url;
- }
- break;
- case CollectModel_meetMian:
- {
- NSString * url = @"会议纪要";
- return url;
- }
- break;
- case CollectModel_meetDetail:
- {
- NSString * url = @"会议";
- return url;
- }
- break;
- case CollectModel_Aritle:
- {
- NSString * url = @"文章";
- return url;
- }
- break;
- case CollectModel_TopicBooK:
- {
- NSString * url = @"topicBook";
- return url;
- }
- break;
- case CollectModel_TopicSubBooK:
- {
- NSString * url = @"share_file";
- return url;
- }
- break;
- default:
- {
- NSString * url = @"笔记文章";
- return url;
- }
- break;
- }
- }
- #pragma mark - 分享功能
- - (void)returnToMessage
- {
- ShareListVC * vc = [ShareListVC initShareListVC];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureId = self.sendModel.CollectionDataId;
- model.SoureTypeId = self.sendModel.CollectionType;
- model.Title = self.sendModel.Title;
- model.Author = self.sendModel.Data.Author;
- model.SourceUserId = self.sendModel.SourceUserId;
- model.GroupId = self.sendModel.Data.GroupId;
- model.GroupName = self.sendModel.Data.GroupName;
- model.MinUrl = self.sendModel.Data.MinFile;
- model.Url = self.sendModel.Data.File;
- vc.sendModel = model;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- vc.type = CollectModel_Toipc;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureId = self.sendModel.CollectionDataId;
- model.SoureTypeId = self.sendModel.CollectionType;
- model.Title = self.sendModel.Title;
- model.Author = self.sendModel.Data.Author;
- model.SourceUserId = self.sendModel.SourceUserId;
- model.GroupId = self.sendModel.Data.GroupId;
- model.GroupName = self.sendModel.Data.GroupName;
- model.MinUrl = self.sendModel.Data.MinFile;
- model.Url = self.sendModel.Data.File;
- vc.sendModel = model;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MoveViewController * vc = [MoveViewController initMoveViewController];
- vc.isFromCreateBookVc = YES;
- vc.TypeId = CreateNotesType;
- vc.CollectionType = CollectModel_NoteBook;
- vc.titleStr = @"我的笔记";
- vc.ParentId = 0;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureId = self.sendModel.CollectionDataId;
- model.SoureTypeId = self.sendModel.CollectionType;
- model.Title = self.sendModel.Title;
- model.Author = self.sendModel.Data.Author;
- model.SourceUserId = self.sendModel.SourceUserId;
- model.GroupId = self.sendModel.Data.GroupId;
- model.GroupName = self.sendModel.Data.GroupName;
- model.MinUrl = self.sendModel.Data.MinFile;
- model.Url = self.sendModel.Data.File;
- vc.type = CollectModel_NoteBook;
- vc.sendModel = model;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NewTopic;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureId = self.sendModel.CollectionDataId;
- model.SoureTypeId = self.sendModel.CollectionType;
- model.Title = self.sendModel.Title;
- model.Author = self.sendModel.Data.Author;
- model.SourceUserId = self.sendModel.SourceUserId;
- model.GroupId = self.sendModel.Data.GroupId;
- model.GroupName = self.sendModel.Data.GroupName;
- model.MinUrl = self.sendModel.Data.MinFile;
- model.Url = self.sendModel.Data.File;
- vc.type = CollectModel_NewTopic;
- vc.sendModel = model;
- vc.isReturn = YES;
- vc.hidesBottomBarWhenPushed = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- @end
|