YMPersonalPageAboutView.m 21 KB

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