123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- //
- // LoginSignUpV.m
- // Asteria
- //
- // Created by 王猛 on 2023/5/17.
- //
- #import "LoginSignUpV.h"
- #import "PassWordSecureBtnV.h"
- #import "EamilTFmatchV.h"
- #import <BRPickerView/BRPickerView.h>
- #import "YJLAttributesLabel.h"
- @interface LoginSignUpV ()
- @property (nonatomic, strong) TT_CustonTF *xxx_firstName;
- @property (nonatomic, strong) TT_CustonTF *xxx_lasetName;
- @property (nonatomic, strong) EamilTFmatchV *xxx_regMmailV;
- @property (nonatomic, strong) PassWordSecureBtnV *xxx_regPassWord;
- @property (nonatomic, strong) UILabel *xxx_dateLab;
- @property (nonatomic, strong) UIButton *xxx_creatBtn;
- @property (nonatomic, strong) UIButton *xxx_subscribedBtn;
- @property (nonatomic, strong) QMUILabel *xxx_subscribedLab;
- @property (nonatomic, strong) YJLAttributesLabel *xxx_ClickLab;
- @property (nonatomic, strong) UIButton *xxx_selectBtn;
- @property (nonatomic, strong) NSDate *birthdaySelectDate;
- @property (nonatomic, strong) NSString *xxx_netDateStr;
- @end
- @implementation LoginSignUpV
- - (void)tt_setupViews{
- [self addSubview:self.xxx_firstName];
- [self addSubview:self.xxx_lasetName];
- [self addSubview:self.xxx_regMmailV];
- [self addSubview:self.xxx_regPassWord];
- [self addSubview:self.xxx_dateLab];
- [self addSubview:self.xxx_creatBtn];
- [self addSubview:self.xxx_subscribedBtn];
- [self addSubview:self.xxx_subscribedLab];
- [self addSubview:self.xxx_selectBtn];
- [self addSubview:self.xxx_ClickLab];
-
- [self bringSubviewToFront:self.xxx_regMmailV];
-
- self.birthdaySelectDate = [NSDate date];
- }
- #pragma mark - **************** action ****************
- -(void)action_dateOfBirth{
- UIViewController *topVC = topViewController();
- [topVC.view endEditing:YES];
- BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init];
- datePickerView.pickerMode = BRDatePickerModeDate;
- datePickerView.title = @"Please Select The Date Of Birth";
- datePickerView.selectDate = self.birthdaySelectDate;
- datePickerView.minDate = [NSDate br_setYear:1900 month:1 day:1];
- datePickerView.maxDate = [NSDate date];
- datePickerView.isAutoSelect = YES;
- datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) {
- self.birthdaySelectDate = selectDate;
- NSDateFormatter *formartter= [[NSDateFormatter alloc]init];
- [formartter setDateFormat:@"MM/dd/yyyy"];
- NSString *currentDateStr = [formartter stringFromDate:selectDate];
- self.xxx_dateLab.text = currentDateStr;
- self.xxx_dateLab.textColor = [UIColor qmui_colorWithHexString:@"#000000"];
-
- NSDateFormatter *netFormartter= [[NSDateFormatter alloc]init];
- [formartter setDateFormat:@"yyyy/MM/dd"];
- NSString *netDateStr = [formartter stringFromDate:selectDate];
- self.xxx_netDateStr = netDateStr;
- };
- [datePickerView show];
- }
- -(void)action_creatClick{
- if (self.xxx_selectBtn.selected == NO) {
- [self makeToast:@"Please select 'I Agree' to continue." duration:2 position:CSToastPositionCenter];
- return;
- }else if (self.xxx_firstName.text.length == 0) {
- [self makeToast:@"Please Input FirstName" duration:2 position:CSToastPositionCenter];
- return;
- }else if (self.xxx_lasetName.text.length == 0){
- [self makeToast:@"Please Input LastName" duration:2 position:CSToastPositionCenter];
- return;
- }else if(self.xxx_regMmailV.xxx_emailTF.text.length == 0 || ![Current_normalTool xxx_isValidateEmail:self.xxx_regMmailV.xxx_emailTF.text]){
- [self makeToast:@"Please prvide an email address." duration:2 position:CSToastPositionCenter];
- return;
- }else if(self.xxx_regPassWord.xxx_passwordTF.text.length<6){
- [self makeToast:@"Please set the correct password." duration:2 position:CSToastPositionCenter];
- return;
- }else if(!isValid(self.xxx_netDateStr)){
- [self makeToast:@"Please set Date Of Birth." duration:2 position:CSToastPositionCenter];
- return;
- }
-
- NSMutableDictionary *customer = [NSMutableDictionary dictionary];
- [customer setObject:self.xxx_firstName.text forKey:@"firstname"];
- [customer setObject:self.xxx_lasetName.text forKey:@"lastname"];
- [customer setObject:self.xxx_regMmailV.xxx_emailTF.text forKey:@"email"];
- [customer setObject:self.xxx_netDateStr forKey:@"dob"];
- NSMutableDictionary *tempDic = [NSMutableDictionary dictionary];
- [tempDic setObject:customer forKey:@"customer"];
- [tempDic setObject:self.xxx_regPassWord.xxx_passwordTF.text forKey:@"password"];
-
- BOOL isSubscribedSelect = self.xxx_subscribedBtn.selected;
- if(isSubscribedSelect){
- NSDictionary *extension_attributes = @{
- @"is_subscribed": @true
- };;
- [tempDic setObject:extension_attributes forKey:@"extension_attributes"];
- }
-
- [self generaltriggermethodType:1 data:tempDic];
- }
- -(void)action_xxx_subscribedBtnClick:(UIButton *)btn{
- btn.selected = !btn.selected;
- }
- -(void)action_selectClick:(UIButton *)btn{
- btn.selected = !btn.selected;
- }
- -(TT_CustonTF *)xxx_firstName{
- if (!_xxx_firstName) {
- _xxx_firstName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(20, 0, (KScreenWidth-60)/2, 50)
- PlaceHolder:@"* FIRST NAME"
- andLifImage:nil
- AndRightImage:nil
- LiftImageFrame:CGRectZero
- RightImageFrame:CGRectZero
- AndTag:0
- AndKeyboardType:UIKeyboardTypeDefault
- clearButtonMode:UITextFieldViewModeAlways
- AndReturnKeyType:UIReturnKeyDone
- masksToBounds:YES
- conrenRadius:4
- BorderColor:[UIColor colorWithHexString:@"#000000"]
- BorderWidth:1];
- _xxx_firstName.font = [UIFont fontWithName:Rob_Regular size:14];
- _xxx_firstName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
- }
- return _xxx_firstName;
- }
- -(TT_CustonTF *)xxx_lasetName{
- if (!_xxx_lasetName) {
- _xxx_lasetName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(CGRectGetMaxX(self.xxx_firstName.frame)+20, 0, (KScreenWidth-60)/2, 50)
- PlaceHolder:@"* LAST NAME"
- andLifImage:nil
- AndRightImage:nil
- LiftImageFrame:CGRectZero
- RightImageFrame:CGRectZero
- AndTag:0
- AndKeyboardType:UIKeyboardTypeDefault
- clearButtonMode:UITextFieldViewModeAlways
- AndReturnKeyType:UIReturnKeyDone
- masksToBounds:YES
- conrenRadius:4
- BorderColor:[UIColor colorWithHexString:@"#000000"]
- BorderWidth:1];
- _xxx_lasetName.font = [UIFont fontWithName:Rob_Regular size:14];
- _xxx_lasetName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
-
- }
- return _xxx_lasetName;
- }
- -(EamilTFmatchV *)xxx_regMmailV{
- if (!_xxx_regMmailV) {
- _xxx_regMmailV = [[EamilTFmatchV alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(self.xxx_firstName.frame)+30 , KScreenWidth, 50)];
- }
- return _xxx_regMmailV;
- }
- -(PassWordSecureBtnV *)xxx_regPassWord{
- if (!_xxx_regPassWord) {
- _xxx_regPassWord = [[PassWordSecureBtnV alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.xxx_regMmailV.frame)+30, KScreenWidth-40, 50+20)];
- }
- return _xxx_regPassWord;
- }
- -(UILabel *)xxx_dateLab{
- if (!_xxx_dateLab) {
- _xxx_dateLab = [TT_ControlTool uc_ControlToolUILabelFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_regPassWord.frame)+10, KScreenWidth-40, 50)
- AndTitle:@"DATE OF BIRTH"
- AndFontSize:14
- AndTitleColor:[UIColor colorWithHexString:@"#999999"]
- Numberoflines:1
- TextAlignment:NSTextAlignmentCenter
- adjustesFontSizesTowidth:NO
- masksToBounds:YES
- conrenrRadius:4
- userInteractionEnabled:YES
- tap_selector:@selector(action_dateOfBirth)
- object:self];
- _xxx_dateLab.layer.borderColor = [UIColor colorWithHexString:@"#000000"].CGColor;
- _xxx_dateLab.layer.borderWidth = 1;
- _xxx_dateLab.text = @"DATE OF BIRTH";
-
- }
- return _xxx_dateLab;
- }
- - (UIButton *)xxx_creatBtn {
- if (!_xxx_creatBtn) {
- _xxx_creatBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_dateLab.frame)+30 ,KScreenWidth-40,50)
- taeget:self
- sel:@selector(action_creatClick)
- tag:0
- AntTitle:@"CREATE ACCOUNT"
- titleFont:17
- titleColor:[UIColor whiteColor]
- andImage:nil
- AndBackColor:nil
- adjustsFontSizesTowidth:NO
- masksToBounds:YES
- conrenRadius:5
- BorderColor:nil
- BorderWidth:0
- ContentHorizontalAligment:0];
- _xxx_creatBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16];
- _xxx_creatBtn.backgroundColor = ThemeColor;
- }
- return _xxx_creatBtn;
- }
- -(UIButton *)xxx_subscribedBtn{
- if (!_xxx_subscribedBtn) {
- _xxx_subscribedBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_creatBtn.frame)+20, 40, 40)
- taeget:self
- sel:@selector(action_xxx_subscribedBtnClick:)
- tag:0
- AntTitle:nil
- titleFont:0
- titleColor:nil
- andImage:@"login_selectRido"
- AndBackColor:[UIColor clearColor]
- adjustsFontSizesTowidth:NO
- masksToBounds:NO
- conrenRadius:0
- BorderColor:nil
- BorderWidth:0
- ContentHorizontalAligment:0];
- [_xxx_subscribedBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected];
- _xxx_subscribedBtn.selected = YES;
- }
- return _xxx_subscribedBtn;
- }
- -(QMUILabel *)xxx_subscribedLab{
- if (!_xxx_subscribedLab) {
- _xxx_subscribedLab = [[QMUILabel alloc]init];
- _xxx_subscribedLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_creatBtn.frame)+20, KScreenWidth - 20-20-40, 40);
- NSString *string = @"I’d Like To Receive Emails Or Sms With Exclusive Discounts And News From Asteriahair";
- _xxx_subscribedLab.text = string;
- _xxx_subscribedLab.font = [UIFont fontWithName:Rob_Regular size:12];
- _xxx_subscribedLab.textColor = [UIColor colorWithHexString:@"#000000"];
- }
- return _xxx_subscribedLab;
- }
- -(UIButton *)xxx_selectBtn{
- if (!_xxx_selectBtn) {
- _xxx_selectBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, 40, 40)
- taeget:self
- sel:@selector(action_selectClick:)
- tag:1
- AntTitle:nil
- titleFont:0
- titleColor:nil
- andImage:@"login_selectRido"
- AndBackColor:[UIColor clearColor]
- adjustsFontSizesTowidth:NO
- masksToBounds:NO
- conrenRadius:0
- BorderColor:nil
- BorderWidth:0
- ContentHorizontalAligment:0];
- [_xxx_selectBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected];
- }
- return _xxx_selectBtn;
- }
- -(YJLAttributesLabel *)xxx_ClickLab{
- if (!_xxx_ClickLab) {
- _xxx_ClickLab = [[YJLAttributesLabel alloc]init];
- _xxx_ClickLab.numberOfLines = 0;
- _xxx_ClickLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, KScreenWidth - 20-20-40, 60);
- NSString *string = @"I Agree To Asteriahair Terms & Conditions And Privacy Policy.";
- NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:string];
- NSMutableArray *arr_text = [[NSMutableArray alloc]initWithObjects:@"Terms & Conditions",@"Privacy Policy." ,nil];
- attrStr = [self textArr:arr_text AttributedString:attrStr Connet:string];
- NSMutableArray * arr_range = [[NSMutableArray alloc]initWithObjects:@"23",@"46", nil];//点击的文字开始位置设置
- [_xxx_ClickLab setAttributesText:attrStr actionText:arr_text actionRange:arr_range];//d添加到UILabel上面
- _xxx_ClickLab.YJLAttributesBlock = ^(NSString * _Nonnull clicktext) {//点击事件的d返回
- if([clicktext isEqualToString:@"Terms & Conditions"]){
- NSString *temrUrl = [NSString stringWithFormat:@"https:%@%@",HostPath,@"/terms-conditions"];
- [Fuction_Tool push_BaseWebUrl:temrUrl webTitle:@"Terms & Conditions"];
- }else if ([clicktext isEqualToString:@"Privacy Policy."]){
- NSString *PrivacyUrl =[NSString stringWithFormat:@"https:%@%@",HostPath,@"/privacy_policy"];
- [Fuction_Tool push_BaseWebUrl:PrivacyUrl webTitle:@"Privacy Policy"];
- }
- };
- _xxx_ClickLab.font = [UIFont systemFontOfSize:12];
- }
- return _xxx_ClickLab;
- }
- #pragma mark 多个点击位置进行简单设置
- -(NSMutableAttributedString *)textArr:(NSMutableArray *)textarr AttributedString:(NSMutableAttributedString *)String Connet:(NSString *)connet{
-
- for (int i=0; i<textarr.count; i++) {
- NSRange range = [connet rangeOfString:textarr[i]];
- [String addAttribute:NSLinkAttributeName
- value:textarr[i]
- range: range];
- [String addAttribute:NSForegroundColorAttributeName
- value:ThemeColor
- range:range];
- [String addAttribute:NSUnderlineStyleAttributeName
- value:[NSNumber numberWithInteger:NSUnderlineStyleSingle]
- range:range];
- }
- return String;
- }
- @end
|