activityDetailVController.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. //
  2. // activityDetailVController.m
  3. // ZhongJingLianMeng
  4. //
  5. // Created by youke on 2018/12/6.
  6. // Copyright © 2018 youke. All rights reserved.
  7. //
  8. #import "activityDetailVController.h"
  9. #import "UIAlertController+LY.h"
  10. #import <JavaScriptCore/JavaScriptCore.h>
  11. #import <ShareSDK/ShareSDK.h>
  12. #import <ShareSDKUI/ShareSDK+SSUI.h>
  13. #import "ZLCWebView.h"
  14. #import<ShareSDKUI/SSUIShareActionSheetStyle.h>//设置简单分享菜单样式
  15. #import "logInViewController.h"
  16. #import "UserInfoModel.h"
  17. #import "eventActivityVController.h"
  18. #import "OrderAirportPayCancelView.h"
  19. //#import "joinAllianceVController.h"
  20. //#import "VIPXuFeiController.h"
  21. //#import "applyForDirectorController.h"
  22. @interface activityDetailVController ()<ZLCWebViewDelegate>
  23. @property (nonatomic, strong) ZLCWebView *webView;
  24. @property(nonatomic,strong) JSContext *jsContext;
  25. @property(nonatomic,strong)UIButton *collectionBtn;
  26. @property(nonatomic,strong)UIButton *sendBtn;
  27. @property (strong, nonatomic) HttpRequestManger *sessionManager;
  28. @property(nonatomic,strong)NSString *collectionStaus;
  29. @property(nonatomic,strong)InfoModel *userInfoModel;
  30. @property (strong, nonatomic) OrderAirportPayCancelView *cancelView;
  31. @property (strong, nonatomic) OrderAirportPayCancelView *vipContinueView;
  32. @end
  33. @implementation activityDetailVController
  34. - (HttpRequestManger*) sessionManager{
  35. if (!_sessionManager) {
  36. _sessionManager = [[HttpRequestManger alloc]init];
  37. }
  38. return _sessionManager;
  39. }
  40. -(void)viewWillAppear:(BOOL)animated{
  41. [super viewWillAppear:YES];
  42. [self loadSelectActivityStatus];
  43. [self loadIsCollection];
  44. }
  45. -(void)loadSelectActivityStatus{
  46. kWeakSelf(self);
  47. NSMutableDictionary *parma = [NSMutableDictionary dictionary];
  48. parma[@"id"] = weakself.newsId;
  49. self.sessionManager = [[HttpRequestManger alloc]init];
  50. [self.sessionManager sendPostHttpRequestWithUrl:selectActivityStatus params:parma bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  51. NSLog(@"%@",response);
  52. weakself.activityStatus =[NSString stringWithFormat:@"%@", response[@"activityStatus"]];
  53. if ([weakself.activityStatus isEqualToString:@"0"]) {
  54. [weakself.sendBtn setTitle:@"活动报名" forState:UIControlStateNormal];
  55. weakself.sendBtn.userInteractionEnabled = YES;
  56. }else{
  57. [weakself.sendBtn setTitle:@"活动已结束" forState:UIControlStateNormal];
  58. weakself.sendBtn.userInteractionEnabled = NO;
  59. }
  60. } failure:^(NSError *error) {
  61. NSLog(@"%@",error);
  62. }];
  63. }
  64. -(void)loadIsCollection{
  65. // kWeakSelf(self);
  66. //
  67. // NSMutableDictionary *parma = [NSMutableDictionary dictionary];
  68. //
  69. // parma[@"id"] = weakself.newsId;
  70. // parma[@"type"] = @"1";
  71. // self.sessionManager = [[HttpRequestManger alloc]init];
  72. // [self.sessionManager sendPostHttpRequestWithUrl:isCollection params:parma bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  73. //
  74. // weakself.collectionStaus = response[@"isCollected"];
  75. //
  76. // if ([weakself.collectionStaus isEqualToString:@"1"]) {
  77. //
  78. // [weakself.collectionBtn setImage:[UIImage imageNamed:@"collectionIng"] forState:UIControlStateNormal];
  79. //
  80. // [_collectionBtn setTitle:@"取消收藏" forState:UIControlStateNormal];
  81. //
  82. // }else{
  83. //
  84. // [weakself.collectionBtn setImage:[UIImage imageNamed:@"collectionNo"] forState:UIControlStateNormal];
  85. //
  86. // [_collectionBtn setTitle:@"收藏" forState:UIControlStateNormal];
  87. //
  88. // }
  89. // } failure:^(NSError *error) {
  90. //
  91. // NSLog(@"%@",error);
  92. // }];
  93. }
  94. - (void)viewDidLoad {
  95. [super viewDidLoad];
  96. [self.navigationView removeAllLeftButton];
  97. self.navigationView.titleLabel.text = self.titleStr;
  98. self.navigationView.titleLabel.textColor = [UIColor blackColor];
  99. self.view.backgroundColor = [UIColor whiteColor];
  100. kWeakSelf(self);
  101. [self.navigationView addLeftButtonWithImage:[UIImage imageNamed:@"btn_back"] clickCallBack:^(UIView *view) {
  102. [weakself.navigationController popViewControllerAnimated:YES];
  103. }];
  104. [self.navigationView addRightButtonWithImage:[UIImage imageNamed:@"share"] clickCallBack:^(UIView *view) {
  105. [weakself showShareView];
  106. }];
  107. UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, kGScreenHeight -50, kGScreenWidth, 50)];
  108. bottomView.backgroundColor = [UIColor whiteColor];
  109. [self.view addSubview:bottomView];
  110. // UIView *btnView = [[UIView alloc]init];
  111. // btnView.backgroundColor = [UIColor whiteColor];
  112. // [bottomView addSubview:btnView];
  113. // [btnView mas_makeConstraints:^(MASConstraintMaker *make) {
  114. //
  115. // make.size.mas_equalTo(CGSizeMake(kGScreenWidth -264, 50));
  116. //
  117. // make.left.equalTo(bottomView.mas_left).offset(0);
  118. //
  119. // make.top.equalTo(bottomView.mas_top).offset(0);
  120. // }];
  121. // _collectionBtn =[UIButton buttonWithType:UIButtonTypeCustom];
  122. //
  123. // [_collectionBtn setImage:[UIImage imageNamed:@"collectionNo"] forState:UIControlStateNormal];
  124. //
  125. // [_collectionBtn setTitle:@"收藏" forState:UIControlStateNormal];
  126. //
  127. // _collectionBtn.titleLabel.size = CGSizeMake(30, 15);
  128. //
  129. // _collectionBtn.titleLabel.font = TextFont(12);
  130. //
  131. // [_collectionBtn setTitleColor:[UIColor colorWithHexValue:0x333333] forState:UIControlStateNormal];
  132. //
  133. // [_collectionBtn setImageEdgeInsets:UIEdgeInsetsMake(-10, 10, 0, 0)];
  134. //
  135. // [_collectionBtn setTitleEdgeInsets:UIEdgeInsetsMake(_collectionBtn.currentImage.size.height + 10, -_collectionBtn.currentImage.size.width, 0, 0)];
  136. //
  137. // [_collectionBtn addTarget:self action:@selector(collectionClick:) forControlEvents:UIControlEventTouchUpInside];
  138. //
  139. // [btnView addSubview:_collectionBtn];
  140. //
  141. // [_collectionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  142. //
  143. // make.size.mas_equalTo(CGSizeMake(50, 50));
  144. //
  145. // make.centerX.mas_equalTo(btnView.mas_centerX).offset(0);
  146. //
  147. // make.centerY.mas_equalTo(btnView.mas_centerY).offset(0);
  148. //
  149. // }];
  150. //
  151. _sendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  152. // if ([self.activityStatus isEqualToString:@"0"]) {
  153. //
  154. // [_sendBtn setTitle:@"活动报名" forState:UIControlStateNormal];
  155. // _sendBtn.userInteractionEnabled = YES;
  156. // }else{
  157. //
  158. // [_sendBtn setTitle:@"活动已结束" forState:UIControlStateNormal];
  159. //
  160. // _sendBtn.userInteractionEnabled = NO;
  161. // }
  162. _sendBtn.titleLabel.size = CGSizeMake(30, 15);
  163. _sendBtn.titleLabel.font = TextFont(15);
  164. [_sendBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  165. _sendBtn.backgroundColor = AllMainColor;
  166. [_sendBtn addTarget:self action:@selector(OrderToClick:) forControlEvents:UIControlEventTouchUpInside];
  167. [bottomView addSubview:_sendBtn];
  168. [_sendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  169. make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 50));
  170. make.left.equalTo(bottomView.mas_left).offset(0);
  171. make.right.equalTo(bottomView.mas_right).offset(0);
  172. make.top.equalTo(bottomView.mas_top).offset(0);
  173. }];
  174. self.webView = [[ZLCWebView alloc] initWithFrame:CGRectMake(0,isFullScreen?35:20, kGScreenWidth,isFullScreen?kGScreenHeight -35 -90: kGScreenHeight-20 -70)];
  175. if (@available(iOS 11.0, *)) {
  176. self.webView.wkWebView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  177. }else {
  178. self.automaticallyAdjustsScrollViewInsets = NO;
  179. }
  180. self.webView.delegate = self;
  181. [self.view addSubview:self.webView];
  182. [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.urlStr]]];
  183. self.webView.wkWebView.scrollView.backgroundColor = [UIColor whiteColor];
  184. self.webView.wkWebView.scrollView.showsVerticalScrollIndicator = NO;
  185. // self.webView.wkWebView.scrollView.showsHorizontalScrollIndicator = NO;
  186. _webView.wkWebView.scrollView.bounces = NO;
  187. // Do any additional setup after loading the view.
  188. }
  189. -(void)collectionClick:(UIButton *)sender{
  190. // if (!IsStrEmpty([DKGlobal sharedInstance].token)) {
  191. //
  192. // kWeakSelf(self);
  193. //
  194. // if (![weakself.collectionStaus isEqualToString:@"0"]) {
  195. //
  196. // NSMutableDictionary *parma = [NSMutableDictionary dictionary];
  197. //
  198. // parma[@"id"] = weakself.newsId;
  199. //
  200. // parma[@"collectType"] = @"1";
  201. //
  202. // self.sessionManager = [[HttpRequestManger alloc]init];
  203. //
  204. // [self.sessionManager sendPostHttpRequestWithUrl:cancelCollection params:parma bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  205. //
  206. // [MBProgressHUD showSuccess:@"取消收藏"];
  207. //
  208. // weakself.collectionStaus = @"0";
  209. //
  210. // [weakself.collectionBtn setImage:[UIImage imageNamed:@"collectionNo"] forState:UIControlStateNormal];
  211. //
  212. // [_collectionBtn setTitle:@"收藏" forState:UIControlStateNormal];
  213. // } failure:^(NSError *error) {
  214. //
  215. // NSLog(@"%@",error);
  216. // }];
  217. // }else{
  218. // kWeakSelf(self);
  219. // NSMutableDictionary *parma = [NSMutableDictionary dictionary];
  220. //
  221. // parma[@"id"] = weakself.newsId;
  222. //
  223. // parma[@"type"] = @"1";
  224. //
  225. // self.sessionManager = [[HttpRequestManger alloc]init];
  226. //
  227. // [self.sessionManager sendPostHttpRequestWithUrl:collectionNews params:parma bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  228. // [MBProgressHUD showSuccess:@"收藏成功"];
  229. //
  230. // weakself.collectionStaus = @"1";
  231. //
  232. // [weakself.collectionBtn setImage:[UIImage imageNamed:@"collectionIng"] forState:UIControlStateNormal];
  233. //
  234. // [_collectionBtn setTitle:@"取消收藏" forState:UIControlStateNormal];
  235. //
  236. //
  237. // } failure:^(NSError *error) {
  238. // NSLog(@"%@",error);
  239. // }];
  240. // }
  241. // }else{
  242. // [MBProgressHUD showError:@"请先登录"];
  243. // logInViewController *loginVC = [[logInViewController alloc]init];
  244. // [self.navigationController pushViewController:loginVC animated:YES];
  245. //
  246. // }
  247. //
  248. }
  249. - (void)zlcwebViewDidStartLoad:(ZLCWebView *)webview
  250. {
  251. [SVProgressHUD show];
  252. NSLog(@"页面开始加载");
  253. }
  254. - (void)zlcwebView:(ZLCWebView *)webview shouldStartLoadWithURL:(NSURL *)URL
  255. {
  256. NSLog(@"截取到URL:%@",URL);
  257. }
  258. - (void)zlcwebView:(ZLCWebView *)webview didFinishLoadingURL:(NSURL *)URL
  259. {
  260. [SVProgressHUD dismiss];
  261. NSLog(@"页面加载完成%@",URL);
  262. }
  263. - (void)zlcwebView:(ZLCWebView *)webview didFailToLoadURL:(NSURL *)URL error:(NSError *)error
  264. {
  265. [SVProgressHUD dismiss];
  266. NSLog(@"加载出现错误");
  267. }
  268. //}
  269. -(void)viewWillDisappear:(BOOL)animated{
  270. [super viewWillDisappear:YES];
  271. _webView = nil;
  272. [self cleanCacheAndCookie];
  273. }
  274. /**清除缓存和cookie*/
  275. - (void)cleanCacheAndCookie{
  276. //清除cookies
  277. NSHTTPCookie *cookie;
  278. NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
  279. for (cookie in [storage cookies]){
  280. [storage deleteCookie:cookie];
  281. }
  282. //清除UIWebView的缓存
  283. [[NSURLCache sharedURLCache] removeAllCachedResponses];
  284. NSURLCache * cache = [NSURLCache sharedURLCache];
  285. [cache removeAllCachedResponses];
  286. [cache setDiskCapacity:0];
  287. [cache setMemoryCapacity:0];
  288. }
  289. -(void)showShareView{
  290. NSArray *arr =@[[UIImage imageNamed:@"AppIcon"]];
  291. if (IsStrEmpty(_shareTitle)) {
  292. _shareTitle = @"";
  293. }
  294. if (arr) {
  295. NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
  296. [shareParams SSDKSetupShareParamsByText:@"卖铺宝"
  297. images:arr
  298. url:[NSURL URLWithString:[NSString stringWithFormat:@"%@",_shareUrl]]
  299. title:_shareTitle
  300. type:SSDKContentTypeAuto];
  301. // [shareParams SSDKEnableUseClientShare];
  302. [ShareSDK showShareActionSheet:nil //要显示菜单的视图, iPad版中此参数作为弹出菜单的参照视图,只有传这个才可以弹出我们的分享菜单,可以传分享的按钮对象或者自己创建小的view 对象,iPhone可以传nil不会影响
  303. items:@[@(SSDKPlatformSubTypeWechatSession),@(SSDKPlatformSubTypeWechatTimeline)]
  304. shareParams:shareParams
  305. onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
  306. switch (platformType) {
  307. case SSDKPlatformSubTypeWechatSession:
  308. break;
  309. case SSDKPlatformSubTypeWechatTimeline:
  310. break;
  311. default:
  312. break;
  313. }
  314. switch (state) {
  315. case SSDKResponseStateSuccess:
  316. // {
  317. // UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"分享成功"
  318. // message:nil
  319. // delegate:nil
  320. // cancelButtonTitle:@"确定"
  321. // otherButtonTitles:nil];
  322. // [alertView show];
  323. break;
  324. // }
  325. case SSDKResponseStateFail:
  326. // {
  327. // UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"分享失败"
  328. // message:nil
  329. // delegate:nil
  330. // cancelButtonTitle:@"OK"
  331. // otherButtonTitles:nil, nil];
  332. // [alert show];
  333. //
  334. //
  335. // NSLog(@"%@",error);
  336. break;
  337. // }
  338. default:
  339. break;
  340. }
  341. }
  342. ];
  343. }
  344. }
  345. -(void)OrderToClick:(UIButton *)sender{
  346. // if (![DKGlobal sharedInstance].token ) {
  347. // logInViewController *control = [[logInViewController alloc] init];
  348. // [self.navigationController pushViewController:control animated:YES];
  349. // }else{
  350. // [self isSpeicialStatus];
  351. //
  352. // }
  353. if (![DKGlobal sharedInstance].token) {
  354. LogInViewController *control = [[LogInViewController alloc] init];
  355. control.hidesBottomBarWhenPushed = YES;
  356. EasyNavigationController *nav = [[EasyNavigationController alloc]initWithRootViewController:control];
  357. [[DKGlobal sharedInstance].rootNavController presentViewController:nav animated:YES completion:nil];
  358. }else{
  359. [self loadActivityStatus];
  360. }
  361. }
  362. - (OrderAirportPayCancelView*)cancelView{
  363. WS(weakSelf);
  364. if (!_cancelView) {
  365. _cancelView = [[NSBundle mainBundle]loadNibNamed:@"OrderAirportPayCancelView" owner:self options:nil].firstObject;
  366. _cancelView.frame = self.view.bounds;
  367. // _cancelView.isFromOrder = self.isFromOrder;
  368. _cancelView.tipLabel.hidden = YES;
  369. _cancelView.contentLabel.hidden = YES;
  370. _cancelView.titleLabel.text = @"您还未加入会员";
  371. _cancelView.titleLabelTop.constant = 35;
  372. [_cancelView.rightBtn setBackgroundColor:[UIColor colorWithHexValue:0x3C915C]];
  373. [_cancelView.leftBtn setTitle:@"继续报名" forState:UIControlStateNormal];
  374. [_cancelView.rightBtn setTitle:@"加入会员" forState:UIControlStateNormal];
  375. _cancelView.leftBtnCallback = ^{
  376. eventActivityVController *control = [[eventActivityVController alloc] init];
  377. control.activityId = weakSelf.newsId;
  378. [weakSelf.navigationController pushViewController:control animated:YES];
  379. // [weakSelf.cancelView removeFromSuperview];
  380. };
  381. // _cancelView.rightBtnCallback = ^{
  382. // joinAllianceVController *joinVC = [[joinAllianceVController alloc]init];
  383. // joinVC.phone = weakSelf.userInfoModel.phone;
  384. // joinVC.model = weakSelf.userInfoModel;
  385. // [weakSelf.navigationController pushViewController:joinVC animated:YES];
  386. //
  387. // };
  388. }
  389. return _cancelView;
  390. }
  391. - (OrderAirportPayCancelView*)vipContinueView{
  392. WS(weakSelf);
  393. if (!_vipContinueView) {
  394. _vipContinueView = [[NSBundle mainBundle]loadNibNamed:@"OrderAirportPayCancelView" owner:self options:nil].firstObject;
  395. _vipContinueView.frame = self.view.bounds;
  396. // _cancelView.isFromOrder = self.isFromOrder;
  397. _vipContinueView.tipLabel.hidden = YES;
  398. _vipContinueView.contentLabel.hidden = YES;
  399. _vipContinueView.titleLabel.text = @"您的会员已经到期";
  400. _vipContinueView.titleLabelTop.constant = 35;
  401. [_vipContinueView.rightBtn setBackgroundColor:[UIColor colorWithHexValue:0x3C915C]];
  402. [_vipContinueView.leftBtn setTitle:@"待会再说" forState:UIControlStateNormal];
  403. [_vipContinueView.rightBtn setTitle:@"申请续费" forState:UIControlStateNormal];
  404. _vipContinueView.leftBtnCallback = ^{
  405. [weakSelf.cancelView removeFromSuperview];
  406. };
  407. // _vipContinueView.rightBtnCallback = ^{
  408. // if ([weakSelf.userInfoModel.level isEqualToString:@"3"]){
  409. // applyForDirectorController *applyFor = [[applyForDirectorController alloc]init];
  410. // applyFor.model = self.userInfoModel;
  411. // [self.navigationController pushViewController:applyFor animated:YES];
  412. // }else{
  413. // VIPXuFeiController *control = [[VIPXuFeiController alloc] init];
  414. // [weakSelf.navigationController pushViewController:control animated:YES];
  415. // }
  416. // };
  417. }
  418. return _vipContinueView;
  419. }
  420. -(void)isSpeicialStatus{
  421. // kWeakSelf(self);
  422. //
  423. // [ProgressHUD show];
  424. //
  425. // _sessionManager =[[HttpRequestManger alloc]init];
  426. //
  427. // [_sessionManager sendPostHttpRequestWithUrl:getMemberInfo params:nil bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  428. //
  429. // [ProgressHUD hide];
  430. //
  431. // NSLog(@"%@",response);
  432. //
  433. // NSDictionary *dic = [response objectForKeySafely:@"memberInfo"];
  434. //
  435. // weakself.userInfoModel = [UserInfoModel mj_objectWithKeyValues:dic];
  436. // //判断是否会员到期
  437. // if ([weakself.userInfoModel.term isEqualToString:@"2"]){
  438. //
  439. // UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
  440. //
  441. // [window addSubview: weakself.vipContinueView];
  442. // }else{
  443. // if ([weakself.userInfoModel.level isEqualToString:@"1"]||[weakself.userInfoModel.level isEqualToString:@"2"]||[weakself.userInfoModel.level isEqualToString:@"3"]){
  444. //
  445. // //是会员的话 走 loadActivityStatus 方法
  446. // [self loadActivityStatus];
  447. //
  448. // }else{
  449. // //弹窗
  450. // UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
  451. //
  452. // [window addSubview: weakself.cancelView];
  453. // }
  454. // }
  455. //
  456. //
  457. // } failure:^(NSError *error) {
  458. // NSLog(@"%@",error);
  459. // [ProgressHUD hide];
  460. // }];
  461. }
  462. -(void)loadActivityStatus{
  463. WS(weakSelf)
  464. [ProgressHUD show];
  465. _sessionManager = [[HttpRequestManger alloc] init];
  466. NSMutableDictionary *parma = [NSMutableDictionary dictionary];
  467. parma[@"id"] = weakSelf.newsId;
  468. [self.sessionManager sendPostHttpRequestWithUrl:isSignUp params:parma bodyBlock:nil progress:nil success:^(NSDictionary *response) {
  469. [ProgressHUD hide];
  470. NSLog(@"%@",response);
  471. NSString *flag = [NSString stringWithFormat:@"%@",response[@"flag"]];
  472. if ([flag isEqualToString:@"0"]) {
  473. eventActivityVController *control = [[eventActivityVController alloc] init];
  474. control.activityId = weakSelf.newsId;
  475. [self.navigationController pushViewController:control animated:YES];
  476. }else{
  477. [ToastView showToast:@"已报名该活动,不能重复报名"];
  478. }
  479. // }else{
  480. //
  481. // [ToastView showToast:@"请不要重复报名"];
  482. // }
  483. } failure:^(NSError *error) {
  484. [ProgressHUD hide];
  485. NSLog(@"%@",error);
  486. }];
  487. }
  488. - (void)dealloc {
  489. if (_sessionManager) {
  490. [_sessionManager cancelAllTask];
  491. }
  492. DebugLog(@"%@没有造成循环引用", [self class]);
  493. }
  494. - (void)didReceiveMemoryWarning {
  495. [super didReceiveMemoryWarning];
  496. // Dispose of any resources that can be recreated.
  497. }
  498. /*
  499. #pragma mark - Navigation
  500. // In a storyboard-based application, you will often want to do a little preparation before navigation
  501. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  502. // Get the new view controller using [segue destinationViewController].
  503. // Pass the selected object to the new view controller.
  504. }
  505. */
  506. @end