TDInterLeterHomeViewController.m 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178
  1. //
  2. // TDInterLeterHomeViewController.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/9.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "TDInterLeterHomeViewController.h"
  9. #import "ChatMsgNoticeCell.h"
  10. #import "YCMenuView.h"
  11. #import "ShowNewGroupAlert.h"
  12. #import "TDInterLeterTypeVC.h"
  13. #import "TDInterLeterSearchVC.h"
  14. #import "NoticeNewGroupVC.h"
  15. #import "MoveViewController.h"
  16. #import "CreateInterLeterVC.h"
  17. #import "MyTDTopicCreateVC.h"
  18. #import "MyTDTopicDetailVC.h"
  19. #import "NSDate+Extension.h"
  20. #import "ShowBtn.h"
  21. #import "MyTDGroupView.h"
  22. #import "NoticeListModel.h"
  23. #import "MyApprovalPageDetail.h"
  24. @interface TDInterLeterHomeViewController ()<UITableViewDelegate,UITableViewDataSource,TDInterLeterTypeVCDelegate>
  25. //@property (weak, nonatomic) IBOutlet UITableView *tableView;
  26. @property (strong, nonatomic) UITableView *tableView;
  27. @property (weak, nonatomic) IBOutlet ShowBtn *titleBtn;
  28. @property (weak, nonatomic) IBOutlet UIButton *rightAddBtn;
  29. @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
  30. @property (weak, nonatomic) IBOutlet UILabel *titleLable;
  31. @property (weak, nonatomic) IBOutlet UIButton *deleteSelectBtn;
  32. @property (weak, nonatomic) IBOutlet UIView *NavBar;
  33. @property (weak, nonatomic) IBOutlet UIView *HeadView;
  34. @property (strong, nonatomic) MyTDGroupView *SearchView;
  35. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *HeadHight;
  36. @property (strong, nonatomic) UIButton *leftCloseBtn;
  37. @property (strong, nonatomic) UIButton *rightMoveBtn;
  38. @property (strong, nonatomic) UILabel *LineL;
  39. @property (strong, nonatomic) NSMutableArray *taskActionArray;
  40. @property (strong, nonatomic) TDInterLeterTypeVC *tDInterLeterTypeVC;
  41. @property (assign, nonatomic) PageTypeFromShou pageType;
  42. @property (assign, nonatomic) NSUInteger currentPage;
  43. @property (assign, nonatomic) BOOL isFresh;
  44. @property (assign, nonatomic) NSInteger totalRecord;
  45. @property (strong, nonatomic) NSMutableArray<NoticeModel * >*interLetterArray;
  46. //界面操作状态参数
  47. @property (assign,nonatomic) OperationStateEnum operationStateEnum;
  48. //界面操作视图
  49. @property (strong,nonatomic) UIView *operationBottomBgView;
  50. @property (weak, nonatomic) IBOutlet UIButton *operationAllSelectButton;
  51. @property (nonatomic, assign) BOOL iSViewEditor;
  52. @property (strong,nonatomic) UIButton *opearateLeftBtn;
  53. @property (strong,nonatomic) UIButton *opearateRightBtn;
  54. @property (assign,nonatomic) BOOL isAllselect;
  55. @property (assign,nonatomic) BOOL addTableH;
  56. @property (assign,nonatomic) BOOL removeTableH;
  57. @property (strong,nonatomic) UIView *deleteView;
  58. @property (nonatomic, strong) UIView *SortView;
  59. @property (nonatomic, strong) UIButton *allSelectBtn;
  60. @property (nonatomic, strong) UILabel *selectCountL;
  61. @end
  62. @implementation TDInterLeterHomeViewController
  63. +(TDInterLeterHomeViewController *)initChatMsgNoticeVC{
  64. TDInterLeterHomeViewController *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterHome"];
  65. return controller;
  66. }
  67. - (void)viewWillAppear:(BOOL)animated{
  68. [super viewWillAppear:animated];
  69. [self headRefresh];
  70. }
  71. - (MyTDGroupView *)SearchView
  72. {
  73. if (!_SearchView) {
  74. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  75. }
  76. return _SearchView;
  77. }
  78. - (UITableView *)tableView
  79. {
  80. if (!_tableView) {
  81. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  82. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  83. }
  84. return _tableView;
  85. }
  86. - (void)autoSizeBtn:(NSString *)title
  87. {
  88. [self.titleBtn setLabelTitle:title];
  89. }
  90. - (void)viewDidLoad {
  91. [super viewDidLoad];
  92. self.fd_prefersNavigationBarHidden = YES;
  93. self.fd_interactivePopDisabled = YES;
  94. self.view.backgroundColor = RGB(255, 255, 255);
  95. [self addSortV];
  96. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  97. [self.HeadView addSubview:self.SearchView];
  98. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  99. make.top.mas_offset(6);
  100. make.left.right.mas_equalTo(self.HeadView);
  101. make.height.mas_offset(36);
  102. }];
  103. WS(weakSelf);
  104. [self.SearchView.button setAction:^{
  105. TDInterLeterSearchVC *vc = [[TDInterLeterSearchVC alloc] init];
  106. vc.FolderId = weakSelf.interLeterFolderId;
  107. vc.type = weakSelf.pageType;
  108. [weakSelf.navigationController pushViewController:vc animated:YES];
  109. }];
  110. [self.view addSubview:self.tableView];
  111. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.left.right.mas_equalTo(self.view);
  113. make.top.mas_equalTo(self.HeadView.mas_bottom);
  114. if (@available(iOS 11.0, *)) {
  115. make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
  116. } else {
  117. make.bottom.equalTo(self.view.mas_bottom);
  118. }
  119. }];
  120. self.tableView.delegate = self;
  121. self.tableView.dataSource = self;
  122. self.tableView.backgroundColor = [UIColor clearColor];
  123. self.pageType = PageTypeFromTitleAll;
  124. [self autoSizeBtn:@"全部"];
  125. [self.titleBtn setAction:^{
  126. weakSelf.tDInterLeterTypeVC.view.hidden = !weakSelf.tDInterLeterTypeVC.view.hidden;
  127. if(weakSelf.tDInterLeterTypeVC.view.hidden){
  128. [weakSelf.titleBtn dismiss];
  129. }else{
  130. [weakSelf.titleBtn show];
  131. }
  132. }];
  133. [self.rightAddBtn setAction:^{
  134. NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
  135. YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
  136. view.menuColor = RGB(255, 255, 255);
  137. view.separatorColor = RGB(234, 234, 234);
  138. view.textColor = RGB(102, 102, 102);
  139. view.textFont = [UIFont systemFontOfSize:16.0];
  140. view.menuCellHeight = 43.5;
  141. view.maxDisplayCount = 10;
  142. view.offset = -6;
  143. [view show];
  144. }];
  145. [self.rightEditBtn setAction:^{
  146. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  147. vc.type = CollectModel_Notice;
  148. vc.replayType = MailReplayCreate;
  149. vc.FolderId = weakSelf.interLeterFolderId;
  150. [weakSelf.navigationController pushViewController:vc animated:YES];
  151. }];
  152. [self.deleteSelectBtn setAction:^{
  153. [weakSelf changeToOperation:YES];
  154. }];
  155. [self.view addSubview:self.tDInterLeterTypeVC.view];
  156. [self initBottomBgView];
  157. [self initDeleteView];
  158. [self changeToOperation:NO];
  159. self.iSViewEditor = NO;
  160. }
  161. #pragma mark - 批量编辑
  162. -(UIView *)deleteView{
  163. if(!_deleteView){
  164. _deleteView = [[UIView alloc] init];
  165. CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
  166. _deleteView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
  167. _deleteView.backgroundColor = RGB(255, 255, 255);
  168. _deleteView.hidden = YES;
  169. }
  170. return _deleteView;
  171. }
  172. -(void)initDeleteView
  173. {
  174. UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  175. [leftCloseBtn setTitle:@"全部删除" forState:UIControlStateNormal];
  176. [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
  177. leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  178. [self.deleteView addSubview:leftCloseBtn];
  179. leftCloseBtn.frame = CGRectMake(0, 0, SCREEN_WIDTH/2, self.deleteView.height);
  180. UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  181. [rightMoveBtn setTitle:@"全部恢复" forState:UIControlStateNormal];
  182. [rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
  183. rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  184. [self.deleteView addSubview:rightMoveBtn];
  185. rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, self.deleteView.height);
  186. UILabel * topLine = [[UILabel alloc] init];
  187. topLine.backgroundColor = RGB(240, 239, 244);
  188. [self.deleteView addSubview:topLine];
  189. topLine.frame = CGRectMake(0, 0, SCREEN_WIDTH, 0.5);
  190. UILabel *line = [[UILabel alloc] init];
  191. line.backgroundColor = RGB(240, 239, 244);
  192. [self.deleteView addSubview:line];
  193. line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.deleteView.height);
  194. WS(weakSelf);
  195. [leftCloseBtn setAction:^{
  196. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部删除" preferredStyle:UIAlertControllerStyleAlert];
  197. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  198. }];
  199. [ok setValue:k9 forKey:@"_titleTextColor"];
  200. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  201. SHOWLOADING
  202. NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_DeleteRecord_All),5];
  203. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  204. REMOVESHOW
  205. [weakSelf headRefresh];
  206. } failure:^(NSError * _Nonnull error) {
  207. SHOWERROR([ZYCTool handerResultData:error]);
  208. }];
  209. }];
  210. [alertVC addAction:ok];
  211. [alertVC addAction:noOk];
  212. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  213. }];
  214. [rightMoveBtn setAction:^{
  215. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部恢复" preferredStyle:UIAlertControllerStyleAlert];
  216. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  217. }];
  218. [ok setValue:k9 forKey:@"_titleTextColor"];
  219. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  220. SHOWLOADING
  221. NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_Recover_All),5];
  222. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  223. REMOVESHOW
  224. [weakSelf headRefresh];
  225. } failure:^(NSError * _Nonnull error) {
  226. SHOWERROR([ZYCTool handerResultData:error]);
  227. }];
  228. }];
  229. [alertVC addAction:ok];
  230. [alertVC addAction:noOk];
  231. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  232. }];
  233. [[UtilsTools getWindow] addSubview:self.deleteView];
  234. }
  235. - (void)changeBarBtn:(BOOL)isHidden
  236. {
  237. self.rightAddBtn.hidden = isHidden;
  238. self.rightEditBtn.hidden = isHidden;
  239. self.deleteSelectBtn.hidden = !isHidden;
  240. self.deleteView.hidden = !isHidden;
  241. if(isHidden){
  242. if (!self.removeTableH) {
  243. self.addTableH = YES;
  244. self.removeTableH = YES;
  245. self.view.height -= self.tabBarController.tabBar.height;
  246. self.tableView.height -= self.tabBarController.tabBar.height;
  247. [self.view layoutIfNeeded];
  248. [self.tableView layoutIfNeeded];
  249. }
  250. }else{
  251. if (self.addTableH) {
  252. self.addTableH = NO;
  253. self.removeTableH = NO;
  254. self.tableView.height += self.tabBarController.tabBar.height;
  255. self.view.height += self.tabBarController.tabBar.height;
  256. [self.view layoutIfNeeded];
  257. [self.tableView layoutIfNeeded];
  258. }
  259. }
  260. }
  261. - (void)addRefresh
  262. {
  263. WS(weakSelf);
  264. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  265. [weakSelf headRefresh];
  266. }];
  267. // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  268. // [weakSelf footerRefresh];
  269. // }];
  270. }
  271. - (void)removeRefresh
  272. {
  273. [self.tableView.mj_header endRefreshing];
  274. [self.tableView.mj_header removeFromSuperview];
  275. [self.tableView.mj_footer endRefreshing];
  276. [self.tableView.mj_footer removeFromSuperview];
  277. }
  278. - (void)headRefresh{
  279. self.currentPage = 1;
  280. self.totalRecord = 0;
  281. [self.interLetterArray removeAllObjects];
  282. [self getInterListData];
  283. }
  284. - (void)footerRefresh{
  285. self.currentPage += 1;
  286. if (self.totalRecord == self.interLetterArray.count) {
  287. [self.tableView.mj_footer endRefreshing];
  288. return ;
  289. }
  290. [self getInterListData];
  291. }
  292. - (void)getInterListData{
  293. NSLog(@"%@",@"刷新数据");
  294. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  295. if (self.pageType == PageTypeFromTitleDeleted) {
  296. [self changeBarBtn:YES];
  297. }else{
  298. [self changeBarBtn:NO];
  299. }
  300. [dict setObject:@(self.currentPage) forKey:@"Page"];
  301. [dict setObject:@"99999999" forKey:@"PerPage"];
  302. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  303. [dict setObject:@"" forKey:@"Keyword"];
  304. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  305. WS(weakSelf);
  306. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  307. NSLog(@"站内信返回数据%@",responseObject);
  308. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  309. [weakSelf.tableView.mj_header endRefreshing];
  310. [weakSelf.tableView.mj_footer endRefreshing];
  311. weakSelf.totalRecord = listModel.Total;
  312. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  313. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  314. [weakSelf.tableView.mj_footer resetNoMoreData];
  315. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  316. }
  317. [weakSelf.tableView reloadData];
  318. } failure:^(NSError * _Nonnull error) {
  319. SHOWERROR([ZYCTool handerResultData:error]);
  320. [weakSelf.tableView.mj_header endRefreshing];
  321. [weakSelf.tableView.mj_footer endRefreshing];
  322. }];
  323. }
  324. - (TDInterLeterTypeVC *)tDInterLeterTypeVC{
  325. if (_tDInterLeterTypeVC == nil) {
  326. _tDInterLeterTypeVC = [TDInterLeterTypeVC initTDInterLeterTypeVC];
  327. [_tDInterLeterTypeVC.view setFrame:CGRectMake(0, kNavigationHeight, SCREEN_WIDTH, SCREEN_HEIGHT - kNavigationHeight)];
  328. [_tDInterLeterTypeVC.view setHidden:YES];
  329. _tDInterLeterTypeVC.delegate = self;
  330. }
  331. return _tDInterLeterTypeVC;
  332. }
  333. -(void)userSelectType:(NSString *)typeName{
  334. self.tDInterLeterTypeVC.view.hidden = !self.tDInterLeterTypeVC.view.hidden;
  335. if(self.tDInterLeterTypeVC.view.hidden){
  336. [self.titleBtn dismiss];
  337. }else{
  338. [self.titleBtn show];
  339. }
  340. if(typeName.length > 0){
  341. [self autoSizeBtn:typeName];
  342. if([@"全部" isEqualToString:typeName]){
  343. self.pageType = PageTypeFromTitleAll;
  344. }else if([@"通知" isEqualToString:typeName]){
  345. self.pageType = PageTypeFromTitleNotice;
  346. }else if([@"站内信" isEqualToString:typeName]){
  347. self.pageType = PageTypeFromTitleMail;
  348. }else if([@"匿名信" isEqualToString:typeName]){
  349. self.pageType = PageTypeFromTitleNoSign;
  350. }else if([@"我审批的" isEqualToString:typeName]){
  351. self.pageType = PageTypeFromTitleMeShen;
  352. }else if([@"我发出的" isEqualToString:typeName]){
  353. self.pageType = PageTypeFromTitleMeSend;
  354. }else if([@"抄送我的" isEqualToString:typeName]){
  355. self.pageType = PageTypeFromTitleChao;
  356. }else if([@"草稿箱" isEqualToString:typeName]){
  357. self.pageType = PageTypeFromTitleDraftBox;
  358. }else if([@"已删除" isEqualToString:typeName]){
  359. self.pageType = PageTypeFromTitleDeleted;
  360. }
  361. [self headRefresh];
  362. }
  363. }
  364. #pragma Mark 左滑按钮 iOS8以上
  365. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
  366. NoticeModel *model = self.interLetterArray[indexPath.row];
  367. WS(weakSelf);
  368. if (self.operationStateEnum == OperationStateEnum0) {
  369. switch (model.NoticeStatus) {
  370. case 1:{
  371. switch (model.AttributeValue) {
  372. case 2:{
  373. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  374. [tableView setEditing:NO animated:YES];
  375. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  376. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  377. [tableView reloadData];
  378. }];
  379. [ok setValue:k9 forKey:@"_titleTextColor"];
  380. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  381. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  382. }];
  383. [alertVC addAction:ok];
  384. [alertVC addAction:noOk];
  385. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  386. }];
  387. action1.backgroundColor = RGB(255, 59, 47);
  388. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  389. [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"修改文件夹名称" changeStr:model.FolderName confirm:^(NSString * _Nonnull groupName) {
  390. NSLog(@"%@",groupName);
  391. [weakSelf reNameFind:model withReNameString:groupName];
  392. } cancle:^{
  393. }] show];
  394. }];
  395. action2.backgroundColor = RGB(255, 149, 3);
  396. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  397. [weakSelf topFind:model];
  398. }];
  399. action3.backgroundColor = RGB(197, 201, 204);
  400. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
  401. actions.performsFirstActionWithFullSwipe = NO;
  402. return actions;
  403. }break;
  404. case 3:{
  405. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  406. [weakSelf topFind:model];
  407. }];
  408. action1.backgroundColor = RGB(197, 201, 204);
  409. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
  410. actions.performsFirstActionWithFullSwipe = NO;
  411. return actions;
  412. }break;
  413. default:{
  414. WEAKSELF
  415. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  416. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  417. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  418. [tableView reloadData];
  419. }];
  420. [ok setValue:k9 forKey:@"_titleTextColor"];
  421. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  422. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  423. }];
  424. [alertVC addAction:ok];
  425. [alertVC addAction:noOk];
  426. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  427. }];
  428. action1.backgroundColor = RGB(255, 59, 47);
  429. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  430. STRONGSELF
  431. [strongSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  432. }];
  433. action2.backgroundColor = UIColorHex(0x589AF1);
  434. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  435. STRONGSELF
  436. [strongSelf topFind:model];
  437. }];
  438. action3.backgroundColor = RGB(197, 201, 204);
  439. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
  440. actions.performsFirstActionWithFullSwipe = NO;
  441. return actions;
  442. }
  443. break;
  444. }
  445. }break;
  446. case 0:
  447. {
  448. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"彻底删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  449. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  450. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  451. [tableView reloadData];
  452. }];
  453. [ok setValue:k9 forKey:@"_titleTextColor"];
  454. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  455. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:YES];
  456. }];
  457. [alertVC addAction:ok];
  458. [alertVC addAction:noOk];
  459. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  460. }];
  461. action1.backgroundColor = RGB(255, 59, 47);
  462. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
  463. actions.performsFirstActionWithFullSwipe = NO;
  464. return actions;
  465. }
  466. break;
  467. default:
  468. {
  469. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  470. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  471. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  472. [tableView reloadData];
  473. }];
  474. [ok setValue:k9 forKey:@"_titleTextColor"];
  475. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  476. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  477. }];
  478. [alertVC addAction:ok];
  479. [alertVC addAction:noOk];
  480. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  481. }];
  482. action1.backgroundColor = RGB(255, 59, 47);
  483. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  484. [weakSelf topFind:model];
  485. }];
  486. action2.backgroundColor = RGB(197, 201, 204);
  487. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
  488. actions.performsFirstActionWithFullSwipe = NO;
  489. return actions;
  490. }
  491. break;
  492. }
  493. }
  494. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  495. actions.performsFirstActionWithFullSwipe = NO;
  496. return actions;
  497. }
  498. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  499. return 1;
  500. }
  501. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  502. return self.interLetterArray.count;
  503. }
  504. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  505. // NoticeModel *model = self.interLetterArray[indexPath.row];
  506. // switch (model.AttributeValue) {
  507. // case 1:
  508. // return [ChatMsgNoticeCell configCell2Height];
  509. // case 2:
  510. // return [ChatMsgNoticeCell configCell1Height];
  511. // default:
  512. // return 0;
  513. // }
  514. return UITableViewAutomaticDimension;
  515. }
  516. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  517. WS(weakSelf);
  518. NoticeModel *model = self.interLetterArray[indexPath.row];
  519. switch (self.operationStateEnum) {
  520. case OperationStateEnum0:{
  521. switch (model.AttributeValue) {
  522. case 1:{
  523. switch (model.NoticeStatus) {
  524. case 1:///正常
  525. {
  526. switch (model.TypeValue){
  527. case PageTypeFromTitleMail:
  528. {
  529. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  530. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  531. cell.cell2TitleLabel.text = model.Title;
  532. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  533. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  534. cell.IsTopImgV.hidden = !model.IsTop;
  535. cell.cell2RedBgView.hidden = model.IsRead;
  536. return cell;
  537. }
  538. break;
  539. case PageTypeFromTitleNotice:
  540. {
  541. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  542. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  543. cell.cell2TitleLabel.text = model.Title;
  544. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  545. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  546. cell.cell2RedBgView.hidden = model.IsRead;
  547. cell.IsTopImgV.hidden = !model.IsTop;
  548. return cell;
  549. }
  550. break;
  551. case PageTypeFromTitleMeShen:
  552. {
  553. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  554. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  555. cell.cell2TitleLabel.text = model.Title;
  556. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  557. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  558. cell.cell2RedBgView.hidden = model.IsRead;
  559. cell.IsTopImgV.hidden = !model.IsTop;
  560. return cell;
  561. }
  562. break;
  563. case PageTypeFromTitleMeSend:
  564. {
  565. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  566. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  567. cell.cell2TitleLabel.text = model.Title;
  568. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  569. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  570. cell.cell2RedBgView.hidden = model.IsRead;
  571. cell.IsTopImgV.hidden = !model.IsTop;
  572. return cell;
  573. }
  574. break;
  575. case PageTypeFromTitleChao:
  576. {
  577. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  578. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  579. cell.cell2TitleLabel.text = model.Title;
  580. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  581. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  582. cell.cell2RedBgView.hidden = model.IsRead;
  583. cell.IsTopImgV.hidden = !model.IsTop;
  584. return cell;
  585. }
  586. break;
  587. default:///匿名
  588. {
  589. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  590. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  591. cell.cell2TitleLabel.text = model.Title;
  592. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  593. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  594. cell.cell2RedBgView.hidden = model.IsRead;
  595. cell.IsTopImgV.hidden = !model.IsTop;
  596. return cell;
  597. }
  598. break;
  599. }
  600. }
  601. break;
  602. case 0:///删除
  603. {
  604. switch (model.TypeValue) {
  605. case PageTypeFromTitleMail:{
  606. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  607. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  608. cell.cell2TitleLabel.text = model.Title;
  609. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  610. cell.IsTopImgV.hidden = !model.IsTop;
  611. cell.cell2EditBtn.hidden = NO;
  612. cell.cell2RedBgView.hidden = YES;
  613. cell.cell2TimeLabel.hidden = YES;
  614. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  615. [cell.cell2EditBtn setAction:^{
  616. NSLog(@"恢复已删除站内信");
  617. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  618. }];
  619. return cell;
  620. }
  621. break;
  622. case PageTypeFromTitleNotice:
  623. {
  624. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  625. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  626. cell.cell2TitleLabel.text = model.Title;
  627. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  628. cell.IsTopImgV.hidden = !model.IsTop;
  629. cell.cell2EditBtn.hidden = NO;
  630. cell.cell2RedBgView.hidden = YES;
  631. cell.cell2TimeLabel.hidden = YES;
  632. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  633. [cell.cell2EditBtn setAction:^{
  634. NSLog(@"恢复已删除站内信");
  635. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  636. }];
  637. return cell;
  638. }
  639. break;
  640. case PageTypeFromTitleMeShen:
  641. {
  642. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  643. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  644. cell.cell2TitleLabel.text = model.Title;
  645. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  646. cell.IsTopImgV.hidden = !model.IsTop;
  647. cell.cell2EditBtn.hidden = NO;
  648. cell.cell2RedBgView.hidden = YES;
  649. cell.cell2TimeLabel.hidden = YES;
  650. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  651. [cell.cell2EditBtn setAction:^{
  652. NSLog(@"恢复已删除站内信");
  653. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  654. }];
  655. return cell;
  656. }
  657. break;
  658. case PageTypeFromTitleMeSend:
  659. {
  660. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  661. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  662. cell.cell2TitleLabel.text = model.Title;
  663. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  664. cell.IsTopImgV.hidden = !model.IsTop;
  665. cell.cell2EditBtn.hidden = NO;
  666. cell.cell2RedBgView.hidden = YES;
  667. cell.cell2TimeLabel.hidden = YES;
  668. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  669. [cell.cell2EditBtn setAction:^{
  670. NSLog(@"恢复已删除站内信");
  671. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  672. }];
  673. return cell;
  674. }
  675. break;
  676. case PageTypeFromTitleChao:
  677. {
  678. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  679. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  680. cell.cell2TitleLabel.text = model.Title;
  681. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  682. cell.IsTopImgV.hidden = !model.IsTop;
  683. cell.cell2EditBtn.hidden = NO;
  684. cell.cell2RedBgView.hidden = YES;
  685. cell.cell2TimeLabel.hidden = YES;
  686. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  687. [cell.cell2EditBtn setAction:^{
  688. NSLog(@"恢复已删除站内信");
  689. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  690. }];
  691. return cell;
  692. }
  693. break;
  694. default:///匿名
  695. {
  696. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  697. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  698. cell.cell2TitleLabel.text = model.Title;
  699. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  700. cell.IsTopImgV.hidden = !model.IsTop;
  701. cell.cell2EditBtn.hidden = NO;
  702. cell.cell2RedBgView.hidden = YES;
  703. cell.cell2TimeLabel.hidden = YES;
  704. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  705. [cell.cell2EditBtn setAction:^{
  706. NSLog(@"恢复已删除站内信");
  707. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  708. }];
  709. return cell;
  710. }
  711. break;
  712. }
  713. }
  714. break;
  715. default:
  716. {
  717. switch (model.TypeValue) {
  718. case PageTypeFromTitleMail:{
  719. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  720. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  721. cell.cell2TitleLabel.text = model.Title;
  722. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  723. cell.IsTopImgV.hidden = !model.IsTop;
  724. cell.cell2EditBtn.hidden = NO;
  725. [cell.cell2EditBtn setAction:^{
  726. [weakSelf editorButtonHander:indexPath];
  727. }];
  728. cell.cell2RedBgView.hidden = model.IsRead;
  729. cell.cell2TimeLabel.hidden = YES;
  730. return cell;
  731. }
  732. break;
  733. case PageTypeFromTitleNotice:
  734. {
  735. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  736. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  737. cell.cell2TitleLabel.text = model.Title;
  738. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  739. cell.IsTopImgV.hidden = !model.IsTop;
  740. cell.cell2EditBtn.hidden = NO;
  741. [cell.cell2EditBtn setAction:^{
  742. [weakSelf editorButtonHander:indexPath];
  743. }];
  744. cell.cell2RedBgView.hidden = model.IsRead;
  745. cell.cell2TimeLabel.hidden = YES;
  746. return cell;
  747. }
  748. break;
  749. case PageTypeFromTitleMeShen:
  750. {
  751. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  752. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  753. cell.cell2TitleLabel.text = model.Title;
  754. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  755. cell.IsTopImgV.hidden = !model.IsTop;
  756. cell.cell2EditBtn.hidden = NO;
  757. [cell.cell2EditBtn setAction:^{
  758. [weakSelf editorButtonHander:indexPath];
  759. }];
  760. cell.cell2RedBgView.hidden = model.IsRead;
  761. cell.cell2TimeLabel.hidden = YES;
  762. return cell;
  763. }
  764. break;
  765. case PageTypeFromTitleMeSend:
  766. {
  767. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  768. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  769. cell.cell2TitleLabel.text = model.Title;
  770. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  771. cell.IsTopImgV.hidden = !model.IsTop;
  772. cell.cell2EditBtn.hidden = NO;
  773. [cell.cell2EditBtn setAction:^{
  774. [weakSelf editorButtonHander:indexPath];
  775. }];
  776. cell.cell2RedBgView.hidden = model.IsRead;
  777. cell.cell2TimeLabel.hidden = YES;
  778. return cell;
  779. }
  780. break;
  781. case PageTypeFromTitleChao:
  782. {
  783. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  784. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  785. cell.cell2TitleLabel.text = model.Title;
  786. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  787. cell.IsTopImgV.hidden = !model.IsTop;
  788. cell.cell2EditBtn.hidden = NO;
  789. [cell.cell2EditBtn setAction:^{
  790. [weakSelf editorButtonHander:indexPath];
  791. }];
  792. cell.cell2RedBgView.hidden = model.IsRead;
  793. cell.cell2TimeLabel.hidden = YES;
  794. return cell;
  795. }
  796. break;
  797. default:///匿名
  798. {
  799. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  800. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  801. cell.cell2TitleLabel.text = model.Title;
  802. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  803. cell.IsTopImgV.hidden = !model.IsTop;
  804. cell.cell2EditBtn.hidden = NO;
  805. [cell.cell2EditBtn setAction:^{
  806. [weakSelf editorButtonHander:indexPath];
  807. }];
  808. cell.cell2RedBgView.hidden = model.IsRead;
  809. cell.cell2TimeLabel.hidden = YES;
  810. return cell;
  811. }
  812. break;
  813. }
  814. }
  815. break;
  816. }
  817. }
  818. break;
  819. case 2:{
  820. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell1:tableView indexPath:indexPath];
  821. cell.cell1TitleLabel.text = model.FolderName;
  822. cell.IsTopImgV.hidden = !model.IsTop;
  823. cell.cell1TimeLabel.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
  824. return cell;
  825. }break;
  826. default:{
  827. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  828. return cell;
  829. }
  830. break;
  831. }
  832. }break;
  833. default:{
  834. self.isAllselect = [self checkNoticeArray];
  835. [self setingMoveButton];
  836. [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
  837. switch (model.AttributeValue) {
  838. case 1:{
  839. switch (model.NoticeStatus) {
  840. case 1:///正常
  841. {
  842. switch (model.TypeValue){
  843. case PageTypeFromTitleMail:
  844. {
  845. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  846. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  847. cell.cell2TitleLabel.text = model.Title;
  848. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  849. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  850. cell.IsTopImgV.hidden = !model.IsTop;
  851. cell.cell2TimeLabel.hidden = YES;
  852. cell.cell2RedBgView.hidden = YES;
  853. cell.cell1SelectButton.selected = model.IsSelect;
  854. [cell.cell1SelectButton setAction:^{
  855. model.IsSelect = !model.IsSelect;
  856. [weakSelf sumCount];
  857. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  858. }];
  859. cell.isShow = model.IsTop;
  860. return cell;
  861. }
  862. break;
  863. case PageTypeFromTitleNotice:
  864. {
  865. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  866. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  867. cell.cell2TitleLabel.text = model.Title;
  868. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  869. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  870. cell.cell2RedBgView.hidden = YES;
  871. cell.IsTopImgV.hidden = !model.IsTop;
  872. cell.cell2TimeLabel.hidden = YES;
  873. cell.cell1SelectButton.selected = model.IsSelect;
  874. [cell.cell1SelectButton setAction:^{
  875. model.IsSelect = !model.IsSelect;
  876. [weakSelf sumCount];
  877. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  878. }];
  879. cell.isShow = model.IsTop;
  880. return cell;
  881. }
  882. break;
  883. case PageTypeFromTitleMeShen:
  884. {
  885. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  886. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  887. cell.cell2TitleLabel.text = model.Title;
  888. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  889. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  890. cell.IsTopImgV.hidden = !model.IsTop;
  891. cell.cell2TimeLabel.hidden = YES;
  892. cell.cell2RedBgView.hidden = YES;
  893. cell.cell1SelectButton.selected = model.IsSelect;
  894. [cell.cell1SelectButton setAction:^{
  895. model.IsSelect = !model.IsSelect;
  896. [weakSelf sumCount];
  897. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  898. }];
  899. cell.isShow = model.IsTop;
  900. return cell;
  901. }
  902. break;
  903. case PageTypeFromTitleMeSend:
  904. {
  905. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  906. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  907. cell.cell2TitleLabel.text = model.Title;
  908. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  909. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  910. cell.IsTopImgV.hidden = !model.IsTop;
  911. cell.cell2TimeLabel.hidden = YES;
  912. cell.cell2RedBgView.hidden = YES;
  913. cell.cell1SelectButton.selected = model.IsSelect;
  914. [cell.cell1SelectButton setAction:^{
  915. model.IsSelect = !model.IsSelect;
  916. [weakSelf sumCount];
  917. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  918. }];
  919. cell.isShow = model.IsTop;
  920. return cell;
  921. }
  922. break;
  923. case PageTypeFromTitleChao:
  924. {
  925. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  926. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  927. cell.cell2TitleLabel.text = model.Title;
  928. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  929. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  930. cell.IsTopImgV.hidden = !model.IsTop;
  931. cell.cell2TimeLabel.hidden = YES;
  932. cell.cell2RedBgView.hidden = YES;
  933. cell.cell1SelectButton.selected = model.IsSelect;
  934. [cell.cell1SelectButton setAction:^{
  935. model.IsSelect = !model.IsSelect;
  936. [weakSelf sumCount];
  937. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  938. }];
  939. cell.isShow = model.IsTop;
  940. return cell;
  941. }
  942. break;
  943. default:///匿名
  944. {
  945. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  946. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  947. cell.cell2TitleLabel.text = model.Title;
  948. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  949. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  950. cell.IsTopImgV.hidden = !model.IsTop;
  951. cell.cell2TimeLabel.hidden = YES;
  952. cell.cell2RedBgView.hidden = YES;
  953. cell.cell1SelectButton.selected = model.IsSelect;
  954. [cell.cell1SelectButton setAction:^{
  955. model.IsSelect = !model.IsSelect;
  956. [weakSelf sumCount];
  957. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  958. }];
  959. cell.isShow = model.IsTop;
  960. return cell;
  961. }
  962. break;
  963. }
  964. }
  965. break;
  966. case 0:///删除
  967. {
  968. switch (model.TypeValue) {
  969. case PageTypeFromTitleMail:{
  970. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  971. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  972. cell.cell2TitleLabel.text = model.Title;
  973. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  974. cell.IsTopImgV.hidden = !model.IsTop;
  975. cell.cell2EditBtn.hidden = NO;
  976. cell.cell2RedBgView.hidden = YES;
  977. cell.cell2TimeLabel.hidden = YES;
  978. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  979. [cell.cell2EditBtn setAction:^{
  980. NSLog(@"恢复已删除站内信");
  981. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  982. }];
  983. cell.isShow = model.IsTop;
  984. return cell;
  985. }
  986. break;
  987. case PageTypeFromTitleNotice:
  988. {
  989. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  990. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  991. cell.cell2TitleLabel.text = model.Title;
  992. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  993. cell.IsTopImgV.hidden = !model.IsTop;
  994. cell.cell2EditBtn.hidden = NO;
  995. cell.cell2RedBgView.hidden = YES;
  996. cell.cell2TimeLabel.hidden = YES;
  997. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  998. [cell.cell2EditBtn setAction:^{
  999. NSLog(@"恢复已删除站内信");
  1000. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1001. }];
  1002. cell.isShow = model.IsTop;
  1003. return cell;
  1004. }
  1005. break;
  1006. case PageTypeFromTitleMeShen:
  1007. {
  1008. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1009. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1010. cell.cell2TitleLabel.text = model.Title;
  1011. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1012. cell.IsTopImgV.hidden = !model.IsTop;
  1013. cell.cell2EditBtn.hidden = NO;
  1014. cell.cell2RedBgView.hidden = YES;
  1015. cell.cell2TimeLabel.hidden = YES;
  1016. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1017. [cell.cell2EditBtn setAction:^{
  1018. NSLog(@"恢复已删除站内信");
  1019. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1020. }];
  1021. cell.isShow = model.IsTop;
  1022. return cell;
  1023. }
  1024. break;
  1025. case PageTypeFromTitleMeSend:
  1026. {
  1027. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1028. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1029. cell.cell2TitleLabel.text = model.Title;
  1030. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1031. cell.IsTopImgV.hidden = !model.IsTop;
  1032. cell.cell2EditBtn.hidden = NO;
  1033. cell.cell2RedBgView.hidden = YES;
  1034. cell.cell2TimeLabel.hidden = YES;
  1035. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1036. [cell.cell2EditBtn setAction:^{
  1037. NSLog(@"恢复已删除站内信");
  1038. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1039. }];
  1040. cell.isShow = model.IsTop;
  1041. return cell;
  1042. }
  1043. break;
  1044. case PageTypeFromTitleChao:
  1045. {
  1046. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1047. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1048. cell.cell2TitleLabel.text = model.Title;
  1049. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1050. cell.IsTopImgV.hidden = !model.IsTop;
  1051. cell.cell2EditBtn.hidden = NO;
  1052. cell.cell2RedBgView.hidden = YES;
  1053. cell.cell2TimeLabel.hidden = YES;
  1054. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1055. [cell.cell2EditBtn setAction:^{
  1056. NSLog(@"恢复已删除站内信");
  1057. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1058. }];
  1059. cell.isShow = model.IsTop;
  1060. return cell;
  1061. }
  1062. break;
  1063. default:///匿名
  1064. {
  1065. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1066. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1067. cell.cell2TitleLabel.text = model.Title;
  1068. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1069. cell.IsTopImgV.hidden = !model.IsTop;
  1070. cell.cell2EditBtn.hidden = NO;
  1071. cell.cell2RedBgView.hidden = YES;
  1072. cell.cell2TimeLabel.hidden = YES;
  1073. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1074. [cell.cell2EditBtn setAction:^{
  1075. NSLog(@"恢复已删除站内信");
  1076. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1077. }];
  1078. cell.isShow = model.IsTop;
  1079. return cell;
  1080. }
  1081. break;
  1082. }
  1083. }
  1084. break;
  1085. default:
  1086. {
  1087. switch (model.TypeValue) {
  1088. case PageTypeFromTitleMail:{
  1089. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1090. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1091. cell.cell2TitleLabel.text = model.Title;
  1092. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1093. cell.cell2TimeLabel.hidden = YES;
  1094. cell.cell1TimeLabel.hidden = YES;
  1095. cell.IsTopImgV.hidden = !model.IsTop;
  1096. cell.enterBtn.hidden = YES;
  1097. cell.cell1SelectButton.selected = model.IsSelect;
  1098. [cell.cell1SelectButton setAction:^{
  1099. model.IsSelect = !model.IsSelect;
  1100. [weakSelf sumCount];
  1101. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1102. }];
  1103. cell.isShow = model.IsTop;
  1104. return cell;
  1105. }
  1106. break;
  1107. case PageTypeFromTitleNotice:
  1108. {
  1109. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1110. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  1111. cell.cell2TitleLabel.text = model.Title;
  1112. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1113. cell.cell2TimeLabel.hidden = YES;
  1114. cell.cell1TimeLabel.hidden = YES;
  1115. cell.IsTopImgV.hidden = !model.IsTop;
  1116. cell.enterBtn.hidden = YES;
  1117. cell.cell1SelectButton.selected = model.IsSelect;
  1118. [cell.cell1SelectButton setAction:^{
  1119. model.IsSelect = !model.IsSelect;
  1120. [weakSelf sumCount];
  1121. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1122. }];
  1123. cell.isShow = model.IsTop;
  1124. return cell;
  1125. }
  1126. break;
  1127. case PageTypeFromTitleMeShen:
  1128. {
  1129. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1130. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1131. cell.cell2TitleLabel.text = model.Title;
  1132. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1133. cell.cell2TimeLabel.hidden = YES;
  1134. cell.cell1TimeLabel.hidden = YES;
  1135. cell.IsTopImgV.hidden = !model.IsTop;
  1136. cell.enterBtn.hidden = YES;
  1137. cell.cell1SelectButton.selected = model.IsSelect;
  1138. [cell.cell1SelectButton setAction:^{
  1139. model.IsSelect = !model.IsSelect;
  1140. [weakSelf sumCount];
  1141. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1142. }];
  1143. cell.isShow = model.IsTop;
  1144. return cell;
  1145. }
  1146. break;
  1147. case PageTypeFromTitleMeSend:
  1148. {
  1149. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1150. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1151. cell.cell2TitleLabel.text = model.Title;
  1152. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1153. cell.cell2TimeLabel.hidden = YES;
  1154. cell.cell1TimeLabel.hidden = YES;
  1155. cell.IsTopImgV.hidden = !model.IsTop;
  1156. cell.enterBtn.hidden = YES;
  1157. cell.cell1SelectButton.selected = model.IsSelect;
  1158. [cell.cell1SelectButton setAction:^{
  1159. model.IsSelect = !model.IsSelect;
  1160. [weakSelf sumCount];
  1161. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1162. }];
  1163. cell.isShow = model.IsTop;
  1164. return cell;
  1165. }
  1166. break;
  1167. case PageTypeFromTitleChao:
  1168. {
  1169. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1170. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1171. cell.cell2TitleLabel.text = model.Title;
  1172. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1173. cell.cell2TimeLabel.hidden = YES;
  1174. cell.cell1TimeLabel.hidden = YES;
  1175. cell.IsTopImgV.hidden = !model.IsTop;
  1176. cell.enterBtn.hidden = YES;
  1177. cell.cell1SelectButton.selected = model.IsSelect;
  1178. [cell.cell1SelectButton setAction:^{
  1179. model.IsSelect = !model.IsSelect;
  1180. [weakSelf sumCount];
  1181. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1182. }];
  1183. cell.isShow = model.IsTop;
  1184. return cell;
  1185. }
  1186. break;
  1187. default:///匿名
  1188. {
  1189. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1190. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1191. cell.cell2TitleLabel.text = model.Title;
  1192. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1193. cell.cell2TimeLabel.hidden = YES;
  1194. cell.cell1TimeLabel.hidden = YES;
  1195. cell.IsTopImgV.hidden = !model.IsTop;
  1196. cell.enterBtn.hidden = YES;
  1197. cell.cell1SelectButton.selected = model.IsSelect;
  1198. [cell.cell1SelectButton setAction:^{
  1199. model.IsSelect = !model.IsSelect;
  1200. [weakSelf sumCount];
  1201. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1202. }];
  1203. cell.isShow = model.IsTop;
  1204. return cell;
  1205. }
  1206. break;
  1207. }
  1208. }
  1209. break;
  1210. }
  1211. }
  1212. break;
  1213. default:{
  1214. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell10:tableView indexPath:indexPath];
  1215. cell.cell1TitleLabel.text = model.FolderName;
  1216. cell.cell1TimeLabel.hidden = YES;
  1217. cell.enterBtn.hidden = YES;
  1218. cell.IsTopImgV.hidden = !model.IsTop;
  1219. cell.cell2TimeLabel.hidden = YES;
  1220. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1221. cell.cell1SelectButton.selected = model.IsSelect;
  1222. [cell.cell1SelectButton setAction:^{
  1223. model.IsSelect = !model.IsSelect;
  1224. [weakSelf sumCount];
  1225. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1226. }];
  1227. return cell;
  1228. }break;
  1229. }
  1230. }break;
  1231. }
  1232. }
  1233. - (BOOL)checkNoticeArray
  1234. {
  1235. BOOL isFloder = NO;
  1236. for (NoticeModel * model in self.interLetterArray) {
  1237. if (model.AttributeValue == 2) {
  1238. if (model.IsSelect) {
  1239. SHOWERROR(@"文件夹不能移动");
  1240. isFloder = YES;
  1241. }
  1242. }
  1243. }
  1244. [self.rightMoveBtn setEnabled:!isFloder];
  1245. if(self.interLetterArray.count == 0)
  1246. {
  1247. return NO;
  1248. }else{
  1249. for (NoticeModel * model in self.interLetterArray) {
  1250. if (!model.IsSelect) {
  1251. return NO;
  1252. }
  1253. }
  1254. return YES;
  1255. }
  1256. }
  1257. - (void)setIntroLabelWithModel:(NoticeModel *)model introLabel:(UILabel *)introLabel unreadNumberLabel:(UILabel *)unreadNumberLabel {
  1258. //判断是否匿名
  1259. if (model.IsAdmin) {
  1260. if (model.TypeValue == 18) {
  1261. introLabel.text = @"匿名";
  1262. unreadNumberLabel.text = nil;
  1263. }else{
  1264. if (model.EnjoyUser.length > 10) {
  1265. NSRange range1 = NSMakeRange(10, (model.EnjoyUser.length - 10));
  1266. NSString *resultStr1 = [model.EnjoyUser stringByReplacingCharactersInRange:range1 withString:@"..."];
  1267. introLabel.text = [NSString stringWithFormat:@"收件人:%@",resultStr1];
  1268. }else{
  1269. introLabel.text = [NSString stringWithFormat:@"收件人:%@",model.EnjoyUser];
  1270. }
  1271. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1272. }
  1273. }else {
  1274. if (model.TypeValue == 18) {
  1275. introLabel.text = @"匿名";
  1276. unreadNumberLabel.text = nil;
  1277. }else{
  1278. introLabel.text = [NSString stringWithFormat:@"发件人:%@",model.UserName];
  1279. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1280. }
  1281. }
  1282. }
  1283. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  1284. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  1285. NoticeModel *model = self.interLetterArray[indexPath.row];
  1286. switch (self.operationStateEnum) {
  1287. case OperationStateEnum0:
  1288. {
  1289. switch (model.AttributeValue) {
  1290. case 2:{
  1291. TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
  1292. vc.interLeterFolderId = model.Id;
  1293. vc.interLeterFoldName = model.FolderName;
  1294. [self.navigationController pushViewController:vc animated:YES];
  1295. }break;
  1296. default:{
  1297. if (self.pageType == PageTypeFromTitleDraftBox) {
  1298. [self editorButtonHander:indexPath];
  1299. }else{
  1300. switch (model.TypeValue) {
  1301. case PageTypeFromTitleNoSign:
  1302. {
  1303. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1304. vc.Id = model.MiddleId;
  1305. vc.type = CollectModel_NoSignMail;
  1306. [self.navigationController pushViewController:vc animated:YES];
  1307. }break;
  1308. case PageTypeFromTitleMail:
  1309. {
  1310. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1311. vc.Id = model.MiddleId;
  1312. vc.type = CollectModel_InterMail;
  1313. [self.navigationController pushViewController:vc animated:YES];
  1314. }break;
  1315. case PageTypeFromTitleNotice:
  1316. {
  1317. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1318. vc.Id = model.MiddleId;
  1319. vc.type = CollectModel_Notice;
  1320. [self.navigationController pushViewController:vc animated:YES];
  1321. }break;
  1322. case PageTypeFromTitleMeShen:
  1323. {
  1324. [self pushWorkVCwithModel:model];
  1325. }break;
  1326. case PageTypeFromTitleMeSend:
  1327. {
  1328. [self pushWorkVCwithModel:model];
  1329. }break;
  1330. case PageTypeFromTitleChao:
  1331. {
  1332. [self pushWorkVCwithModel:model];
  1333. }break;
  1334. default:
  1335. {
  1336. // MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1337. // vc.detailType = (model.MissiveType == 1)? InterLeterDetialType_Sign : InterLeterDetialType_NoSign;
  1338. // vc.Id = model.MiddleId;
  1339. // vc.type = CollectModel_InterMail;
  1340. // [self.navigationController pushViewController:vc animated:YES];
  1341. }break;
  1342. }
  1343. }
  1344. }break;
  1345. }
  1346. }break;
  1347. default:{
  1348. model.IsSelect = !model.IsSelect;
  1349. [self sumCount];
  1350. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1351. }break;
  1352. }
  1353. }
  1354. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
  1355. return tableView.editing;
  1356. }
  1357. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
  1358. NoticeModel *model = self.interLetterArray[sourceIndexPath.row];
  1359. NoticeModel *toModel = self.interLetterArray[destinationIndexPath.row];
  1360. WS(weakSelf);
  1361. if (model.AttributeValue == toModel.AttributeValue && model.IsTop && toModel.IsTop) {
  1362. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(model.Id),@"MiddleIdSecond":@(toModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1363. [weakSelf.interLetterArray removeObject:model];
  1364. [weakSelf.interLetterArray insertObject:model atIndex:destinationIndexPath.row];
  1365. dispatch_async(dispatch_get_main_queue(), ^{
  1366. [weakSelf.tableView reloadData];
  1367. });
  1368. } failure:^(NSError * _Nonnull error) {
  1369. }];
  1370. }else{
  1371. [weakSelf.interLetterArray removeObject:model];
  1372. [weakSelf.interLetterArray insertObject:model atIndex:sourceIndexPath.row];
  1373. dispatch_async(dispatch_get_main_queue(), ^{
  1374. [weakSelf.tableView reloadData];
  1375. });
  1376. }
  1377. }
  1378. - (void)sumCount
  1379. {
  1380. NSInteger count = 0;
  1381. for (NoticeModel * smodel in self.interLetterArray) {
  1382. if (smodel.IsSelect) {
  1383. count ++;
  1384. }
  1385. }
  1386. [self.allSelectBtn setImage:count == self.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
  1387. self.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
  1388. }
  1389. #pragma mark - 设置 移动按钮 样式
  1390. - (void)setingMoveButton{
  1391. BOOL flag = NO;
  1392. BOOL use = NO;
  1393. for (NoticeModel *model in self.interLetterArray) {
  1394. if (model.IsSelect) {
  1395. if (model.AttributeValue == 2) {
  1396. flag = YES;
  1397. }else{
  1398. use = YES;
  1399. }
  1400. }
  1401. }
  1402. if (flag) {
  1403. [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
  1404. self.rightMoveBtn.enabled = NO;
  1405. }else{
  1406. if (!use) {
  1407. [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
  1408. self.rightMoveBtn.enabled = NO;
  1409. }else{
  1410. [self.rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
  1411. self.rightMoveBtn.enabled = YES;
  1412. }
  1413. }
  1414. }
  1415. -(NSMutableArray *)getMenuDataSource:(NSMutableArray *)titleArray{
  1416. NSMutableArray *menuDataSourceArray = [[NSMutableArray alloc] init];
  1417. for(int i=0;i<titleArray.count;i++){
  1418. NSString *titleStr = [titleArray objectAtIndex:i];
  1419. WS(weakSelf);
  1420. YCMenuAction *actionMenu = [YCMenuAction actionWithTitle:titleStr image:nil handler:^(YCMenuAction *action) {
  1421. if([@"建文件夹" isEqualToString:action.title]){
  1422. [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"建文件夹" placeholder:@"请输入文件夹名称" confirm:^(NSString * _Nonnull groupName) {
  1423. NSLog(@"%@",groupName);
  1424. [weakSelf addFind:groupName];
  1425. } cancle:^{
  1426. }] show];
  1427. }
  1428. else if ([@"批量编辑" isEqualToString:action.title]){
  1429. [weakSelf changeToOperation:YES];
  1430. }
  1431. }];
  1432. [menuDataSourceArray addObject:actionMenu];
  1433. }
  1434. return menuDataSourceArray;
  1435. }
  1436. -(NSMutableArray *)taskActionArray{
  1437. if(!_taskActionArray){
  1438. if (self.isHome) {
  1439. _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"建文件夹",@"批量编辑", nil];
  1440. }else{
  1441. _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"批量编辑", nil];
  1442. }
  1443. }
  1444. return _taskActionArray;
  1445. }
  1446. - (NSMutableArray<NoticeModel *> *)interLetterArray{
  1447. if (!_interLetterArray) {
  1448. _interLetterArray = [NSMutableArray array];
  1449. }
  1450. return _interLetterArray;
  1451. }
  1452. #pragma mark - 批量编辑
  1453. -(void)initBottomBgView{
  1454. UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1455. [leftCloseBtn setTitle:@"删除" forState:UIControlStateNormal];
  1456. [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
  1457. leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  1458. [self.operationBottomBgView addSubview:leftCloseBtn];
  1459. leftCloseBtn.frame = CGRectMake(0, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
  1460. self.opearateLeftBtn = leftCloseBtn;
  1461. UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1462. [rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
  1463. [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateNormal];
  1464. // [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateDisabled];
  1465. rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  1466. [self.operationBottomBgView addSubview:rightMoveBtn];
  1467. rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
  1468. self.opearateRightBtn = rightMoveBtn;
  1469. UILabel *line = [[UILabel alloc] init];
  1470. line.backgroundColor = RGB(240, 239, 244);
  1471. [self.operationBottomBgView addSubview:line];
  1472. line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.operationBottomBgView.height);
  1473. self.leftCloseBtn = leftCloseBtn;
  1474. self.rightMoveBtn = rightMoveBtn;
  1475. self.LineL = line;
  1476. WS(weakSelf);
  1477. [leftCloseBtn setAction:^{
  1478. NSMutableArray *selectIDArray = [NSMutableArray array];
  1479. for (NoticeModel * model in weakSelf.interLetterArray) {
  1480. if (model.IsSelect) {
  1481. [selectIDArray addObject:model];
  1482. }
  1483. }
  1484. if (selectIDArray.count == 0) {
  1485. SHOWERROR(@"请选择要删除的站内信");
  1486. return ;
  1487. }else{
  1488. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  1489. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1490. }];
  1491. [ok setValue:k9 forKey:@"_titleTextColor"];
  1492. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1493. [weakSelf thoroughDelete:selectIDArray isDelete:NO];
  1494. }];
  1495. [alertVC addAction:ok];
  1496. [alertVC addAction:noOk];
  1497. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1498. }
  1499. }];
  1500. [rightMoveBtn setAction:^{
  1501. NSMutableArray *selectIDArray = [NSMutableArray array];
  1502. for (NoticeModel * model in weakSelf.interLetterArray) {
  1503. if (model.IsSelect) {
  1504. [selectIDArray addObject:@(model.Id)];
  1505. }
  1506. }
  1507. if (selectIDArray.count == 0) {
  1508. SHOWERROR(@"请选择要移动的站内信或者文件夹");
  1509. return ;
  1510. }
  1511. [weakSelf launchMoveVC:selectIDArray];
  1512. }];
  1513. [[UtilsTools getWindow] addSubview:self.operationBottomBgView];
  1514. }
  1515. - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
  1516. MoveViewController * vc = [MoveViewController initMoveViewController];
  1517. vc.TypeId = CreateShouType;
  1518. vc.collectType = CollectHanderType_Move;
  1519. vc.ParentId = 0;
  1520. vc.titleStr = @"移动到";
  1521. vc.FolderIds = selectIDArray;
  1522. [self.navigationController pushViewController:vc animated:YES];
  1523. [self changeToOperation:NO];
  1524. }
  1525. -(UIView *)operationBottomBgView{
  1526. if(!_operationBottomBgView){
  1527. _operationBottomBgView = [[UIView alloc] init];
  1528. CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
  1529. _operationBottomBgView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
  1530. _operationBottomBgView.backgroundColor = RGB(255, 255, 255);
  1531. _operationBottomBgView.hidden = YES;
  1532. }
  1533. return _operationBottomBgView;
  1534. }
  1535. #pragma mark 批量操作与正常操作界面切换
  1536. -(void)changeToOperation:(BOOL)operation{
  1537. WS(weakSelf);
  1538. if(self.pageType == PageTypeFromTitleDeleted){
  1539. [self.rightMoveBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1540. [self.rightMoveBtn setAction:^{
  1541. NSMutableArray *MiddleIds = [NSMutableArray array];
  1542. for (NoticeModel *model in weakSelf.interLetterArray) {
  1543. if (model.IsSelect) {
  1544. [MiddleIds addObject:@(model.Id)];
  1545. }
  1546. }
  1547. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1548. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1549. [dic setValue:@(5) forKey:@"FolderType"];
  1550. [dic setValue:@(1) forKey:@"IsDelete"];
  1551. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1552. SHOWLOADING
  1553. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1554. REMOVESHOW
  1555. [weakSelf headRefresh];
  1556. } failure:^(NSError * _Nonnull error) {
  1557. SHOWERROR([ZYCTool handerResultData:error]);
  1558. }];
  1559. }];
  1560. }else{
  1561. [self.rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
  1562. [self.rightMoveBtn setAction:^{
  1563. NSMutableArray *selectIDArray = [NSMutableArray array];
  1564. for (NoticeModel * model in weakSelf.interLetterArray) {
  1565. if (model.IsSelect) {
  1566. [selectIDArray addObject:@(model.Id)];
  1567. }
  1568. }
  1569. if (selectIDArray.count == 0) {
  1570. SHOWERROR(@"请选择要移动的站内信或者文件夹");
  1571. return ;
  1572. }
  1573. [weakSelf launchMoveVC:selectIDArray];
  1574. }];
  1575. }
  1576. if(operation){
  1577. self.deleteView.hidden = YES;
  1578. self.iSViewEditor = YES;
  1579. self.SearchView.hidden = YES;
  1580. self.HeadHight.constant = 36.f;
  1581. self.rightAddBtn.hidden = YES;
  1582. self.rightEditBtn.hidden = YES;
  1583. self.SortView.hidden = NO;
  1584. //默认操作状态为批量编辑状态
  1585. [self removeRefresh];
  1586. [self.tableView setEditing:YES];
  1587. self.operationStateEnum = OperationStateEnum1;
  1588. self.operationAllSelectButton.hidden = NO;
  1589. [self.operationAllSelectButton setTitleColor:UIColorHex(#0F88EB) forState:UIControlStateNormal];
  1590. [self.operationAllSelectButton setImage:nil forState:UIControlStateNormal];
  1591. WS(weakSelf);
  1592. self.isAllselect = [self checkNoticeArray];
  1593. self.titleLable.text = @"批量编辑";
  1594. self.titleLable.hidden = NO;
  1595. self.titleBtn.hidden = YES;
  1596. [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
  1597. [self.operationAllSelectButton setAction:^{
  1598. for (NoticeModel *model in weakSelf.interLetterArray) {
  1599. model.IsSelect = !weakSelf.isAllselect;
  1600. }
  1601. [weakSelf.allSelectBtn setImage:weakSelf.isAllselect ? IMG(@"sendinfo_no") : IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  1602. weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",weakSelf.isAllselect ? 0 : (long)weakSelf.interLetterArray.count];
  1603. [weakSelf.tableView reloadData];
  1604. }];
  1605. self.operationBottomBgView.hidden = NO;
  1606. if(self.pageType != PageTypeFromTitleDeleted){
  1607. self.tabBarController.tabBar.hidden = YES;
  1608. self.view.height -= self.tabBarController.tabBar.height;
  1609. self.tableView.height -= (self.tabBarController.tabBar.height + 36);
  1610. [self.view layoutIfNeeded];
  1611. [self.tableView layoutIfNeeded];
  1612. }else{
  1613. self.deleteSelectBtn.hidden = YES;
  1614. }
  1615. self.fd_interactivePopDisabled = YES;
  1616. self.tableView.allowsSelectionDuringEditing = YES;
  1617. }else{
  1618. [self addRefresh];
  1619. if(self.pageType == PageTypeFromTitleDeleted){
  1620. self.deleteView.hidden = NO;
  1621. self.rightAddBtn.hidden = YES;
  1622. self.rightEditBtn.hidden = YES;
  1623. self.deleteSelectBtn.hidden = NO;
  1624. }else{
  1625. self.deleteView.hidden = YES;
  1626. self.rightAddBtn.hidden = NO;
  1627. self.rightEditBtn.hidden = NO;
  1628. self.deleteSelectBtn.hidden = YES;
  1629. self.tabBarController.tabBar.hidden = YES;
  1630. self.tableView.height += self.tabBarController.tabBar.height;
  1631. self.view.height += self.tabBarController.tabBar.height;
  1632. [self.view layoutIfNeeded];
  1633. [self.tableView layoutIfNeeded];
  1634. }
  1635. [self.tableView setEditing:NO];
  1636. self.operationBottomBgView.hidden = YES;
  1637. self.iSViewEditor = NO;
  1638. self.HeadHight.constant = 46.f;
  1639. self.SortView.hidden = YES;
  1640. self.SearchView.hidden = NO;
  1641. [self.SortView mas_updateConstraints:^(MASConstraintMaker *make) {
  1642. make.height.mas_offset(0);
  1643. }];
  1644. //默认操作状态为无状态
  1645. self.operationStateEnum = OperationStateEnum0;
  1646. self.operationAllSelectButton.hidden = NO;
  1647. if (self.isHome) {
  1648. self.titleBtn.hidden = NO;
  1649. self.titleLable.hidden = YES;
  1650. }else{
  1651. self.titleLable.hidden = NO;
  1652. self.titleBtn.hidden = YES;
  1653. self.titleLable.text = self.interLeterFoldName;
  1654. }
  1655. [self.operationAllSelectButton setImage:IMG(@"menu_black_icon") forState:UIControlStateNormal];
  1656. [self.operationAllSelectButton setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
  1657. self.fd_interactivePopDisabled = NO;
  1658. }
  1659. [self.tableView reloadData];
  1660. }
  1661. #pragma mark 移动 isEdit:当前是否为编辑状态
  1662. -(void)userDidMove:(BOOL)move isEdit:(BOOL)isEdit{
  1663. //移动
  1664. if(move){
  1665. //默认操作状态为移动状态
  1666. self.operationStateEnum = OperationStateEnum2;
  1667. self.rightAddBtn.hidden = NO;
  1668. [self resetRightBtnAction:NO];
  1669. //隐藏tabBar - 并将TableView至底端
  1670. self.tabBarController.tabBar.hidden = YES;
  1671. self.view.height += self.tabBarController.tabBar.height;
  1672. self.tableView.height += self.tabBarController.tabBar.height;
  1673. [self.view layoutIfNeeded];
  1674. [self.tableView layoutIfNeeded];
  1675. //隐藏operationBottomBgView
  1676. self.operationBottomBgView.hidden = YES;
  1677. }
  1678. else{
  1679. //隐藏tabBar - 并将TableView至底端有tabBar.height的高
  1680. self.tabBarController.tabBar.hidden = YES;
  1681. self.view.height -= self.tabBarController.tabBar.height;
  1682. self.tableView.height -= self.tabBarController.tabBar.height;
  1683. [self.view layoutIfNeeded];
  1684. [self.tableView layoutIfNeeded];
  1685. //显示operationBottomBgView
  1686. self.operationBottomBgView.hidden = NO;
  1687. if(isEdit){
  1688. self.operationStateEnum = OperationStateEnum1;
  1689. self.rightAddBtn.hidden = YES;
  1690. [self resetRightBtnAction:YES];
  1691. }else{
  1692. [self changeToOperation:NO];
  1693. }
  1694. }
  1695. [self.tableView reloadData];
  1696. }
  1697. - (void)reSettingIsSelect{
  1698. for (NoticeModel *model in self.interLetterArray) {
  1699. model.IsSelect = NO;
  1700. }
  1701. }
  1702. -(void)resetRightBtnAction:(BOOL)isShowMenu{
  1703. WS(weakSelf);
  1704. if(isShowMenu){
  1705. [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_add_icon"] forState:UIControlStateNormal];
  1706. [self.rightAddBtn setAction:^{
  1707. NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
  1708. YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
  1709. view.menuColor = RGB(255, 255, 255);
  1710. view.separatorColor = RGB(234, 234, 234);
  1711. view.textColor = RGB(102, 102, 102);
  1712. view.textFont = [UIFont systemFontOfSize:16.0];
  1713. view.menuCellHeight = 43.5;
  1714. view.maxDisplayCount = 10;
  1715. view.offset = -6;
  1716. [view show];
  1717. }];
  1718. }else{
  1719. [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_fileadd_icon"] forState:UIControlStateNormal];
  1720. [self.rightAddBtn setAction:^{
  1721. [ShowtipTool showErrorWithStatus:@"未做"];
  1722. }];
  1723. }
  1724. }
  1725. - (void)backAction:(id)sender{
  1726. [self changeBarBtn:NO];
  1727. self.deleteView.hidden = YES;
  1728. if (self.iSViewEditor) {
  1729. [self headRefresh];
  1730. [self changeSelectStatus];
  1731. [self changeToOperation:NO];
  1732. }else{
  1733. [self.navigationController popViewControllerAnimated:true];
  1734. }
  1735. }
  1736. - (void)changeSelectStatus
  1737. {
  1738. for (NoticeModel * model in self.interLetterArray) {
  1739. model.IsSelect = NO;
  1740. }
  1741. }
  1742. - (void)menuAction:(id)sender{
  1743. switch (self.operationStateEnum) {
  1744. case OperationStateEnum1:
  1745. {
  1746. for (NoticeModel *model in self.interLetterArray) {
  1747. model.IsSelect = !self.isAllselect;
  1748. }
  1749. [self.tableView reloadData];
  1750. [self setingMoveButton];
  1751. }
  1752. break;
  1753. default:
  1754. [super menuAction:sender];
  1755. break;
  1756. }
  1757. }
  1758. #pragma mark - 文件夹操作 创建 | 修改 | 置顶 | 取消置顶 | 删除 | 恢复已删除 | 移动
  1759. /// 创建文件夹
  1760. - (void)addFind:(NSString *)groupname{
  1761. SHOWLOADING
  1762. WEAKSELF
  1763. [[HttpManager sharedHttpManager] PUTUrl:Host(APP_Middle_Add_Folder) parameters:@{@"FolderName":groupname,@"ParentId":@(self.interLeterFolderId),@"TypeId":@(800)} success:^(id _Nonnull responseObject) {
  1764. STRONGSELF
  1765. REMOVESHOW
  1766. [strongSelf headRefresh];
  1767. } failure:^(NSError * _Nonnull error) {
  1768. SHOWERROR([ZYCTool handerResultData:error]);
  1769. }];
  1770. }
  1771. /// 修改文件夹名称
  1772. - (void)reNameFind:(NoticeModel*)findModel withReNameString:(NSString *)renameString{
  1773. SHOWLOADING
  1774. WEAKSELF
  1775. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_ReName) parameters:@{@"FolderName":renameString,@"Id":@(findModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1776. STRONGSELF
  1777. REMOVESHOW
  1778. [strongSelf headRefresh];
  1779. } failure:^(NSError * _Nonnull error) {
  1780. SHOWERROR([ZYCTool handerResultData:error]);
  1781. }];
  1782. }
  1783. /// 文件夹 置顶 和 取消置顶
  1784. - (void)topFind:(NoticeModel*)findModel{
  1785. NSLog(@"文件夹---%@%@",findModel.IsTop ? @"置顶":@"取消置顶",findModel.FolderName);
  1786. SHOWLOADING
  1787. WEAKSELF
  1788. [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  1789. REMOVESHOW
  1790. [weakSelf reCreateTable];
  1791. } failure:^(NSError * _Nonnull error) {
  1792. SHOWERROR([ZYCTool handerResultData:error]);
  1793. }];
  1794. }
  1795. - (void)reCreateTable
  1796. {
  1797. self.currentPage = 1;
  1798. self.totalRecord = 0;
  1799. [self.interLetterArray removeAllObjects];
  1800. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  1801. if (self.pageType == PageTypeFromTitleDeleted) {
  1802. [self changeBarBtn:YES];
  1803. }else{
  1804. [self changeBarBtn:NO];
  1805. }
  1806. // [dict setObject:@(self.currentPage) forKey:@"Page"];
  1807. // [dict setObject:@"99999999" forKey:@"PerPage"];
  1808. // [dict setObject:@(self.pageType) forKey:@"SearchType"];
  1809. // [dict setObject:@"" forKey:@"Keyword"];
  1810. // [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  1811. // WS(weakSelf);
  1812. // [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1813. // NSLog(@"站内信返回数据%@",responseObject);
  1814. // NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  1815. // [weakSelf.tableView.mj_header endRefreshing];
  1816. // [weakSelf.tableView.mj_footer endRefreshing];
  1817. // weakSelf.totalRecord = listModel.Total;
  1818. // [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  1819. // if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  1820. // [weakSelf.tableView.mj_footer resetNoMoreData];
  1821. // [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  1822. // }
  1823. // [weakSelf.tableView reloadData];
  1824. // } failure:^(NSError * _Nonnull error) {
  1825. // SHOWERROR([ZYCTool handerResultData:error]);
  1826. // [weakSelf.tableView.mj_header endRefreshing];
  1827. // [weakSelf.tableView.mj_footer endRefreshing];
  1828. // }];
  1829. [dict setObject:@(self.currentPage) forKey:@"Page"];
  1830. [dict setObject:@"99999999" forKey:@"PerPage"];
  1831. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  1832. [dict setObject:@"" forKey:@"Key"];
  1833. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  1834. WS(weakSelf);
  1835. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1836. NSLog(@"站内信返回数据%@",responseObject);
  1837. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  1838. [weakSelf.tableView.mj_header endRefreshing];
  1839. [weakSelf.tableView.mj_footer endRefreshing];
  1840. weakSelf.totalRecord = listModel.Total;
  1841. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  1842. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  1843. [weakSelf.tableView.mj_footer resetNoMoreData];
  1844. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  1845. }
  1846. dispatch_async(dispatch_get_main_queue(), ^{
  1847. [weakSelf.tableView removeFromSuperview];
  1848. weakSelf.tableView = nil;
  1849. [weakSelf.view addSubview:weakSelf.tableView];
  1850. weakSelf.tableView.delegate = weakSelf;
  1851. weakSelf.tableView.dataSource = weakSelf;
  1852. weakSelf.tableView.backgroundColor = [UIColor clearColor];
  1853. [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  1854. make.left.right.mas_equalTo(weakSelf.view);
  1855. make.top.mas_equalTo(weakSelf.NavBar.mas_bottom);
  1856. if (@available(iOS 11.0, *)) {
  1857. make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
  1858. } else {
  1859. make.bottom.equalTo(weakSelf.view.mas_bottom);
  1860. }
  1861. }];
  1862. [weakSelf.tableView reloadData];
  1863. });
  1864. } failure:^(NSError * _Nonnull error) {
  1865. SHOWERROR([ZYCTool handerResultData:error]);
  1866. [weakSelf.tableView.mj_header endRefreshing];
  1867. [weakSelf.tableView.mj_footer endRefreshing];
  1868. }];
  1869. }
  1870. /// 删除文件夹
  1871. //- (void)deleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
  1872. // NSMutableArray *MiddleIds = [NSMutableArray array];
  1873. //
  1874. // for (NoticeModel *model in findModelArray) {
  1875. // [MiddleIds addObject:@(model.Id)];
  1876. // }
  1877. // NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1878. // [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1879. // [dic setValue:@(5) forKey:@"FolderType"];
  1880. // [dic setValue:@(0) forKey:@"IsDelete"];
  1881. // [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1882. //
  1883. // SHOWLOADING
  1884. // WEAKSELF
  1885. // [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1886. // STRONGSELF
  1887. // REMOVESHOW
  1888. // [strongSelf headRefresh];
  1889. // } failure:^(NSError * _Nonnull error) {
  1890. // SHOWERROR([ZYCTool handerResultData:error]);
  1891. // }];
  1892. //
  1893. //}
  1894. - (void)thoroughDelete:(NSMutableArray<NoticeModel *>*)array isDelete:(BOOL)isDelete
  1895. {
  1896. NSMutableArray * addArray = [NSMutableArray array];
  1897. for (NoticeModel *model in array) {
  1898. [addArray addObject:@(model.Id)];
  1899. }
  1900. NSDictionary * dict = @{@"MiddleIds":addArray,
  1901. @"FolderType":@(800), ///1 通知
  1902. @"IsDelete":@(isDelete)
  1903. };
  1904. WS(weakSelf);
  1905. SHOWLOADING
  1906. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dict responseStyle:DATA success:^(id _Nonnull responseObject) {
  1907. REMOVESHOW
  1908. SHOWSUCCESS(@"删除成功");
  1909. [weakSelf.interLetterArray removeObjectsInArray:array];
  1910. dispatch_async(dispatch_get_main_queue(), ^{
  1911. [weakSelf.tableView reloadData];
  1912. });
  1913. } failure:^(NSError * _Nonnull error) {
  1914. REMOVESHOW
  1915. }];
  1916. }
  1917. /// 恢复文件夹
  1918. - (void)reDoDeleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
  1919. NSMutableArray *MiddleIds = [NSMutableArray array];
  1920. for (NoticeModel *model in findModelArray) {
  1921. [MiddleIds addObject:@(model.Id)];
  1922. }
  1923. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1924. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1925. [dic setValue:@(5) forKey:@"FolderType"];
  1926. [dic setValue:@(0) forKey:@"IsDelete"];
  1927. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1928. SHOWLOADING
  1929. WEAKSELF
  1930. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1931. STRONGSELF
  1932. REMOVESHOW
  1933. [strongSelf headRefresh];
  1934. } failure:^(NSError * _Nonnull error) {
  1935. SHOWERROR([ZYCTool handerResultData:error]);
  1936. }];
  1937. }
  1938. /// 移动文件夹
  1939. - (void)moveFind:(NSMutableArray<NoticeModel *>*)findModelArray withSuperModel:(NoticeModel *)supermodel{
  1940. NSMutableArray *MiddleIds = [NSMutableArray array];
  1941. for (NoticeModel *model in findModelArray) {
  1942. [MiddleIds addObject:@(model.Id)];
  1943. }
  1944. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1945. [dic setValue:MiddleIds forKey:@"Ids"];
  1946. [dic setValue:@(0) forKey:@"ParentId"];
  1947. SHOWLOADING
  1948. WEAKSELF
  1949. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Move) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1950. STRONGSELF
  1951. REMOVESHOW
  1952. [strongSelf headRefresh];
  1953. } failure:^(NSError * _Nonnull error) {
  1954. SHOWERROR([ZYCTool handerResultData:error]);
  1955. }];
  1956. }
  1957. - (void)editorButtonHander:(NSIndexPath *)indexpath{
  1958. WS(weakSelf);
  1959. NoticeModel *model = self.interLetterArray[indexpath.row];
  1960. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1961. vc.type = CollectModel_InterMail;
  1962. vc.isEdit = YES;
  1963. vc.replayType = MailReplayEdit;
  1964. vc.Id = model.MiddleId;
  1965. vc.isFromDraft = (model.SourceId == 0 ? YES : NO);
  1966. vc.MailType = model.TypeValue;
  1967. vc.upDateBlock = ^{
  1968. [weakSelf headRefresh];
  1969. };
  1970. [self.navigationController pushViewController:vc animated:YES];
  1971. }
  1972. - (void)pushWorkVCwithModel:(NoticeModel *)model
  1973. {
  1974. WS(weakSelf);
  1975. MyApprovalPageDetail *myApprovalPageDetail = [[MyApprovalPageDetail alloc] init];
  1976. [myApprovalPageDetail setActionSussBlock:^{
  1977. [weakSelf headRefresh];
  1978. }];
  1979. switch (model.TypeValue) {
  1980. case PageTypeFromTitleMeShen:
  1981. {
  1982. myApprovalPageDetail.pageType = Type_ONEA;
  1983. }
  1984. break;
  1985. case PageTypeFromTitleMeSend:
  1986. {
  1987. myApprovalPageDetail.pageType = Type_ONEB;
  1988. }
  1989. break;
  1990. default:
  1991. {
  1992. myApprovalPageDetail.pageType = Type_ONEC;
  1993. }
  1994. break;
  1995. }
  1996. myApprovalPageDetail.Stats = model.FlowState;
  1997. myApprovalPageDetail.userId = model.UserId;
  1998. myApprovalPageDetail.indexId = model.MiddleId;
  1999. myApprovalPageDetail.TodoId = model.TodoId;
  2000. myApprovalPageDetail.title = model.Title;
  2001. [self.navigationController pushViewController:myApprovalPageDetail animated:YES];
  2002. }
  2003. - (void)setShenIcon:(NoticeModel *)model withCellImgV:(UIImageView *)imagV
  2004. {
  2005. if (model.IsRecall) {
  2006. imagV.image = IMG(@"shenpi_reCall");
  2007. }else{
  2008. if ([model.FlowState isEqualToString:@"Checking"]) {
  2009. imagV.image = IMG(@"审批");
  2010. }else{
  2011. imagV.image = IMG(@"shenpi_icon");
  2012. }
  2013. }
  2014. }
  2015. - (UIButton *)allSelectBtn
  2016. {
  2017. if (!_allSelectBtn) {
  2018. _allSelectBtn = [UIButton new];
  2019. _allSelectBtn.hidden = YES;
  2020. [_allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  2021. }
  2022. return _allSelectBtn;
  2023. }
  2024. - (UILabel *)selectCountL
  2025. {
  2026. if (!_selectCountL) {
  2027. _selectCountL = [UILabel new];
  2028. _selectCountL.font = Kfont(13);
  2029. _selectCountL.text = @"0";
  2030. _selectCountL.hidden = YES;
  2031. _selectCountL.textColor = UIColorHex(0x0F88EB);
  2032. }
  2033. return _selectCountL;
  2034. }
  2035. - (UIView *)SortView
  2036. {
  2037. if (!_SortView) {
  2038. _SortView = [UIView new];
  2039. _SortView.backgroundColor = UIColorHex(0xF0EFF4);
  2040. _SortView.hidden = YES;
  2041. }
  2042. return _SortView;
  2043. }
  2044. - (void)addSortV
  2045. {
  2046. [self.HeadView addSubview:self.SortView];
  2047. [self.SortView mas_makeConstraints:^(MASConstraintMaker *make) {
  2048. make.edges.mas_offset(UIEdgeInsetsZero);
  2049. }];
  2050. [self.SortView addSubview:self.allSelectBtn];
  2051. // [self.SortView addSubview:self.selectCountL];
  2052. [self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  2053. make.left.mas_offset(5);
  2054. make.centerY.mas_equalTo(self.SortView);
  2055. make.size.mas_offset(CGSizeMake(36, 36));
  2056. }];
  2057. // UILabel * leftL = [UILabel new];
  2058. // leftL.text = @"已选:";
  2059. // leftL.textColor = UIColorHex(0x666666);
  2060. // leftL.font = Kfont(13);
  2061. // [self.SortView addSubview:leftL];
  2062. // [leftL mas_makeConstraints:^(MASConstraintMaker *make) {
  2063. // make.left.mas_equalTo(self.allSelectBtn.mas_right).offset(5);
  2064. // make.centerY.mas_equalTo(self.SortView);
  2065. // }];
  2066. // [self.selectCountL mas_makeConstraints:^(MASConstraintMaker *make) {
  2067. // make.left.mas_equalTo(leftL.mas_right).offset(8);
  2068. // make.centerY.mas_equalTo(self.SortView);
  2069. // }];
  2070. UILabel * rightL = [UILabel new];
  2071. rightL.text = @"长按右侧三横,拖动可进行排序";
  2072. rightL.textColor = UIColorHex(0x666666);
  2073. rightL.font = Kfont(13);
  2074. [self.SortView addSubview:rightL];
  2075. [rightL mas_makeConstraints:^(MASConstraintMaker *make) {
  2076. // make.left.mas_equalTo(self.selectCountL.mas_right).offset(5);
  2077. // make.centerY.mas_equalTo(self.SortView);
  2078. make.center.mas_equalTo(self.SortView);
  2079. }];
  2080. WS(weakSelf);
  2081. [self.allSelectBtn setAction:^{
  2082. for (NoticeModel *model in weakSelf.interLetterArray) {
  2083. model.IsSelect = !weakSelf.isAllselect;
  2084. if (model.IsSelect && model.AttributeValue == 2) {
  2085. SHOWERROR(@"文件夹不能移动");
  2086. }
  2087. }
  2088. NSInteger count = 0;
  2089. for (NoticeModel * smodel in weakSelf.interLetterArray) {
  2090. if (smodel.IsSelect) {
  2091. count ++;
  2092. }
  2093. }
  2094. [weakSelf.allSelectBtn setImage:count == weakSelf.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
  2095. weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
  2096. dispatch_async(dispatch_get_main_queue(), ^{
  2097. [weakSelf.tableView reloadData];
  2098. });
  2099. }];
  2100. }
  2101. - (void)viewDidDisappear:(BOOL)animated
  2102. {
  2103. [super viewDidDisappear:animated];
  2104. [self changeBarBtn:NO];
  2105. self.deleteView.hidden = YES;
  2106. self.operationBottomBgView.hidden = YES;
  2107. }
  2108. @end