// // ApplyRecommendView.m // model // // Created by Drew on 2018/11/7. // Copyright © 2018 Mine. All rights reserved. // #import "ApplyRecommendView.h" #import "Masonry.h" @interface ApplyRecommendView () @property(nonatomic, strong) UIView *mask; @property(nonatomic, strong) UIView *content; @end @implementation ApplyRecommendView - (instancetype)init { if (self = [super init]) { [self initView]; } return self; } - (void)initView { self.backgroundColor = [UIColor clearColor]; UIView *mask = [[UIView alloc] init]; mask.backgroundColor = [UIColor clearColor]; [self addSubview:mask]; [mask mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self); }]; self.mask = mask; UIView *content = [[UIView alloc] init]; content.backgroundColor = [UIColor whiteColor]; content.layer.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:1].CGColor; content.layer.cornerRadius = 12; [self addSubview:content]; [content mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.mas_left).offset(20); make.right.equalTo(self.mas_right).offset(-20); make.top.equalTo(self.mas_top).offset(68); make.bottom.equalTo(self.mas_bottom).offset(-68); }]; content.transform = CGAffineTransformMakeScale(0.3, 0.3); content.alpha = 0; self.content = content; UILabel *title = [[UILabel alloc] init]; title.numberOfLines = 0; title.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; title.textColor = [UIColor blackColor]; title.text = @"申请上推荐位"; [content addSubview:title]; [title mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(content); make.top.equalTo(content).offset(30); }]; UILabel *detail = [[UILabel alloc] init]; detail.numberOfLines = 0; detail.font = [UIFont systemFontOfSize:13]; detail.textColor = [UIColor blackColor]; detail.text = @"1、申请上推荐位可在客户端有更多展示机会和更好的展示位置,获取更多商演订单和视频面试订单的经济收益。\n2、申请上推荐位视为与平台签订协议,可额外获得更多现金奖励和境外旅游奖励等。\n3、千模官方商业活动优先推荐“推荐位”的模特参与。\n\n要求及奖励:\n1、每天在线不得低于60分钟或每月累计在线不低于30小时。\n2、每月更新动态不低于15天(次),接听率不低于65%。\n3、月收入超过10000元,额外奖励1000元。\n4、申请上推荐审核后,如时长及接单率未达到标注,平台扣款100元。\n5、每次申请上推荐位的协议周期为一个月,以自然月整月为准,可续签。"; [content addSubview:detail]; [detail mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(content).offset(15); make.right.equalTo(content).offset(-15); make.top.equalTo(title.mas_bottom).offset(20); }]; UIButton *confirmBtn = [[UIButton alloc] init]; [confirmBtn setTitle:@"确认申请" forState:UIControlStateNormal]; [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; confirmBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; confirmBtn.layer.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:64 / 255.0 blue:149 / 255.0 alpha:1].CGColor; confirmBtn.layer.cornerRadius = 20; confirmBtn.layer.shadowColor = [UIColor colorWithRed:255 / 255.0 green:64 / 255.0 blue:149 / 255.0 alpha:0.36].CGColor; confirmBtn.layer.shadowOffset = CGSizeMake(0, 8); confirmBtn.layer.shadowOpacity = 1; confirmBtn.layer.shadowRadius = 10; [content addSubview:confirmBtn]; [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(180); make.height.mas_equalTo(40); make.centerX.equalTo(content); make.bottom.equalTo(content).offset(-55); }]; [confirmBtn addTarget:self action:@selector(confirm) forControlEvents:UIControlEventTouchUpInside]; UIButton *cancel = [[UIButton alloc] init]; [cancel setTitle:@"取消" forState:UIControlStateNormal]; cancel.titleLabel.font = [UIFont systemFontOfSize:14]; [cancel setTitleColor:[UIColor colorWithHexString:@"333333"] forState:UIControlStateNormal]; [content addSubview:cancel]; [cancel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(content); make.bottom.equalTo(content).offset(-20); make.height.mas_equalTo(20); }]; [cancel addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; } - (void)show { [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.mask.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.5]; self.content.transform = CGAffineTransformMakeScale(1, 1); self.content.alpha = 1; } completion:^(BOOL finished) { }]; } - (void)dismiss { [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ self.mask.backgroundColor = [UIColor clearColor]; self.content.transform = CGAffineTransformMakeScale(0.3, 0.3); self.content.alpha = 0; } completion:^(BOOL finished) { [self removeFromSuperview]; }]; } - (void)confirm { [self dismiss]; if (self.confirmBlock) { self.confirmBlock(); } } + (void)showIntoView:(UIView *)view confirm:(void (^)(void))confirmBlock { ApplyRecommendView *recView = [[ApplyRecommendView alloc] init]; recView.confirmBlock = confirmBlock; [view addSubview:recView]; [recView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(view); }]; [recView show]; } @end