ApplyRecommendView.m 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // ApplyRecommendView.m
  3. // model
  4. //
  5. // Created by Drew on 2018/11/7.
  6. // Copyright © 2018 Mine. All rights reserved.
  7. //
  8. #import "ApplyRecommendView.h"
  9. #import "Masonry.h"
  10. @interface ApplyRecommendView ()
  11. @property(nonatomic, strong) UIView *mask;
  12. @property(nonatomic, strong) UIView *content;
  13. @end
  14. @implementation ApplyRecommendView
  15. - (instancetype)init {
  16. if (self = [super init]) {
  17. [self initView];
  18. }
  19. return self;
  20. }
  21. - (void)initView {
  22. self.backgroundColor = [UIColor clearColor];
  23. UIView *mask = [[UIView alloc] init];
  24. mask.backgroundColor = [UIColor clearColor];
  25. [self addSubview:mask];
  26. [mask mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.edges.equalTo(self);
  28. }];
  29. self.mask = mask;
  30. UIView *content = [[UIView alloc] init];
  31. content.backgroundColor = [UIColor whiteColor];
  32. content.layer.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1].CGColor;
  33. content.layer.cornerRadius = 12;
  34. [self addSubview:content];
  35. [content mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.left.equalTo(self.mas_left).offset(20);
  37. make.right.equalTo(self.mas_right).offset(-20);
  38. make.top.equalTo(self.mas_top).offset(68);
  39. make.bottom.equalTo(self.mas_bottom).offset(-68);
  40. }];
  41. content.transform = CGAffineTransformMakeScale(0.3, 0.3);
  42. content.alpha = 0;
  43. self.content = content;
  44. UILabel *title = [[UILabel alloc] init];
  45. title.numberOfLines = 0;
  46. title.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  47. title.textColor = [UIColor blackColor];
  48. title.text = @"申请上推荐位";
  49. [content addSubview:title];
  50. [title mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.centerX.equalTo(content);
  52. make.top.equalTo(content).offset(30);
  53. }];
  54. UILabel *detail = [[UILabel alloc] init];
  55. detail.numberOfLines = 0;
  56. detail.font = [UIFont systemFontOfSize:13];
  57. detail.textColor = [UIColor blackColor];
  58. detail.text = @"1、申请上推荐位可在客户端有更多展示机会和更好的展示位置,获取更多商演订单和视频面试订单的经济收益。\n2、申请上推荐位视为与平台签订协议,可额外获得更多现金奖励和境外旅游奖励等。\n3、千模官方商业活动优先推荐“推荐位”的模特参与。\n\n要求及奖励:\n1、每天在线不得低于60分钟或每月累计在线不低于30小时。\n2、每月更新动态不低于15天(次),接听率不低于65%。\n3、月收入超过10000元,额外奖励1000元。\n4、申请上推荐审核后,如时长及接单率未达到标注,平台扣款100元。\n5、每次申请上推荐位的协议周期为一个月,以自然月整月为准,可续签。";
  59. [content addSubview:detail];
  60. [detail mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.left.equalTo(content).offset(15);
  62. make.right.equalTo(content).offset(-15);
  63. make.top.equalTo(title.mas_bottom).offset(20);
  64. }];
  65. UIButton *confirmBtn = [[UIButton alloc] init];
  66. [confirmBtn setTitle:@"确认申请" forState:UIControlStateNormal];
  67. [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  68. confirmBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
  69. confirmBtn.layer.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:64 / 255.0 blue:149 / 255.0 alpha:1].CGColor;
  70. confirmBtn.layer.cornerRadius = 20;
  71. confirmBtn.layer.shadowColor = [UIColor colorWithRed:255 / 255.0 green:64 / 255.0 blue:149 / 255.0 alpha:0.36].CGColor;
  72. confirmBtn.layer.shadowOffset = CGSizeMake(0, 8);
  73. confirmBtn.layer.shadowOpacity = 1;
  74. confirmBtn.layer.shadowRadius = 10;
  75. [content addSubview:confirmBtn];
  76. [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.width.mas_equalTo(180);
  78. make.height.mas_equalTo(40);
  79. make.centerX.equalTo(content);
  80. make.bottom.equalTo(content).offset(-55);
  81. }];
  82. [confirmBtn addTarget:self action:@selector(confirm) forControlEvents:UIControlEventTouchUpInside];
  83. UIButton *cancel = [[UIButton alloc] init];
  84. [cancel setTitle:@"取消" forState:UIControlStateNormal];
  85. cancel.titleLabel.font = [UIFont systemFontOfSize:14];
  86. [cancel setTitleColor:[UIColor colorWithHexString:@"333333"] forState:UIControlStateNormal];
  87. [content addSubview:cancel];
  88. [cancel mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.centerX.equalTo(content);
  90. make.bottom.equalTo(content).offset(-20);
  91. make.height.mas_equalTo(20);
  92. }];
  93. [cancel addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
  94. }
  95. - (void)show {
  96. [UIView animateWithDuration:0.25
  97. delay:0
  98. options:UIViewAnimationOptionCurveEaseOut
  99. animations:^{
  100. self.mask.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.5];
  101. self.content.transform = CGAffineTransformMakeScale(1, 1);
  102. self.content.alpha = 1;
  103. }
  104. completion:^(BOOL finished) {
  105. }];
  106. }
  107. - (void)dismiss {
  108. [UIView animateWithDuration:0.25
  109. delay:0
  110. options:UIViewAnimationOptionCurveEaseOut
  111. animations:^{
  112. self.mask.backgroundColor = [UIColor clearColor];
  113. self.content.transform = CGAffineTransformMakeScale(0.3, 0.3);
  114. self.content.alpha = 0;
  115. }
  116. completion:^(BOOL finished) {
  117. [self removeFromSuperview];
  118. }];
  119. }
  120. - (void)confirm {
  121. [self dismiss];
  122. if (self.confirmBlock) {
  123. self.confirmBlock();
  124. }
  125. }
  126. + (void)showIntoView:(UIView *)view confirm:(void (^)(void))confirmBlock {
  127. ApplyRecommendView *recView = [[ApplyRecommendView alloc] init];
  128. recView.confirmBlock = confirmBlock;
  129. [view addSubview:recView];
  130. [recView mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.edges.equalTo(view);
  132. }];
  133. [recView show];
  134. }
  135. @end