MyTDTopicDetailVC.m 139 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216
  1. //
  2. // MyTDTopicDetailVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2019/12/19.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyTDTopicDetailVC.h"
  9. #import "NoteBookDetailCell.h"
  10. #import "NoteBookShareVC.h"
  11. #import "MoveViewController.h"
  12. #import "ChangeTopicVC.h"
  13. #import "TDGroupInfoListVC.h"
  14. #import "TextInputView.h"
  15. #import "MHTopicCell.h"
  16. #import "MHTopic.h"
  17. #import "MHTopicFrame.h"
  18. #import "ClickOKViewController.h"
  19. #import "ReadListVC.h"
  20. #import "HomeDetailController.h"
  21. #import "ChatMsgNoticeDetailVC.h"
  22. #import "NoteBookDetailVC.h"
  23. #import "MyFavoriteVC.h"
  24. #import "NoteBookVC.h"
  25. #import "TDInterLeterDetailVC.h"
  26. #import "FileOpenViewController.h"
  27. #import "EMChatFileShowVC.h"
  28. #import "MyTDTopicCreateVC.h"
  29. #import "NoticeUnreadVC.h"
  30. #import "DownFileViewController.h"
  31. #import "CountDataVC.h"
  32. #import "WorkFlowDetailsController.h"
  33. #import "MyTDGroupViewController.h"
  34. #import "MoveViewController.h"
  35. #import "MyApprovalPageDetail.h"
  36. #import "WorkFlowDetailsController.h"
  37. #import "OtherFavoriteVC.h"
  38. #import "OtherNoteBookVC.h"
  39. #import "MailListDetailVC.h"
  40. #import "ReadListVC.h"
  41. #import "ShareListVC.h"
  42. #import "BookWCDetailVC.h"
  43. #import "BookListenVC.h"
  44. @interface MyTDTopicDetailVC ()<UITableViewDataSource,UITableViewDelegate,NoteBookShareVCDelegate,MHTopicCellDelegate,WKUIDelegate,WKNavigationDelegate,UIScrollViewDelegate,WKScriptMessageHandler>
  45. @property (strong,nonatomic) IBOutlet UITableView *tableView;
  46. @property (nonatomic,assign) NSUInteger currentPage;
  47. @property (nonatomic,strong) MyNoteBookDetailModel *currentNoteModel;
  48. @property (nonatomic,strong) MyNodeBookZanModel *currentZanModel;
  49. @property (nonatomic,strong) MyNoteBookCommentModel *currentNoteCommentModel;
  50. @property (nonatomic,strong) NSMutableArray *commentArray;
  51. @property (nonatomic,assign) BOOL isFresh;
  52. @property (weak, nonatomic) IBOutlet UILabel *titleL;
  53. @property (weak, nonatomic) IBOutlet UIButton *commentButton;
  54. @property (weak, nonatomic) IBOutlet UIButton *commentScrollBtn;
  55. @property (weak, nonatomic) IBOutlet UILabel *commentNumberLabel;
  56. @property (weak, nonatomic) IBOutlet UIButton *zanButton;
  57. @property (weak, nonatomic) IBOutlet UIButton *collectButton;
  58. @property (weak, nonatomic) IBOutlet UIButton *shareButton;
  59. @property (weak, nonatomic) IBOutlet UILabel *commentCountL;
  60. @property (weak, nonatomic) IBOutlet UIImageView *zanImgV;
  61. @property (weak, nonatomic) IBOutlet UILabel *zanCountL;
  62. @property (weak, nonatomic) IBOutlet UIImageView *collectImgV;
  63. @property (weak, nonatomic) IBOutlet UILabel *collectL;
  64. @property (weak, nonatomic) IBOutlet UIImageView *shareImgV;
  65. @property (weak, nonatomic) IBOutlet UILabel *shareCountL;
  66. @property (weak, nonatomic) IBOutlet UIView *TalkView;
  67. @property (weak, nonatomic) IBOutlet UIView *ReplayView;
  68. @property (weak, nonatomic) IBOutlet UIButton *ReplayBtn;
  69. @property (weak, nonatomic) IBOutlet UIView *BottomView;
  70. @property (weak, nonatomic) IBOutlet UIButton *musicBtn;
  71. @property (weak, nonatomic) IBOutlet UIButton *shareBtn;
  72. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *shareWidth;
  73. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomHeight;
  74. @property (nonatomic, strong) TextInputView *commentInputView;
  75. @property (assign, nonatomic) NSInteger countComment;
  76. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  77. @property (nonatomic,assign) BOOL isSort;
  78. @property (nonatomic,assign) BOOL isScrComment;
  79. @property (nonatomic,assign) CGFloat webH;
  80. @property (nonatomic,strong) WKWebView * webView;
  81. @property (nonatomic,assign) BOOL dismissSelf;
  82. @property (nonatomic,copy) NSString * shareText;
  83. @property (nonatomic,assign) BOOL IsShareText;
  84. @property (nonatomic,assign) NSInteger commentId;
  85. @property (nonatomic,copy) NSString * commentStr;
  86. @property (nonatomic,assign) BOOL isSelf;
  87. @property (nonatomic,assign) BOOL IsCollect;
  88. @property (nonatomic,assign) NSInteger sendUserId;
  89. @end
  90. @implementation MyTDTopicDetailVC
  91. +(MyTDTopicDetailVC *)initMyTDTopicDetailVC{
  92. MyTDTopicDetailVC *controller = [StoryboardManager.shared.myTDTopic instantiateViewControllerWithIdentifier:@"MyTDTopicDetailVC"];
  93. return controller;
  94. }
  95. - (void)viewWillAppear:(BOOL)animated
  96. {
  97. [super viewWillAppear:animated];
  98. WS(weakSelf);
  99. self.dismissSelf = NO;
  100. NSString *jsonString = [NSString stringWithFormat:@"getData('%ld','%@','%ld')",(long)self.Id,USERDEFAULTSGET(@"LOGINTOKEN"),(long)self.type];
  101. self.musicBtn.hidden = YES;
  102. [self createMenuItems];
  103. switch (self.type) {
  104. case CollectModel_InterMail:
  105. {
  106. [self setMailBottomView:YES];
  107. [self.ReplayBtn setAction:^{
  108. weakSelf.dismissSelf = YES;
  109. [weakSelf ReplayAction];
  110. }];
  111. self.titleL.text = @"站内信";
  112. }
  113. break;
  114. case CollectModel_NoSignMail:
  115. {
  116. [self setMailBottomView:YES];
  117. [self.ReplayBtn setAction:^{
  118. weakSelf.dismissSelf = YES;
  119. [weakSelf ReplayAction];
  120. }];
  121. self.titleL.text = @"站内信";
  122. }
  123. break;
  124. case CollectModel_NewTopic:
  125. {
  126. self.titleL.text = @"话题";
  127. self.musicBtn.hidden = NO;
  128. [self setMailBottomView:NO];
  129. }
  130. break;
  131. case CollectModel_Toipc:
  132. {
  133. self.titleL.text = @"话题";
  134. self.musicBtn.hidden = NO;
  135. [self setMailBottomView:NO];
  136. }
  137. break;
  138. case CollectModel_Notice:
  139. {
  140. self.titleL.text = @"通知";
  141. [self setMailBottomView:NO];
  142. }
  143. break;
  144. case CollectModel_NoteBook:
  145. {
  146. self.titleL.text = @"笔记";
  147. self.shareWidth.constant = 50.f;
  148. self.bottomHeight.constant = 0.f;
  149. [self.shareBtn setAction:^{
  150. [weakSelf shareHander];
  151. }];
  152. self.BottomView.hidden = YES;
  153. self.shareBtn.hidden = NO;
  154. self.musicBtn.hidden = NO;
  155. }
  156. break;
  157. case CollectModel_Aritle:
  158. {
  159. self.titleL.text = @"正文";
  160. self.musicBtn.hidden = NO;
  161. [self setMailBottomView:NO];
  162. }
  163. break;
  164. case CollectModel_MediaAritle:
  165. {
  166. self.titleL.text = @"正文";
  167. self.musicBtn.hidden = NO;
  168. [self setMailBottomView:NO];
  169. }
  170. break;
  171. case CollectModel_meetMian:
  172. {
  173. self.titleL.text = @"会议纪要";
  174. self.musicBtn.hidden = NO;
  175. [self setMailBottomView:NO];
  176. }
  177. break;
  178. default:
  179. {
  180. self.titleL.text = @"正文";
  181. self.musicBtn.hidden = NO;
  182. [self setMailBottomView:NO];
  183. }
  184. break;
  185. }
  186. }
  187. - (void)setMailBottomView:(BOOL)isSet
  188. {
  189. if (isSet) {
  190. self.TalkView.hidden = YES;
  191. self.ReplayView.hidden = NO;
  192. self.ReplayBtn.layer.cornerRadius = 5.f;
  193. self.ReplayBtn.layer.masksToBounds = YES;
  194. self.ReplayBtn.layer.borderColor = UIColorHex(0x0F8AE3).CGColor;
  195. self.ReplayBtn.layer.borderWidth = 0.5f;
  196. [self.BottomView setBackgroundColor:UIColorHex(0xF5F5F5)];
  197. }else{
  198. [self.BottomView setBackgroundColor:[UIColor whiteColor]];
  199. self.TalkView.hidden = NO;
  200. self.TalkView.layer.cornerRadius = 4.f;
  201. self.TalkView.layer.masksToBounds = YES;
  202. self.TalkView.layer.borderColor = UIColorHex(0xE5E5E5).CGColor;
  203. self.TalkView.layer.borderWidth = 0.5f;
  204. self.ReplayView.hidden = YES;
  205. }
  206. }
  207. - (void)ReplayAction{
  208. WS(weakSelf);
  209. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  210. UIAlertAction *alertAction1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  211. [weakSelf setCusMenuShare];
  212. }];
  213. [alertAction1 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  214. UIAlertAction *alertAction2 = [UIAlertAction actionWithTitle:@"回复" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  215. weakSelf.webH = 0;
  216. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  217. vc.upDateBlock = ^{
  218. [weakSelf headRefresh];
  219. };
  220. vc.replayType = MailReplayOne;
  221. vc.type = weakSelf.type;
  222. vc.isEdit = YES;
  223. vc.Id = weakSelf.Id;
  224. [weakSelf.navigationController pushViewController:vc animated:YES];
  225. }];
  226. [alertAction2 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  227. UIAlertAction *alertAction3 = [UIAlertAction actionWithTitle:@"回复全部" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  228. weakSelf.webH = 0;
  229. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  230. vc.upDateBlock = ^{
  231. [weakSelf headRefresh];
  232. };
  233. vc.replayType = MailReplayAll;
  234. vc.isEdit = YES;
  235. vc.type = CollectModel_InterMail;
  236. vc.Id = weakSelf.Id;
  237. [weakSelf.navigationController pushViewController:vc animated:YES];
  238. }];
  239. [alertAction3 setValue:UIColorHex(0x0A0A0A) forKey:@"titleTextColor"];
  240. [alert addAction:alertAction2];
  241. [alert addAction:alertAction3];
  242. [alert addAction:alertAction1];
  243. [self presentViewController:alert animated:YES completion:^{
  244. }];
  245. }
  246. - (void)viewDidLoad {
  247. [super viewDidLoad];
  248. self.fd_prefersNavigationBarHidden = YES;
  249. [self setTableViewRefresh];
  250. WS(weakSelf);
  251. [self.shareButton setAction:^{
  252. weakSelf.dismissSelf = YES;
  253. [weakSelf ShareDetail];
  254. }];
  255. [self.zanButton setAction:^{
  256. weakSelf.dismissSelf = YES;
  257. [weakSelf gotoZanHander];
  258. }];
  259. if (self.type != CollectModel_InterMail || self.type != CollectModel_NoSignMail) {
  260. [self.commentButton setAction:^{
  261. weakSelf.dismissSelf = YES;
  262. [weakSelf commentHander];
  263. }];
  264. [self.commentScrollBtn setAction:^{
  265. weakSelf.isScrComment = !weakSelf.isScrComment;
  266. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  267. [weakSelf scrollToCommentViewTop];
  268. });
  269. }];
  270. }
  271. [self.view addSubview:self.noteBookShareVC.view];
  272. [self.view addSubview:self.commentInputView];
  273. self.tableView.tableHeaderView = self.webView;
  274. self.webView.UIDelegate = self;
  275. self.webView.navigationDelegate = self;
  276. self.webView.scrollView.delegate = self;
  277. [self headRefresh];
  278. // UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  279. // if (weakSelf.currentNoteModel.UserId == [AppUserModel sharedAppUserModel].Id) {
  280. // [weakSelf editorButtonHander];
  281. // }
  282. // }];
  283. // [self.webView addGestureRecognizer:tap];
  284. // self.webView.userInteractionEnabled = YES;
  285. // tap.numberOfTouchesRequired = 2;
  286. // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(menuShow) name:UIMenuControllerDidShowMenuNotification object:nil];
  287. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(collectSuccess) name:COLLECTSUCCESS object:nil];
  288. // 通知-监听键盘弹出事件
  289. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeKeyboardWillShowNotification:) name:UIKeyboardWillShowNotification object:nil];
  290. // 通知-监听键盘回收事
  291. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeKeyboardWillHideNotification:) name:UIKeyboardWillHideNotification object:nil];
  292. }
  293. #pragma mark - UIKeyBoradNotification
  294. - (void)changeKeyboardWillShowNotification:(NSNotification*)notification
  295. {
  296. WS(weakSelf);
  297. NSDictionary *userInfo = [notification userInfo];
  298. // 键盘弹出后的frame的结构体对象
  299. NSValue *valueEndFrame = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
  300. // 得到键盘弹出后的键盘视图所在y坐标
  301. CGFloat keyBoardEndY = valueEndFrame.CGRectValue.origin.y;
  302. // 键盘弹出的动画时间
  303. NSNumber *duration = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
  304. // 键盘弹出的动画曲线
  305. NSNumber *curve = [userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
  306. // 添加移动动画,使视图跟随键盘移动(动画时间和曲线都保持一致)
  307. [UIView animateWithDuration:[duration doubleValue] animations:^{
  308. [UIView setAnimationBeginsFromCurrentState:YES];
  309. [UIView setAnimationCurve:[curve intValue]];
  310. [UIView animateWithDuration:0.5 animations:^{
  311. [weakSelf.commentInputView startAnimationWithY:keyBoardEndY - 150.f];
  312. }];
  313. } completion:^(BOOL finished) {
  314. }];
  315. }
  316. - (void)changeKeyboardWillHideNotification:(NSNotification*)notification
  317. {
  318. WS(weakSelf);
  319. NSDictionary *userInfo = [notification userInfo];
  320. // 键盘弹出的动画时间
  321. NSNumber *duration = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
  322. // 键盘弹出的动画曲线
  323. NSNumber *curve = [userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
  324. [UIView animateWithDuration:[duration doubleValue]animations:^{
  325. [weakSelf.commentInputView startAnimationWithY:SCREEN_HEIGHT];
  326. [UIView setAnimationBeginsFromCurrentState:YES];
  327. [UIView setAnimationCurve:[curve intValue]];
  328. } completion:^(BOOL finished) {
  329. [weakSelf setCusMenuShare];
  330. }];
  331. }
  332. - (void)setTableViewRefresh{
  333. WS(weakSelf);
  334. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  335. [weakSelf headRefresh];
  336. }];
  337. self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  338. [weakSelf footerRefresh];
  339. }];
  340. }
  341. - (void)setBottomViewData:(MyNoteBookDetailModel *)model
  342. {
  343. WS(weakSelf);
  344. __block MyNoteBookDetailModel * weakModel = model;
  345. self.IsCollect = model.IsCollect;
  346. dispatch_async(dispatch_get_main_queue(), ^{
  347. weakSelf.countComment = weakModel.CommentCount;
  348. if (weakModel.CommentCount == 0) {
  349. weakSelf.commentCountL.text = [NSString stringWithFormat:@"评 论"];
  350. }else{
  351. if (weakModel.CommentCount > 10000) {
  352. weakSelf.commentCountL.text = [NSString stringWithFormat:@"%.1f万\n评 论",weakModel.CommentCount / 10000.0];
  353. }else{
  354. weakSelf.commentCountL.text = [NSString stringWithFormat:@"%ld\n评 论",(long)weakModel.CommentCount];
  355. }
  356. }
  357. weakSelf.zanCountL.text = [NSString stringWithFormat:@"%ld",(long)weakModel.PraiseCount];
  358. weakSelf.collectL.text = [NSString stringWithFormat:@"%ld",(long)weakModel.CollectCount];
  359. weakSelf.shareCountL.text = [NSString stringWithFormat:@"%ld",(long)weakModel.RetransmissionCount];
  360. weakSelf.zanCountL.hidden = weakModel.PraiseCount == 0 ? YES : NO;
  361. weakSelf.collectL.hidden = weakModel.CollectCount == 0 ? YES : NO;
  362. weakSelf.shareCountL.hidden = weakModel.RetransmissionCount == 0 ? YES : NO;
  363. weakSelf.zanImgV.image = weakModel.IsPraise ? IMG(@"zan_yes"):IMG(@"zan_no");
  364. weakSelf.collectImgV.image = weakModel.IsCollect ? IMG(@"icon_collect_off"):IMG(@"收藏五角星");
  365. weakSelf.shareImgV.image = IMG(@"icon_share");
  366. weakSelf.zanCountL.textColor = weakModel.IsPraise ? UIColorHex(#009AFF):UIColorHex(#999999);
  367. weakSelf.collectL.textColor = weakModel.IsCollect ? UIColorHex(#009AFF):UIColorHex(#999999);
  368. weakSelf.shareCountL.textColor = UIColorHex(#009AFF);
  369. [weakSelf.collectButton setAction:^{
  370. weakSelf.dismissSelf = YES;
  371. if (weakModel.IsCollect) {
  372. dispatch_async(dispatch_get_main_queue(), ^{
  373. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"真的取消收藏吗?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  374. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  375. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  376. [dic setValue:@(weakSelf.Id) forKey:@"CollectionDataId"];
  377. /// 1文章 2话题 3 收藏 4笔记 5通知 6站内信 7小组 8 会议详情 14工作流审批 300 文件 400 会议纪要
  378. NSInteger type = weakSelf.type;
  379. [dic setValue:@(type) forKey:@"CollectionType"];
  380. [dic setValue:@(0) forKey:@"FolderId"];
  381. [dic setValue:@(0) forKey:@"SourceUserId"];
  382. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  383. [[HttpManager sharedHttpManager] PUTUrl:Host(API_CreateCollect) parameters:dic success:^(id _Nonnull responseObject) {
  384. [weakSelf refreshData];
  385. weakSelf.IsCollect = NO;
  386. } failure:^(NSError * _Nonnull error) {
  387. // SHOWERROR([ZYCTool handerResultData:error]);
  388. }];
  389. });
  390. [weakSelf setCusMenuShare];
  391. }];
  392. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  393. [weakSelf setCusMenuShare];
  394. }];
  395. [alert addAction:actionYes];
  396. [alert addAction:actionNo];
  397. [weakSelf presentViewController:alert animated:YES completion:^{
  398. }];
  399. });
  400. }else{
  401. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  402. [weakSelf gotoCollectHander];
  403. });
  404. }
  405. }];
  406. });
  407. }
  408. #pragma mark - 网络请求数据
  409. - (void)getNoticeData
  410. {
  411. WS(weakSelf);
  412. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  413. __block NSInteger httpFinishCount = 0;
  414. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  415. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_Notice_Detail),(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  416. NSLog(@"通知正文%@",responseObject);
  417. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  418. weakSelf.sendUserId = weakSelf.currentNoteModel.UserId;
  419. if (++httpFinishCount == 3) {
  420. dispatch_semaphore_signal(sem);
  421. }
  422. } failure:^(NSError * _Nonnull error) {
  423. // SHOWERROR([ZYCTool handerResultData:error]);
  424. }];
  425. NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
  426. @"TypeValue":@([self backTypeValue]),//通知 2
  427. @"Page":@(self.currentPage),
  428. @"PerPage":@(20),
  429. @"sort":weakSelf.isSort ? @"asc":@"desc"
  430. };
  431. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  432. NSLog(@"评论数据列表%@",responseObject);
  433. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  434. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  435. for (NSDictionary * dict in responseObject[@"Items"]) {
  436. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  437. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  438. NSMutableArray * subArray = [NSMutableArray array];
  439. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  440. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  441. [subArray addObject:commentModel];
  442. }
  443. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  444. }
  445. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  446. }
  447. }
  448. }
  449. if (++httpFinishCount == 3) {
  450. dispatch_semaphore_signal(sem);
  451. }
  452. } failure:^(NSError * _Nonnull error) {
  453. // SHOWERROR([ZYCTool handerResultData:error]);
  454. }];
  455. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  456. @"TypeValue":@([self backTypeValue]),//通知 2
  457. @"Page":@(1),
  458. @"PerPage":@(20),
  459. @"sort":@""
  460. };
  461. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  462. NSLog(@"点赞列表%@",responseObject);
  463. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  464. if (++httpFinishCount == 3) {
  465. dispatch_semaphore_signal(sem);
  466. }
  467. } failure:^(NSError * _Nonnull error) {
  468. // SHOWERROR([ZYCTool handerResultData:error]);
  469. }];
  470. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  471. dispatch_async(dispatch_get_main_queue(), ^{
  472. [weakSelf.tableView.mj_header endRefreshing];
  473. [weakSelf.tableView.mj_footer endRefreshing];
  474. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  475. [weakSelf.tableView reloadData];
  476. });
  477. });
  478. }
  479. - (void)getTopic{
  480. WS(weakSelf);
  481. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  482. __block NSInteger httpFinishCount = 0;
  483. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  484. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_App_Detail) parameters:@{@"Id":@(self.Id),@"UserId":@([AppUserModel sharedAppUserModel].Id)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  485. NSLog(@"话题正文%@",responseObject);
  486. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  487. if (++httpFinishCount == 3) {
  488. dispatch_semaphore_signal(sem);
  489. }
  490. } failure:^(NSError * _Nonnull error) {
  491. // SHOWERROR([ZYCTool handerResultData:error]);
  492. }];
  493. NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
  494. @"TypeValue":@([self backTypeValue]),//话题 1
  495. @"Page":@(self.currentPage),
  496. @"PerPage":@(20),
  497. @"sort":weakSelf.isSort ? @"asc":@"desc"
  498. };
  499. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  500. NSLog(@"评论数据列表%@",responseObject);
  501. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  502. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  503. for (NSDictionary * dict in responseObject[@"Items"]) {
  504. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  505. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  506. NSMutableArray * subArray = [NSMutableArray array];
  507. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  508. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  509. [subArray addObject:commentModel];
  510. }
  511. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  512. }
  513. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  514. }
  515. }
  516. }
  517. if (++httpFinishCount == 3) {
  518. dispatch_semaphore_signal(sem);
  519. }
  520. } failure:^(NSError * _Nonnull error) {
  521. // SHOWERROR([ZYCTool handerResultData:error]);
  522. }];
  523. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  524. @"TypeValue":@([self backTypeValue]),//话题 1
  525. @"Page":@(1),
  526. @"PerPage":@(20),
  527. @"sort":@""
  528. };
  529. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  530. NSLog(@"点赞列表%@",responseObject);
  531. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  532. if (++httpFinishCount == 3) {
  533. dispatch_semaphore_signal(sem);
  534. }
  535. } failure:^(NSError * _Nonnull error) {
  536. // SHOWERROR([ZYCTool handerResultData:error]);
  537. }];
  538. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  539. dispatch_async(dispatch_get_main_queue(), ^{
  540. [weakSelf.tableView.mj_header endRefreshing];
  541. [weakSelf.tableView.mj_footer endRefreshing];
  542. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  543. [weakSelf.tableView reloadData];
  544. });
  545. });
  546. }
  547. - (void)getMeeting{
  548. WS(weakSelf);
  549. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  550. __block NSInteger httpFinishCount = 0;
  551. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  552. NSString * meetId = [NSString stringWithFormat:@"%ld",(long)weakSelf.Id];
  553. [[HttpManager sharedHttpManager] GETUrl:Host(UpdateMeeting(meetId)) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  554. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  555. if (++httpFinishCount == 3) {
  556. dispatch_semaphore_signal(sem);
  557. }
  558. } failure:^(NSError * _Nonnull error) {
  559. // SHOWERROR([ZYCTool handerResultData:error]);
  560. }];
  561. NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
  562. @"TypeValue":@([self backTypeValue]),//会议 10
  563. @"Page":@(self.currentPage),
  564. @"PerPage":@(20),
  565. @"sort":weakSelf.isSort ? @"asc":@"desc"
  566. };
  567. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  568. NSLog(@"评论数据列表%@",responseObject);
  569. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  570. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  571. for (NSDictionary * dict in responseObject[@"Items"]) {
  572. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  573. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  574. NSMutableArray * subArray = [NSMutableArray array];
  575. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  576. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  577. [subArray addObject:commentModel];
  578. }
  579. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  580. }
  581. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  582. }
  583. }
  584. }
  585. if (++httpFinishCount == 3) {
  586. dispatch_semaphore_signal(sem);
  587. }
  588. } failure:^(NSError * _Nonnull error) {
  589. // SHOWERROR([ZYCTool handerResultData:error]);
  590. }];
  591. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  592. @"TypeValue":@([self backTypeValue]),//会议 10
  593. @"Page":@(1),
  594. @"PerPage":@(20),
  595. @"sort":@""
  596. };
  597. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  598. NSLog(@"点赞列表%@",responseObject);
  599. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  600. if (++httpFinishCount == 3) {
  601. dispatch_semaphore_signal(sem);
  602. }
  603. } failure:^(NSError * _Nonnull error) {
  604. // SHOWERROR([ZYCTool handerResultData:error]);
  605. }];
  606. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  607. dispatch_async(dispatch_get_main_queue(), ^{
  608. [weakSelf.tableView.mj_header endRefreshing];
  609. [weakSelf.tableView.mj_footer endRefreshing];
  610. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  611. [weakSelf.tableView reloadData];
  612. });
  613. });
  614. }
  615. - (void)getNote{
  616. WS(weakSelf);
  617. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  618. __block NSInteger httpFinishCount = 0;
  619. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  620. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_NoteBook_Detail,(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  621. NSLog(@"笔记正文%@",responseObject);
  622. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  623. if (++httpFinishCount == 3) {
  624. dispatch_semaphore_signal(sem);
  625. }
  626. } failure:^(NSError * _Nonnull error) {
  627. // SHOWERROR([ZYCTool handerResultData:error]);
  628. }];
  629. NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
  630. @"TypeValue":@([self backTypeValue]),
  631. @"Page":@(self.currentPage),
  632. @"PerPage":@(20),
  633. @"sort":weakSelf.isSort ? @"asc":@"desc"
  634. };
  635. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  636. NSLog(@"评论数据列表%@",responseObject);
  637. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  638. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  639. for (NSDictionary * dict in responseObject[@"Items"]) {
  640. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  641. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  642. NSMutableArray * subArray = [NSMutableArray array];
  643. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  644. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  645. [subArray addObject:commentModel];
  646. }
  647. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  648. }
  649. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  650. }
  651. }
  652. }
  653. if (++httpFinishCount == 3) {
  654. dispatch_semaphore_signal(sem);
  655. }
  656. } failure:^(NSError * _Nonnull error) {
  657. // SHOWERROR([ZYCTool handerResultData:error]);
  658. }];
  659. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  660. @"TypeValue":@([self backTypeValue]),//会议 10
  661. @"Page":@(1),
  662. @"PerPage":@(20),
  663. @"sort":@""
  664. };
  665. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  666. NSLog(@"点赞列表%@",responseObject);
  667. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  668. if (++httpFinishCount == 3) {
  669. dispatch_semaphore_signal(sem);
  670. }
  671. } failure:^(NSError * _Nonnull error) {
  672. // SHOWERROR([ZYCTool handerResultData:error]);
  673. }];
  674. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  675. dispatch_async(dispatch_get_main_queue(), ^{
  676. [weakSelf.tableView.mj_header endRefreshing];
  677. [weakSelf.tableView.mj_footer endRefreshing];
  678. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  679. [weakSelf.tableView reloadData];
  680. });
  681. });
  682. }
  683. - (void)getAritle{
  684. WS(weakSelf);
  685. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  686. __block NSInteger httpFinishCount = 0;
  687. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  688. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,[NSString stringWithFormat:@"/api/app/article/detail/%ld",self.Id]] parameters:@{@"id":@(self.Id)}
  689. responseStyle:JOSN success:^(id _Nonnull responseObject) {
  690. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  691. if (++httpFinishCount == 3) {
  692. dispatch_semaphore_signal(sem);
  693. }
  694. } failure:^(NSError * _Nonnull error) {
  695. }];
  696. NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
  697. @"TypeValue":@([self backTypeValue]),//会议 10
  698. @"Page":@(self.currentPage),
  699. @"PerPage":@(20),
  700. @"sort":weakSelf.isSort ? @"asc":@"desc"
  701. };
  702. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  703. NSLog(@"评论数据列表%@",responseObject);
  704. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  705. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  706. for (NSDictionary * dict in responseObject[@"Items"]) {
  707. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  708. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  709. NSMutableArray * subArray = [NSMutableArray array];
  710. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  711. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  712. [subArray addObject:commentModel];
  713. }
  714. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  715. }
  716. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  717. }
  718. }
  719. }
  720. if (++httpFinishCount == 3) {
  721. dispatch_semaphore_signal(sem);
  722. }
  723. } failure:^(NSError * _Nonnull error) {
  724. // SHOWERROR([ZYCTool handerResultData:error]);
  725. }];
  726. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  727. @"TypeValue":@([self backTypeValue]),//会议 10
  728. @"Page":@(1),
  729. @"PerPage":@(20),
  730. @"sort":@""
  731. };
  732. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  733. NSLog(@"点赞列表%@",responseObject);
  734. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  735. if (++httpFinishCount == 3) {
  736. dispatch_semaphore_signal(sem);
  737. }
  738. } failure:^(NSError * _Nonnull error) {
  739. // SHOWERROR([ZYCTool handerResultData:error]);
  740. }];
  741. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  742. dispatch_async(dispatch_get_main_queue(), ^{
  743. [weakSelf.tableView.mj_header endRefreshing];
  744. [weakSelf.tableView.mj_footer endRefreshing];
  745. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  746. [weakSelf.tableView reloadData];
  747. });
  748. });
  749. }
  750. - (void)getMediaAritle{
  751. WS(weakSelf);
  752. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  753. __block NSInteger httpFinishCount = 0;
  754. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  755. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Media),weakSelf.Id];
  756. [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  757. NSLog(@"%@",responseObject);
  758. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  759. if (++httpFinishCount == 3) {
  760. dispatch_semaphore_signal(sem);
  761. }
  762. } failure:^(NSError * _Nonnull error) {
  763. if (++httpFinishCount == 3) {
  764. dispatch_semaphore_signal(sem);
  765. }
  766. }];
  767. NSDictionary * comParaDict = @{@"ArticleId":@(self.Id),
  768. @"TypeValue":@([self backTypeValue]),//会议 10
  769. @"Page":@(self.currentPage),
  770. @"PerPage":@(20),
  771. @"sort":weakSelf.isSort ? @"asc":@"desc"
  772. };
  773. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:comParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  774. NSLog(@"评论数据列表%@",responseObject);
  775. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  776. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  777. for (NSDictionary * dict in responseObject[@"Items"]) {
  778. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  779. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  780. NSMutableArray * subArray = [NSMutableArray array];
  781. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  782. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  783. [subArray addObject:commentModel];
  784. }
  785. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  786. }
  787. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  788. }
  789. }
  790. }
  791. if (++httpFinishCount == 3) {
  792. dispatch_semaphore_signal(sem);
  793. }
  794. } failure:^(NSError * _Nonnull error) {
  795. if (++httpFinishCount == 3) {
  796. dispatch_semaphore_signal(sem);
  797. }
  798. }];
  799. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  800. @"TypeValue":@([self backTypeValue]),//会议 10
  801. @"Page":@(1),
  802. @"PerPage":@(20),
  803. @"sort":@""
  804. };
  805. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  806. NSLog(@"点赞列表%@",responseObject);
  807. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  808. if (++httpFinishCount == 3) {
  809. dispatch_semaphore_signal(sem);
  810. }
  811. } failure:^(NSError * _Nonnull error) {
  812. if (++httpFinishCount == 3) {
  813. dispatch_semaphore_signal(sem);
  814. }
  815. }];
  816. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  817. dispatch_async(dispatch_get_main_queue(), ^{
  818. [weakSelf.tableView.mj_header endRefreshing];
  819. [weakSelf.tableView.mj_footer endRefreshing];
  820. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  821. [weakSelf.tableView reloadData];
  822. });
  823. });
  824. }
  825. - (void)getMail
  826. {
  827. WS(weakSelf);
  828. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  829. __block NSInteger httpFinishCount = 0;
  830. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  831. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_InterLetterDetail),(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  832. NSLog(@"%@",responseObject);
  833. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  834. [weakSelf.tableView.mj_header endRefreshing];
  835. [weakSelf.tableView.mj_footer endRefreshing];
  836. NSArray * array = responseObject[@"Items"];
  837. if ([array.firstObject isKindOfClass:[NSDictionary class]]) {
  838. weakSelf.sendUserId = [[array.firstObject objectForKey:@"UserId"] integerValue];
  839. }
  840. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:array.firstObject error:nil];
  841. if (++httpFinishCount == 2) {
  842. dispatch_semaphore_signal(sem);
  843. }
  844. }
  845. } failure:^(NSError * _Nonnull error) {
  846. // SHOWERROR([ZYCTool handerResultData:error]);
  847. }];
  848. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  849. @"TypeValue":@([self backTypeValue]),//会议 10
  850. @"Page":@(1),
  851. @"PerPage":@(20),
  852. @"sort":@""
  853. };
  854. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  855. NSLog(@"点赞列表%@",responseObject);
  856. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  857. if (++httpFinishCount == 2) {
  858. dispatch_semaphore_signal(sem);
  859. }
  860. } failure:^(NSError * _Nonnull error) {
  861. // SHOWERROR([ZYCTool handerResultData:error]);
  862. }];
  863. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  864. dispatch_async(dispatch_get_main_queue(), ^{
  865. [weakSelf.tableView.mj_header endRefreshing];
  866. [weakSelf.tableView.mj_footer endRefreshing];
  867. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  868. [weakSelf.tableView reloadData];
  869. });
  870. });
  871. }
  872. #pragma mark - 刷新点赞数据
  873. - (void)refreshNoticeData
  874. {
  875. WS(weakSelf);
  876. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  877. __block NSInteger httpFinishCount = 0;
  878. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  879. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%ld",Host(API_Notice_Detail),(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  880. NSLog(@"通知正文%@",responseObject);
  881. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  882. if (++httpFinishCount == 2) {
  883. dispatch_semaphore_signal(sem);
  884. }
  885. } failure:^(NSError * _Nonnull error) {
  886. // SHOWERROR([ZYCTool handerResultData:error]);
  887. }];
  888. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  889. @"TypeValue":@([self backTypeValue]),//通知 2
  890. @"Page":@(1),
  891. @"PerPage":@(20),
  892. @"sort":@""
  893. };
  894. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  895. NSLog(@"点赞列表%@",responseObject);
  896. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  897. if (++httpFinishCount == 2) {
  898. dispatch_semaphore_signal(sem);
  899. }
  900. } failure:^(NSError * _Nonnull error) {
  901. // SHOWERROR([ZYCTool handerResultData:error]);
  902. }];
  903. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  904. dispatch_async(dispatch_get_main_queue(), ^{
  905. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  906. [weakSelf.tableView reloadData];
  907. });
  908. });
  909. }
  910. - (void)refreshTopicData
  911. {
  912. WS(weakSelf);
  913. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  914. __block NSInteger httpFinishCount = 0;
  915. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  916. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_App_Detail) parameters:@{@"Id":@(self.Id),@"UserId":@([AppUserModel sharedAppUserModel].Id)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  917. NSLog(@"话题正文%@",responseObject);
  918. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  919. if (++httpFinishCount == 2) {
  920. dispatch_semaphore_signal(sem);
  921. }
  922. } failure:^(NSError * _Nonnull error) {
  923. // SHOWERROR([ZYCTool handerResultData:error]);
  924. }];
  925. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  926. @"TypeValue":@([self backTypeValue]),//话题 1
  927. @"Page":@(1),
  928. @"PerPage":@(20),
  929. @"sort":@""
  930. };
  931. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  932. NSLog(@"点赞列表%@",responseObject);
  933. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  934. if (++httpFinishCount == 2) {
  935. dispatch_semaphore_signal(sem);
  936. }
  937. } failure:^(NSError * _Nonnull error) {
  938. // SHOWERROR([ZYCTool handerResultData:error]);
  939. }];
  940. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  941. dispatch_async(dispatch_get_main_queue(), ^{
  942. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  943. [weakSelf.tableView reloadData];
  944. });
  945. });
  946. }
  947. - (void)refreshMeetingData
  948. {
  949. WS(weakSelf);
  950. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  951. __block NSInteger httpFinishCount = 0;
  952. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  953. NSString * meetId = [NSString stringWithFormat:@"%ld",(long)weakSelf.Id];
  954. [[HttpManager sharedHttpManager] GETUrl:Host(UpdateMeeting(meetId)) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  955. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  956. if (++httpFinishCount == 2) {
  957. dispatch_semaphore_signal(sem);
  958. }
  959. } failure:^(NSError * _Nonnull error) {
  960. // SHOWERROR([ZYCTool handerResultData:error]);
  961. }];
  962. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  963. @"TypeValue":@([self backTypeValue]),//话题 1
  964. @"Page":@(1),
  965. @"PerPage":@(20),
  966. @"sort":@""
  967. };
  968. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  969. NSLog(@"点赞列表%@",responseObject);
  970. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  971. if (++httpFinishCount == 2) {
  972. dispatch_semaphore_signal(sem);
  973. }
  974. } failure:^(NSError * _Nonnull error) {
  975. // SHOWERROR([ZYCTool handerResultData:error]);
  976. }];
  977. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  978. dispatch_async(dispatch_get_main_queue(), ^{
  979. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  980. [weakSelf.tableView reloadData];
  981. });
  982. });
  983. }
  984. - (void)refreshNoteData
  985. {
  986. WS(weakSelf);
  987. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  988. __block NSInteger httpFinishCount = 0;
  989. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  990. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_NoteBook_Detail,(long)self.Id] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  991. NSLog(@"话题正文%@",responseObject);
  992. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  993. if (++httpFinishCount == 2) {
  994. dispatch_semaphore_signal(sem);
  995. }
  996. } failure:^(NSError * _Nonnull error) {
  997. // SHOWERROR([ZYCTool handerResultData:error]);
  998. }];
  999. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  1000. @"TypeValue":@([self backTypeValue]),//话题 1
  1001. @"Page":@(1),
  1002. @"PerPage":@(20),
  1003. @"sort":@""
  1004. };
  1005. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1006. NSLog(@"点赞列表%@",responseObject);
  1007. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  1008. if (++httpFinishCount == 2) {
  1009. dispatch_semaphore_signal(sem);
  1010. }
  1011. } failure:^(NSError * _Nonnull error) {
  1012. // SHOWERROR([ZYCTool handerResultData:error]);
  1013. }];
  1014. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  1015. dispatch_async(dispatch_get_main_queue(), ^{
  1016. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  1017. [weakSelf.tableView reloadData];
  1018. });
  1019. });
  1020. }
  1021. - (void)refreshAritleData
  1022. {
  1023. WS(weakSelf);
  1024. SHOWLOADING
  1025. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  1026. __block NSInteger httpFinishCount = 0;
  1027. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  1028. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,[NSString stringWithFormat:@"/api/app/article/detail/%ld",self.Id]] parameters:@{@"id":@(self.Id)}
  1029. responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1030. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  1031. if (++httpFinishCount == 2) {
  1032. dispatch_semaphore_signal(sem);
  1033. }
  1034. } failure:^(NSError * _Nonnull error) {
  1035. REMOVESHOW
  1036. }];
  1037. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  1038. @"TypeValue":@([self backTypeValue]),//会议 10
  1039. @"Page":@(1),
  1040. @"PerPage":@(20),
  1041. @"sort":@""
  1042. };
  1043. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1044. NSLog(@"点赞列表%@",responseObject);
  1045. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  1046. if (++httpFinishCount == 2) {
  1047. dispatch_semaphore_signal(sem);
  1048. }
  1049. } failure:^(NSError * _Nonnull error) {
  1050. REMOVESHOW
  1051. }];
  1052. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  1053. dispatch_async(dispatch_get_main_queue(), ^{
  1054. REMOVESHOW
  1055. [weakSelf.tableView.mj_header endRefreshing];
  1056. [weakSelf.tableView.mj_footer endRefreshing];
  1057. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  1058. [weakSelf.tableView reloadData];
  1059. });
  1060. });
  1061. }
  1062. - (void)refreshMediaAritleData
  1063. {
  1064. WS(weakSelf);
  1065. SHOWLOADING
  1066. dispatch_semaphore_t sem = dispatch_semaphore_create(0);
  1067. __block NSInteger httpFinishCount = 0;
  1068. [[HttpManager sharedHttpManager] cancelRequest];
  1069. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  1070. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Media),weakSelf.Id];
  1071. [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1072. NSLog(@"%@",responseObject);
  1073. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  1074. weakSelf.currentNoteModel = [[MyNoteBookDetailModel alloc]initWithDictionary:responseObject error:nil];
  1075. if (++httpFinishCount == 2) {
  1076. dispatch_semaphore_signal(sem);
  1077. }
  1078. }else{
  1079. NSLog(@"asfasfas");
  1080. }
  1081. } failure:^(NSError * _Nonnull error) {
  1082. if (++httpFinishCount == 2) {
  1083. dispatch_semaphore_signal(sem);
  1084. }
  1085. }];
  1086. NSDictionary * AnaParaDict = @{@"SourceId":@(self.Id),
  1087. @"TypeValue":@([self backTypeValue]),//会议 10
  1088. @"Page":@(1),
  1089. @"PerPage":@(20),
  1090. @"sort":@""
  1091. };
  1092. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_List) parameters:AnaParaDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1093. NSLog(@"点赞列表%@",responseObject);
  1094. weakSelf.currentZanModel = [[MyNodeBookZanModel alloc]initWithDictionary:responseObject error:nil];
  1095. if (++httpFinishCount == 2) {
  1096. dispatch_semaphore_signal(sem);
  1097. }
  1098. } failure:^(NSError * _Nonnull error) {
  1099. if (++httpFinishCount == 2) {
  1100. dispatch_semaphore_signal(sem);
  1101. }
  1102. }];
  1103. dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
  1104. dispatch_async(dispatch_get_main_queue(), ^{
  1105. REMOVESHOW
  1106. [weakSelf.tableView.mj_header endRefreshing];
  1107. [weakSelf.tableView.mj_footer endRefreshing];
  1108. [weakSelf setBottomViewData:weakSelf.currentNoteModel];
  1109. [weakSelf.tableView reloadData];
  1110. });
  1111. });
  1112. }
  1113. - (MHTopicFrame *)_topicFrameWithTopic:(MHTopic *)topic
  1114. {
  1115. MHTopicFrame *topicFrame = [[MHTopicFrame alloc] init];
  1116. // 传递微博模型数据,计算所有子控件的frame
  1117. topicFrame.topic = topic;
  1118. return topicFrame;
  1119. }
  1120. - (void)sortCommentList
  1121. {
  1122. WS(weakSelf);
  1123. NSArray * array = self.commentArray;
  1124. self.commentArray =[NSMutableArray arrayWithArray:[[array reverseObjectEnumerator] allObjects]];
  1125. dispatch_async(dispatch_get_main_queue(), ^{
  1126. [weakSelf.tableView reloadData];
  1127. });
  1128. }
  1129. - (void)RefreshCommentList
  1130. {
  1131. WS(weakSelf);
  1132. [self.commentArray removeAllObjects];
  1133. self.currentPage = 1;
  1134. NSDictionary * paraDict = @{@"ArticleId":@(self.Id),
  1135. @"TypeValue":@([self backTypeValue]),//话题 1
  1136. @"Page":@(self.currentPage),
  1137. @"PerPage":@(20),
  1138. @"sort":weakSelf.isSort ? @"asc":@"desc"
  1139. };
  1140. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1141. NSLog(@"评论数据列表%@",responseObject);
  1142. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  1143. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  1144. for (NSDictionary * dict in responseObject[@"Items"]) {
  1145. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  1146. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  1147. NSMutableArray * subArray = [NSMutableArray array];
  1148. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  1149. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  1150. [subArray addObject:commentModel];
  1151. }
  1152. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  1153. }
  1154. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  1155. }
  1156. }
  1157. }
  1158. dispatch_async(dispatch_get_main_queue(), ^{
  1159. [weakSelf.tableView reloadData];
  1160. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1161. weakSelf.dismissSelf = NO;
  1162. });
  1163. });
  1164. } failure:^(NSError * _Nonnull error) {
  1165. // SHOWERROR([ZYCTool handerResultData:error]);
  1166. }];
  1167. }
  1168. - (void)headRefresh{
  1169. self.isFresh = YES;
  1170. self.currentPage = 1;
  1171. [self.commentArray removeAllObjects];
  1172. [self loadDataWebView];
  1173. switch (self.type) {
  1174. case CollectModel_Notice:
  1175. {
  1176. [self getNoticeData];
  1177. }
  1178. break;
  1179. case CollectModel_Toipc:
  1180. {
  1181. [self getTopic];
  1182. }
  1183. break;
  1184. case CollectModel_NewTopic:
  1185. {
  1186. [self getNote];
  1187. }
  1188. break;
  1189. case CollectModel_Group:
  1190. {
  1191. [self getTopic];
  1192. }
  1193. break;
  1194. case CollectModel_meetMian:
  1195. {
  1196. [self getMeeting];
  1197. }
  1198. break;
  1199. case CollectModel_NoteBook:
  1200. {
  1201. [self getNote];
  1202. }
  1203. break;
  1204. case CollectModel_InterMail:
  1205. {
  1206. [self getMail];
  1207. }
  1208. break;
  1209. case CollectModel_NoSignMail:
  1210. {
  1211. [self getMail];
  1212. }
  1213. break;
  1214. case CollectModel_Aritle:
  1215. {
  1216. [self getAritle];
  1217. }
  1218. break;
  1219. case CollectModel_MediaAritle:
  1220. {
  1221. [self getMediaAritle];
  1222. }
  1223. break;
  1224. default:
  1225. break;
  1226. }
  1227. }
  1228. - (void)footerRefresh{
  1229. self.isFresh = NO;
  1230. self.currentPage += 1;
  1231. if (self.commentArray.count == self.currentNoteCommentModel.Total) {
  1232. self.tableView.mj_footer.hidden = YES;
  1233. [self.tableView.mj_footer resetNoMoreData];
  1234. return;
  1235. }
  1236. NSDictionary * paraDict = @{@"ArticleId":@(self.Id),
  1237. @"TypeValue":@([self backTypeValue]),//话题 1
  1238. @"Page":@(self.currentPage),
  1239. @"PerPage":@(20),
  1240. @"sort":self.isSort ? @"asc":@"desc"
  1241. };
  1242. WS(weakSelf);
  1243. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_List) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1244. NSLog(@"评论数据列表%@",responseObject);
  1245. if ([responseObject isKindOfClass:[NSDictionary class]]) {
  1246. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  1247. for (NSDictionary * dict in responseObject[@"Items"]) {
  1248. MHTopic * topic = [MHTopic modelWithDictionary:dict];
  1249. if ([[dict objectForKey:@"TopicCommentReplyResults"] isKindOfClass:[NSArray class]]) {
  1250. NSMutableArray * subArray = [NSMutableArray array];
  1251. for (NSDictionary * subDict in dict[@"TopicCommentReplyResults"]) {
  1252. MHComment * commentModel = [MHComment modelWithDictionary:subDict];
  1253. [subArray addObject:commentModel];
  1254. }
  1255. topic.CommentReplyResults = [NSMutableArray arrayWithArray:subArray];
  1256. }
  1257. [weakSelf.commentArray addObject:[weakSelf _topicFrameWithTopic:topic]];
  1258. }
  1259. }
  1260. }
  1261. dispatch_async(dispatch_get_main_queue(), ^{
  1262. [weakSelf.tableView reloadData];
  1263. });
  1264. } failure:^(NSError * _Nonnull error) {
  1265. // SHOWERROR([ZYCTool handerResultData:error]);
  1266. weakSelf.currentPage -= 1;
  1267. }];
  1268. [self.tableView.mj_footer endRefreshing];
  1269. }
  1270. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  1271. if (self.type == CollectModel_InterMail || self.type == CollectModel_NoSignMail) {
  1272. return 1;
  1273. }
  1274. return 2;
  1275. }
  1276. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  1277. if (self.currentZanModel.Items.count == 0) {
  1278. switch (section) {
  1279. case 0:
  1280. return 0;
  1281. break;
  1282. default:
  1283. return self.commentArray.count;
  1284. break;
  1285. }
  1286. }else{
  1287. switch (section) {
  1288. case 0:
  1289. return 1;
  1290. break;
  1291. default:
  1292. return self.commentArray.count;
  1293. break;
  1294. }
  1295. }
  1296. }
  1297. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  1298. {
  1299. if (self.currentZanModel.Items.count == 0 && self.commentArray.count == 0) {
  1300. MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
  1301. if (topicFrame.tableViewFrame.size.height == 0) {
  1302. return topicFrame.height+topicFrame.tableViewFrame.size.height;
  1303. }else{
  1304. return topicFrame.height+topicFrame.tableViewFrame.size.height+MHTopicVerticalSpace;
  1305. }
  1306. }else{
  1307. switch (indexPath.section) {
  1308. case 0:
  1309. return UITableViewAutomaticDimension;
  1310. break;
  1311. default:
  1312. {
  1313. MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
  1314. if (topicFrame.tableViewFrame.size.height == 0) {
  1315. return topicFrame.height + topicFrame.tableViewFrame.size.height;
  1316. }else{
  1317. return topicFrame.height + topicFrame.tableViewFrame.size.height;
  1318. }
  1319. }
  1320. break;
  1321. }
  1322. }
  1323. }
  1324. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  1325. WS(weakSelf);
  1326. if (self.currentZanModel.Items.count == 0 && self.commentArray.count == 0) {
  1327. MHTopicCell *cell = [MHTopicCell cellWithTableView:tableView];
  1328. cell.backgroundColor = [UIColor whiteColor];
  1329. MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
  1330. cell.topicFrame = topicFrame;
  1331. cell.createTimeLabel.text = [NSString stringWithFormat:@"%@ %@",topicFrame.topic.FloorCount,topicFrame.topic.CreatedTime];
  1332. [cell.thumbBtn setAction:^{
  1333. [weakSelf gotoZanCommentHanderModel:topicFrame.topic indexPath:indexPath];
  1334. }];
  1335. cell.replyContentBlock = ^{
  1336. [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
  1337. // if (topicFrame.topic.UserId != [AppUserModel sharedAppUserModel].Id) {
  1338. // [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
  1339. // }
  1340. };
  1341. __block MHTopicCell * bCell = cell;
  1342. cell.longBlock = ^{
  1343. weakSelf.commentId = topicFrame.topic.Id;
  1344. weakSelf.commentStr = topicFrame.topic.Content;
  1345. weakSelf.isSelf = topicFrame.topic.UserId == [AppUserModel sharedAppUserModel].Id;
  1346. if (weakSelf.isSelf) {
  1347. [weakSelf longDeleteSelf:bCell];
  1348. }
  1349. };
  1350. cell.longSubBlock = ^(NSInteger commentId,UILabel * label,NSString * Content) {
  1351. weakSelf.commentId = commentId;
  1352. weakSelf.commentStr = Content;
  1353. [weakSelf longDeleteSubCell:label];
  1354. };
  1355. cell.delegate = self;
  1356. return cell;
  1357. }else{
  1358. switch (indexPath.section) {
  1359. case 0:{
  1360. WS(weakSelf);
  1361. NoteBookDetailCell *cell = [NoteBookDetailCell configCell3:tableView indexPath:indexPath];
  1362. cell.commentSortBtn.hidden = self.commentArray.count == 0 ? YES : NO;
  1363. [cell.commentSortBtn setAction:^{
  1364. weakSelf.isSort = !weakSelf.isSort;
  1365. cell.commentSortBtn.selected = !cell.commentSortBtn.isSelected;
  1366. [weakSelf sortCommentList];
  1367. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1368. weakSelf.isScrComment = YES;
  1369. [weakSelf scrollToCommentViewTop];
  1370. });
  1371. }];
  1372. switch (self.currentZanModel.Items.count) {
  1373. case 0:{
  1374. cell.zanNameLabel.text = @"";
  1375. cell.zanNumberlabel.text = @"";
  1376. }break;
  1377. case 1:{
  1378. MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
  1379. cell.zanNameLabel.text = model.UserName;
  1380. cell.zanNumberlabel.text = [NSString stringWithFormat:@" %lu人点赞",(unsigned long)self.currentZanModel.Items.count];
  1381. }break;
  1382. case 2:{
  1383. MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
  1384. MyNoteBookZanSubModel *model1 = self.currentZanModel.Items[1];
  1385. cell.zanNameLabel.text = [NSString stringWithFormat:@"%@、%@",model.UserName,model1.UserName];
  1386. cell.zanNumberlabel.text = [NSString stringWithFormat:@" %lu人点赞",(unsigned long)self.currentZanModel.Items.count];
  1387. }break;
  1388. case 3:{
  1389. MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
  1390. MyNoteBookZanSubModel *model1 = self.currentZanModel.Items[1];
  1391. MyNoteBookZanSubModel *model2 = self.currentZanModel.Items[2];
  1392. cell.zanNameLabel.text = [NSString stringWithFormat:@"%@、%@、%@",model.UserName,model1.UserName,model2.UserName];
  1393. cell.zanNumberlabel.text = [NSString stringWithFormat:@" %lu人点赞",(unsigned long)self.currentZanModel.Items.count];
  1394. }break;
  1395. default:{
  1396. MyNoteBookZanSubModel *model = self.currentZanModel.Items[0];
  1397. MyNoteBookZanSubModel *model1 = self.currentZanModel.Items[1];
  1398. MyNoteBookZanSubModel *model2 = self.currentZanModel.Items[2];
  1399. cell.zanNameLabel.text = [NSString stringWithFormat:@"%@、%@、%@",model.UserName,model1.UserName,model2.UserName];
  1400. cell.zanNumberlabel.text = [NSString stringWithFormat:@" 等%lu人点赞",(unsigned long)self.currentZanModel.Total];
  1401. }break;
  1402. }
  1403. return cell;
  1404. }break;
  1405. default:{
  1406. MHTopicCell *cell = [MHTopicCell cellWithTableView:tableView];
  1407. MHTopicFrame *topicFrame = self.commentArray[indexPath.row];
  1408. cell.topicFrame = topicFrame;
  1409. cell.createTimeLabel.text = [NSString stringWithFormat:@"%@ %@",topicFrame.topic.FloorCount,topicFrame.topic.CreatedTime];
  1410. [cell.thumbBtn setAction:^{
  1411. [weakSelf gotoZanCommentHanderModel:topicFrame.topic indexPath:indexPath];
  1412. }];
  1413. cell.replyContentBlock = ^{
  1414. [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
  1415. // if (topicFrame.topic.UserId != [AppUserModel sharedAppUserModel].Id) {
  1416. // [weakSelf replyCommentName:topicFrame.topic.Name andId:[NSString stringWithFormat:@"%ld",(long)topicFrame.topic.Id]];
  1417. // }
  1418. };
  1419. __block MHTopicCell * bCell = cell;
  1420. cell.longBlock = ^{
  1421. weakSelf.commentId = topicFrame.topic.Id;
  1422. weakSelf.commentStr = topicFrame.topic.Content;
  1423. weakSelf.isSelf = topicFrame.topic.UserId == [AppUserModel sharedAppUserModel].Id;
  1424. if (weakSelf.isSelf) {
  1425. [weakSelf longDeleteSelf:bCell];
  1426. }
  1427. };
  1428. cell.longSubBlock = ^(NSInteger commentId,UILabel * label,NSString * Content) {
  1429. weakSelf.commentId = commentId;
  1430. weakSelf.commentStr = Content;
  1431. [weakSelf longDeleteSubCell:label];
  1432. };
  1433. cell.delegate = self;
  1434. return cell;
  1435. }break;
  1436. }
  1437. }
  1438. }
  1439. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  1440. if (self.currentZanModel.Items.count > 0) {
  1441. switch (indexPath.section) {
  1442. case 0://点赞
  1443. {
  1444. ClickOKViewController *vc = [ClickOKViewController initClickOKViewController];
  1445. vc.indexId = self.Id;
  1446. vc.zanToTal = self.currentZanModel.Items.count;
  1447. vc.type = [self backTypeValue];
  1448. [self.navigationController pushViewController:vc animated:YES];
  1449. }
  1450. break;
  1451. default:
  1452. break;
  1453. }
  1454. }
  1455. }
  1456. #pragma mark - 点击文件跳转
  1457. - (void)pushVCWithDict:(NSDictionary *)dict
  1458. {
  1459. NSInteger Id = [dict[@"id"] integerValue];
  1460. NSInteger userId = [dict[@"userId"] integerValue];
  1461. NSString * title = dict[@"title"];
  1462. WS(weakSelf);
  1463. switch ([dict[@"type"] integerValue]) {
  1464. case CollectModel_Group:
  1465. {
  1466. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  1467. vc.GroupId = Id;
  1468. vc.titleStr = title;
  1469. [self.navigationController pushViewController:vc animated:YES];
  1470. }
  1471. break;
  1472. case CollectModel_file:{
  1473. DownFileViewController * vc = [[DownFileViewController alloc] init];
  1474. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  1475. model.Title = title;
  1476. model.SoureId = Id;
  1477. model.Url = dict[@"bigurl"];
  1478. model.MinUrl = dict[@"smallurl"];
  1479. model.SoureTypeId = CollectModel_file;
  1480. vc.model = model;
  1481. [self.navigationController pushViewController:vc animated:YES];
  1482. }break;
  1483. case CollectModel_Image:{
  1484. DownFileViewController * vc = [[DownFileViewController alloc] init];
  1485. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  1486. model.Title = title;
  1487. model.SoureId = Id;
  1488. model.Url = dict[@"bigurl"];
  1489. model.MinUrl = dict[@"smallurl"];
  1490. model.SoureTypeId = CollectModel_Image;
  1491. vc.model = model;
  1492. [self.navigationController pushViewController:vc animated:YES];
  1493. }break;
  1494. case CollectModel_Aritle:{
  1495. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1496. vc.type = CollectModel_Aritle;
  1497. vc.Id = Id;
  1498. [weakSelf.navigationController pushViewController:vc animated:YES];
  1499. }break;
  1500. case CollectModel_MediaAritle:{
  1501. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1502. vc.type = CollectModel_Aritle;
  1503. vc.Id = Id;
  1504. [weakSelf.navigationController pushViewController:vc animated:YES];
  1505. }break;
  1506. case CollectModel_Notice:{
  1507. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1508. vc.type = CollectModel_Notice;
  1509. vc.Id = Id;
  1510. [self.navigationController pushViewController:vc animated:YES];
  1511. }break;
  1512. case CollectModel_TopicBooK:{
  1513. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  1514. vc.listType = MyFavoriteListLevelTypeA ;
  1515. vc.FolderId = Id;
  1516. vc.CollectionDataId = Id;
  1517. vc.CollectionType = CollectModel_TopicBooK;
  1518. vc.Author = title;
  1519. vc.TypeValue = 1;
  1520. vc.myTitle = title;
  1521. vc.VisitUserId = userId;
  1522. [self.navigationController pushViewController:vc animated:YES];
  1523. }break;
  1524. case CollectModel_TopicSubBooK:{
  1525. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  1526. vc.listType = MyFavoriteListLevelTypeB ;
  1527. vc.FolderId = Id;
  1528. vc.CollectionDataId = Id;
  1529. vc.CollectionType = CollectModel_TopicSubBooK;
  1530. vc.Author = title;
  1531. vc.TypeValue = 1;
  1532. vc.myTitle = title;
  1533. vc.VisitUserId = userId;
  1534. [self.navigationController pushViewController:vc animated:YES];
  1535. }break;
  1536. case CollectModel_Toipc:{
  1537. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1538. vc.type = CollectModel_Toipc;
  1539. vc.Id = Id;
  1540. [self.navigationController pushViewController:vc animated:YES];
  1541. }break;
  1542. case CollectModel_NewTopic:{
  1543. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1544. vc.type = CollectModel_NewTopic;
  1545. vc.Id = Id;
  1546. [self.navigationController pushViewController:vc animated:YES];
  1547. }break;
  1548. case CollectModel_NoteBook:{
  1549. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1550. vc.type = CollectModel_NoteBook;
  1551. vc.Id = Id;
  1552. [self.navigationController pushViewController:vc animated:YES];
  1553. }break;
  1554. case CollectModel_Collect:{
  1555. }break;
  1556. case CollectModel_CollectFile:{
  1557. if (userId == [AppUserModel sharedAppUserModel].Id) {
  1558. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  1559. vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1560. vc.ParentId = 0;
  1561. vc.FolderId = Id;
  1562. vc.myTitle = title;
  1563. [self.navigationController pushViewController:vc animated:YES];
  1564. }else{
  1565. OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
  1566. vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1567. vc.ParentId = 0;
  1568. vc.FolderId = Id;
  1569. vc.myTitle = title;
  1570. vc.VisitUserId = userId;
  1571. [self.navigationController pushViewController:vc animated:YES];
  1572. }
  1573. }break;
  1574. case CollectModel_NoteFile:{
  1575. if (userId == [AppUserModel sharedAppUserModel].Id) {
  1576. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  1577. vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1578. vc.ParentId = 0;
  1579. vc.FolderId = Id;
  1580. vc.myTitle = title;
  1581. vc.TypeValue = 1;
  1582. vc.VisitUserId = 0;
  1583. [self.navigationController pushViewController:vc animated:YES];
  1584. }else{
  1585. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  1586. vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1587. vc.ParentId = 0;
  1588. vc.FolderId = Id;
  1589. vc.myTitle = title;
  1590. vc.TypeValue = 1;
  1591. vc.VisitUserId = userId;
  1592. [self.navigationController pushViewController:vc animated:YES];
  1593. }
  1594. }break;
  1595. case CollectModel_InterMail:{
  1596. TDInterLeterDetailVC * vc = [TDInterLeterDetailVC initTDInterLeterDetailVC];
  1597. vc.detailType = InterLeterDetialType_Sign;
  1598. vc.interLeterID = Id;
  1599. [self.navigationController pushViewController:vc animated:YES];
  1600. }break;
  1601. case CollectModel_NoSignMail:{
  1602. TDInterLeterDetailVC * vc = [TDInterLeterDetailVC initTDInterLeterDetailVC];
  1603. vc.detailType = InterLeterDetialType_NoSign;
  1604. vc.interLeterID = Id;
  1605. [self.navigationController pushViewController:vc animated:YES];
  1606. }break;
  1607. case CollectModel_work:{
  1608. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  1609. vc.pageType = Type_ONEC;
  1610. vc.indexId = Id;
  1611. vc.title = title;
  1612. vc.TodoId = Id;
  1613. [self.navigationController pushViewController:vc animated:YES];
  1614. }break;
  1615. case CollectModel_StoreSound:
  1616. {
  1617. BookListenVC * vc = [BookListenVC initBookListenVC];
  1618. vc.Id = Id;
  1619. vc.MediaType = MediaMusicType;
  1620. [self.navigationController pushViewController:vc animated:YES];
  1621. }
  1622. break;
  1623. case CollectModel_StoreVideo:
  1624. {
  1625. BookWCDetailVC * vc = [BookWCDetailVC initBookWCDetailVC];
  1626. vc.Id = Id;
  1627. [self.navigationController pushViewController:vc animated:YES];
  1628. }
  1629. break;
  1630. case CollectModel_meetDetail:{
  1631. WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:Id];
  1632. [self.navigationController pushViewController:vc animated:YES];
  1633. }break;
  1634. case CollectModel_meetMian:{
  1635. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1636. vc.type = CollectModel_meetMian;
  1637. vc.Id = Id;
  1638. [self.navigationController pushViewController:vc animated:YES];
  1639. }break;
  1640. case CollectModel_financeCount:{
  1641. CountDataVC *vc = [CountDataVC initCountDataVC];
  1642. vc.index = 0;
  1643. vc.titleStr = @"财务统计";
  1644. [self.navigationController pushViewController:vc animated:YES];
  1645. }break;
  1646. case CollectModel_affairsCount:{
  1647. CountDataVC *vc = [CountDataVC initCountDataVC];
  1648. vc.index = 1;
  1649. vc.titleStr = @"人事统计";
  1650. [self.navigationController pushViewController:vc animated:YES];
  1651. }break;
  1652. case CollectModel_publishCount:{
  1653. CountDataVC *vc = [CountDataVC initCountDataVC];
  1654. vc.index = 2;
  1655. vc.titleStr = @"出版统计";
  1656. [self.navigationController pushViewController:vc animated:YES];
  1657. }break;
  1658. default:
  1659. break;
  1660. }
  1661. }
  1662. #pragma mark - 操作 (删除 | 编辑 | 点赞列表 | 点赞正文 | 评论正文 | 转发正文 | 点赞评论 )
  1663. /// 删除
  1664. - (void)deleteButtonHander{
  1665. WS(weakSelf);
  1666. NSString * title = @"确认删除";
  1667. switch (self.type) {
  1668. case CollectModel_Notice:
  1669. {
  1670. title = @"确认撤回";
  1671. }
  1672. break;
  1673. case CollectModel_InterMail:
  1674. {
  1675. title = @"确认撤回";
  1676. }
  1677. break;
  1678. default:
  1679. {
  1680. title = @"确认删除";
  1681. }
  1682. break;
  1683. }
  1684. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:(UIAlertControllerStyleAlert)];
  1685. UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  1686. [weakSelf cancelAction];
  1687. }];
  1688. UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  1689. }];
  1690. [alert addAction:sureAction];
  1691. [alert addAction:cancelAction];
  1692. [weakSelf presentViewController:alert animated:YES completion:^{
  1693. }];
  1694. }
  1695. - (void)cancelAction
  1696. {
  1697. WS(weakSelf);
  1698. switch (self.type) {
  1699. case CollectModel_Toipc:
  1700. {
  1701. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Topic),(long)self.Id];
  1702. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1703. SHOWSUCCESS(@"删除成功");
  1704. if (weakSelf.RefreshTopicBlock) {
  1705. weakSelf.RefreshTopicBlock();
  1706. }
  1707. [weakSelf.navigationController popViewControllerAnimated:YES];
  1708. } failure:^(NSError * _Nonnull error) {
  1709. // SHOWERROR([ZYCTool handerResultData:error]);
  1710. }];
  1711. }
  1712. break;
  1713. case CollectModel_NewTopic:
  1714. {
  1715. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NoteBook_Detail),(long)self.Id];
  1716. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1717. SHOWSUCCESS(@"删除成功");
  1718. if (weakSelf.RefreshTopicBlock) {
  1719. weakSelf.RefreshTopicBlock();
  1720. }
  1721. [weakSelf.navigationController popViewControllerAnimated:YES];
  1722. } failure:^(NSError * _Nonnull error) {
  1723. // SHOWERROR([ZYCTool handerResultData:error]);
  1724. }];
  1725. }
  1726. break;
  1727. case CollectModel_Group:
  1728. {
  1729. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NoteBook_Detail),(long)self.Id];
  1730. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1731. SHOWSUCCESS(@"删除成功");
  1732. if (weakSelf.RefreshTopicBlock) {
  1733. weakSelf.RefreshTopicBlock();
  1734. }
  1735. [weakSelf.navigationController popViewControllerAnimated:YES];
  1736. } failure:^(NSError * _Nonnull error) {
  1737. }];
  1738. }
  1739. break;
  1740. case CollectModel_Notice:
  1741. {
  1742. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NOTICE_RECALL),(long)self.Id];
  1743. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1744. SHOWSUCCESS(@"撤回成功");
  1745. if (weakSelf.RefreshTopicBlock) {
  1746. weakSelf.RefreshTopicBlock();
  1747. }
  1748. [weakSelf.navigationController popViewControllerAnimated:YES];
  1749. } failure:^(NSError * _Nonnull error) {
  1750. }];
  1751. }
  1752. break;
  1753. case CollectModel_NoteBook:
  1754. {
  1755. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NoteBook_Detail),(long)self.Id];
  1756. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1757. SHOWSUCCESS(@"删除成功");
  1758. if (weakSelf.RefreshTopicBlock) {
  1759. weakSelf.RefreshTopicBlock();
  1760. }
  1761. [weakSelf.navigationController popViewControllerAnimated:YES];
  1762. } failure:^(NSError * _Nonnull error) {
  1763. }];
  1764. }
  1765. break;
  1766. case CollectModel_InterMail:
  1767. {
  1768. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NOTICE_RECALL),(long)self.Id];
  1769. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1770. SHOWSUCCESS(@"撤回成功");
  1771. if (weakSelf.RefreshTopicBlock) {
  1772. weakSelf.RefreshTopicBlock();
  1773. }
  1774. [weakSelf.navigationController popViewControllerAnimated:YES];
  1775. } failure:^(NSError * _Nonnull error) {
  1776. }];
  1777. }
  1778. break;
  1779. case CollectModel_meetMian:
  1780. {
  1781. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/api/app/meeting/summary/"),(long)self.Id];
  1782. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1783. SHOWSUCCESS(@"撤回成功");
  1784. if (weakSelf.RefreshTopicBlock) {
  1785. weakSelf.RefreshTopicBlock();
  1786. }
  1787. [weakSelf.navigationController popViewControllerAnimated:YES];
  1788. } failure:^(NSError * _Nonnull error) {
  1789. }];
  1790. }
  1791. break;
  1792. case CollectModel_NoSignMail:
  1793. {
  1794. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_NOTICE_RECALL),(long)self.Id];
  1795. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1796. SHOWSUCCESS(@"撤回成功");
  1797. if (weakSelf.RefreshTopicBlock) {
  1798. weakSelf.RefreshTopicBlock();
  1799. }
  1800. [weakSelf.navigationController popViewControllerAnimated:YES];
  1801. } failure:^(NSError * _Nonnull error) {
  1802. }];
  1803. }
  1804. break;
  1805. default:
  1806. break;
  1807. }
  1808. }
  1809. /// 编辑
  1810. - (void)editorButtonHander{
  1811. self.webH = 0;
  1812. WS(weakSelf);
  1813. if (self.RefreshTopicBlock) {
  1814. self.RefreshTopicBlock();
  1815. }
  1816. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1817. vc.upDateBlock = ^{
  1818. [weakSelf headRefresh];
  1819. };
  1820. vc.isEdit = YES;
  1821. vc.FolderId = self.currentNoteModel.FolderId;
  1822. vc.FolderName = self.currentNoteModel.FolderId == 0 ? @"根目录" :self.currentNoteModel.FolderName;
  1823. vc.replayType = MailReplayEdit;
  1824. switch (self.type) {
  1825. case CollectModel_Notice:
  1826. {
  1827. vc.MailType = 3;
  1828. vc.type = self.type;
  1829. }
  1830. break;
  1831. case CollectModel_InterMail:
  1832. {
  1833. vc.MailType = 1;
  1834. vc.type = self.type;
  1835. }
  1836. break;
  1837. case CollectModel_NoSignMail:
  1838. {
  1839. vc.MailType = 2;
  1840. vc.type = CollectModel_InterMail;
  1841. }
  1842. break;
  1843. default:
  1844. {
  1845. vc.type = self.type;
  1846. }
  1847. break;
  1848. }
  1849. vc.Id = self.Id;
  1850. [self.navigationController pushViewController:vc animated:YES];
  1851. }
  1852. /// 转发正文
  1853. - (void)ShareDetail{
  1854. SHOWLOADING
  1855. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  1856. [dic setValue:@(self.Id) forKey:@"SourceId"];
  1857. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1858. [dic setValue:@(4) forKey:@"AnalyzeType"];///转发
  1859. [dic setValue:@(0) forKey:@"CommentId"];
  1860. [dic setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
  1861. WS(weakSelf);
  1862. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1863. REMOVESHOW
  1864. [weakSelf refreshData];
  1865. weakSelf.IsShareText = NO;
  1866. [weakSelf shareHander];
  1867. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1868. weakSelf.isScrComment = YES;
  1869. [weakSelf scrollToCommentViewTop];
  1870. });
  1871. [weakSelf setCusMenuShare];
  1872. } failure:^(NSError * _Nonnull error) {
  1873. REMOVESHOW
  1874. [weakSelf setCusMenuShare];
  1875. }];
  1876. }
  1877. /// 点赞正文
  1878. - (void)gotoZanHander{
  1879. SHOWLOADING
  1880. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  1881. [dic setValue:@(self.Id) forKey:@"SourceId"];
  1882. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1883. [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞
  1884. [dic setValue:@(0) forKey:@"CommentId"];
  1885. [dic setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
  1886. WS(weakSelf);
  1887. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1888. REMOVESHOW
  1889. if (weakSelf.RefreshTopicBlock) {
  1890. weakSelf.RefreshTopicBlock();
  1891. }
  1892. weakSelf.currentNoteModel.IsPraise = !weakSelf.currentNoteModel.IsPraise;
  1893. if (weakSelf.currentNoteModel.IsPraise) {
  1894. SHOWSUCCESS(@"点赞成功");
  1895. }else{
  1896. SHOWSUCCESS(@"已取消点赞");
  1897. }
  1898. [weakSelf refreshData];
  1899. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  1900. weakSelf.isScrComment = YES;
  1901. [weakSelf scrollToCommentViewTop];
  1902. [weakSelf setCusMenuShare];
  1903. });
  1904. } failure:^(NSError * _Nonnull error) {
  1905. REMOVESHOW
  1906. [weakSelf setCusMenuShare];
  1907. }];
  1908. }
  1909. /// 评论正文
  1910. - (void)commentHander{
  1911. [self.commentInputView startEditing];
  1912. WEAKSELF
  1913. self.commentInputView.inputBlock = ^(NSString * _Nonnull content) {
  1914. NSLog(@"%@",content);
  1915. [weakSelf setCusMenuShare];
  1916. [weakSelf sendCommentToServerWithcontent:content];
  1917. };
  1918. }
  1919. - (void)sendCommentToServerWithcontent:(NSString *)content
  1920. {
  1921. WS(weakSelf);
  1922. NSMutableDictionary *dicc = [NSMutableDictionary dictionary];
  1923. [dicc setValue:@(self.Id) forKey:@"ArticleId"];
  1924. [dicc setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1925. [dicc setValue:content forKey:@"Content"];
  1926. [dicc setValue:@(0) forKey:@"Pid"];//回复评论时用到的ID
  1927. [dicc setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
  1928. NSLog(@"%@",dicc);
  1929. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_Add) parameters:dicc responseStyle:DATA success:^(id _Nonnull responseObject) {
  1930. SHOWSUCCESS(@"评论成功");
  1931. weakSelf.countComment ++;
  1932. if (weakSelf.RefreshTopicBlock) {
  1933. weakSelf.RefreshTopicBlock();
  1934. }
  1935. if (weakSelf.countComment == 0) {
  1936. self.commentCountL.text = [NSString stringWithFormat:@"评 论"];
  1937. }else{
  1938. if (weakSelf.countComment >= 10000) {
  1939. weakSelf.commentCountL.text = [NSString stringWithFormat:@"%.1f万\n评 论",weakSelf.countComment / 10000.0];
  1940. }else{
  1941. weakSelf.commentCountL.text = [NSString stringWithFormat:@"%ld\n评 论",(long)weakSelf.countComment];
  1942. }
  1943. }
  1944. [weakSelf RefreshCommentList];
  1945. } failure:^(NSError * _Nonnull error) {
  1946. // SHOWERROR([ZYCTool handerResultData:error]);
  1947. }];
  1948. }
  1949. /// 转发正文
  1950. - (void)shareHander{
  1951. [self.noteBookShareVC initNoteBookShareData];
  1952. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1953. }
  1954. - (NoteBookShareVC *)noteBookShareVC{
  1955. if (_noteBookShareVC == nil) {
  1956. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  1957. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  1958. [_noteBookShareVC.view setHidden:YES];
  1959. _noteBookShareVC.delegate = self;
  1960. }
  1961. return _noteBookShareVC;
  1962. }
  1963. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  1964. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1965. if ([typeName isEqualToString:@"发给微信好友"]) {
  1966. [self returnToWechatSession];
  1967. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  1968. [self returnToWechatTimeLine];
  1969. }else if ([typeName isEqualToString:@"发到微博"]){
  1970. [self returnToSina];
  1971. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  1972. [self returnToQQ];
  1973. }else if ([typeName isEqualToString:@"发到消息"]){
  1974. [self returnToMessage];
  1975. }else if ([typeName isEqualToString:@"发到小组"]){
  1976. [self returnToGroup];
  1977. }else if ([typeName isEqualToString:@"发到笔记"]){
  1978. [self returnToNote];
  1979. }else if ([typeName isEqualToString:@"发到话题"]){
  1980. [self returnToTopic];
  1981. }else{
  1982. }
  1983. }
  1984. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  1985. {
  1986. //创建分享消息对象
  1987. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  1988. messageObject.title = title;
  1989. //创建网页内容对象
  1990. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
  1991. //设置网页地址
  1992. shareObject.webpageUrl = url;
  1993. //分享消息对象设置分享内容对象
  1994. messageObject.shareObject = shareObject;
  1995. //调用分享接口
  1996. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  1997. if (error) {
  1998. NSLog(@"************Share fail with error %@*********",error);
  1999. }else{
  2000. NSLog(@"response data is %@",data);
  2001. }
  2002. }];
  2003. }
  2004. - (void)returnToWechatSession
  2005. {
  2006. NSString * name = @"";
  2007. if (![self.currentNoteModel.Name isKindOfClass:[NSNull class]] && self.currentNoteModel.Name.length > 0) {
  2008. name = self.currentNoteModel.Name;
  2009. }else if(![self.currentNoteModel.UserName isKindOfClass:[NSNull class]] && self.currentNoteModel.UserName.length > 0) {
  2010. name = self.currentNoteModel.UserName;
  2011. }
  2012. if (self.type == CollectModel_NoSignMail) {
  2013. name = @"匿名";
  2014. }
  2015. if (self.type == CollectModel_Toipc) {
  2016. name = [NSString stringWithFormat:@"%@ 来自-%@",name, self.currentNoteModel.GroupName];
  2017. }
  2018. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.currentNoteModel.Title desc:name url:[self returnUrl] img:[self returnImage]];
  2019. }
  2020. - (void)returnToWechatTimeLine
  2021. {
  2022. NSString * name = @"";
  2023. if (![self.currentNoteModel.Name isKindOfClass:[NSNull class]] && self.currentNoteModel.Name.length > 0) {
  2024. name = self.currentNoteModel.Name;
  2025. }else if(![self.currentNoteModel.UserName isKindOfClass:[NSNull class]] && self.currentNoteModel.UserName.length > 0) {
  2026. name = self.currentNoteModel.UserName;
  2027. }
  2028. if (self.type == CollectModel_NoSignMail) {
  2029. name = @"匿名";
  2030. }
  2031. if (self.type == CollectModel_Toipc) {
  2032. name = [NSString stringWithFormat:@"%@ 来自-%@",name, self.currentNoteModel.GroupName];
  2033. }
  2034. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.currentNoteModel.Title desc:name url:[self returnUrl] img:[self returnImage]];
  2035. }
  2036. - (void)returnToSina
  2037. {
  2038. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.currentNoteModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.currentNoteModel.Name] url:[self returnUrl] img:[self returnImage]];
  2039. }
  2040. - (void)returnToQQ
  2041. {
  2042. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.currentNoteModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.currentNoteModel.Name] url:[self returnUrl] img:[self returnImage]];
  2043. }
  2044. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url img:(NSString *)image
  2045. {
  2046. //创建分享消息对象
  2047. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  2048. messageObject.title = title;
  2049. //创建网页内容对象
  2050. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:[UIImage imageNamed:image]];
  2051. //设置网页地址
  2052. shareObject.webpageUrl = url;
  2053. //分享消息对象设置分享内容对象
  2054. messageObject.shareObject = shareObject;
  2055. //调用分享接口
  2056. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  2057. if (error) {
  2058. NSLog(@"************Share fail with error %@*********",error);
  2059. }else{
  2060. NSLog(@"response data is %@",data);
  2061. }
  2062. }];
  2063. }
  2064. - (NSString *)returnUrl
  2065. {
  2066. switch (self.type) {
  2067. case CollectModel_Group:
  2068. {
  2069. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/topicDetailsWx?"),(long)self.currentNoteModel.Id];
  2070. return url;
  2071. }
  2072. break;
  2073. case CollectModel_Toipc:
  2074. {
  2075. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/topicDetailsWx?"),(long)self.currentNoteModel.Id];
  2076. return url;
  2077. }
  2078. break;
  2079. case CollectModel_NewTopic:
  2080. {
  2081. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noteDetailsWx?"),(long)self.currentNoteModel.Id];
  2082. return url;
  2083. }
  2084. break;
  2085. case CollectModel_Notice:
  2086. {
  2087. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noticeDetailsWx?"),(long)self.currentNoteModel.Id];
  2088. return url;
  2089. }
  2090. break;
  2091. case CollectModel_NoteBook:
  2092. {
  2093. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noteDetailsWx?"),(long)self.currentNoteModel.Id];
  2094. return url;
  2095. }
  2096. break;
  2097. case CollectModel_InterMail:
  2098. {
  2099. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/mailWx?"),(long)self.currentNoteModel.Id];
  2100. return url;
  2101. }
  2102. break;
  2103. case CollectModel_NoSignMail:
  2104. {
  2105. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/mailWx?"),(long)self.currentNoteModel.Id];
  2106. return url;
  2107. }
  2108. break;
  2109. case CollectModel_meetMian:
  2110. {
  2111. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/minutesMeetingWx?"),(long)self.currentNoteModel.Id];
  2112. return url;
  2113. }
  2114. break;
  2115. case CollectModel_meetDetail:
  2116. {
  2117. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/meetingWx?"),(long)self.currentNoteModel.Id];
  2118. return url;
  2119. }
  2120. break;
  2121. case CollectModel_Aritle:
  2122. {
  2123. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/mainText?"),(long)self.currentNoteModel.Id];
  2124. return url;
  2125. }
  2126. break;
  2127. case CollectModel_NoteFile:
  2128. {
  2129. 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,@"笔记文件夹"];
  2130. return url;
  2131. }
  2132. break;
  2133. case CollectModel_CollectFile:
  2134. {
  2135. 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,@"收藏文件夹"];
  2136. return url;
  2137. }
  2138. break;
  2139. case CollectModel_TopicBooK:
  2140. {
  2141. 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,@"文件夹"];
  2142. return url;
  2143. }
  2144. break;
  2145. case CollectModel_TopicSubBooK:
  2146. {
  2147. 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,@"文件夹"];
  2148. return url;
  2149. }
  2150. break;
  2151. case CollectModel_work:
  2152. {
  2153. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.currentNoteModel.Id];
  2154. return url;
  2155. }
  2156. break;
  2157. default:
  2158. {
  2159. NSString * url = [NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/noticeDetailsWx?"),(long)self.currentNoteModel.Id];
  2160. return url;
  2161. }
  2162. break;
  2163. }
  2164. return @"";
  2165. }
  2166. - (NSString *)returnImage
  2167. {
  2168. switch (self.type) {
  2169. case CollectModel_Group:
  2170. {
  2171. NSString * url = @"笔记小组";
  2172. return url;
  2173. }
  2174. break;
  2175. case CollectModel_Toipc:
  2176. {
  2177. NSString * url = @"话题";
  2178. return url;
  2179. }
  2180. break;
  2181. case CollectModel_NewTopic:
  2182. {
  2183. NSString * url = @"话题";
  2184. return url;
  2185. }
  2186. break;
  2187. case CollectModel_Notice:
  2188. {
  2189. NSString * url = @"通知图标";
  2190. return url;
  2191. }
  2192. break;
  2193. case CollectModel_NoteBook:
  2194. {
  2195. NSString * url = @"noteBook_icon";
  2196. return url;
  2197. }
  2198. break;
  2199. case CollectModel_NoteFile:
  2200. {
  2201. NSString * url = @"share_file";
  2202. return url;
  2203. }
  2204. break;
  2205. case CollectModel_CollectFile:
  2206. {
  2207. NSString * url = @"share_file";
  2208. return url;
  2209. }
  2210. break;
  2211. case CollectModel_InterMail:
  2212. {
  2213. NSString * url = @"站内信";
  2214. return url;
  2215. }
  2216. break;
  2217. case CollectModel_NoSignMail:
  2218. {
  2219. NSString * url = @"站内信";
  2220. return url;
  2221. }
  2222. break;
  2223. case CollectModel_meetMian:
  2224. {
  2225. NSString * url = @"会议纪要";
  2226. return url;
  2227. }
  2228. break;
  2229. case CollectModel_meetDetail:
  2230. {
  2231. NSString * url = @"会议";
  2232. return url;
  2233. }
  2234. break;
  2235. case CollectModel_Aritle:
  2236. {
  2237. NSString * url = @"文章";
  2238. return url;
  2239. }
  2240. break;
  2241. case CollectModel_TopicBooK:
  2242. {
  2243. NSString * url = @"topicBook";
  2244. return url;
  2245. }
  2246. break;
  2247. case CollectModel_TopicSubBooK:
  2248. {
  2249. NSString * url = @"share_file";
  2250. return url;
  2251. }
  2252. break;
  2253. default:
  2254. {
  2255. NSString * url = @"笔记文章";
  2256. return url;
  2257. }
  2258. break;
  2259. }
  2260. return @"";
  2261. }
  2262. #pragma mark - 分享功能
  2263. - (void)returnToMessage
  2264. {
  2265. ShareListVC * vc = [ShareListVC initShareListVC];
  2266. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  2267. model.SoureId = self.Id;
  2268. model.SoureTypeId = self.type;
  2269. model.Title = self.currentNoteModel.Title;
  2270. model.Author = self.currentNoteModel.UserName;
  2271. model.GroupId = self.currentNoteModel.GroupId;
  2272. model.GroupName = self.currentNoteModel.GroupName;
  2273. vc.sendModel = model;
  2274. vc.isReturn = YES;
  2275. [self.navigationController pushViewController:vc animated:YES];
  2276. }
  2277. - (void)returnToGroup
  2278. {
  2279. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  2280. vc.type = CollectModel_Toipc;
  2281. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  2282. model.SoureId = self.Id;
  2283. model.SoureTypeId = self.type;
  2284. model.Title = self.currentNoteModel.Title;
  2285. model.Author = self.currentNoteModel.UserName ? self.currentNoteModel.UserName : self.currentNoteModel.Name;
  2286. model.SourceUserId = self.currentNoteModel.UserId;
  2287. model.GroupId = self.currentNoteModel.GroupId;
  2288. model.GroupName = self.currentNoteModel.GroupName;
  2289. vc.sendModel = model;
  2290. vc.isReturn = YES;
  2291. [self.navigationController pushViewController:vc animated:YES];
  2292. }
  2293. - (void)returnToNote
  2294. {
  2295. MoveViewController * vc = [MoveViewController initMoveViewController];
  2296. vc.isFromCreateBookVc = YES;
  2297. vc.TypeId = CreateNotesType;
  2298. vc.CollectionType = CollectModel_NoteBook;
  2299. vc.titleStr = @"我的笔记";
  2300. vc.ParentId = 0;
  2301. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  2302. if (self.IsShareText) {
  2303. model.Title = self.shareText;
  2304. model.SoureTypeId = 1;
  2305. }else{
  2306. model.SoureId = self.Id;
  2307. model.SoureTypeId = self.type;
  2308. model.Title = self.currentNoteModel.Title;
  2309. model.Author = self.currentNoteModel.UserName ? self.currentNoteModel.UserName : self.currentNoteModel.Name;
  2310. model.SourceUserId = self.currentNoteModel.UserId;
  2311. model.GroupId = self.currentNoteModel.GroupId;
  2312. model.GroupName = self.currentNoteModel.GroupName;
  2313. vc.type = CollectModel_NoteBook;
  2314. }
  2315. vc.sendModel = model;
  2316. vc.isReturn = YES;
  2317. [self.navigationController pushViewController:vc animated:YES];
  2318. }
  2319. - (void)returnToTopic
  2320. {
  2321. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  2322. vc.type = CollectModel_NewTopic;
  2323. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  2324. if (self.IsShareText) {
  2325. model.Title = self.shareText;
  2326. model.SoureTypeId = 1;
  2327. }else{
  2328. model.SoureId = self.Id;
  2329. model.SoureTypeId = self.type;
  2330. model.Title = self.currentNoteModel.Title;
  2331. model.Author = self.currentNoteModel.UserName ? self.currentNoteModel.UserName : self.currentNoteModel.Name;
  2332. model.SourceUserId = self.currentNoteModel.UserId;
  2333. model.GroupId = self.currentNoteModel.GroupId;
  2334. model.GroupName = self.currentNoteModel.GroupName;
  2335. vc.type = CollectModel_NewTopic;
  2336. }
  2337. vc.sendModel = model;
  2338. vc.isReturn = YES;
  2339. [self.navigationController pushViewController:vc animated:YES];
  2340. }
  2341. /// 点赞评论
  2342. - (void)gotoZanCommentHanderModel:(MHTopic *)model indexPath:(NSIndexPath *)indexPath{
  2343. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  2344. [dic setValue:@(self.Id) forKey:@"SourceId"];
  2345. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  2346. [dic setValue:@(2) forKey:@"AnalyzeType"];//详情点赞
  2347. [dic setValue:@(model.Id) forKey:@"CommentId"];
  2348. [dic setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
  2349. WS(weakSelf);
  2350. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  2351. model.IsLaud = !model.IsLaud;
  2352. if (model.IsLaud) {
  2353. SHOWSUCCESS(@"点赞成功");
  2354. }else{
  2355. SHOWSUCCESS(@"已取消点赞");
  2356. }
  2357. dispatch_async(dispatch_get_main_queue(), ^{
  2358. [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  2359. });
  2360. } failure:^(NSError * _Nonnull error) {
  2361. // SHOWERROR([ZYCTool handerResultData:error]);
  2362. }];
  2363. }
  2364. - (void)gotoCollectHander{
  2365. MoveViewController *vc = [MoveViewController initMoveViewController];
  2366. //NSInteger meetId = [self.dataDict[@"MeetingId"] integerValue];
  2367. vc.CollectionDataId = self.Id;
  2368. vc.collectType = CollectHanderType_Collect;
  2369. vc.CollectionType = self.type == CollectModel_NoSignMail ? CollectModel_InterMail : self.type;
  2370. vc.ParentId = 0;
  2371. vc.titleStr = @"我的收藏";
  2372. vc.TypeId = CreateCollectionType;
  2373. vc.FolderIds = @[].mutableCopy;
  2374. // 收藏类型 1文章 2话题 3 收藏 4笔记 5通知 6站内信 7小组 8 会议详情 14工作流审批 300 文件 400 会议纪要
  2375. [self.navigationController pushViewController:vc animated:YES];
  2376. }
  2377. - (void)collectSuccess
  2378. {
  2379. NSString *jsonString = [NSString stringWithFormat:@"showCollection('%d')",1];
  2380. [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
  2381. NSLog(@"data:%@",data);
  2382. NSLog(@"error:%@",error);
  2383. }];
  2384. NSLog(@"12313");
  2385. WS(weakSelf);
  2386. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  2387. [weakSelf refreshData];
  2388. weakSelf.IsCollect = YES;
  2389. });
  2390. }
  2391. - (NSMutableArray<MyNoteBookCommentSubModel *> *)commentArray{
  2392. if (!_commentArray) {
  2393. _commentArray = [NSMutableArray array];
  2394. }
  2395. return _commentArray;
  2396. }
  2397. - (TextInputView *)commentInputView {
  2398. if (!_commentInputView) {
  2399. _commentInputView = [[TextInputView alloc] initWithFrame:[UIScreen mainScreen].bounds];
  2400. }
  2401. return _commentInputView;
  2402. }
  2403. #pragma mark - MHTopicCellDelegate
  2404. - (void)topicCellForClickedThumbAction:(MHTopicCell *)topicCell
  2405. {
  2406. /**
  2407. * 这里点击事件自行根据自己UI处理
  2408. *
  2409. */
  2410. NSLog(@"---点击👍按钮---");
  2411. }
  2412. - (void)topicCellForClickedMoreAction:(MHTopicCell *)topicCell
  2413. {
  2414. /**
  2415. * 这里点击事件自行根据自己UI处理
  2416. *
  2417. */
  2418. // 修改数据源方法
  2419. MHTopic *topic = topicCell.topicFrame.topic;
  2420. topic.IsLaud = !topic.IsLaud;
  2421. if (topic.IsLaud) {
  2422. // topic.thumbNums+=1;
  2423. // }else{
  2424. // topic.thumbNums-=1;
  2425. }
  2426. // 刷新数据
  2427. [self.tableView reloadData];
  2428. }
  2429. - (void)topicCellDidClickedUser:(MHTopicCell *)topicCell
  2430. {
  2431. NSLog(@"======%ld",(long)topicCell.topicFrame.topic.UserId);
  2432. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  2433. vc.indexId = topicCell.topicFrame.topic.UserId;
  2434. [self.navigationController pushViewController:vc animated:YES];
  2435. // MHUserInfoController *userInfo = [[MHUserInfoController alloc] init];
  2436. // userInfo.user = topicCell.topicFrame.topic.user;
  2437. // [self.navigationController pushViewController:userInfo animated:YES];
  2438. }
  2439. - (void)topicCell:(MHTopicCell *)topicCell didClickedUser:(NSString *)userId
  2440. {
  2441. NSLog(@"======%@",userId);
  2442. // MHUserInfoController *userInfo = [[MHUserInfoController alloc] init];
  2443. // userInfo.user = user;
  2444. // [self.navigationController pushViewController:userInfo animated:YES];
  2445. }
  2446. - (void)topicCell:(MHTopicCell *)topicCell didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  2447. {
  2448. MHTopicFrame *topicFrame = topicCell.topicFrame;
  2449. MHCommentFrame *commentFrame = topicFrame.commentFrames[indexPath.row];
  2450. NSLog(@"这里回复 -- :%@",commentFrame.comment.Id);
  2451. if (commentFrame.comment.UserId != [AppUserModel sharedAppUserModel].Id) {
  2452. [self replyCommentName:commentFrame.comment.Name andId:commentFrame.comment.Id];
  2453. }
  2454. }
  2455. #pragma mark - 长按删除评论Cell
  2456. - (void)longDeleteSelf:(MHTopicCell *)cell
  2457. {
  2458. [self becomeFirstResponder];
  2459. UIMenuController *menu = [UIMenuController sharedMenuController];
  2460. // UIMenuItem *copyItem = [[UIMenuItem alloc] initWithTitle:@"复制" action:@selector(copyItemAction:)];
  2461. UIMenuItem *deleteItem = [[UIMenuItem alloc] initWithTitle:@"删除" action:@selector(deleteItemAction:)];
  2462. UIMenuItem *upDateItem = [[UIMenuItem alloc] initWithTitle:@"编辑" action:@selector(upDateItemAction:)];
  2463. [menu setMenuItems: @[deleteItem,upDateItem]];
  2464. NSLog(@"%@",NSStringFromCGRect(cell.frame));
  2465. [menu setTargetRect:cell.contentLabel.frame inView:cell];
  2466. [menu setMenuVisible:YES animated:NO];
  2467. }
  2468. - (void)longDeleteSubCell:(UILabel *)label
  2469. {
  2470. [self becomeFirstResponder];
  2471. UIMenuController *menu = [UIMenuController sharedMenuController];
  2472. UIMenuItem *deleteItem = [[UIMenuItem alloc] initWithTitle:@"删除" action:@selector(deleteItemAction:)];
  2473. UIMenuItem *upDateItem = [[UIMenuItem alloc] initWithTitle:@"编辑" action:@selector(upDateItemAction:)];
  2474. [menu setMenuItems: @[deleteItem,upDateItem]];
  2475. [menu setTargetRect:label.frame inView:label];
  2476. [menu setMenuVisible:YES animated:NO];
  2477. }
  2478. //-(BOOL)canBecomeFirstResponder
  2479. //{
  2480. // return YES;
  2481. //}
  2482. //是否可以接收某些菜单的某些交互操作
  2483. //-(BOOL)canPerformAction:(SEL)action withSender:(id)sender{
  2484. // return (action == @selector(deleteItemAction:)
  2485. // ||action == @selector(upDateItemAction:));
  2486. //}
  2487. - (void)copyItemAction:(UIMenuItem *)item
  2488. {
  2489. UIPasteboard *pboard = [UIPasteboard generalPasteboard];
  2490. pboard.string = self.commentStr;
  2491. SHOWSUCCESS(@"复制成功");
  2492. NSLog(@"选中-----%@", pboard.string);
  2493. }
  2494. - (void)deleteItemAction:(UIMenuItem *)item
  2495. {
  2496. WS(weakSelf);
  2497. SHOWLOADING
  2498. [[HttpManager sharedHttpManager] DeleteUrl:Host(API_APP_Comment_Delete) parameters:@{@"ArticleId":@(self.Id),@"CommentId":@(self.commentId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  2499. REMOVESHOW
  2500. SHOWSUCCESS(@"删除成功");
  2501. if (weakSelf.RefreshTopicBlock) {
  2502. weakSelf.RefreshTopicBlock();
  2503. }
  2504. [weakSelf headRefresh];
  2505. } failure:^(NSError * _Nonnull error) {
  2506. REMOVESHOW
  2507. }];
  2508. }
  2509. - (void)upDateItemAction:(UIMenuItem *)item
  2510. {
  2511. [self upDateComment];
  2512. }
  2513. - (void)upDateComment{
  2514. self.dismissSelf = YES;
  2515. [self.view endEditing:YES];
  2516. [self.commentInputView setViewText:self.commentStr];
  2517. [self.commentInputView startEditing];
  2518. WS(weakSelf);
  2519. self.commentInputView.inputBlock = ^(NSString * _Nonnull content) {
  2520. SHOWLOADING
  2521. [[HttpManager sharedHttpManager] PUTUrl:Host(API_APP_Comment_Update) parameters:@{@"Content":content,@"CommentId":@(weakSelf.commentId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  2522. REMOVESHOW
  2523. if (weakSelf.RefreshTopicBlock) {
  2524. weakSelf.RefreshTopicBlock();
  2525. }
  2526. [weakSelf RefreshCommentList];
  2527. } failure:^(NSError * _Nonnull error) {
  2528. REMOVESHOW
  2529. weakSelf.dismissSelf = NO;
  2530. }];
  2531. };
  2532. }
  2533. - (void)replyCommentName:(NSString *)name andId:(NSString *)commentId{
  2534. WS(weakSelf);
  2535. self.dismissSelf = YES;
  2536. [self.commentInputView setPlaceText:[NSString stringWithFormat:@"回复%@:",name]];
  2537. [self.commentInputView startEditing];
  2538. self.commentInputView.inputBlock = ^(NSString * _Nonnull content) {
  2539. NSLog(@"%@",content);
  2540. weakSelf.dismissSelf = NO;
  2541. if (weakSelf.RefreshTopicBlock) {
  2542. weakSelf.RefreshTopicBlock();
  2543. }
  2544. [weakSelf replyCommentWithcontent:content andId:commentId];
  2545. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  2546. weakSelf.isScrComment = YES;
  2547. [weakSelf scrollToCommentViewTop];
  2548. });
  2549. };
  2550. }
  2551. - (void)replyCommentWithcontent:(NSString *)content andId:(NSString *)commentId
  2552. {
  2553. WS(weakSelf);
  2554. NSMutableDictionary *dicc = [NSMutableDictionary dictionary];
  2555. [dicc setValue:@(self.Id) forKey:@"ArticleId"];
  2556. [dicc setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  2557. [dicc setValue:content forKey:@"Content"];
  2558. [dicc setValue:commentId forKey:@"Pid"];//回复评论时用到的ID
  2559. [dicc setValue:@([self backTypeValue]) forKey:@"TypeValue"];//话题 1
  2560. NSLog(@"%@",dicc);
  2561. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Comment_Add) parameters:dicc responseStyle:DATA success:^(id _Nonnull responseObject) {
  2562. SHOWSUCCESS(@"评论成功");
  2563. if (weakSelf.RefreshTopicBlock) {
  2564. weakSelf.RefreshTopicBlock();
  2565. }
  2566. [weakSelf RefreshCommentList];
  2567. } failure:^(NSError * _Nonnull error) {
  2568. // SHOWERROR([ZYCTool handerResultData:error]);
  2569. }];
  2570. }
  2571. - (void)scrollToCommentViewTop
  2572. {
  2573. WS(weakSelf);
  2574. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  2575. if (weakSelf.isScrComment) {
  2576. if ((weakSelf.commentArray.count > 0 || weakSelf.currentZanModel.Items.count > 0) && weakSelf.tableView) {
  2577. // NSIndexPath * indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
  2578. [weakSelf.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:NSNotFound inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
  2579. }
  2580. }else{
  2581. [weakSelf.tableView scrollToTop];
  2582. }
  2583. });
  2584. }
  2585. - (WKWebView *)webView
  2586. {
  2587. if (!_webView) {
  2588. WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
  2589. // 实例化对象
  2590. WKUserContentController* userContent = [[WKUserContentController alloc] init];
  2591. [userContent addScriptMessageHandler:self name:@"delelteAction"];
  2592. [userContent addScriptMessageHandler:self name:@"editAction"];
  2593. [userContent addScriptMessageHandler:self name:@"postTopicDetailsData"];
  2594. [userContent addScriptMessageHandler:self name:@"alreadyRead"];
  2595. [userContent addScriptMessageHandler:self name:@"to"];
  2596. [userContent addScriptMessageHandler:self name:@"goMeeting"];
  2597. [userContent addScriptMessageHandler:self name:@"goUser"];
  2598. [userContent addScriptMessageHandler:self name:@"goRead"];
  2599. [userContent addScriptMessageHandler:self name:@"postH"];
  2600. [userContent addScriptMessageHandler:self name:@"postSave"];
  2601. [userContent addScriptMessageHandler:self name:@"appCollection"];
  2602. NSMutableString *javascript = [NSMutableString string];
  2603. [javascript appendString:@"document.documentElement.style.webkitTouchCallout='none';"];//禁止长按
  2604. // [javascript appendString:@"document.documentElement.style.webkitUserSelect='none';"];//禁止选择
  2605. WKUserScript *noneSelectScript = [[WKUserScript alloc] initWithSource:javascript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
  2606. [userContent addUserScript:noneSelectScript];
  2607. configuration.userContentController = userContent;
  2608. WKPreferences *preferences = [WKPreferences new];
  2609. preferences.javaScriptCanOpenWindowsAutomatically = YES;
  2610. preferences.minimumFontSize = 10.0;
  2611. configuration.preferences = preferences;
  2612. // 初始化WKWebView
  2613. _webView = [[WKWebView alloc]initWithFrame:CGRectZero configuration:configuration];
  2614. _webView.scrollView.scrollEnabled = NO;
  2615. _webView.scrollView.bounces = NO;
  2616. _webView.scrollView.showsVerticalScrollIndicator = NO;
  2617. _webView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  2618. }
  2619. return _webView;
  2620. }
  2621. - (void)loadDataWebView
  2622. {
  2623. NSString * url = nil;
  2624. switch (self.type) {
  2625. case CollectModel_Aritle:
  2626. {
  2627. url = @"/mobile/mainTextWeb";
  2628. }
  2629. break;
  2630. case CollectModel_MediaAritle:
  2631. {
  2632. url = @"/mobile/periodicalWeb";
  2633. }
  2634. break;
  2635. case CollectModel_Group:
  2636. {
  2637. url = @"/mobile/topicDetails";
  2638. }
  2639. break;
  2640. case CollectModel_Toipc:
  2641. {
  2642. url = @"/mobile/topicDetails";
  2643. }
  2644. break;
  2645. case CollectModel_NewTopic:
  2646. {
  2647. url = @"/mobile/topicDetails";
  2648. }
  2649. break;
  2650. case CollectModel_NoteBook:
  2651. {
  2652. url = @"/mobile/topicDetails";
  2653. }
  2654. break;
  2655. case CollectModel_Notice:
  2656. {
  2657. url = @"/mobile/noticeDetails";
  2658. }
  2659. break;
  2660. case CollectModel_InterMail:
  2661. {
  2662. url = @"/mobile/mail";
  2663. }
  2664. break;
  2665. case CollectModel_NoSignMail:
  2666. {
  2667. url = @"/mobile/mail";
  2668. }
  2669. break;
  2670. case CollectModel_meetMian:
  2671. {
  2672. url = @"/mobile/minutesMeeting";
  2673. }
  2674. break;
  2675. default:
  2676. {
  2677. url = @"/mobile/topicDetails";
  2678. }
  2679. break;
  2680. }
  2681. NSURL *pathUrl = [NSURL URLWithString:HtmlHost(url)];
  2682. // NSURL *pathUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",@"Http://192.168.0.119:8080/admin",url]];
  2683. NSURLRequest *request = [NSURLRequest requestWithURL:pathUrl];
  2684. [self.webView loadRequest:request];
  2685. [self.webView.scrollView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil];
  2686. }
  2687. - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
  2688. /** < 法2 > */
  2689. /** < loading:防止滚动一直刷新,出现闪屏 > */
  2690. if ([keyPath isEqualToString:@"contentSize"]) {
  2691. CGFloat H = self.webView.scrollView.contentSize.height;
  2692. NSLog(@"=========== webH :%f",H);
  2693. if (self.webH != H && H != 0) {
  2694. self.webH = H;
  2695. self.tableView.sectionHeaderHeight = self.webH;
  2696. [self.webView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.webH)];
  2697. [self setBottomViewData:self.currentNoteModel];
  2698. [self.tableView reloadData];
  2699. }
  2700. }
  2701. }
  2702. #pragma mark - WKScriptMessageHandler
  2703. - (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message {
  2704. if ([message.name isEqualToString:@"delelteAction"]) {
  2705. [self deleteButtonHander];
  2706. }
  2707. if ([message.name isEqualToString:@"editAction"]) {
  2708. [self editorButtonHander];
  2709. }
  2710. if ([message.name isEqualToString:@"postTopicDetailsData"]) {
  2711. NSString *jsonString = [NSString stringWithFormat:@"getData('%ld','%@','%ld','%ld')",(long)self.Id,USERDEFAULTSGET(@"LOGINTOKEN"),(long)self.type,[AppUserModel sharedAppUserModel].Id];
  2712. [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
  2713. NSLog(@"data:%@",data);
  2714. NSLog(@"error:%@",error);
  2715. }];
  2716. }
  2717. if ([message.name isEqualToString:@"postH"]) {
  2718. NSLog(@"msgBody:%@",message.body);
  2719. NSInteger H = [message.body integerValue];
  2720. self.tableView.sectionHeaderHeight = self.webH - H;
  2721. [self.webView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.webH - H)];
  2722. [self.tableView reloadData];
  2723. }
  2724. if ([message.name isEqualToString:@"postSave"]) {
  2725. NSString * imgUrl = message.body;
  2726. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  2727. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"保存图片" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  2728. UIImage * img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imgUrl]]];
  2729. [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
  2730. [PHAssetChangeRequest creationRequestForAssetFromImage:img];
  2731. } completionHandler:^(BOOL success, NSError * _Nullable error) {
  2732. dispatch_async(dispatch_get_main_queue(), ^{
  2733. if (success) {
  2734. SHOWSUCCESS(@"图片保存成功");
  2735. }else{
  2736. SHOWERROR(@"图片保存失败");
  2737. }
  2738. });
  2739. }];
  2740. }];
  2741. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  2742. }];
  2743. [alert addAction:actionYes];
  2744. [alert addAction:actionNo];
  2745. [self presentViewController:alert animated:YES completion:^{
  2746. }];
  2747. }
  2748. if ([message.name isEqualToString:@"appCollection"]) {
  2749. WS(weakSelf);
  2750. if (self.IsCollect) {
  2751. dispatch_async(dispatch_get_main_queue(), ^{
  2752. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"真的取消收藏吗?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  2753. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  2754. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  2755. [dic setValue:@(weakSelf.Id) forKey:@"CollectionDataId"];
  2756. /// 1文章 2话题 3 收藏 4笔记 5通知 6站内信 7小组 8 会议详情 14工作流审批 300 文件 400 会议纪要
  2757. NSInteger type = weakSelf.type;
  2758. [dic setValue:@(type) forKey:@"CollectionType"];
  2759. [dic setValue:@(0) forKey:@"FolderId"];
  2760. [dic setValue:@(0) forKey:@"SourceUserId"];
  2761. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  2762. [[HttpManager sharedHttpManager] PUTUrl:Host(API_CreateCollect) parameters:dic success:^(id _Nonnull responseObject) {
  2763. [weakSelf refreshData];
  2764. weakSelf.IsCollect = NO;
  2765. NSString *jsonString = [NSString stringWithFormat:@"showCollection('%d')",0];
  2766. [weakSelf.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
  2767. NSLog(@"data:%@",data);
  2768. NSLog(@"error:%@",error);
  2769. }];
  2770. } failure:^(NSError * _Nonnull error) {
  2771. // SHOWERROR([ZYCTool handerResultData:error]);
  2772. }];
  2773. });
  2774. [weakSelf setCusMenuShare];
  2775. }];
  2776. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  2777. [weakSelf setCusMenuShare];
  2778. }];
  2779. [alert addAction:actionYes];
  2780. [alert addAction:actionNo];
  2781. [weakSelf presentViewController:alert animated:YES completion:^{
  2782. }];
  2783. });
  2784. }else{
  2785. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  2786. [weakSelf gotoCollectHander];
  2787. });
  2788. }
  2789. }
  2790. if ([message.name isEqualToString:@"alreadyRead"]) {
  2791. NSLog(@"msgBody:%@",message.body);
  2792. NSDictionary * dict = (NSDictionary *)message.body;
  2793. NoticeUnreadVC *vc = [NoticeUnreadVC initNoticeUnreadVC];
  2794. vc.Id = self.Id;
  2795. switch (self.type) {
  2796. case CollectModel_Notice:
  2797. vc.type = ReadNoticeType;
  2798. break;
  2799. case CollectModel_InterMail:
  2800. vc.type = ReadMissiveType;
  2801. break;
  2802. case CollectModel_NoSignMail:
  2803. vc.type = ReadMissiveType;
  2804. break;
  2805. default:
  2806. vc.type = ReadNoticeType;
  2807. break;
  2808. }
  2809. vc.readCount = [dict[@"ReadCount"] integerValue];
  2810. vc.unReadCount = [dict[@"AllCount"] integerValue] - [dict[@"ReadCount"] integerValue];
  2811. [self.navigationController pushViewController:vc animated:YES];
  2812. }
  2813. if ([message.name isEqualToString:@"to"]) {
  2814. NSLog(@"msgBody:%@",message.body);
  2815. NSDictionary * dict = (NSDictionary *)message.body;
  2816. [self pushVCWithDict:dict];
  2817. }
  2818. if ([message.name isEqualToString:@"goMeeting"]) {
  2819. NSLog(@"msgBody:%@",message.body);
  2820. NSInteger meetId = [message.body integerValue];
  2821. WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:meetId];
  2822. [self.navigationController pushViewController:vc animated:YES];
  2823. }
  2824. if ([message.name isEqualToString:@"goUser"]) {
  2825. NSLog(@"msgBody:%@",message.body);
  2826. MailListDetailVC *vc = [MailListDetailVC initMailListDetailVC];
  2827. vc.indexId = self.sendUserId;
  2828. [self.navigationController pushViewController:vc animated:YES];
  2829. }
  2830. if ([message.name isEqualToString:@"goRead"]) {
  2831. NSLog(@"msgBody:%@",message.body);
  2832. NSInteger count = [message.body integerValue];
  2833. ReadListVC * vc = [ReadListVC initReadListVC];
  2834. vc.type = self.type;
  2835. vc.indexId = self.Id;
  2836. vc.ReadTotal = count;
  2837. [self.navigationController pushViewController:vc animated:YES];
  2838. }
  2839. }
  2840. #pragma mark - WKScriptMessageHandler
  2841. - (NSString *)convertToJson:(NSDictionary *)dict
  2842. {
  2843. NSError *error;
  2844. NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
  2845. NSString *jsonString;
  2846. if (!jsonData) {
  2847. NSLog(@"%@",error);
  2848. }else{
  2849. jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
  2850. }
  2851. NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
  2852. NSRange range = {0,jsonString.length};
  2853. //去掉字符串中的空格
  2854. [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
  2855. NSRange range2 = {0,mutStr.length};
  2856. //去掉字符串中的换行符
  2857. [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
  2858. return mutStr;
  2859. }
  2860. //#pragma mark - WKUIDelegete
  2861. //- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(nonnull NSString *)message initiatedByFrame:(nonnull WKFrameInfo *)frame completionHandler:(nonnull void (^)(void))completionHandler
  2862. //{
  2863. // UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:message?:@"" preferredStyle:UIAlertControllerStyleAlert];
  2864. // [alertController addAction:([UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  2865. // completionHandler();
  2866. // }])];
  2867. // [self presentViewController:alertController animated:YES completion:nil];
  2868. // NSLog(@"Aleart=========%@",message);
  2869. // completionHandler();
  2870. //}
  2871. //- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{
  2872. // // DLOG(@"msg = %@ frmae = %@",message,frame);
  2873. // UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:message?:@"" preferredStyle:UIAlertControllerStyleAlert];
  2874. // [alertController addAction:([UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  2875. // completionHandler(NO);
  2876. // }])];
  2877. // [alertController addAction:([UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  2878. // completionHandler(YES);
  2879. // }])];
  2880. // [self presentViewController:alertController animated:YES completion:nil];
  2881. //}
  2882. //- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable))completionHandler{
  2883. // UIAlertController *alertController = [UIAlertController alertControllerWithTitle:prompt message:@"" preferredStyle:UIAlertControllerStyleAlert];
  2884. // [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
  2885. // textField.text = defaultText;
  2886. // }];
  2887. // [alertController addAction:([UIAlertAction actionWithTitle:@"完成" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  2888. // completionHandler(alertController.textFields[0].text?:@"");
  2889. // }])];
  2890. // [self presentViewController:alertController animated:YES completion:nil];
  2891. //}
  2892. - (NSString *)arrayToJSONString:(NSArray *)array
  2893. {
  2894. NSError *error = nil;
  2895. NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:&error];
  2896. NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
  2897. return jsonString;
  2898. }
  2899. - (void)dealloc {
  2900. WKWebsiteDataStore *dateStore = [WKWebsiteDataStore defaultDataStore];
  2901. [dateStore fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes]
  2902. completionHandler:^(NSArray * __nonnull records) {
  2903. for (WKWebsiteDataRecord *record in records)
  2904. {
  2905. [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:record.dataTypes
  2906. forDataRecords:@[record]
  2907. completionHandler:^{
  2908. NSLog(@"Cookies for %@ deleted successfully",record.displayName);
  2909. }];
  2910. }
  2911. }];
  2912. WKUserContentController *userCC = self.webView.configuration.userContentController;
  2913. [userCC removeScriptMessageHandlerForName:@"delelteAction"];
  2914. [userCC removeScriptMessageHandlerForName:@"editAction"];
  2915. [userCC removeScriptMessageHandlerForName:@"postTopicDetailsData"];
  2916. [userCC removeScriptMessageHandlerForName:@"alreadyRead"];
  2917. [userCC removeScriptMessageHandlerForName:@"to"];
  2918. [userCC removeScriptMessageHandlerForName:@"goMeeting"];
  2919. [userCC removeScriptMessageHandlerForName:@"goUser"];
  2920. [userCC removeScriptMessageHandlerForName:@"goRead"];
  2921. [userCC removeScriptMessageHandlerForName:@"postH"];
  2922. [userCC removeScriptMessageHandlerForName:@"postSave"];
  2923. [self.webView.scrollView removeObserver:self forKeyPath:@"contentSize"];
  2924. [[NSNotificationCenter defaultCenter] removeObserver:self];
  2925. [self.webView stopLoading];
  2926. self.webView.UIDelegate = nil;
  2927. self.webView.navigationDelegate = nil;
  2928. self.webView.scrollView.delegate = nil;
  2929. [self.webView removeFromSuperview];
  2930. }
  2931. - (NSInteger)backTypeValue
  2932. {
  2933. switch (self.type) {
  2934. case CollectModel_Aritle:
  2935. {
  2936. return 100;
  2937. }
  2938. break;
  2939. case CollectModel_MediaAritle:
  2940. {
  2941. return 101;
  2942. }
  2943. break;
  2944. case CollectModel_Group:
  2945. {
  2946. return 1;
  2947. }
  2948. break;
  2949. case CollectModel_Toipc:
  2950. {
  2951. return 2;
  2952. }
  2953. break;
  2954. case CollectModel_Notice:
  2955. {
  2956. return 5;
  2957. }
  2958. break;
  2959. case CollectModel_NewTopic:
  2960. {
  2961. return -4;
  2962. }
  2963. break;
  2964. case CollectModel_NoteBook:
  2965. {
  2966. return 4;
  2967. }
  2968. break;
  2969. case CollectModel_meetMian:
  2970. {
  2971. return 8;
  2972. }
  2973. break;
  2974. case CollectModel_InterMail:
  2975. {
  2976. return 6;
  2977. }
  2978. break;
  2979. case CollectModel_NoSignMail:
  2980. {
  2981. return 6;
  2982. }
  2983. break;
  2984. default:
  2985. {
  2986. return 1;
  2987. }
  2988. break;
  2989. }
  2990. }
  2991. - (void)refreshData
  2992. {
  2993. switch (self.type) {
  2994. case CollectModel_Aritle:
  2995. {
  2996. [self refreshAritleData];
  2997. }
  2998. break;
  2999. case CollectModel_MediaAritle:
  3000. {
  3001. [self refreshMediaAritleData];
  3002. }
  3003. break;
  3004. case CollectModel_Group:
  3005. {
  3006. [self refreshTopicData];
  3007. }
  3008. break;
  3009. case CollectModel_Toipc:
  3010. {
  3011. [self refreshTopicData];
  3012. }
  3013. break;
  3014. case CollectModel_NewTopic:
  3015. {
  3016. [self refreshNoteData];
  3017. }
  3018. break;
  3019. case CollectModel_Notice:
  3020. {
  3021. [self refreshNoticeData];
  3022. }
  3023. break;
  3024. case CollectModel_NoteBook:
  3025. {
  3026. [self refreshNoteData];
  3027. }
  3028. break;
  3029. case CollectModel_InterMail:
  3030. {
  3031. [self getMail];
  3032. }
  3033. break;
  3034. case CollectModel_NoSignMail:
  3035. {
  3036. [self getMail];
  3037. }
  3038. break;
  3039. case CollectModel_meetMian:
  3040. {
  3041. [self refreshMeetingData];
  3042. }
  3043. break;
  3044. default:
  3045. {
  3046. [self refreshTopicData];
  3047. }
  3048. break;
  3049. }
  3050. }
  3051. #pragma mark - UIMenuController
  3052. //指定menu响应事件 屏蔽系统自带响应事件
  3053. - (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
  3054. NSLog(@"%@", NSStringFromSelector(action));
  3055. if (action == @selector(copyAction:)
  3056. ||action == @selector(tySelectedAll:)
  3057. ||action == @selector(shareSelectedText:)
  3058. ||action == @selector(searchAction:)
  3059. ||action == @selector(deleteItemAction:)
  3060. ||action == @selector(upDateItemAction:)) {
  3061. return YES;
  3062. }
  3063. if (action == @selector(cut:)
  3064. ||action == @selector(select:)
  3065. ||action == @selector(selectAll:)
  3066. ||action == @selector(paste:)
  3067. ||action == @selector(delete:)
  3068. ||action == @selector(makeTextWritingDirectionRightToLeft:)
  3069. ||action == @selector(makeTextWritingDirectionLeftToRight:)) {
  3070. return NO;
  3071. }
  3072. return NO;
  3073. }
  3074. - (void)viewWillDisappear:(BOOL)animated{
  3075. [super viewWillDisappear:animated];
  3076. self.dismissSelf = YES;
  3077. }
  3078. //允许成为第一响应
  3079. - (BOOL)canBecomeFirstResponder {
  3080. return YES;
  3081. }
  3082. - (BOOL)canResignFirstResponder {
  3083. if (self.dismissSelf) {
  3084. return YES;
  3085. }
  3086. return NO;
  3087. }
  3088. #pragma mark 实现自定义方法
  3089. - (void)setCusMenuShare
  3090. {
  3091. self.dismissSelf = NO;
  3092. // [self createMenuItems];
  3093. }
  3094. - (void)copyAction:(UIMenuController *)menu
  3095. {
  3096. SHOWSUCCESS(@"复制成功");
  3097. [self.webView evaluateJavaScript:@"window.getSelection().toString()" completionHandler:^(id _Nullable content, NSError * _Nullable error) {
  3098. UIPasteboard *pboard = [UIPasteboard generalPasteboard];
  3099. pboard.string = (NSString *)content;
  3100. NSLog(@"选中-----%@", pboard.string);
  3101. }];
  3102. }
  3103. - (void)searchAction:(UIMenuController *)menu
  3104. {
  3105. }
  3106. - (void)tySelectedAll:(UIMenuController *)menu{
  3107. [self.webView selectAll:menu];
  3108. self.dismissSelf = YES;
  3109. }
  3110. - (void)shareSelectedText:(UIMenuController *)menu {
  3111. WS(weakSelf);
  3112. [self.webView evaluateJavaScript:@"window.getSelection().toString()" completionHandler:^(id _Nullable data, NSError * _Nullable error) {
  3113. NSLog(@"选中的文字为:%@", data);
  3114. [self.webView copy:data];
  3115. weakSelf.shareText = data;
  3116. if (weakSelf.shareText.length > 0) {
  3117. weakSelf.IsShareText = YES;
  3118. [weakSelf shareHander];
  3119. }
  3120. }];
  3121. }
  3122. - (void)createMenuItems
  3123. {
  3124. UIMenuController * menu = [UIMenuController sharedMenuController];
  3125. UIMenuItem *item1 = [[UIMenuItem alloc]initWithTitle:@"复制" action:@selector(copyAction:)];
  3126. UIMenuItem *item2 = [[UIMenuItem alloc]initWithTitle:@"全选" action:@selector(tySelectedAll:)];
  3127. UIMenuItem *item3 = [[UIMenuItem alloc]initWithTitle:@"摘录" action:@selector(shareSelectedText:)];
  3128. UIMenuItem *item4 = [[UIMenuItem alloc]initWithTitle:@"搜索" action:@selector(searchAction:)];
  3129. [menu setMenuItems:@[item1, item2, item3, item4]];
  3130. menu.menuVisible = YES;
  3131. }
  3132. @end