YMPersonalPageAboutView.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. //
  2. // YMPersonalPageAboutView.m
  3. // MSYOUPAI
  4. //
  5. // Created by microtech macmini on 2024/7/6.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMPersonalPageViewModel.h"
  9. #import "YMPersonalPageAboutView.h"
  10. @interface YMPersonalPageAboutView ()
  11. /// 个人主页VM
  12. @property (nonatomic, strong) YMPersonalPageViewModel *viewModel;
  13. /// 用户昵称标签
  14. @property (nonatomic, strong) UILabel *userNicknameLb;
  15. /// 用户在线状态视图
  16. @property (nonatomic, strong) UIImageView *userOnlineStatusView;
  17. /// 用户在线状态点
  18. @property (nonatomic, strong) UIView *userOnlineStatusPoint;
  19. /// 用户在线状态标签
  20. @property (nonatomic, strong) UILabel *userOnlineStatusLb;
  21. /// 状态堆叠视图
  22. @property (nonatomic, strong) UIStackView *nameStackView;
  23. /// 状态堆叠视图
  24. @property (nonatomic, strong) UIStackView *statusStackView;
  25. /// 用户简介标签
  26. @property (nonatomic, strong) UILabel *userIntroLb;
  27. /// 用户性别和年龄视图
  28. @property (nonatomic, strong) UIView *userGenderAndAgeView;
  29. /// 用户性别图标
  30. @property (nonatomic, strong) UIImageView *userGenderAndAgeIcon;
  31. /// 用户年龄标签
  32. @property (nonatomic, strong) UILabel *userGenderAndAgeLb;
  33. /// 用户真人认证图标
  34. @property (nonatomic, strong) UIButton *userRealPersonCertIcon;
  35. /// 用户VIP图标
  36. @property (nonatomic, strong) UIImageView *userVIPIcon;
  37. /// 用户视频收费
  38. @property (nonatomic, strong) UIView *userFeesView;
  39. /// 用户性别图标
  40. @property (nonatomic, strong) UIImageView *diamondImgV;
  41. /// 用户年龄标签
  42. @property (nonatomic, strong) UILabel *feesLb;
  43. /// 关注按钮
  44. @property (nonatomic, strong) UIButton *followButn;
  45. /// 心动或搭讪按钮
  46. @property (nonatomic, strong) UIButton *heartbeatOrAccostBtn;
  47. @end
  48. @implementation YMPersonalPageAboutView
  49. - (void)ym_setupViews{
  50. [self addSubview:self.nameStackView];
  51. [self.nameStackView addArrangedSubview:self.userNicknameLb];
  52. [self.nameStackView addArrangedSubview:self.userOnlineStatusView];
  53. [self addSubview:self.userIntroLb];
  54. [self addSubview:self.statusStackView];
  55. [self.statusStackView addArrangedSubview:self.userRealPersonCertIcon];
  56. [self.statusStackView addArrangedSubview:self.userGenderAndAgeView];
  57. [self.userGenderAndAgeView addSubview:self.userGenderAndAgeIcon];
  58. [self.userGenderAndAgeView addSubview:self.userGenderAndAgeLb];
  59. [self.statusStackView addArrangedSubview:self.userFeesView];
  60. [self.userFeesView addSubview:self.diamondImgV];
  61. [self.userFeesView addSubview:self.feesLb];
  62. [self.statusStackView addArrangedSubview:self.userVIPIcon];
  63. [self addSubview:self.followButn];
  64. [self addSubview:self.heartbeatOrAccostBtn];
  65. [self setNeedsUpdateConstraints];
  66. [self updateConstraintsIfNeeded];
  67. }
  68. - (void)updateConstraints {
  69. [self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.top.equalTo(self).offset(adapt(20));
  71. make.left.equalTo(self).offset(adapt(12));
  72. make.height.mas_equalTo(adapt(20));
  73. }];
  74. [self.userNicknameLb mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.height.mas_equalTo(adapt(20));
  76. }];
  77. [self.userOnlineStatusView mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.width.mas_equalTo(adapt(42));
  79. make.height.mas_equalTo(adapt(20));
  80. }];
  81. [self.userIntroLb mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.top.equalTo(self.nameStackView.mas_bottom).offset(adapt(10));
  83. make.left.equalTo(self).offset(adapt(12));
  84. make.right.equalTo(self).offset(adapt(-12));
  85. }];
  86. [self.statusStackView mas_makeConstraints:^(MASConstraintMaker *make) {
  87. make.top.equalTo(self.userIntroLb.mas_bottom).offset(adapt(10));
  88. make.left.equalTo(self.mas_left).offset(adapt(12));
  89. make.height.mas_equalTo(adapt(22));
  90. }];
  91. [self.userRealPersonCertIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.width.mas_equalTo(adapt(62));
  93. make.height.mas_equalTo(adapt(22));
  94. }];
  95. [self.userGenderAndAgeView mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.width.mas_equalTo(adapt(40));
  97. make.height.mas_equalTo(adapt(22));
  98. }];
  99. [self.userGenderAndAgeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.centerY.equalTo(self.userGenderAndAgeView.mas_centerY);
  101. make.left.equalTo(self.userGenderAndAgeView.mas_left).offset(adapt(4));
  102. make.height.mas_equalTo(adapt(9));
  103. }];
  104. [self.userGenderAndAgeLb mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.centerY.equalTo(self.userGenderAndAgeView.mas_centerY);
  106. make.left.equalTo(self.userGenderAndAgeIcon.mas_right).offset(adapt(1));
  107. make.right.equalTo(self.userGenderAndAgeView.mas_right).offset(adapt(-6));
  108. }];
  109. [self.userFeesView mas_makeConstraints:^(MASConstraintMaker *make) {
  110. make.height.mas_equalTo(adapt(22));
  111. }];
  112. [self.diamondImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  113. make.left.equalTo(self.userFeesView.mas_left).offset(adapt(4));
  114. make.centerY.equalTo(self.userFeesView);
  115. make.height.mas_equalTo(adapt(10));
  116. }];
  117. [self.feesLb mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.centerY.equalTo(self.userFeesView);
  119. make.left.equalTo(self.diamondImgV.mas_right).offset(adapt(3));
  120. make.right.equalTo(self.userFeesView).offset(adapt(-4));
  121. make.height.mas_equalTo(adapt(22));
  122. }];
  123. [self.userVIPIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  124. make.width.mas_equalTo(adapt(44));
  125. make.height.mas_equalTo(adapt(18));
  126. }];
  127. [self.followButn mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
  129. make.left.equalTo(self.mas_left).offset(adapt(12));
  130. make.width.mas_equalTo((kScreenWidth - (adapt(12) * 2) - 20) / 2);
  131. make.height.mas_equalTo(adapt(40));
  132. make.bottom.equalTo(self.mas_bottom).offset(adapt(-10));
  133. }];
  134. [self.heartbeatOrAccostBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  135. make.top.equalTo(self.followButn).offset(adapt(0));
  136. make.right.equalTo(self.mas_right).offset(adapt(-12));
  137. make.width.mas_equalTo((kScreenWidth - (adapt(12) * 2) - 20) / 2);
  138. make.height.mas_equalTo(adapt(40));
  139. }];
  140. [super updateConstraints];
  141. }
  142. - (void)ym_bindViewModel:(YMPersonalPageViewModel *)viewModel{
  143. if (!viewModel) { return; }
  144. _viewModel = viewModel;
  145. @weakify(self)
  146. RAC(self.userNicknameLb, text) = RACObserve(self.viewModel, userNickname);
  147. RAC(self.userNicknameLb, textColor) = RACObserve(self.viewModel, userNicknameColor);
  148. [[[[RACObserve(self.viewModel, userOnlineImgStr) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userOnlineImgStr) {
  149. @strongify(self)
  150. self.userOnlineStatusView.image = ImageByName(userOnlineImgStr);
  151. }];
  152. RAC(self.userGenderAndAgeIcon, image) = RACObserve(self.viewModel, userGenderAndAgeIcon);
  153. RAC(self.userGenderAndAgeLb, text) = RACObserve(self.viewModel, userGenderAndAgeText);
  154. [[[[RACObserve(self.viewModel, userGender) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userGender) {
  155. @strongify(self)
  156. if ([userGender isEqualToString:@"女"]) {
  157. self.userGenderAndAgeLb.textColor = HexColorFromRGB(0xFF2682);
  158. self.userGenderAndAgeView.backgroundColor = HexColorFromRGB(0xFCF2FD);
  159. } else {
  160. self.userGenderAndAgeLb.textColor = HexColorFromRGB(0x037BFF);
  161. self.userGenderAndAgeView.backgroundColor = HexColorFromRGB(0xE1EFFF);
  162. NSString *textStr = [NSString stringWithFormat:@"余额: %@钻石",@(self.viewModel.balance)];
  163. self.feesLb.text = textStr;
  164. self.feesLb.textColor = HexColorFromRGB(0x883FFB);
  165. self.userFeesView.hidden = false;
  166. }
  167. }];
  168. [[[[RACObserve(self.viewModel, isRealPersonCert) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isRealPersonCert) {
  169. @strongify(self)
  170. if ([isRealPersonCert boolValue]) {
  171. self.userRealPersonCertIcon.hidden = NO;
  172. } else {
  173. self.userRealPersonCertIcon.hidden = YES;
  174. }
  175. }];
  176. [[[[RACObserve(self.viewModel, isVIP) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isVIP) {
  177. @strongify(self)
  178. if ([isVIP boolValue]) {
  179. self.userVIPIcon.hidden = NO;
  180. } else {
  181. self.userVIPIcon.hidden = YES;
  182. }
  183. }];
  184. [[[[RACObserve(self.viewModel, userVideoFeesAmount) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString * userVideoFeesAmount) {
  185. @strongify(self)
  186. NSString *textStr = userVideoFeesAmount?:@"***/分钟";
  187. self.feesLb.text = textStr;
  188. }];
  189. [[[[RACObserve(self.viewModel, isHideUserFeesAmount) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isHideUserFeesAmount) {
  190. @strongify(self)
  191. if ([isHideUserFeesAmount boolValue]) {
  192. self.userFeesView.hidden = YES;
  193. } else {
  194. self.userFeesView.hidden = NO;
  195. }
  196. }];
  197. RAC(self.userIntroLb, text) = RACObserve(self.viewModel, userIntro);
  198. [[[[RACObserve(self.viewModel, isFollow) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber * isFollow) {
  199. @strongify(self)
  200. if (![isFollow boolValue]) {
  201. [self.followButn setTitle:@" 关注" forState:UIControlStateNormal];
  202. [self.followButn setImage:ImageByName(@"ym_personal_page_followable") forState:UIControlStateNormal];
  203. [self.followButn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0x000000, 1),HexColorFromRGBA(0x000000, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  204. }else{
  205. [self.followButn setTitle:@" 已关注" forState:UIControlStateNormal];
  206. [self.followButn setImage:ImageByName(@"ym_personal_page_followed") forState:UIControlStateNormal];
  207. [self.followButn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xF572EF, 1),HexColorFromRGBA(0x587BFC, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  208. }
  209. }];
  210. [[[[RACObserve(self.viewModel, isOtherPersonalPage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNumber *isOtherPersonalPage) {
  211. @strongify(self)
  212. if ([isOtherPersonalPage boolValue]) {
  213. self.followButn.hidden = NO;
  214. [self.heartbeatOrAccostBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  215. make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
  216. make.right.equalTo(self.mas_right).offset(adapt(-12));
  217. make.width.mas_equalTo((kScreenWidth - (adapt(12) * 2) - 20) / 2);
  218. make.height.mas_equalTo(adapt(40));
  219. }];
  220. } else {
  221. self.followButn.hidden = YES;
  222. [self.heartbeatOrAccostBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  223. make.top.equalTo(self.statusStackView.mas_bottom).offset(adapt(10));
  224. make.left.equalTo(self.mas_left).offset(adapt(12));
  225. make.right.equalTo(self.mas_right).offset(adapt(-12));
  226. make.height.mas_equalTo(adapt(40));
  227. }];
  228. }
  229. }];
  230. [[[[RACObserve(self.viewModel, heartbeatOrAccostButtonTitle) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString *heartbeatOrAccostButtonTitle) {
  231. @strongify(self)
  232. [self.heartbeatOrAccostBtn setTitle:heartbeatOrAccostButtonTitle forState:UIControlStateNormal];
  233. if([heartbeatOrAccostButtonTitle containsString:@"私聊"]){
  234. [self.heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFB95FF, 1),HexColorFromRGBA(0xFF5F71, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  235. [self.heartbeatOrAccostBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
  236. }else{
  237. [self.heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFB95FF, 1),HexColorFromRGBA(0xFF5F71, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  238. [self.heartbeatOrAccostBtn setTitleColor:MAINGRIDTitleC forState:UIControlStateNormal];
  239. }
  240. }];
  241. [[[[RACObserve(self.viewModel, heartbeatOrAccostButtonImage) distinctUntilChanged] deliverOnMainThread] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSString *heartbeatOrAccostButtonImage) {
  242. @strongify(self)
  243. [self.heartbeatOrAccostBtn setImage:ImageByName(heartbeatOrAccostButtonImage) forState:UIControlStateNormal];
  244. }];
  245. }
  246. - (UILabel *)userNicknameLb{
  247. if (!_userNicknameLb) {
  248. _userNicknameLb = [[UILabel alloc]init];
  249. _userNicknameLb.font = LCBoldFont(18);
  250. _userNicknameLb.textColor = HexColorFromRGB(0xFFFFFF);
  251. _userNicknameLb.textAlignment = NSTextAlignmentLeft;
  252. _userNicknameLb.text = @"******";
  253. }
  254. return _userNicknameLb;
  255. }
  256. - (UIImageView *)userOnlineStatusView{
  257. if (!_userOnlineStatusView) {
  258. _userOnlineStatusView = [[UIImageView alloc] init];
  259. // _userOnlineStatusView.layer.borderWidth = 1;
  260. // _userOnlineStatusView.layer.borderColor = HexColorFromRGB(0xD8BFD8).CGColor;
  261. // _userOnlineStatusView.layer.cornerRadius = adapt(20)/2;
  262. // _userOnlineStatusView.layer.masksToBounds = YES;
  263. }
  264. return _userOnlineStatusView;
  265. }
  266. - (UIStackView *)nameStackView{
  267. if (!_nameStackView) {
  268. _nameStackView = [[UIStackView alloc]init];
  269. _nameStackView.axis = UILayoutConstraintAxisHorizontal;
  270. _nameStackView.alignment = UIStackViewAlignmentCenter;
  271. _nameStackView.spacing = adapt(6);
  272. }
  273. return _nameStackView;
  274. }
  275. - (UIStackView *)statusStackView{
  276. if (!_statusStackView) {
  277. _statusStackView = [[UIStackView alloc]init];
  278. _statusStackView.axis = UILayoutConstraintAxisHorizontal;
  279. _statusStackView.alignment = UIStackViewAlignmentCenter;
  280. _statusStackView.spacing = adapt(6);
  281. }
  282. return _statusStackView;
  283. }
  284. - (UILabel *)userIntroLb{
  285. if (!_userIntroLb) {
  286. _userIntroLb = [[UILabel alloc]init];
  287. _userIntroLb.font = LCFont(15);
  288. _userIntroLb.textColor = HexColorFromRGBA(0x000000,0.55);
  289. _userIntroLb.textAlignment = NSTextAlignmentLeft;
  290. _userIntroLb.text = @"这个人很懒,什么都没有留下...";
  291. }
  292. return _userIntroLb;
  293. }
  294. - (UIView *)userGenderAndAgeView{
  295. if (!_userGenderAndAgeView) {
  296. _userGenderAndAgeView = [[UIView alloc]init];
  297. _userGenderAndAgeView.layer.cornerRadius = adapt(10);
  298. _userGenderAndAgeView.backgroundColor = HexColorFromRGB(0xE9F8FB);
  299. _userGenderAndAgeView.layer.cornerRadius = adapt(22)/2;
  300. _userGenderAndAgeView.layer.masksToBounds = YES;
  301. }
  302. return _userGenderAndAgeView;
  303. }
  304. - (UIImageView *)userGenderAndAgeIcon{
  305. if (!_userGenderAndAgeIcon) {
  306. _userGenderAndAgeIcon = [[UIImageView alloc] init];
  307. _userGenderAndAgeIcon.image = ImageByName(@"ym_personal_page_female_icon");
  308. _userGenderAndAgeIcon.contentMode = UIViewContentModeScaleAspectFit;
  309. }
  310. return _userGenderAndAgeIcon;
  311. }
  312. - (UILabel *)userGenderAndAgeLb{
  313. if (!_userGenderAndAgeLb) {
  314. _userGenderAndAgeLb = [[UILabel alloc]init];
  315. _userGenderAndAgeLb.font = LCFont(11);
  316. _userGenderAndAgeLb.textColor = HexColorFromRGB(0xFF2682);
  317. _userGenderAndAgeLb.text = @"***";
  318. _userGenderAndAgeLb.textAlignment = NSTextAlignmentLeft;
  319. }
  320. return _userGenderAndAgeLb;
  321. }
  322. - (UIButton *)userRealPersonCertIcon{
  323. if (!_userRealPersonCertIcon) {
  324. _userRealPersonCertIcon = [UIButton buttonWithType:(UIButtonTypeCustom)];
  325. _userRealPersonCertIcon.userInteractionEnabled = NO;
  326. [_userRealPersonCertIcon setImage:ImageByName(@"ym_personal_page_real_person_cert_icon") forState:(UIControlStateNormal)];
  327. [_userRealPersonCertIcon setTitle:@" 已认证" forState:(UIControlStateNormal)];
  328. [_userRealPersonCertIcon setTitleColor:HexColorFromRGB(0x16CED0) forState:(UIControlStateNormal)];
  329. _userRealPersonCertIcon.titleLabel.font = LCFont(10);
  330. _userRealPersonCertIcon.backgroundColor = HexColorFromRGB(0xE9F8FB);
  331. _userRealPersonCertIcon.layer.cornerRadius = adapt(22)/2;
  332. _userRealPersonCertIcon.layer.masksToBounds = YES;
  333. }
  334. return _userRealPersonCertIcon;
  335. }
  336. - (UIImageView *)userVIPIcon{
  337. if (!_userVIPIcon) {
  338. _userVIPIcon = [[UIImageView alloc]init];
  339. _userVIPIcon.image = ImageByName(@"ym_mine_vip_icon");
  340. _userVIPIcon.contentMode = UIViewContentModeScaleAspectFit;
  341. }
  342. return _userVIPIcon;
  343. }
  344. - (UIView *)userFeesView{
  345. if (!_userFeesView) {
  346. _userFeesView = [[UIView alloc]init];
  347. _userFeesView.layer.cornerRadius = adapt(4);
  348. _userFeesView.layer.masksToBounds = YES;
  349. _userFeesView.backgroundColor = HexColorFromRGB(0xF3E1FF);
  350. }
  351. return _userFeesView;
  352. }
  353. - (UIImageView *)diamondImgV{
  354. if (!_diamondImgV) {
  355. _diamondImgV = [[UIImageView alloc]init];
  356. _diamondImgV.image = ImageByName(@"ym_personal_page_zs");
  357. _diamondImgV.contentMode = UIViewContentModeScaleAspectFit;
  358. }
  359. return _diamondImgV;
  360. }
  361. - (UILabel *)feesLb{
  362. if (!_feesLb) {
  363. _feesLb = [[UILabel alloc]init];
  364. _feesLb.font = LCBoldFont(9);
  365. _feesLb.textColor = HexColorFromRGB(0xFF3DD7);
  366. _feesLb.text = @"***";
  367. }
  368. return _feesLb;
  369. }
  370. - (UIButton *)followButn {
  371. if (!_followButn) {
  372. _followButn = [UIButton buttonWithType:(UIButtonTypeCustom)];
  373. [_followButn setTitle:@" 关注" forState:(UIControlStateNormal)];
  374. [_followButn setImage:ImageByName(@"ym_personal_page_followable") forState:UIControlStateNormal];
  375. [_followButn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:(UIControlStateNormal)];
  376. [_followButn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0x000000, 1),HexColorFromRGBA(0x000000, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  377. _followButn.titleLabel.font = LCFont(13);
  378. _followButn.backgroundColor = UIColor.clearColor;
  379. _followButn.layer.cornerRadius = adapt(20)/2;
  380. _followButn.layer.masksToBounds = YES;
  381. _followButn.layer.borderColor = HexColorFromRGB(0x8B45FB).CGColor;
  382. _followButn.layer.borderWidth = 0.5;
  383. WS(weakSelf)
  384. [[[_followButn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
  385. [weakSelf.viewModel followUser];
  386. }];
  387. }
  388. return _followButn;
  389. }
  390. - (UIButton *)heartbeatOrAccostBtn{
  391. if (!_heartbeatOrAccostBtn) {
  392. _heartbeatOrAccostBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  393. [_heartbeatOrAccostBtn setTitle:@" 心动" forState:(UIControlStateNormal)];
  394. [_heartbeatOrAccostBtn setImage:ImageByName(@"ym_personal_page_msg") forState:UIControlStateNormal];
  395. [_heartbeatOrAccostBtn setTitleColor:HexColorFromRGB(0xFFFFFF) forState:(UIControlStateNormal)];
  396. [_heartbeatOrAccostBtn ym_setGradientBackgroundWithColors:@[HexColorFromRGBA(0xFF6E79, 1),HexColorFromRGBA(0xFF6E79, 1)] locations:kMainGradLocation startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
  397. _heartbeatOrAccostBtn.titleLabel.font = LCFont(16);
  398. _heartbeatOrAccostBtn.layer.cornerRadius = adapt(20)/2;
  399. _heartbeatOrAccostBtn.layer.masksToBounds = YES;
  400. _heartbeatOrAccostBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
  401. [_heartbeatOrAccostBtn setSemanticContentAttribute:UISemanticContentAttributeForceLeftToRight];
  402. CGFloat margin = 5;
  403. _heartbeatOrAccostBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -margin, 0, margin);
  404. WS(weakSelf)
  405. [[[_heartbeatOrAccostBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id x) {
  406. if (weakSelf.viewModel.isOtherPersonalPage) {
  407. [weakSelf.viewModel sendAccostRequest];
  408. } else {
  409. [ZCHUDHelper showTitle:@"无法和自己互动"];
  410. }
  411. }];
  412. }
  413. return _heartbeatOrAccostBtn;
  414. }
  415. @end