TDInterLeterHomeViewController.m 135 KB

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