ASUserCenterTopView.m 8.3 KB

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