123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584 |
- //
- // TDInterLeterHomeViewController.m
- // smartRhino
- //
- // Created by tederen on 2019/11/9.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "TDInterLeterHomeViewController.h"
- #import "ChatMsgNoticeCell.h"
- #import "YCMenuView.h"
- #import "ShowNewGroupAlert.h"
- #import "TDInterLeterTypeVC.h"
- #import "TDInterLeterSearchVC.h"
- #import "NoticeNewGroupVC.h"
- #import "MoveViewController.h"
- #import "CreateInterLeterVC.h"
- #import "MyTDTopicCreateVC.h"
- #import "MyTDTopicDetailVC.h"
- #import "NSDate+Extension.h"
- #import "ShowBtn.h"
- @interface TDInterLeterHomeViewController ()<UITableViewDelegate,UITableViewDataSource,TDInterLeterTypeVCDelegate>
- //@property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (strong, nonatomic) UITableView *tableView;
- @property (weak, nonatomic) IBOutlet ShowBtn *titleBtn;
- @property (weak, nonatomic) IBOutlet UIButton *rightAddBtn;
- @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
- @property (weak, nonatomic) IBOutlet UILabel *titleLable;
- @property (weak, nonatomic) IBOutlet UIButton *deleteSelectBtn;
- @property (weak, nonatomic) IBOutlet UIView *NavBar;
- @property (strong, nonatomic) UIButton *leftCloseBtn;
- @property (strong, nonatomic) UIButton *rightMoveBtn;
- @property (strong, nonatomic) UILabel *LineL;
- @property (strong, nonatomic) NSMutableArray *taskActionArray;
- @property (strong, nonatomic) TDInterLeterTypeVC *tDInterLeterTypeVC;
- @property (assign, nonatomic) PageTypeFromTitleBtn pageType;
- @property (assign, nonatomic) NSUInteger currentPage;
- @property (assign, nonatomic) BOOL isFresh;
- @property (assign, nonatomic) NSInteger totalRecord;
- @property (strong, nonatomic) NSMutableArray<InterLeterSubModel * >*interLetterArray;
- //界面操作状态参数
- @property (assign,nonatomic) OperationStateEnum operationStateEnum;
- //界面操作视图
- @property (strong,nonatomic) UIView *operationBottomBgView;
- @property (weak, nonatomic) IBOutlet UIButton *operationAllSelectButton;
- @property (nonatomic, assign) BOOL iSViewEditor;
- @property (strong,nonatomic) UIButton *opearateLeftBtn;
- @property (strong,nonatomic) UIButton *opearateRightBtn;
- @property (assign,nonatomic) BOOL isAllselect;
- @property (assign,nonatomic) BOOL addTableH;
- @property (assign,nonatomic) BOOL removeTableH;
- @property (strong,nonatomic) UIView *deleteView;
- @end
- @implementation TDInterLeterHomeViewController
- +(TDInterLeterHomeViewController *)initChatMsgNoticeVC{
- TDInterLeterHomeViewController *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterHome"];
- return controller;
- }
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self headRefresh];
- }
- - (UITableView *)tableView
- {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- }
- return _tableView;
- }
- - (void)autoSizeBtn:(NSString *)title
- {
- [self.titleBtn setLabelTitle:title];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- self.fd_interactivePopDisabled = YES;
- self.view.backgroundColor = RGB(255, 255, 255);
- if (@available(iOS 11.0, *)) {
- self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
-
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.NavBar.mas_bottom);
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(self.view.mas_bottom);
- }
- }];
-
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.tableView.backgroundColor = [UIColor clearColor];
-
- self.pageType = PageTypeFromTitleAll;
- [self autoSizeBtn:@"全部"];
- WS(weakSelf);
- [self.titleBtn setAction:^{
- weakSelf.tDInterLeterTypeVC.view.hidden = !weakSelf.tDInterLeterTypeVC.view.hidden;
- if(weakSelf.tDInterLeterTypeVC.view.hidden){
- [weakSelf.titleBtn dismiss];
- }else{
- [weakSelf.titleBtn show];
- }
- }];
-
- [self.rightAddBtn setAction:^{
- NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
- YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
- view.menuColor = RGB(255, 255, 255);
- view.separatorColor = RGB(234, 234, 234);
- view.textColor = RGB(102, 102, 102);
- view.textFont = [UIFont systemFontOfSize:16.0];
- view.menuCellHeight = 43.5;
- view.maxDisplayCount = 10;
- view.offset = -6;
- [view show];
- }];
-
- [self.rightEditBtn setAction:^{
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_InterMail;
- vc.replayType = MailReplayCreate;
- vc.FolderId = weakSelf.interLeterFolderId;
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [self.deleteSelectBtn setAction:^{
- [weakSelf changeToOperation:YES];
- }];
- [self.view addSubview:self.tDInterLeterTypeVC.view];
- [self initBottomBgView];
- [self initDeleteView];
- [self changeToOperation:NO];
- self.iSViewEditor = NO;
- }
- #pragma mark - 批量编辑
- -(UIView *)deleteView{
- if(!_deleteView){
- _deleteView = [[UIView alloc] init];
- CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
- _deleteView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
- _deleteView.backgroundColor = RGB(255, 255, 255);
- _deleteView.hidden = YES;
- }
- return _deleteView;
- }
- -(void)initDeleteView
- {
- UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [leftCloseBtn setTitle:@"全部删除" forState:UIControlStateNormal];
- [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
- leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
-
- [self.deleteView addSubview:leftCloseBtn];
- leftCloseBtn.frame = CGRectMake(0, 0, SCREEN_WIDTH/2, self.deleteView.height);
-
- UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [rightMoveBtn setTitle:@"全部恢复" forState:UIControlStateNormal];
- [rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
- rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
-
- [self.deleteView addSubview:rightMoveBtn];
- rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, self.deleteView.height);
-
- UILabel * topLine = [[UILabel alloc] init];
- topLine.backgroundColor = RGB(240, 239, 244);
- [self.deleteView addSubview:topLine];
- topLine.frame = CGRectMake(0, 0, SCREEN_WIDTH, 0.5);
-
- UILabel *line = [[UILabel alloc] init];
- line.backgroundColor = RGB(240, 239, 244);
- [self.deleteView addSubview:line];
- line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.deleteView.height);
-
- WS(weakSelf);
- [leftCloseBtn setAction:^{
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- SHOWLOADING
- NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_DeleteRecord_All),5];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- [rightMoveBtn setAction:^{
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部恢复" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- SHOWLOADING
- NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_Recover_All),5];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- [[UtilsTools getWindow] addSubview:self.deleteView];
- }
- - (void)changeBarBtn:(BOOL)isHidden
- {
- self.rightAddBtn.hidden = isHidden;
- self.rightEditBtn.hidden = isHidden;
- self.deleteSelectBtn.hidden = !isHidden;
- self.deleteView.hidden = !isHidden;
- if(self.pageType == PageTypeFromTitleDeleted){
- if (!self.removeTableH) {
- self.addTableH = YES;
- self.removeTableH = YES;
- self.view.height -= self.tabBarController.tabBar.height;
- self.tableView.height -= self.tabBarController.tabBar.height;
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- }
- }else{
- if (self.addTableH) {
- self.addTableH = NO;
- self.removeTableH = NO;
- self.tableView.height += self.tabBarController.tabBar.height;
- self.view.height += self.tabBarController.tabBar.height;
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- }
- }
- }
- - (void)addRefresh
- {
- WS(weakSelf);
- self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [weakSelf headRefresh];
- }];
- // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
- // [weakSelf footerRefresh];
- // }];
- }
- - (void)removeRefresh
- {
- [self.tableView.mj_header endRefreshing];
- [self.tableView.mj_header removeFromSuperview];
- [self.tableView.mj_footer endRefreshing];
- [self.tableView.mj_footer removeFromSuperview];
- }
- - (void)headRefresh{
- self.currentPage = 1;
- self.totalRecord = 0;
- [self.interLetterArray removeAllObjects];
- [self getInterListData];
- }
- - (void)footerRefresh{
- self.currentPage += 1;
- if (self.totalRecord == self.interLetterArray.count) {
- [self.tableView.mj_footer endRefreshing];
- return ;
- }
- [self getInterListData];
- }
- - (void)getInterListData{
- NSLog(@"%@",@"刷新数据");
- NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
- NSUInteger deleteType = 0;
- switch (self.pageType) {
- case PageTypeFromTitleAll:
- {
- [self changeBarBtn:NO];
- deleteType = 1;
- }
- break;
- case PageTypeFromTitleMy:
- {
- [self changeBarBtn:NO];
- deleteType = 2;
- }
- break;
- case PageTypeFromTitleDraftBox:
- {
- [self changeBarBtn:NO];
- deleteType = 3;
- }
- break;
- case PageTypeFromTitleDeleted:
- {
- [self changeBarBtn:YES];
- deleteType = 4;
- }
- break;
- default:
- {
- [self changeBarBtn:NO];
- deleteType = 5;
- }
- break;
- }
- [dict setObject:@(self.currentPage) forKey:@"Page"];
- // [dict setObject:@"20" forKey:@"PerPage"];
- [dict setObject:@"99999999" forKey:@"PerPage"];
- [dict setObject:@(deleteType) forKey:@"SearchType"];
- [dict setObject:@"" forKey:@"Key"];
- [dict setObject:@(self.interLeterFolderId) forKey:@"FolderId"];
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_InterLetter) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"站内信返回数据%@",responseObject);
- InterLeterModel *listModel = [[InterLeterModel alloc] initWithDictionary:responseObject error:nil];
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- weakSelf.totalRecord = listModel.Total;
- [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
- if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
- [weakSelf.tableView.mj_footer resetNoMoreData];
- [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
- }
- [weakSelf.tableView reloadData];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- }];
- }
- - (TDInterLeterTypeVC *)tDInterLeterTypeVC{
- if (_tDInterLeterTypeVC == nil) {
- _tDInterLeterTypeVC = [TDInterLeterTypeVC initTDInterLeterTypeVC];
- [_tDInterLeterTypeVC.view setFrame:CGRectMake(0, kNavigationHeight, SCREEN_WIDTH, SCREEN_HEIGHT - kNavigationHeight)];
- [_tDInterLeterTypeVC.view setHidden:YES];
- _tDInterLeterTypeVC.delegate = self;
- }
- return _tDInterLeterTypeVC;
- }
- -(void)userSelectType:(NSString *)typeName{
- self.tDInterLeterTypeVC.view.hidden = !self.tDInterLeterTypeVC.view.hidden;
- if(self.tDInterLeterTypeVC.view.hidden){
- [self.titleBtn dismiss];
- }else{
- [self.titleBtn show];
- }
- if(typeName.length > 0){
- [self autoSizeBtn:typeName];
- if([@"全部" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleAll;
- }else if([@"我发出的" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleMy;
- }else if([@"草稿箱" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleDraftBox;
- }else if([@"已删除" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleDeleted;
- }else if([@"匿名信" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleNoSign;
- }
- [self headRefresh];
- }
- }
- #pragma Mark 左滑按钮 iOS8以上
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
- - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
- InterLeterSubModel *model = self.interLetterArray[indexPath.row];
- if (indexPath.section == 0) {
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- WS(weakSelf);
- switch (self.pageType) {
- case PageTypeFromTitleAll:{
- switch (model.AttributeValue) {
- case 2:{
- UIContextualAction *action1 = [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:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"修改文件夹名称" changeStr:model.FolderName confirm:^(NSString * _Nonnull groupName) {
- NSLog(@"%@",groupName);
- [weakSelf reNameFind:model withReNameString:groupName];
- } cancle:^{
-
- }] show];
- }];
- action2.backgroundColor = RGB(255, 149, 3);
- UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
-
- [weakSelf topFind:model];
- }];
-
- action3.backgroundColor = RGB(197, 201, 204);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }break;
- case 3:{
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf topFind:model];
- }];
-
- action1.backgroundColor = RGB(197, 201, 204);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }break;
- default:{
- WEAKSELF
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
-
- action1.backgroundColor = RGB(255, 59, 47);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
-
- STRONGSELF
- [strongSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- }];
-
- action2.backgroundColor = UIColorHex(0x589AF1);
-
- UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- STRONGSELF
- [strongSelf topFind:model];
- }];
-
- action3.backgroundColor = RGB(197, 201, 204);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- break;
- }
- }break;
- case PageTypeFromTitleDeleted:
- {
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"彻底删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:YES];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- break;
- default:
- {
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf topFind:model];
- }];
- action2.backgroundColor = RGB(197, 201, 204);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- break;
- }
- }
- #else
- - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
- InterLeterSubModel *model = self.interLetterArray[indexPath.row];
- if (indexPath.section == 0) {
- return @[];
- }
- switch (self.pageType) {
- case PageTypeFromTitleAll:{
- switch (model.AttributeValue) {
- case 2:{
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"重命名" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- WEAKSELF
- [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"修改文件夹名称" changeStr:model.FolderName confirm:^(NSString * _Nonnull groupName) {
- NSLog(@"%@",groupName);
- STRONGSELF
- [strongSelf reNameFind:model withReNameString:groupName];
- } cancle:^{
-
- }] show];
- }];
- action2.backgroundColor = RGB(255, 149, 3);
- UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title: model.IsTop?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- STRONGSELF
- [strongSelf topFind:model];
- }];
- action3.backgroundColor = RGB(197, 201, 204);
- return @[action1, action2, action3];
- }break;
- case 3:{
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title: model.IsTop?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- STRONGSELF
- [strongSelf topFind:model];
- }];
-
- action1.backgroundColor = RGB(197, 201, 204);
- return @[action1];
- }break;
- default:{
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
-
- action1.backgroundColor = RGB(255, 59, 47);
-
- UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- STRONGSELF
- [strongSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- }];
-
- action2.backgroundColor = UIColorHex(0x589AF1);
-
- UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- STRONGSELF
- [strongSelf topFind:model];
- }];
-
- action3.backgroundColor = RGB(197, 201, 204);
-
- return @[action1, action2, action3];
- }
- break;
- }
- }break;
- case PageTypeFromTitleDeleted:
- {
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"彻底删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:YES];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- return @[action1];
- }
- break;
- default:
- {
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
-
- action1.backgroundColor = RGB(255, 59, 47);
-
-
-
- UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- STRONGSELF
- [strongSelf topFind:model];
- }];
-
- action2.backgroundColor = RGB(197, 201, 204);
-
- return @[action1, action2];
- }
- break;
- }
- }
- #endif
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 2;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- switch (section) {
- case 0:
- return self.iSViewEditor ? 0 : 1;
- case 1:
- return self.interLetterArray.count;
- default:
- return 0;
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- switch (indexPath.section) {
- case 0:
- return self.iSViewEditor ? 0 : [ChatMsgNoticeCell configCell0Height];
- default:
- {
- InterLeterSubModel *model = self.interLetterArray[indexPath.row];
- switch (model.AttributeValue) {
- case 1:
- return [ChatMsgNoticeCell configCell2Height];
- case 2:
- return [ChatMsgNoticeCell configCell1Height];
- default:
- return 0;
- }
- }
- }
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- if (indexPath.section == 0) {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell0:tableView indexPath:indexPath];
- WS(weakSelf);
- [cell.cell0SearchBtn setAction:^{
- TDInterLeterSearchVC *vc = [[TDInterLeterSearchVC alloc] init];
- vc.FolderId = weakSelf.interLeterFolderId;
- vc.type = weakSelf.pageType;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }
- InterLeterSubModel *model = self.interLetterArray[indexPath.row];
- switch (self.operationStateEnum) {
- case OperationStateEnum0:{
- switch (model.AttributeValue) {
- case 1:{
- switch (self.pageType) {
- case PageTypeFromTitleAll:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2RedBgView.hidden = model.IsRead;
- return cell;
- }
- break;
- case PageTypeFromTitleMy:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleDraftBox:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2UnReadNumberLbl.hidden = YES;
- if (model.MissiveType == 2) {
- cell.cell2IntroLabel.text = @"匿名";
- }else{
- if (model.EnjoyUser.length == 0) {
- cell.cell2IntroLabel.hidden = YES;
- }else{
- if (model.EnjoyUser.length > 13) {
- NSRange range1 = NSMakeRange(10, (model.EnjoyUser.length - 10));
- NSString *resultStr1 = [model.EnjoyUser stringByReplacingCharactersInRange:range1 withString:@"..."];
- cell.cell2IntroLabel.text = [NSString stringWithFormat:@"收件人:%@",resultStr1];
- }else{
- cell.cell2IntroLabel.text = [NSString stringWithFormat:@"收件人:%@",model.EnjoyUser];
- }
- }
- }
- cell.cell2EditBtn.hidden = NO;
- WS(weakSelf);
- [cell.cell2EditBtn setAction:^{
- NSLog(@"编辑草稿箱站内信");
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- case PageTypeFromTitleDeleted:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- WS(weakSelf);
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }break;
- default:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
- cell.cell2TitleLabel.text = model.Title;
- //cell.cell2IntroLabel.text = @"匿名";
- cell.IsTopImgV.hidden = !model.IsTop;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2RedBgView.hidden = model.IsRead;
- return cell;
- }
- break;
- }
- }break;
- case 2:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell1:tableView indexPath:indexPath];
- cell.cell1TitleLabel.text = model.FolderName;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell1TimeLabel.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
- return cell;
- }break;
- default:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- return cell;
- }
- break;
- }
- }break;
- case OperationStateEnum1:{
- self.isAllselect = [self checkNoticeArray];
- [self setingMoveButton];
- [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
- switch (model.AttributeValue) {
- case 1:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.enterBtn.hidden = YES;
- cell.cell2SelectButton.selected = model.IsSelect;
- [cell.cell2SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- return cell;
- }break;
- case 2:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell10:tableView indexPath:indexPath];
- cell.cell1TitleLabel.text = model.FolderName;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.enterBtn.hidden = YES;
- cell.IsTopImgV.hidden = YES;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell2SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- return cell;
-
- }break;
- default:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- return cell;
- }
- break;
- }
- }break;
- default:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2RedBgView.hidden = YES;
- return cell;
- }
- break;
- }
- }
- - (BOOL)checkNoticeArray
- {
- BOOL isFloder = NO;
- for (InterLeterSubModel * model in self.interLetterArray) {
- if (model.AttributeValue == 2) {
- if (model.IsSelect) {
- SHOWERROR(@"文件夹不能移动");
- isFloder = YES;
- }
- }
- }
- [self.rightMoveBtn setEnabled:!isFloder];
-
- if(self.interLetterArray.count == 0)
- {
- return NO;
- }else{
- for (InterLeterSubModel * model in self.interLetterArray) {
- if (model.AttributeValue == 1 || model.AttributeValue == 2) {
- if (!model.IsSelect) {
- return NO;
- }
- }
- }
- return YES;
- }
- }
- - (void)setIntroLabelWithModel:(InterLeterSubModel *)model introLabel:(UILabel *)introLabel unreadNumberLabel:(UILabel *)unreadNumberLabel {
- //判断是否匿名
- if (model.IsAdmin == YES) {
- if (model.EnjoyUser.length > 10) {
- NSRange range1 = NSMakeRange(10, (model.EnjoyUser.length - 10));
- NSString *resultStr1 = [model.EnjoyUser stringByReplacingCharactersInRange:range1 withString:@"..."];
- introLabel.text = [NSString stringWithFormat:@"收件人:%@",resultStr1];
- }else{
- introLabel.text = [NSString stringWithFormat:@"收件人:%@",model.EnjoyUser];
- }
- unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
- }else {
- if (model.MissiveType == 2) {
- introLabel.text = @"匿名";
- unreadNumberLabel.text = nil;
- }else {
- introLabel.text = model.SendName;
- unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
- }
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.section == 0) {
- return;
- }else{
- InterLeterSubModel *model = self.interLetterArray[indexPath.row];
- switch (self.operationStateEnum) {
- case OperationStateEnum0:
- {
- switch (model.AttributeValue) {
- case 2:{
- TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
- vc.interLeterFolderId = model.Id;
- vc.interLeterFoldName = model.FolderName;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:{
- if (self.pageType == PageTypeFromTitleDraftBox) {
- [self editorButtonHander:indexPath];
- }else{
- switch (model.MissiveType) {
- case 1:
- {
- MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- // vc.detailType = (model.MissiveType == 1)? InterLeterDetialType_Sign : InterLeterDetialType_NoSign;
- vc.Id = model.MiddleId;
- vc.type = CollectModel_InterMail;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case 2:{
- MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.MiddleId;
- vc.type = CollectModel_InterMail;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- {
- MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- // vc.detailType = (model.MissiveType == 1)? InterLeterDetialType_Sign : InterLeterDetialType_NoSign;
- vc.Id = model.MiddleId;
- vc.type = CollectModel_InterMail;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- }
- }
- }break;
- }
- }break;
- default:{
- model.IsSelect = !model.IsSelect;
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationNone];
- return;
- }break;
- }
- }
- }
- #pragma mark - 设置 移动按钮 样式
- - (void)setingMoveButton{
- NSInteger flag = 1;
- for (InterLeterSubModel *model in self.interLetterArray) {
- if (model.IsSelect) {
- if (model.AttributeValue == 2) {
- flag += 1;
- }
- }
- }
- if (flag == 1) {
- self.opearateRightBtn.enabled = YES;
- }else{
- self.opearateRightBtn.enabled = NO;
- }
- }
- -(NSMutableArray *)getMenuDataSource:(NSMutableArray *)titleArray{
- NSMutableArray *menuDataSourceArray = [[NSMutableArray alloc] init];
- for(int i=0;i<titleArray.count;i++){
- NSString *titleStr = [titleArray objectAtIndex:i];
- WS(weakSelf);
- YCMenuAction *actionMenu = [YCMenuAction actionWithTitle:titleStr image:nil handler:^(YCMenuAction *action) {
- if([@"建文件夹" isEqualToString:action.title]){
- [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"建文件夹" placeholder:@"请输入文件夹名称" confirm:^(NSString * _Nonnull groupName) {
- NSLog(@"%@",groupName);
- [weakSelf addFind:groupName];
- } cancle:^{
- }] show];
- }
- else if ([@"批量编辑" isEqualToString:action.title]){
- [weakSelf changeToOperation:YES];
- }
- }];
- [menuDataSourceArray addObject:actionMenu];
- }
- return menuDataSourceArray;
- }
- -(NSMutableArray *)taskActionArray{
- if(!_taskActionArray){
- if (self.isHome) {
- _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"建文件夹",@"批量编辑", nil];
- }else{
- _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"批量编辑", nil];
- }
- }
- return _taskActionArray;
- }
- - (NSMutableArray<InterLeterSubModel *> *)interLetterArray{
- if (!_interLetterArray) {
- _interLetterArray = [NSMutableArray array];
- }
- return _interLetterArray;
- }
- #pragma mark - 批量编辑
- -(void)initBottomBgView{
- UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [leftCloseBtn setTitle:@"删除" forState:UIControlStateNormal];
- [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
- leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
-
- [self.operationBottomBgView addSubview:leftCloseBtn];
- leftCloseBtn.frame = CGRectMake(0, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
- self.opearateLeftBtn = leftCloseBtn;
- UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
- [rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
- [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateDisabled];
- rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
-
- [self.operationBottomBgView addSubview:rightMoveBtn];
- rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
- self.opearateRightBtn = rightMoveBtn;
- UILabel *line = [[UILabel alloc] init];
- line.backgroundColor = RGB(240, 239, 244);
- [self.operationBottomBgView addSubview:line];
- line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.operationBottomBgView.height);
-
- self.leftCloseBtn = leftCloseBtn;
- self.rightMoveBtn = rightMoveBtn;
- self.LineL = line;
- WS(weakSelf);
- [leftCloseBtn setAction:^{
- NSMutableArray *selectIDArray = [NSMutableArray array];
- for (InterLeterSubModel * model in weakSelf.interLetterArray) {
- if (model.IsSelect) {
- [selectIDArray addObject:model];
- }
- }
- if (selectIDArray.count == 0) {
- SHOWERROR(@"请选择要删除的站内信");
- return ;
- }else{
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf thoroughDelete:selectIDArray isDelete:NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }
- }];
- [rightMoveBtn setAction:^{
- NSMutableArray *selectIDArray = [NSMutableArray array];
- for (InterLeterSubModel * model in weakSelf.interLetterArray) {
- if (model.IsSelect) {
- [selectIDArray addObject:@(model.Id)];
- }
- }
- if (selectIDArray.count == 0) {
- SHOWERROR(@"请选择要移动的站内信或者文件夹");
- return ;
- }
- [weakSelf launchMoveVC:selectIDArray];
- }];
-
- [[UtilsTools getWindow] addSubview:self.operationBottomBgView];
- }
- - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
- MoveViewController * vc = [MoveViewController initMoveViewController];
- vc.TypeId = CreateCommonType;
- vc.collectType = CollectHanderType_Move;
- vc.ParentId = 0;
- vc.titleStr = @"移动到";
- vc.FolderIds = selectIDArray;
- [self.navigationController pushViewController:vc animated:YES];
-
- [self changeToOperation:NO];
-
- }
- -(UIView *)operationBottomBgView{
- if(!_operationBottomBgView){
- _operationBottomBgView = [[UIView alloc] init];
- CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
- _operationBottomBgView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
- _operationBottomBgView.backgroundColor = RGB(255, 255, 255);
- _operationBottomBgView.hidden = YES;
- }
- return _operationBottomBgView;
- }
- #pragma mark 批量操作与正常操作界面切换
- -(void)changeToOperation:(BOOL)operation{
- WS(weakSelf);
- if(self.pageType == PageTypeFromTitleDeleted){
- [self.rightMoveBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [self.rightMoveBtn setAction:^{
- NSMutableArray *MiddleIds = [NSMutableArray array];
- for (InterLeterSubModel *model in weakSelf.interLetterArray) {
- if (model.IsSelect) {
- [MiddleIds addObject:@(model.Id)];
- }
- }
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:MiddleIds forKey:@"MiddleIds"];
- [dic setValue:@(5) forKey:@"FolderType"];
- [dic setValue:@(1) forKey:@"IsDelete"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }];
- }else{
- [self.rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
- [self.rightMoveBtn setAction:^{
- NSMutableArray *selectIDArray = [NSMutableArray array];
- for (InterLeterSubModel * model in weakSelf.interLetterArray) {
- if (model.IsSelect) {
- [selectIDArray addObject:@(model.Id)];
- }
- }
- if (selectIDArray.count == 0) {
- SHOWERROR(@"请选择要移动的站内信或者文件夹");
- return ;
- }
- [weakSelf launchMoveVC:selectIDArray];
- }];
- }
- if(operation){
- self.deleteView.hidden = YES;
- self.iSViewEditor = YES;
- self.rightAddBtn.hidden = YES;
- self.rightEditBtn.hidden = YES;
- //默认操作状态为批量编辑状态
- [self removeRefresh];
- self.operationStateEnum = OperationStateEnum1;
- self.operationAllSelectButton.hidden = NO;
- [self.operationAllSelectButton setTitleColor:UIColorHex(#0F88EB) forState:UIControlStateNormal];
- [self.operationAllSelectButton setImage:nil forState:UIControlStateNormal];
- WS(weakSelf);
- self.isAllselect = [self checkNoticeArray];
- self.titleLable.text = @"批量编辑";
- self.titleLable.hidden = NO;
- self.titleBtn.hidden = YES;
- [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
- [self.operationAllSelectButton setAction:^{
- for (InterLeterSubModel *model in self.interLetterArray) {
- model.IsSelect = !weakSelf.isAllselect;
- }
- [weakSelf.tableView reloadData];
- }];
- self.operationBottomBgView.hidden = NO;
- if(self.pageType != PageTypeFromTitleDeleted){
- self.tabBarController.tabBar.hidden = YES;
- self.view.height -= self.tabBarController.tabBar.height;
- self.tableView.height -= self.tabBarController.tabBar.height;
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- }else{
- self.deleteSelectBtn.hidden = YES;
- }
- }else{
- [self addRefresh];
- if(self.pageType == PageTypeFromTitleDeleted){
- self.deleteView.hidden = NO;
- self.rightAddBtn.hidden = YES;
- self.rightEditBtn.hidden = YES;
- self.deleteSelectBtn.hidden = NO;
- }else{
- self.deleteView.hidden = YES;
- self.rightAddBtn.hidden = NO;
- self.rightEditBtn.hidden = NO;
- self.deleteSelectBtn.hidden = YES;
- self.tabBarController.tabBar.hidden = YES;
- self.tableView.height += self.tabBarController.tabBar.height;
- self.view.height += self.tabBarController.tabBar.height;
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- }
- self.operationBottomBgView.hidden = YES;
- self.iSViewEditor = NO;
- //默认操作状态为无状态
- self.operationStateEnum = OperationStateEnum0;
- self.operationAllSelectButton.hidden = NO;
- if (self.isHome) {
- self.titleBtn.hidden = NO;
- self.titleLable.hidden = YES;
- }else{
- self.titleLable.hidden = NO;
- self.titleBtn.hidden = YES;
- self.titleLable.text = self.interLeterFoldName;
- }
- [self.operationAllSelectButton setImage:IMG(@"menu_black_icon") forState:UIControlStateNormal];
- [self.operationAllSelectButton setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
- }
- [self.tableView reloadData];
- }
- #pragma mark 移动 isEdit:当前是否为编辑状态
- -(void)userDidMove:(BOOL)move isEdit:(BOOL)isEdit{
- //移动
- if(move){
- //默认操作状态为移动状态
- self.operationStateEnum = OperationStateEnum2;
- self.rightAddBtn.hidden = NO;
- [self resetRightBtnAction:NO];
-
- //隐藏tabBar - 并将TableView至底端
- self.tabBarController.tabBar.hidden = YES;
- self.view.height += self.tabBarController.tabBar.height;
- self.tableView.height += self.tabBarController.tabBar.height;
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- //隐藏operationBottomBgView
- self.operationBottomBgView.hidden = YES;
- }
- else{
- //隐藏tabBar - 并将TableView至底端有tabBar.height的高
- self.tabBarController.tabBar.hidden = YES;
- self.view.height -= self.tabBarController.tabBar.height;
- self.tableView.height -= self.tabBarController.tabBar.height;
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- //显示operationBottomBgView
- self.operationBottomBgView.hidden = NO;
-
- if(isEdit){
- self.operationStateEnum = OperationStateEnum1;
- self.rightAddBtn.hidden = YES;
- [self resetRightBtnAction:YES];
- }else{
- [self changeToOperation:NO];
- }
- }
- [self.tableView reloadData];
- }
- - (void)reSettingIsSelect{
- for (InterLeterSubModel *model in self.interLetterArray) {
- model.IsSelect = NO;
- }
- }
- -(void)resetRightBtnAction:(BOOL)isShowMenu{
- WS(weakSelf);
- if(isShowMenu){
- [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_add_icon"] forState:UIControlStateNormal];
- [self.rightAddBtn setAction:^{
- NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
- YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
- view.menuColor = RGB(255, 255, 255);
- view.separatorColor = RGB(234, 234, 234);
- view.textColor = RGB(102, 102, 102);
- view.textFont = [UIFont systemFontOfSize:16.0];
- view.menuCellHeight = 43.5;
- view.maxDisplayCount = 10;
- view.offset = -6;
- [view show];
- }];
- }else{
- [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_fileadd_icon"] forState:UIControlStateNormal];
- [self.rightAddBtn setAction:^{
- [ShowtipTool showErrorWithStatus:@"未做"];
- }];
- }
- }
- - (void)backAction:(id)sender{
- [self changeBarBtn:NO];
- self.deleteView.hidden = YES;
- if (self.iSViewEditor) {
- [self headRefresh];
- [self changeSelectStatus];
- [self changeToOperation:NO];
- }else{
- [self.navigationController popViewControllerAnimated:true];
- }
- }
- - (void)changeSelectStatus
- {
- for (InterLeterSubModel * model in self.interLetterArray) {
- model.IsSelect = NO;
- }
- }
- - (void)menuAction:(id)sender{
- switch (self.operationStateEnum) {
- case OperationStateEnum1:
- {
- for (InterLeterSubModel *model in self.interLetterArray) {
- model.IsSelect = !self.isAllselect;
- }
- [self.tableView reloadData];
- [self setingMoveButton];
- }
- break;
- default:
- [super menuAction:sender];
- break;
- }
- }
- #pragma mark - 文件夹操作 创建 | 修改 | 置顶 | 取消置顶 | 删除 | 恢复已删除 | 移动
- /// 创建文件夹
- - (void)addFind:(NSString *)groupname{
- SHOWLOADING
- WEAKSELF
- [[HttpManager sharedHttpManager] PUTUrl:Host(APP_Middle_Add_Folder) parameters:@{@"FolderName":groupname,@"ParentId":@(self.interLeterFolderId),@"TypeId":@(5)} success:^(id _Nonnull responseObject) {
- STRONGSELF
- REMOVESHOW
- [strongSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- /// 修改文件夹名称
- - (void)reNameFind:(InterLeterSubModel*)findModel withReNameString:(NSString *)renameString{
-
- SHOWLOADING
- WEAKSELF
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_ReName) parameters:@{@"FolderName":renameString,@"Id":@(findModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- STRONGSELF
- REMOVESHOW
- [strongSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
-
- }
- /// 文件夹 置顶 和 取消置顶
- - (void)topFind:(InterLeterSubModel*)findModel{
- NSLog(@"文件夹---%@%@",findModel.IsTop ? @"置顶":@"取消置顶",findModel.FolderName);
- SHOWLOADING
- WEAKSELF
- [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf reCreateTable];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)reCreateTable
- {
- self.currentPage = 1;
- self.totalRecord = 0;
- [self.interLetterArray removeAllObjects];
- NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
- NSUInteger deleteType = 0;
- switch (self.pageType) {
- case PageTypeFromTitleAll:
- {
- [self changeBarBtn:NO];
- deleteType = 1;
- }
- break;
- case PageTypeFromTitleMy:
- {
- [self changeBarBtn:NO];
- deleteType = 2;
- }
- break;
- case PageTypeFromTitleDraftBox:
- {
- [self changeBarBtn:NO];
- deleteType = 3;
- }
- break;
- case PageTypeFromTitleDeleted:
- {
- [self changeBarBtn:YES];
- deleteType = 4;
- }
- break;
- default:
- {
- [self changeBarBtn:NO];
- deleteType = 5;
- }
- break;
- }
- [dict setObject:@(self.currentPage) forKey:@"Page"];
- [dict setObject:@"20" forKey:@"PerPage"];
- [dict setObject:@(deleteType) forKey:@"SearchType"];
- [dict setObject:@"" forKey:@"Key"];
- [dict setObject:@(self.interLeterFolderId) forKey:@"FolderId"];
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_InterLetter) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"站内信返回数据%@",responseObject);
- InterLeterModel *listModel = [[InterLeterModel alloc] initWithDictionary:responseObject error:nil];
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- weakSelf.totalRecord = listModel.Total;
- [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
- if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
- [weakSelf.tableView.mj_footer resetNoMoreData];
- [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView removeFromSuperview];
- weakSelf.tableView = nil;
- [weakSelf.view addSubview:weakSelf.tableView];
- weakSelf.tableView.delegate = weakSelf;
- weakSelf.tableView.dataSource = weakSelf;
- weakSelf.tableView.backgroundColor = [UIColor clearColor];
- [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(weakSelf.view);
- make.top.mas_equalTo(weakSelf.NavBar.mas_bottom);
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(weakSelf.view.mas_bottom);
- }
- }];
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- }];
- }
- /// 删除文件夹
- //- (void)deleteFind:(NSMutableArray<InterLeterSubModel *>*)findModelArray{
- // NSMutableArray *MiddleIds = [NSMutableArray array];
- //
- // for (InterLeterSubModel *model in findModelArray) {
- // [MiddleIds addObject:@(model.Id)];
- // }
- // NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- // [dic setValue:MiddleIds forKey:@"MiddleIds"];
- // [dic setValue:@(5) forKey:@"FolderType"];
- // [dic setValue:@(0) forKey:@"IsDelete"];
- // [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- //
- // SHOWLOADING
- // WEAKSELF
- // [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- // STRONGSELF
- // REMOVESHOW
- // [strongSelf headRefresh];
- // } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- // }];
- //
- //}
- - (void)thoroughDelete:(NSMutableArray<InterLeterSubModel *>*)array isDelete:(BOOL)isDelete
- {
- NSMutableArray * addArray = [NSMutableArray array];
- for (InterLeterSubModel *model in array) {
- [addArray addObject:@(model.Id)];
- }
- NSDictionary * dict = @{@"MiddleIds":addArray,
- @"FolderType":@(5), ///1 通知
- @"IsDelete":@(isDelete)
- };
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dict responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- SHOWSUCCESS(@"删除成功");
- // [weakSelf changeToOperation:NO];
- [weakSelf.interLetterArray removeObjectsInArray:array];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- }
- /// 恢复文件夹
- - (void)reDoDeleteFind:(NSMutableArray<InterLeterSubModel *>*)findModelArray{
- NSMutableArray *MiddleIds = [NSMutableArray array];
- for (InterLeterSubModel *model in findModelArray) {
- [MiddleIds addObject:@(model.Id)];
- }
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:MiddleIds forKey:@"MiddleIds"];
- [dic setValue:@(5) forKey:@"FolderType"];
- [dic setValue:@(0) forKey:@"IsDelete"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
-
- SHOWLOADING
- WEAKSELF
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- STRONGSELF
- REMOVESHOW
- [strongSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
-
- }
- /// 移动文件夹
- - (void)moveFind:(NSMutableArray<InterLeterSubModel *>*)findModelArray withSuperModel:(NoticeModel *)supermodel{
- NSMutableArray *MiddleIds = [NSMutableArray array];
-
- for (InterLeterSubModel *model in findModelArray) {
- [MiddleIds addObject:@(model.Id)];
- }
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:MiddleIds forKey:@"Ids"];
- [dic setValue:@(0) forKey:@"ParentId"];
-
- SHOWLOADING
- WEAKSELF
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Move) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- STRONGSELF
- REMOVESHOW
- [strongSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
-
- }
- - (void)editorButtonHander:(NSIndexPath *)indexpath{
- WS(weakSelf);
- InterLeterSubModel *model = self.interLetterArray[indexpath.row];
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_InterMail;
- vc.isEdit = YES;
- vc.replayType = MailReplayEdit;
- vc.Id = model.MiddleId;
- vc.isFromDraft = (model.SourceId == 0 ? YES : NO);
- vc.MailType = model.MissiveType;
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- [self changeBarBtn:NO];
- self.deleteView.hidden = YES;
- self.operationBottomBgView.hidden = YES;
- }
- @end
|