TDInterLeterDetailVC.m 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. //
  2. // TDInterLeterDetailVC.m
  3. // smartRhino
  4. //
  5. // Created by taidi on 2019/12/26.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "TDInterLeterDetailVC.h"
  9. #import "NoteBookDetailCell.h"
  10. #import "CreateInterLeterVC.h"
  11. #import "MailListDetailVC.h"
  12. #import "NoticeUnreadVC.h"
  13. #import "MoveViewController.h"
  14. #import "NSDate+Extension.h"
  15. #import "CreateInterLeterVC.h"
  16. #import "NoteBookShareVC.h"
  17. #import "MyTDGroupViewController.h"
  18. #import "MyTDTopicCreateVC.h"
  19. #import "MoveViewController.h"
  20. @interface TDInterLeterDetailVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  21. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  22. @property (strong,nonatomic) NSMutableArray <InterLeterDetailSubModel *>* interLetterArray;
  23. @property (nonatomic,strong) NSMutableArray <MyNoteBookCommentSubModel*>*commentArray;
  24. @property (nonatomic,assign) BOOL isFresh;
  25. @property (nonatomic,assign) NSUInteger currentPage;
  26. @property (nonatomic,assign) NSUInteger totalRecord;
  27. @property (weak, nonatomic) IBOutlet UIButton *commentButton;
  28. //@property (weak, nonatomic) IBOutlet UILabel *commentNumberLabel;
  29. @property (weak, nonatomic) IBOutlet UIButton *zanButton;
  30. @property (weak, nonatomic) IBOutlet UILabel *zanNumberLabel;
  31. @property (weak, nonatomic) IBOutlet UIButton *collectButton;
  32. @property (weak, nonatomic) IBOutlet UILabel *collectNumberLabel;
  33. @property (weak, nonatomic) IBOutlet UIButton *shareButton;
  34. @property (weak, nonatomic) IBOutlet UILabel *shareNumberLabel;
  35. @property (weak, nonatomic) IBOutlet UIImageView *zanImageView;
  36. @property (weak, nonatomic) IBOutlet UIImageView *collectImageView;
  37. @property (weak, nonatomic) IBOutlet UIImageView *shareImageView;
  38. @property (strong,nonatomic) InterLeterDetailSubModel * currentDetailModel;
  39. @property (strong,nonatomic) InterLeterDetailModel * detailModel;
  40. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  41. @property (copy, nonatomic) NSString *replayTitle;
  42. @property (nonatomic,assign) BOOL labelShow;
  43. @end
  44. @implementation TDInterLeterDetailVC
  45. - (void)viewWillAppear:(BOOL)animated
  46. {
  47. [super viewWillAppear:animated];
  48. [self getData];
  49. }
  50. +(TDInterLeterDetailVC *)initTDInterLeterDetailVC{
  51. TDInterLeterDetailVC *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterDetailVC"];
  52. return controller;
  53. }
  54. - (void)viewDidLoad {
  55. [super viewDidLoad];
  56. self.fd_prefersNavigationBarHidden = YES;
  57. self.view.backgroundColor = RGB(255, 255, 255);
  58. if (@available(iOS 11.0, *)) {
  59. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  60. } else {
  61. self.automaticallyAdjustsScrollViewInsets = NO;
  62. }
  63. WS(weakSelf);
  64. [self.collectButton setAction:^{
  65. [weakSelf gotoCollectHander];
  66. }];
  67. [self.shareButton setAction:^{
  68. [weakSelf shareHander];
  69. }];
  70. [self.zanButton setAction:^{
  71. [weakSelf gotoZanHander];
  72. }];
  73. [self.commentButton setAction:^{
  74. [weakSelf commentHander];
  75. }];
  76. }
  77. - (void)getData{
  78. switch (self.detailType) {
  79. case InterLeterDetialType_Sign:
  80. break;
  81. case InterLeterDetialType_NoSign:
  82. break;
  83. default:
  84. break;
  85. }
  86. SHOWLOADING;
  87. WS(weakSelf);
  88. [self.interLetterArray removeAllObjects];
  89. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_InterLetterDetail),(long)self.interLeterID] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  90. weakSelf.detailModel = [[InterLeterDetailModel alloc]initWithDictionary:responseObject error:nil];
  91. REMOVESHOW
  92. NSLog(@"%@",responseObject);
  93. [weakSelf.interLetterArray addObjectsFromArray:weakSelf.detailModel.Items];
  94. InterLeterDetailSubModel *mymodel = weakSelf.detailModel.Items.firstObject;
  95. weakSelf.currentDetailModel = mymodel;
  96. if(mymodel.IsCollect){
  97. weakSelf.collectImageView.image = IMG(@"icon_collect_off");
  98. }else{
  99. weakSelf.collectImageView.image = IMG(@"收藏五角星");
  100. }
  101. if (mymodel.IsPraise) {
  102. weakSelf.zanImageView.image = IMG(@"zan_yes");
  103. }else{
  104. weakSelf.zanImageView.image = IMG(@"zan_no");
  105. }
  106. dispatch_async(dispatch_get_main_queue(), ^{
  107. weakSelf.collectButton.selected = mymodel.IsCollect;
  108. weakSelf.zanButton.selected = mymodel.IsPraise;
  109. weakSelf.shareButton.selected = YES;
  110. weakSelf.zanNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)mymodel.PraiseCount];
  111. weakSelf.zanNumberLabel.textColor = !mymodel.IsPraise ? UIColorHex(#999999) : UIColorHex(#0F8AE3);
  112. weakSelf.collectNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)mymodel.CollectCount];
  113. weakSelf.collectNumberLabel.textColor = !mymodel.IsCollect ? UIColorHex(#999999) : UIColorHex(#0F8AE3);
  114. weakSelf.shareNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)mymodel.RetransmissionCount];
  115. weakSelf.zanNumberLabel.hidden = mymodel.PraiseCount == 0 ? YES : NO;
  116. weakSelf.collectNumberLabel.hidden = mymodel.CollectCount == 0 ? YES : NO;
  117. weakSelf.shareNumberLabel.hidden = mymodel.RetransmissionCount == 0 ? YES : NO;
  118. weakSelf.shareNumberLabel.textColor = UIColorHex(#0F8AE3);
  119. [weakSelf.tableView reloadData];
  120. });
  121. } failure:^(NSError * _Nonnull error) {
  122. SHOWERROR([ZYCTool handerResultData:error]);
  123. }];
  124. [self.view addSubview:self.noteBookShareVC.view];
  125. }
  126. - (NSMutableArray<InterLeterDetailSubModel *> *)interLetterArray{
  127. if (!_interLetterArray) {
  128. _interLetterArray = [NSMutableArray new];
  129. }
  130. return _interLetterArray;
  131. }
  132. - (NSMutableArray<MyNoteBookCommentSubModel *> *)commentArray{
  133. if (!_commentArray) {
  134. _commentArray = [NSMutableArray new];
  135. }
  136. return _commentArray;
  137. }
  138. - (void)getComment{
  139. }
  140. #pragma mark - tableview 代理
  141. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  142. return self.interLetterArray.count;
  143. }
  144. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  145. InterLeterDetailSubModel *model = self.interLetterArray[section];
  146. switch (self.detailType) {
  147. case InterLeterDetialType_Sign:{
  148. return model.Data.count + 1;
  149. }break;
  150. case InterLeterDetialType_NoSign:{
  151. return model.Data.count + 1;
  152. }break;
  153. case InterLeterDetialType_Replay:{
  154. switch (section) {
  155. case 0:{ // 最后一次回复
  156. return model.Data.count + 1;
  157. }break;
  158. default:{// 往次回复
  159. return model.Data.count + 2;
  160. }break;
  161. }
  162. }break;
  163. default:
  164. {
  165. return model.Data.count + 1;
  166. }break;
  167. }
  168. }
  169. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  170. WS(weakSelf);
  171. InterLeterDetailSubModel * model = self.interLetterArray[indexPath.section];
  172. switch (self.detailType) {
  173. case InterLeterDetialType_Replay :{
  174. switch (indexPath.section) {
  175. case 0:{ // 最后一次回复
  176. switch (indexPath.row) {
  177. case 0:{
  178. NoteBookDetailCell *cell = [NoteBookDetailCell configCell6:tableView indexPath:indexPath];
  179. cell.cellArticleTitleLabel.text = model.Title;
  180. self.replayTitle = model.Title;
  181. if(model.AddresseeUsers.count == 0){
  182. cell.cellArticleAuthor2Label.attributedText = [[NSAttributedString alloc] initWithString:@"收件人:--"];
  183. }else{
  184. NSMutableArray * userArray = [[NSMutableArray alloc] init];
  185. for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
  186. [userArray addObject:userModel.Name];
  187. }
  188. NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
  189. [cell layoutIfNeeded];
  190. [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
  191. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  192. weakSelf.labelShow = !weakSelf.labelShow;
  193. [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  194. }];
  195. [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
  196. cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
  197. }
  198. cell.cellArticleAuthorLabel.text = [NSString stringWithFormat:@"发件人:%@",model.UserName];
  199. cell.cellArticleTimeLabel.numberOfLines = 1;
  200. cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
  201. cell.cellArticleReadNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ReadCount];
  202. cell.cellArticleAllReadNumberLabel.text = [NSString stringWithFormat:@"/%ld",(long)model.AllCount];
  203. [cell.checkReadButton setAction:^{
  204. [weakSelf checkRead];
  205. }];
  206. [cell.checkPeopleButton setAction:^{
  207. [weakSelf checkReadUserId:model.UserId];
  208. }];
  209. cell.cellArticleEditorButton.hidden = YES;
  210. cell.cellArticleDeleteButton.hidden = YES;
  211. return cell;
  212. }break;
  213. default:{
  214. InterLeterDetailDataModel *dataModel = model.Data[indexPath.row - 1];
  215. switch (dataModel.Type) {
  216. case CollectDataType_Text:{
  217. NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
  218. cell.cell0ImgTitleLab.text = dataModel.Text;
  219. return cell;
  220. }break;
  221. case CollectDataType_IMG:{
  222. NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
  223. [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  224. [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  225. }];
  226. return cell;
  227. }break;
  228. case CollectDataType_File:{
  229. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  230. NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
  231. if (imageName.length > 0) {
  232. cell.cell1IconImageView.image = IMG(imageName);
  233. }else{
  234. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
  235. }
  236. cell.cell1TitleLabel.text = dataModel.FileName;
  237. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@",dataModel.Author] KeyString:dataModel.Author];
  238. return cell;
  239. }break;
  240. case CollectDataType_Article:{
  241. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  242. cell.cell1IconImageView.image = IMG(@"文章");
  243. cell.cell1TitleLabel.text = dataModel.FileName;
  244. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的文章",dataModel.Author] KeyString:dataModel.Author];
  245. return cell;
  246. }break;
  247. case CollectDataType_Notice:{
  248. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  249. cell.cell1IconImageView.image = IMG(@"通知图标");
  250. cell.cell1TitleLabel.text = dataModel.Title;
  251. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的通知",dataModel.Author] KeyString:dataModel.Author];
  252. return cell;
  253. }break;
  254. case CollectDataType_Topic:{
  255. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  256. cell.cell1IconImageView.image = IMG(@"话题");
  257. cell.cell1TitleLabel.text = dataModel.Title;
  258. cell.cell1Authorlabel.text = dataModel.Author;
  259. return cell;
  260. }break;
  261. case CollectDataType_Note:{
  262. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  263. cell.cell1IconImageView.image = IMG(@"noteBook_icon");
  264. cell.cell1TitleLabel.text = dataModel.Title;
  265. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
  266. return cell;
  267. }break;
  268. case CollectDataType_Collect:{
  269. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  270. cell.cell1IconImageView.image = IMG(@"收藏");
  271. cell.cell1TitleLabel.text = dataModel.Title;
  272. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  273. return cell;
  274. }break;
  275. case CollectDataType_NoteFile:{
  276. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  277. cell.cell1IconImageView.image = IMG(@"find_1");
  278. cell.cell1TitleLabel.text = dataModel.Title;
  279. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记文件夹",dataModel.Author] KeyString:dataModel.Author];
  280. return cell;
  281. }break;
  282. case CollectDataType_CollectFile:{
  283. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  284. cell.cell1IconImageView.image = IMG(@"find_1");
  285. cell.cell1TitleLabel.text = dataModel.Title;
  286. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏文件夹",dataModel.Author] KeyString:dataModel.Author];
  287. return cell;
  288. }break;
  289. case CollectDataType_InterMail:{
  290. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  291. cell.cell1IconImageView.image = IMG(@"站内信图");
  292. cell.cell1TitleLabel.text = dataModel.Title;
  293. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  294. return cell;
  295. }break;
  296. case CollectDataType_Group:{
  297. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  298. cell.cell1IconImageView.image = IMG(@"笔记小组");
  299. cell.cell1TitleLabel.text = dataModel.Title;
  300. cell.cell1Authorlabel.text = dataModel.Author;
  301. return cell;
  302. }break;
  303. case CollectDataType_Approval:{
  304. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  305. cell.cell1IconImageView.image = IMG(@"审批");
  306. cell.cell1TitleLabel.text = dataModel.Title;
  307. cell.cell1Authorlabel.text = dataModel.Author;
  308. return cell;
  309. }break;
  310. default:{
  311. NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
  312. return cell;
  313. }break;
  314. }
  315. }break;
  316. }
  317. }break;
  318. default:{// 往次回复
  319. switch (indexPath.row) {
  320. case 0:{
  321. NoteBookDetailCell *cell = [NoteBookDetailCell configCell8:tableView indexPath:indexPath];
  322. return cell;
  323. }
  324. case 1:{
  325. NoteBookDetailCell *cell = [NoteBookDetailCell configCell6:tableView indexPath:indexPath];
  326. cell.cellArticleTitleLabel.text = model.Title;
  327. if(model.AddresseeUsers.count == 0){
  328. cell.cellArticleAuthorLabel.text = @"--";
  329. }else{
  330. NSMutableArray * userArray = [[NSMutableArray alloc] init];
  331. for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
  332. [userArray addObject:userModel.Name];
  333. }
  334. NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
  335. [cell layoutIfNeeded];
  336. [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
  337. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  338. weakSelf.labelShow = !weakSelf.labelShow;
  339. [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  340. }];
  341. [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
  342. cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
  343. }
  344. cell.cellArticleAuthorLabel.textColor = UIColorHex(999999);
  345. cell.cellArticleReadNumberLabel.textColor = UIColorHex(999999);
  346. cell.cellArticleAuthorLabel.text = model.UserName;
  347. cell.cellArticleTimeLabel.numberOfLines = 1;
  348. cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
  349. cell.cellArticleReadNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ReadCount];
  350. cell.cellArticleAllReadNumberLabel.text = [NSString stringWithFormat:@"/%ld",(long)model.AllCount];
  351. [cell.cellArticleDeleteButton setTitle:@"撤回" forState:UIControlStateNormal];
  352. WS(weakSelf);
  353. [cell.checkReadButton setAction:^{
  354. [weakSelf checkRead];
  355. }];
  356. [cell.checkPeopleButton setAction:^{
  357. [weakSelf checkReadUserId:model.UserId];
  358. }];
  359. if (model.IsAdmin) {
  360. cell.cellArticleEditorButton.hidden = NO;
  361. cell.cellArticleDeleteButton.hidden = NO;
  362. }else{
  363. cell.cellArticleEditorButton.hidden = YES;
  364. cell.cellArticleDeleteButton.hidden = YES;
  365. }
  366. [cell.cellArticleDeleteButton setAction:^{
  367. [weakSelf deleteButtonHander:model.Id];
  368. }];
  369. [cell.cellArticleEditorButton setAction:^{
  370. [weakSelf editorButtonHander:model.Id];
  371. }];
  372. return cell;
  373. }break;
  374. default:{
  375. InterLeterDetailDataModel *dataModel = model.Data[indexPath.row-2];
  376. switch (dataModel.Type) {
  377. case CollectDataType_Text:{
  378. NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
  379. cell.cell0ImgTitleLab.text = dataModel.Text;
  380. return cell;
  381. }break;
  382. case CollectDataType_IMG:{
  383. NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
  384. [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  385. [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  386. }];
  387. return cell;
  388. }break;
  389. case CollectDataType_File:{
  390. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  391. NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
  392. if (imageName.length > 0) {
  393. cell.cell1IconImageView.image = IMG(imageName);
  394. }else{
  395. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
  396. }
  397. cell.cell1TitleLabel.text = dataModel.FileName;
  398. cell.cell1Authorlabel.text = dataModel.Author;
  399. return cell;
  400. }break;
  401. case CollectDataType_Article:{
  402. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  403. switch (dataModel.ArticleImgUrl.count) {
  404. case 0:{
  405. cell.cell1IconImageView.image = IMG(@"icon_myPaper");
  406. }break;
  407. default:{
  408. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.ArticleImgUrl.firstObject] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {}];
  409. }break;
  410. }
  411. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  412. }];
  413. cell.cell1TitleLabel.text = dataModel.FileName;
  414. cell.cell1Authorlabel.text = dataModel.Author;
  415. return cell;
  416. }break;
  417. case CollectDataType_Notice:{
  418. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  419. cell.cell1IconImageView.image = IMG(@"通知图标");
  420. cell.cell1TitleLabel.text = dataModel.Title;
  421. cell.cell1Authorlabel.text = dataModel.Author;
  422. return cell;
  423. }break;
  424. case CollectDataType_Topic:{
  425. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  426. cell.cell1IconImageView.image = IMG(@"话题");
  427. cell.cell1TitleLabel.text = dataModel.Title;
  428. cell.cell1Authorlabel.text = dataModel.Author;
  429. return cell;
  430. }break;
  431. case CollectDataType_Note:{
  432. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  433. cell.cell1IconImageView.image = IMG(@"noteBook_icon");
  434. cell.cell1TitleLabel.text = dataModel.Title;
  435. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
  436. return cell;
  437. }break;
  438. case CollectDataType_Collect:{
  439. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  440. cell.cell1IconImageView.image = IMG(@"收藏");
  441. cell.cell1TitleLabel.text = dataModel.Title;
  442. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  443. return cell;
  444. }break;
  445. case CollectDataType_InterMail:{
  446. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  447. cell.cell1IconImageView.image = IMG(@"站内信图");
  448. cell.cell1TitleLabel.text = dataModel.Title;
  449. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  450. return cell;
  451. }break;
  452. case CollectDataType_Group:{
  453. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  454. cell.cell1IconImageView.image = IMG(@"笔记小组");
  455. cell.cell1TitleLabel.text = dataModel.Title;
  456. cell.cell1Authorlabel.text = dataModel.Author;
  457. return cell;
  458. }break;
  459. case CollectDataType_Approval:{
  460. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  461. cell.cell1IconImageView.image = IMG(@"审批");
  462. cell.cell1TitleLabel.text = dataModel.Title;
  463. cell.cell1Authorlabel.text = dataModel.Author;
  464. return cell;
  465. }break;
  466. default:{
  467. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  468. cell.cell1IconImageView.image = IMG(@"笔记群聊");
  469. cell.cell1TitleLabel.text = dataModel.Title;
  470. cell.cell1Authorlabel.text = dataModel.Author;
  471. return cell;
  472. }break;
  473. }
  474. }break;
  475. }
  476. }break;
  477. }
  478. }break;
  479. case InterLeterDetialType_Sign :{
  480. InterLeterDetailSubModel * model = self.interLetterArray[indexPath.section];
  481. switch (indexPath.row) {
  482. case 0:
  483. {
  484. NoteBookDetailCell *cell = [NoteBookDetailCell configCell6:tableView indexPath:indexPath];
  485. cell.cellArticleTitleLabel.text = model.Title;
  486. self.replayTitle = model.Title;
  487. if(model.AddresseeUsers.count == 0){
  488. cell.cellArticleAuthor2Label.attributedText = [[NSAttributedString alloc] initWithString:@"收件人:--"];
  489. }else{
  490. NSMutableArray * userArray = [[NSMutableArray alloc] init];
  491. for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
  492. [userArray addObject:userModel.Name];
  493. }
  494. NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
  495. [cell layoutIfNeeded];
  496. [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
  497. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  498. weakSelf.labelShow = !weakSelf.labelShow;
  499. [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  500. }];
  501. [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
  502. cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
  503. }
  504. cell.cellArticleAuthorLabel.text = [NSString stringWithFormat:@"%@",model.UserName];
  505. cell.cellArticleTimeLabel.numberOfLines = 1;
  506. cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
  507. cell.cellArticleReadNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ReadCount];
  508. cell.cellArticleAllReadNumberLabel.text = [NSString stringWithFormat:@"/%ld",(long)model.AllCount];
  509. [cell.cellArticleDeleteButton setTitle:@"撤回" forState:UIControlStateNormal];
  510. WS(weakSelf);
  511. [cell.checkReadButton setAction:^{
  512. [weakSelf checkRead];
  513. }];
  514. [cell.checkPeopleButton setAction:^{
  515. [weakSelf checkReadUserId:model.UserId];
  516. }];
  517. if (model.IsRecall) {
  518. cell.cellArticleDeleteButton.hidden = NO;
  519. if ([AppUserModel sharedAppUserModel].Id == model.UserId) {
  520. cell.cellArticleEditorButton.hidden = NO;
  521. }else{
  522. cell.cellArticleEditorButton.hidden = YES;
  523. };
  524. }else{
  525. if ([AppUserModel sharedAppUserModel].Id == model.UserId) {
  526. cell.cellArticleDeleteButton.hidden = YES;
  527. cell.cellArticleEditorButton.hidden = NO;
  528. }else{
  529. cell.cellArticleDeleteButton.hidden = YES;
  530. cell.cellArticleEditorButton.hidden = YES;
  531. };
  532. }
  533. [cell.cellArticleDeleteButton setAction:^{
  534. [weakSelf ReCallMessage:model.Id];
  535. }];
  536. [cell.cellArticleEditorButton setAction:^{
  537. [weakSelf editMissive:model.Id];
  538. }];
  539. return cell;
  540. }
  541. break;
  542. default:{
  543. InterLeterDetailDataModel *dataModel = model.Data[indexPath.row-1];
  544. switch (dataModel.Type) {
  545. case CollectDataType_Text:{
  546. NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
  547. cell.cell0ImgTitleLab.text = dataModel.Text;
  548. return cell;
  549. }break;
  550. case CollectDataType_IMG:{
  551. NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
  552. [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  553. [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  554. }];
  555. return cell;
  556. }break;
  557. case CollectDataType_File:{
  558. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  559. NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
  560. if (imageName.length > 0) {
  561. cell.cell1IconImageView.image = IMG(imageName);
  562. }else{
  563. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
  564. }
  565. cell.cell1IconImageView.image = IMG(imageName);
  566. cell.cell1TitleLabel.text = dataModel.FileName;
  567. cell.cell1Authorlabel.text = dataModel.Author;
  568. return cell;
  569. }break;
  570. case CollectDataType_Article:{
  571. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  572. switch (dataModel.ArticleImgUrl.count) {
  573. case 0:{
  574. cell.cell1IconImageView.image = IMG(@"icon_myPaper");
  575. }break;
  576. default:{
  577. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.ArticleImgUrl.firstObject] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {}];
  578. }break;
  579. }
  580. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  581. }];
  582. cell.cell1TitleLabel.text = dataModel.FileName;
  583. cell.cell1Authorlabel.text = dataModel.Author;
  584. return cell;
  585. }break;
  586. case CollectDataType_Notice:{
  587. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  588. cell.cell1IconImageView.image = IMG(@"通知图标");
  589. cell.cell1TitleLabel.text = dataModel.Title;
  590. cell.cell1Authorlabel.text = dataModel.Author;
  591. return cell;
  592. }break;
  593. case CollectDataType_Topic:{
  594. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  595. cell.cell1IconImageView.image = IMG(@"话题");
  596. cell.cell1TitleLabel.text = dataModel.Title;
  597. cell.cell1Authorlabel.text = dataModel.Author;
  598. return cell;
  599. }break;
  600. case CollectDataType_Note:{
  601. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  602. cell.cell1IconImageView.image = IMG(@"noteBook_icon");
  603. cell.cell1TitleLabel.text = dataModel.Title;
  604. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
  605. return cell;
  606. }break;
  607. case CollectDataType_Collect:{
  608. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  609. cell.cell1IconImageView.image = IMG(@"收藏");
  610. cell.cell1TitleLabel.text = dataModel.Title;
  611. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  612. return cell;
  613. }break;
  614. case CollectDataType_InterMail:{
  615. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  616. cell.cell1IconImageView.image = IMG(@"站内信图");
  617. cell.cell1TitleLabel.text = dataModel.Title;
  618. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  619. return cell;
  620. }break;
  621. case CollectDataType_Group:{
  622. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  623. cell.cell1IconImageView.image = IMG(@"笔记小组");
  624. cell.cell1TitleLabel.text = dataModel.Title;
  625. cell.cell1Authorlabel.text = dataModel.Author;
  626. return cell;
  627. }break;
  628. case CollectDataType_Approval:{
  629. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  630. cell.cell1IconImageView.image = IMG(@"审批");
  631. cell.cell1TitleLabel.text = dataModel.Title;
  632. cell.cell1Authorlabel.text = dataModel.Author;
  633. return cell;
  634. }break;
  635. default:{
  636. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  637. cell.cell1IconImageView.image = IMG(@"笔记群聊");
  638. cell.cell1TitleLabel.text = dataModel.Title;
  639. cell.cell1Authorlabel.text = dataModel.Author;
  640. return cell;
  641. }break;
  642. }
  643. }
  644. break;
  645. }
  646. }break;
  647. case InterLeterDetialType_NoSign :{
  648. InterLeterDetailSubModel * model = self.interLetterArray[indexPath.section];
  649. switch (indexPath.row) {
  650. case 0:
  651. {
  652. NoteBookDetailCell *cell = [NoteBookDetailCell configCell7:tableView indexPath:indexPath];
  653. cell.cellArticleTitleLabel.text = model.Title;
  654. self.replayTitle = model.Title;
  655. [cell.cellArticleDeleteButton setTitle:@"撤回" forState:UIControlStateNormal];
  656. if(model.AddresseeUsers.count == 0){
  657. cell.cellArticleAuthor2Label.attributedText = [[NSAttributedString alloc] initWithString:@"收件人:--"];
  658. }else{
  659. NSMutableArray * userArray = [[NSMutableArray alloc] init];
  660. for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
  661. [userArray addObject:userModel.Name];
  662. }
  663. NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
  664. [cell layoutIfNeeded];
  665. [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
  666. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  667. weakSelf.labelShow = !weakSelf.labelShow;
  668. [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  669. }];
  670. [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
  671. cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
  672. }
  673. cell.cellArticleTimeLabel.numberOfLines = 1;
  674. cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
  675. if (model.IsAdmin) {
  676. cell.cellArticleEditorButton.hidden = NO;
  677. cell.cellArticleDeleteButton.hidden = NO;
  678. }else{
  679. cell.cellArticleEditorButton.hidden = YES;
  680. cell.cellArticleDeleteButton.hidden = YES;
  681. }
  682. WS(weakSelf);
  683. [cell.cellArticleDeleteButton setAction:^{
  684. [weakSelf deleteButtonHander:model.Id];
  685. }];
  686. [cell.cellArticleEditorButton setAction:^{
  687. [weakSelf editorButtonHander:model.Id];
  688. }];
  689. return cell;
  690. }
  691. break;
  692. default:{
  693. InterLeterDetailDataModel *dataModel = model.Data[indexPath.row-1];
  694. switch (dataModel.Type) {
  695. case CollectDataType_Text:{
  696. NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
  697. cell.cell0ImgTitleLab.text = dataModel.Text;
  698. return cell;
  699. }break;
  700. case CollectDataType_IMG:{
  701. NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
  702. [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  703. [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  704. }];
  705. return cell;
  706. }break;
  707. case CollectDataType_File:{
  708. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  709. NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
  710. if (imageName.length > 0) {
  711. cell.cell1IconImageView.image = IMG(imageName);
  712. }else{
  713. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
  714. }
  715. cell.cell1IconImageView.image = IMG(imageName);
  716. cell.cell1TitleLabel.text = dataModel.FileName;
  717. cell.cell1Authorlabel.text = dataModel.Author;
  718. return cell;
  719. }break;
  720. case CollectDataType_Article:{
  721. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  722. switch (dataModel.ArticleImgUrl.count) {
  723. case 0:{
  724. cell.cell1IconImageView.image = IMG(@"icon_myPaper");
  725. }break;
  726. default:{
  727. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.ArticleImgUrl.firstObject] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {}];
  728. }break;
  729. }
  730. [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
  731. }];
  732. cell.cell1TitleLabel.text = dataModel.FileName;
  733. cell.cell1Authorlabel.text = dataModel.Author;
  734. return cell;
  735. }break;
  736. case CollectDataType_Notice:{
  737. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  738. cell.cell1IconImageView.image = IMG(@"通知图标");
  739. cell.cell1TitleLabel.text = dataModel.Title;
  740. cell.cell1Authorlabel.text = dataModel.Author;
  741. return cell;
  742. }break;
  743. case CollectDataType_Topic:{
  744. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  745. cell.cell1IconImageView.image = IMG(@"话题");
  746. cell.cell1TitleLabel.text = dataModel.Title;
  747. cell.cell1Authorlabel.text = dataModel.Author;
  748. return cell;
  749. }break;
  750. case CollectDataType_Note:{
  751. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  752. cell.cell1IconImageView.image = IMG(@"noteBook_icon");
  753. cell.cell1TitleLabel.text = dataModel.Title;
  754. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
  755. return cell;
  756. }break;
  757. case CollectDataType_Collect:{
  758. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  759. cell.cell1IconImageView.image = IMG(@"收藏");
  760. cell.cell1TitleLabel.text = dataModel.Title;
  761. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  762. return cell;
  763. }break;
  764. case CollectDataType_InterMail:{
  765. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  766. cell.cell1IconImageView.image = IMG(@"站内信图");
  767. cell.cell1TitleLabel.text = dataModel.Title;
  768. cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
  769. return cell;
  770. }break;
  771. case CollectDataType_Group:{
  772. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  773. cell.cell1IconImageView.image = IMG(@"笔记小组");
  774. cell.cell1TitleLabel.text = dataModel.Title;
  775. cell.cell1Authorlabel.text = dataModel.Author;
  776. return cell;
  777. }break;
  778. case CollectDataType_Approval:{
  779. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  780. cell.cell1IconImageView.image = IMG(@"审批");
  781. cell.cell1TitleLabel.text = dataModel.Title;
  782. cell.cell1Authorlabel.text = dataModel.Author;
  783. return cell;
  784. }break;
  785. default:{
  786. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  787. cell.cell1IconImageView.image = IMG(@"笔记群聊");
  788. cell.cell1TitleLabel.text = dataModel.Title;
  789. cell.cell1Authorlabel.text = dataModel.Author;
  790. return cell;
  791. }break;
  792. }
  793. }
  794. break;
  795. }
  796. }break;
  797. default:{
  798. NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
  799. return cell;
  800. }
  801. break;
  802. }
  803. }
  804. - (void)deleteButtonHander:(NSInteger)interLeterID{
  805. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  806. [dic setValue:@[@(interLeterID)] forKey:@"MiddleIds"];
  807. [dic setValue:@(5) forKey:@"FolderType"];
  808. SHOWLOADING
  809. WS(weakSelf);
  810. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  811. REMOVESHOW
  812. [weakSelf.navigationController popViewControllerAnimated:YES];
  813. } failure:^(NSError * _Nonnull error) {
  814. SHOWERROR([ZYCTool handerResultData:error]);
  815. }];
  816. }
  817. - (void)editorButtonHander:(NSInteger)interLeterID{
  818. CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
  819. vc.interLeterId = interLeterID;
  820. vc.interLeterHanderType = InterLeterHanderType_Modify;
  821. vc.modifyArray = self.interLetterArray;
  822. [self.navigationController pushViewController:vc animated:YES];
  823. }
  824. - (void)gotoCollectHander{
  825. MoveViewController *vc = [MoveViewController initMoveViewController];
  826. vc.CollectionDataId = self.interLeterID;
  827. vc.collectType = CollectHanderType_Collect;
  828. vc.ParentId = 0;
  829. vc.titleStr = @"我的收藏";
  830. vc.TypeId = CreateCollectionType;
  831. vc.FolderIds = @[].mutableCopy;
  832. vc.CollectionType = 6;
  833. [self.navigationController pushViewController:vc animated:YES];
  834. }
  835. - (void)shareHander{
  836. [self.noteBookShareVC initNoteBookShareData];
  837. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  838. }
  839. - (NoteBookShareVC *)noteBookShareVC{
  840. if (_noteBookShareVC == nil) {
  841. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  842. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  843. [_noteBookShareVC.view setHidden:YES];
  844. _noteBookShareVC.delegate = self;
  845. }
  846. return _noteBookShareVC;
  847. }
  848. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  849. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  850. if ([typeName isEqualToString:@"发给微信好友"]) {
  851. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  852. }else if ([typeName isEqualToString:@"发到微博"]){
  853. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  854. }else if ([typeName isEqualToString:@"发到消息"]){
  855. }else if ([typeName isEqualToString:@"发到小组"]){
  856. [self returnToGroup];
  857. }else if ([typeName isEqualToString:@"发到笔记"]){
  858. [self returnToNote];
  859. }else if ([typeName isEqualToString:@"发到话题"]){
  860. [self returnToTopic];
  861. }else{
  862. }
  863. }
  864. - (void)returnToGroup
  865. {
  866. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  867. NewTopicModel * model = [[NewTopicModel alloc] init];
  868. model.type = CollectDataType_InterMail;
  869. model.title = self.currentDetailModel.Title;
  870. model.FileId = self.currentDetailModel.Id;
  871. model.AuthorName = self.currentDetailModel.SendName;
  872. model.FileName = self.currentDetailModel.Title;
  873. vc.sendModel = model;
  874. vc.isReturn = YES;
  875. [self.navigationController pushViewController:vc animated:YES];
  876. }
  877. - (void)returnToNote
  878. {
  879. MoveViewController * vc = [MoveViewController initMoveViewController];
  880. vc.TypeId = CreateNotesType;
  881. vc.ParentId = 0;
  882. vc.titleStr = @"我的笔记";
  883. NewTopicModel * model = [[NewTopicModel alloc] init];
  884. model.type = CollectDataType_InterMail;
  885. model.title = self.currentDetailModel.Title;
  886. model.FileId = self.currentDetailModel.Id;
  887. model.AuthorName = self.currentDetailModel.SendName;
  888. model.FileName = self.currentDetailModel.Title;
  889. vc.sendModel = model;
  890. vc.isReturn = YES;
  891. [self.navigationController pushViewController:vc animated:YES];
  892. }
  893. - (void)returnToTopic
  894. {
  895. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  896. NewTopicModel * model = [[NewTopicModel alloc] init];
  897. model.type = CollectDataType_InterMail;
  898. model.title = self.currentDetailModel.Title;
  899. model.FileId = self.currentDetailModel.Id;
  900. model.AuthorName = self.currentDetailModel.SendName;
  901. model.FileName = self.currentDetailModel.Title;
  902. vc.sendModel = model;
  903. vc.isReturn = YES;
  904. [self.navigationController pushViewController:vc animated:YES];
  905. }
  906. - (void)gotoZanHander{
  907. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  908. [dic setValue:@(self.currentDetailModel.Id) forKey:@"SourceId"];
  909. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  910. [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞
  911. [dic setValue:@(4) forKey:@"TypeValue"];//笔记 3
  912. WS(weakSelf);
  913. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  914. [weakSelf getData];
  915. } failure:^(NSError * _Nonnull error) {
  916. SHOWERROR([ZYCTool handerResultData:error]);
  917. }];
  918. }
  919. - (void)checkRead{
  920. InterLeterDetailSubModel * model = self.interLetterArray.firstObject;
  921. NoticeUnreadVC *vc = [NoticeUnreadVC initNoticeUnreadVC];
  922. vc.Id = model.Id;
  923. vc.type = ReadMissiveType;
  924. vc.readCount = model.ReadCount;
  925. vc.unReadCount = model.AllCount - model.ReadCount;
  926. [self.navigationController pushViewController:vc animated:YES];
  927. }
  928. - (void)checkReadUserId:(NSInteger )userId{
  929. MailListDetailVC *vc = [MailListDetailVC initMailListDetailVC];
  930. vc.indexId = userId;
  931. [self.navigationController pushViewController:vc animated:YES];
  932. }
  933. - (void)commentHander{
  934. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  935. UIAlertAction *alertAction1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  936. }];
  937. [alertAction1 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  938. WS(weakSelf);
  939. UIAlertAction *alertAction2 = [UIAlertAction actionWithTitle:@"回复" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  940. CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
  941. vc.interLeterHanderType = InterLeterHanderType_Replay;
  942. vc.replayId = weakSelf.interLeterID;
  943. vc.replayArray = weakSelf.interLetterArray;
  944. vc.replayDataArray = [NSMutableArray arrayWithArray:@[weakSelf.detailModel.missiveAddressee]];
  945. vc.replayTitle = weakSelf.replayTitle;
  946. [weakSelf.navigationController pushViewController:vc animated:YES];
  947. }];
  948. [alertAction2 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  949. UIAlertAction *alertAction3 = [UIAlertAction actionWithTitle:@"回复全部" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  950. CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
  951. vc.interLeterHanderType = InterLeterHanderType_Replay;
  952. vc.replayId = weakSelf.interLeterID;
  953. vc.replayArray = weakSelf.interLetterArray;
  954. vc.replayDataArray = [NSMutableArray arrayWithArray:weakSelf.detailModel.missiveAddressees];
  955. vc.replayTitle = weakSelf.replayTitle;
  956. [weakSelf.navigationController pushViewController:vc animated:YES];
  957. }];
  958. [alertAction3 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  959. [alert addAction:alertAction2];
  960. [alert addAction:alertAction3];
  961. [alert addAction:alertAction1];
  962. [self presentViewController:alert animated:YES completion:^{
  963. }];
  964. }
  965. #pragma mark - 撤回站内信
  966. - (void)ReCallMessage:(NSInteger)Id
  967. {
  968. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Missive_Recall),(long)Id];
  969. SHOWLOADING
  970. WS(weakSelf);
  971. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  972. REMOVESHOW
  973. [weakSelf.navigationController popViewControllerAnimated:YES];
  974. } failure:^(NSError * _Nonnull error) {
  975. REMOVESHOW
  976. SHOWERROR(@"站内信超过撤回时间")
  977. }];
  978. }
  979. - (void)editMissive:(NSInteger)Id
  980. {
  981. CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
  982. vc.interLeterHanderType = InterLeterHanderType_Modify;
  983. vc.isEdit = YES;
  984. vc.interLeterId = Id;
  985. [self.navigationController pushViewController:vc animated:YES];
  986. }
  987. - (void)setCellLabel:(UILabel *)label withText:(NSString *)text indexPath:(NSIndexPath *)indexPath isShow:(BOOL)isShow
  988. {
  989. NSArray * stringArr = [self getLinesArrayOfStringInText:text width:label.frame.size.width];
  990. if (stringArr.count > 2) {
  991. if (isShow) {
  992. NSString *upStr = @" 收起";
  993. NSString *string1 = stringArr[0];
  994. NSString *string2 = stringArr.lastObject;
  995. NSString *string3 = [NSString stringWithFormat:@"%@%@",string2,upStr];
  996. if (string3.length > string1.length) {
  997. upStr = [NSString stringWithFormat:@"%@\n%@",text,upStr];
  998. }else{
  999. upStr = [NSString stringWithFormat:@"%@%@",text,upStr];
  1000. }
  1001. label.attributedText = [self AttributedwithText:upStr];
  1002. label.numberOfLines = 0;
  1003. }else{
  1004. label.numberOfLines = 2;
  1005. NSString *string1 = stringArr[0];
  1006. NSString *string2 = stringArr[1];
  1007. string2 = [string2 substringToIndex:string2.length - 6];
  1008. NSString *string3 = [NSString stringWithFormat:@"%@%@... 展开",string1,string2];
  1009. label.attributedText = [self AttributedwithText:string3];
  1010. }
  1011. }else{
  1012. label.attributedText = [[NSAttributedString alloc] initWithString:text];
  1013. }
  1014. }
  1015. - (NSAttributedString *)AttributedwithText:(NSString *)text
  1016. {
  1017. NSMutableAttributedString *mutableAttributedString = [[NSMutableAttributedString alloc] initWithString:text];
  1018. [mutableAttributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, text.length)];
  1019. [mutableAttributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x999999) range:NSMakeRange(0, text.length - 2)];
  1020. [mutableAttributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x1F87DB) range:NSMakeRange(text.length - 2, 2)];
  1021. return mutableAttributedString;
  1022. }
  1023. - (NSArray *)getLinesArrayOfStringInText:(NSString *)text width:(CGFloat)width{
  1024. UIFont *font = [UIFont systemFontOfSize:14];
  1025. CTFontRef myFont = CTFontCreateWithName((CFStringRef)([font fontName]), [font pointSize], NULL);
  1026. NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
  1027. [attStr addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)myFont range:NSMakeRange(0, attStr.length)];
  1028. CFRelease(myFont);
  1029. CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString(( CFAttributedStringRef)attStr);
  1030. CGMutablePathRef path = CGPathCreateMutable();
  1031. CGPathAddRect(path, NULL, CGRectMake(0,0,width,100000));
  1032. CTFrameRef frame = CTFramesetterCreateFrame(frameSetter, CFRangeMake(0, 0), path, NULL);
  1033. NSArray *lines = ( NSArray *)CTFrameGetLines(frame);
  1034. NSMutableArray *linesArray = [[NSMutableArray alloc]init];
  1035. for (id line in lines) {
  1036. CTLineRef lineRef = (__bridge CTLineRef )line;
  1037. CFRange lineRange = CTLineGetStringRange(lineRef);
  1038. NSRange range = NSMakeRange(lineRange.location, lineRange.length);
  1039. NSString *lineString = [text substringWithRange:range];
  1040. CFAttributedStringSetAttribute((CFMutableAttributedStringRef)attStr, lineRange, kCTKernAttributeName, (CFTypeRef)([NSNumber numberWithFloat:0.0]));
  1041. CFAttributedStringSetAttribute((CFMutableAttributedStringRef)attStr, lineRange, kCTKernAttributeName, (CFTypeRef)([NSNumber numberWithInt:0.0]));
  1042. [linesArray addObject:lineString];
  1043. }
  1044. CGPathRelease(path);
  1045. CFRelease( frame );
  1046. CFRelease(frameSetter);
  1047. return (NSArray *)linesArray;
  1048. }
  1049. @end