YMInvitingPrizesIncentivesNotesView.m 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. //
  2. // YMInvitingPrizesIncentivesNotesView.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/3/6.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMInvitingPrizesIncentivesNotesView.h"
  9. #import "YMInvitingPrizesViewModel.h"
  10. @interface YMInvitingPrizesIncentivesNotesView ()
  11. /// 邀请有奖VM
  12. @property (nonatomic, strong) YMInvitingPrizesViewModel *viewModel;
  13. /// 顶部右视图
  14. //@property (nonatomic, strong) UIView *topRightView;
  15. @property (nonatomic, strong) UIImageView *bgImgv;
  16. @property (nonatomic, strong) UIImageView *titleImgv;
  17. ///// 渐变色图片视图
  18. //@property (nonatomic, strong) UIImageView *gradientImageView;
  19. ///// 功能标题标签
  20. //@property (nonatomic, strong) UILabel *functionTitleLb;
  21. /// 底部基础视图
  22. @property (nonatomic, strong) UIView *bottomBaseView;
  23. /// 奖励说明标题标签
  24. @property (nonatomic, strong) UILabel *incentivesNotesTitleLb;
  25. /// 渐变色图片视图
  26. @property (nonatomic, strong) UIImageView *titleImgvL;
  27. /// 渐变色图片视图
  28. @property (nonatomic, strong) UIImageView *titleImgvR;
  29. /// 奖励说明内容标签
  30. @property (nonatomic, strong) UILabel *incentivesNotesContentLb;
  31. ///// 奖励说明提示标签
  32. //@property (nonatomic, strong) UILabel *incentivesNotesTipsLb;
  33. @end
  34. @implementation YMInvitingPrizesIncentivesNotesView
  35. - (void)ym_setupViews{
  36. // [self addSubview:self.topRightView];
  37. // [self.topRightView addSubview:self.gradientImageView];
  38. // [self.topRightView addSubview:self.functionTitleLb];
  39. [self addSubview:self.bottomBaseView];
  40. [self.bottomBaseView addSubview:self.bgImgv];
  41. //[self.bottomBaseView addSubview:self.titleImgv];
  42. [self.bottomBaseView addSubview:self.incentivesNotesTitleLb];
  43. [self.bottomBaseView addSubview:self.titleImgvL];
  44. [self.bottomBaseView addSubview:self.titleImgvR];
  45. [self.bottomBaseView addSubview:self.incentivesNotesContentLb];
  46. // [self.bottomBaseView addSubview:self.incentivesNotesTipsLb];
  47. [self setNeedsUpdateConstraints];
  48. [self updateConstraintsIfNeeded];
  49. }
  50. - (void)updateConstraints{
  51. // [self.topRightView mas_makeConstraints:^(MASConstraintMaker *make) {
  52. // make.top.equalTo(self);
  53. // make.left.equalTo(self).offset(adapt(15));
  54. // make.right.equalTo(self).offset(adapt(-15));
  55. // make.height.mas_equalTo(adapt(45));
  56. // }];
  57. //
  58. // [self.gradientImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  59. // make.bottom.equalTo(self.topRightView.mas_bottom).offset(adapt(-5));
  60. // make.left.equalTo(self.topRightView).offset(adapt(15));
  61. // make.width.mas_equalTo(adapt(90));
  62. // make.height.mas_equalTo(adapt(15));
  63. // }];
  64. //
  65. // [self.functionTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  66. // make.centerY.equalTo(self.topRightView.mas_centerY);
  67. // make.left.equalTo(self.topRightView).offset(adapt(18));
  68. // }];
  69. [self.bottomBaseView mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.top.equalTo(self).offset(adapt(0));
  71. make.left.equalTo(self).offset(adapt(15));
  72. make.right.equalTo(self).offset(adapt(-15));
  73. make.bottom.equalTo(self);
  74. }];
  75. [self.bgImgv mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.edges.equalTo(self.bottomBaseView);
  77. }];
  78. // [self.titleImgv mas_makeConstraints:^(MASConstraintMaker *make) {
  79. // make.top.equalTo(self.bottomBaseView).offset(adapt(28));
  80. // make.centerX.equalTo(self.bottomBaseView);
  81. // make.width.mas_equalTo(adapt(156));
  82. // make.height.mas_equalTo(adapt(25));
  83. // }];
  84. [self.incentivesNotesTitleLb mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.top.equalTo(self.bottomBaseView).offset(adapt(16));
  86. make.centerX.equalTo(self.bottomBaseView).offset(adapt(0));
  87. //make.width.mas_equalTo(adapt(156));
  88. make.height.mas_equalTo(adapt(22));
  89. }];
  90. [self.titleImgvL mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.right.equalTo(self.incentivesNotesTitleLb.mas_left).offset(adapt(-10));
  92. make.centerY.equalTo(self.incentivesNotesTitleLb);
  93. //make.height.mas_equalTo(adapt(22));
  94. }];
  95. [self.titleImgvR mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.left.equalTo(self.incentivesNotesTitleLb.mas_right).offset(adapt(10));
  97. make.centerY.equalTo(self.incentivesNotesTitleLb);
  98. //make.height.mas_equalTo(adapt(22));
  99. }];
  100. [self.incentivesNotesContentLb mas_makeConstraints:^(MASConstraintMaker *make) {
  101. make.top.equalTo(self.incentivesNotesTitleLb.mas_bottom).offset(adapt(7));
  102. make.left.equalTo(self.bottomBaseView).offset(adapt(18));
  103. make.right.equalTo(self.bottomBaseView).offset(adapt(-18));
  104. make.bottom.equalTo(self.bottomBaseView).offset(adapt(-31));
  105. }];
  106. // [self.incentivesNotesTipsLb mas_makeConstraints:^(MASConstraintMaker *make) {
  107. // make.top.equalTo(self.incentivesNotesContentLb.mas_bottom).offset(adapt(10));
  108. // make.left.equalTo(self.bottomBaseView).offset(adapt(12));
  109. // make.right.equalTo(self.bottomBaseView).offset(adapt(-12));
  110. // make.bottom.equalTo(self.bottomBaseView).offset(adapt(-31));
  111. // }];
  112. [super updateConstraints];
  113. }
  114. - (void)ym_bindViewModel:(YMInvitingPrizesViewModel *)viewModel{
  115. if (!viewModel) {
  116. return;
  117. }
  118. _viewModel = viewModel;
  119. RAC(self.incentivesNotesContentLb, attributedText) = RACObserve(self.viewModel, incentivesNotes);
  120. }
  121. //- (UIView *)topRightView{
  122. // if (!_topRightView) {
  123. // _topRightView = [[UIView alloc]init];
  124. // _topRightView.backgroundColor = UIColor.clearColor;
  125. // //[_topRightView addRectCorner:UIRectCornerTopLeft|UIRectCornerTopRight radius:adapt(21)];
  126. // }
  127. // return _topRightView;
  128. //}
  129. //
  130. //
  131. //- (UIImageView *)gradientImageView{
  132. // if (!_gradientImageView) {
  133. // _gradientImageView = [[UIImageView alloc]init];
  134. // _gradientImageView.image = ImageByName(@"ym_inviting_prizes_line_icon");
  135. // }
  136. // return _gradientImageView;
  137. //}
  138. //
  139. //- (UILabel *)functionTitleLb{
  140. // if (!_functionTitleLb) {
  141. // _functionTitleLb = [[UILabel alloc]init];
  142. // _functionTitleLb.font = LCBoldFont(18);
  143. // _functionTitleLb.textColor = HexColorFromRGB(0x333333);
  144. // _functionTitleLb.textAlignment = NSTextAlignmentLeft;
  145. // _functionTitleLb.text = @"邀请奖励";
  146. // }
  147. // return _functionTitleLb;
  148. //}
  149. - (UIImageView *)bgImgv {
  150. if (!_bgImgv) {
  151. _bgImgv = [[UIImageView alloc] init];
  152. UIImage *image = ImageByName(@"ym_inviting_prizes_invitation_reward_bg");
  153. UIEdgeInsets insets = UIEdgeInsetsMake(40, 0, 40, 0); // 上、左、下、右的拉伸边距
  154. // 创建可拉伸的图像
  155. UIImage *stretchableImage = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];
  156. _bgImgv.image = stretchableImage;
  157. _bgImgv.hidden = YES;
  158. }
  159. return _bgImgv;
  160. }
  161. - (UIImageView *)titleImgv {
  162. if (!_titleImgv) {
  163. _titleImgv = [[UIImageView alloc] init];
  164. _titleImgv.image = ImageByName(@"ym_inviting_prizes_invitation_reward_title");
  165. }
  166. return _titleImgv;
  167. }
  168. - (UIView *)bottomBaseView{
  169. if (!_bottomBaseView) {
  170. _bottomBaseView = [[UIView alloc]init];
  171. _bottomBaseView.backgroundColor = UIColor.whiteColor;
  172. _bottomBaseView.layer.cornerRadius = adapt(23);
  173. _bottomBaseView.layer.masksToBounds = YES;
  174. //[_bottomBaseView addRectCorner:UIRectCornerBottomLeft|UIRectCornerBottomRight radius:adapt(21)];
  175. }
  176. return _bottomBaseView;
  177. }
  178. - (UILabel *)incentivesNotesTitleLb{
  179. if (!_incentivesNotesTitleLb) {
  180. _incentivesNotesTitleLb = [[UILabel alloc]init];
  181. _incentivesNotesTitleLb.font = LCBoldFont(16);
  182. _incentivesNotesTitleLb.textColor = rgba(255, 63, 104, 1);
  183. _incentivesNotesTitleLb.textAlignment = NSTextAlignmentCenter;
  184. _incentivesNotesTitleLb.text = @"邀请奖励";
  185. }
  186. return _incentivesNotesTitleLb;
  187. }
  188. - (UIImageView *)titleImgvL{
  189. if (!_titleImgvL) {
  190. _titleImgvL = [[UIImageView alloc]initWithImage:ImageByName(@"ym_inviting_prizes_my_invitation_title_left")];
  191. }
  192. return _titleImgvL;
  193. }
  194. - (UIImageView *)titleImgvR{
  195. if (!_titleImgvR) {
  196. _titleImgvR = [[UIImageView alloc]initWithImage:ImageByName(@"ym_inviting_prizes_my_invitation_title_right")];
  197. }
  198. return _titleImgvR;
  199. }
  200. - (UILabel *)incentivesNotesContentLb{
  201. if (!_incentivesNotesContentLb) {
  202. _incentivesNotesContentLb = [[UILabel alloc]init];
  203. _incentivesNotesContentLb.font = LCFont(14);
  204. _incentivesNotesContentLb.textColor = rgba(102, 102, 102, 1);
  205. _incentivesNotesContentLb.textAlignment = NSTextAlignmentLeft;
  206. _incentivesNotesContentLb.numberOfLines = 0;
  207. }
  208. return _incentivesNotesContentLb;
  209. }
  210. //- (UILabel *)incentivesNotesTipsLb{
  211. // if (!_incentivesNotesTipsLb) {
  212. // _incentivesNotesTipsLb = [[UILabel alloc]init];
  213. // _incentivesNotesTipsLb.font = LCFont(13);
  214. // _incentivesNotesTipsLb.textColor = HexColorFromRGB(0x333333);
  215. // _incentivesNotesTipsLb.textAlignment = NSTextAlignmentLeft;
  216. // _incentivesNotesTipsLb.text = @"提示:凡是发现自刷行为一律取消奖励资格并封号!";
  217. // }
  218. // return _incentivesNotesTipsLb;
  219. //}
  220. @end