| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 | 
							- //
 
- //  ASBirthdayTreatViewController.m
 
- //  Asteria
 
- //
 
- //  Created by iOS on 2023/7/1.
 
- //
 
- #import "ASBirthdayTreatViewController.h"
 
- @interface ASBirthdayTreatViewController ()
 
- @property (nonatomic, strong) UIScrollView *scrollV;
 
- @property (nonatomic, strong) UIView *bgV;
 
- @property (nonatomic, strong) UIImageView *bgImgV;
 
- @property (nonatomic, strong) UIImageView *topImgV;
 
- @property (nonatomic, strong) UIImageView *titleImgV;
 
- @property (nonatomic, strong) UILabel * contentLB;
 
- @property (nonatomic, strong) UILabel * codeDesLB;
 
- @property (nonatomic, strong) UIView *btnV;
 
- @property (nonatomic, strong) UIButton *startBt;
 
- @property (nonatomic, strong) UIView *dateV;
 
- @property (nonatomic, strong) UILabel *monthLb;
 
- @property (nonatomic, strong) UILabel *dayLb;
 
- @property (nonatomic, strong) UIImageView *dayBgV;
 
- @property (nonatomic, strong) UILabel *yearLb;
 
- @end
 
- @implementation ASBirthdayTreatViewController
 
- - (void)viewDidLoad {
 
-     [super viewDidLoad];
 
-     // Do any additional setup after loading the view.
 
-     self.titleStr = @"Birthday Treat";
 
-     [self setNavRightSearch:^{
 
-         
 
-     }];
 
-     
 
-     [self loadSubviews];
 
-     [self configSubVs];
 
-     
 
-     
 
- }
 
- - (void)viewWillAppear:(BOOL)animated {
 
-     [super viewWillAppear:animated];
 
-     
 
- //    KWLoginedUserModel *info = [KWLoginedManager.shareInstance getCurrentLoginedUser];
 
- //    if (info.isBirthday) {
 
- //        @weakify(self);
 
- //        [self.vm getVIPCouponData:^(BOOL flag) {
 
- //            if (flag) {
 
-                 self.codeDesLB.text = [NSString stringWithFormat: @"USE CODE: %@\nGET DISCOUNT & GIFTPACK", ASUserInfoManager.shared.code];
 
-                 NSString *birthStr = [NSString stringWithFormat: @"Our Gift To You?\n$%@ To Spend On Your\nFavorite Hair.", ASUserInfoManager.shared.amount];
 
-                 self.contentLB.text = birthStr;
 
- //            }
 
- //
 
- //
 
- //        }];
 
- //    }
 
-     
 
- }
 
- - (void)configSubVs {
 
-     
 
-     self.statusBgV.backgroundColor = _E0FFF5;
 
-     self.customNavBar.backgroundColor = _F0FFFA;
 
-     
 
-     self.titleImgV.image = [UIImage imageNamed:self.isBirthday ? @"birth_titleImg_2" : @"birth_titleImg_1"];
 
-     self.codeDesLB.hidden = !self.isBirthday;
 
-     self.btnV.hidden = !self.isBirthday;
 
-         
 
-     
 
-     NSString *time = ASUserInfoManager.shared.birthDay;
 
-     NSDate *date = [NSDate dateWithString:time format:@"MM dd, yyyy"];
 
-     
 
-     self.dayLb.text = [NSString stringWithFormat:@"%ld" ,date.day];
 
-     
 
-     NSString *monStr = @"JANUARY";
 
-     NSInteger mon = date.month;
 
-     switch (mon) {
 
-         case 1:
 
-             monStr = @"JANUARY";
 
-             break;
 
-         case 2:
 
-             monStr = @"FEBRUARY";
 
-             break;
 
-         case 3:
 
-             monStr = @"MARCH";
 
-             break;
 
-         case 4:
 
-             monStr = @"APRIL";
 
-             break;
 
-         case 5:
 
-             monStr = @"MAY";
 
-             break;
 
-         case 6:
 
-             monStr = @"JUNE";
 
-             break;
 
-         case 7:
 
-             monStr = @"JULY";
 
-             break;
 
-         case 8:
 
-             monStr = @"AUGUST";
 
-             break;
 
-         case 9:
 
-             monStr = @"SEPTEMBER";
 
-             break;
 
-         case 10:
 
-             monStr = @"OCTOBER";
 
-             break;
 
-         case 11:
 
-             monStr = @"NOVEMBER";
 
-             break;
 
-         default:
 
-             monStr = @"DECEMBER";
 
-             break;
 
-     }
 
-     self.monthLb.text = monStr;
 
-     self.yearLb.text = [NSString stringWithFormat:@"%ld" ,date.year];// @"2000";
 
-     
 
-     NSString *birthStr = @"Our Gift To You?\n$30 To Spend On Your\nFavorite Hair.";
 
-     NSString *defualtStr = [NSString stringWithFormat: @"hello,%@ %@\nThanks for giving us the opportunity to celebratingyour birthday with you in the future.You’re going to receive our special birthday treat.\nLook forward to your special day to come.", @"USER", @"NAME"];//info.lastname, info.firstname];
 
-     self.contentLB.text = self.isBirthday ? birthStr : defualtStr;
 
-     
 
-     
 
- }
 
