YOUPAILZUpgradeIntimacyLevelWindow.m 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. //
  2. // YOUPAILZUpgradeIntimacyLevelWindow.m
  3. // MSYOUPAI
  4. //
  5. // Created by CY on 2022/3/18.
  6. // Copyright © 2022 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZUpgradeIntimacyLevelWindow.h"
  9. @implementation YOUPAILZUpgradeIntimacyLevelModel
  10. + (NSDictionary *)mj_replacedKeyFromPropertyName
  11. {
  12. return @{
  13. @"youpaipfrom_uid":@"from_uid",
  14. @"youpaipfrom_nickname":@"from_nickname",
  15. @"youpaipto_uid":@"to_uid",
  16. @"youpaipto_nickname":@"to_nickname",
  17. @"youpaipcurrent_score":@"current_score",
  18. @"youpaipcurrent_grade":@"current_grade",
  19. @"youpaipcurrent_sign":@"current_sign",
  20. @"youpaipdes_next_score":@"des_next_score",
  21. @"youpaipnex_grade":@"nex_grade",
  22. @"youpaipnext_sign":@"next_sign",
  23. @"youpaipis_next":@"is_next",
  24. @"youpaipdes":@"des",
  25. };
  26. }
  27. @end
  28. @interface YOUPAILZUpgradeIntimacyLevelWindow ()
  29. @end
  30. @implementation YOUPAILZUpgradeIntimacyLevelWindow
  31. - (void)viewDidLoad {
  32. [super viewDidLoad];
  33. self.baseView.hidden = YES;
  34. [self youpaifinitUI];
  35. }
  36. - (void)youpaifinitUI{
  37. // window.youpaipvip = [LCSaveModel getUserModel].youpaipuserinfo.youpaipvip;
  38. UIImageView *bgImgV = [[UIImageView alloc] init];
  39. bgImgV.image = [UIImage imageNamed:@"vqu_images_im_upgrade_intimacy_level_bg"];
  40. bgImgV.userInteractionEnabled = YES;
  41. [self.view addSubview:bgImgV];
  42. [bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.center.equalTo(self.view);
  44. make.size.mas_offset(CGSizeMake(323.0f, 353.0f));
  45. }];
  46. UIImageView *headerImgV = [[UIImageView alloc] init];
  47. headerImgV.image = [UIImage imageNamed:@"vqu_images_im_upgrade_intimacy_level_header"];
  48. [self.view addSubview:headerImgV];
  49. [headerImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.centerX.equalTo(self.view);
  51. make.top.equalTo(bgImgV.mas_top).offset(-78.0f);
  52. make.size.mas_offset(CGSizeMake(349.5f, 205.0f));
  53. }];
  54. UILabel *titleL = [[UILabel alloc] init];
  55. titleL.font = LCBoldFont(20.0f);
  56. titleL.text = @"恭喜你";
  57. [bgImgV addSubview:titleL];
  58. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.top.equalTo(headerImgV.mas_bottom).offset(5.0f);
  60. make.centerX.equalTo(bgImgV);
  61. }];
  62. UILabel *detailL = [[UILabel alloc] init];
  63. detailL.font = LCFont14;
  64. detailL.textColor = LZ273145Color;
  65. detailL.textAlignment = NSTextAlignmentCenter;
  66. detailL.numberOfLines = 0;
  67. [bgImgV addSubview:detailL];
  68. [detailL mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.top.equalTo(titleL.mas_bottom).offset(10.0f);
  70. make.left.offset(28.0f);
  71. make.right.offset(-28.0f);
  72. }];
  73. UILabel *unlockContentL = [[UILabel alloc] init];
  74. unlockContentL.font = LCFont12;
  75. unlockContentL.textColor = LZFE66A4Color;
  76. unlockContentL.textAlignment = NSTextAlignmentCenter;
  77. unlockContentL.text = self.model.youpaipdes;
  78. unlockContentL.numberOfLines = 0;
  79. [bgImgV addSubview:unlockContentL];
  80. [unlockContentL mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.top.equalTo(detailL.mas_bottom).offset(20.0f);
  82. make.left.offset(28.0f);
  83. make.right.offset(-28.0f);
  84. }];
  85. UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  86. [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
  87. [confirmBtn setTitle:@"去看看" forState:UIControlStateNormal];
  88. [confirmBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  89. confirmBtn.titleLabel.font = LCFont(16);
  90. [confirmBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(240.0f, 48.0f) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:GradientLeftToRight] forState:UIControlStateNormal];
  91. confirmBtn.layer.cornerRadius = 24.0f;
  92. confirmBtn.clipsToBounds = YES;
  93. [bgImgV addSubview:confirmBtn];
  94. [confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.centerX.equalTo(bgImgV);
  96. make.width.offset(240.0f);
  97. make.bottom.offset(-29.0f);
  98. make.height.offset(48.0f);
  99. }];
  100. NSMutableString *detailStr = [NSMutableString string];
  101. NSString *nickname = self.model.youpaipfrom_nickname;
  102. if ([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id isEqual:self.model.youpaipfrom_uid]) {
  103. nickname = self.model.youpaipto_nickname;
  104. }
  105. [detailStr appendString:@"与"];
  106. [detailStr appendFormat:@" %@ ",nickname];
  107. [detailStr appendString:@"的亲密度等级达到"];
  108. [detailStr appendFormat:@"【%@】",self.model.youpaipcurrent_sign];
  109. [detailStr appendString:@"阶段"];
  110. if ([self.model.youpaipis_next integerValue] == 1) {
  111. [detailStr appendString:@"还差"];
  112. [detailStr appendFormat:@" %@°C",self.model.youpaipdes_next_score];
  113. [detailStr appendString:@",升级至"];
  114. [detailStr appendFormat:@"【%@】",self.model.youpaipnext_sign];
  115. [detailStr appendString:@"阶段"];
  116. }
  117. // 与 cp.晨曦 的亲密度等级达到【初识】阶段
  118. // 还差 166°C,升级至【朋友】阶段
  119. NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:detailStr];
  120. if ([self.model.youpaipis_next integerValue] == 1) {
  121. [str addAttribute:NSForegroundColorAttributeName value:LZFE66A4Color range:[detailStr rangeOfString:[NSString stringWithFormat:@" %@°C",self.model.youpaipdes_next_score]]];
  122. }
  123. detailL.attributedText = str;
  124. UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  125. [closeBtn setImage:[UIImage imageNamed:@"vqu_images_home_super_exposure_close"] forState:UIControlStateNormal];
  126. [closeBtn addTarget:self action:@selector(youpaifcloseBtnClick) forControlEvents:UIControlEventTouchUpInside];
  127. [self.view addSubview:closeBtn];
  128. [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  129. make.top.equalTo(bgImgV.mas_bottom).offset(0);
  130. make.centerX.equalTo(bgImgV);
  131. make.size.mas_offset(CGSizeMake(34.0f, 34.0f));
  132. }];
  133. }
  134. - (void)youpaifconfirmBtnClick{
  135. [self dismissViewControllerAnimated:YES completion:^{
  136. [[NSNotificationCenter defaultCenter] postNotificationName:@"GoIntimacyList" object:nil userInfo:nil];
  137. [[LCTools getCurrentVC].tabBarController setSelectedIndex:2];
  138. [[LCTools getCurrentVC].tabBarController.navigationController popToRootViewControllerAnimated:YES];
  139. [[LCTools getCurrentVC].navigationController popToRootViewControllerAnimated:YES];
  140. }];
  141. }
  142. - (void)youpaifcloseBtnClick{
  143. [self dismissViewControllerAnimated:YES completion:nil];
  144. }
  145. @end