PromoteController.m 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // PromoteController.m
  3. // model
  4. //
  5. // Created by Drew on 2018/10/29.
  6. // Copyright © 2018 Mine. All rights reserved.
  7. //
  8. #import "PromoteController.h"
  9. #import "ShareViewController.h"
  10. #import "ChooseShareController.h"
  11. #import "MyTeamController.h"
  12. @interface PromoteController ()<ShareProtocol>
  13. @property (weak, nonatomic) IBOutlet UILabel *rewardLabel;
  14. @property (weak, nonatomic) IBOutlet UILabel *descLabel;
  15. @property (weak, nonatomic) IBOutlet UIView *contentView;
  16. @end
  17. @implementation PromoteController
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  21. btn.frame = CGRectMake(0, 0, 40, 40);
  22. UIImage *image = [[UIImage imageNamed:@"backBtn"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
  23. [btn setImage:image forState:UIControlStateNormal];
  24. btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
  25. btn.tintColor = [UIColor whiteColor];
  26. [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  27. UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
  28. UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
  29. nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
  30. self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
  31. UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"推广明细" style:UIBarButtonItemStylePlain target:self action:@selector(detail)];
  32. [rightBtn setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:16],NSFontAttributeName, nil] forState:UIControlStateNormal];
  33. [rightBtn setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:16],NSFontAttributeName, nil] forState:UIControlStateSelected];
  34. [rightBtn setTintColor:[UIColor whiteColor]];
  35. self.navigationItem.rightBarButtonItem = rightBtn;
  36. NSString *str = @"用户端\n1:所有用户都可参与推广奖励\n2:通过分享自己的专属“推广链接”或“二维码”下载千模通告及注册的用户,才算做“我的推广用户”\n3:用户充值分成比例为10%\n4:分成金额可用于提现或兑换服务\n\n模特端\n1:推荐并通过审核以后,总数达到30人以上,即可申请成为“经纪人”\n2:经纪人享有所有推荐模特视频面试交易金额的10%作为奖励及其他奖励\n3:奖励可用于提现或购买平台服务";
  37. NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:str];
  38. [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:[str rangeOfString:@"用户端"]];
  39. [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:[str rangeOfString:@"模特端"]];
  40. NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  41. [paragraphStyle setLineSpacing:2];
  42. [attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, str.length)];
  43. self.descLabel.attributedText = attrStr;
  44. }
  45. -(void)viewWillAppear:(BOOL)animated{
  46. [super viewWillAppear:animated];
  47. self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
  48. [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
  49. [self.navigationController.navigationBar setShadowImage:[UIImage new]];
  50. }
  51. - (void)viewWillDisappear:(BOOL)animated {
  52. [super viewWillDisappear:animated];
  53. [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
  54. [self.navigationController.navigationBar setShadowImage:nil];
  55. self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
  56. }
  57. - (void)viewDidLayoutSubviews {
  58. CAGradientLayer *gl = [CAGradientLayer layer];
  59. gl.frame = self.view.bounds;
  60. gl.startPoint = CGPointMake(0.5, 0);
  61. gl.endPoint = CGPointMake(0.5, 0.98);
  62. gl.colors = @[(__bridge id)[UIColor colorWithRed:251/255.0 green:92/255.0 blue:163/255.0 alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:253/255.0 green:127/255.0 blue:141/255.0 alpha:1].CGColor];
  63. gl.locations = @[@(0), @(1.0f)];
  64. [self.view.layer insertSublayer:gl atIndex:0];
  65. // gradient
  66. CAGradientLayer *gl1 = [CAGradientLayer layer];
  67. gl1.frame = self.contentView.bounds;
  68. gl1.startPoint = CGPointMake(0.5, 0);
  69. gl1.endPoint = CGPointMake(0.5, 0.97);
  70. gl1.colors = @[(__bridge id)[UIColor colorWithRed:255/255.0 green:216/255.0 blue:134/255.0 alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:252/255.0 green:136/255.0 blue:149/255.0 alpha:1].CGColor];
  71. gl1.locations = @[@(0), @(1.0f)];
  72. self.contentView.layer.cornerRadius = 24;
  73. self.contentView.clipsToBounds = YES;
  74. [self.contentView.layer insertSublayer:gl1 atIndex:0];
  75. }
  76. - (void)backClick {
  77. [self.navigationController popViewControllerAnimated:YES];
  78. }
  79. - (void)detail {
  80. MyTeamController *vc = [[MyTeamController alloc] init];
  81. [self.navigationController pushViewController:vc animated:YES];
  82. }
  83. - (IBAction)withdraw:(id)sender {
  84. }
  85. - (IBAction)transfer:(id)sender {
  86. }
  87. - (IBAction)invite:(id)sender {
  88. ChooseShareController* vc = [[ChooseShareController alloc] init];
  89. vc.delegate = self;
  90. [self.tabBarController presentViewController:vc animated:NO completion:nil];
  91. }
  92. -(void)shareMember{
  93. ShareViewController *vc = [[ShareViewController alloc] init];
  94. vc.hidesBottomBarWhenPushed = YES;
  95. vc.type = 1;
  96. [self.navigationController pushViewController:vc animated:YES];
  97. }
  98. -(void)shareModel{
  99. ShareViewController *vc = [[ShareViewController alloc] init];
  100. vc.hidesBottomBarWhenPushed = YES;
  101. vc.type = 2;
  102. [self.navigationController pushViewController:vc animated:YES];
  103. }
  104. @end