- - (void)loadSubviews {
 
-     
 
-     [self.view addSubview:self.scrollV];
 
-     [self.scrollV addSubview:self.bgV];
 
-     
 
-     [self.scrollV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.top.equalTo(self.customNavBar.mas_bottom);
 
-         make.right.left.bottom.equalTo(self.view);
 
-     }];
 
-     [self.bgV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.edges.equalTo(self.scrollV);
 
-         make.width.equalTo(self.view);
 
-         make.height.greaterThanOrEqualTo([NSNumber numberWithFloat:SCREEN_HEIGHT - (NavigationBarHeight+StatusHeight)]);
 
-     }];
 
-     
 
-     
 
-     [self.bgV addSubview:self.bgImgV];
 
-     [self.bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.edges.equalTo(self.bgV);
 
-     }];
 
-     
 
-     
 
-     UIStackView *stackV = [[UIStackView alloc] init];
 
-     stackV.axis = UILayoutConstraintAxisVertical;
 
-     stackV.distribution = UIStackViewDistributionFill;
 
-     stackV.alignment = UIStackViewAlignmentFill;
 
-     stackV.spacing = 20;
 
-     
 
-     
 
-     [self.bgV addSubview:stackV];
 
-     [stackV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.centerX.equalTo(self.bgV);
 
-         make.width.equalTo([NSNumber numberWithFloat:SCREEN_WIDTH - 120]);
 
-         make.top.equalTo(self.bgV.mas_top).offset(38);
 
-         make.bottom.equalTo(self.bgV.mas_bottom).offset(-150);
 
-     }];
 
-     
 
-     
 
-     UIStackView *topSt = [[UIStackView alloc] init];
 
-     topSt.axis = UILayoutConstraintAxisVertical;
 
-     topSt.distribution = UIStackViewDistributionFill;
 
-     topSt.alignment = UIStackViewAlignmentFill;
 
-     topSt.spacing = 8;
 
-     
 
-     [topSt addArrangedSubview:self.topImgV];
 
-     [self.topImgV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@102);
 
-     }];
 
-     
 
-     [topSt addArrangedSubview:self.titleImgV];
 
-     [self.titleImgV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@68);
 
-     }];
 
-     [stackV addArrangedSubview:topSt];
 
-     
 
-     [stackV addArrangedSubview:self.contentLB];
 
- //    [stackV addArrangedSubview:self.lineV];
 
- //    [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
 
- //        make.height.equalTo(@50);
 
- //    }];
 
-     
 
-     [stackV addArrangedSubview:self.btnV];
 
-     
 
-     [self.btnV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@45);
 
-     }];
 
-     
 
-     [self.btnV addSubview:self.startBt];
 
-     
 
-     [self.startBt mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@45);
 
-         make.width.equalTo([NSNumber numberWithFloat:SCREEN_WIDTH-150]);
 
-         make.center.equalTo(self.btnV);
 
-     }];
 
-     
 
-     [stackV addArrangedSubview:self.codeDesLB];
 
