LoginSignUpV.m 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 *tempDic = [NSMutableDictionary dictionary];
  81. [tempDic setObject:self.xxx_firstName.text forKey:@"firstName"];
  82. [tempDic setObject:self.xxx_lasetName.text forKey:@"lastName"];
  83. [tempDic setObject:self.xxx_regMmailV.xxx_emailTF.text forKey:@"email"];
  84. [tempDic setObject:self.xxx_regPassWord.xxx_passwordTF.text forKey:@"password"];
  85. BOOL isSubscribedSelect = self.xxx_subscribedBtn.selected;
  86. [tempDic setObject:[NSString stringWithFormat:@"%d",isSubscribedSelect] forKey:@"is_subscribed"];
  87. if ([self.xxx_dateLab.text isEqualToString:@"Date Of Birth"]) {
  88. [tempDic setObject:@"" forKey:@"birthday"];
  89. }else{
  90. [tempDic setObject:self.xxx_dateLab.text forKey:@"birthday"];
  91. }
  92. [self generaltriggermethodType:1 data:tempDic];
  93. }
  94. -(void)action_xxx_subscribedBtnClick:(UIButton *)btn{
  95. btn.selected = !btn.selected;
  96. }
  97. -(void)action_selectClick:(UIButton *)btn{
  98. btn.selected = !btn.selected;
  99. }
  100. -(TT_CustonTF *)xxx_firstName{
  101. if (!_xxx_firstName) {
  102. _xxx_firstName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(20, 0, (KScreenWidth-60)/2, 50)
  103. PlaceHolder:@"* FIRST NAME"
  104. andLifImage:nil
  105. AndRightImage:nil
  106. LiftImageFrame:CGRectZero
  107. RightImageFrame:CGRectZero
  108. AndTag:0
  109. AndKeyboardType:UIKeyboardTypeDefault
  110. clearButtonMode:UITextFieldViewModeAlways
  111. AndReturnKeyType:UIReturnKeyDone
  112. masksToBounds:YES
  113. conrenRadius:4
  114. BorderColor:[UIColor colorWithHexString:@"#000000"]
  115. BorderWidth:1];
  116. _xxx_firstName.font = [UIFont fontWithName:Rob_Regular size:14];
  117. _xxx_firstName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
  118. }
  119. return _xxx_firstName;
  120. }
  121. -(TT_CustonTF *)xxx_lasetName{
  122. if (!_xxx_lasetName) {
  123. _xxx_lasetName = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(CGRectGetMaxX(self.xxx_firstName.frame)+20, 0, (KScreenWidth-60)/2, 50)
  124. PlaceHolder:@"* LAST NAME"
  125. andLifImage:nil
  126. AndRightImage:nil
  127. LiftImageFrame:CGRectZero
  128. RightImageFrame:CGRectZero
  129. AndTag:0
  130. AndKeyboardType:UIKeyboardTypeDefault
  131. clearButtonMode:UITextFieldViewModeAlways
  132. AndReturnKeyType:UIReturnKeyDone
  133. masksToBounds:YES
  134. conrenRadius:4
  135. BorderColor:[UIColor colorWithHexString:@"#000000"]
  136. BorderWidth:1];
  137. _xxx_lasetName.font = [UIFont fontWithName:Rob_Regular size:14];
  138. _xxx_lasetName.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
  139. }
  140. return _xxx_lasetName;
  141. }
  142. -(EamilTFmatchV *)xxx_regMmailV{
  143. if (!_xxx_regMmailV) {
  144. _xxx_regMmailV = [[EamilTFmatchV alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(self.xxx_firstName.frame)+30 , KScreenWidth, 50)];
  145. }
  146. return _xxx_regMmailV;
  147. }
  148. -(PassWordSecureBtnV *)xxx_regPassWord{
  149. if (!_xxx_regPassWord) {
  150. _xxx_regPassWord = [[PassWordSecureBtnV alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.xxx_regMmailV.frame)+30, KScreenWidth-40, 50+20)];
  151. }
  152. return _xxx_regPassWord;
  153. }
  154. -(UILabel *)xxx_dateLab{
  155. if (!_xxx_dateLab) {
  156. _xxx_dateLab = [TT_ControlTool uc_ControlToolUILabelFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_regPassWord.frame)+10, KScreenWidth-40, 50)
  157. AndTitle:@"DATE OF BIRTH"
  158. AndFontSize:14
  159. AndTitleColor:[UIColor colorWithHexString:@"#999999"]
  160. Numberoflines:1
  161. TextAlignment:NSTextAlignmentCenter
  162. adjustesFontSizesTowidth:NO
  163. masksToBounds:YES
  164. conrenrRadius:4
  165. userInteractionEnabled:YES
  166. tap_selector:@selector(action_dateOfBirth)
  167. object:self];
  168. _xxx_dateLab.layer.borderColor = [UIColor colorWithHexString:@"#000000"].CGColor;
  169. _xxx_dateLab.layer.borderWidth = 1;
  170. _xxx_dateLab.text = @"DATE OF BIRTH";
  171. }
  172. return _xxx_dateLab;
  173. }
  174. - (UIButton *)xxx_creatBtn {
  175. if (!_xxx_creatBtn) {
  176. _xxx_creatBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_dateLab.frame)+30 ,KScreenWidth-40,50)
  177. taeget:self
  178. sel:@selector(action_creatClick)
  179. tag:0
  180. AntTitle:@"CREATE ACCOUNT"
  181. titleFont:17
  182. titleColor:[UIColor whiteColor]
  183. andImage:nil
  184. AndBackColor:nil
  185. adjustsFontSizesTowidth:NO
  186. masksToBounds:YES
  187. conrenRadius:5
  188. BorderColor:nil
  189. BorderWidth:0
  190. ContentHorizontalAligment:0];
  191. _xxx_creatBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16];
  192. _xxx_creatBtn.backgroundColor = ThemeColor;
  193. }
  194. return _xxx_creatBtn;
  195. }
  196. -(UIButton *)xxx_subscribedBtn{
  197. if (!_xxx_subscribedBtn) {
  198. _xxx_subscribedBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_creatBtn.frame)+20, 40, 40)
  199. taeget:self
  200. sel:@selector(action_xxx_subscribedBtnClick:)
  201. tag:0
  202. AntTitle:nil
  203. titleFont:0
  204. titleColor:nil
  205. andImage:@"login_selectRido"
  206. AndBackColor:[UIColor clearColor]
  207. adjustsFontSizesTowidth:NO
  208. masksToBounds:NO
  209. conrenRadius:0
  210. BorderColor:nil
  211. BorderWidth:0
  212. ContentHorizontalAligment:0];
  213. [_xxx_subscribedBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected];
  214. _xxx_subscribedBtn.selected = YES;
  215. }
  216. return _xxx_subscribedBtn;
  217. }
  218. -(QMUILabel *)xxx_subscribedLab{
  219. if (!_xxx_subscribedLab) {
  220. _xxx_subscribedLab = [[QMUILabel alloc]init];
  221. _xxx_subscribedLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_creatBtn.frame)+20, KScreenWidth - 20-20-40, 40);
  222. NSString *string = @"I’d Like To Receive Emails Or Sms With Exclusive Discounts And News From Asteriahair";
  223. _xxx_subscribedLab.text = string;
  224. _xxx_subscribedLab.font = [UIFont fontWithName:Rob_Regular size:12];
  225. _xxx_subscribedLab.textColor = [UIColor colorWithHexString:@"#000000"];
  226. }
  227. return _xxx_subscribedLab;
  228. }
  229. -(UIButton *)xxx_selectBtn{
  230. if (!_xxx_selectBtn) {
  231. _xxx_selectBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20,CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, 40, 40)
  232. taeget:self
  233. sel:@selector(action_selectClick:)
  234. tag:1
  235. AntTitle:nil
  236. titleFont:0
  237. titleColor:nil
  238. andImage:@"login_selectRido"
  239. AndBackColor:[UIColor clearColor]
  240. adjustsFontSizesTowidth:NO
  241. masksToBounds:NO
  242. conrenRadius:0
  243. BorderColor:nil
  244. BorderWidth:0
  245. ContentHorizontalAligment:0];
  246. [_xxx_selectBtn setImage:[UIImage imageNamed:@"login_selectRido_select"] forState:UIControlStateSelected];
  247. }
  248. return _xxx_selectBtn;
  249. }
  250. -(YYLabel *)xxx_ClickLab{
  251. if (!_xxx_ClickLab) {
  252. _xxx_ClickLab = [YYLabel new];
  253. _xxx_ClickLab.numberOfLines = 0;
  254. _xxx_ClickLab.textVerticalAlignment = YYTextVerticalAlignmentCenter;
  255. _xxx_ClickLab.frame = CGRectMake(60, CGRectGetMaxY(self.xxx_subscribedBtn.frame)+10, KScreenWidth - 20-20-40, 40);
  256. NSString *string = @"I Agree To Asteriahair Terms & Conditions And Privacy Policy.";
  257. NSMutableAttributedString *attributed = [[NSMutableAttributedString alloc] initWithString:string];
  258. YYTextHighlight *protocolHightlight = [[YYTextHighlight alloc] init];
  259. [attributed yy_setTextHighlight:protocolHightlight range:[string rangeOfString:@"Terms & Conditions"]];
  260. [attributed yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle] range:[string rangeOfString:@"Terms & Conditions"]];
  261. YYTextHighlight *layHightlight = [[YYTextHighlight alloc] init];
  262. [attributed yy_setTextHighlight:layHightlight range:[string rangeOfString:@"Privacy Policy"]];
  263. [attributed yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle] range:[string rangeOfString:@"Privacy Policy"]];
  264. [attributed yy_setColor:ThemeColor range:[string rangeOfString:@"Terms & Conditions"]];
  265. [attributed yy_setColor:ThemeColor range:[string rangeOfString:@"Privacy Policy"]];
  266. @weakify(self)
  267. [attributed yy_setTextHighlightRange:[string rangeOfString:@"Terms & Conditions"] color:ThemeColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  268. NSLog(@"----");
  269. NSString *temrUrl = [NSString stringWithFormat:@"%@terms-conditions",AS_WebSever];
  270. [Fuction_Tool push_BaseWebUrl:temrUrl webTitle:@"Terms & Conditions"];
  271. }];
  272. [attributed yy_setTextHighlightRange:[string rangeOfString:@"Privacy Policy"] color:ThemeColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  273. NSLog(@"----");
  274. NSString *PrivacyUrl = [NSString stringWithFormat:@"%@privacy_policy",AS_WebSever];
  275. [Fuction_Tool push_BaseWebUrl:PrivacyUrl webTitle:@"Privacy Policy"];
  276. }];
  277. _xxx_ClickLab.attributedText = attributed;
  278. _xxx_ClickLab.font = [UIFont systemFontOfSize:12];
  279. }
  280. return _xxx_ClickLab;
  281. }
  282. @end