LoginSignUpV.m 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. //
  2. // LoginSignUpV.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2023/5/17.
  6. //
  7. #import "LoginSignUpV.h"
  8. #import "PassWordSecureBtnV.h"
  9. #import "EamilTFmatchV.h"
  10. #import <BRPickerView/BRPickerView.h>
  11. @interface LoginSignUpV ()
  12. @property (nonatomic, strong) TT_CustonTF *xxx_firstName;
  13. @property (nonatomic, strong) TT_CustonTF *xxx_lasetName;
  14. @property (nonatomic, strong) EamilTFmatchV *xxx_regMmailV;
  15. @property (nonatomic, strong) PassWordSecureBtnV *xxx_regPassWord;
  16. @property (nonatomic, strong) UILabel *xxx_dateLab;
  17. @property (nonatomic, strong) UIButton *xxx_creatBtn;
  18. @property (nonatomic, strong) UIButton *xxx_subscribedBtn;
  19. @property (nonatomic, strong) QMUILabel *xxx_subscribedLab;
  20. @property (nonatomic, strong) YYLabel *xxx_ClickLab;
  21. @property (nonatomic, strong) UIButton *xxx_selectBtn;
  22. @property (nonatomic, strong) NSDate *birthdaySelectDate;
  23. @end
  24. @implementation LoginSignUpV
  25. - (void)tt_setupViews{
  26. [self addSubview:self.xxx_firstName];
  27. [self addSubview:self.xxx_lasetName];
  28. [self addSubview:self.xxx_regMmailV];
  29. [self addSubview:self.xxx_regPassWord];
  30. [self addSubview:self.xxx_dateLab];
  31. [self addSubview:self.xxx_creatBtn];
  32. [self addSubview:self.xxx_subscribedBtn];
  33. [self addSubview:self.xxx_subscribedLab];
  34. [self addSubview:self.xxx_selectBtn];
  35. [self addSubview:self.xxx_ClickLab];
  36. [self bringSubviewToFront:self.xxx_regMmailV];
  37. self.birthdaySelectDate = [NSDate date];
  38. }
  39. #pragma mark - **************** action ****************
  40. -(void)action_dateOfBirth{
  41. UIViewController *topVC = topViewController();
  42. [topVC.view endEditing:YES];
  43. BRDatePickerView *datePickerView = [[BRDatePickerView alloc]init];
  44. datePickerView.pickerMode = BRDatePickerModeDate;
  45. datePickerView.title = @"Please Select The Date Of Birth";
  46. datePickerView.selectDate = self.birthdaySelectDate;
  47. datePickerView.minDate = [NSDate br_setYear:1900 month:1 day:1];
  48. datePickerView.maxDate = [NSDate date];
  49. datePickerView.isAutoSelect = YES;
  50. datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) {
  51. self.birthdaySelectDate = selectDate;
  52. NSDateFormatter *formartter= [[NSDateFormatter alloc]init];
  53. [formartter setDateFormat:@"MM/dd/yyyy"];
  54. NSString *currentDateStr = [formartter stringFromDate:selectDate];
  55. self.xxx_dateLab.text = currentDateStr;
  56. self.xxx_dateLab.textColor = [UIColor qmui_colorWithHexString:@"#000000"];
  57. NSLog(@"selectValue=%@", selectValue);
  58. NSLog(@"selectDate=%@", selectDate);
  59. NSLog(@"---------------------------------");
  60. };
  61. [datePickerView show];
  62. }
  63. -(void)action_creatClick{
  64. if (self.xxx_selectBtn.selected == NO) {
  65. [self makeToast:@"Please select 'I Agree' to continue." duration:2 position:CSToastPositionCenter];
  66. return;
  67. }else if (self.xxx_firstName.text.length == 0) {
  68. [self makeToast:@"Please Input FirstName" duration:2 position:CSToastPositionCenter];
  69. return;
  70. }else if (self.xxx_lasetName.text.length == 0){
  71. [self makeToast:@"Please Input LastName" duration:2 position:CSToastPositionCenter];
  72. return;
  73. }else if(self.xxx_regMmailV.xxx_emailTF.text.length == 0 || ![Current_normalTool xxx_isValidateEmail:self.xxx_regMmailV.xxx_emailTF.text]){
  74. [self makeToast:@"Please prvide an email address." duration:2 position:CSToastPositionCenter];
  75. return;
  76. }else if(self.xxx_regPassWord.xxx_passwordTF.text.length<6){
  77. [self makeToast:@"Please set the correct password." duration:2 position:CSToastPositionCenter];
  78. return;
  79. }
  80. NSMutableDictionary *customer = [NSMutableDictionary dictionary];
  81. [customer setObject:self.xxx_firstName.text forKey:@"firstname"];
  82. [customer setObject:self.xxx_lasetName.text forKey:@"lastname"];
  83. [customer setObject:self.xxx_regMmailV.xxx_emailTF.text forKey:@"email"];
  84. NSMutableDictionary *tempDic = [NSMutableDictionary dictionary];
  85. [tempDic setObject:customer forKey:@"customer"];
  86. [tempDic setObject:self.xxx_regPassWord.xxx_passwordTF.text forKey:@"password"];
  87. // BOOL isSubscribedSelect = self.xxx_subscribedBtn.selected;
  88. // [tempDic setObject:[NSString stringWithFormat:@"%d",isSubscribedSelect] forKey:@"is_subscribed"];
  89. // if ([self.xxx_dateLab.text isEqualToString:@"Date Of Birth"]) {
  90. // [tempDic setObject:@"" forKey:@"birthday"];
  91. // }else{
  92. // [tempDic setObject:self.xxx_dateLab.text forKey:@"birthday"];
  93. // }
  94. [self generaltriggermethodType:1 data:tempDic];
  95. }
  96. -(void)action_xxx_subscribedBtnClick:(UIButton *)btn{
  97. btn.selected = !btn.selected;
  98. }
  99. -(void)action_selectClick:(UIButton *)btn{
  100. btn.selected = !btn.selected;
  101. }
  102. -(TT_CustonTF *)xxx_firstName{
  103. if (!_xxx_firstName) {
  104. _xxx_firstName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(20, 0, (KScreenWidth-60)/2, 50)
  105. PlaceHolder:@"* FIRST NAME"
  106. andLifImage:nil
  107. AndRightImage:nil
  108. LiftImageFrame:CGRectZero
  109. RightImageFrame:CGRectZero
  110. AndTag:0
  111. AndKeyboardType:UIKeyboardTypeDefault
  112. clearButtonMode:UITextFieldViewModeAlways
  113. AndReturnKeyType:UIReturnKeyDone
  114. masksToBounds:YES
  115. conrenRadius:4
  116. BorderColor:[UIColor colorWithHexString:@"#000000"]
  117. BorderWidth:1];
  118. _xxx_firstName.font = [UIFont fontWithName:Rob_Regular size:14];
  119. _xxx_firstName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
  120. }
  121. return _xxx_firstName;
  122. }
  123. -(TT_CustonTF *)xxx_lasetName{
  124. if (!_xxx_lasetName) {
  125. _xxx_lasetName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(CGRectGetMaxX(self.xxx_firstName.frame)+20, 0, (KScreenWidth-60)/2, 50)
  126. PlaceHolder:@"* LAST NAME"
  127. andLifImage:nil
  128. AndRightImage:nil
  129. LiftImageFrame:CGRectZero
  130. RightImageFrame:CGRectZero
  131. AndTag:0
  132. AndKeyboardType:UIKeyboardTypeDefault
  133. clearButtonMode:UITextFieldViewModeAlways
  134. AndReturnKeyType:UIReturnKeyDone
  135. masksToBounds:YES
  136. conrenRadius:4
  137. BorderColor:[UIColor colorWithHexString:@"#000000"]
  138. BorderWidth:1];
  139. _xxx_lasetName.font = [UIFont fontWithName:Rob_Regular size:14];
  140. _xxx_lasetName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
  141. }
  142. return _xxx_lasetName;
  143. }
  144. -(EamilTFmatchV *)xxx_regMmailV{
  145. if (!_xxx_regMmailV) {
  146. _xxx_regMmailV = [[EamilTFmatchV alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(self.xxx_firstName.frame)+30 , KScreenWidth, 50)];
  147. }
  148. return _xxx_regMmailV;
  149. }
  150. -(PassWordSecureBtnV *)xxx_regPassWord{
  151. if (!_xxx_regPassWord) {
  152. _xxx_regPassWord = [[PassWordSecureBtnV alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.xxx_regMmailV.frame)+30, KScreenWidth-40, 50+20)];
  153. }
  154. return _xxx_regPassWord;
  155. }
  156. -(UILabel *)xxx_dateLab{
  157. if (!_xxx_dateLab) {
  158. _xxx_dateLab = [TT_ControlTool uc_ControlToolUILabelFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_regPassWord.frame)+10, KScreenWidth-40, 50)
  159. AndTitle:@"DATE OF BIRTH"
  160. AndFontSize:14
  161. AndTitleColor:[UIColor colorWithHexString:@"#999999"]
  162. Numberoflines:1
  163. TextAlignment:NSTextAlignmentCenter
  164. adjustesFontSizesTowidth:NO
  165. masksToBounds:YES
  166. conrenrRadius:4
  167. userInteractionEnabled:YES
  168. tap_selector:@selector(action_dateOfBirth)
  169. object:self];
  170. _xxx_dateLab.layer.borderColor = [UIColor colorWithHexString:@"#000000"].CGColor;
  171. _xxx_dateLab.layer.borderWidth = 1;
  172. _xxx_dateLab.text = @"DATE OF BIRTH";
  173. }
  174. return _xxx_dateLab;
  175. }
  176. - (UIButton *)xxx_creatBtn {
  177. if (!_xxx_creatBtn) {
  178. _xxx_creatBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_dateLab.frame)+30 ,KScreenWidth-40,50)
  179. taeget:self
  180. sel:@selector(action_creatClick)
  181. tag:0
  182. AntTitle:@"CREATE ACCOUNT"
  183. titleFont:17
  184. titleColor:[UIColor whiteColor]
  185. andImage:nil
  186. AndBackColor:nil
  187. adjustsFontSizesTowidth:NO
  188. masksToBounds:YES
  189. conrenRadius:5
  190. BorderColor:nil
  191. BorderWidth:0
  192. ContentHorizontalAligment:0];
  193. _xxx_creatBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16];
  194. _xxx_creatBtn.backgroundColor = ThemeColor;
  195. }
  196. return _xxx_creatBtn;
  197. }
  198. -(UIButton *)xxx_subscribedBtn{
  199. if (!_xxx_subscribedBtn) {
  200. _xxx_subscribedBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_creatBtn.frame)+20, 40, 40)
  201. taeget:self
  202. sel:@selector(action_xxx_subscribedBtnClick:)
  203. tag:0
  204. AntTitle:nil
  205. titleFont:0
  206. titleColor:nil
  207. andImage:@"login_selectRido"
  208. AndBackColor:[UIColor clearColor]
  209. adjustsFontSizesTowidth:NO
  210. masksToBounds:NO
  211. conrenRadius:0
  212. BorderColor:nil
  213. BorderWidth:0
  214. ContentHorizontalAligment:0];
  215. [_xxx_subscribedBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected];
  216. _xxx_subscribedBtn.selected = YES;
  217. }
  218. return _xxx_subscribedBtn;
  219. }
  220. -(QMUILabel *)xxx_subscribedLab{
  221. if (!_xxx_subscribedLab) {
  222. _xxx_subscribedLab = [[QMUILabel alloc]init];
  223. _xxx_subscribedLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_creatBtn.frame)+20, KScreenWidth - 20-20-40, 40);
  224. NSString *string = @"I’d Like To Receive Emails Or Sms With Exclusive Discounts And News From Asteriahair";
  225. _xxx_subscribedLab.text = string;
  226. _xxx_subscribedLab.font = [UIFont fontWithName:Rob_Regular size:12];
  227. _xxx_subscribedLab.textColor = [UIColor colorWithHexString:@"#000000"];
  228. }
  229. return _xxx_subscribedLab;
  230. }
  231. -(UIButton *)xxx_selectBtn{
  232. if (!_xxx_selectBtn) {
  233. _xxx_selectBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, 40, 40)
  234. taeget:self
  235. sel:@selector(action_selectClick:)
  236. tag:1
  237. AntTitle:nil
  238. titleFont:0
  239. titleColor:nil
  240. andImage:@"login_selectRido"
  241. AndBackColor:[UIColor clearColor]
  242. adjustsFontSizesTowidth:NO
  243. masksToBounds:NO
  244. conrenRadius:0
  245. BorderColor:nil
  246. BorderWidth:0
  247. ContentHorizontalAligment:0];
  248. [_xxx_selectBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected];
  249. }
  250. return _xxx_selectBtn;
  251. }
  252. -(YYLabel *)xxx_ClickLab{
  253. if (!_xxx_ClickLab) {
  254. _xxx_ClickLab = [YYLabel new];
  255. _xxx_ClickLab.numberOfLines = 0;
  256. _xxx_ClickLab.textVerticalAlignment = YYTextVerticalAlignmentCenter;
  257. _xxx_ClickLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, KScreenWidth - 20-20-40, 40);
  258. NSString *string = @"I Agree To Asteriahair Terms & Conditions And Privacy Policy.";
  259. NSMutableAttributedString *attributed = [[NSMutableAttributedString alloc] initWithString:string];
  260. YYTextHighlight *protocolHightlight = [[YYTextHighlight alloc] init];
  261. [attributed yy_setTextHighlight:protocolHightlight range:[string rangeOfString:@"Terms & Conditions"]];
  262. [attributed yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle] range:[string rangeOfString:@"Terms & Conditions"]];
  263. YYTextHighlight *layHightlight = [[YYTextHighlight alloc] init];
  264. [attributed yy_setTextHighlight:layHightlight range:[string rangeOfString:@"Privacy Policy"]];
  265. [attributed yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle] range:[string rangeOfString:@"Privacy Policy"]];
  266. [attributed yy_setColor:ThemeColor range:[string rangeOfString:@"Terms & Conditions"]];
  267. [attributed yy_setColor:ThemeColor range:[string rangeOfString:@"Privacy Policy"]];
  268. @weakify(self)
  269. [attributed yy_setTextHighlightRange:[string rangeOfString:@"Terms & Conditions"] color:ThemeColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  270. NSLog(@"----");
  271. NSString *temrUrl = [NSString stringWithFormat:@"%@terms-conditions",AS_WebSever];
  272. [Fuction_Tool push_BaseWebUrl:temrUrl webTitle:@"Terms & Conditions"];
  273. }];
  274. [attributed yy_setTextHighlightRange:[string rangeOfString:@"Privacy Policy"] color:ThemeColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  275. NSLog(@"----");
  276. NSString *PrivacyUrl = [NSString stringWithFormat:@"%@privacy_policy",AS_WebSever];
  277. [Fuction_Tool push_BaseWebUrl:PrivacyUrl webTitle:@"Privacy Policy"];
  278. }];
  279. _xxx_ClickLab.attributedText = attributed;
  280. _xxx_ClickLab.font = [UIFont systemFontOfSize:12];
  281. }
  282. return _xxx_ClickLab;
  283. }
  284. @end