ASUserCenterTopView.m 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. //
  2. // ASUserCenterTopView.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/5/15.
  6. //
  7. #import "ASUserCenterTopView.h"
  8. #import "ASUserAvaterView.h"
  9. #import "ASUserBaseInfoView.h"
  10. @interface ASUserCenterTopView ()
  11. @property (nonatomic, strong) UIView *bgV;
  12. @property (nonatomic, strong) ASUserAvaterView *bgAvaterV;
  13. @property (nonatomic, strong) ASUserBaseInfoView *userInfoV;
  14. @property (nonatomic, strong) UIButton *settingBt;
  15. @property (nonatomic,strong) UIView *vipContentV;
  16. @property (nonatomic,strong) UIView *vipLineV1;
  17. @property (nonatomic,strong) UIView *vipLineV2;
  18. @property (nonatomic,strong) UIView *vipPointV1;
  19. @property (nonatomic,strong) UIView *vipPointV2;
  20. @property (nonatomic,strong) UIImageView *currentVipTipV;
  21. @property (nonatomic,strong) UIImageView *vipLevel1;
  22. @property (nonatomic,strong) UIImageView *vipLevel2;
  23. @property (nonatomic,strong) UILabel *vipDesLb;
  24. @end
  25. @implementation ASUserCenterTopView
  26. - (void)setDemoData {
  27. [self.bgAvaterV setUserHeadV:@"" uName:@"new"];
  28. [self.bgAvaterV setBorderColor:[UIColor clearColor] width:0];
  29. }
  30. - (void)settingAction {
  31. if (self.settingBlock) {
  32. self.settingBlock();
  33. }
  34. }
  35. // MARK: - SubUI
  36. - (instancetype)initWithFrame:(CGRect)frame {
  37. self = [super initWithFrame:CGRectMake(0, 0, KScreenWidth, 226)];
  38. if (self) {
  39. self.backgroundColor = UIColor.clearColor;
  40. [self loadSubV];
  41. [self setDemoData];
  42. }
  43. return self;
  44. }
  45. - (void)loadSubV {
  46. self.backgroundColor = Col_FFF;
  47. [self addSubview:self.bgV];
  48. self.bgV.backgroundColor = Col_FFF;
  49. self.bgV.frame = CGRectMake(10, 10, KScreenWidth-20, 206);
  50. UIVisualEffectView *blurV = [UIView getBlurV:self.bgV.bounds];
  51. blurV.alpha = 0.95;
  52. [self.bgV addSubview:self.bgAvaterV];
  53. [self.bgAvaterV mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.edges.equalTo(self.bgV);
  55. }];
  56. [self.bgV addSubview:blurV];
  57. [self.bgV addSubview:self.userInfoV];
  58. [self.bgV addSubview:self.settingBt];
  59. [self.bgV addSubview:self.vipContentV];
  60. [self.bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.top.leading.equalTo(self).offset(10);
  62. make.bottom.trailing.equalTo(self).offset(-10);
  63. make.height.equalTo(@206);
  64. }];
  65. [self.userInfoV mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.top.leading.equalTo(self.bgV).offset(10);
  67. make.trailing.equalTo(self.bgV).offset(-10);
  68. make.height.equalTo(@100);
  69. }];
  70. [self.settingBt mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.top.equalTo(self.bgV).offset(10);
  72. make.trailing.equalTo(self.bgV).offset(-10);
  73. make.width.height.equalTo(@24);
  74. }];
  75. [self.vipContentV mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.top.equalTo(self.userInfoV.mas_bottom).offset(20);
  77. make.bottom.equalTo(self.bgV).offset(-20);
  78. make.leading.equalTo(self.userInfoV);
  79. make.width.equalTo(self.userInfoV);
  80. }];
  81. // vip
  82. [self.vipContentV addSubview:self.vipDesLb];
  83. [self.vipContentV addSubview:self.vipLineV1];
  84. [self.vipContentV addSubview:self.vipLineV2];
  85. [self.vipContentV addSubview:self.vipPointV1];
  86. [self.vipContentV addSubview:self.vipPointV2];
  87. [self.vipContentV addSubview:self.currentVipTipV];
  88. [self.vipContentV addSubview:self.vipLevel1];
  89. [self.vipContentV addSubview:self.vipLevel2];
  90. [self.vipDesLb mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.left.equalTo(self.vipContentV).offset(0);
  92. make.right.equalTo(self.vipContentV).offset(0);
  93. make.top.equalTo(self.vipContentV).offset(0);
  94. make.height.equalTo(@14);
  95. }];
  96. [self.vipLineV1 mas_makeConstraints:^(MASConstraintMaker *make) {
  97. make.left.equalTo(self.vipContentV).offset(0);
  98. make.right.equalTo(self.vipContentV).offset(0);
  99. make.top.equalTo(self.vipDesLb.mas_bottom).offset(17);
  100. make.height.equalTo(@2);
  101. }];
  102. [self.vipLineV2 mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.trailing.equalTo(self.vipLineV1);
  104. make.centerY.equalTo(self.vipLineV1);
  105. make.width.equalTo(self.vipLineV1.mas_width).multipliedBy(0.68);
  106. make.height.equalTo(self.vipLineV1);
  107. }];
  108. [self.vipPointV1 mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.centerX.equalTo(self.vipLineV2.mas_left);
  110. make.centerY.equalTo(self.vipLineV1);
  111. make.width.height.equalTo(@10);
  112. }];
  113. [self.vipPointV2 mas_makeConstraints:^(MASConstraintMaker *make) {
  114. make.right.equalTo(self.vipLineV2.mas_right);
  115. make.centerY.equalTo(self.vipLineV1);
  116. make.width.height.equalTo(@10);
  117. }];
  118. [self.currentVipTipV mas_makeConstraints:^(MASConstraintMaker *make) {
  119. make.bottom.equalTo(self.vipPointV1.mas_top);
  120. make.centerX.equalTo(self.vipPointV1);
  121. make.width.equalTo(@10);
  122. make.height.equalTo(@8);
  123. }];
  124. [self.vipLevel1 mas_makeConstraints:^(MASConstraintMaker *make) {
  125. make.top.equalTo(self.vipPointV1.mas_bottom).offset(5);
  126. make.trailing.equalTo(self.vipPointV1);
  127. make.width.equalTo(@35);
  128. make.height.equalTo(@20);
  129. }];
  130. [self.vipLevel2 mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.trailing.equalTo(self.vipPointV2);
  132. make.centerY.equalTo(self.vipLevel1);
  133. make.width.equalTo(@35);
  134. make.height.equalTo(@20);
  135. }];
  136. }
  137. - (UIView *)bgV {
  138. if (!_bgV) {
  139. UIView *v = [UIView baseV];
  140. v.layer.cornerRadius = 8;
  141. v.layer.masksToBounds = true;
  142. _bgV = v;
  143. }
  144. return _bgV;
  145. }
  146. - (ASUserAvaterView *)bgAvaterV {
  147. if (!_bgAvaterV) {
  148. ASUserAvaterView *v = [[ASUserAvaterView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth-20, 206)];
  149. _bgAvaterV = v;
  150. }
  151. return _bgAvaterV;
  152. }
  153. - (ASUserBaseInfoView *)userInfoV {
  154. if (!_userInfoV) {
  155. ASUserBaseInfoView *v = [[ASUserBaseInfoView alloc] initWithFrame:CGRectZero];
  156. _userInfoV = v;
  157. }
  158. return _userInfoV;
  159. }
  160. - (UIButton *)settingBt {
  161. if (!_settingBt) {
  162. UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
  163. [bt setImage:[UIImage imageNamed:@"uc_setting"] forState:UIControlStateNormal];
  164. [bt addTarget:self action:@selector(settingAction) forControlEvents:UIControlEventTouchUpInside];
  165. _settingBt = bt;
  166. }
  167. return _settingBt;
  168. }
  169. // MARK: vip等级
  170. - (UIImageView *)vipLevel1 {
  171. if (!_vipLevel1) {
  172. _vipLevel1 = [UIView baseImgV];
  173. _vipLevel1.image = [UIImage imageNamed:@"vip_1"];
  174. }
  175. return _vipLevel1;
  176. }
  177. -(UIImageView *)vipLevel2 {
  178. if (!_vipLevel2) {
  179. _vipLevel2 = [UIView baseImgV];
  180. _vipLevel2.image = [UIImage imageNamed:@"vip_2"];
  181. }
  182. return _vipLevel2;
  183. }
  184. - (UILabel *)vipDesLb {
  185. if (!_vipDesLb) {
  186. UILabel *lb = [UIView baseLb];
  187. lb.font = [UIFont fontWithName:Rob_Regular size:12];
  188. lb.text = @"Growth Value 7220/10000";
  189. lb.textAlignment = NSTextAlignmentLeft;
  190. _vipDesLb = lb;
  191. }
  192. return _vipDesLb;
  193. }
  194. -(UIView *)vipLineV1 {
  195. if (!_vipLineV1) {
  196. _vipLineV1 = [UIView baseV];
  197. _vipLineV1.backgroundColor = [UIColor blackColor];
  198. }
  199. return _vipLineV1;
  200. }
  201. -(UIView *)vipLineV2 {
  202. if (!_vipLineV2) {
  203. _vipLineV2 = [UIView baseV];
  204. _vipLineV2.backgroundColor = Col_FFF;
  205. }
  206. return _vipLineV2;
  207. }
  208. -(UIView *)vipPointV1 {
  209. if (!_vipPointV1) {
  210. _vipPointV1 = [UIView baseV];
  211. _vipPointV1.backgroundColor = UIColor.blackColor;
  212. _vipPointV1.layer.cornerRadius = 5;
  213. _vipPointV1.layer.masksToBounds = true;
  214. }
  215. return _vipPointV1;
  216. }
  217. -(UIView *)vipPointV2 {
  218. if (!_vipPointV2) {
  219. _vipPointV2 = [UIView baseV];
  220. _vipPointV2.backgroundColor = UIColor.blackColor;
  221. _vipPointV2.layer.cornerRadius = 5;
  222. _vipPointV2.layer.masksToBounds = true;
  223. }
  224. return _vipPointV2;
  225. }
  226. -(UIView *)vipContentV {
  227. if (!_vipContentV) {
  228. _vipContentV = [UIView baseV];
  229. _vipContentV.backgroundColor = UIColor.clearColor;
  230. }
  231. return _vipContentV;
  232. }
  233. -(UIImageView *)currentVipTipV {
  234. if (!_currentVipTipV) {
  235. _currentVipTipV = [UIView baseImgV];
  236. _currentVipTipV.image = [UIImage imageNamed:@"mine_current_position"];
  237. }
  238. return _currentVipTipV;
  239. }
  240. @end