-     [self.codeDesLB mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@48);
 
-     }];
 
-     
 
-     
 
-     
 
-     
 
-     [stackV addArrangedSubview:self.dateV];
 
-     [self.dateV addSubview:self.monthLb];
 
-     [self.dateV addSubview:self.dayBgV];
 
-     [self.dateV addSubview:self.dayLb];
 
-     [self.dateV addSubview:self.yearLb];
 
-     
 
-     [self.monthLb mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@17);
 
-         make.centerX.equalTo(self.dateV);
 
-         make.top.equalTo(self.dateV).offset(10);
 
-     }];
 
-     [self.dayBgV mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@45);
 
-         make.width.equalTo(@36.5);
 
-         make.centerX.equalTo(self.dateV);
 
-         make.top.equalTo(self.monthLb.mas_bottom).offset(5);
 
-     }];
 
-     [self.dayLb mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.center.equalTo(self.dayBgV);
 
-         make.height.equalTo(self.dayBgV);
 
-         make.width.equalTo(self.dayBgV);
 
-     }];
 
-     [self.yearLb mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.height.equalTo(@17);
 
-         make.centerX.equalTo(self.dateV);
 
-         make.top.equalTo(self.dayBgV.mas_bottom).offset(5);
 
-         make.bottom.equalTo(self.dateV).offset(-10);
 
-     }];
 
-     
 
-     
 
-     dispatch_async(dispatch_get_main_queue(), ^{
 
-         [self viewAddLineColorBg:self.bgV colorArr:@[
 
-             (id)_E0FFF5.CGColor,
 
-             (id)Col_FFF.CGColor
 
-         ]];
 
-     });
 
- }
 
- - (UIScrollView *)scrollV {
 
-     if (!_scrollV) {
 
-         UIScrollView *v = [UIScrollView new];
 
-         v.showsVerticalScrollIndicator = false;
 
-         v.showsHorizontalScrollIndicator = false;
 
-         v.backgroundColor = Col_FFF;
 
-         _scrollV = v;
 
-     }
 
-     return _scrollV;
 
- }
 
- - (UIView *)bgV {
 
-     if (!_bgV) {
 
-         UIView *v = [UIView new];
 
-         _bgV = v;
 
-     }
 
-     return _bgV;
 
- }
 
- - (UIImageView *)bgImgV {
 
-     if (!_bgImgV) {
 
-         UIImageView *v = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"birth_bg"]];
 
-         v.contentMode = UIViewContentModeScaleToFill;
 
-         _bgImgV = v;
 
-     }
 
-     return  _bgImgV;
 
- }
 
- - (UIImageView *)topImgV {
 
-     if (!_topImgV) {
 
-         UIImageView *v = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"birth_topImg"]];
 
-         v.contentMode = UIViewContentModeScaleAspectFit;
 
-         _topImgV = v;
 
-     }
 
-     return  _topImgV;
 
- }
 
- - (UIImageView *)titleImgV {
 
-     if (!_titleImgV) {
 
-         UIImageView *v = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"birth_titleImg_1"]];
 
-         v.contentMode = UIViewContentModeScaleAspectFit;
 
-         _titleImgV = v;
 
-     }
 
-     return  _titleImgV;
 
- }
 
- - (UILabel *)contentLB {
 
-     if (!_contentLB) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.numberOfLines = 0;
 
-         lb.textAlignment = NSTextAlignmentCenter;
 
-         lb.textColor = UIColor.blackColor;
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:14];
 
-         lb.qmui_lineHeight = 24;
 
-         _contentLB = lb;
 
-     }
 
-     return  _contentLB;
 
- }
 
- - (UILabel *)codeDesLB {
 
-     if (!_codeDesLB) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.numberOfLines = 0;
 
-         lb.textColor = _043632;
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:12];
 
-         lb.qmui_lineHeight = 24;
 
-         lb.textAlignment = NSTextAlignmentCenter;
 
-         lb.lineBreakMode = NSLineBreakByWordWrapping;
 
-         lb.text = @"USE CODE: BIRTHDAY\nGET DISCOUNT & GIFTPACK";
 
-         _codeDesLB = lb;
 
