// // YOUPAILZUpgradeIntimacyLevelWindow.m // MSYOUPAI // // Created by CY on 2022/3/18. // Copyright © 2022 MS. All rights reserved. // #import "YOUPAILZUpgradeIntimacyLevelWindow.h" @implementation YOUPAILZUpgradeIntimacyLevelModel + (NSDictionary *)mj_replacedKeyFromPropertyName { return @{ @"youpaipfrom_uid":@"from_uid", @"youpaipfrom_nickname":@"from_nickname", @"youpaipto_uid":@"to_uid", @"youpaipto_nickname":@"to_nickname", @"youpaipcurrent_score":@"current_score", @"youpaipcurrent_grade":@"current_grade", @"youpaipcurrent_sign":@"current_sign", @"youpaipdes_next_score":@"des_next_score", @"youpaipnex_grade":@"nex_grade", @"youpaipnext_sign":@"next_sign", @"youpaipis_next":@"is_next", @"youpaipdes":@"des", }; } @end @interface YOUPAILZUpgradeIntimacyLevelWindow () @end @implementation YOUPAILZUpgradeIntimacyLevelWindow - (void)viewDidLoad { [super viewDidLoad]; self.baseView.hidden = YES; [self youpaifinitUI]; } - (void)youpaifinitUI{ // window.youpaipvip = [LCSaveModel getUserModel].youpaipuserinfo.youpaipvip; UIImageView *bgImgV = [[UIImageView alloc] init]; bgImgV.image = [UIImage imageNamed:@"vqu_images_im_upgrade_intimacy_level_bg"]; bgImgV.userInteractionEnabled = YES; [self.view addSubview:bgImgV]; [bgImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(self.view); make.size.mas_offset(CGSizeMake(323.0f, 353.0f)); }]; UIImageView *headerImgV = [[UIImageView alloc] init]; headerImgV.image = [UIImage imageNamed:@"vqu_images_im_upgrade_intimacy_level_header"]; [self.view addSubview:headerImgV]; [headerImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view); make.top.equalTo(bgImgV.mas_top).offset(-78.0f); make.size.mas_offset(CGSizeMake(349.5f, 205.0f)); }]; UILabel *titleL = [[UILabel alloc] init]; titleL.font = LCBoldFont(20.0f); titleL.text = @"恭喜你"; [bgImgV addSubview:titleL]; [titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(headerImgV.mas_bottom).offset(5.0f); make.centerX.equalTo(bgImgV); }]; UILabel *detailL = [[UILabel alloc] init]; detailL.font = LCFont14; detailL.textColor = LZ273145Color; detailL.textAlignment = NSTextAlignmentCenter; detailL.numberOfLines = 0; [bgImgV addSubview:detailL]; [detailL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(titleL.mas_bottom).offset(10.0f); make.left.offset(28.0f); make.right.offset(-28.0f); }]; UILabel *unlockContentL = [[UILabel alloc] init]; unlockContentL.font = LCFont12; unlockContentL.textColor = LZFE66A4Color; unlockContentL.textAlignment = NSTextAlignmentCenter; unlockContentL.text = self.model.youpaipdes; unlockContentL.numberOfLines = 0; [bgImgV addSubview:unlockContentL]; [unlockContentL mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(detailL.mas_bottom).offset(20.0f); make.left.offset(28.0f); make.right.offset(-28.0f); }]; UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnClick) forControlEvents:UIControlEventTouchUpInside]; [confirmBtn setTitle:@"去看看" forState:UIControlStateNormal]; [confirmBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; confirmBtn.titleLabel.font = LCFont(16); [confirmBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(240.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal]; confirmBtn.layer.cornerRadius = 24.0f; confirmBtn.clipsToBounds = YES; [bgImgV addSubview:confirmBtn]; [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(bgImgV); make.width.offset(240.0f); make.bottom.offset(-29.0f); make.height.offset(48.0f); }]; NSMutableString *detailStr = [NSMutableString string]; NSString *nickname = self.model.youpaipfrom_nickname; if ([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id isEqual:self.model.youpaipfrom_uid]) { nickname = self.model.youpaipto_nickname; } [detailStr appendString:@"与"]; [detailStr appendFormat:@" %@ ",nickname]; [detailStr appendString:@"的亲密度等级达到"]; [detailStr appendFormat:@"【%@】",self.model.youpaipcurrent_sign]; [detailStr appendString:@"阶段"]; if ([self.model.youpaipis_next integerValue] == 1) { [detailStr appendString:@"还差"]; [detailStr appendFormat:@" %@°C",self.model.youpaipdes_next_score]; [detailStr appendString:@",升级至"]; [detailStr appendFormat:@"【%@】",self.model.youpaipnext_sign]; [detailStr appendString:@"阶段"]; } // 与 cp.晨曦 的亲密度等级达到【初识】阶段 // 还差 166°C,升级至【朋友】阶段 NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:detailStr]; if ([self.model.youpaipis_next integerValue] == 1) { [str addAttribute:NSForegroundColorAttributeName value:LZFE66A4Color range:[detailStr rangeOfString:[NSString stringWithFormat:@" %@°C",self.model.youpaipdes_next_score]]]; } detailL.attributedText = str; UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [closeBtn setImage:[UIImage imageNamed:@"vqu_images_home_super_exposure_close"] forState:UIControlStateNormal]; [closeBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:closeBtn]; [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(bgImgV.mas_bottom).offset(0); make.centerX.equalTo(bgImgV); make.size.mas_offset(CGSizeMake(34.0f, 34.0f)); }]; } - (void)youpaifconfirmBtnClick{ [self dismissViewControllerAnimated:YES completion:^{ [[NSNotificationCenter defaultCenter] postNotificationName:@"GoIntimacyList" object:nil userInfo:nil]; [[LCTools getCurrentVC].tabBarController setSelectedIndex:2]; [[LCTools getCurrentVC].tabBarController.navigationController popToRootViewControllerAnimated:YES]; [[LCTools getCurrentVC].navigationController popToRootViewControllerAnimated:YES]; }]; } - (void)youpaifcloseBtnClick{ [self dismissViewControllerAnimated:YES completion:nil]; } @end