// // InviteCodeViewController.m // TreeHole // // Created by 郑创权 on 2022/11/9. // #import "InviteCodeViewController.h" #import #import "InviteCordViewCell.h" #import "ChatViewController.h" #import "inputInviteCodeAlertView.h" #import "ShareInviteCodeAlertView.h" @interface InviteCodeViewController (){ // 纵向 跑马灯 JhtVerticalMarquee *_inviteUserMarquee; // 是否暂停了纵向 跑马灯 BOOL _isPauseV; } @property (nonatomic, strong)UIView* inviteCodeView; @property (nonatomic, strong)UILabel* codeLab; @property (nonatomic, strong)UIView* inviteUserInXiDiView; //用户A邀请用户B @property (nonatomic, strong)UIView* unlockVipView;//邀请同好 @property (nonatomic, strong)UIImageView* unlockContentImgV; @property (nonatomic, strong)UIView* vipContentView; //邀请同游免费得到会员 @property (nonatomic, strong)UIView* vipInviteCordContentView; //邀请记录及分红 @property (nonatomic, strong)UIView* vipInviteCordContentBootomView; @property (nonatomic, strong)NSDictionary* inviteDataDict; @end @implementation InviteCodeViewController - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if (_isPauseV) { [_inviteUserMarquee marqueeOfSettingWithState:MarqueeContinue_V]; } } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; } - (BOOL)isSupportContentScrollView { return YES; } - (void)viewDidLoad { [super viewDidLoad]; // self.title = @"邀请有奖"; self.navigationItem.title = @"邀请有奖"; UIButton* gongLueBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0,FIX_SIZE(58), FIX_SIZE(20))]; [gongLueBtn setTitle:@"邀请攻略" forState:UIControlStateNormal]; [gongLueBtn addTarget:self action:@selector(gongLueBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [gongLueBtn setTitleColor:HEX_COLOR(0xFFFFFF) forState:UIControlStateNormal]; gongLueBtn.titleLabel.font = MT_FONT_MEDIUM_SIZE(14); self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:gongLueBtn]; [self.contentScrollView addSubview:self.inviteCodeView]; [self.contentScrollView addSubview:self.inviteUserInXiDiView]; [self.contentScrollView addSubview:self.unlockVipView]; [self.contentScrollView addSubview:self.vipContentView]; [self.contentScrollView addSubview:self.vipInviteCordContentView]; [self.contentScrollView addSubview:self.vipInviteCordContentBootomView]; self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, self.vipInviteCordContentBootomView.bottom + 20 +50); WeakSelf(self); [PYHTTPManager postWithPath:@"invite" params:@{} callback:^(id _Nullable rsp, NSError * _Nullable error) { if (!error) { NSDictionary* dataDict = rsp; NSLog(@"invite dataDict:%@",dataDict); weakself.inviteDataDict = dataDict; }else{ [SVProgressHUD showErrorWithStatus:@"服务器出错了"]; } }]; // Do any additional setup after loading the view. } -(UIView *)inviteCodeView{ if (!_inviteCodeView) { _inviteCodeView = [[UIView alloc]initWithFrame:CGRectMake(20, NAVIGATION_BAR_HEIGHT + 20 , SCREEN_WIDTH - 40, FIX_SIZE(203))]; _inviteCodeView.backgroundColor = HEX_COLOR_A(0xFFFFFF, 0.1); _inviteCodeView.layer.cornerRadius = FIX_SIZE(6); _inviteCodeView.layer.masksToBounds = YES; UILabel* mineInviteCodeLab = [[UILabel alloc]initWithFrame:CGRectMake(FIX_SIZE(14), FIX_SIZE(24), FIX_SIZE(130), FIX_SIZE(22))]; mineInviteCodeLab.textColor = HEX_COLOR(0xFFFFFF); mineInviteCodeLab.font = MT_FONT_MEDIUM_SIZE(16); mineInviteCodeLab.textAlignment = NSTextAlignmentLeft; mineInviteCodeLab.text = @"我的专属邀请码"; [_inviteCodeView addSubview:mineInviteCodeLab]; UIButton* inputInviteCodeBtn = [[UIButton alloc]initWithFrame:CGRectMake(_inviteCodeView.width - FIX_SIZE(90), FIX_SIZE(20), FIX_SIZE(76), FIX_SIZE(30))]; inputInviteCodeBtn.layer.cornerRadius = FIX_SIZE(15); inputInviteCodeBtn.layer.masksToBounds = YES; inputInviteCodeBtn.layer.borderWidth = FIX_SIZE(1); inputInviteCodeBtn.layer.borderColor = HEX_COLOR(0xFFB902).CGColor; inputInviteCodeBtn.titleLabel.font = MT_FONT_REGULAR_SIZE(12); [inputInviteCodeBtn setTitle:@"填码对接" forState:UIControlStateNormal]; [inputInviteCodeBtn setTitleColor:HEX_COLOR(0xFFB902) forState:UIControlStateNormal]; [inputInviteCodeBtn addTarget:self action:@selector(inputInviteCodeBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [_inviteCodeView addSubview:inputInviteCodeBtn]; UILabel* codeLab = [[UILabel alloc]initWithFrame:CGRectMake((_inviteCodeView.width - FIX_SIZE(115) )/2.0 - FIX_SIZE(20)/2.0, FIX_SIZE(80), FIX_SIZE(115), FIX_SIZE(42))]; codeLab.text = @""; codeLab.textAlignment = NSTextAlignmentLeft; codeLab.textColor = HEX_COLOR(0xFFB902); codeLab.font = MT_FONT_MEDIUM_SIZE(30); [_inviteCodeView addSubview:codeLab]; _codeLab = codeLab; UIButton* copyBtn = [[UIButton alloc]initWithFrame:CGRectMake(codeLab.right + FIX_SIZE(6), codeLab.bottom - FIX_SIZE(26), FIX_SIZE(30), FIX_SIZE(20))]; [copyBtn setTitle:@"复制" forState:UIControlStateNormal]; [copyBtn setTitleColor:HEX_COLOR_A(0xFFFFFF, 0.7) forState:UIControlStateNormal]; copyBtn.titleLabel.font = MT_FONT_MEDIUM_SIZE(14); [copyBtn addTarget:self action:@selector(copyBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [_inviteCodeView addSubview:copyBtn]; UIButton* inputInviteBtn = [[UIButton alloc]initWithFrame:CGRectMake((_inviteCodeView.width - FIX_SIZE(224))/2.0, codeLab.bottom + FIX_SIZE(20), FIX_SIZE(224), FIX_SIZE(42))]; inputInviteBtn.layer.cornerRadius = 21; inputInviteBtn.layer.masksToBounds = YES; inputInviteBtn.backgroundColor = HEX_COLOR(0xFFB902); inputInviteBtn.titleLabel.font = MT_FONT_REGULAR_SIZE(16); [inputInviteBtn setTitle:@"立即邀请" forState:UIControlStateNormal]; [inputInviteBtn setTitleColor:HEX_COLOR(0x000000) forState:UIControlStateNormal]; [inputInviteBtn addTarget:self action:@selector(inputInviteBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [_inviteCodeView addSubview:inputInviteBtn]; } return _inviteCodeView; } -(UIView *)inviteUserInXiDiView{ if(!_inviteUserInXiDiView){ _inviteUserInXiDiView = [[UIView alloc]initWithFrame:CGRectMake(20, _inviteCodeView.bottom + FIX_SIZE(20), SCREEN_WIDTH - 40, FIX_SIZE(40))]; // gradient CAGradientLayer *gl = [CAGradientLayer layer]; gl.frame = CGRectMake(0,0,_inviteUserInXiDiView.width,_inviteUserInXiDiView.height); gl.startPoint = CGPointMake(0, 1); gl.endPoint = CGPointMake(1, 1); gl.colors = @[(__bridge id)HEX_COLOR_A(0xFFFFFF, 0).CGColor, (__bridge id)HEX_COLOR_A(0xFFFFFF, 0.1).CGColor, (__bridge id)HEX_COLOR_A(0xFFFFFF, 0.1).CGColor, (__bridge id)HEX_COLOR_A(0xFFFFFF, 0).CGColor]; gl.locations = @[@(0), @(0.5f), @(0.5f), @(1.0f)]; [_inviteUserInXiDiView.layer addSublayer:gl]; _inviteUserInXiDiView.layer.cornerRadius = FIX_SIZE(6); [_inviteUserInXiDiView addSubview:self.inviteUserMarquee]; [self.inviteUserMarquee scrollWithCallbackBlock:^(JhtVerticalMarquee *view, NSInteger currentIndex) { // NSLog(@"滚动到第 %ld 条数据", (long)currentIndex); }]; NSString* userAStr = @"用户A"; NSString* userBStr = @"用户B"; NSString* contentStr = [NSString stringWithFormat:@"%@ 邀请 %@ 加入喜蒂天使",userAStr,userBStr]; NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]initWithString:contentStr]; [attrStr addAttribute:NSForegroundColorAttributeName value:HEX_COLOR(0xFFFFFF) range:NSMakeRange(userAStr.length+2, 2)]; [attrStr addAttribute:NSForegroundColorAttributeName value:HEX_COLOR(0xFFFFFF) range:NSMakeRange(contentStr.length-6, 6)]; NSArray *soureArray = @[attrStr]; self.inviteUserMarquee.sourceArray = soureArray; // 开始滚动 [self.inviteUserMarquee marqueeOfSettingWithState:MarqueeStart_V]; } return _inviteUserInXiDiView; } - (JhtVerticalMarquee *)inviteUserMarquee { if (!_inviteUserMarquee) { _inviteUserMarquee = [[JhtVerticalMarquee alloc] initWithFrame:_inviteUserInXiDiView.bounds]; _inviteUserMarquee.tag = 101; // _inviteUserMarquee.isCounterclockwise = YES; // _inviteUserMarquee.numberOfLines = 0; _inviteUserMarquee.backgroundColor = [UIColor clearColor]; _inviteUserMarquee.textColor = HEX_COLOR(0xFFB902); _inviteUserMarquee.textAlignment = NSTextAlignmentCenter; // 添加点击手势 // UITapGestureRecognizer *vtap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(marqueeTapGes:)]; // [_inviteUserMarquee addGestureRecognizer:vtap]; } return _inviteUserMarquee; } -(UIView *)unlockVipView{ if (!_unlockVipView) { _unlockVipView = [[UIView alloc]initWithFrame:CGRectMake(20, _inviteUserInXiDiView.bottom + 30, SCREEN_WIDTH - 40, 25 + 21 + ((SCREEN_WIDTH - 40)*0.543) )]; UIImageView* titleImgV = [[UIImageView alloc]initWithFrame:CGRectMake((_unlockVipView.width - 279)/2.0, 0, 279, 25)]; titleImgV.image = [UIImage imageNamed:@"TH_invite_title_unlock"]; [_unlockVipView addSubview:titleImgV]; UIImageView* contentImgV = [[UIImageView alloc]initWithFrame:CGRectMake(0, titleImgV.bottom + 21, (SCREEN_WIDTH - 40), ((SCREEN_WIDTH - 40)*0.543))]; // contentImgV.backgroundColor = HEX_COLOR_A(0xFFFFFF, 0.1); // contentImgV.layer.cornerRadius = 6; // contentImgV.layer.masksToBounds = YES; contentImgV.image = [UIImage imageNamed:@"TH_invite_unlockContent"]; contentImgV.contentMode = UIViewContentModeScaleToFill; [_unlockVipView addSubview:contentImgV]; _unlockContentImgV = contentImgV; } return _unlockVipView; } -(UIView *)vipContentView{ if (!_vipContentView) { _vipContentView = [[UIView alloc]initWithFrame:CGRectMake(20, _unlockVipView.bottom + 20, SCREEN_WIDTH - 40 , FIX_SIZE(221))]; UIView* inviteAwardView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, _vipContentView.width , FIX_SIZE(221))]; inviteAwardView.backgroundColor = HEX_COLOR_A(0xFFFFFF, 0.1); inviteAwardView.layer.cornerRadius = FIX_SIZE(6); inviteAwardView.layer.masksToBounds = YES; [_vipContentView addSubview:inviteAwardView]; UIView* inviteTopAwardView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, inviteAwardView.width, FIX_SIZE(48))]; [inviteAwardView addSubview:inviteTopAwardView]; UIView* leftInviteTopAwardCircleView = [[UIView alloc]initWithFrame:CGRectMake(FIX_SIZE(9), FIX_SIZE(9), FIX_SIZE(7), FIX_SIZE(7))]; leftInviteTopAwardCircleView.backgroundColor = HEX_COLOR(0x0F0D1B); leftInviteTopAwardCircleView.layer.cornerRadius = FIX_SIZE(3.5); leftInviteTopAwardCircleView.layer.borderColor = HEX_COLOR_A(0xFFFFFF, 0.3).CGColor; leftInviteTopAwardCircleView.layer.borderWidth = FIX_SIZE(1); [inviteTopAwardView addSubview:leftInviteTopAwardCircleView]; UIView* rightInviteTopAwardCircleView = [[UIView alloc]initWithFrame:CGRectMake(inviteTopAwardView.width - FIX_SIZE(16), FIX_SIZE(9), FIX_SIZE(7), FIX_SIZE(7))]; rightInviteTopAwardCircleView.backgroundColor = HEX_COLOR(0x0F0D1B); rightInviteTopAwardCircleView.layer.cornerRadius = FIX_SIZE(3.5); rightInviteTopAwardCircleView.layer.borderColor = HEX_COLOR_A(0xFFFFFF, 0.3).CGColor; rightInviteTopAwardCircleView.layer.borderWidth = FIX_SIZE(1); [inviteTopAwardView addSubview:rightInviteTopAwardCircleView]; UILabel* inviteTopAwardTitleLab = [[UILabel alloc]initWithFrame:CGRectMake((inviteTopAwardView.width - FIX_SIZE(230))/2.0, FIX_SIZE(14), FIX_SIZE(230), FIX_SIZE(20))]; inviteTopAwardTitleLab.text = @"邀请同友免费得会员,时长无限叠加"; inviteTopAwardTitleLab.textColor = HEX_COLOR(0xFFB902); inviteTopAwardTitleLab.textAlignment = NSTextAlignmentCenter; inviteTopAwardTitleLab.font = MT_FONT_MEDIUM_SIZE(14); [inviteTopAwardView addSubview:inviteTopAwardTitleLab]; UIView* leftHLineV = [[UIView alloc]initWithFrame:CGRectMake(FIX_SIZE(8), FIX_SIZE(24), FIX_SIZE(42), FIX_SIZE(1))]; leftHLineV.backgroundColor = HEX_COLOR(0xFFB902); [inviteTopAwardView addSubview:leftHLineV]; UIView* rightHLineV = [[UIView alloc]initWithFrame:CGRectMake(inviteTopAwardView.width - FIX_SIZE(50), FIX_SIZE(24), FIX_SIZE(42), FIX_SIZE(1))]; rightHLineV.backgroundColor = HEX_COLOR(0xFFB902); [inviteTopAwardView addSubview:rightHLineV]; UIView* bottomHLineV = [[UIView alloc]initWithFrame:CGRectMake(0, inviteTopAwardView.height - FIX_SIZE(1), inviteTopAwardView.width, FIX_SIZE(1))]; bottomHLineV.backgroundColor = HEX_COLOR(0x151528); [inviteTopAwardView addSubview:bottomHLineV]; UIView* inviteContentAwardView = [[UIView alloc]initWithFrame:CGRectMake(0, inviteTopAwardView.bottom, inviteAwardView.width, FIX_SIZE(172))]; [inviteAwardView addSubview:inviteContentAwardView]; UILabel* leftInviteNumLab = [[UILabel alloc]initWithFrame:CGRectMake(FIX_SIZE(13), FIX_SIZE(29), FIX_SIZE(60), FIX_SIZE(20))]; leftInviteNumLab.text = @"邀请人数"; leftInviteNumLab.textAlignment = NSTextAlignmentLeft; leftInviteNumLab.font = MT_FONT_Heavy_SIZE(14); leftInviteNumLab.textColor = HEX_COLOR(0xD2AF53); [inviteContentAwardView addSubview:leftInviteNumLab]; UILabel* leftInviteTimeNumLab = [[UILabel alloc]initWithFrame:CGRectMake(FIX_SIZE(13), leftInviteNumLab.bottom + FIX_SIZE(22), FIX_SIZE(60), FIX_SIZE(20))]; leftInviteTimeNumLab.text = @"会员时长"; leftInviteTimeNumLab.textAlignment = NSTextAlignmentLeft; leftInviteTimeNumLab.font = MT_FONT_Heavy_SIZE(14); leftInviteTimeNumLab.textColor = HEX_COLOR(0xD2AF53); [inviteContentAwardView addSubview:leftInviteTimeNumLab]; NSArray* invite_vip_confArray = @[@{@"invite_user":@"3",@"vip_day":@"30"},@{@"invite_user":@"20",@"vip_day":@"100"}, @{@"invite_user":@"200",@"vip_day":@"365"},@{@"invite_user":@"500",@"vip_day":@"3"}]; UIView* progressHLineView = [[UIView alloc]initWithFrame:CGRectMake(leftInviteNumLab.right + FIX_SIZE(6) , leftInviteNumLab.centerY - 1, inviteContentAwardView.width - leftInviteNumLab.right - FIX_SIZE(6) - FIX_SIZE(13), FIX_SIZE(2))]; progressHLineView.backgroundColor = HEX_COLOR(0xFFFFFF); [inviteContentAwardView addSubview:progressHLineView]; CGFloat circleBtnW = FIX_SIZE(46); CGFloat circleBtnH = FIX_SIZE(46); CGFloat circleBtnJianGe = (progressHLineView.width - circleBtnW*4)/3.0; for (NSInteger i = 0 ; i < invite_vip_confArray.count ; i++) { UIButton* circleBtn = [[UIButton alloc]initWithFrame:CGRectMake(progressHLineView.left + (circleBtnJianGe+circleBtnW)*i, progressHLineView.centerY - FIX_SIZE(23), circleBtnW, circleBtnH)]; circleBtn.layer.cornerRadius = FIX_SIZE(23); circleBtn.layer.borderColor = HEX_COLOR(0x0A0814).CGColor; circleBtn.layer.borderWidth = FIX_SIZE(2.5); circleBtn.titleLabel.font = MT_FONT_MEDIUM_SIZE(12); [circleBtn setTitleColor:HEX_COLOR(0x392602) forState:UIControlStateNormal]; NSString* tempBtnTitleStr = [NSString stringWithFormat:@"%@人",invite_vip_confArray[i][@"invite_user"]]; [circleBtn setTitle:tempBtnTitleStr forState:UIControlStateNormal]; [circleBtn setBackgroundColor:HEX_COLOR(0xFFFFFF)]; circleBtn.tag = 4000001+i; [inviteContentAwardView addSubview:circleBtn]; UILabel* decLab = [[UILabel alloc]initWithFrame:CGRectMake(circleBtn.centerX - FIX_SIZE(25), leftInviteTimeNumLab.centerY - FIX_SIZE(10) , FIX_SIZE(50), FIX_SIZE(20))]; decLab.tag = 4000101+i; decLab.text = [NSString stringWithFormat:@"+%@天",invite_vip_confArray[i][@"vip_day"]]; if(i == invite_vip_confArray.count - 1){ decLab.text = [NSString stringWithFormat:@"+%@年",invite_vip_confArray[i][@"vip_day"]]; } decLab.textAlignment = NSTextAlignmentCenter; decLab.font = MT_FONT_MEDIUM_SIZE(12); decLab.textColor = HEX_COLOR(0xFFF6DE); [inviteContentAwardView addSubview:decLab]; if(i < invite_vip_confArray.count - 2){ UIView* tempProgressHLineView = [[UIView alloc]initWithFrame:CGRectMake(circleBtn.right - FIX_SIZE(2.5), progressHLineView.centerY - FIX_SIZE(1), circleBtnJianGe+FIX_SIZE(5), FIX_SIZE(2))]; tempProgressHLineView.backgroundColor = HEX_COLOR(0xFFFFFF); tempProgressHLineView.tag = 4000401+i; [inviteContentAwardView addSubview:tempProgressHLineView]; } } // UILabel* leftInviteTipLab = [[UILabel alloc]initWithFrame:CGRectMake(FIX_SIZE(13), leftInviteTimeNumLab.bottom + FIX_SIZE(10), inviteContentAwardView.width - FIX_SIZE(26), FIX_SIZE(40))]; leftInviteTipLab.textAlignment = NSTextAlignmentLeft; leftInviteTipLab.numberOfLines = 0; leftInviteTipLab.font = MT_FONT_Heavy_SIZE(14); leftInviteTipLab.textColor = HEX_COLOR(0xD2AF53); [inviteContentAwardView addSubview:leftInviteTipLab]; leftInviteTipLab.tag = 4000201; NSString* tipLabStr = [NSString stringWithFormat:@"Tip:您已成功邀请%@位同好,免费获得会员%@天,再邀请%@位同友可领取更多奖励~",@"--",@"--",@"--"]; NSMutableAttributedString *leftInviteTipLabMString = [[NSMutableAttributedString alloc] initWithString:tipLabStr attributes:@{NSFontAttributeName:MT_FONT_Heavy_SIZE(14),NSForegroundColorAttributeName: HEX_COLOR(0xFFFFFF)}]; [leftInviteTipLabMString addAttributes:@{NSFontAttributeName:MT_FONT_Heavy_SIZE(14), NSForegroundColorAttributeName: HEX_COLOR(0xD2AF53)} range:NSMakeRange(0, 4)]; leftInviteTipLab.attributedText = leftInviteTipLabMString; leftInviteTipLab.textAlignment = NSTextAlignmentLeft; [inviteContentAwardView addSubview:leftInviteTipLab]; //底部样式. UIView* leftInviteBottomAwardCircleView = [[UIView alloc]initWithFrame:CGRectMake(FIX_SIZE(37), inviteAwardView.bottom - FIX_SIZE(12) - FIX_SIZE(14), FIX_SIZE(14), FIX_SIZE(14))]; leftInviteBottomAwardCircleView.backgroundColor = HEX_COLOR(0x0F0D1B); leftInviteBottomAwardCircleView.layer.cornerRadius = FIX_SIZE(7); leftInviteBottomAwardCircleView.layer.borderColor = HEX_COLOR_A(0xFFFFFF, 0.3).CGColor; leftInviteBottomAwardCircleView.layer.borderWidth = FIX_SIZE(2); [inviteAwardView addSubview:leftInviteBottomAwardCircleView]; UIView* rightInviteBottomAwardCircleView = [[UIView alloc]initWithFrame:CGRectMake(inviteAwardView.width - FIX_SIZE(51), inviteAwardView.bottom - FIX_SIZE(12) - FIX_SIZE(14) , FIX_SIZE(14), FIX_SIZE(14))]; rightInviteBottomAwardCircleView.backgroundColor = HEX_COLOR(0x0F0D1B); rightInviteBottomAwardCircleView.layer.cornerRadius = FIX_SIZE(7); rightInviteBottomAwardCircleView.layer.borderColor = HEX_COLOR_A(0xFFFFFF, 0.3).CGColor; rightInviteBottomAwardCircleView.layer.borderWidth = FIX_SIZE(2); [inviteAwardView addSubview:rightInviteBottomAwardCircleView]; UIView* leftYeallowVLineView = [[UIView alloc]initWithFrame:CGRectMake(leftInviteBottomAwardCircleView.left+FIX_SIZE(2), leftInviteBottomAwardCircleView.centerY , leftInviteBottomAwardCircleView.width-FIX_SIZE(4), inviteAwardView.height - leftInviteBottomAwardCircleView.centerY)]; leftYeallowVLineView.backgroundColor = HEX_COLOR(0xFFB902); // leftYeallowVLineView.layer.cornerRadius = FIX_SIZE(5); UIBezierPath *leftVLineMaskPath = [UIBezierPath bezierPathWithRoundedRect:leftYeallowVLineView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(FIX_SIZE(5), FIX_SIZE(5))]; CAShapeLayer *leftVLineMaskLayer = [[CAShapeLayer alloc] init]; leftVLineMaskLayer.frame = leftVLineMaskPath.bounds; leftVLineMaskLayer.path = leftVLineMaskPath.CGPath; leftYeallowVLineView.layer.mask = leftVLineMaskLayer; // leftYeallowVLineView.layer.masksToBounds = YES; [inviteAwardView addSubview:leftYeallowVLineView]; UIView* rightYeallowVLineView = [[UIView alloc]initWithFrame:CGRectMake(rightInviteBottomAwardCircleView.right-FIX_SIZE(2) - leftYeallowVLineView.width, leftYeallowVLineView.y , leftYeallowVLineView.width, leftYeallowVLineView.height)]; rightYeallowVLineView.backgroundColor = HEX_COLOR(0xFFB902); // rightYeallowVLineView.layer.cornerRadius = FIX_SIZE(5); UIBezierPath *rightVLineMaskPath = [UIBezierPath bezierPathWithRoundedRect:rightYeallowVLineView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(FIX_SIZE(5), FIX_SIZE(5))]; CAShapeLayer *rightVLineMaskLayer = [[CAShapeLayer alloc] init]; rightVLineMaskLayer.frame = rightVLineMaskPath.bounds; rightVLineMaskLayer.path = rightVLineMaskPath.CGPath; rightYeallowVLineView.layer.mask = rightVLineMaskLayer; // rightYeallowVLineView.layer.masksToBounds = YES; [inviteAwardView addSubview:rightYeallowVLineView]; } return _vipContentView; } -(UIView *)vipInviteCordContentView{ if (!_vipInviteCordContentView) { _vipInviteCordContentView = [[UIView alloc]initWithFrame:CGRectMake(20,_vipContentView.bottom - FIX_SIZE(1), SCREEN_WIDTH - 40, FIX_SIZE(81))]; UIView* topView = [[UIView alloc]initWithFrame:CGRectMake(0, FIX_SIZE(21), _vipInviteCordContentView.width, FIX_SIZE(60))]; topView.backgroundColor = HEX_COLOR_A(0xFFFFFF, 0.1); // topView.layer.cornerRadius = FIX_SIZE(6); topView.layer.masksToBounds = YES; UIBezierPath *topViewMaskPath = [UIBezierPath bezierPathWithRoundedRect:topView.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(FIX_SIZE(6), FIX_SIZE(6))]; CAShapeLayer *topViewMaskLayer = [[CAShapeLayer alloc] init]; topViewMaskLayer.frame = topView.bounds; topViewMaskLayer.path = topViewMaskPath.CGPath; topView.layer.mask = topViewMaskLayer; [_vipInviteCordContentView addSubview:topView]; //顶部样式. UIView* leftInviteTopAwardCircleView = [[UIView alloc]initWithFrame:CGRectMake(FIX_SIZE(37), FIX_SIZE(12), FIX_SIZE(14), FIX_SIZE(14))]; leftInviteTopAwardCircleView.backgroundColor = HEX_COLOR(0x0F0D1B); leftInviteTopAwardCircleView.layer.cornerRadius = FIX_SIZE(7); leftInviteTopAwardCircleView.layer.borderColor = HEX_COLOR_A(0xFFFFFF, 0.3).CGColor; leftInviteTopAwardCircleView.layer.borderWidth = FIX_SIZE(2); [topView addSubview:leftInviteTopAwardCircleView]; UIView* rightInviteTopCircleView = [[UIView alloc]initWithFrame:CGRectMake(topView.width - FIX_SIZE(51), FIX_SIZE(12), FIX_SIZE(14), FIX_SIZE(14))]; rightInviteTopCircleView.backgroundColor = HEX_COLOR(0x0F0D1B); rightInviteTopCircleView.layer.cornerRadius = FIX_SIZE(7); rightInviteTopCircleView.layer.borderColor = HEX_COLOR_A(0xFFFFFF, 0.3).CGColor; rightInviteTopCircleView.layer.borderWidth = FIX_SIZE(2); [topView addSubview:rightInviteTopCircleView]; UIView* leftYeallowVLineView = [[UIView alloc]initWithFrame:CGRectMake(leftInviteTopAwardCircleView.left+FIX_SIZE(2), 0, leftInviteTopAwardCircleView.width-FIX_SIZE(4), topView.y + leftInviteTopAwardCircleView.centerY )]; leftYeallowVLineView.backgroundColor = HEX_COLOR(0xFFB902); // leftYeallowVLineView.layer.cornerRadius = FIX_SIZE(5); UIBezierPath *leftVLineMaskPath = [UIBezierPath bezierPathWithRoundedRect:leftYeallowVLineView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(FIX_SIZE(5), FIX_SIZE(5))]; CAShapeLayer *leftVLineMaskLayer = [[CAShapeLayer alloc] init]; leftVLineMaskLayer.frame = leftVLineMaskLayer.bounds; leftVLineMaskLayer.path = leftVLineMaskPath.CGPath; leftYeallowVLineView.layer.mask = leftVLineMaskLayer; leftYeallowVLineView.layer.masksToBounds = YES; [_vipInviteCordContentView addSubview:leftYeallowVLineView]; UIView* rightYeallowVLineView = [[UIView alloc]initWithFrame:CGRectMake(rightInviteTopCircleView.right-FIX_SIZE(2) - leftYeallowVLineView.width, 0, rightInviteTopCircleView.width-FIX_SIZE(4), leftYeallowVLineView.height)]; rightYeallowVLineView.backgroundColor = HEX_COLOR(0xFFB902); // rightYeallowVLineView.layer.cornerRadius = FIX_SIZE(5); UIBezierPath *rightVLineMaskPath = [UIBezierPath bezierPathWithRoundedRect:rightYeallowVLineView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(FIX_SIZE(5), FIX_SIZE(5))]; CAShapeLayer *rightVLineMaskLayer = [[CAShapeLayer alloc] init]; rightVLineMaskLayer.frame = rightVLineMaskLayer.bounds; rightVLineMaskLayer.path = rightVLineMaskPath.CGPath; rightYeallowVLineView.layer.mask = rightVLineMaskLayer; rightYeallowVLineView.layer.masksToBounds = YES; [_vipInviteCordContentView addSubview:rightYeallowVLineView]; // UIView* hLineView = [[UIView alloc]initWithFrame:CGRectMake(FIX_SIZE(12), FIX_SIZE(44), topView.width - FIX_SIZE(40), FIX_SIZE(1))]; // hLineView.backgroundColor = HEX_COLOR(0xFFB902); // [topView addSubview:hLineView]; UILabel* inviteTopRecordTitleLab = [[UILabel alloc]initWithFrame:CGRectMake((topView.width - FIX_SIZE(80))/2.0, FIX_SIZE(34), FIX_SIZE(80), FIX_SIZE(20))]; inviteTopRecordTitleLab.text = @"邀请记录"; inviteTopRecordTitleLab.textColor = HEX_COLOR(0xFFB902); inviteTopRecordTitleLab.textAlignment = NSTextAlignmentCenter; inviteTopRecordTitleLab.font = MT_FONT_MEDIUM_SIZE(14); [topView addSubview:inviteTopRecordTitleLab]; UIView* leftHLineV = [[UIView alloc]initWithFrame:CGRectMake(FIX_SIZE(8), inviteTopRecordTitleLab.centerY - FIX_SIZE(0.5) , (topView.width - inviteTopRecordTitleLab.width - FIX_SIZE(16))/2.0, FIX_SIZE(1))]; leftHLineV.backgroundColor = HEX_COLOR(0xFFB902); [topView addSubview:leftHLineV]; UIView* rightHLineV = [[UIView alloc]initWithFrame:CGRectMake(inviteTopRecordTitleLab.right, leftHLineV.y, leftHLineV.width, FIX_SIZE(1))]; rightHLineV.backgroundColor = HEX_COLOR(0xFFB902); [topView addSubview:rightHLineV]; } return _vipInviteCordContentView; } -(UIView *)vipInviteCordContentBootomView{ if (!_vipInviteCordContentBootomView) { _vipInviteCordContentBootomView = [[UIView alloc]initWithFrame:CGRectMake(20, _vipInviteCordContentView.bottom, SCREEN_WIDTH - 40, FIX_SIZE(20))]; _vipInviteCordContentBootomView.backgroundColor = HEX_COLOR_A(0xFFFFFF, 0.1); // topView.layer.cornerRadius = FIX_SIZE(6); _vipInviteCordContentBootomView.layer.masksToBounds = YES; UIBezierPath *bottomViewMaskPath = [UIBezierPath bezierPathWithRoundedRect:_vipInviteCordContentBootomView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(FIX_SIZE(6), FIX_SIZE(6))]; CAShapeLayer *bottomViewMaskLayer = [[CAShapeLayer alloc] init]; bottomViewMaskLayer.frame = _vipInviteCordContentBootomView.bounds; bottomViewMaskLayer.path = bottomViewMaskPath.CGPath; _vipInviteCordContentBootomView.layer.mask = bottomViewMaskLayer; } return _vipInviteCordContentBootomView; } #pragma mark Get Method /** 点击 滚动跑马灯 触发方法 */ - (void)marqueeTapGes:(UITapGestureRecognizer *)ges { // if (ges.view.tag == 101) { // NSLog(@"点击__纵向__滚动的跑马灯_第 %ld 条数据啦!!!", (long)self.inviteUserMarquee.currentIndex); // } // // [self.inviteUserMarquee marqueeOfSettingWithState:MarqueePause_V]; // _isPauseV = YES; // [self.navigationController pushViewController:[[testVC alloc] init] animated:YES]; } //复制点击事件。 -(void)copyBtnClick:(UIButton*)sender{ UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.string = _codeLab.text; [SVProgressHUD showSuccessWithStatus:@"复制成功"]; } -(void)setInviteDataDict:(NSDictionary *)inviteDataDict{ _inviteDataDict = inviteDataDict; //邀请码. _codeLab.text = _inviteDataDict[@"invite_code"]; [_codeLab sizeToFit]; //用户A邀请用户B NSArray* invite_showArray = _inviteDataDict[@"invite_show"]; if([invite_showArray isKindOfClass:[NSNull class]]){ invite_showArray = @[]; }; // invite_showArray = @[@{@"invite_user":@"用户A",@"invite":@"用户B"},@{@"invite_user":@"HH",@"invite":@"孤独"}]; NSMutableArray *soureMArray = [NSMutableArray arrayWithArray:@[]]; NSLog(@"invite_showArray : %@",invite_showArray); if (invite_showArray.count == 0){ NSString* contentStr = [NSString stringWithFormat:@"暂时无最新邀请记录"]; NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]initWithString:contentStr]; [soureMArray addObject:attrStr]; }else{ for (NSInteger i = 0 ; i < invite_showArray.count; i++) { NSString* userAStr = invite_showArray[i][@"invite_user"]; NSString* userBStr = invite_showArray[i][@"inviter"]; NSString* contentStr = [NSString stringWithFormat:@"%@ 邀请 %@ 加入喜蒂天使",userAStr,userBStr]; NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc]initWithString:contentStr]; [attrStr addAttribute:NSForegroundColorAttributeName value:HEX_COLOR(0xFFFFFF) range:NSMakeRange(userAStr.length+2, 2)]; [attrStr addAttribute:NSForegroundColorAttributeName value:HEX_COLOR(0xFFFFFF) range:NSMakeRange(contentStr.length-6, 6)]; [soureMArray addObject:attrStr]; } } _inviteUserMarquee.sourceArray = [soureMArray copy]; //vipConfig NSArray* invite_vip_confArray = _inviteDataDict[@"invite_vip_conf"]; NSDictionary* tempInvite_vip_descDict = _inviteDataDict[@"invite_vip_desc"]; for (NSInteger i = 0 ; i < invite_vip_confArray.count; i++) { NSString* inviteUserNumStr = tempInvite_vip_descDict[@"invite_user"]; NSString* configInvite_userStr = invite_vip_confArray[i][@"invite_user"]; NSString* tempBtnTitleStr = [NSString stringWithFormat:@"%@人",configInvite_userStr]; UIButton* vipConfigBtn = (UIButton*)[self.view viewWithTag:4000001+i]; [vipConfigBtn setTitle:tempBtnTitleStr forState:UIControlStateNormal]; if(i < invite_vip_confArray.count - 2){ UIView* tempProgressHLineView = (UIView*)[self.view viewWithTag:4000401+i]; if(inviteUserNumStr.integerValue >= configInvite_userStr.integerValue){ tempProgressHLineView.backgroundColor = HEX_COLOR(0xEAC378); }else{ tempProgressHLineView.backgroundColor = HEX_COLOR(0xFFFFFF); } } if(inviteUserNumStr.integerValue >= configInvite_userStr.integerValue){ [vipConfigBtn setBackgroundColor:HEX_COLOR(0xEAC378)]; } UILabel* decLab = (UILabel*)[self.view viewWithTag:4000101+i]; decLab.text = invite_vip_confArray[i][@"vip_day"]; // decLab.text = [NSString stringWithFormat:@"+%@天",invite_vip_confArray[i][@"vip_day"]]; // if(i == invite_vip_confArray.count - 1){ // decLab.text = [NSString stringWithFormat:@"+%@年",invite_vip_confArray[i][@"vip_day"]]; // } } NSDictionary* invite_vip_descDict = _inviteDataDict[@"invite_vip_desc"]; UILabel* leftInviteTipLab = (UILabel*)[self.view viewWithTag:4000201]; NSString* tipLabStr = [NSString stringWithFormat:@"Tip:您已成功邀请%@位同好,免费获得会员%@,再邀请%@位同友可领取更多奖励~",invite_vip_descDict[@"invite_user"],invite_vip_descDict[@"gain_vip"],invite_vip_descDict[@"net_invite_vip"]]; NSMutableAttributedString *leftInviteTipLabMString = [[NSMutableAttributedString alloc] initWithString:tipLabStr attributes:@{NSFontAttributeName:MT_FONT_Heavy_SIZE(14),NSForegroundColorAttributeName: HEX_COLOR(0xFFFFFF)}]; [leftInviteTipLabMString addAttributes:@{NSFontAttributeName:MT_FONT_Heavy_SIZE(14), NSForegroundColorAttributeName: HEX_COLOR(0xD2AF53)} range:NSMakeRange(0, 4)]; leftInviteTipLab.attributedText = leftInviteTipLabMString; leftInviteTipLab.textAlignment = NSTextAlignmentLeft; //邀请记录及分红 NSArray* invite_listArray = _inviteDataDict[@"invite_list"]; if([invite_listArray isKindOfClass:[NSNull class]]){ invite_listArray = @[]; }; // invite_listArray = @[@{@"avatar":@"https://xidi-official-website.oss-cn-shenzhen.aliyuncs.com/avatar/avatar_123_1661148010323.png", // @"created":@"填码时间:2022-12-7", // @"gender":@"CT", // @"nickname":@"孤狼", // @"user_id":@"hole_6602"}, // @{@"avatar":@"https://xidi-official-website.oss-cn-shenzhen.aliyuncs.com/avatar/avatar_123_1661148010323.png",@"created":@"填码时间:2022-12-7",@"gender":@"CT",@"nickname":@"还行吧",@"user_id":@"hole_6602"}]; if (invite_listArray.count<1) { UIView *contentV = [UIView new]; [self.contentScrollView addSubview:contentV]; contentV.backgroundColor = HEX_COLOR_A(0xFFFFFF, 0.1);; contentV.frame = CGRectMake(20, _vipInviteCordContentView.bottom + 0, Screen_Width-40, FIX_SIZE(150) + 50); UIImageView *imgV = [UIImageView new]; UIImage *image = ImageNamed(@"TH_empty_page_icon"); image = [UIImage imageWithImage:image scaledToSize:CGSizeMake(FIX_SIZE(150), FIX_SIZE(150))]; imgV.image = image; imgV.frame = CGRectMake(0, 0, Screen_Width-40, FIX_SIZE(150)); imgV.contentMode = UIViewContentModeScaleAspectFit; [contentV addSubview:imgV]; UILabel *tips = [UILabel new]; tips.text = @"邀请好友可免费获得两年会员奖励哦~\n快去邀请好友加入喜蒂天使吧~"; tips.numberOfLines = 0; tips.textAlignment = NSTextAlignmentCenter; tips.frame = CGRectMake(20, FIX_SIZE(130), Screen_Width-80, 50); [contentV addSubview:tips]; // self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, self.vipInviteCordContentBootomView.bottom + 20 + FIX_SIZE(150)); _vipInviteCordContentBootomView.y = contentV.bottom ; self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, self.vipInviteCordContentBootomView.bottom + 20 + 50); } for(NSInteger i = 0; i < invite_listArray.count ; i++){ InviteCordViewCell* cell = [[InviteCordViewCell alloc]initWithFrame:CGRectMake(20, _vipInviteCordContentView.bottom + (i*FIX_SIZE(65)), SCREEN_WIDTH - 40, FIX_SIZE(65))]; cell.dataDict = invite_listArray[i]; cell.siLiaoBtnBlock = ^(NSDictionary * _Nonnull dict) { NSLog(@"dict : %@",dict); // user_id ChatViewController* chatVC = [[ChatViewController alloc]init]; TUIConversationCellData* coveData = [[TUIConversationCellData alloc]init]; coveData.title = dict[@"nickname"]; coveData.userID = dict[@"user_id"]; chatVC.convData = coveData; [self.navigationController pushViewController:chatVC animated:YES]; }; [self.contentScrollView addSubview:cell]; if(i == invite_listArray.count - 1){ _vipInviteCordContentBootomView.y = cell.bottom; self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, self.vipInviteCordContentBootomView.bottom + 20); } } NSDictionary* invite_vip_imgDict = _inviteDataDict[@"invite_vip_img"]; [_unlockContentImgV sd_setImageWithURL:[NSURL URLWithString:invite_vip_imgDict[@"invite_vip_image"]] placeholderImage:[UIImage imageNamed:@"TH_invite_unlockContent"]]; } -(void)inputInviteCodeBtnClick:(UIButton*)sender{ if (_codeLab.text.length == 0) { [SVProgressHUD showErrorWithStatus:@"数据未加载完"]; return; } inputInviteCodeAlertView* alertView = [[inputInviteCodeAlertView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, Screen_Height)]; alertView.sureBtnBlock = ^{ }; [[ZcqVender theTopviewControler].view addSubview:alertView]; } -(void)gongLueBtnClick:(UIButton*)sender{ [PYAppService openWebVCWithTitle:@"邀请攻略" url:@"https://iquanpai.com/app-h5/4_148.html"]; } -(void)inputInviteBtnClick:(UIButton*)sender{ if (_codeLab.text.length == 0) { [SVProgressHUD showErrorWithStatus:@"数据未加载完"]; return; } ShareInviteCodeAlertView* alertView = [[ShareInviteCodeAlertView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, Screen_Height)]; alertView.dataDict = _inviteDataDict; [[ZcqVender theTopviewControler].view addSubview:alertView]; } @end