NewRegisterViewController.m 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107
  1. //
  2. // MMMessageVerificationVC.m
  3. // MingMen
  4. //
  5. // Created by 罗云飞 on 2017/3/11.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "NewRegisterViewController.h"
  9. #import "NewRegistCell.h"
  10. #import "AgreementViewController.h"
  11. @interface NewRegisterViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
  12. {
  13. NSMutableArray *dataArray;
  14. UITableView *mainTableView;
  15. UITextField *phoneTextField;
  16. UITextField *verificationCodeTextField;
  17. UITextField *recommendCodeTextField;
  18. UITextField *passWord1TextField;
  19. UITextField *passWord2TextField;
  20. UIButton *verificationCodeButton;
  21. UITextField *mynametextField;
  22. UIButton *selectedBtn;
  23. BOOL isProtocolRule;//技淘注册协议
  24. UITextField *UnitnameTextField;//单位名称输入框
  25. UILabel *unitname;//固定
  26. UILabel *contacts;//联系人名称固定
  27. UITextField *contactsTextField;//联系人名称输入框
  28. UIButton *confirm;//注册
  29. UIButton *confirm2;//注册
  30. UIView *protocolRuleBar;//注册勾选协议
  31. UIView *protocolRuleBar2;//注册勾选协议2
  32. UILabel *line2;
  33. UILabel *line;
  34. NSString *type;//类别 个人or企业 0-个人 1-单位
  35. NSString *yonghutype;
  36. }
  37. @property (strong ,nonatomic) UITextField * account;
  38. @property (strong ,nonatomic) UITextField * iphoneNumber;
  39. @property (strong ,nonatomic) UITextField * yanzhenma;
  40. @property (strong ,nonatomic) UITextField * Customer;
  41. @property (strong ,nonatomic) UITextField * password;
  42. @property (strong ,nonatomic) UITextField * querenpassword;
  43. @property (strong ,nonatomic) UIButton * yhtypeStr;
  44. @end
  45. @implementation NewRegisterViewController
  46. - (void)viewWillAppear:(BOOL)animated
  47. {
  48. [super viewWillAppear:animated];
  49. //关闭侧滑返回功能
  50. // self.fd_interactivePopDisabled=YES;
  51. [self.navgationBar setHidden:YES];
  52. }
  53. - (void)viewDidDisappear:(BOOL)animated
  54. {
  55. [super viewDidDisappear:animated];
  56. [self.navgationBar setHidden:NO];
  57. }
  58. -(void)dealloc
  59. {
  60. NSLog(@"注册界面销毁");
  61. }
  62. - (void)viewDidLoad {
  63. [super viewDidLoad];
  64. // Do any additional setup after loading the view.
  65. [self setNavTitle:@"立即注册"];
  66. isProtocolRule = YES;
  67. yonghutype = @"请选择用户类型";
  68. [self loadUI];
  69. // [self dataInitialization];
  70. // [self loadsView];
  71. }
  72. - (void)loadUI{
  73. UIImageView *backimage = [UIImageView new];
  74. [backimage setImage:[UIImage imageNamed:@"dlbj"]];
  75. backimage.backgroundColor = NewClearColor;
  76. backimage.userInteractionEnabled = YES;
  77. [self.view addSubview:backimage];
  78. backimage.sd_layout
  79. .leftEqualToView(self.view)
  80. .topEqualToView(self.view)
  81. .bottomEqualToView(self.view)
  82. .rightEqualToView(self.view);
  83. UIButton *fanhuiBT = [UIButton new];
  84. [fanhuiBT setBackgroundImage:NewImageNamed(@"fh") forState:UIControlStateNormal];
  85. NewTouchUpInside(fanhuiBT, fanhuiBTclick:);
  86. [backimage addSubview:fanhuiBT];
  87. if (NavHeader == 88) {
  88. fanhuiBT.sd_layout
  89. .leftSpaceToView(backimage, 17)
  90. .topSpaceToView(backimage, 52)
  91. .heightIs(21)
  92. .widthIs(11);
  93. }else{
  94. fanhuiBT.sd_layout
  95. .leftSpaceToView(backimage, 17)
  96. .topSpaceToView(backimage, 32)
  97. .heightIs(21)
  98. .widthIs(11);
  99. }
  100. UIImageView *logoimage = [UIImageView new];
  101. [logoimage setImage:[UIImage imageNamed:@"logo"]];
  102. logoimage.backgroundColor = NewClearColor;
  103. [backimage addSubview:logoimage];
  104. logoimage.sd_layout
  105. .centerXEqualToView(backimage)
  106. .topSpaceToView(backimage, fitScreenHeight(90))
  107. .heightIs(fitScreenWidth(80))
  108. .widthIs(fitScreenWidth(80));
  109. //用户名
  110. UIView *usernameview = [UIView new];
  111. usernameview.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  112. usernameview.userInteractionEnabled = YES;
  113. ViewRadius(usernameview, 5);
  114. // [backimage addSubview:usernameview];
  115. usernameview.sd_layout
  116. .leftSpaceToView(backimage, 45)
  117. .rightSpaceToView(backimage, 45)
  118. .heightIs(45)
  119. .topSpaceToView(logoimage, fitScreenHeight(65));
  120. UIImageView *usernameimage = [UIImageView new];
  121. [usernameimage setImage:[UIImage imageNamed:@"yh"]];
  122. [usernameimage setBackgroundColor:NewClearColor];
  123. [usernameview addSubview:usernameimage];
  124. usernameimage.sd_layout
  125. .centerYEqualToView(usernameview)
  126. .leftSpaceToView(usernameview, 15)
  127. .heightIs(16)
  128. .widthIs(16);
  129. [usernameview addSubview:self.account];
  130. _account.sd_layout
  131. .leftSpaceToView(usernameimage, 15)
  132. .heightIs(30)
  133. .centerYEqualToView(usernameview)
  134. .rightSpaceToView(usernameview, 15);
  135. //手机号码
  136. UIView *iponeNumView = [UIView new];
  137. iponeNumView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  138. iponeNumView.userInteractionEnabled = YES;
  139. ViewRadius(iponeNumView, 5);
  140. [backimage addSubview:iponeNumView];
  141. iponeNumView.sd_layout
  142. .leftSpaceToView(backimage, 45)
  143. .rightSpaceToView(backimage, 45)
  144. .heightIs(fitScreenWidth(45))
  145. .topSpaceToView(logoimage, fitScreenHeight(65));
  146. UIImageView *iponeNumimage = [UIImageView new];
  147. [iponeNumimage setImage:[UIImage imageNamed:@"sj"]];
  148. [iponeNumimage setBackgroundColor:NewClearColor];
  149. [iponeNumView addSubview:iponeNumimage];
  150. iponeNumimage.sd_layout
  151. .centerYEqualToView(iponeNumView)
  152. .leftSpaceToView(iponeNumView, 15)
  153. .heightIs(20)
  154. .widthIs(17);
  155. [iponeNumView addSubview:self.iphoneNumber];
  156. _iphoneNumber.sd_layout
  157. .leftSpaceToView(iponeNumimage, 15)
  158. .heightIs(30)
  159. .centerYEqualToView(iponeNumimage)
  160. .rightSpaceToView(iponeNumView, 15);
  161. //验证码
  162. UIView *yanzhenmaView = [UIView new];
  163. yanzhenmaView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  164. yanzhenmaView.userInteractionEnabled = YES;
  165. ViewRadius(yanzhenmaView, 5);
  166. // [backimage addSubview:yanzhenmaView];
  167. yanzhenmaView.sd_layout
  168. .leftSpaceToView(backimage, 45)
  169. .rightSpaceToView(backimage, 45)
  170. .heightIs(fitScreenWidth(45))
  171. .topSpaceToView(iponeNumView, 15);
  172. UIImageView *yanzhenmaimage = [UIImageView new];
  173. [yanzhenmaimage setImage:[UIImage imageNamed:@"yz"]];
  174. [yanzhenmaimage setBackgroundColor:NewClearColor];
  175. [yanzhenmaView addSubview:yanzhenmaimage];
  176. yanzhenmaimage.sd_layout
  177. .centerYEqualToView(yanzhenmaView)
  178. .leftSpaceToView(yanzhenmaView, 15)
  179. .heightIs(20)
  180. .widthIs(18);
  181. [yanzhenmaView addSubview:self.yanzhenma];
  182. self.yanzhenma.sd_layout
  183. .leftSpaceToView(yanzhenmaimage, 15)
  184. .heightIs(30)
  185. .centerYEqualToView(yanzhenmaimage)
  186. .rightSpaceToView(yanzhenmaView, 80);
  187. verificationCodeButton = [UIButton new];
  188. [verificationCodeButton setTitle:@"获取验证码" forState:UIControlStateNormal];
  189. [verificationCodeButton setTitleColor:[UIColor colorWithString:@"#2987DE"] forState:UIControlStateNormal];
  190. verificationCodeButton.titleLabel.font = NewFont(fitScreenWidth(13));
  191. verificationCodeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
  192. NewTouchUpInside(verificationCodeButton, touchVerificationCode:);
  193. [yanzhenmaView addSubview:verificationCodeButton];
  194. verificationCodeButton.sd_layout
  195. .centerYEqualToView(yanzhenmaView)
  196. .rightSpaceToView(yanzhenmaView, 10)
  197. .heightIs(15)
  198. .widthIs(80);
  199. //客户名称
  200. UIView *CustomernameView = [UIView new];
  201. CustomernameView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  202. CustomernameView.userInteractionEnabled = YES;
  203. ViewRadius(CustomernameView, 5);
  204. // [backimage addSubview:CustomernameView];
  205. CustomernameView.sd_layout
  206. .leftSpaceToView(backimage, 45)
  207. .rightSpaceToView(backimage, 45)
  208. .heightIs(fitScreenWidth(45))
  209. .topSpaceToView(yanzhenmaView, 15);
  210. UIImageView *Customernameimage = [UIImageView new];
  211. [Customernameimage setImage:[UIImage imageNamed:@"khxm-min"]];
  212. // [Customernameimage setBackgroundColor:NewRedColor];
  213. [CustomernameView addSubview:Customernameimage];
  214. Customernameimage.sd_layout
  215. .centerYEqualToView(CustomernameView)
  216. .leftSpaceToView(CustomernameView, 15)
  217. .heightIs(19)
  218. .widthIs(16);
  219. [CustomernameView addSubview:self.Customer];
  220. _Customer.sd_layout
  221. .leftSpaceToView(Customernameimage, 15)
  222. .heightIs(30)
  223. .centerYEqualToView(Customernameimage)
  224. .rightSpaceToView(CustomernameView, 15);
  225. //第一次密码
  226. UIView *passwordView = [UIView new];
  227. passwordView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  228. passwordView.userInteractionEnabled = YES;
  229. ViewRadius(passwordView, 5);
  230. [backimage addSubview:passwordView];
  231. passwordView.sd_layout
  232. .leftSpaceToView(backimage, 45)
  233. .rightSpaceToView(backimage, 45)
  234. .heightIs(fitScreenWidth(45))
  235. .topSpaceToView(iponeNumView, 15);
  236. UIImageView *passwordimage = [UIImageView new];
  237. [passwordimage setImage:[UIImage imageNamed:@"mm"]];
  238. [passwordimage setBackgroundColor:NewClearColor];
  239. [passwordView addSubview:passwordimage];
  240. passwordimage.sd_layout
  241. .centerYEqualToView(passwordView)
  242. .leftSpaceToView(passwordView, 15)
  243. .heightIs(19)
  244. .widthIs(16);
  245. [passwordView addSubview:self.password];
  246. _password.sd_layout
  247. .leftSpaceToView(passwordimage, 15)
  248. .heightIs(30)
  249. .centerYEqualToView(passwordimage)
  250. .rightSpaceToView(passwordView, 15);
  251. //第二次密码
  252. UIView *querenpasswordView = [UIView new];
  253. querenpasswordView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  254. querenpasswordView.userInteractionEnabled = YES;
  255. ViewRadius(querenpasswordView, 5);
  256. [backimage addSubview:querenpasswordView];
  257. querenpasswordView.sd_layout
  258. .leftSpaceToView(backimage, 45)
  259. .rightSpaceToView(backimage, 45)
  260. .heightIs(fitScreenWidth(45))
  261. .topSpaceToView(passwordView, 15);
  262. UIImageView *querenpasswordimage = [UIImageView new];
  263. [querenpasswordimage setImage:[UIImage imageNamed:@"qr"]];
  264. [querenpasswordimage setBackgroundColor:NewClearColor];
  265. [querenpasswordView addSubview:querenpasswordimage];
  266. querenpasswordimage.sd_layout
  267. .centerYEqualToView(querenpasswordView)
  268. .leftSpaceToView(querenpasswordView, 15)
  269. .heightIs(19)
  270. .widthIs(16);
  271. [querenpasswordView addSubview:self.querenpassword];
  272. _querenpassword.sd_layout
  273. .leftSpaceToView(querenpasswordimage, 15)
  274. .heightIs(30)
  275. .centerYEqualToView(querenpasswordimage)
  276. .rightSpaceToView(querenpasswordView, 15);
  277. UIView *yhtypeView = [UIView new];
  278. yhtypeView.backgroundColor = [UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
  279. yhtypeView.userInteractionEnabled = YES;
  280. ViewRadius(yhtypeView, 5);
  281. // [backimage addSubview:yhtypeView];
  282. yhtypeView.sd_layout
  283. .leftSpaceToView(backimage, 45)
  284. .rightSpaceToView(backimage, 45)
  285. .heightIs(fitScreenWidth(45))
  286. .topSpaceToView(querenpasswordView, 15);
  287. UIImageView *yhtype = [UIImageView new];
  288. [yhtype setImage:[UIImage imageNamed:@"用户类型"]];
  289. [yhtype setBackgroundColor:NewClearColor];
  290. [yhtypeView addSubview:yhtype];
  291. yhtype.sd_layout
  292. .centerYEqualToView(yhtypeView)
  293. .leftSpaceToView(yhtypeView, 15)
  294. .heightIs(19)
  295. .widthIs(16);
  296. _yhtypeStr = [UIButton new];
  297. [_yhtypeStr setTitle:yonghutype forState:UIControlStateNormal];
  298. [_yhtypeStr setTitleColor:[UIColor colorWithString:@"#9A9A9A"] forState:UIControlStateNormal];
  299. _yhtypeStr.titleLabel.font = NewFont(fitScreenWidth(12));
  300. NewTouchUpInside(_yhtypeStr, yhbuttoncilck);
  301. _yhtypeStr.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  302. [yhtypeView addSubview:_yhtypeStr];
  303. self.yhtypeStr.sd_layout
  304. .leftSpaceToView(yhtype, 15)
  305. .heightIs(30)
  306. .centerYEqualToView(yhtype)
  307. .rightSpaceToView(yhtypeView, 15);
  308. [backimage addSubview:protocolRuleBar = [NewControlPackage protocolRuleBarInitWithFrame:CGRectMake(0, 0, 0, 0) title:@"接受技淘网用户协议" textColor:NewNavigationColor textAlignment:UIControlContentHorizontalAlignmentLeft font:fitScreenWidth(13) backgroundColor:NewWhiteColor backgroundImage:NewImageNamed(@"未选中状态") backgroundImageSelected:NewImageNamed(@"选中") target:self action:@selector(registrationBTclick:) hidden:NO agreeBTTag:155 agreementBTTag:156 userInteractionEnabled:YES]];
  309. protocolRuleBar.sd_layout
  310. .leftSpaceToView(backimage, fitScreenWidth(50))
  311. .topSpaceToView(querenpasswordView, 15)
  312. .widthIs(SCREEN_WIDTH)
  313. .heightIs(30);
  314. [backimage addSubview:confirm2 = [NewControlPackage buttonInitWithTitle:@"注 册" Frame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewButtonColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(14) tag:105 target:self action:@selector(touchConfirm) hidden:NO userInteractionEnabled:YES]];
  315. ViewRadius(confirm2, 8);
  316. confirm2.sd_layout
  317. .leftEqualToView(querenpasswordView)
  318. .topSpaceToView(protocolRuleBar, 20)
  319. .heightIs(40)
  320. .rightEqualToView(querenpasswordView);
  321. }
  322. - (UITextField *)account
  323. {
  324. if (!_account)
  325. {
  326. _account = [UITextField new];
  327. [_account setBackgroundColor:[UIColor clearColor]];
  328. [_account setTextColor:NewGrayColor];
  329. [_account setPlaceholder:@"请输入用户名"];
  330. [_account setText:@""];
  331. [_account setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
  332. [_account setSecureTextEntry:NO];
  333. [_account setKeyboardType:UIKeyboardTypeNumberPad];
  334. [_account setReturnKeyType:UIReturnKeyDefault];
  335. [_account addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  336. }
  337. return _account;
  338. }
  339. - (UITextField *)Customer
  340. {
  341. if (!_Customer)
  342. {
  343. _Customer = [UITextField new];
  344. [_Customer setBackgroundColor:[UIColor clearColor]];
  345. [_Customer setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
  346. [_Customer setPlaceholder:@"请输入客户名称"];
  347. [_Customer setText:@""];
  348. [_Customer setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
  349. [_Customer setSecureTextEntry:NO];
  350. [_Customer setKeyboardType:UIKeyboardTypeDefault];
  351. [_Customer setReturnKeyType:UIReturnKeyDefault];
  352. [_Customer addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  353. }
  354. return _Customer;
  355. }
  356. - (UITextField *)password
  357. {
  358. if (!_password)
  359. {
  360. _password = [UITextField new];
  361. [_password setBackgroundColor:[UIColor clearColor]];
  362. [_password setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
  363. [_password setPlaceholder:@"请输入密码"];
  364. [_password setText:@""];
  365. [_password setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
  366. [_password setSecureTextEntry:YES];
  367. [_password setKeyboardType:UIKeyboardTypeDefault];
  368. [_password setReturnKeyType:UIReturnKeyDefault];
  369. [_password addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  370. }
  371. return _password;
  372. }
  373. - (UITextField *)yanzhenma
  374. {
  375. if (!_yanzhenma)
  376. {
  377. _yanzhenma = [UITextField new];
  378. [_yanzhenma setBackgroundColor:[UIColor clearColor]];
  379. [_yanzhenma setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
  380. [_yanzhenma setPlaceholder:@"请输入验证码"];
  381. [_yanzhenma setText:@""];
  382. [_yanzhenma setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
  383. [_yanzhenma setSecureTextEntry:NO];
  384. [_yanzhenma setKeyboardType:UIKeyboardTypeDefault];
  385. [_yanzhenma setReturnKeyType:UIReturnKeyDefault];
  386. [_yanzhenma addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  387. }
  388. return _yanzhenma;
  389. }
  390. - (UITextField *)iphoneNumber
  391. {
  392. if (!_iphoneNumber)
  393. {
  394. _iphoneNumber = [UITextField new];
  395. [_iphoneNumber setBackgroundColor:[UIColor clearColor]];
  396. [_iphoneNumber setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
  397. [_iphoneNumber setPlaceholder:@"请输入手机号"];
  398. [_iphoneNumber setText:@""];
  399. [_iphoneNumber setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
  400. [_iphoneNumber setSecureTextEntry:NO];
  401. [_iphoneNumber setKeyboardType:UIKeyboardTypeDefault];
  402. [_iphoneNumber setReturnKeyType:UIReturnKeyDefault];
  403. [_iphoneNumber addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  404. }
  405. return _iphoneNumber;
  406. }
  407. - (UITextField *)querenpassword
  408. {
  409. if (!_querenpassword)
  410. {
  411. _querenpassword = [UITextField new];
  412. [_querenpassword setBackgroundColor:[UIColor clearColor]];
  413. [_querenpassword setTextColor:[UIColor colorWithString:@"#9A9A9A"]];
  414. [_querenpassword setPlaceholder:@"请输入邀请码"];
  415. [_querenpassword setText:@""];
  416. [_querenpassword setFont:[UIFont systemFontOfSize:fitScreenWidth(12)]];
  417. [_querenpassword setSecureTextEntry:YES];
  418. [_querenpassword setKeyboardType:UIKeyboardTypeDefault];
  419. [_querenpassword setReturnKeyType:UIReturnKeyDefault];
  420. [_querenpassword addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  421. }
  422. return _querenpassword;
  423. }
  424. #pragma mark - 数据初始化
  425. -(void)dataInitialization
  426. {
  427. phoneTextField = nil;
  428. verificationCodeTextField = nil;
  429. recommendCodeTextField = nil;
  430. verificationCodeButton = nil;
  431. passWord1TextField = nil;
  432. passWord2TextField = nil;
  433. dataArray = NewMutableArrayInit;
  434. type = @"0";
  435. isProtocolRule = YES;
  436. for (int i=0; i<4; i++) {
  437. NSDictionary *dataDic = [NSDictionary dictionary];
  438. switch (i) {
  439. case 0:
  440. dataDic = @{@"nameKey":@"手机号码",@"imageKey":@"手机号码",@"placeholderKey":@""};
  441. [dataArray addObject:dataDic];
  442. break;
  443. case 1:
  444. dataDic = @{@"nameKey":@"验证码",@"imageKey":@"短信",@"placeholderKey":@"请输入短信验证码"};
  445. [dataArray addObject:dataDic];
  446. break;
  447. case 2:
  448. dataDic = @{@"nameKey":@"设置密码",@"imageKey":@"密码",@"placeholderKey":@"密码不少于6位数"};
  449. [dataArray addObject:dataDic];
  450. break;
  451. case 3:
  452. dataDic = @{@"nameKey":@"确认密码",@"imageKey":@"密码",@"placeholderKey":@"密码不少于6位数"};
  453. [dataArray addObject:dataDic];
  454. break;
  455. default:
  456. break;
  457. }
  458. }
  459. }
  460. #pragma mark - UI初始化
  461. -(void)loadsView
  462. {
  463. [self.view addSubview:mainTableView = [NewControlPackage tableViewInitWithFrame:CGRectMake(0, ViewStartY, SCREEN_WIDTH, SCREEN_HEIGHT-ViewStartY) backgroundColor:NewClearColor style:0 delegate:self dataSource:self showsHorizontalScrollIndicator:NO showsVerticalScrollIndicator:NO hidden:NO tag:100 userInteractionEnabled:YES]];
  464. mainTableView.separatorStyle = NO; //newtableView隐藏线条
  465. UIView *view;
  466. mainTableView.tableFooterView = view = [NewControlPackage viewInitWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 400) backgroundColor:NewClearColor hidden:NO tag:101 userInteractionEnabled:YES];
  467. UIImageView *lineImge;
  468. [view addSubview:lineImge = [NewControlPackage imageViewInitWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-15, .6) image:nil highlightedImage:nil backgroundColor:NewCellLineColor tag:102 hidden:YES userInteractionEnabled:YES]];
  469. UILabel *personal = [UILabel new];
  470. personal.text = @"个 人";
  471. personal.textColor = NewBlackColor;
  472. personal.font = NewFont(fitScreenWidth(12));
  473. [personal setSingleLineAutoResizeWithMaxWidth:0];
  474. [view addSubview:personal];
  475. personal.sd_layout
  476. .rightSpaceToView(view, SCREEN_WIDTH/2+20)
  477. .topSpaceToView(lineImge, 30)
  478. .heightIs(20);
  479. UIButton *personalBT = [UIButton new];
  480. [personalBT setImage:[UIImage imageNamed:@"未选中状态"] forState:UIControlStateNormal];
  481. [personalBT setImage:[UIImage imageNamed:@"选中"] forState:UIControlStateSelected];
  482. personalBT.selected = YES;
  483. selectedBtn = personalBT;
  484. NewTouchUpInside(personalBT, personalBTclick:);
  485. personalBT.tag = 100;
  486. [view addSubview:personalBT];
  487. personalBT.sd_layout
  488. .rightSpaceToView(personal, 5)
  489. .topSpaceToView(lineImge, 30)
  490. .heightIs(20)
  491. .widthIs(20);
  492. //企业
  493. UIButton *enterpriseBT = [UIButton new];
  494. [enterpriseBT setImage:[UIImage imageNamed:@"未选中状态"] forState:UIControlStateNormal];
  495. [enterpriseBT setImage:[UIImage imageNamed:@"选中"] forState:UIControlStateSelected];
  496. enterpriseBT.tag = 101;
  497. NewTouchUpInside(enterpriseBT, personalBTclick:);
  498. [view addSubview:enterpriseBT];
  499. enterpriseBT.sd_layout
  500. .leftSpaceToView(view, SCREEN_WIDTH/2+20)
  501. .topSpaceToView(lineImge, 30)
  502. .heightIs(20)
  503. .widthIs(20);
  504. UILabel *enterprise = [UILabel new];
  505. enterprise.text = @"企 业";
  506. enterprise.textColor = NewBlackColor;
  507. enterprise.font = NewFont(fitScreenWidth(12));
  508. [enterprise setSingleLineAutoResizeWithMaxWidth:0];
  509. [view addSubview:enterprise];
  510. enterprise.sd_layout
  511. .leftSpaceToView(enterpriseBT, 5)
  512. .topEqualToView(enterpriseBT)
  513. .heightIs(20);
  514. //您的姓名
  515. [view addSubview:mynametextField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewBlackColor placeholder:@"您的姓名" hidden:NO tag:200 font:NewFont(fitScreenWidth(14)) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
  516. [mynametextField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  517. mynametextField.sd_layout
  518. .leftSpaceToView(view, 30)
  519. .topSpaceToView(enterprise, 20)
  520. .widthIs(200)
  521. .heightIs(35);
  522. line = [UILabel new];
  523. line.backgroundColor = NewLineGrayColor;
  524. [view addSubview:line];
  525. line.sd_layout
  526. .leftEqualToView(mynametextField)
  527. .topSpaceToView(mynametextField, 1)
  528. .heightIs(0.8)
  529. .rightSpaceToView(view, 30);
  530. [view addSubview:confirm = [NewControlPackage buttonInitWithTitle:@"注 册" Frame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewButtonColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(fitScreenWidth(14)) tag:105 target:self action:@selector(touchConfirm) hidden:NO userInteractionEnabled:YES]];
  531. ViewRadius(confirm, 8);
  532. confirm.sd_layout
  533. .leftEqualToView(mynametextField)
  534. .topSpaceToView(line, 20)
  535. .heightIs(40)
  536. .rightSpaceToView(view, 15);
  537. // //注册勾选按钮
  538. [view addSubview:protocolRuleBar = [NewControlPackage protocolRuleBarInitWithFrame:CGRectMake(0, 0, 0, 0) title:@"注册即视为同意用户协议" textColor:NewNavigationColor textAlignment:UIControlContentHorizontalAlignmentLeft font:fitScreenWidth(13) backgroundColor:NewWhiteColor backgroundImage:NewImageNamed(@"未选中状态") backgroundImageSelected:NewImageNamed(@"选中") target:self action:@selector(registrationBTclick:) hidden:NO agreeBTTag:155 agreementBTTag:156 userInteractionEnabled:YES]];
  539. protocolRuleBar.sd_layout
  540. .leftSpaceToView(view, fitScreenWidth(50))
  541. .topSpaceToView(confirm, 20)
  542. .widthIs(SCREEN_WIDTH)
  543. .heightIs(20);
  544. unitname = [UILabel new];
  545. unitname.text = @"单位名称";
  546. unitname.font = NewFont(14);
  547. unitname.textColor = [UIColor colorWithString:@"#3C3C3C"];
  548. [unitname setSingleLineAutoResizeWithMaxWidth:0];
  549. [view addSubview:unitname];
  550. unitname.sd_layout
  551. .leftSpaceToView(view, 30)
  552. .topSpaceToView(personalBT, 30)
  553. .heightIs(15);
  554. //单位名称
  555. [view addSubview:UnitnameTextField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewBlackColor placeholder:@"请输入单位名称" hidden:NO tag:220 font:NewFont(14) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
  556. [UnitnameTextField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  557. UnitnameTextField.sd_layout
  558. .leftSpaceToView(unitname, 15)
  559. .topSpaceToView(enterprise, 20)
  560. .widthIs(200)
  561. .heightIs(35);
  562. contacts = [UILabel new];
  563. contacts.text = @"联系人名称";
  564. contacts.textColor = NewBlackColor;
  565. contacts.font = NewFont(14);
  566. [contacts setSingleLineAutoResizeWithMaxWidth:0];
  567. [view addSubview:contacts];
  568. contacts.sd_layout
  569. .leftEqualToView(unitname)
  570. .topSpaceToView(line, 27)
  571. .heightIs(15);
  572. //联系人名称输入框
  573. [view addSubview:contactsTextField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewBlackColor placeholder:@"请输入联系人名称" hidden:NO tag:221 font:NewFont(14) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
  574. [contactsTextField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  575. contactsTextField.sd_layout
  576. .leftSpaceToView(contacts, 15)
  577. .topSpaceToView(line, 27)
  578. .widthIs(200)
  579. .heightIs(15);
  580. line2 = [UILabel new];
  581. line2.backgroundColor = [UIColor colorWithString:@"eaeaea"];
  582. [view addSubview:line2];
  583. line2.sd_layout
  584. .leftEqualToView(contacts)
  585. .topSpaceToView(contactsTextField, 10)
  586. .heightIs(0.8)
  587. .rightSpaceToView(view, 30);
  588. [view addSubview:confirm2 = [NewControlPackage buttonInitWithTitle:@"注 册" Frame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewButtonColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(14) tag:105 target:self action:@selector(touchConfirm) hidden:NO userInteractionEnabled:YES]];
  589. ViewRadius(confirm2, 8);
  590. confirm2.sd_layout
  591. .leftEqualToView(contacts)
  592. .topSpaceToView(line2, 30)
  593. .heightIs(40)
  594. .rightSpaceToView(view, 15);
  595. // //注册勾选按钮
  596. [view addSubview:protocolRuleBar2 = [NewControlPackage protocolRuleBarInitWithFrame:CGRectMake(0, 0, 0, 0) title:@"注册即视为同意用户协议" textColor:[UIColor colorWithString:@"#9A9A9A"] textAlignment:UIControlContentHorizontalAlignmentLeft font:fitScreenWidth(14) backgroundColor:NewWhiteColor backgroundImage:NewImageNamed(@"未选中状态") backgroundImageSelected:NewImageNamed(@"选中") target:self action:@selector(registrationBTclick:) hidden:NO agreeBTTag:155 agreementBTTag:156 userInteractionEnabled:YES]];
  597. protocolRuleBar2.sd_layout
  598. .leftSpaceToView(view, 0)
  599. .topSpaceToView(confirm2, 20)
  600. .widthIs(SCREEN_WIDTH)
  601. .heightIs(20);
  602. unitname.hidden = YES;
  603. UnitnameTextField.hidden = YES;
  604. contactsTextField.hidden = YES;
  605. contacts.hidden = YES;
  606. line2.hidden = YES;
  607. confirm2.hidden = YES;
  608. protocolRuleBar2.hidden = YES;
  609. }
  610. #pragma mark - UITableView Delegate
  611. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  612. return 1;
  613. }
  614. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  615. return dataArray.count;
  616. }
  617. - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  618. static NSString *Cell = @"Cell";
  619. NewRegistCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell];
  620. if (cell == nil) {
  621. cell = [[NewRegistCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cell];
  622. }
  623. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//(这种是没有点击后的阴影效果)
  624. cell.image.image = NewImageNamed(dataArray[indexPath.row][@"imageKey"]);
  625. cell.title.text = dataArray[indexPath.row][@"nameKey"];
  626. if (passWord2TextField == nil) {
  627. //获取验证码frame
  628. float vcwidth = 66;
  629. float vcheight = cell.height-20;
  630. float vcx = SCREEN_WIDTH-vcwidth-20;
  631. float vcy = 10;
  632. UITextField *textField;
  633. [cell.contentView addSubview:textField = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:NewGrayColor placeholder:dataArray[indexPath.row][@"placeholderKey"] hidden:NO tag:100+(int)indexPath.row font:NewFont(fitScreenWidth(13)) textAlignment:NSTextAlignmentLeft clearButtonMode:NO clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeDefault returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]];
  634. [textField addTarget:self action:@selector(textFieldEditingChanged:) forControlEvents:UIControlEventEditingChanged];
  635. textField.sd_layout
  636. .leftSpaceToView(cell.contentView, 110)
  637. .heightIs(fitScreenWidth(25))
  638. .centerYEqualToView(cell.title)
  639. .rightSpaceToView(cell.contentView, 30);
  640. if (indexPath.row == 0) {
  641. cell.areacode.hidden = NO;
  642. }else{
  643. cell.areacode.hidden = YES;
  644. }
  645. if (indexPath.row==0) {
  646. phoneTextField = textField;
  647. textField.sd_layout
  648. .leftSpaceToView(cell.contentView, 140)
  649. .heightIs(fitScreenWidth(25))
  650. .centerYEqualToView(cell.title)
  651. .rightSpaceToView(cell.contentView, 30);
  652. [textField setKeyboardType:UIKeyboardTypeNumberPad];
  653. }else if (indexPath.row==1) {
  654. verificationCodeTextField = textField;
  655. [cell.contentView addSubview:verificationCodeButton = [NewControlPackage buttonInitWithTitle:@"获取验证码" Frame:CGRectMake(vcx, vcy, vcwidth, vcheight) backgroundImage:nil backgroundImageHighlighted:nil backgroundColor:NewLightGrayColor textColor:NewWhiteColor textAlignment:UIControlContentHorizontalAlignmentCenter font:NewFont(fitScreenWidth(11)) tag:99 target:self action:@selector(touchVerificationCode:) hidden:NO userInteractionEnabled:YES]];
  656. // ViewRadius(verificationCodeButton, 10);
  657. verificationCodeButton.sd_layout
  658. .rightSpaceToView(cell.contentView, 30)
  659. .heightIs(fitScreenWidth(25))
  660. .bottomSpaceToView(cell.contentView, 5)
  661. .widthIs(fitScreenWidth(66));
  662. }else if (indexPath.row==2) {
  663. passWord1TextField = textField;
  664. [passWord1TextField setSecureTextEntry:YES];
  665. }else if (indexPath.row==3) {
  666. passWord2TextField = textField;
  667. [passWord2TextField setSecureTextEntry:YES];
  668. }
  669. }
  670. return cell;
  671. }
  672. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  673. {
  674. return fitScreenWidth(44);
  675. }
  676. #pragma mark - 作字符输入限制
  677. - (void)textFieldEditingChanged:(UITextField *)textField
  678. {
  679. /*
  680. @property (strong ,nonatomic) UITextField * account;
  681. @property (strong ,nonatomic) UITextField * iphoneNumber;
  682. @property (strong ,nonatomic) UITextField * yanzhenma;
  683. @property (strong ,nonatomic) UITextField * Customer;
  684. @property (strong ,nonatomic) UITextField * password;
  685. @property (strong ,nonatomic) UITextField * querenpassword;
  686. */
  687. if (textField == self.iphoneNumber) {
  688. if ([textField.text length]>11) {
  689. textField.text=[textField.text substringToIndex:11];//手机号码11位
  690. }
  691. }else if (textField == self.yanzhenma) {
  692. if ([textField.text length]>6) {
  693. textField.text=[textField.text substringToIndex:6];//验证码4位
  694. }
  695. }else if (textField == self.account) {
  696. if ([textField.text length]>6) {
  697. textField.text=[textField.text substringToIndex:6];//用户名
  698. }
  699. }else if (textField == self.password) {
  700. if ([textField.text length]>20) {
  701. textField.text=[textField.text substringToIndex:20];//第一次密码最多20位
  702. }
  703. }else if (textField == self.querenpassword) {
  704. if ([textField.text length]>20) {
  705. textField.text=[textField.text substringToIndex:20];//第二次密码最多20位
  706. }
  707. }else if (textField == self.Customer){
  708. if ([textField.text length]>6) {
  709. textField.text=[textField.text substringToIndex:6];//客户名称
  710. }
  711. }
  712. }
  713. #pragma mark - 获取验证码
  714. - (void)touchVerificationCode:(UIButton *)sender
  715. {
  716. if (![self verification:@"校验手机号"]) {
  717. return;
  718. }
  719. [MBProgressHUD showLoadToView:self.view title:@"请稍后..."];
  720. NSMutableDictionary *parameters = NewMutableDictionaryInit;
  721. [parameters safeSetObject:self.iphoneNumber.text forKey:@"mobile"];//手机号码
  722. [NetworkRequestManager requestGetWithInterfacePrefix:JT_getAppMCode parameters:parameters onSuccess:^(id requestdict) {
  723. [MBProgressHUD hideHUDForView:self.view];
  724. if ([requestdict[@"error"] count] !=0) {
  725. for (NSDictionary *dic in requestdict[@"error"]) {
  726. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  727. verificationCodeButton.sd_layout
  728. .widthIs(fitScreenWidth(66));
  729. }
  730. }else{
  731. verificationCodeButton.sd_layout
  732. .widthIs(fitScreenWidth(100));
  733. [MBProgressHUD showSuccess:@"短信已发送" toView:self.view];
  734. sender.frame = CGRectMake(sender.left, sender.top, 80, sender.height);
  735. [self verificationCode:60 sender:sender];
  736. }
  737. } onFailure:^{
  738. [MBProgressHUD hideHUDForView:self.view];
  739. }];
  740. }
  741. - (void)verificationCode:(NSInteger)code sender:(UIButton *)sender{
  742. NSString *str=[NSString stringWithFormat:@"%d秒后重新发送",(int)code];
  743. [sender setTitle:str forState:UIControlStateNormal];
  744. sender.enabled=NO;
  745. if (code==0) {
  746. sender.enabled=YES;
  747. [sender setTitle:@"获取验证码" forState:UIControlStateNormal];
  748. sender.frame = CGRectMake(sender.left, sender.top, 66, sender.height);
  749. return;
  750. }
  751. code--;
  752. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  753. [self verificationCode:code sender:sender];
  754. });
  755. }
  756. #pragma mark - 注册按钮
  757. - (void)touchConfirm
  758. {
  759. NSMutableDictionary *parameters = NewMutableDictionaryInit;
  760. if (!isProtocolRule) {
  761. [self.view makeToast:@"请同意勾选用户协议" duration:1.0 position:CSToastPositionCenter];
  762. return;
  763. }
  764. if (self.iphoneNumber.text.length<=0 || self.iphoneNumber.text.length < 11) {
  765. [MBProgressHUD showError:@"请填写正确的手机号码" toView:self.view];
  766. return;
  767. }else if (self.password.text.length<=0 || self.password.text.length<6){
  768. [MBProgressHUD showError:@"请填写密码,密码长度且大于6位数" toView:self.view];
  769. return;
  770. }else{
  771. [MBProgressHUD showSuccess:@"恭喜您,注册成功!入驻发布信息,请联系平台管理员激活账户" toView:self.view];
  772. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  773. NewPopViewController;
  774. });
  775. }
  776. return;
  777. // if (![self verification:@"个人注册"]) {
  778. // return;
  779. // }
  780. // if ([yonghutype isEqualToString:@"请选择用户类型"]) {
  781. // [MBProgressHUD showError:@"请先选择用户类型" toView:self.view];
  782. // return;
  783. // }
  784. [MBProgressHUD showLoadToView:self.view title:@"请稍后..."];
  785. [parameters safeSetObject:self.iphoneNumber.text forKey:@"mobile"];//手机号
  786. [parameters safeSetObject:self.password.text forKey:@"password"];//密码
  787. [parameters safeSetObject:self.yanzhenma.text forKey:@"mobileCode"];//短信验证码
  788. [parameters safeSetObject:@"" forKey:@"unitName"];//客户名称
  789. // if ([yonghutype isEqualToString:@"个人"]) {
  790. [parameters safeSetObject:@"0" forKey:@"type"];//
  791. // }else if ([yonghutype isEqualToString:@"企业"]){
  792. // [parameters safeSetObject:@"1" forKey:@"type"];//您的姓名
  793. // }
  794. [parameters safeSetObject:self.querenpassword.text forKey:@"beInviteCode"];//邀请码
  795. [NetworkRequestManager requestPostWithInterfacePrefix:JT_register parameters:parameters onSuccess:^(id requestData) {
  796. [MBProgressHUD hideHUDForView:self.view];
  797. if ([requestData[@"error"] count] !=0) {
  798. for (NSDictionary *dic in requestData[@"error"]) {
  799. [MBProgressHUD showError:dic[@"message"] toView:self.view];
  800. }
  801. }else{
  802. [MBProgressHUD showSuccess:@"注册成功" toView:self.view];
  803. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  804. NewPopViewController;
  805. });
  806. }
  807. } onFailure:^{
  808. [MBProgressHUD hideHUDForView:self.view];
  809. }];
  810. };
  811. - (BOOL)verification:(NSString *)status
  812. {
  813. if ([status isEqualToString:@"校验手机号"]) {
  814. if (self.iphoneNumber.text.length <= 0) {
  815. [self.view makeToast:@"请输入手机号码" duration:1.0 position:CSToastPositionCenter];
  816. return NO;
  817. }else if (self.iphoneNumber.text.length < 11){
  818. [self.view makeToast:@"手机号码输入有误" duration:1.0 position:CSToastPositionCenter];
  819. return NO;
  820. }
  821. }else if([status isEqualToString:@"个人注册"]){
  822. if (self.iphoneNumber.text.length < 11) {
  823. [self.view makeToast:@"手机号码输入有误" duration:1.5 position:CSToastPositionCenter];
  824. return NO;
  825. }
  826. if (self.yanzhenma.text.length <= 0) {
  827. [self.view makeToast:@"验证码输入有误" duration:1.5 position:CSToastPositionCenter];
  828. return NO;
  829. }
  830. if (self.Customer.text.length<=0) {
  831. [self.view makeToast:@"客户名称输入有误" duration:1.5 position:CSToastPositionCenter];
  832. return NO;
  833. }
  834. if (self.password.text.length<6||self.querenpassword.text.length<6) {
  835. [self.view makeToast:@"新密码不能少于6位数" duration:1.5 position:CSToastPositionCenter];
  836. return NO;
  837. }
  838. if (self.password.text.length < 6) {
  839. [self.view makeToast:@"新密码输入有误" duration:1.5 position:CSToastPositionCenter];
  840. return NO;
  841. }
  842. if (self.querenpassword.text.length < 6) {
  843. [self.view makeToast:@"确认新密码输入有误" duration:1.5 position:CSToastPositionCenter];
  844. return NO;
  845. }
  846. if (![self.password.text isEqualToString:self.querenpassword.text]) {
  847. [self.view makeToast:@"设置密码和确认密码不同" duration:1.5 position:CSToastPositionCenter];
  848. return NO;
  849. }
  850. // if (self.account.text.length<=0) {
  851. // [self.view makeToast:@"用户名输入有误" duration:1.5 position:CSToastPositionCenter];
  852. // return NO;
  853. // }
  854. }
  855. return YES;
  856. }
  857. #pragma mark ---- 点击个人或企业按钮------
  858. - (void)personalBTclick:(UIButton *)sender {
  859. if (sender != selectedBtn)
  860. {
  861. selectedBtn.selected = NO;
  862. selectedBtn = sender;
  863. }
  864. selectedBtn.selected = YES;
  865. NSLog(@"%ld",sender.tag);
  866. if (sender.tag == 100) {
  867. NSLog(@"个人");
  868. type = @"0";
  869. unitname.hidden = YES;
  870. UnitnameTextField.hidden = YES;
  871. mynametextField.hidden = NO;
  872. contactsTextField.hidden = YES;
  873. contacts.hidden = YES;
  874. line2.hidden = YES;
  875. //注册按钮
  876. confirm.hidden = NO;
  877. confirm2.hidden = YES;
  878. //勾选协议按钮
  879. protocolRuleBar.hidden = NO;
  880. protocolRuleBar2.hidden = YES;
  881. }else{
  882. NSLog(@"企业");
  883. type = @"1";
  884. unitname.hidden = NO;
  885. UnitnameTextField.hidden = NO;
  886. mynametextField.hidden = YES;
  887. contactsTextField.hidden = NO;
  888. contacts.hidden = NO;
  889. line2.hidden = NO;
  890. //注册按钮
  891. confirm.hidden = YES;
  892. confirm2.hidden = NO;
  893. //勾选协议按钮
  894. protocolRuleBar.hidden = YES;
  895. protocolRuleBar2.hidden = NO;
  896. }
  897. }
  898. #pragma mark ---- 点击注册协议勾选按钮 ------
  899. - (void)registrationBTclick:(UIButton *)sender {
  900. if (sender.tag == 155) {
  901. sender.selected = !sender.selected;
  902. if (!sender.selected) {
  903. NSLog(@"同意协议");
  904. isProtocolRule = YES;
  905. }else {
  906. NSLog(@"不同意协议");
  907. isProtocolRule = NO;
  908. }
  909. }else if (sender.tag == 156) {
  910. NSLog(@"点击协议规则");
  911. NewInitWithName(AgreementViewController, vc);
  912. vc.str = @"注册协议";
  913. NewPushViewController(vc);
  914. }
  915. }
  916. - (void)fanhuiBTclick:(UIButton *)sender {
  917. NewPopViewController;
  918. }
  919. -(void)yhbuttoncilck
  920. {
  921. UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:@"用户类型" message:@"请选择用户类型" preferredStyle:UIAlertControllerStyleActionSheet];
  922. // 创建action,这里action1只是方便编写,以后再编程的过程中还是以命名规范为主
  923. UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"个人" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  924. yonghutype = @"个人";
  925. [_yhtypeStr setTitle:yonghutype forState:UIControlStateNormal];
  926. }];
  927. UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"企业" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  928. yonghutype = @"企业";
  929. [_yhtypeStr setTitle:yonghutype forState:UIControlStateNormal];
  930. }];
  931. UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  932. }];
  933. //把action添加到actionSheet里
  934. [actionSheet addAction:action1];
  935. [actionSheet addAction:action2];
  936. [actionSheet addAction:action3];
  937. //相当于之前的[actionSheet show];
  938. [self presentViewController:actionSheet animated:YES completion:nil];
  939. }
  940. - (void)didReceiveMemoryWarning {
  941. [super didReceiveMemoryWarning];
  942. // Dispose of any resources that can be recreated.
  943. }
  944. /*
  945. #pragma mark - Navigation
  946. // In a storyboard-based application, you will often want to do a little preparation before navigation
  947. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  948. // Get the new view controller using [segue destinationViewController].
  949. // Pass the selected object to the new view controller.
  950. }
  951. */
  952. @end