12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489 |
- //
- // 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"
- #import "MyTDGroupView.h"
- #import "NoticeListModel.h"
- #import "MyApprovalPageDetail.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 (weak, nonatomic) IBOutlet UIView *HeadView;
- @property (strong, nonatomic) MyTDGroupView *SearchView;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *HeadHight;
- @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) PageTypeFromShou pageType;
- @property (assign, nonatomic) NSUInteger currentPage;
- @property (assign, nonatomic) BOOL isFresh;
- @property (assign, nonatomic) NSInteger totalRecord;
- @property (strong, nonatomic) NSMutableArray<NoticeModel * >*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;
- @property (nonatomic, strong) UIView *SortView;
- @property (nonatomic, strong) UIButton *allSelectBtn;
- @property (nonatomic, strong) UILabel *selectCountL;
- @end
- @implementation TDInterLeterHomeViewController
- +(TDInterLeterHomeViewController *)initChatMsgNoticeVC{
- TDInterLeterHomeViewController *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterHome"];
- return controller;
- }
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self headRefresh];
- }
- - (MyTDGroupView *)SearchView
- {
- if (!_SearchView) {
- _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 5, SCREEN_WIDTH, 36)];
- }
- return _SearchView;
- }
- - (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);
- [self addSortV];
- self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- [self.HeadView addSubview:self.SearchView];
- WS(weakSelf);
- [self.SearchView.button setAction:^{
- TDInterLeterSearchVC *vc = [[TDInterLeterSearchVC alloc] init];
- vc.FolderId = weakSelf.interLeterFolderId;
- vc.type = weakSelf.pageType;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
-
- [self.view addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(self.view);
- make.top.mas_equalTo(self.HeadView.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:@"全部"];
- [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_Notice;
- vc.replayType = MailReplayCreate;
- vc.FolderId = weakSelf.interLeterFolderId;
- [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(isHidden){
- 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];
- if (self.pageType == PageTypeFromTitleDeleted) {
- [self changeBarBtn:YES];
- }else{
- [self changeBarBtn:NO];
- }
- [dict setObject:@(self.currentPage) forKey:@"Page"];
- [dict setObject:@"99999999" forKey:@"PerPage"];
- [dict setObject:@(self.pageType) forKey:@"SearchType"];
- [dict setObject:@"" forKey:@"Keyword"];
- [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"站内信返回数据%@",responseObject);
- REMOVESHOW
- NoticeListModel *listModel = [[NoticeListModel 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) {
- REMOVESHOW
- SHOWERROR([ZYCTool handerResultData:error]);
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- }];
- }
- - (void)getData{
- NSLog(@"%@",@"刷新数据");
- self.currentPage = 1;
- self.totalRecord = 0;
- [self.interLetterArray removeAllObjects];
- NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
- [dict setObject:@(self.currentPage) forKey:@"Page"];
- [dict setObject:@"99999999" forKey:@"PerPage"];
- [dict setObject:@(self.pageType) forKey:@"SearchType"];
- [dict setObject:@"" forKey:@"Keyword"];
- [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"站内信返回数据%@",responseObject);
- REMOVESHOW
- NoticeListModel *listModel = [[NoticeListModel 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) {
- REMOVESHOW
- 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 = PageTypeFromTitleNotice;
- }else if([@"站内信" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleMail;
- }else if([@"匿名信" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleNoSign;
- }else if([@"我审批的" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleMeShen;
- }else if([@"我发出的" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleMeSend;
- }else if([@"抄送我的" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleChao;
- }else if([@"草稿箱" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleDraftBox;
- }else if([@"已删除" isEqualToString:typeName]){
- self.pageType = PageTypeFromTitleDeleted;
- }
- [self headRefresh];
- }
- }
- #pragma Mark 左滑按钮 iOS8以上
- - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
- NoticeModel *model = self.interLetterArray[indexPath.row];
- WS(weakSelf);
- if (self.operationStateEnum == OperationStateEnum0) {
- switch (model.NoticeStatus) {
- case 1:{
- 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];
- completionHandler(YES);
- }];
- 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];
- completionHandler(YES);
- }];
- 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];
- completionHandler(YES);
- }];
-
- 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];
- completionHandler(YES);
- }];
-
- action1.backgroundColor = RGB(197, 201, 204);
- 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];
- completionHandler(YES);
- }];
-
- action1.backgroundColor = RGB(255, 59, 47);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- completionHandler(YES);
- }];
-
- action2.backgroundColor = UIColorHex(0x589AF1);
-
- UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf topFind:model];
- completionHandler(YES);
- }];
-
- action3.backgroundColor = RGB(197, 201, 204);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- break;
- }
- }break;
- case 0:
- {
- 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];
- completionHandler(YES);
- }];
- 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];
- completionHandler(YES);
- }];
- 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];
- completionHandler(YES);
- }];
- action2.backgroundColor = RGB(197, 201, 204);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- break;
- }
- }
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.interLetterArray.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- // NoticeModel *model = self.interLetterArray[indexPath.row];
- // switch (model.AttributeValue) {
- // case 1:
- // return [ChatMsgNoticeCell configCell2Height];
- // case 2:
- // return [ChatMsgNoticeCell configCell1Height];
- // default:
- // return 0;
- // }
- return UITableViewAutomaticDimension;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- WS(weakSelf);
- NoticeModel *model = self.interLetterArray[indexPath.row];
- switch (self.operationStateEnum) {
- case OperationStateEnum0:{
- switch (model.AttributeValue) {
- case 1:{
- switch (model.NoticeStatus) {
- case 1:///正常
- {
- switch (model.TypeValue){
- case PageTypeFromTitleMail:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2RedBgView.hidden = model.IsRead;
- return cell;
- }
- break;
- case PageTypeFromTitleNotice:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleMeShen:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleChao:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- default:///匿名
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- 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.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- return cell;
- }
- break;
- }
- }
- break;
- case 0:///删除
- {
- switch (model.TypeValue) {
- case PageTypeFromTitleMail:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleNotice:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleMeShen:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleChao:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- default:///匿名
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- return cell;
- }
- break;
- }
- }
- break;
- default:
- {
- switch (model.TypeValue) {
- case PageTypeFromTitleMail:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- case PageTypeFromTitleNotice:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- case PageTypeFromTitleMeShen:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2EditBtn.hidden = NO;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- case PageTypeFromTitleChao:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2EditBtn.hidden = NO;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2EditBtn.hidden = NO;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- default:///匿名
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2EditBtn.hidden = NO;
- [cell.cell2EditBtn setAction:^{
- [weakSelf editorButtonHander:indexPath];
- }];
- cell.cell2RedBgView.hidden = model.IsRead;
- cell.cell2TimeLabel.hidden = YES;
- return cell;
- }
- break;
- }
- }
- 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;
- default:{
- self.isAllselect = [self checkNoticeArray];
- [self setingMoveButton];
- [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
- switch (model.AttributeValue) {
- case 1:{
- switch (model.NoticeStatus) {
- case 1:///正常
- {
- switch (model.TypeValue){
- case PageTypeFromTitleMail:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- 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.cell2TimeLabel.hidden = YES;
- cell.cell2RedBgView.hidden = YES;
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleNotice:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2RedBgView.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleMeShen:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- 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.cell2TimeLabel.hidden = YES;
- cell.cell2RedBgView.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2RedBgView.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleChao:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- 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.cell2TimeLabel.hidden = YES;
- cell.cell2RedBgView.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- 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.cell2TimeLabel.hidden = YES;
- cell.cell2RedBgView.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- default:///匿名
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.hidden = YES;
- cell.cell2RedBgView.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- }
- }
- break;
- case 0:///删除
- {
- switch (model.TypeValue) {
- case PageTypeFromTitleMail:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleNotice:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleMeShen:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleChao:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- default:///匿名
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2EditBtn.hidden = NO;
- cell.cell2RedBgView.hidden = YES;
- cell.cell2TimeLabel.hidden = YES;
- [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
- [cell.cell2EditBtn setAction:^{
- NSLog(@"恢复已删除站内信");
- [weakSelf reDoDeleteFind:@[model].mutableCopy];
- }];
- cell.isShow = model.IsTop;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- dispatch_async(dispatch_get_main_queue(), ^{
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- });
- }];
- return cell;
- }
- break;
- }
- }
- break;
- default:
- {
- switch (model.TypeValue) {
- case PageTypeFromTitleMail:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleNotice:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleMeShen:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleChao:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- default:///匿名
- {
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
- cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
- cell.cell2TitleLabel.text = model.Title;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell2TimeLabel.hidden = YES;
- cell.cell1TimeLabel.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
- cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
- cell.enterBtn.hidden = YES;
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- cell.isShow = model.IsTop;
- return cell;
- }
- break;
- }
- }
- break;
- }
- }
- break;
- default:{
- ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell10:tableView indexPath:indexPath];
- cell.cell1TitleLabel.text = model.FolderName;
- cell.cell1TimeLabel.hidden = YES;
- cell.enterBtn.hidden = YES;
- cell.IsTopImgV.hidden = !model.IsTop;
- cell.cell2TimeLabel.hidden = YES;
- [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
- cell.cell1SelectButton.selected = model.IsSelect;
- [cell.cell1SelectButton setAction:^{
- model.IsSelect = !model.IsSelect;
- [weakSelf sumCount];
- [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
- }];
- return cell;
-
- }break;
- }
- }break;
- }
- }
- - (BOOL)checkNoticeArray
- {
- BOOL isFloder = NO;
- for (NoticeModel * 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 (NoticeModel * model in self.interLetterArray) {
- if (!model.IsSelect) {
- return NO;
- }
- }
- return YES;
- }
- }
- - (void)setIntroLabelWithModel:(NoticeModel *)model introLabel:(UILabel *)introLabel unreadNumberLabel:(UILabel *)unreadNumberLabel {
- //判断是否匿名
- if (model.TypeValue == PageTypeFromTitleSystem) {
- introLabel.text = model.UserName;
- unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
- }else{
- if (model.IsAdmin) {
- 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.TypeValue == 18) {
- introLabel.text = @"匿名";
- unreadNumberLabel.text = nil;
- }else{
- introLabel.text = [NSString stringWithFormat:@"发件人:%@",model.UserName];
- unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
- }
- }
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- NoticeModel *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.TypeValue) {
- case PageTypeFromTitleNoSign:
- {
- MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.MiddleId;
- vc.type = CollectModel_NoSignMail;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case PageTypeFromTitleMail:
- {
- MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.MiddleId;
- vc.type = CollectModel_InterMail;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case PageTypeFromTitleNotice:
- {
- MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.MiddleId;
- vc.type = CollectModel_Notice;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case PageTypeFromTitleMeShen:
- {
- [self pushWorkVCwithModel:model];
- }break;
- case PageTypeFromTitleMeSend:
- {
- [self pushWorkVCwithModel:model];
- }break;
- case PageTypeFromTitleChao:
- {
- [self pushWorkVCwithModel:model];
- }break;
- case PageTypeFromTitleSystem:
- {
- [self pushWorkVCwithModel:model];
- }
- break;
- default:
- {
- [self pushWorkVCwithModel:model];
- }break;
- }
- }
- }break;
- }
- }break;
- default:{
- model.IsSelect = !model.IsSelect;
- [self sumCount];
- [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }break;
- }
- }
- - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
- return tableView.editing;
- }
- - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
- NoticeModel *model = self.interLetterArray[sourceIndexPath.row];
- NoticeModel *toModel = self.interLetterArray[destinationIndexPath.row];
- WS(weakSelf);
- if (model.AttributeValue == toModel.AttributeValue && model.IsTop && toModel.IsTop) {
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(model.Id),@"MiddleIdSecond":@(toModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- [weakSelf.interLetterArray removeObject:model];
- [weakSelf.interLetterArray insertObject:model atIndex:destinationIndexPath.row];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }else{
- [weakSelf.interLetterArray removeObject:model];
- [weakSelf.interLetterArray insertObject:model atIndex:sourceIndexPath.row];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- }
- }
- - (void)sumCount
- {
- NSInteger count = 0;
- for (NoticeModel * smodel in self.interLetterArray) {
- if (smodel.IsSelect) {
- count ++;
- }
- }
- [self.allSelectBtn setImage:count == self.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
- self.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
- }
- #pragma mark - 设置 移动按钮 样式
- - (void)setingMoveButton{
- BOOL flag = NO;
- BOOL use = NO;
- for (NoticeModel *model in self.interLetterArray) {
- if (model.IsSelect) {
- if (model.AttributeValue == 2) {
- flag = YES;
- }else{
- use = YES;
- }
- }
- }
- if (flag) {
- [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
- self.rightMoveBtn.enabled = NO;
- }else{
- if (!use) {
- [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
- self.rightMoveBtn.enabled = NO;
- }else{
- [self.rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
- self.rightMoveBtn.enabled = YES;
- }
- }
-
- }
- -(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<NoticeModel *> *)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:UIColorHex(#BBBBBB) 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 (NoticeModel * 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:weakSelf.pageType == PageTypeFromTitleDeleted ? YES : NO];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }
- }];
- [rightMoveBtn setAction:^{
- NSMutableArray *selectIDArray = [NSMutableArray array];
- for (NoticeModel * 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 = CreateShouType;
- vc.CollectionType = CollectModel_ShouJian;
- 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 (NoticeModel *model in weakSelf.interLetterArray) {
- if (model.IsSelect) {
- [MiddleIds addObject:@(model.Id)];
- }
- }
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:MiddleIds forKey:@"MiddleIds"];
- [dic setValue:@(800) forKey:@"FolderType"];
- [dic setValue:@(0) forKey:@"IsDelete"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf getData];
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }];
- }else{
- [self.rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
- [self.rightMoveBtn setAction:^{
- NSMutableArray *selectIDArray = [NSMutableArray array];
- for (NoticeModel * 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.SortView.hidden = NO;
- self.SearchView.hidden = NO;
- self.HeadHight.constant = 82.f;
- [self.SortView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_offset(36);
- }];
- CGRect rect = self.SearchView.frame;
- rect.origin.y = 41.f;
- self.SearchView.frame = rect;
- self.rightAddBtn.hidden = YES;
- self.rightEditBtn.hidden = YES;
- //默认操作状态为批量编辑状态
- [self removeRefresh];
- [self.tableView setEditing:YES];
- 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 (NoticeModel *model in weakSelf.interLetterArray) {
- model.IsSelect = !weakSelf.isAllselect;
- }
- [weakSelf.allSelectBtn setImage:weakSelf.isAllselect ? IMG(@"sendinfo_no") : IMG(@"sendinfo_yes") forState:UIControlStateNormal];
- weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",weakSelf.isAllselect ? 0 : (long)weakSelf.interLetterArray.count];
- [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 + 36);
- [self.view layoutIfNeeded];
- [self.tableView layoutIfNeeded];
- }else{
- self.deleteSelectBtn.hidden = YES;
- }
- self.fd_interactivePopDisabled = YES;
- self.tableView.allowsSelectionDuringEditing = 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.tableView setEditing:NO];
- self.operationBottomBgView.hidden = YES;
- self.iSViewEditor = NO;
- self.HeadHight.constant = 46.f;
- CGRect rect = self.SearchView.frame;
- rect.origin.y = 5.f;
- self.SearchView.frame = rect;
- self.SortView.hidden = YES;
- self.SearchView.hidden = NO;
- [self.SortView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_offset(0);
- }];
- //默认操作状态为无状态
- 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.fd_interactivePopDisabled = NO;
- }
- [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 (NoticeModel *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 (NoticeModel * model in self.interLetterArray) {
- model.IsSelect = NO;
- }
- }
- - (void)menuAction:(id)sender{
- switch (self.operationStateEnum) {
- case OperationStateEnum1:
- {
- for (NoticeModel *model in self.interLetterArray) {
- model.IsSelect = !self.isAllselect;
- }
- [self.tableView reloadData];
- [self setingMoveButton];
- }
- break;
- default:{
- [super menuAction:sender];
- self.deleteView.hidden = YES;
- self.operationBottomBgView.hidden = YES;
- }
- break;
- }
- }
- #pragma mark - 文件夹操作 创建 | 修改 | 置顶 | 取消置顶 | 删除 | 恢复已删除 | 移动
- /// 创建文件夹
- - (void)addFind:(NSString *)groupname{
- SHOWLOADING
- WEAKSELF
- [[HttpManager sharedHttpManager] PUTUrl:Host(APP_Middle_Add_Folder) parameters:@{@"FolderName":groupname,@"ParentId":@(self.interLeterFolderId),@"TypeId":@(800)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- STRONGSELF
- REMOVESHOW
- [strongSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- /// 修改文件夹名称
- - (void)reNameFind:(NoticeModel*)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:(NoticeModel*)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];
- if (self.pageType == PageTypeFromTitleDeleted) {
- [self changeBarBtn:YES];
- }else{
- [self changeBarBtn:NO];
- }
- // [dict setObject:@(self.currentPage) forKey:@"Page"];
- // [dict setObject:@"99999999" forKey:@"PerPage"];
- // [dict setObject:@(self.pageType) forKey:@"SearchType"];
- // [dict setObject:@"" forKey:@"Keyword"];
- // [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
- // WS(weakSelf);
- // [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- // NSLog(@"站内信返回数据%@",responseObject);
- // NoticeListModel *listModel = [[NoticeListModel 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];
- // }];
- [dict setObject:@(self.currentPage) forKey:@"Page"];
- [dict setObject:@"99999999" forKey:@"PerPage"];
- [dict setObject:@(self.pageType) forKey:@"SearchType"];
- [dict setObject:@"" forKey:@"Key"];
- [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"站内信返回数据%@",responseObject);
- NoticeListModel *listModel = [[NoticeListModel 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.HeadView.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<NoticeModel *>*)findModelArray{
- // NSMutableArray *MiddleIds = [NSMutableArray array];
- //
- // for (NoticeModel *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<NoticeModel *>*)array isDelete:(BOOL)isDelete
- {
- NSMutableArray * addArray = [NSMutableArray array];
- for (NoticeModel *model in array) {
- [addArray addObject:@(model.Id)];
- }
- NSDictionary * dict = @{@"MiddleIds":addArray,
- @"FolderType":@(800), ///1 通知
- @"IsDelete":@(isDelete)
- };
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dict responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- SHOWSUCCESS(@"删除成功");
- [weakSelf.interLetterArray removeObjectsInArray:array];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- }
- /// 恢复文件夹
- - (void)reDoDeleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
- NSMutableArray *MiddleIds = [NSMutableArray array];
- for (NoticeModel *model in findModelArray) {
- [MiddleIds addObject:@(model.Id)];
- }
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:MiddleIds forKey:@"MiddleIds"];
- [dic setValue:@(800) 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) {
- REMOVESHOW
- [weakSelf getData];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- /// 移动文件夹
- - (void)moveFind:(NSMutableArray<NoticeModel *>*)findModelArray withSuperModel:(NoticeModel *)supermodel{
- NSMutableArray *MiddleIds = [NSMutableArray array];
-
- for (NoticeModel *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);
- NoticeModel *model = self.interLetterArray[indexpath.row];
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.isEdit = YES;
- vc.replayType = MailReplayEdit;
- vc.Id = model.MiddleId;
- vc.isFromDraft = YES;
- switch (model.TypeValue) {
- case PageTypeFromTitleNotice:
- {
- vc.MailType = 3;
- vc.type = CollectModel_Notice;
- }
- break;
- case PageTypeFromTitleMail:
- {
- vc.MailType = 1;
- vc.type = CollectModel_InterMail;
- }
- break;
- default:
- {
- vc.MailType = 2;
- vc.type = CollectModel_InterMail;
- }
- break;
- }
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)pushWorkVCwithModel:(NoticeModel *)model
- {
- MyApprovalPageDetail *myApprovalPageDetail = [[MyApprovalPageDetail alloc] init];
- switch (model.TypeValue) {
- case PageTypeFromTitleMeShen:
- {
- myApprovalPageDetail.pageType = Type_ONEA;
- }
- break;
- case PageTypeFromTitleMeSend:
- {
- myApprovalPageDetail.pageType = Type_ONEB;
- }
- break;
- case PageTypeFromTitleSystem:
- {
- if (model.IsAdmin) {
- myApprovalPageDetail.pageType = Type_ONEB;
- }else{
- myApprovalPageDetail.pageType = Type_ONEA;
- }
- }
- break;
- default:
- {
- myApprovalPageDetail.pageType = Type_ONEC;
- }
- break;
- }
- myApprovalPageDetail.Stats = model.FlowState;
- myApprovalPageDetail.userId = model.UserId;
- myApprovalPageDetail.indexId = model.MiddleId;
- myApprovalPageDetail.TodoId = model.TodoId;
- myApprovalPageDetail.title = model.Title;
- [self.navigationController pushViewController:myApprovalPageDetail animated:YES];
- }
- - (void)setShenIcon:(NoticeModel *)model withCellImgV:(UIImageView *)imagV
- {
- if (model.IsRecall) {
- imagV.image = IMG(@"IsRecall_Icon");
- }else{
- switch (model.TypeValue) {
- case PageTypeFromTitleSystem:
- {
- imagV.image = IMG(@"shenpi_icon");
- }
- break;
- default:
- {
- if ([model.FlowState isEqualToString:@"Checking"]) {
- imagV.image = IMG(@"审批");
- }else{
- imagV.image = IMG(@"shenpi_icon");
- }
- }
- break;
- }
- }
- }
- - (UIButton *)allSelectBtn
- {
- if (!_allSelectBtn) {
- _allSelectBtn = [UIButton new];
- _allSelectBtn.hidden = YES;
- [_allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
- }
- return _allSelectBtn;
- }
- - (UILabel *)selectCountL
- {
- if (!_selectCountL) {
- _selectCountL = [UILabel new];
- _selectCountL.font = Kfont(13);
- _selectCountL.text = @"0";
- _selectCountL.hidden = YES;
- _selectCountL.textColor = UIColorHex(0x0F88EB);
- }
- return _selectCountL;
- }
- - (UIView *)SortView
- {
- if (!_SortView) {
- _SortView = [UIView new];
- _SortView.backgroundColor = UIColorHex(0xF0EFF4);
- }
- return _SortView;
- }
- - (void)addSortV
- {
- [self.HeadView addSubview:self.SortView];
- [self.SortView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.right.mas_equalTo(self.HeadView);
- make.height.mas_offset(36);
- }];
- [self.SortView addSubview:self.allSelectBtn];
- // [self.SortView addSubview:self.selectCountL];
- [self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_offset(5);
- make.centerY.mas_equalTo(self.SortView);
- make.size.mas_offset(CGSizeMake(36, 36));
- }];
- // UILabel * leftL = [UILabel new];
- // leftL.text = @"已选:";
- // leftL.textColor = UIColorHex(0x666666);
- // leftL.font = Kfont(13);
- // [self.SortView addSubview:leftL];
- // [leftL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.mas_equalTo(self.allSelectBtn.mas_right).offset(5);
- // make.centerY.mas_equalTo(self.SortView);
- // }];
- // [self.selectCountL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.mas_equalTo(leftL.mas_right).offset(8);
- // make.centerY.mas_equalTo(self.SortView);
- // }];
- UILabel * rightL = [UILabel new];
- rightL.text = @"长按右侧三横,拖动可进行排序";
- rightL.textColor = UIColorHex(0x666666);
- rightL.font = Kfont(13);
- [self.SortView addSubview:rightL];
- [rightL mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.mas_equalTo(self.selectCountL.mas_right).offset(5);
- // make.centerY.mas_equalTo(self.SortView);
- make.center.mas_equalTo(self.SortView);
- }];
- WS(weakSelf);
- [self.allSelectBtn setAction:^{
- for (NoticeModel *model in weakSelf.interLetterArray) {
- model.IsSelect = !weakSelf.isAllselect;
- if (model.IsSelect && model.AttributeValue == 2) {
- SHOWERROR(@"文件夹不能移动");
- }
- }
- NSInteger count = 0;
- for (NoticeModel * smodel in weakSelf.interLetterArray) {
- if (smodel.IsSelect) {
- count ++;
- }
- }
-
- [weakSelf.allSelectBtn setImage:count == weakSelf.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
- weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- }];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- [self changeBarBtn:NO];
- self.deleteView.hidden = YES;
- self.operationBottomBgView.hidden = YES;
- }
- @end
|