AgreementViewController.m 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // AgreementViewController.m
  3. // BuguLive
  4. //
  5. // Created by yy on 16/7/8.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "AgreementViewController.h"
  9. #import "PublishLivestViewController.h"
  10. @interface AgreementViewController ()
  11. @end
  12. @implementation AgreementViewController
  13. - (void)viewDidLoad
  14. {
  15. [super viewDidLoad];
  16. self.view.backgroundColor = [UIColor whiteColor];
  17. self.navigationItem.title = ASLocalizedString(@"主播协议");
  18. UIColor *color = kAppGrayColor2;
  19. NSDictionary *dic = [NSDictionary dictionaryWithObject:color forKey:NSForegroundColorAttributeName];
  20. self.navigationController.navigationBar.titleTextAttributes = dic;
  21. self.navigationItem.hidesBackButton = YES;
  22. UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithTitle:ASLocalizedString(@"关闭")style:UIBarButtonItemStylePlain target:self action:@selector(closeAction)];
  23. self.navigationItem.rightBarButtonItem = item;
  24. item.tintColor = kAppGrayColor2;
  25. UIButton *agreeButton = [[UIButton alloc]initWithFrame:CGRectMake(kScreenW *0.156, kScreenH-kNavigationBarHeight-kStatusBarHeight-60, kScreenW *0.6875, 40)];
  26. [agreeButton setTintColor:kAppMainColor];
  27. [agreeButton addTarget:self action:@selector(agreeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
  28. [agreeButton setTitle:ASLocalizedString(@"已阅读并同意")forState:UIControlStateNormal];
  29. [agreeButton setTitleColor:kAppMainColor forState:UIControlStateNormal];
  30. [agreeButton.layer setBorderWidth:1];
  31. [agreeButton.layer setBorderColor:[kAppMainColor CGColor]];
  32. agreeButton.layer.masksToBounds = YES;
  33. agreeButton.layer.cornerRadius = 20;
  34. [self.view addSubview:agreeButton];
  35. }
  36. - (void)initFWUI
  37. {
  38. [super initFWUI];
  39. self.webView.frame = CGRectMake(0, 0, kScreenW, kScreenH-kNavigationBarHeight-kStatusBarHeight-80);
  40. [self.webView.scrollView setShowsVerticalScrollIndicator:YES];
  41. }
  42. - (BOOL)prefersStatusBarHidden
  43. {
  44. return YES;
  45. }
  46. - (void)closeAction
  47. {
  48. [self dismissViewControllerAnimated:YES completion:nil];
  49. }
  50. - (void)agreeButtonAction:(UIButton *)sender
  51. {
  52. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  53. [parmDict setObject:@"user" forKey:@"ctl"];
  54. [parmDict setObject:@"agree" forKey:@"act"];
  55. FWWeakify(self)
  56. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  57. {
  58. FWStrongify(self)
  59. if ([responseJson toInt:@"status"]==1)
  60. {
  61. IMALoginParam *loginParam = [IMALoginParam loadFromLocal];
  62. loginParam.isAgree = 1;
  63. [loginParam saveToLocal];
  64. [self dismissViewControllerAnimated:YES completion:nil];
  65. // PublishLivestViewController *pushVC = [[PublishLivestViewController alloc] init];
  66. //// [[AppDelegate sharedAppDelegate]pushViewController:pushVC animated:YES];
  67. // [self presentViewController:pushVC animated:YES completion:nil];
  68. }
  69. } FailureBlock:^(NSError *error){
  70. }];
  71. }
  72. @end