123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128 |
- //
- // TDInterLeterDetailVC.m
- // smartRhino
- //
- // Created by taidi on 2019/12/26.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "TDInterLeterDetailVC.h"
- #import "NoteBookDetailCell.h"
- #import "CreateInterLeterVC.h"
- #import "MailListDetailVC.h"
- #import "NoticeUnreadVC.h"
- #import "MoveViewController.h"
- #import "NSDate+Extension.h"
- #import "CreateInterLeterVC.h"
- #import "NoteBookShareVC.h"
- #import "MyTDGroupViewController.h"
- #import "MyTDTopicCreateVC.h"
- #import "MoveViewController.h"
- @interface TDInterLeterDetailVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (strong,nonatomic) NSMutableArray <InterLeterDetailSubModel *>* interLetterArray;
- @property (nonatomic,strong) NSMutableArray <MyNoteBookCommentSubModel*>*commentArray;
- @property (nonatomic,assign) BOOL isFresh;
- @property (nonatomic,assign) NSUInteger currentPage;
- @property (nonatomic,assign) NSUInteger totalRecord;
- @property (weak, nonatomic) IBOutlet UIButton *commentButton;
- //@property (weak, nonatomic) IBOutlet UILabel *commentNumberLabel;
- @property (weak, nonatomic) IBOutlet UIButton *zanButton;
- @property (weak, nonatomic) IBOutlet UILabel *zanNumberLabel;
- @property (weak, nonatomic) IBOutlet UIButton *collectButton;
- @property (weak, nonatomic) IBOutlet UILabel *collectNumberLabel;
- @property (weak, nonatomic) IBOutlet UIButton *shareButton;
- @property (weak, nonatomic) IBOutlet UILabel *shareNumberLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *zanImageView;
- @property (weak, nonatomic) IBOutlet UIImageView *collectImageView;
- @property (weak, nonatomic) IBOutlet UIImageView *shareImageView;
- @property (strong,nonatomic) InterLeterDetailSubModel * currentDetailModel;
- @property (strong,nonatomic) InterLeterDetailModel * detailModel;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- @property (copy, nonatomic) NSString *replayTitle;
- @property (nonatomic,assign) BOOL labelShow;
- @end
- @implementation TDInterLeterDetailVC
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self getData];
- }
- +(TDInterLeterDetailVC *)initTDInterLeterDetailVC{
- TDInterLeterDetailVC *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterDetailVC"];
- return controller;
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- self.view.backgroundColor = RGB(255, 255, 255);
- if (@available(iOS 11.0, *)) {
- self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- WS(weakSelf);
- [self.collectButton setAction:^{
- [weakSelf gotoCollectHander];
- }];
- [self.shareButton setAction:^{
- [weakSelf shareHander];
- }];
- [self.zanButton setAction:^{
- [weakSelf gotoZanHander];
- }];
- [self.commentButton setAction:^{
- [weakSelf commentHander];
- }];
- }
- - (void)getData{
- switch (self.detailType) {
- case InterLeterDetialType_Sign:
-
- break;
- case InterLeterDetialType_NoSign:
-
- break;
- default:
- break;
- }
- SHOWLOADING;
- WS(weakSelf);
- [self.interLetterArray removeAllObjects];
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_InterLetterDetail),(long)self.interLeterID] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- weakSelf.detailModel = [[InterLeterDetailModel alloc]initWithDictionary:responseObject error:nil];
- REMOVESHOW
- NSLog(@"%@",responseObject);
- [weakSelf.interLetterArray addObjectsFromArray:weakSelf.detailModel.Items];
- InterLeterDetailSubModel *mymodel = weakSelf.detailModel.Items.firstObject;
- weakSelf.currentDetailModel = mymodel;
- if(mymodel.IsCollect){
- weakSelf.collectImageView.image = IMG(@"icon_collect_off");
- }else{
- weakSelf.collectImageView.image = IMG(@"收藏五角星");
- }
- if (mymodel.IsPraise) {
- weakSelf.zanImageView.image = IMG(@"zan_yes");
- }else{
- weakSelf.zanImageView.image = IMG(@"zan_no");
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- weakSelf.collectButton.selected = mymodel.IsCollect;
- weakSelf.zanButton.selected = mymodel.IsPraise;
- weakSelf.shareButton.selected = YES;
- weakSelf.zanNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)mymodel.PraiseCount];
- weakSelf.zanNumberLabel.textColor = !mymodel.IsPraise ? UIColorHex(#999999) : UIColorHex(#0F8AE3);
- weakSelf.collectNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)mymodel.CollectCount];
- weakSelf.collectNumberLabel.textColor = !mymodel.IsCollect ? UIColorHex(#999999) : UIColorHex(#0F8AE3);
- weakSelf.shareNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)mymodel.RetransmissionCount];
-
- weakSelf.zanNumberLabel.hidden = mymodel.PraiseCount == 0 ? YES : NO;
- weakSelf.collectNumberLabel.hidden = mymodel.CollectCount == 0 ? YES : NO;
- weakSelf.shareNumberLabel.hidden = mymodel.RetransmissionCount == 0 ? YES : NO;
-
- weakSelf.shareNumberLabel.textColor = UIColorHex(#0F8AE3);
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- [self.view addSubview:self.noteBookShareVC.view];
- }
- - (NSMutableArray<InterLeterDetailSubModel *> *)interLetterArray{
- if (!_interLetterArray) {
- _interLetterArray = [NSMutableArray new];
- }
- return _interLetterArray;
- }
- - (NSMutableArray<MyNoteBookCommentSubModel *> *)commentArray{
- if (!_commentArray) {
- _commentArray = [NSMutableArray new];
- }
- return _commentArray;
- }
- - (void)getComment{
-
- }
- #pragma mark - tableview 代理
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return self.interLetterArray.count;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- InterLeterDetailSubModel *model = self.interLetterArray[section];
- switch (self.detailType) {
- case InterLeterDetialType_Sign:{
- return model.Data.count + 1;
- }break;
- case InterLeterDetialType_NoSign:{
- return model.Data.count + 1;
- }break;
- case InterLeterDetialType_Replay:{
- switch (section) {
- case 0:{ // 最后一次回复
- return model.Data.count + 1;
- }break;
- default:{// 往次回复
- return model.Data.count + 2;
- }break;
- }
-
- }break;
- default:
- {
- return model.Data.count + 1;
- }break;
- }
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- WS(weakSelf);
- InterLeterDetailSubModel * model = self.interLetterArray[indexPath.section];
- switch (self.detailType) {
- case InterLeterDetialType_Replay :{
- switch (indexPath.section) {
- case 0:{ // 最后一次回复
- switch (indexPath.row) {
- case 0:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell6:tableView indexPath:indexPath];
- cell.cellArticleTitleLabel.text = model.Title;
- self.replayTitle = model.Title;
- if(model.AddresseeUsers.count == 0){
- cell.cellArticleAuthor2Label.attributedText = [[NSAttributedString alloc] initWithString:@"收件人:--"];
- }else{
- NSMutableArray * userArray = [[NSMutableArray alloc] init];
- for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
- [userArray addObject:userModel.Name];
- }
- NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
- [cell layoutIfNeeded];
- [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- weakSelf.labelShow = !weakSelf.labelShow;
- [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
- cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
- }
- cell.cellArticleAuthorLabel.text = [NSString stringWithFormat:@"发件人:%@",model.UserName];
- cell.cellArticleTimeLabel.numberOfLines = 1;
- cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
- cell.cellArticleReadNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ReadCount];
- cell.cellArticleAllReadNumberLabel.text = [NSString stringWithFormat:@"/%ld",(long)model.AllCount];
- [cell.checkReadButton setAction:^{
- [weakSelf checkRead];
- }];
- [cell.checkPeopleButton setAction:^{
- [weakSelf checkReadUserId:model.UserId];
- }];
- cell.cellArticleEditorButton.hidden = YES;
- cell.cellArticleDeleteButton.hidden = YES;
- return cell;
- }break;
- default:{
- InterLeterDetailDataModel *dataModel = model.Data[indexPath.row - 1];
- switch (dataModel.Type) {
- case CollectDataType_Text:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell0ImgTitleLab.text = dataModel.Text;
- return cell;
- }break;
- case CollectDataType_IMG:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- return cell;
- }break;
- case CollectDataType_File:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
- if (imageName.length > 0) {
- cell.cell1IconImageView.image = IMG(imageName);
- }else{
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
- }
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@",dataModel.Author] KeyString:dataModel.Author];
- return cell;
- }break;
- case CollectDataType_Article:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"文章");
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的文章",dataModel.Author] KeyString:dataModel.Author];
- return cell;
- }break;
- case CollectDataType_Notice:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"通知图标");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的通知",dataModel.Author] KeyString:dataModel.Author];
- return cell;
- }break;
- case CollectDataType_Topic:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"话题");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Note:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"noteBook_icon");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
- return cell;
- }break;
- case CollectDataType_Collect:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"收藏");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_NoteFile:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"find_1");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记文件夹",dataModel.Author] KeyString:dataModel.Author];
- return cell;
- }break;
- case CollectDataType_CollectFile:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"find_1");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏文件夹",dataModel.Author] KeyString:dataModel.Author];
- return cell;
- }break;
- case CollectDataType_InterMail:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"站内信图");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Group:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记小组");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
-
- }break;
- case CollectDataType_Approval:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"审批");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
-
- }break;
- default:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
- return cell;
- }break;
- }
- }break;
- }
- }break;
- default:{// 往次回复
- switch (indexPath.row) {
- case 0:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell8:tableView indexPath:indexPath];
- return cell;
- }
- case 1:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell6:tableView indexPath:indexPath];
- cell.cellArticleTitleLabel.text = model.Title;
- if(model.AddresseeUsers.count == 0){
- cell.cellArticleAuthorLabel.text = @"--";
- }else{
- NSMutableArray * userArray = [[NSMutableArray alloc] init];
- for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
- [userArray addObject:userModel.Name];
- }
- NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
- [cell layoutIfNeeded];
- [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- weakSelf.labelShow = !weakSelf.labelShow;
- [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
- cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
- }
- cell.cellArticleAuthorLabel.textColor = UIColorHex(999999);
- cell.cellArticleReadNumberLabel.textColor = UIColorHex(999999);
- cell.cellArticleAuthorLabel.text = model.UserName;
- cell.cellArticleTimeLabel.numberOfLines = 1;
- cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
- cell.cellArticleReadNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ReadCount];
- cell.cellArticleAllReadNumberLabel.text = [NSString stringWithFormat:@"/%ld",(long)model.AllCount];
- [cell.cellArticleDeleteButton setTitle:@"撤回" forState:UIControlStateNormal];
- WS(weakSelf);
- [cell.checkReadButton setAction:^{
- [weakSelf checkRead];
- }];
- [cell.checkPeopleButton setAction:^{
- [weakSelf checkReadUserId:model.UserId];
- }];
- if (model.IsAdmin) {
- cell.cellArticleEditorButton.hidden = NO;
- cell.cellArticleDeleteButton.hidden = NO;
- }else{
- cell.cellArticleEditorButton.hidden = YES;
- cell.cellArticleDeleteButton.hidden = YES;
- }
- [cell.cellArticleDeleteButton setAction:^{
- [weakSelf deleteButtonHander:model.Id];
- }];
- [cell.cellArticleEditorButton setAction:^{
- [weakSelf editorButtonHander:model.Id];
- }];
- return cell;
- }break;
- default:{
- InterLeterDetailDataModel *dataModel = model.Data[indexPath.row-2];
- switch (dataModel.Type) {
- case CollectDataType_Text:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell0ImgTitleLab.text = dataModel.Text;
- return cell;
- }break;
- case CollectDataType_IMG:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- return cell;
- }break;
- case CollectDataType_File:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
- if (imageName.length > 0) {
- cell.cell1IconImageView.image = IMG(imageName);
- }else{
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
- }
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Article:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- switch (dataModel.ArticleImgUrl.count) {
- case 0:{
- cell.cell1IconImageView.image = IMG(@"icon_myPaper");
- }break;
- default:{
- [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) {}];
- }break;
- }
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- }];
-
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Notice:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"通知图标");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Topic:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"话题");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Note:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"noteBook_icon");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Collect:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"收藏");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_InterMail:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"站内信图");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Group:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记小组");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
-
- }break;
- case CollectDataType_Approval:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"审批");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
-
- }break;
- default:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记群聊");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- }
- }break;
- }
- }break;
- }
- }break;
- case InterLeterDetialType_Sign :{
- InterLeterDetailSubModel * model = self.interLetterArray[indexPath.section];
- switch (indexPath.row) {
- case 0:
- {
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell6:tableView indexPath:indexPath];
- cell.cellArticleTitleLabel.text = model.Title;
- self.replayTitle = model.Title;
- if(model.AddresseeUsers.count == 0){
- cell.cellArticleAuthor2Label.attributedText = [[NSAttributedString alloc] initWithString:@"收件人:--"];
- }else{
- NSMutableArray * userArray = [[NSMutableArray alloc] init];
- for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
- [userArray addObject:userModel.Name];
- }
- NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
- [cell layoutIfNeeded];
- [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- weakSelf.labelShow = !weakSelf.labelShow;
- [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
- cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
- }
- cell.cellArticleAuthorLabel.text = [NSString stringWithFormat:@"%@",model.UserName];
- cell.cellArticleTimeLabel.numberOfLines = 1;
- cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
- cell.cellArticleReadNumberLabel.text = [NSString stringWithFormat:@"%ld",(long)model.ReadCount];
- cell.cellArticleAllReadNumberLabel.text = [NSString stringWithFormat:@"/%ld",(long)model.AllCount];
- [cell.cellArticleDeleteButton setTitle:@"撤回" forState:UIControlStateNormal];
- WS(weakSelf);
- [cell.checkReadButton setAction:^{
- [weakSelf checkRead];
- }];
- [cell.checkPeopleButton setAction:^{
- [weakSelf checkReadUserId:model.UserId];
- }];
- if (model.IsRecall) {
- cell.cellArticleDeleteButton.hidden = NO;
- if ([AppUserModel sharedAppUserModel].Id == model.UserId) {
- cell.cellArticleEditorButton.hidden = NO;
- }else{
- cell.cellArticleEditorButton.hidden = YES;
- };
- }else{
- if ([AppUserModel sharedAppUserModel].Id == model.UserId) {
- cell.cellArticleDeleteButton.hidden = YES;
- cell.cellArticleEditorButton.hidden = NO;
- }else{
- cell.cellArticleDeleteButton.hidden = YES;
- cell.cellArticleEditorButton.hidden = YES;
- };
- }
- [cell.cellArticleDeleteButton setAction:^{
- [weakSelf ReCallMessage:model.Id];
- }];
- [cell.cellArticleEditorButton setAction:^{
- [weakSelf editMissive:model.Id];
- }];
- return cell;
- }
- break;
- default:{
- InterLeterDetailDataModel *dataModel = model.Data[indexPath.row-1];
- switch (dataModel.Type) {
- case CollectDataType_Text:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell0ImgTitleLab.text = dataModel.Text;
- return cell;
- }break;
- case CollectDataType_IMG:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- return cell;
- }break;
- case CollectDataType_File:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
- if (imageName.length > 0) {
- cell.cell1IconImageView.image = IMG(imageName);
- }else{
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
- }
- cell.cell1IconImageView.image = IMG(imageName);
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Article:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- switch (dataModel.ArticleImgUrl.count) {
- case 0:{
- cell.cell1IconImageView.image = IMG(@"icon_myPaper");
- }break;
- default:{
- [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) {}];
- }break;
- }
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- }];
-
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Notice:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"通知图标");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Topic:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"话题");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Note:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"noteBook_icon");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Collect:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"收藏");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_InterMail:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"站内信图");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Group:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记小组");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
-
- }break;
- case CollectDataType_Approval:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"审批");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
-
- }break;
- default:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记群聊");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- }
- }
- break;
- }
- }break;
- case InterLeterDetialType_NoSign :{
- InterLeterDetailSubModel * model = self.interLetterArray[indexPath.section];
- switch (indexPath.row) {
- case 0:
- {
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell7:tableView indexPath:indexPath];
- cell.cellArticleTitleLabel.text = model.Title;
- self.replayTitle = model.Title;
- [cell.cellArticleDeleteButton setTitle:@"撤回" forState:UIControlStateNormal];
- if(model.AddresseeUsers.count == 0){
- cell.cellArticleAuthor2Label.attributedText = [[NSAttributedString alloc] initWithString:@"收件人:--"];
- }else{
- NSMutableArray * userArray = [[NSMutableArray alloc] init];
- for (InterLeterAddresseeUsers * userModel in model.AddresseeUsers) {
- [userArray addObject:userModel.Name];
- }
- NSString * NoticeAddresseeNames = [NSString stringWithFormat:@"收件人: %@",[userArray componentsJoinedByString:@"、"]];
- [cell layoutIfNeeded];
- [self setCellLabel:cell.cellArticleAuthor2Label withText:NoticeAddresseeNames indexPath:indexPath isShow:self.labelShow];
- UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- weakSelf.labelShow = !weakSelf.labelShow;
- [weakSelf.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- [cell.cellArticleAuthor2Label addGestureRecognizer:tap];
- cell.cellArticleAuthor2Label.userInteractionEnabled = YES;
- }
- cell.cellArticleTimeLabel.numberOfLines = 1;
- cell.cellArticleTimeLabel.text = [NSDate getCHtimeWihtDate:model.CreatedDate];
- if (model.IsAdmin) {
- cell.cellArticleEditorButton.hidden = NO;
- cell.cellArticleDeleteButton.hidden = NO;
- }else{
- cell.cellArticleEditorButton.hidden = YES;
- cell.cellArticleDeleteButton.hidden = YES;
- }
- WS(weakSelf);
- [cell.cellArticleDeleteButton setAction:^{
- [weakSelf deleteButtonHander:model.Id];
- }];
- [cell.cellArticleEditorButton setAction:^{
- [weakSelf editorButtonHander:model.Id];
- }];
- return cell;
- }
- break;
- default:{
- InterLeterDetailDataModel *dataModel = model.Data[indexPath.row-1];
- switch (dataModel.Type) {
- case CollectDataType_Text:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell0ImgTitleLab.text = dataModel.Text;
- return cell;
- }break;
- case CollectDataType_IMG:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- [self.tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
- }];
- return cell;
- }break;
- case CollectDataType_File:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- NSString * imageName = [ZYCTool getFileNameImage:dataModel.File];
- if (imageName.length > 0) {
- cell.cell1IconImageView.image = IMG(imageName);
- }else{
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"icon_weizhiwenjian")];
- }
- cell.cell1IconImageView.image = IMG(imageName);
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Article:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- switch (dataModel.ArticleImgUrl.count) {
- case 0:{
- cell.cell1IconImageView.image = IMG(@"icon_myPaper");
- }break;
- default:{
- [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) {}];
- }break;
- }
- [cell.cell1IconImageView sd_setImageWithURL:[NSURL URLWithString:dataModel.File] placeholderImage:IMG(@"img_placeHolder")completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- }];
-
- cell.cell1TitleLabel.text = dataModel.FileName;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Notice:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"通知图标");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Topic:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"话题");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Note:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"noteBook_icon");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的笔记",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Collect:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"收藏");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_InterMail:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"站内信图");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.attributedText = [ZYCTool checkOfString:[NSString stringWithFormat:@"来自-%@的收藏",dataModel.Author] KeyString:dataModel.Author];
-
- return cell;
- }break;
- case CollectDataType_Group:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记小组");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- case CollectDataType_Approval:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"审批");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- default:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell1IconImageView.image = IMG(@"笔记群聊");
- cell.cell1TitleLabel.text = dataModel.Title;
- cell.cell1Authorlabel.text = dataModel.Author;
-
- return cell;
- }break;
- }
- }
- break;
- }
- }break;
- default:{
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell2:tableView indexPath:indexPath];
- return cell;
- }
- break;
- }
- }
- - (void)deleteButtonHander:(NSInteger)interLeterID{
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:@[@(interLeterID)] forKey:@"MiddleIds"];
- [dic setValue:@(5) forKey:@"FolderType"];
-
- SHOWLOADING
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)editorButtonHander:(NSInteger)interLeterID{
- CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
- vc.interLeterId = interLeterID;
- vc.interLeterHanderType = InterLeterHanderType_Modify;
- vc.modifyArray = self.interLetterArray;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)gotoCollectHander{
- MoveViewController *vc = [MoveViewController initMoveViewController];
- vc.CollectionDataId = self.interLeterID;
- vc.collectType = CollectHanderType_Collect;
- vc.ParentId = 0;
- vc.titleStr = @"我的收藏";
- vc.TypeId = CreateCollectionType;
- vc.FolderIds = @[].mutableCopy;
- vc.CollectionType = 6;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)shareHander{
- [self.noteBookShareVC initNoteBookShareData];
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
-
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
-
- }else if ([typeName isEqualToString:@"发到微博"]){
-
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
-
- }else if ([typeName isEqualToString:@"发到消息"]){
-
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
-
- }
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- NewTopicModel * model = [[NewTopicModel alloc] init];
- model.type = CollectDataType_InterMail;
- model.title = self.currentDetailModel.Title;
- model.FileId = self.currentDetailModel.Id;
- model.AuthorName = self.currentDetailModel.SendName;
- model.FileName = self.currentDetailModel.Title;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MoveViewController * vc = [MoveViewController initMoveViewController];
- vc.TypeId = CreateNotesType;
- vc.ParentId = 0;
- vc.titleStr = @"我的笔记";
- NewTopicModel * model = [[NewTopicModel alloc] init];
- model.type = CollectDataType_InterMail;
- model.title = self.currentDetailModel.Title;
- model.FileId = self.currentDetailModel.Id;
- model.AuthorName = self.currentDetailModel.SendName;
- model.FileName = self.currentDetailModel.Title;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- NewTopicModel * model = [[NewTopicModel alloc] init];
- model.type = CollectDataType_InterMail;
- model.title = self.currentDetailModel.Title;
- model.FileId = self.currentDetailModel.Id;
- model.AuthorName = self.currentDetailModel.SendName;
- model.FileName = self.currentDetailModel.Title;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)gotoZanHander{
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setValue:@(self.currentDetailModel.Id) forKey:@"SourceId"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞
- [dic setValue:@(4) forKey:@"TypeValue"];//笔记 3
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- [weakSelf getData];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)checkRead{
- InterLeterDetailSubModel * model = self.interLetterArray.firstObject;
- NoticeUnreadVC *vc = [NoticeUnreadVC initNoticeUnreadVC];
- vc.Id = model.Id;
- vc.type = ReadMissiveType;
- vc.readCount = model.ReadCount;
- vc.unReadCount = model.AllCount - model.ReadCount;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)checkReadUserId:(NSInteger )userId{
- MailListDetailVC *vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)commentHander{
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-
- UIAlertAction *alertAction1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [alertAction1 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
- WS(weakSelf);
- UIAlertAction *alertAction2 = [UIAlertAction actionWithTitle:@"回复" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
- vc.interLeterHanderType = InterLeterHanderType_Replay;
- vc.replayId = weakSelf.interLeterID;
- vc.replayArray = weakSelf.interLetterArray;
- vc.replayDataArray = [NSMutableArray arrayWithArray:@[weakSelf.detailModel.missiveAddressee]];
- vc.replayTitle = weakSelf.replayTitle;
-
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [alertAction2 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
- UIAlertAction *alertAction3 = [UIAlertAction actionWithTitle:@"回复全部" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
- vc.interLeterHanderType = InterLeterHanderType_Replay;
- vc.replayId = weakSelf.interLeterID;
- vc.replayArray = weakSelf.interLetterArray;
- vc.replayDataArray = [NSMutableArray arrayWithArray:weakSelf.detailModel.missiveAddressees];
- vc.replayTitle = weakSelf.replayTitle;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [alertAction3 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
- [alert addAction:alertAction2];
- [alert addAction:alertAction3];
- [alert addAction:alertAction1];
- [self presentViewController:alert animated:YES completion:^{
-
- }];
- }
- #pragma mark - 撤回站内信
- - (void)ReCallMessage:(NSInteger)Id
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Missive_Recall),(long)Id];
- SHOWLOADING
- WS(weakSelf);
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- SHOWERROR(@"站内信超过撤回时间")
- }];
- }
- - (void)editMissive:(NSInteger)Id
- {
- CreateInterLeterVC *vc = [CreateInterLeterVC initCreateInterLeterVC];
- vc.interLeterHanderType = InterLeterHanderType_Modify;
- vc.isEdit = YES;
- vc.interLeterId = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)setCellLabel:(UILabel *)label withText:(NSString *)text indexPath:(NSIndexPath *)indexPath isShow:(BOOL)isShow
- {
- NSArray * stringArr = [self getLinesArrayOfStringInText:text width:label.frame.size.width];
- if (stringArr.count > 2) {
- if (isShow) {
- NSString *upStr = @" 收起";
- NSString *string1 = stringArr[0];
- NSString *string2 = stringArr.lastObject;
- NSString *string3 = [NSString stringWithFormat:@"%@%@",string2,upStr];
- if (string3.length > string1.length) {
- upStr = [NSString stringWithFormat:@"%@\n%@",text,upStr];
- }else{
- upStr = [NSString stringWithFormat:@"%@%@",text,upStr];
- }
- label.attributedText = [self AttributedwithText:upStr];
- label.numberOfLines = 0;
- }else{
- label.numberOfLines = 2;
- NSString *string1 = stringArr[0];
- NSString *string2 = stringArr[1];
- string2 = [string2 substringToIndex:string2.length - 6];
- NSString *string3 = [NSString stringWithFormat:@"%@%@... 展开",string1,string2];
- label.attributedText = [self AttributedwithText:string3];
- }
- }else{
- label.attributedText = [[NSAttributedString alloc] initWithString:text];
- }
- }
- - (NSAttributedString *)AttributedwithText:(NSString *)text
- {
- NSMutableAttributedString *mutableAttributedString = [[NSMutableAttributedString alloc] initWithString:text];
- [mutableAttributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, text.length)];
- [mutableAttributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x999999) range:NSMakeRange(0, text.length - 2)];
- [mutableAttributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x1F87DB) range:NSMakeRange(text.length - 2, 2)];
- return mutableAttributedString;
- }
- - (NSArray *)getLinesArrayOfStringInText:(NSString *)text width:(CGFloat)width{
- UIFont *font = [UIFont systemFontOfSize:14];
- CTFontRef myFont = CTFontCreateWithName((CFStringRef)([font fontName]), [font pointSize], NULL);
- NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
- [attStr addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)myFont range:NSMakeRange(0, attStr.length)];
- CFRelease(myFont);
- CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString(( CFAttributedStringRef)attStr);
- CGMutablePathRef path = CGPathCreateMutable();
- CGPathAddRect(path, NULL, CGRectMake(0,0,width,100000));
- CTFrameRef frame = CTFramesetterCreateFrame(frameSetter, CFRangeMake(0, 0), path, NULL);
- NSArray *lines = ( NSArray *)CTFrameGetLines(frame);
- NSMutableArray *linesArray = [[NSMutableArray alloc]init];
- for (id line in lines) {
- CTLineRef lineRef = (__bridge CTLineRef )line;
- CFRange lineRange = CTLineGetStringRange(lineRef);
- NSRange range = NSMakeRange(lineRange.location, lineRange.length);
- NSString *lineString = [text substringWithRange:range];
- CFAttributedStringSetAttribute((CFMutableAttributedStringRef)attStr, lineRange, kCTKernAttributeName, (CFTypeRef)([NSNumber numberWithFloat:0.0]));
- CFAttributedStringSetAttribute((CFMutableAttributedStringRef)attStr, lineRange, kCTKernAttributeName, (CFTypeRef)([NSNumber numberWithInt:0.0]));
- [linesArray addObject:lineString];
- }
- CGPathRelease(path);
- CFRelease( frame );
- CFRelease(frameSetter);
- return (NSArray *)linesArray;
- }
- @end
|