YMGuidePageViewController.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // YMGuidePageViewController.m
  3. // MSYOUPAI
  4. //
  5. // Created by YoMi on 2024/2/10.
  6. // Copyright © 2024 MS. All rights reserved.
  7. //
  8. #import "YMGuidePageViewController.h"
  9. #import "YMGuidePageViewModel.h"
  10. @interface YMGuidePageViewController ()
  11. /// 引导页VM
  12. @property (nonatomic, strong) YMGuidePageViewModel *viewModel;
  13. /// 启动图
  14. @property (nonatomic, strong) UIImageView *launchscreenImage;
  15. @end
  16. @implementation YMGuidePageViewController
  17. @dynamic viewModel;
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. [self setNavHidden:YES];
  21. YMServicePolicyPopupView *customView = [[YMServicePolicyPopupView alloc]init];
  22. YMPopupView *popupView = [YMPopupView initWithCustomView:customView parentView:self.view popStyle:YMPopupStyleFade dismissStyle:YMDismissStyleFade];
  23. popupView.priority = 999;
  24. popupView.cornerRadius = adapt(10);
  25. popupView.rectCorners = UIRectCornerAllCorners;
  26. popupView.positionStyle = YMPositionStyleCenter;
  27. popupView.isHideBg = NO;
  28. popupView.bgAlpha = 0.3;
  29. [popupView pop];
  30. @weakify(popupView)
  31. customView.buttonBlock = ^(BOOL isConsentAuthorization) {
  32. @strongify(popupView)
  33. if (self.callBlock) {
  34. self.callBlock(isConsentAuthorization);
  35. }
  36. [popupView dismissWithStyle:YMDismissStyleFade duration:2.0];
  37. };
  38. customView.userProtocolBlock = ^{
  39. YMWebArticleViewModel *webArticleVM = [[YMWebArticleViewModel alloc]initWithParams:@{
  40. ParamsUrl:[NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,UserProtocolH5]
  41. }];
  42. [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_WEB_ARTICLE) withUserInfo:@{
  43. RouterViewModel:webArticleVM
  44. } completion:nil];
  45. };
  46. customView.privacyPolicyBlock = ^{
  47. YMWebArticleViewModel *webArticleVM = [[YMWebArticleViewModel alloc]initWithParams:@{
  48. ParamsUrl:[NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,UserPrivacyH5]
  49. }];
  50. [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_WEB_ARTICLE) withUserInfo:@{
  51. RouterViewModel:webArticleVM
  52. } completion:nil];
  53. };
  54. }
  55. - (void)viewWillAppear:(BOOL)animated{
  56. [super viewWillAppear:YES];
  57. }
  58. - (void)viewWillDisappear:(BOOL)animated{
  59. [super viewWillDisappear:YES];
  60. }
  61. - (void)ym_setupViews{
  62. [self.view addSubview:self.launchscreenImage];
  63. [self.view sendSubviewToBack:self.launchscreenImage];
  64. [self.view setNeedsUpdateConstraints];
  65. [self.view updateConstraintsIfNeeded];
  66. }
  67. - (void)updateViewConstraints{
  68. [self.launchscreenImage mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.top.equalTo(self.view);
  70. make.left.right.equalTo(self.view);
  71. make.bottom.equalTo(self.view);
  72. }];
  73. [super updateViewConstraints];
  74. }
  75. - (void)ym_bindViewModel{
  76. }
  77. - (UIImageView *)launchscreenImage{
  78. if (!_launchscreenImage) {
  79. _launchscreenImage = [[UIImageView alloc]init];
  80. _launchscreenImage.contentMode = UIViewContentModeScaleAspectFill;
  81. _launchscreenImage.image = ImageByName(@"vqu_images_ic_login_bg");
  82. _launchscreenImage.userInteractionEnabled = YES;
  83. }
  84. return _launchscreenImage;
  85. }
  86. @end