-     }
 
-     return  _codeDesLB;
 
- }
 
- - (UIView *)btnV {
 
-     if (!_btnV) {
 
-         UIView *v = [UIView new];
 
-         v.backgroundColor = UIColor.clearColor;
 
-         _btnV = v;
 
-     }
 
-     return _btnV;
 
- }
 
- - (UIButton *)startBt {
 
-     if (!_startBt) {
 
-         UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
 
-         bt.backgroundColor = [UIColor blackColor];
 
-         bt.layer.cornerRadius = 4;
 
-         bt.layer.masksToBounds = true;
 
-         [bt setTitle:@"GET THE PARTY STARTED" forState:UIControlStateNormal];
 
-         [bt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
 
-         bt.titleLabel.font = [UIFont fontWithName:Rob_Regular size:16];
 
-         [bt addTarget:self action:@selector(btnAction) forControlEvents:UIControlEventTouchUpInside];
 
-         _startBt = bt;
 
-     }
 
-     return _startBt;
 
- }
 
- - (void)btnAction {
 
-     if (![ASUserInfoManager.shared.typeId isEqualToString:@""]) {
 
-         NSDictionary *para = @{
 
-             @"type":ASUserInfoManager.shared.typeId,  //String
 
-             @"title":@"HD Lace",//String
 
-             @"searchKey":@"",//String
 
-         };
 
-         UIViewController *vc = [CTMediator.sharedInstance getProductListVc:para];
 
-         
 
-         [self.navigationController pushViewController:vc animated:true];
 
-     } else {
 
-         [self.view makeToast:@"Get Birth Products Type Error"];
 
-     }
 
- }
 
- - (UIView *)dateV {
 
-     if (!_dateV) {
 
-         UIView *v = [UIView new];
 
-         v.backgroundColor = UIColor.clearColor;
 
-         _dateV = v;
 
-     }
 
-     return _dateV;
 
- }
 
- - (UILabel *)monthLb {
 
-     if (!_monthLb) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.numberOfLines = 0;
 
-         lb.textColor = UIColor.blackColor;
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:14];
 
-         lb.qmui_lineHeight = 20;
 
-         _monthLb = lb;
 
-     }
 
-     return  _monthLb;
 
- }
 
- - (UILabel *)dayLb {
 
-     if (!_dayLb) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.numberOfLines = 0;
 
-         lb.textColor = UIColor.blackColor;
 
-         lb.font = [UIFont fontWithName:Rob_Bold size:20];
 
-         lb.qmui_lineHeight = 20;
 
-         lb.textAlignment = NSTextAlignmentCenter;
 
-         _dayLb = lb;
 
-     }
 
-     return  _dayLb;
 
- }
 
- - (UILabel *)yearLb {
 
-     if (!_yearLb) {
 
-         UILabel *lb = [[UILabel alloc] init];
 
-         lb.numberOfLines = 0;
 
-         lb.textColor = UIColor.blackColor;
 
-         lb.font = [UIFont fontWithName:Rob_Regular size:14];
 
-         lb.qmui_lineHeight = 20;
 
-         _yearLb = lb;
 
-     }
 
-     return  _yearLb;
 
- }
 
- - (UIImageView *)dayBgV {
 
-     if (!_dayBgV) {
 
-         UIImageView *v = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"birth_dayTime_bg"]];
 
-         v.contentMode = UIViewContentModeScaleAspectFit;
 
-         _dayBgV = v;
 
-     }
 
-     return _dayBgV;
 
- }
 
- - (void)viewAddLineColorBg:(UIView *)bgV colorArr:(NSArray *)colors {
 
-     CAGradientLayer *layer = [[CAGradientLayer alloc] init];
 
-     layer.frame = bgV.bounds;
 
-     layer.colors = colors;
 
-     layer.startPoint = CGPointMake(0.44, 0.2);
 
-     layer.endPoint = CGPointMake(0.5, 1);
 
-     layer.locations = @[@0,@1.0f];
 
-     layer.name = @"colorLayer";
 
-     [bgV.layer insertSublayer:layer atIndex:0];
 
- }
 
- @end
 
 
  |