1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265 |
- //
- // MyTDTopicDetailVC.m
- // smartRhino
- //
- // Created by niuzhen on 2019/12/19.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyTDTopicDetailVC.h"
- #import "NoteBookDetailCell.h"
- #import "NoteBookShareVC.h"
- #import "MoveViewController.h"
- #import "ChangeTopicVC.h"
- #import "TDGroupInfoListVC.h"
- #import "TextInputView.h"
- #import "MHTopicCell.h"
- #import "MHTopic.h"
- #import "MHTopicFrame.h"
- #import "ClickOKViewController.h"
- #import "ReadListVC.h"
- #import "HomeDetailController.h"
- #import "ChatMsgNoticeDetailVC.h"
- #import "NoteBookDetailVC.h"
- #import "MyFavoriteVC.h"
- #import "NoteBookVC.h"
- #import "TDInterLeterDetailVC.h"
- #import "FileOpenViewController.h"
- #import "EMChatFileShowVC.h"
- #import "MyTDTopicCreateVC.h"
- #import "NoticeUnreadVC.h"
- #import "DownFileViewController.h"
- #import "CountDataVC.h"
- #import "WorkFlowDetailsController.h"
- #import "MyTDGroupViewController.h"
- #import "MoveViewController.h"
- #import "MyApprovalPageDetail.h"
- #import "WorkFlowDetailsController.h"
- #import "OtherFavoriteVC.h"
- #import "OtherNoteBookVC.h"
- #import "MailListDetailVC.h"
- #import "ReadListVC.h"
- #import "ShareListVC.h"
- #import "BookWCDetailVC.h"
- #import "BookListenVC.h"
- #import "LZImageBrowserManger.h"
- #import "LZImageBrowserHeader.h"
- @interface MyTDTopicDetailVC ()<UITableViewDataSource,UITableViewDelegate,NoteBookShareVCDelegate,MHTopicCellDelegate,WKUIDelegate,WKNavigationDelegate,UIScrollViewDelegate,WKScriptMessageHandler>
- @property (strong,nonatomic) IBOutlet UITableView *tableView;
- @property (nonatomic,assign) NSUInteger currentPage;
- @property (nonatomic,strong) LZImageBrowserManger *imageBrowserManger;
- @property (nonatomic,strong) MyNoteBookDetailModel *currentNoteModel;
- @property (nonatomic,strong) MyNodeBookZanModel *currentZanModel;
- @property (nonatomic,strong) MyNoteBookCommentModel *currentNoteCommentModel;
- @property (nonatomic,strong) NSMutableArray *commentArray;
- @property (nonatomic,assign) BOOL isFresh;
- @property (weak, nonatomic) IBOutlet UILabel *titleL;
- @property (weak, nonatomic) IBOutlet UIButton *commentButton;
- @property (weak, nonatomic) IBOutlet UIButton *commentScrollBtn;
- @property (weak, nonatomic) IBOutlet UILabel *commentNumberLabel;
- @property (weak, nonatomic) IBOutlet UIButton *zanButton;
- @property (weak, nonatomic) IBOutlet UIButton *collectButton;
- @property (weak, nonatomic) IBOutlet UIButton *shareButton;
- @property (weak, nonatomic) IBOutlet UILabel *commentCountL;
- @property (weak, nonatomic) IBOutlet UIImageView *zanImgV;
- @property (weak, nonatomic) IBOutlet UILabel *zanCountL;
- @property (weak, nonatomic) IBOutlet UIImageView *collectImgV;
- @property (weak, nonatomic) IBOutlet UILabel *collectL;
- @property (weak, nonatomic) IBOutlet UIImageView *shareImgV;
- @property (weak, nonatomic) IBOutlet UILabel *shareCountL;
- @property (weak, nonatomic) IBOutlet UIView *TalkView;
- @property (weak, nonatomic) IBOutlet UIView *ReplayView;
- @property (weak, nonatomic) IBOutlet UIButton *ReplayBtn;
- @property (weak, nonatomic) IBOutlet UIView *BottomView;
- @property (weak, nonatomic) IBOutlet UIButton *musicBtn;
- @property (weak, nonatomic) IBOutlet UIButton *shareBtn;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *shareWidth;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomHeight;
- @property (nonatomic, strong) TextInputView *commentInputView;
- @property (assign, nonatomic) NSInteger countComment;
- @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
- @property (nonatomic,assign) BOOL isSort;
- @property (nonatomic,assign) BOOL isScrComment;
- @property (nonatomic,assign) CGFloat webH;
- @property (nonatomic,strong) WKWebView * webView;
- @property (nonatomic,assign) BOOL dismissSelf;
- @property (nonatomic,copy) NSString * shareText;
- @property (nonatomic,assign) BOOL IsShareText;
- @property (nonatomic,assign) NSInteger commentId;
- @property (nonatomic,copy) NSString * commentStr;
- @property (nonatomic,assign) BOOL isSelf;
- @property (nonatomic,assign) BOOL IsCollect;
- @property (nonatomic,assign) NSInteger sendUserId;
- @end
- @implementation MyTDTopicDetailVC
- +(MyTDTopicDetailVC *)initMyTDTopicDetailVC{
- MyTDTopicDetailVC *controller = [StoryboardManager.shared.myTDTopic instantiateViewControllerWithIdentifier:@"MyTDTopicDetailVC"];
- return controller;
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- WS(weakSelf);
- self.dismissSelf = NO;
- NSString *jsonString = [NSString stringWithFormat:@"getData('%ld','%@','%ld')",(long)self.Id,USERDEFAULTSGET(@"LOGINTOKEN"),(long)self.type];
-
- self.musicBtn.hidden = YES;
- switch (self.type) {
- case CollectModel_InterMail:
- {
- [self setMailBottomView:YES];
- [self.ReplayBtn setAction:^{
- weakSelf.dismissSelf = YES;
- [weakSelf ReplayAction];
- }];
- self.titleL.text = @"站内信";
- }
- break;
- case CollectModel_NoSignMail:
- {
- [self setMailBottomView:YES];
- [self.ReplayBtn setAction:^{
- weakSelf.dismissSelf = YES;
- [weakSelf ReplayAction];
- }];
- self.titleL.text = @"站内信";
- }
- break;
- case CollectModel_NewTopic:
- {
- self.titleL.text = @"话题";
- self.musicBtn.hidden = NO;
- [self setMailBottomView:NO];
- }
- break;
- case CollectModel_Toipc:
- {
- self.titleL.text = @"话题";
- self.musicBtn.hidden = NO;
- [self setMailBottomView:NO];
- }
- break;
- case CollectModel_Notice:
- {
- self.titleL.text = @"通知";
- [self setMailBottomView:NO];
- }
- break;
- case CollectModel_NoteBook:
- {
- self.titleL.text = @"笔记";
- self.shareWidth.constant = 50.f;
- self.bottomHeight.constant = 0.f;
- [self.shareBtn setAction:^{
- [weakSelf shareHander];
- }];
- self.BottomView.hidden = YES;
- self.shareBtn.hidden = NO;
- self.musicBtn.hidden = NO;
- }
- break;
- case CollectModel_Aritle:
- {
- self.titleL.text = @"正文";
- self.musicBtn.hidden = NO;
- [self setMailBottomView:NO];
- }
- break;
- case CollectModel_MediaAritle:
- {
- self.titleL.text = @"正文";
- self.musicBtn.hidden = NO;
- [self setMailBottomView:NO];
- }
- break;
- case CollectModel_meetMian:
- {
- self.titleL.text = @"会议纪要";
- self.musicBtn.hidden = NO;
- [self setMailBottomView:NO];
- }
- break;
- default:
- {
- self.titleL.text = @"正文";
- self.musicBtn.hidden = NO;
- [self setMailBottomView:NO];
- }
- break;
- }
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- self.dismissSelf = YES;
- }
- - (void)setMailBottomView:(BOOL)isSet
- {
- if (isSet) {
- self.TalkView.hidden = YES;
- self.ReplayView.hidden = NO;
- self.ReplayBtn.layer.cornerRadius = 5.f;
- self.ReplayBtn.layer.masksToBounds = YES;
- self.ReplayBtn.layer.borderColor = UIColorHex(0x0F8AE3).CGColor;
- self.ReplayBtn.layer.borderWidth = 0.5f;
- [self.BottomView setBackgroundColor:UIColorHex(0xF5F5F5)];
- }else{
- [self.BottomView setBackgroundColor:[UIColor whiteColor]];
- self.TalkView.hidden = NO;
- self.TalkView.layer.cornerRadius = 4.f;
- self.TalkView.layer.masksToBounds = YES;
- self.TalkView.layer.borderColor = UIColorHex(0xE5E5E5).CGColor;
- self.TalkView.layer.borderWidth = 0.5f;
- self.ReplayView.hidden = YES;
- }
- }
- - (void)ReplayAction{
- WS(weakSelf);
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-
- UIAlertAction *alertAction1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf setCusMenuShare];
- }];
- [alertAction1 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
- UIAlertAction *alertAction2 = [UIAlertAction actionWithTitle:@"回复" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- weakSelf.webH = 0;
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- vc.replayType = MailReplayOne;
- vc.type = weakSelf.type;
- vc.isEdit = YES;
- vc.Id = weakSelf.Id;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [alertAction2 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
- UIAlertAction *alertAction3 = [UIAlertAction actionWithTitle:@"回复全部" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- weakSelf.webH = 0;
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- vc.replayType = MailReplayAll;
- vc.isEdit = YES;
- vc.type = CollectModel_InterMail;
- vc.Id = weakSelf.Id;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [alertAction3 setValue:UIColorHex(0x0A0A0A) forKey:@"titleTextColor"];
- [alert addAction:alertAction2];
- [alert addAction:alertAction3];
- [alert addAction:alertAction1];
-
- [self presentViewController:alert animated:YES completion:^{
-
- }];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
-
- [self setTableViewRefresh];
- WS(weakSelf);
- [self.shareButton setAction:^{
- weakSelf.dismissSelf = YES;
- [weakSelf ShareDetail];
- }];
- [self.zanButton setAction:^{
- weakSelf.dismissSelf = YES;
- [weakSelf gotoZanHander];
- }];
-
- if (self.type != CollectModel_InterMail || self.type != CollectModel_NoSignMail) {
- [self.commentButton setAction:^{
- weakSelf.dismissSelf = YES;
- [weakSelf commentHander];
- }];
- [self.commentScrollBtn setAction:^{
- weakSelf.isScrComment = !weakSelf.isScrComment;
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf scrollToCommentViewTop];
- });
- }];
- }
-
- [self.view addSubview:self.noteBookShareVC.view];
- [self.view addSubview:self.commentInputView];
- self.tableView.tableHeaderView = self.webView;
- self.webView.UIDelegate = self;
- self.webView.navigationDelegate = self;
- self.webView.scrollView.delegate = self;
- [self headRefresh];
- // UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
- // if (weakSelf.currentNoteModel.UserId == [AppUserModel sharedAppUserModel].Id) {
- // [weakSelf editorButtonHander];
- // }
- // }];
- // [self.webView addGestureRecognizer:tap];
- // self.webView.userInteractionEnabled = YES;
- // tap.numberOfTouchesRequired = 2;
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuShow) name:UIMenuControllerDidShowMenuNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(collectSuccess) name:COLLECTSUCCESS object:nil];
- // 通知-监听键盘弹出事件
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeKeyboardWillShowNotification:) name:UIKeyboardWillShowNotification object:nil];
- // 通知-监听键盘回收事
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeKeyboardWillHideNotification:) name:UIKeyboardWillHideNotification object:nil];
- [self createMenuItems];
- [self becomeFirstResponder];
- }
- #pragma mark - UIKeyBoradNotification
- - (void)changeKeyboardWillShowNotification:(NSNotification*)notification
- {
- WS(weakSelf);
- NSDictionary *userInfo = [notification userInfo];
- // 键盘弹出后的frame的结构体对象
- NSValue *valueEndFrame = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
- // 得到键盘弹出后的键盘视图所在y坐标
- CGFloat keyBoardEndY = valueEndFrame.CGRectValue.origin.y;
- // 键盘弹出的动画时间
- NSNumber *duration = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
- // 键盘弹出的动画曲线
- NSNumber *curve = [userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
- // 添加移动动画,使视图跟随键盘移动(动画时间和曲线都保持一致)
- [UIView animateWithDuration:[duration doubleValue] animations:^{
- [UIView setAnimationBeginsFromCurrentState:YES];
- [UIView setAnimationCurve:[curve intValue]];
- [UIView animateWithDuration:0.5 animations:^{
- [weakSelf.commentInputView startAnimationWithY:keyBoardEndY - 150.f];
- }];
- } completion:^(BOOL finished) {
-
- }];
- }
- - (void)changeKeyboardWillHideNotification:(NSNotification*)notification
- {
- WS(weakSelf);
- NSDictionary *userInfo = [notification userInfo];
- // 键盘弹出的动画时间
- NSNumber *duration = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
- // 键盘弹出的动画曲线
- NSNumber *curve = [userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
- [UIView animateWithDuration:[duration doubleValue]animations:^{
- [weakSelf.commentInputView startAnimationWithY:SCREEN_HEIGHT];
- [UIView setAnimationBeginsFromCurrentState:YES];
- [UIView setAnimationCurve:[curve intValue]];
- } completion:^(BOOL finished) {
- [weakSelf setCusMenuShare];
- }];
- }
- - (void)setTableViewRefresh{
- WS(weakSelf);
- self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [weakSelf headRefresh];
- }];
- self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
- [weakSelf footerRefresh];
- }];
- }
- - (void)setBottomViewData:(MyNoteBookDetailModel *)model
- {
- WS(weakSelf);
- __block MyNoteBookDetailModel * weakModel = model;
- self.IsCollect = model.IsCollect;
- dispatch_async(dispatch_get_main_queue(), ^{
- weakSelf.countComment = weakModel.CommentCount;
- if (weakModel.CommentCount == 0) {
- weakSelf.commentCountL.text = [NSString stringWithFormat:@"评 论"];
- }else{
- if (weakModel.CommentCount > 10000) {
- weakSelf.commentCountL.text = [NSString stringWithFormat:@"%.1f万\n评 论",weakModel.CommentCount / 10000.0];
- }else{
- weakSelf.commentCountL.text = [NSString stringWithFormat:@"%ld\n评 论",(long)weakModel.CommentCount];
- }
- }
- weakSelf.zanCountL.text = [NSString stringWithFormat:@"%ld",(long)weakModel.PraiseCount];
- weakSelf.collectL.text = [NSString stringWithFormat:@"%ld",(long)weakModel.CollectCount];
- weakSelf.shareCountL.text = [NSString stringWithFormat:@"%ld",(long)weakModel.RetransmissionCount];
-
- weakSelf.zanCountL.hidden = weakModel.PraiseCount == 0 ? YES : NO;
- weakSelf.collectL.hidden = weakModel.CollectCount == 0 ? YES : NO;
- weakSelf.shareCountL.hidden = weakModel.RetransmissionCount == 0 ? YES : NO;
-
- weakSelf.zanImgV.image = weakModel.IsPraise ? IMG(@"zan_yes"):IMG(@"zan_no");
- weakSelf.collectImgV.image = weakModel.IsCollect ? IMG(@"icon_collect_off"):IMG(@"收藏五角星");
- weakSelf.shareImgV.image = IMG(@"icon_share");
- weakSelf.zanCountL.textColor = weakModel.IsPraise ? UIColorHex(#009AFF):UIColorHex(#999999);
- weakSelf.collectL.textColor = weakModel.IsCollect ? UIColorHex(#009AFF):UIColorHex(#999999);
- weakSelf.shareCountL.textColor = UIColorHex(#009AFF);
- [weakSelf.collectButton setAction:^{
- weakSelf.dismissSelf = YES;
- if (weakModel.IsCollect) {
- dispatch_async(dispatch_get_main_queue(), ^{
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"真的取消收藏吗?" message:nil preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:@(weakSelf.Id) forKey:@"CollectionDataId"];
- /// 1文章 2话题 3 收藏 4笔记 5通知 6站内信 7小组 8 会议详情 14工作流审批 300 文件 400 会议纪要
- NSInteger type = weakSelf.type;
- [dic setValue:@(type) forKey:@"CollectionType"];
- [dic setValue:@(0) forKey:@"FolderId"];
- [dic setValue:@(0) forKey:@"SourceUserId"];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_CreateCollect) parameters:dic success:^(id _Nonnull responseObject) {
- [weakSelf refreshData];
- weakSelf.IsCollect = NO;
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- });
- [weakSelf setCusMenuShare];
- }];
- UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf setCusMenuShare];
- }];
- [alert addAction:actionYes];
- [alert addAction:actionNo];
- [weakSelf presentViewController:alert animated:YES completion:^{
-
- }];
- });
- }else{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf gotoCollectHander];
- });
- }
- }];
- });
- }
- #pragma mark - 网络请求数据
- - (void)getNoticeData
- {
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_Notice_Detail),(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"通知正文%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- weakSelf.sendUserId = weakSelf.currentNoteModel.UserId;
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
-
- NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//通知 2
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
-
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//通知 2
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)getTopic{
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_App_Detail) parameters:@{@"Id":@(self.Id),@"UserId":@([AppUserModel sharedAppUserModel].Id)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"话题正文%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
-
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)getMeeting{
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSString * meetId = [NSString stringWithFormat:@"%ld",(long)weakSelf.Id];
- [[HttpManager sharedHttpManager] GETUrl:Host(UpdateMeeting(meetId)) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
-
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)getNote{
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_NoteBook_Detail,(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"笔记正文%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
-
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)getAritle{
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,[NSString stringWithFormat:@"/api/app/article/detail/%ld",self.Id]] parameters:@{@"id":@(self.Id)}
- responseStyle:JOSN success:^(id _Nonnull responseObject) {
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
-
- }];
- NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)getMediaAritle{
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Media),weakSelf.Id];
- [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- }];
- NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- if (++httpFinishCount == 3) {
- dispatch_semaphore_signal(sem);
- }
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)getMail
- {
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_InterLetterDetail),(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- NSArray * array = responseObject[@"Items"];
- if ([array.firstObject isKindOfClass:[NSDictionary class]]) {
- weakSelf.sendUserId = [[array.firstObject objectForKey:@"UserId"] integerValue];
- }
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:array.firstObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- #pragma mark - 刷新点赞数据
- - (void)refreshNoticeData
- {
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_Notice_Detail),(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"通知正文%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
-
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//通知 2
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)refreshTopicData
- {
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_App_Detail) parameters:@{@"Id":@(self.Id),@"UserId":@([AppUserModel sharedAppUserModel].Id)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"话题正文%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)refreshMeetingData
- {
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSString * meetId = [NSString stringWithFormat:@"%ld",(long)weakSelf.Id];
- [[HttpManager sharedHttpManager] GETUrl:Host(UpdateMeeting(meetId)) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)refreshNoteData
- {
- WS(weakSelf);
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_NoteBook_Detail,(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"话题正文%@",responseObject);
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)refreshAritleData
- {
- WS(weakSelf);
- SHOWLOADING
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,[NSString stringWithFormat:@"/api/app/article/detail/%ld",self.Id]] parameters:@{@"id":@(self.Id)}
- responseStyle:JOSN success:^(id _Nonnull responseObject) {
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- REMOVESHOW
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (void)refreshMediaAritleData
- {
- WS(weakSelf);
- SHOWLOADING
- dispatch_semaphore_t sem = dispatch_semaphore_create(0);
- __block NSInteger httpFinishCount = 0;
- [[HttpManager sharedHttpManager] cancelRequest];
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Media),weakSelf.Id];
- [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
- weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- }else{
- NSLog(@"asfasfas");
- }
- } failure:^(NSError * _Nonnull error) {
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- }];
- NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//会议 10
- @"Page":@(1),
- @"PerPage":@(20),
- @"sort":@""
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"点赞列表%@",responseObject);
- weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- } failure:^(NSError * _Nonnull error) {
- if (++httpFinishCount == 2) {
- dispatch_semaphore_signal(sem);
- }
- }];
- dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
- dispatch_async(dispatch_get_main_queue(), ^{
- REMOVESHOW
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf setBottomViewData:weakSelf.currentNoteModel];
- [weakSelf.tableView reloadData];
- });
- });
- }
- - (MHTopicFrame *)_topicFrameWithTopic:(MHTopic *)topic
- {
- MHTopicFrame *topicFrame = [[MHTopicFrame alloc] init];
- // 传递微博模型数据,计算所有子控件的frame
- topicFrame.topic = topic;
-
- return topicFrame;
- }
- - (void)sortCommentList
- {
- WS(weakSelf);
- NSArray * array = self.commentArray;
- self.commentArray =[NSMutableArray arrayWithArray:[[array reverseObjectEnumerator] allObjects]];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- }
- - (void)RefreshCommentList
- {
- WS(weakSelf);
- [self.commentArray removeAllObjects];
- self.currentPage = 1;
- NSDictionary * paraDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":weakSelf.isSort ? @"asc":@"desc"
- };
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
-
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- weakSelf.dismissSelf = NO;
- });
- });
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)headRefresh{
- self.isFresh = YES;
- self.currentPage = 1;
- [self.commentArray removeAllObjects];
- [self loadDataWebView];
- switch (self.type) {
- case CollectModel_Notice:
- {
- [self getNoticeData];
- }
- break;
- case CollectModel_Toipc:
- {
- [self getTopic];
- }
- break;
- case CollectModel_NewTopic:
- {
- [self getNote];
- }
- break;
- case CollectModel_Group:
- {
- [self getTopic];
- }
- break;
- case CollectModel_meetMian:
- {
- [self getMeeting];
- }
- break;
-
- case CollectModel_NoteBook:
- {
- [self getNote];
- }
- break;
- case CollectModel_InterMail:
- {
- [self getMail];
- }
- break;
- case CollectModel_NoSignMail:
- {
- [self getMail];
- }
- break;
- case CollectModel_Aritle:
- {
- [self getAritle];
- }
- break;
- case CollectModel_MediaAritle:
- {
- [self getMediaAritle];
- }
- break;
- default:
- break;
- }
- }
- - (void)footerRefresh{
- self.isFresh = NO;
- self.currentPage += 1;
- if (self.commentArray.count == self.currentNoteCommentModel.Total) {
- self.tableView.mj_footer.hidden = YES;
- [self.tableView.mj_footer resetNoMoreData];
- return;
- }
- NSDictionary * paraDict = @{@"ArticleId":@(self.Id),
- @"TypeValue":@([self backTypeValue]),//话题 1
- @"Page":@(self.currentPage),
- @"PerPage":@(20),
- @"sort":self.isSort ? @"asc":@"desc"
- };
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"评论数据列表%@",responseObject);
- if ([responseObject isKindOfClass:[NSDictionary class]]) {
-
- if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
- for (NSDictionary * dict in responseObject[@"Items"]) {
- MHTopic * topic = [MHTopic modelWithDictionary:dict];
- if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
- NSMutableArray * subArray = [NSMutableArray array];
- for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
- MHComment * commentModel = [MHComment modelWithDictionary:subDict];
- [subArray addObject:commentModel];
- }
- topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
- }
- [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
- }
- }
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- weakSelf.currentPage -= 1;
- }];
- [self.tableView.mj_footer endRefreshing];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- if (self.type == CollectModel_InterMail || self.type == CollectModel_NoSignMail) {
- return 1;
- }
- return 2;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- if (self.currentZanModel.Items.count == 0) {
- switch (section) {
- case 0:
- return 0;
- break;
- default:
- return self.commentArray.count;
- break;
- }
- }else{
- switch (section) {
- case 0:
- return 1;
- break;
- default:
- return self.commentArray.count;
- break;
- }
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (self.currentZanModel.Items.count == 0 && self.commentArray.count == 0) {
- MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
- if (topicFrame.tableViewFrame.size.height == 0) {
- return topicFrame.height+topicFrame.tableViewFrame.size.height;
- }else{
- return topicFrame.height+topicFrame.tableViewFrame.size.height+MHTopicVerticalSpace;
- }
- }else{
- switch (indexPath.section) {
- case 0:
- return UITableViewAutomaticDimension;
- break;
- default:
- {
- MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
- if (topicFrame.tableViewFrame.size.height == 0) {
- return topicFrame.height + topicFrame.tableViewFrame.size.height;
- }else{
- return topicFrame.height + topicFrame.tableViewFrame.size.height;
- }
- }
- break;
- }
- }
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- WS(weakSelf);
- if (self.currentZanModel.Items.count == 0 && self.commentArray.count == 0) {
- MHTopicCell *cell = [MHTopicCell cellWithTableView:tableView];
- cell.backgroundColor = [UIColor whiteColor];
- MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
- cell.topicFrame = topicFrame;
- cell.createTimeLabel.text = [NSString stringWithFormat:@"%@ %@",topicFrame.topic.FloorCount,topicFrame.topic.CreatedTime];
- [cell.thumbBtn setAction:^{
- [weakSelf gotoZanCommentHanderModel:topicFrame.topic indexPath:indexPath];
- }];
- cell.replyContentBlock = ^{
- [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
- // if (topicFrame.topic.UserId != [AppUserModel sharedAppUserModel].Id) {
- // [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
- // }
- };
- __block MHTopicCell * bCell = cell;
- cell.longBlock = ^{
- weakSelf.commentId = topicFrame.topic.Id;
- weakSelf.commentStr = topicFrame.topic.Content;
- weakSelf.isSelf = topicFrame.topic.UserId == [AppUserModel sharedAppUserModel].Id;
- if (weakSelf.isSelf) {
- [weakSelf longDeleteSelf:bCell];
- }
- };
- cell.longSubBlock = ^(NSInteger commentId,UILabel * label,NSString * Content) {
- weakSelf.commentId = commentId;
- weakSelf.commentStr = Content;
- [weakSelf longDeleteSubCell:label];
- };
- cell.delegate = self;
- return cell;
- }else{
- switch (indexPath.section) {
- case 0:{
- WS(weakSelf);
- NoteBookDetailCell *cell = [NoteBookDetailCell configCell3:tableView indexPath:indexPath];
- cell.commentSortBtn.hidden = self.commentArray.count == 0 ? YES : NO;
- [cell.commentSortBtn setAction:^{
- weakSelf.isSort = !weakSelf.isSort;
- cell.commentSortBtn.selected = !cell.commentSortBtn.isSelected;
- [weakSelf sortCommentList];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- weakSelf.isScrComment = YES;
- [weakSelf scrollToCommentViewTop];
- });
- }];
- switch (self.currentZanModel.Items.count) {
- case 0:{
- cell.zanNameLabel.text = @"";
- cell.zanNumberlabel.text = @"";
- }break;
- case 1:{
- MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
- cell.zanNameLabel.text = model.UserName;
- cell.zanNumberlabel.text = [NSString stringWithFormat:@" %lu人点赞",(unsigned long)self.currentZanModel.Items.count];
- }break;
- case 2:{
- MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
- MyNoteBookZanSubModel *model1 = self.currentZanModel.Items[1];
- cell.zanNameLabel.text = [NSString stringWithFormat:@"%@、%@",model.UserName,model1.UserName];
- cell.zanNumberlabel.text = [NSString stringWithFormat:@" %lu人点赞",(unsigned long)self.currentZanModel.Items.count];
- }break;
- case 3:{
- MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
- MyNoteBookZanSubModel *model1 = self.currentZanModel.Items[1];
- MyNoteBookZanSubModel *model2 = self.currentZanModel.Items[2];
- cell.zanNameLabel.text = [NSString stringWithFormat:@"%@、%@、%@",model.UserName,model1.UserName,model2.UserName];
- cell.zanNumberlabel.text = [NSString stringWithFormat:@" %lu人点赞",(unsigned long)self.currentZanModel.Items.count];
- }break;
- default:{
- MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
- MyNoteBookZanSubModel *model1 = self.currentZanModel.Items[1];
- MyNoteBookZanSubModel *model2 = self.currentZanModel.Items[2];
- cell.zanNameLabel.text = [NSString stringWithFormat:@"%@、%@、%@",model.UserName,model1.UserName,model2.UserName];
- cell.zanNumberlabel.text = [NSString stringWithFormat:@" 等%lu人点赞",(unsigned long)self.currentZanModel.Total];
- }break;
- }
- return cell;
- }break;
- default:{
- MHTopicCell *cell = [MHTopicCell cellWithTableView:tableView];
- MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
- cell.topicFrame = topicFrame;
- cell.createTimeLabel.text = [NSString stringWithFormat:@"%@ %@",topicFrame.topic.FloorCount,topicFrame.topic.CreatedTime];
- [cell.thumbBtn setAction:^{
- [weakSelf gotoZanCommentHanderModel:topicFrame.topic indexPath:indexPath];
- }];
- cell.replyContentBlock = ^{
- [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
- // if (topicFrame.topic.UserId != [AppUserModel sharedAppUserModel].Id) {
- // [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
- // }
- };
- __block MHTopicCell * bCell = cell;
- cell.longBlock = ^{
- weakSelf.commentId = topicFrame.topic.Id;
- weakSelf.commentStr = topicFrame.topic.Content;
- weakSelf.isSelf = topicFrame.topic.UserId == [AppUserModel sharedAppUserModel].Id;
- if (weakSelf.isSelf) {
- [weakSelf longDeleteSelf:bCell];
- }
- };
- cell.longSubBlock = ^(NSInteger commentId,UILabel * label,NSString * Content) {
- weakSelf.commentId = commentId;
- weakSelf.commentStr = Content;
- [weakSelf longDeleteSubCell:label];
- };
- cell.delegate = self;
- return cell;
- }break;
- }
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- if (self.currentZanModel.Items.count > 0) {
- switch (indexPath.section) {
- case 0://点赞
- {
- ClickOKViewController *vc = [ClickOKViewController initClickOKViewController];
- vc.indexId = self.Id;
- vc.zanToTal = self.currentZanModel.Items.count;
- vc.type = [self backTypeValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- default:
- break;
- }
- }
- }
- #pragma mark - 点击文件跳转
- - (void)pushVCWithDict:(NSDictionary *)dict
- {
- NSInteger Id = [dict[@"id"] integerValue];
- NSInteger userId = [dict[@"userId"] integerValue];
- NSString * title = dict[@"title"];
- WS(weakSelf);
- switch ([dict[@"type"] integerValue]) {
- case CollectModel_Group:
- {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = Id;
- vc.titleStr = title;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_file:{
- DownFileViewController * vc = [[DownFileViewController alloc] init];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.Title = title;
- model.SoureId = Id;
- model.Url = dict[@"bigurl"];
- model.MinUrl = dict[@"smallurl"];
- model.SoureTypeId = CollectModel_file;
- vc.model = model;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Image:{
- DownFileViewController * vc = [[DownFileViewController alloc] init];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.Title = title;
- model.SoureId = Id;
- model.Url = dict[@"bigurl"];
- model.MinUrl = dict[@"smallurl"];
- model.SoureTypeId = CollectModel_Image;
- vc.model = model;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Aritle:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Aritle;
- vc.Id = Id;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_MediaAritle:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Aritle;
- vc.Id = Id;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Notice:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Notice;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_TopicBooK:{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeA ;
- vc.FolderId = Id;
- vc.CollectionDataId = Id;
- vc.CollectionType = CollectModel_TopicBooK;
- vc.Author = title;
- vc.TypeValue = 1;
- vc.myTitle = title;
- vc.VisitUserId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_TopicSubBooK:{
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = MyFavoriteListLevelTypeB ;
- vc.FolderId = Id;
- vc.CollectionDataId = Id;
- vc.CollectionType = CollectModel_TopicSubBooK;
- vc.Author = title;
- vc.TypeValue = 1;
- vc.myTitle = title;
- vc.VisitUserId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Toipc:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NewTopic:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NoteBook:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NoteBook;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Collect:{
-
- }break;
- case CollectModel_CollectFile:{
- if (userId == [AppUserModel sharedAppUserModel].Id) {
- MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- vc.VisitUserId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_NoteFile:{
- if (userId == [AppUserModel sharedAppUserModel].Id) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- vc.TypeValue = 1;
- vc.VisitUserId = 0;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- vc.TypeValue = 1;
- vc.VisitUserId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_InterMail:{
- TDInterLeterDetailVC * vc = [TDInterLeterDetailVC initTDInterLeterDetailVC];
- vc.detailType = InterLeterDetialType_Sign;
- vc.interLeterID = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NoSignMail:{
- TDInterLeterDetailVC * vc = [TDInterLeterDetailVC initTDInterLeterDetailVC];
- vc.detailType = InterLeterDetialType_NoSign;
- vc.interLeterID = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_work:{
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = Id;
- vc.title = title;
- vc.TodoId = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_StoreSound:
- {
- BookListenVC * vc = [BookListenVC initBookListenVC];
- vc.Id = Id;
- vc.MediaType = MediaMusicType;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_StoreVideo:
- {
- BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetDetail:{
- WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:Id];
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_meetMian:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_meetMian;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_financeCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 0;
- vc.titleStr = @"财务统计";
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_affairsCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 1;
- vc.titleStr = @"人事统计";
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_publishCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 2;
- vc.titleStr = @"出版统计";
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- break;
- }
- }
- #pragma mark - 操作 (删除 | 编辑 | 点赞列表 | 点赞正文 | 评论正文 | 转发正文 | 点赞评论 )
- /// 删除
- - (void)deleteButtonHander{
- WS(weakSelf);
- NSString * title = @"确认删除";
- switch (self.type) {
- case CollectModel_Notice:
- {
- title = @"确认撤回";
- }
- break;
- case CollectModel_InterMail:
- {
- title = @"确认撤回";
- }
- break;
- default:
- {
- title = @"确认删除";
- }
- break;
- }
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:(UIAlertControllerStyleAlert)];
- UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf cancelAction];
- }];
- UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- }];
- [alert addAction:sureAction];
- [alert addAction:cancelAction];
- [weakSelf presentViewController:alert animated:YES completion:^{
- }];
- }
- - (void)cancelAction
- {
- WS(weakSelf);
- switch (self.type) {
- case CollectModel_Toipc:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Topic),(long)self.Id];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"删除成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
-
- }];
- }
- break;
- case CollectModel_NewTopic:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NoteBook_Detail),(long)self.Id];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"删除成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case CollectModel_Group:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NoteBook_Detail),(long)self.Id];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"删除成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- break;
- case CollectModel_Notice:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NOTICE_RECALL),(long)self.Id];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"撤回成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- break;
- case CollectModel_NoteBook:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NoteBook_Detail),(long)self.Id];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"删除成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- break;
- case CollectModel_InterMail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NOTICE_RECALL),(long)self.Id];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"撤回成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- break;
- case CollectModel_meetMian:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/api/app/meeting/summary/"),(long)self.Id];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"撤回成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- break;
- case CollectModel_NoSignMail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NOTICE_RECALL),(long)self.Id];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"撤回成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- }];
- }
- break;
- default:
- break;
- }
- }
- /// 编辑
- - (void)editorButtonHander{
- self.webH = 0;
- WS(weakSelf);
- if (self.RefreshTopicBlock) {
- self.RefreshTopicBlock();
- }
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.upDateBlock = ^{
- [weakSelf headRefresh];
- };
- vc.isEdit = YES;
- vc.FolderId = self.currentNoteModel.FolderId;
- vc.FolderName = self.currentNoteModel.FolderId == 0 ? @"根目录" :self.currentNoteModel.FolderName;
- vc.replayType = MailReplayEdit;
- switch (self.type) {
- case CollectModel_Notice:
- {
- vc.MailType = 3;
- vc.type = self.type;
- }
- break;
- case CollectModel_InterMail:
- {
- vc.MailType = 1;
- vc.type = self.type;
- }
- break;
- case CollectModel_NoSignMail:
- {
- vc.MailType = 2;
- vc.type = CollectModel_InterMail;
- }
- break;
- default:
- {
- vc.type = self.type;
- }
- break;
- }
- vc.Id = self.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- /// 转发正文
- - (void)ShareDetail{
- SHOWLOADING
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setValue:@(self.Id) forKey:@"SourceId"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [dic setValue:@(4) forKey:@"AnalyzeType"];///转发
- [dic setValue:@(0) forKey:@"CommentId"];
- [dic setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf refreshData];
- weakSelf.IsShareText = NO;
- [weakSelf shareHander];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- weakSelf.isScrComment = YES;
- [weakSelf scrollToCommentViewTop];
- });
- [weakSelf setCusMenuShare];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- [weakSelf setCusMenuShare];
- }];
- }
- /// 点赞正文
- - (void)gotoZanHander{
- SHOWLOADING
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setValue:@(self.Id) forKey:@"SourceId"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞
- [dic setValue:@(0) forKey:@"CommentId"];
- [dic setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- weakSelf.currentNoteModel.IsPraise = !weakSelf.currentNoteModel.IsPraise;
- if (weakSelf.currentNoteModel.IsPraise) {
- SHOWSUCCESS(@"点赞成功");
- }else{
- SHOWSUCCESS(@"已取消点赞");
- }
- [weakSelf refreshData];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- weakSelf.isScrComment = YES;
- [weakSelf scrollToCommentViewTop];
- [weakSelf setCusMenuShare];
- });
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- [weakSelf setCusMenuShare];
- }];
- }
- /// 评论正文
- - (void)commentHander{
- [self.commentInputView startEditing];
- WEAKSELF
- self.commentInputView.inputBlock = ^(NSString * _Nonnull content) {
- NSLog(@"%@",content);
- [weakSelf setCusMenuShare];
- [weakSelf sendCommentToServerWithcontent:content];
- };
- }
- - (void)sendCommentToServerWithcontent:(NSString *)content
- {
- WS(weakSelf);
- NSMutableDictionary *dicc = [NSMutableDictionary dictionary];
- [dicc setValue:@(self.Id) forKey:@"ArticleId"];
- [dicc setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [dicc setValue:content forKey:@"Content"];
- [dicc setValue:@(0) forKey:@"Pid"];//回复评论时用到的ID
- [dicc setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
- NSLog(@"%@",dicc);
-
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_Add) parameters:dicc responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"评论成功");
- weakSelf.countComment ++;
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- if (weakSelf.countComment == 0) {
- self.commentCountL.text = [NSString stringWithFormat:@"评 论"];
- }else{
- if (weakSelf.countComment >= 10000) {
- weakSelf.commentCountL.text = [NSString stringWithFormat:@"%.1f万\n评 论",weakSelf.countComment / 10000.0];
- }else{
- weakSelf.commentCountL.text = [NSString stringWithFormat:@"%ld\n评 论",(long)weakSelf.countComment];
- }
- }
- [weakSelf RefreshCommentList];
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- /// 转发正文
- - (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:@"发给微信好友"]) {
- [self returnToWechatSession];
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
- [self returnToWechatTimeLine];
- }else if ([typeName isEqualToString:@"发到微博"]){
- [self returnToSina];
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
- [self returnToQQ];
- }else if ([typeName isEqualToString:@"发到消息"]){
- [self returnToMessage];
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
-
- }
- }
- - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
- {
- //创建分享消息对象
- UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
-
- messageObject.title = title;
- //创建网页内容对象
- UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
- //设置网页地址
- shareObject.webpageUrl = url;
-
- //分享消息对象设置分享内容对象
- messageObject.shareObject = shareObject;
-
- //调用分享接口
- [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
- if (error) {
- NSLog(@"************Share fail with error %@*********",error);
- }else{
- NSLog(@"response data is %@",data);
- }
- }];
- }
- - (void)returnToWechatSession
- {
- NSString * name = @"";
- if (![self.currentNoteModel.Name isKindOfClass:[NSNull class]] && self.currentNoteModel.Name.length > 0) {
- name = self.currentNoteModel.Name;
- }else if(![self.currentNoteModel.UserName isKindOfClass:[NSNull class]] && self.currentNoteModel.UserName.length > 0) {
- name = self.currentNoteModel.UserName;
- }
- if (self.type == CollectModel_NoSignMail) {
- name = @"匿名";
- }
- if (self.type == CollectModel_Toipc) {
- name = [NSString stringWithFormat:@"%@ 来自-%@",name, self.currentNoteModel.GroupName];
- }
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.currentNoteModel.Title desc:name url:[self returnUrl] img:[self returnImage]];
- }
- - (void)returnToWechatTimeLine
- {
- NSString * name = @"";
- if (![self.currentNoteModel.Name isKindOfClass:[NSNull class]] && self.currentNoteModel.Name.length > 0) {
- name = self.currentNoteModel.Name;
- }else if(![self.currentNoteModel.UserName isKindOfClass:[NSNull class]] && self.currentNoteModel.UserName.length > 0) {
- name = self.currentNoteModel.UserName;
- }
- if (self.type == CollectModel_NoSignMail) {
- name = @"匿名";
- }
- if (self.type == CollectModel_Toipc) {
- name = [NSString stringWithFormat:@"%@ 来自-%@",name, self.currentNoteModel.GroupName];
- }
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.currentNoteModel.Title desc:name url:[self returnUrl] img:[self returnImage]];
- }
- - (void)returnToSina
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.currentNoteModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.currentNoteModel.Name] url:[self returnUrl] img:[self returnImage]];
- }
- - (void)returnToQQ
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.currentNoteModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.currentNoteModel.Name] url:[self returnUrl] img:[self returnImage]];
- }
- - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url img:(NSString *)image
- {
- //创建分享消息对象
- UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
-
- messageObject.title = title;
- //创建网页内容对象
- UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:[UIImage imageNamed:image]];
- //设置网页地址
- shareObject.webpageUrl = url;
-
- //分享消息对象设置分享内容对象
- messageObject.shareObject = shareObject;
-
- //调用分享接口
- [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
- if (error) {
- NSLog(@"************Share fail with error %@*********",error);
- }else{
- NSLog(@"response data is %@",data);
- }
- }];
- }
- - (NSString *)returnUrl
- {
- switch (self.type) {
- case CollectModel_Group:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/topicDetailsWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_Toipc:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/topicDetailsWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_NewTopic:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noteDetailsWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_Notice:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noticeDetailsWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_NoteBook:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noteDetailsWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_InterMail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/mailWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_NoSignMail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/mailWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_meetMian:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/minutesMeetingWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_meetDetail:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/meetingWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_Aritle:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/mainText?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- case CollectModel_NoteFile:
- {
- NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=13&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.currentNoteModel.Id,[AppUserModel sharedAppUserModel].Id,[AppUserModel sharedAppUserModel].Name,@"笔记文件夹"];
- return url;
- }
- break;
- case CollectModel_CollectFile:
- {
- NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=12&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.currentNoteModel.Id,[AppUserModel sharedAppUserModel].Id,[AppUserModel sharedAppUserModel].Name,@"收藏文件夹"];
- return url;
- }
- break;
- case CollectModel_TopicBooK:
- {
- NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=12&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.currentNoteModel.Id,[AppUserModel sharedAppUserModel].Id,[AppUserModel sharedAppUserModel].Name,@"文件夹"];
- return url;
- }
- break;
- case CollectModel_TopicSubBooK:
- {
- NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=12&userId=%ld&name=%@&describe=%@",ShareHost(@"mobile/folderWx?"),(long)self.currentNoteModel.Id,[AppUserModel sharedAppUserModel].Id,[AppUserModel sharedAppUserModel].Name,@"文件夹"];
- return url;
- }
- break;
- case CollectModel_work:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- default:
- {
- NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noticeDetailsWx?"),(long)self.currentNoteModel.Id];
- return url;
- }
- break;
- }
- return @"";
- }
- - (NSString *)returnImage
- {
- switch (self.type) {
- case CollectModel_Group:
- {
- NSString * url = @"笔记小组";
- return url;
- }
- break;
- case CollectModel_Toipc:
- {
- NSString * url = @"话题";
- return url;
- }
- break;
- case CollectModel_NewTopic:
- {
- NSString * url = @"话题";
- return url;
- }
- break;
- case CollectModel_Notice:
- {
- NSString * url = @"通知图标";
- return url;
- }
- break;
- case CollectModel_NoteBook:
- {
- NSString * url = @"noteBook_icon";
- return url;
- }
- break;
- case CollectModel_NoteFile:
- {
- NSString * url = @"share_file";
- return url;
- }
- break;
- case CollectModel_CollectFile:
- {
- NSString * url = @"share_file";
- return url;
- }
- break;
- case CollectModel_InterMail:
- {
- NSString * url = @"站内信";
- return url;
- }
- break;
- case CollectModel_NoSignMail:
- {
- NSString * url = @"站内信";
- return url;
- }
- break;
- case CollectModel_meetMian:
- {
- NSString * url = @"会议纪要";
- return url;
- }
- break;
- case CollectModel_meetDetail:
- {
- NSString * url = @"会议";
- return url;
- }
- break;
- case CollectModel_Aritle:
- {
- NSString * url = @"文章";
- return url;
- }
- break;
- case CollectModel_TopicBooK:
- {
- NSString * url = @"topicBook";
- return url;
- }
- break;
- case CollectModel_TopicSubBooK:
- {
- NSString * url = @"share_file";
- return url;
- }
- break;
- default:
- {
- NSString * url = @"笔记文章";
- return url;
- }
- break;
- }
- return @"";
- }
- #pragma mark - 分享功能
- - (void)returnToMessage
- {
- ShareListVC * vc = [ShareListVC initShareListVC];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureId = self.Id;
- model.SoureTypeId = self.type;
- model.Title = self.currentNoteModel.Title;
- model.Author = self.currentNoteModel.UserName;
- model.GroupId = self.currentNoteModel.GroupId;
- model.GroupName = self.currentNoteModel.GroupName;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- vc.type = CollectModel_Toipc;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureId = self.Id;
- model.SoureTypeId = self.type;
- model.Title = self.currentNoteModel.Title;
- model.Author = self.currentNoteModel.UserName ? self.currentNoteModel.UserName : self.currentNoteModel.Name;
- model.SourceUserId = self.currentNoteModel.UserId;
- model.GroupId = self.currentNoteModel.GroupId;
- model.GroupName = self.currentNoteModel.GroupName;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MoveViewController * vc = [MoveViewController initMoveViewController];
- vc.isFromCreateBookVc = YES;
- vc.TypeId = CreateNotesType;
- vc.CollectionType = CollectModel_NoteBook;
- vc.titleStr = @"我的笔记";
- vc.ParentId = 0;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- if (self.IsShareText) {
- model.Title = self.shareText;
- model.SoureTypeId = 1;
- }else{
- model.SoureId = self.Id;
- model.SoureTypeId = self.type;
- model.Title = self.currentNoteModel.Title;
- model.Author = self.currentNoteModel.UserName ? self.currentNoteModel.UserName : self.currentNoteModel.Name;
- model.SourceUserId = self.currentNoteModel.UserId;
- model.GroupId = self.currentNoteModel.GroupId;
- model.GroupName = self.currentNoteModel.GroupName;
- vc.type = CollectModel_NoteBook;
- }
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NewTopic;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- if (self.IsShareText) {
- model.Title = self.shareText;
- model.SoureTypeId = 1;
- }else{
- model.SoureId = self.Id;
- model.SoureTypeId = self.type;
- model.Title = self.currentNoteModel.Title;
- model.Author = self.currentNoteModel.UserName ? self.currentNoteModel.UserName : self.currentNoteModel.Name;
- model.SourceUserId = self.currentNoteModel.UserId;
- model.GroupId = self.currentNoteModel.GroupId;
- model.GroupName = self.currentNoteModel.GroupName;
- vc.type = CollectModel_NewTopic;
- }
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- /// 点赞评论
- - (void)gotoZanCommentHanderModel:(MHTopic *)model indexPath:(NSIndexPath *)indexPath{
- NSMutableDictionary *dic = [NSMutableDictionary dictionary];
- [dic setValue:@(self.Id) forKey:@"SourceId"];
- [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [dic setValue:@(2) forKey:@"AnalyzeType"];//详情点赞
- [dic setValue:@(model.Id) forKey:@"CommentId"];
- [dic setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
- WS(weakSelf);
-
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- model.IsLaud = !model.IsLaud;
- if (model.IsLaud) {
- SHOWSUCCESS(@"点赞成功");
- }else{
- SHOWSUCCESS(@"已取消点赞");
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
- });
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)gotoCollectHander{
- MoveViewController *vc = [MoveViewController initMoveViewController];
- //NSInteger meetId = [self.dataDict[@"MeetingId"] integerValue];
- vc.CollectionDataId = self.Id;
- vc.collectType = CollectHanderType_Collect;
- vc.CollectionType = self.type == CollectModel_NoSignMail ? CollectModel_InterMail : self.type;
- vc.ParentId = 0;
- vc.titleStr = @"我的收藏";
- vc.TypeId = CreateCollectionType;
- vc.FolderIds = @[].mutableCopy;
- // 收藏类型 1文章 2话题 3 收藏 4笔记 5通知 6站内信 7小组 8 会议详情 14工作流审批 300 文件 400 会议纪要
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)collectSuccess
- {
- NSString *jsonString = [NSString stringWithFormat:@"showCollection('%d')",1];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- NSLog(@"12313");
- WS(weakSelf);
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf refreshData];
- weakSelf.IsCollect = YES;
- });
- }
- - (NSMutableArray<MyNoteBookCommentSubModel *> *)commentArray{
- if (!_commentArray) {
- _commentArray = [NSMutableArray array];
- }
- return _commentArray;
- }
- - (TextInputView *)commentInputView {
- if (!_commentInputView) {
- _commentInputView = [[TextInputView alloc] initWithFrame:[UIScreen mainScreen].bounds];
- }
- return _commentInputView;
- }
- #pragma mark - MHTopicCellDelegate
- - (void)topicCellForClickedThumbAction:(MHTopicCell *)topicCell
- {
- /**
- * 这里点击事件自行根据自己UI处理
- *
- */
- NSLog(@"---点击👍按钮---");
- }
- - (void)topicCellForClickedMoreAction:(MHTopicCell *)topicCell
- {
- /**
- * 这里点击事件自行根据自己UI处理
- *
- */
- // 修改数据源方法
- MHTopic *topic = topicCell.topicFrame.topic;
- topic.IsLaud = !topic.IsLaud;
- if (topic.IsLaud) {
- // topic.thumbNums+=1;
- // }else{
- // topic.thumbNums-=1;
- }
-
- // 刷新数据
- [self.tableView reloadData];
- }
- - (void)topicCellDidClickedUser:(MHTopicCell *)topicCell
- {
- NSLog(@"======%ld",(long)topicCell.topicFrame.topic.UserId);
- MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = topicCell.topicFrame.topic.UserId;
- [self.navigationController pushViewController:vc animated:YES];
- // MHUserInfoController *userInfo = [[MHUserInfoController alloc] init];
- // userInfo.user = topicCell.topicFrame.topic.user;
- // [self.navigationController pushViewController:userInfo animated:YES];
- }
- - (void)topicCell:(MHTopicCell *)topicCell didClickedUser:(NSString *)userId
- {
- NSLog(@"======%@",userId);
-
- // MHUserInfoController *userInfo = [[MHUserInfoController alloc] init];
- // userInfo.user = user;
- // [self.navigationController pushViewController:userInfo animated:YES];
- }
- - (void)topicCell:(MHTopicCell *)topicCell didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- MHTopicFrame *topicFrame = topicCell.topicFrame;
- MHCommentFrame *commentFrame = topicFrame.commentFrames[indexPath.row];
- NSLog(@"这里回复 -- :%@",commentFrame.comment.Id);
- if (commentFrame.comment.UserId != [AppUserModel sharedAppUserModel].Id) {
- [self replyCommentName:commentFrame.comment.Name andId:commentFrame.comment.Id];
- }
- }
- #pragma mark - 长按删除评论Cell
- - (void)longDeleteSelf:(MHTopicCell *)cell
- {
- [self becomeFirstResponder];
- UIMenuController *menu = [UIMenuController sharedMenuController];
- // UIMenuItem *copyItem = [[UIMenuItem alloc] initWithTitle:@"复制" action:@selector(copyItemAction:)];
- UIMenuItem *deleteItem = [[UIMenuItem alloc] initWithTitle:@"删除" action:@selector(deleteItemAction:)];
- UIMenuItem *upDateItem = [[UIMenuItem alloc] initWithTitle:@"编辑" action:@selector(upDateItemAction:)];
- [menu setMenuItems: @[deleteItem,upDateItem]];
- NSLog(@"%@",NSStringFromCGRect(cell.frame));
- [menu setTargetRect:cell.contentLabel.frame inView:cell];
- [menu setMenuVisible:YES animated:NO];
- }
- - (void)longDeleteSubCell:(UILabel *)label
- {
- [self becomeFirstResponder];
- UIMenuController *menu = [UIMenuController sharedMenuController];
- UIMenuItem *deleteItem = [[UIMenuItem alloc] initWithTitle:@"删除" action:@selector(deleteItemAction:)];
- UIMenuItem *upDateItem = [[UIMenuItem alloc] initWithTitle:@"编辑" action:@selector(upDateItemAction:)];
- [menu setMenuItems: @[deleteItem,upDateItem]];
- [menu setTargetRect:label.frame inView:label];
- [menu setMenuVisible:YES animated:NO];
- }
- //-(BOOL)canBecomeFirstResponder
- //{
- // return YES;
- //}
- //是否可以接收某些菜单的某些交互操作
- //-(BOOL)canPerformAction:(SEL)action withSender:(id)sender{
- // return (action == @selector(deleteItemAction:)
- // ||action == @selector(upDateItemAction:));
- //}
- - (void)copyItemAction:(UIMenuItem *)item
- {
- UIPasteboard *pboard = [UIPasteboard generalPasteboard];
- pboard.string = self.commentStr;
- SHOWSUCCESS(@"复制成功");
- NSLog(@"选中-----%@", pboard.string);
- }
- - (void)deleteItemAction:(UIMenuItem *)item
- {
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] DeleteUrl:Host(API_APP_Comment_Delete) parameters:@{@"ArticleId":@(self.Id),@"CommentId":@(self.commentId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- SHOWSUCCESS(@"删除成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf headRefresh];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- }
- - (void)upDateItemAction:(UIMenuItem *)item
- {
- [self upDateComment];
- }
- - (void)upDateComment{
- self.dismissSelf = YES;
- [self.view endEditing:YES];
- [self.commentInputView setViewText:self.commentStr];
- [self.commentInputView startEditing];
- WS(weakSelf);
- self.commentInputView.inputBlock = ^(NSString * _Nonnull content) {
- SHOWLOADING
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_APP_Comment_Update) parameters:@{@"Content":content,@"CommentId":@(weakSelf.commentId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf RefreshCommentList];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- weakSelf.dismissSelf = NO;
- }];
- };
- }
- - (void)replyCommentName:(NSString *)name andId:(NSString *)commentId{
- WS(weakSelf);
- self.dismissSelf = YES;
- [self.commentInputView setPlaceText:[NSString stringWithFormat:@"回复%@:",name]];
- [self.commentInputView startEditing];
- self.commentInputView.inputBlock = ^(NSString * _Nonnull content) {
- NSLog(@"%@",content);
- weakSelf.dismissSelf = NO;
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf replyCommentWithcontent:content andId:commentId];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- weakSelf.isScrComment = YES;
- [weakSelf scrollToCommentViewTop];
- });
- };
- }
- - (void)replyCommentWithcontent:(NSString *)content andId:(NSString *)commentId
- {
- WS(weakSelf);
- NSMutableDictionary *dicc = [NSMutableDictionary dictionary];
- [dicc setValue:@(self.Id) forKey:@"ArticleId"];
- [dicc setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [dicc setValue:content forKey:@"Content"];
- [dicc setValue:commentId forKey:@"Pid"];//回复评论时用到的ID
- [dicc setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
- NSLog(@"%@",dicc);
-
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_Add) parameters:dicc responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"评论成功");
- if (weakSelf.RefreshTopicBlock) {
- weakSelf.RefreshTopicBlock();
- }
- [weakSelf RefreshCommentList];
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)scrollToCommentViewTop
- {
- WS(weakSelf);
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- if (weakSelf.isScrComment) {
- if ((weakSelf.commentArray.count > 0 || weakSelf.currentZanModel.Items.count > 0) && weakSelf.tableView) {
- // NSIndexPath * indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
- [weakSelf.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:NSNotFound inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
- }
- }else{
- [weakSelf.tableView scrollToTop];
- }
- });
- }
- - (WKWebView *)webView
- {
- if (!_webView) {
- WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
- // 实例化对象
- WKUserContentController* userContent = [[WKUserContentController alloc] init];
- [userContent addScriptMessageHandler:self name:@"delelteAction"];
- [userContent addScriptMessageHandler:self name:@"editAction"];
- [userContent addScriptMessageHandler:self name:@"postTopicDetailsData"];
- [userContent addScriptMessageHandler:self name:@"alreadyRead"];
- [userContent addScriptMessageHandler:self name:@"to"];
- [userContent addScriptMessageHandler:self name:@"goMeeting"];
- [userContent addScriptMessageHandler:self name:@"goUser"];
- [userContent addScriptMessageHandler:self name:@"goRead"];
- [userContent addScriptMessageHandler:self name:@"postH"];
- [userContent addScriptMessageHandler:self name:@"postSave"];
- [userContent addScriptMessageHandler:self name:@"appCollection"];
- [userContent addScriptMessageHandler:self name:@"enlargeImg"];
- [userContent addScriptMessageHandler:self name:@"toNav"];
- NSMutableString *javascript = [NSMutableString string];
- [javascript appendString:@"document.documentElement.style.webkitTouchCallout='none';"];//禁止长按
- // [javascript appendString:@"document.documentElement.style.webkitUserSelect='none';"];//禁止选择
- WKUserScript *noneSelectScript = [[WKUserScript alloc] initWithSource:javascript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
- [userContent addUserScript:noneSelectScript];
-
- configuration.userContentController = userContent;
- WKPreferences *preferences = [WKPreferences new];
- preferences.javaScriptCanOpenWindowsAutomatically = YES;
- preferences.minimumFontSize = 10.0;
- configuration.preferences = preferences;
- // 初始化WKWebView
- _webView = [[WKWebView alloc]initWithFrame:CGRectZero configuration:configuration];
- _webView.scrollView.scrollEnabled = NO;
- _webView.scrollView.bounces = NO;
- _webView.scrollView.showsVerticalScrollIndicator = NO;
- _webView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
- }
- return _webView;
- }
- - (void)loadDataWebView
- {
- NSString * url = nil;
- switch (self.type) {
- case CollectModel_Aritle:
- {
- url = @"/mobile/mainTextWeb";
- }
- break;
- case CollectModel_MediaAritle:
- {
- url = @"/mobile/periodicalWeb";
- }
- break;
- case CollectModel_Group:
- {
- url = @"/mobile/topicDetails";
- }
- break;
- case CollectModel_Toipc:
- {
- url = @"/mobile/topicDetails";
- }
- break;
- case CollectModel_NewTopic:
- {
- url = @"/mobile/topicDetails";
- }
- break;
- case CollectModel_NoteBook:
- {
- url = @"/mobile/topicDetails";
- }
- break;
- case CollectModel_Notice:
- {
- url = @"/mobile/noticeDetails";
- }
- break;
- case CollectModel_InterMail:
- {
- url = @"/mobile/mail";
- }
- break;
- case CollectModel_NoSignMail:
- {
- url = @"/mobile/mail";
- }
- break;
- case CollectModel_meetMian:
- {
- url = @"/mobile/minutesMeeting";
- }
- break;
- default:
- {
- url = @"/mobile/topicDetails";
- }
- break;
- }
- NSURL *pathUrl = [NSURL URLWithString:HtmlHost(url)];
- // NSURL *pathUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",@"Http://192.168.0.119:8080/admin",url]];
- NSURLRequest *request = [NSURLRequest requestWithURL:pathUrl];
- [self.webView loadRequest:request];
- [self.webView.scrollView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil];
- }
- - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
- /** < 法2 > */
- /** < loading:防止滚动一直刷新,出现闪屏 > */
- if ([keyPath isEqualToString:@"contentSize"]) {
- CGFloat H = self.webView.scrollView.contentSize.height;
- NSLog(@"=========== webH :%f",H);
- if (self.webH != H && H != 0) {
- self.webH = H;
- self.tableView.sectionHeaderHeight = self.webH;
- [self.webView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.webH)];
- [self setBottomViewData:self.currentNoteModel];
- [self.tableView reloadData];
- }
- }
- }
- #pragma mark - WKScriptMessageHandler
- - (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message {
- if ([message.name isEqualToString:@"delelteAction"]) {
- [self deleteButtonHander];
- }
- if ([message.name isEqualToString:@"editAction"]) {
- [self editorButtonHander];
- }
- if ([message.name isEqualToString:@"postTopicDetailsData"]) {
- NSString *jsonString = [NSString stringWithFormat:@"getData('%ld','%@','%ld','%ld')",(long)self.Id,USERDEFAULTSGET(@"LOGINTOKEN"),(long)self.type,[AppUserModel sharedAppUserModel].Id];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- }
- if ([message.name isEqualToString:@"postH"]) {
- NSLog(@"msgBody:%@",message.body);
- NSInteger H = [message.body integerValue];
- self.tableView.sectionHeaderHeight = self.webH - H;
- [self.webView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.webH - H)];
- [self.tableView reloadData];
- }
- if ([message.name isEqualToString:@"postSave"]) {
- NSString * imgUrl = message.body;
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
- UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"保存图片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- UIImage * img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imgUrl]]];
- [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
- [PHAssetChangeRequest creationRequestForAssetFromImage:img];
- } completionHandler:^(BOOL success, NSError * _Nullable error) {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (success) {
- SHOWSUCCESS(@"图片保存成功");
- }else{
- SHOWERROR(@"图片保存失败");
- }
- });
- }];
- }];
- UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [alert addAction:actionYes];
- [alert addAction:actionNo];
- [self presentViewController:alert animated:YES completion:^{
- }];
- }
- if ([message.name isEqualToString:@"appCollection"]) {
- WS(weakSelf);
- if (self.IsCollect) {
- dispatch_async(dispatch_get_main_queue(), ^{
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"真的取消收藏吗?" message:nil preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
- [dic setValue:@(weakSelf.Id) forKey:@"CollectionDataId"];
- /// 1文章 2话题 3 收藏 4笔记 5通知 6站内信 7小组 8 会议详情 14工作流审批 300 文件 400 会议纪要
- NSInteger type = weakSelf.type;
- [dic setValue:@(type) forKey:@"CollectionType"];
- [dic setValue:@(0) forKey:@"FolderId"];
- [dic setValue:@(0) forKey:@"SourceUserId"];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_CreateCollect) parameters:dic success:^(id _Nonnull responseObject) {
- [weakSelf refreshData];
- weakSelf.IsCollect = NO;
- NSString *jsonString = [NSString stringWithFormat:@"showCollection('%d')",0];
- [weakSelf.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- } failure:^(NSError * _Nonnull error) {
- // SHOWERROR([ZYCTool handerResultData:error]);
- }];
- });
- [weakSelf setCusMenuShare];
- }];
- UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf setCusMenuShare];
- }];
- [alert addAction:actionYes];
- [alert addAction:actionNo];
- [weakSelf presentViewController:alert animated:YES completion:^{
-
- }];
- });
- }else{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf gotoCollectHander];
- });
- }
- }
- if ([message.name isEqualToString:@"alreadyRead"]) {
- NSLog(@"msgBody:%@",message.body);
- NSDictionary * dict = (NSDictionary *)message.body;
- NoticeUnreadVC *vc = [NoticeUnreadVC initNoticeUnreadVC];
- vc.Id = self.Id;
- switch (self.type) {
- case CollectModel_Notice:
- vc.type = ReadNoticeType;
- break;
- case CollectModel_InterMail:
- vc.type = ReadMissiveType;
- break;
- case CollectModel_NoSignMail:
- vc.type = ReadMissiveType;
- break;
- default:
- vc.type = ReadNoticeType;
- break;
- }
- vc.readCount = [dict[@"ReadCount"] integerValue];
- vc.unReadCount = [dict[@"AllCount"] integerValue] - [dict[@"ReadCount"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- if ([message.name isEqualToString:@"to"]) {
- NSLog(@"msgBody:%@",message.body);
- NSDictionary * dict = (NSDictionary *)message.body;
- [self pushVCWithDict:dict];
- }
- if ([message.name isEqualToString:@"enlargeImg"]) {
- NSLog(@"msgBody:%@",message.body);
- [self showImageAction:message.body];
- }
- if ([message.name isEqualToString:@"toNav"]) {
- NSLog(@"msgBody:%@",message.body);
- [self OpenHttp:message.body];
- }
- if ([message.name isEqualToString:@"goMeeting"]) {
- NSLog(@"msgBody:%@",message.body);
- NSInteger meetId = [message.body integerValue];
- WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:meetId];
- [self.navigationController pushViewController:vc animated:YES];
- }
- if ([message.name isEqualToString:@"goUser"]) {
- NSLog(@"msgBody:%@",message.body);
- MailListDetailVC *vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = self.sendUserId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- if ([message.name isEqualToString:@"goRead"]) {
- NSLog(@"msgBody:%@",message.body);
- NSInteger count = [message.body integerValue];
- ReadListVC * vc = [ReadListVC initReadListVC];
- vc.type = self.type;
- vc.indexId = self.Id;
- vc.ReadTotal = count;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- #pragma mark - WKScriptMessageHandler
- - (NSString *)convertToJson:(NSDictionary *)dict
- {
- NSError *error;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
- NSString *jsonString;
- if (!jsonData) {
- NSLog(@"%@",error);
- }else{
- jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
- }
- NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
- NSRange range = {0,jsonString.length};
- //去掉字符串中的空格
- [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
- NSRange range2 = {0,mutStr.length};
- //去掉字符串中的换行符
- [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
- return mutStr;
- }
- //#pragma mark - WKUIDelegete
- //- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(nonnull NSString *)message initiatedByFrame:(nonnull WKFrameInfo *)frame completionHandler:(nonnull void (^)(void))completionHandler
- //{
- // UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:message?:@"" preferredStyle:UIAlertControllerStyleAlert];
- // [alertController addAction:([UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- // completionHandler();
- // }])];
- // [self presentViewController:alertController animated:YES completion:nil];
- // NSLog(@"Aleart=========%@",message);
- // completionHandler();
- //}
- //- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{
- // // DLOG(@"msg = %@ frmae = %@",message,frame);
- // UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:message?:@"" preferredStyle:UIAlertControllerStyleAlert];
- // [alertController addAction:([UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- // completionHandler(NO);
- // }])];
- // [alertController addAction:([UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- // completionHandler(YES);
- // }])];
- // [self presentViewController:alertController animated:YES completion:nil];
- //}
- //- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable))completionHandler{
- // UIAlertController *alertController = [UIAlertController alertControllerWithTitle:prompt message:@"" preferredStyle:UIAlertControllerStyleAlert];
- // [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
- // textField.text = defaultText;
- // }];
- // [alertController addAction:([UIAlertAction actionWithTitle:@"完成" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- // completionHandler(alertController.textFields[0].text?:@"");
- // }])];
- // [self presentViewController:alertController animated:YES completion:nil];
- //}
- - (NSString *)arrayToJSONString:(NSArray *)array
- {
-
- NSError *error = nil;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:&error];
- NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
- return jsonString;
- }
- - (void)dealloc {
- WKWebsiteDataStore *dateStore = [WKWebsiteDataStore defaultDataStore];
- [dateStore fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes]
- completionHandler:^(NSArray * __nonnull records) {
- for (WKWebsiteDataRecord *record in records)
- {
- [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:record.dataTypes
- forDataRecords:@[record]
- completionHandler:^{
- NSLog(@"Cookies for %@ deleted successfully",record.displayName);
- }];
- }
- }];
-
- WKUserContentController *userCC = self.webView.configuration.userContentController;
- [userCC removeScriptMessageHandlerForName:@"delelteAction"];
- [userCC removeScriptMessageHandlerForName:@"editAction"];
- [userCC removeScriptMessageHandlerForName:@"postTopicDetailsData"];
- [userCC removeScriptMessageHandlerForName:@"alreadyRead"];
- [userCC removeScriptMessageHandlerForName:@"to"];
- [userCC removeScriptMessageHandlerForName:@"goMeeting"];
- [userCC removeScriptMessageHandlerForName:@"goUser"];
- [userCC removeScriptMessageHandlerForName:@"goRead"];
- [userCC removeScriptMessageHandlerForName:@"postH"];
- [userCC removeScriptMessageHandlerForName:@"postSave"];
-
- [self.webView.scrollView removeObserver:self forKeyPath:@"contentSize"];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [self.webView stopLoading];
- self.webView.UIDelegate = nil;
- self.webView.navigationDelegate = nil;
- self.webView.scrollView.delegate = nil;
- [self.webView removeFromSuperview];
- }
- - (NSInteger)backTypeValue
- {
- switch (self.type) {
- case CollectModel_Aritle:
- {
- return 100;
- }
- break;
- case CollectModel_MediaAritle:
- {
- return 101;
- }
- break;
- case CollectModel_Group:
- {
- return 1;
- }
- break;
- case CollectModel_Toipc:
- {
- return 2;
- }
- break;
- case CollectModel_Notice:
- {
- return 5;
- }
- break;
- case CollectModel_NewTopic:
- {
- return -4;
- }
- break;
- case CollectModel_NoteBook:
- {
- return 4;
- }
- break;
- case CollectModel_meetMian:
- {
- return 8;
- }
- break;
- case CollectModel_InterMail:
- {
- return 6;
- }
- break;
- case CollectModel_NoSignMail:
- {
- return 6;
- }
- break;
- default:
- {
- return 1;
- }
- break;
- }
- }
- - (void)refreshData
- {
- switch (self.type) {
- case CollectModel_Aritle:
- {
- [self refreshAritleData];
- }
- break;
- case CollectModel_MediaAritle:
- {
- [self refreshMediaAritleData];
- }
- break;
- case CollectModel_Group:
- {
- [self refreshTopicData];
- }
- break;
- case CollectModel_Toipc:
- {
- [self refreshTopicData];
- }
- break;
- case CollectModel_NewTopic:
- {
- [self refreshNoteData];
- }
- break;
- case CollectModel_Notice:
- {
- [self refreshNoticeData];
- }
- break;
- case CollectModel_NoteBook:
- {
- [self refreshNoteData];
- }
- break;
- case CollectModel_InterMail:
- {
- [self getMail];
- }
- break;
- case CollectModel_NoSignMail:
- {
- [self getMail];
- }
- break;
- case CollectModel_meetMian:
- {
- [self refreshMeetingData];
- }
- break;
- default:
- {
- [self refreshTopicData];
- }
- break;
- }
- }
- #pragma mark - UIMenuController
- //指定menu响应事件 屏蔽系统自带响应事件
- - (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
- NSLog(@"%@", NSStringFromSelector(action));
- if (action == @selector(copyAction:)
- ||action == @selector(tySelectedAll:)
- ||action == @selector(shareSelectedText:)
- ||action == @selector(searchAction:)
- ||action == @selector(deleteItemAction:)
- ||action == @selector(upDateItemAction:)) {
- return YES;
- }
- if (action == @selector(cut:)
- ||action == @selector(select:)
- ||action == @selector(selectAll:)
- ||action == @selector(paste:)
- ||action == @selector(delete:)
- ||action == @selector(makeTextWritingDirectionRightToLeft:)
- ||action == @selector(makeTextWritingDirectionLeftToRight:)) {
- return NO;
- }
- return NO;
- }
- //允许成为第一响应
- - (BOOL)canBecomeFirstResponder {
- UIWindow *window = [[UIApplication sharedApplication].delegate window];
- if ([window isKeyWindow] == NO)
- {
- [window becomeKeyWindow];
- [window makeKeyAndVisible];
- }
- return YES;
- }
- - (BOOL)canResignFirstResponder {
- if (self.dismissSelf) {
- return YES;
- }
- return NO;
- }
- #pragma mark 实现自定义方法
- - (void)setCusMenuShare
- {
- self.dismissSelf = NO;
- // [self createMenuItems];
- }
- - (void)copyAction:(UIMenuController *)menu
- {
- SHOWSUCCESS(@"复制成功");
- [self.webView evaluateJavaScript:@"window.getSelection().toString()" completionHandler:^(id _Nullable content, NSError * _Nullable error) {
- UIPasteboard *pboard = [UIPasteboard generalPasteboard];
- pboard.string = (NSString *)content;
- NSLog(@"选中-----%@", pboard.string);
- }];
- }
- - (void)searchAction:(UIMenuController *)menu
- {
-
- }
- - (void)tySelectedAll:(UIMenuController *)menu{
-
- [self.webView selectAll:menu];
- self.dismissSelf = YES;
- }
- - (void)shareSelectedText:(UIMenuController *)menu {
- WS(weakSelf);
- [self.webView evaluateJavaScript:@"window.getSelection().toString()" completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"选中的文字为:%@", data);
- [self.webView copy:data];
- weakSelf.shareText = data;
- if (weakSelf.shareText.length > 0) {
- weakSelf.IsShareText = YES;
- [weakSelf shareHander];
- }
- }];
- }
- - (void)handleLongPress:(UILongPressGestureRecognizer *)sender
- {
- [self createMenuItems];
- }
- - (void)createMenuItems
- {
- UIMenuController * menu = [UIMenuController sharedMenuController];
- UIMenuItem *item1 = [[UIMenuItem alloc]initWithTitle:@"复制" action:@selector(copyAction:)];
- UIMenuItem *item2 = [[UIMenuItem alloc]initWithTitle:@"全选" action:@selector(tySelectedAll:)];
- UIMenuItem *item3 = [[UIMenuItem alloc]initWithTitle:@"摘录" action:@selector(shareSelectedText:)];
- UIMenuItem *item4 = [[UIMenuItem alloc]initWithTitle:@"搜索" action:@selector(searchAction:)];
- [menu setMenuItems:@[item1, item2, item3, item4]];
- menu.menuVisible = YES;
- }
- - (void)showImageAction:(NSString *)url
- {
- WS(weakSelf);
- UIImageView * ImageV = [[UIImageView alloc] initWithFrame:CGRectMake(50, (SCREEN_HEIGHT - Screen_Width + 100) * 0.5, Screen_Width - 100, Screen_Width - 100)];
- ImageV.hidden = YES;
- [self.view addSubview:ImageV];
- [ImageV sd_setImageWithURL:[NSURL URLWithString:url] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
- dispatch_async(dispatch_get_main_queue(), ^{
- LZImageBrowserManger *imageBrowserManger = [LZImageBrowserManger imageBrowserMangerWithUrlStr:@[url] originImageViews:@[ImageV] originController:weakSelf forceTouch:YES forceTouchActionTitles:@[] forceTouchActionComplete:^(NSInteger selectIndex, NSString *title) {
-
- }];
- weakSelf.imageBrowserManger = imageBrowserManger;
- });
- }];
-
- self.imageBrowserManger.selectPage = 0;
- [self.imageBrowserManger showImageBrowser];
- }
- - (void)OpenHttp:(NSString *)url
- {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url] options:@{} completionHandler:^(BOOL success) {
-
- }];
- }
- @end
|