正在显示
8 个修改的文件
包含
373 行增加
和
31 行删除
@@ -224,3 +224,31 @@ EOT; | @@ -224,3 +224,31 @@ EOT; | ||
224 | return $icon; | 224 | return $icon; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | + | ||
228 | +if (!function_exists('generateCode')) { | ||
229 | + /** | ||
230 | + * 生成n位随机数 | ||
231 | + * @param int $length | ||
232 | + * @return int | ||
233 | + */ | ||
234 | + function generateCode($length = 6) | ||
235 | + { | ||
236 | + $min = pow(10, ($length - 1)); | ||
237 | + $max = pow(10, $length) - 1; | ||
238 | + return rand($min, $max); | ||
239 | + } | ||
240 | +} | ||
241 | + | ||
242 | +if(!function_exists('send_sms2')) { | ||
243 | + function send_sms2($data){ | ||
244 | + //todo 短信账号密码 | ||
245 | + require_once EXTEND_PATH . 'nsms/nsms2.php'; | ||
246 | + $url = "https://api.mix2.zthysms.com/v2/sendSms"; | ||
247 | + $username = 'gongpinda'; | ||
248 | + $password = 'Cxz307312'; | ||
249 | + $sendAPI = new \sendAPI($url, $username, $password); | ||
250 | + $sendAPI->data = $data;/*初始化数据包*/ | ||
251 | + $return = $sendAPI->sendSMS('POST'); | ||
252 | + return $return; | ||
253 | + } | ||
254 | +} |
@@ -145,11 +145,11 @@ class Index extends Backend | @@ -145,11 +145,11 @@ class Index extends Backend | ||
145 | $this->error($validate->getError(), $url, ['token' => $this->request->token()]); | 145 | $this->error($validate->getError(), $url, ['token' => $this->request->token()]); |
146 | } | 146 | } |
147 | //根据mobile获取商户信息 | 147 | //根据mobile获取商户信息 |
148 | - $admin = Db::name('admin')->where(['mobile'=>$mobile])->find(); | 148 | + $admin = Db::name('admin')->where(['phone'=>$mobile])->find(); |
149 | if(empty($admin)){ | 149 | if(empty($admin)){ |
150 | $this->error('当前手机号尚未绑定'); | 150 | $this->error('当前手机号尚未绑定'); |
151 | } | 151 | } |
152 | - if(empty($admin['user_id'])){ | 152 | + if(empty($admin['store_id'])){ |
153 | $this->error('平台管理员忘记密码请联系总管理员'); | 153 | $this->error('平台管理员忘记密码请联系总管理员'); |
154 | } | 154 | } |
155 | if($admin['status'] != 'normal'){ | 155 | if($admin['status'] != 'normal'){ |
@@ -259,7 +259,7 @@ class Index extends Backend | @@ -259,7 +259,7 @@ class Index extends Backend | ||
259 | $str = "Bronet"; | 259 | $str = "Bronet"; |
260 | $auth_code = config('auth_code'); | 260 | $auth_code = config('auth_code'); |
261 | $token = rawurlencode(sha1(md5($str.$auth_code).md5($mobile))); | 261 | $token = rawurlencode(sha1(md5($str.$auth_code).md5($mobile))); |
262 | - $this->success('验证通过',url('reset_password',['token'=>$token,'email'=>$mobile],false,true)); | 262 | + $this->success('验证通过',url('reset_password',['token'=>$token,'mobile'=>$mobile],false,true)); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
@@ -302,9 +302,10 @@ class Index extends Backend | @@ -302,9 +302,10 @@ class Index extends Backend | ||
302 | if($token != $token2){ | 302 | if($token != $token2){ |
303 | $this->error('令牌错误','','',''); | 303 | $this->error('令牌错误','','',''); |
304 | } | 304 | } |
305 | - $admin = Db::name('admin')->where(['email'=>$mobile])->find(); | 305 | + $admin = Db::name('admin')->where(['phone'=>$mobile])->find(); |
306 | + $pwd = $password; | ||
306 | $password = md5(md5($password) . $admin['salt']); | 307 | $password = md5(md5($password) . $admin['salt']); |
307 | - $result = Db::name('admin')->where(['id'=>$admin['id']])->update(['password'=>$password]); | 308 | + $result = Db::name('admin')->where(['id'=>$admin['id']])->update(['password'=>$password,'pwd'=>$pwd]); |
308 | if(empty($result)){ | 309 | if(empty($result)){ |
309 | $this->error('sql执行失败'); | 310 | $this->error('sql执行失败'); |
310 | } | 311 | } |
@@ -296,7 +296,7 @@ | @@ -296,7 +296,7 @@ | ||
296 | 店铺名称 | 296 | 店铺名称 |
297 | </label> | 297 | </label> |
298 | <div class="col-sm-11"> | 298 | <div class="col-sm-11"> |
299 | - <input type="text" class="form-control" id="shopName" placeholder="请填写店铺名称"> | 299 | + <input type="text" class="form-control" id="shopName" placeholder="请填写店铺名称" onblur="testUserName()"> |
300 | <span id="shopNameTips" class="tipsInfo"></span> | 300 | <span id="shopNameTips" class="tipsInfo"></span> |
301 | </div> | 301 | </div> |
302 | </div> | 302 | </div> |
@@ -306,7 +306,7 @@ | @@ -306,7 +306,7 @@ | ||
306 | 公司名称 | 306 | 公司名称 |
307 | </label> | 307 | </label> |
308 | <div class="col-sm-11"> | 308 | <div class="col-sm-11"> |
309 | - <input type="text" class="form-control" id="companyName" placeholder="请填写公司名称"> | 309 | + <input type="text" class="form-control" id="companyName" placeholder="请填写公司名称" onblur="testComName()"> |
310 | <span id="companyNameTips" class="tipsInfo"></span> | 310 | <span id="companyNameTips" class="tipsInfo"></span> |
311 | </div> | 311 | </div> |
312 | </div> | 312 | </div> |
@@ -340,7 +340,7 @@ | @@ -340,7 +340,7 @@ | ||
340 | 经营详细地址 | 340 | 经营详细地址 |
341 | </label> | 341 | </label> |
342 | <div class="col-sm-11"> | 342 | <div class="col-sm-11"> |
343 | - <input type="text" class="form-control" id="address" placeholder="请填写经营详细地址" autocomplete="off"> | 343 | + <input type="text" class="form-control" id="address" placeholder="请填写经营详细地址" autocomplete="off" onblur="testAddress()"> |
344 | <span id="shopAddressTips" class="tipsInfo"></span> | 344 | <span id="shopAddressTips" class="tipsInfo"></span> |
345 | </div> | 345 | </div> |
346 | <ul class="search_keyword"> | 346 | <ul class="search_keyword"> |
@@ -390,7 +390,7 @@ | @@ -390,7 +390,7 @@ | ||
390 | 企业联系人 | 390 | 企业联系人 |
391 | </label> | 391 | </label> |
392 | <div class="col-sm-11"> | 392 | <div class="col-sm-11"> |
393 | - <input type="text" class="form-control" id="companyContacts" placeholder="请填写企业联系人"> | 393 | + <input type="text" class="form-control" id="companyContacts" placeholder="请填写企业联系人" onblur="testCompanyContacts()"> |
394 | <span id="companyContactsTips" class="tipsInfo"></span> | 394 | <span id="companyContactsTips" class="tipsInfo"></span> |
395 | </div> | 395 | </div> |
396 | </div> | 396 | </div> |
@@ -401,7 +401,7 @@ | @@ -401,7 +401,7 @@ | ||
401 | 联系电话 | 401 | 联系电话 |
402 | </label> | 402 | </label> |
403 | <div class="col-sm-11"> | 403 | <div class="col-sm-11"> |
404 | - <input type="text" class="form-control" id="phoneNum" placeholder="请填写联系电话"> | 404 | + <input type="text" class="form-control" id="phoneNum" placeholder="请填写联系电话" onblur="testPhoneNum()"> |
405 | <span id="phoneNumTips" class="tipsInfo"></span> | 405 | <span id="phoneNumTips" class="tipsInfo"></span> |
406 | </div> | 406 | </div> |
407 | </div> | 407 | </div> |
@@ -436,7 +436,7 @@ | @@ -436,7 +436,7 @@ | ||
436 | <div class="form-group agreementBox"> | 436 | <div class="form-group agreementBox"> |
437 | <div class="col-sm-12"> | 437 | <div class="col-sm-12"> |
438 | <img id="radio" src="__CDN__/assets/store/images/radioUnSelect.png" alt="radio" onclick="changeRadioState()"> | 438 | <img id="radio" src="__CDN__/assets/store/images/radioUnSelect.png" alt="radio" onclick="changeRadioState()"> |
439 | - <p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a></p> | 439 | + <p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a><span id="checkboxTips" style="position: inherit;" class="tipsInfo"></span></p> |
440 | </div> | 440 | </div> |
441 | </div> | 441 | </div> |
442 | 442 | ||
@@ -710,6 +710,72 @@ | @@ -710,6 +710,72 @@ | ||
710 | var radioFlag = false;//同意入驻协议标识 | 710 | var radioFlag = false;//同意入驻协议标识 |
711 | var idCardImgFileArr = []; | 711 | var idCardImgFileArr = []; |
712 | 712 | ||
713 | + //校验店铺名称 | ||
714 | + function testUserName() { | ||
715 | + var contactsName = $('#shopName').val(); | ||
716 | + if(contactsName.trim() == ''){ | ||
717 | + $('#shopNameTips').html('请填写店铺名称'); | ||
718 | + return false; | ||
719 | + } | ||
720 | + $('#shopNameTips').html(''); | ||
721 | + return true; | ||
722 | + } | ||
723 | + | ||
724 | + //校验公司名称 | ||
725 | + function testComName() { | ||
726 | + var contactsName = $('#companyName').val(); | ||
727 | + if(contactsName.trim() == ''){ | ||
728 | + $('#companyNameTips').html('请填写公司名称'); | ||
729 | + return false; | ||
730 | + } | ||
731 | + $('#companyNameTips').html(''); | ||
732 | + return true; | ||
733 | + } | ||
734 | + | ||
735 | + //校验三证合一照片 | ||
736 | + function testIDCardPhoto() { | ||
737 | + if(idCardImgFileArr.length == 0){ | ||
738 | + $('#licensePhotoTips').html('请上传三证合一照片'); | ||
739 | + return false; | ||
740 | + } | ||
741 | + $('#licensePhotoTips').html(''); | ||
742 | + return true; | ||
743 | + } | ||
744 | + | ||
745 | + //校验经营详细地址 | ||
746 | + function testAddress() { | ||
747 | + var address = $('#address').val(); | ||
748 | + if(address.trim() == ''){ | ||
749 | + $('#shopAddressTips').html('请填写经营详细地址'); | ||
750 | + return false; | ||
751 | + } | ||
752 | + $('#shopAddressTips').html(''); | ||
753 | + return true; | ||
754 | + } | ||
755 | + | ||
756 | + //校验企业联系人姓名 | ||
757 | + function testCompanyContacts() { | ||
758 | + var contactsName = $('#companyContacts').val(); | ||
759 | + if(contactsName.trim() == ''){ | ||
760 | + $('#companyContactsTips').html('请填写企业联系人'); | ||
761 | + return false; | ||
762 | + } | ||
763 | + $('#companyContactsTips').html(''); | ||
764 | + return true; | ||
765 | + } | ||
766 | + | ||
767 | + //校验手机号 | ||
768 | + function testPhoneNum() { | ||
769 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
770 | + var phoneNum = $('#phoneNum').val(); | ||
771 | + if(!reg.test(phoneNum)){ | ||
772 | + $('#phoneNumTips').html('请填写正确的联系电话'); | ||
773 | + return false; | ||
774 | + } | ||
775 | + $('#phoneNumTips').html(''); | ||
776 | + return true; | ||
777 | + } | ||
778 | + | ||
713 | //校验三证合一照片 | 779 | //校验三证合一照片 |
714 | function testIDCardPhoto() { | 780 | function testIDCardPhoto() { |
715 | if(idCardImgFileArr.length == 0){ | 781 | if(idCardImgFileArr.length == 0){ |
@@ -720,6 +786,14 @@ | @@ -720,6 +786,14 @@ | ||
720 | return true; | 786 | return true; |
721 | } | 787 | } |
722 | 788 | ||
789 | + function testRadioFlag(){ | ||
790 | + if(radioFlag == false){ | ||
791 | + $('#checkboxTips').html('请确认用户协议'); | ||
792 | + return false; | ||
793 | + } | ||
794 | + $('#checkboxTips').html(''); | ||
795 | + } | ||
796 | + | ||
723 | //供应商入驻协议 | 797 | //供应商入驻协议 |
724 | function supplierAgreement() { | 798 | function supplierAgreement() { |
725 | $('#agreementModal').modal(); | 799 | $('#agreementModal').modal(); |
@@ -727,6 +801,12 @@ | @@ -727,6 +801,12 @@ | ||
727 | 801 | ||
728 | //申请入驻 | 802 | //申请入驻 |
729 | function applySettledIn() { | 803 | function applySettledIn() { |
804 | + testUserName(); | ||
805 | + testComName(); | ||
806 | + testAddress(); | ||
807 | + testCompanyContacts(); | ||
808 | + testPhoneNum(); | ||
809 | + testRadioFlag(); | ||
730 | var idCardBox_length = $('#idCardBox').parent().prev().find('.imagesItem').length; | 810 | var idCardBox_length = $('#idCardBox').parent().prev().find('.imagesItem').length; |
731 | console.log(idCardBox_length); | 811 | console.log(idCardBox_length); |
732 | var name = $('#shopName').val();//店铺名称 | 812 | var name = $('#shopName').val();//店铺名称 |
@@ -352,7 +352,7 @@ | @@ -352,7 +352,7 @@ | ||
352 | 联系人姓名 | 352 | 联系人姓名 |
353 | </label> | 353 | </label> |
354 | <div class="col-sm-11"> | 354 | <div class="col-sm-11"> |
355 | - <input type="text" class="form-control" id="contactsName" placeholder="请输入联系人姓名"> | 355 | + <input type="text" class="form-control" id="contactsName" placeholder="请输入联系人姓名" onblur="testUserName()"> |
356 | <span id="contactsNameTips" class="tipsInfo"></span> | 356 | <span id="contactsNameTips" class="tipsInfo"></span> |
357 | </div> | 357 | </div> |
358 | </div> | 358 | </div> |
@@ -362,7 +362,7 @@ | @@ -362,7 +362,7 @@ | ||
362 | 身份证号 | 362 | 身份证号 |
363 | </label> | 363 | </label> |
364 | <div class="col-sm-11"> | 364 | <div class="col-sm-11"> |
365 | - <input type="text" class="form-control" id="idCardNum" placeholder="请输入身份证号"> | 365 | + <input type="text" class="form-control" id="idCardNum" placeholder="请输入身份证号" onblur="testIDCardNum()"> |
366 | <span id="idCardNumTips" class="tipsInfo"></span> | 366 | <span id="idCardNumTips" class="tipsInfo"></span> |
367 | </div> | 367 | </div> |
368 | </div> | 368 | </div> |
@@ -392,7 +392,7 @@ | @@ -392,7 +392,7 @@ | ||
392 | 联系人电话 | 392 | 联系人电话 |
393 | </label> | 393 | </label> |
394 | <div class="col-sm-11"> | 394 | <div class="col-sm-11"> |
395 | - <input type="text" class="form-control" id="phoneNum" placeholder="请输入联系人电话"> | 395 | + <input type="text" class="form-control" id="phoneNum" placeholder="请输入联系人电话" onblur="testPhoneNum()"> |
396 | <span id="phoneNumTips" class="tipsInfo"></span> | 396 | <span id="phoneNumTips" class="tipsInfo"></span> |
397 | </div> | 397 | </div> |
398 | </div> | 398 | </div> |
@@ -416,7 +416,7 @@ | @@ -416,7 +416,7 @@ | ||
416 | 联系人地址 | 416 | 联系人地址 |
417 | </label> | 417 | </label> |
418 | <div class="col-sm-11" style="position: relative"> | 418 | <div class="col-sm-11" style="position: relative"> |
419 | - <input type="text" class="form-control" id="address" placeholder="请输入联系人地址" autocomplete="off"> | 419 | + <input type="text" class="form-control" id="address" placeholder="请输入联系人地址" autocomplete="off" onblur="testAddress()"> |
420 | <span id="addressTips" class="tipsInfo"></span> | 420 | <span id="addressTips" class="tipsInfo"></span> |
421 | </div> | 421 | </div> |
422 | <ul class="search_keyword"> | 422 | <ul class="search_keyword"> |
@@ -475,7 +475,8 @@ | @@ -475,7 +475,8 @@ | ||
475 | <div class="col-sm-12"> | 475 | <div class="col-sm-12"> |
476 | <img id="radio" src="__CDN__/assets/store/images/radioUnSelect.png" alt="radio" | 476 | <img id="radio" src="__CDN__/assets/store/images/radioUnSelect.png" alt="radio" |
477 | onclick="changeRadioState()"> | 477 | onclick="changeRadioState()"> |
478 | - <p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a></p> | 478 | + <p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a><span id="checkboxTips" style="position: inherit;" class="tipsInfo"></span></p> |
479 | + | ||
479 | </div> | 480 | </div> |
480 | </div> | 481 | </div> |
481 | 482 | ||
@@ -514,6 +515,61 @@ | @@ -514,6 +515,61 @@ | ||
514 | var idCardImgFileArr = []; | 515 | var idCardImgFileArr = []; |
515 | var handIDCardImgFileArr = []; | 516 | var handIDCardImgFileArr = []; |
516 | 517 | ||
518 | + //校验用户名 | ||
519 | + function testUserName() { | ||
520 | + var contactsName = $('#contactsName').val(); | ||
521 | + if(contactsName.trim() == ''){ | ||
522 | + $('#contactsNameTips').html('请输入联系人姓名'); | ||
523 | + return false; | ||
524 | + } | ||
525 | + $('#contactsNameTips').html(''); | ||
526 | + return true; | ||
527 | + } | ||
528 | + | ||
529 | + //校验身份证号 | ||
530 | + function testIDCardNum() { | ||
531 | + // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X | ||
532 | + var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; | ||
533 | + var IDCardNum = $('#idCardNum').val(); | ||
534 | + if(!reg.test(IDCardNum)){ | ||
535 | + $('#idCardNumTips').html('请输入正确的身份证号'); | ||
536 | + return false; | ||
537 | + } | ||
538 | + $('#idCardNumTips').html(''); | ||
539 | + return true; | ||
540 | + } | ||
541 | + | ||
542 | + //校验手机号 | ||
543 | + function testPhoneNum() { | ||
544 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
545 | + var phoneNum = $('#phoneNum').val(); | ||
546 | + if(!reg.test(phoneNum)){ | ||
547 | + $('#phoneNumTips').html('请输入正确的联系人电话'); | ||
548 | + return false; | ||
549 | + } | ||
550 | + $('#phoneNumTips').html(''); | ||
551 | + return true; | ||
552 | + } | ||
553 | + | ||
554 | + //校验地址 | ||
555 | + function testAddress() { | ||
556 | + var address = $('#address').val(); | ||
557 | + if(address.trim() == ''){ | ||
558 | + $('#addressTips').html('请输入联系人地址'); | ||
559 | + return false; | ||
560 | + } | ||
561 | + $('#addressTips').html(''); | ||
562 | + return true; | ||
563 | + } | ||
564 | + | ||
565 | + function testRadioFlag(){ | ||
566 | + if(radioFlag == false){ | ||
567 | + $('#checkboxTips').html('请确认用户协议'); | ||
568 | + return false; | ||
569 | + } | ||
570 | + $('#checkboxTips').html(''); | ||
571 | + } | ||
572 | + | ||
517 | //供应商入驻协议 | 573 | //供应商入驻协议 |
518 | function supplierAgreement() { | 574 | function supplierAgreement() { |
519 | $('#agreementModal').modal(); | 575 | $('#agreementModal').modal(); |
@@ -521,6 +577,11 @@ | @@ -521,6 +577,11 @@ | ||
521 | 577 | ||
522 | //申请入驻 | 578 | //申请入驻 |
523 | function applySettledIn() { | 579 | function applySettledIn() { |
580 | + testUserName(); | ||
581 | + testIDCardNum(); | ||
582 | + testPhoneNum(); | ||
583 | + testAddress(); | ||
584 | + testRadioFlag(); | ||
524 | var idCardBox_length = $('#idCardBox').parent().prev().find('.imagesItem').length; | 585 | var idCardBox_length = $('#idCardBox').parent().prev().find('.imagesItem').length; |
525 | console.log(idCardBox_length); | 586 | console.log(idCardBox_length); |
526 | var handIDCardPhotoBox_length = $('#handIDCardPhotoBox').parent().prev().find('.imagesItem').length; | 587 | var handIDCardPhotoBox_length = $('#handIDCardPhotoBox').parent().prev().find('.imagesItem').length; |
@@ -144,18 +144,18 @@ | @@ -144,18 +144,18 @@ | ||
144 | <div class="formBox formBox"> | 144 | <div class="formBox formBox"> |
145 | <form> | 145 | <form> |
146 | <div class="form-group"> | 146 | <div class="form-group"> |
147 | - <input type="text" class="form-control" id="phoneNum" placeholder="手机号"> | 147 | + <input type="text" class="form-control" id="phoneNum" placeholder="手机号" onblur="testPhoneNum()"> |
148 | <span id="phoneNumTips" class="tipsInfo"></span> | 148 | <span id="phoneNumTips" class="tipsInfo"></span> |
149 | </div> | 149 | </div> |
150 | 150 | ||
151 | <div class="form-group"> | 151 | <div class="form-group"> |
152 | - <input type="text" class="form-control" id="verificationCode" placeholder="请输入图形验证码"> | 152 | + <input type="text" class="form-control" id="verificationCode" placeholder="请输入图形验证码" onblur="testImgCode()"> |
153 | <span id="imgCodeTips" class="tipsInfo"></span> | 153 | <span id="imgCodeTips" class="tipsInfo"></span> |
154 | <img src="{:captcha_src()}" alt="captcha" id="codeImg" onclick="this.src='{:captcha_src()}'"> | 154 | <img src="{:captcha_src()}" alt="captcha" id="codeImg" onclick="this.src='{:captcha_src()}'"> |
155 | </div> | 155 | </div> |
156 | 156 | ||
157 | <div class="form-group"> | 157 | <div class="form-group"> |
158 | - <input type="text" class="form-control" id="msgCode" placeholder="请输入短信验证码"> | 158 | + <input type="text" class="form-control" id="msgCode" placeholder="请输入短信验证码" onblur="testCode()"> |
159 | <span id="msgCodeTips" class="tipsInfo"></span> | 159 | <span id="msgCodeTips" class="tipsInfo"></span> |
160 | <span class="input-group-btn"> | 160 | <span class="input-group-btn"> |
161 | <span class="input-group-btn"> | 161 | <span class="input-group-btn"> |
@@ -176,11 +176,11 @@ | @@ -176,11 +176,11 @@ | ||
176 | <div class="formBox"> | 176 | <div class="formBox"> |
177 | <form> | 177 | <form> |
178 | <div class="form-group"> | 178 | <div class="form-group"> |
179 | - <input type="password" class="form-control" id="newPsw" placeholder="请输入新密码"> | 179 | + <input type="password" class="form-control" id="newPsw" placeholder="请输入新密码" onblur="testNewPsw()"> |
180 | <span id="newPswTips" class="tipsInfo"></span> | 180 | <span id="newPswTips" class="tipsInfo"></span> |
181 | </div> | 181 | </div> |
182 | <div class="form-group"> | 182 | <div class="form-group"> |
183 | - <input type="password" class="form-control" id="repeatNewPsw" placeholder="重复新密码"> | 183 | + <input type="password" class="form-control" id="repeatNewPsw" placeholder="重复新密码" onblur="testRepeatNewPsw()"> |
184 | <span id="repeatNewPswTips" class="tipsInfo"></span> | 184 | <span id="repeatNewPswTips" class="tipsInfo"></span> |
185 | </div> | 185 | </div> |
186 | <button type="button" class="btn btn-submit" onclick="confirm()">确认</button> | 186 | <button type="button" class="btn btn-submit" onclick="confirm()">确认</button> |
@@ -193,8 +193,42 @@ | @@ -193,8 +193,42 @@ | ||
193 | {include file="public/js"/} | 193 | {include file="public/js"/} |
194 | <script> | 194 | <script> |
195 | var interval; | 195 | var interval; |
196 | + //校验手机号 | ||
197 | + function testPhoneNum() { | ||
198 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
199 | + var phoneNum = $('#phoneNum').val(); | ||
200 | + if(!reg.test(phoneNum)){ | ||
201 | + $('#phoneNumTips').html('请输入正确的手机号码'); | ||
202 | + return false; | ||
203 | + } | ||
204 | + $('#phoneNumTips').html(''); | ||
205 | + return true; | ||
206 | + } | ||
207 | + | ||
208 | + //校验图形验证码 | ||
209 | + function testImgCode() { | ||
210 | + if($('#verificationCode').val().trim() == ''){ | ||
211 | + $('#imgCodeTips').html('请输入图形验证码'); | ||
212 | + return false; | ||
213 | + } | ||
214 | + $('#imgCodeTips').html(''); | ||
215 | + return true; | ||
216 | + } | ||
217 | + | ||
218 | + //校验短信验证码 | ||
219 | + function testCode() { | ||
220 | + if($('#msgCode').val().trim() == ''){ | ||
221 | + $('#msgCodeTips').html('请输入短信验证码'); | ||
222 | + return false; | ||
223 | + } | ||
224 | + $('#msgCodeTips').html(''); | ||
225 | + return true; | ||
226 | + } | ||
227 | + | ||
196 | //发送短信验证码 | 228 | //发送短信验证码 |
197 | function sendMsg() { | 229 | function sendMsg() { |
230 | + testPhoneNum(); | ||
231 | + testImgCode(); | ||
198 | var mobile = $('#phoneNum').val(); | 232 | var mobile = $('#phoneNum').val(); |
199 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 233 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
200 | var verificationCode = $('#verificationCode').val(); | 234 | var verificationCode = $('#verificationCode').val(); |
@@ -240,6 +274,8 @@ | @@ -240,6 +274,8 @@ | ||
240 | 274 | ||
241 | //下一步 | 275 | //下一步 |
242 | function next() { | 276 | function next() { |
277 | + testPhoneNum(); | ||
278 | + testCode(); | ||
243 | var mobile = $('#phoneNum').val(); | 279 | var mobile = $('#phoneNum').val(); |
244 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 280 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
245 | var code = $('#msgCode').val(); | 281 | var code = $('#msgCode').val(); |
@@ -271,8 +307,41 @@ | @@ -271,8 +307,41 @@ | ||
271 | } | 307 | } |
272 | }); | 308 | }); |
273 | } | 309 | } |
310 | + | ||
311 | + //校验新密码 | ||
312 | + function testNewPsw() { | ||
313 | + var psw_test = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/; | ||
314 | + var psw = $('#newPsw').val(); | ||
315 | + if(psw.trim() == ''){ | ||
316 | + $('#newPswTips').html('请输入新密码'); | ||
317 | + return false; | ||
318 | + }else if(!psw_test.test(psw)){ | ||
319 | + $('#newPswTips').html('至少8个字符,包括1个大写字母,1个小写字母和1个数字'); | ||
320 | + return false; | ||
321 | + } | ||
322 | + $('#newPswTips').html(''); | ||
323 | + return true; | ||
324 | + } | ||
325 | + | ||
326 | + //校验重复新密码 | ||
327 | + function testRepeatNewPsw() { | ||
328 | + if($('#repeatNewPsw').val().trim() == ''){ | ||
329 | + $('#repeatNewPswTips').html('请重复输入新密码'); | ||
330 | + return false; | ||
331 | + } | ||
332 | + if($('#newPsw').val() != $('#repeatNewPsw').val()){ | ||
333 | + $('#repeatNewPswTips').html('两次密码不一致'); | ||
334 | + return false; | ||
335 | + } | ||
336 | + $('#repeatNewPswTips').html(''); | ||
337 | + return true; | ||
338 | + } | ||
274 | //确认修改新密码 | 339 | //确认修改新密码 |
275 | function confirm() { | 340 | function confirm() { |
341 | + testPhoneNum(); | ||
342 | + testCode(); | ||
343 | + testNewPsw(); | ||
344 | + testRepeatNewPsw(); | ||
276 | var mobile = $('#phoneNum').val(); | 345 | var mobile = $('#phoneNum').val(); |
277 | var newPsw = $('#newPsw').val(); | 346 | var newPsw = $('#newPsw').val(); |
278 | var repeatNewPsw = $('#repeatNewPsw').val(); | 347 | var repeatNewPsw = $('#repeatNewPsw').val(); |
@@ -197,11 +197,11 @@ | @@ -197,11 +197,11 @@ | ||
197 | <div class="formBox msgFormBox"> | 197 | <div class="formBox msgFormBox"> |
198 | <form> | 198 | <form> |
199 | <div class="form-group"> | 199 | <div class="form-group"> |
200 | - <input type="text" class="form-control" id="phoneNum" placeholder="手机号"> | 200 | + <input type="text" class="form-control" id="phoneNum" placeholder="手机号" onblur="testPhoneNum()"> |
201 | <span id="phoneNumTips1" class="tipsInfo"></span> | 201 | <span id="phoneNumTips1" class="tipsInfo"></span> |
202 | </div> | 202 | </div> |
203 | <div class="form-group"> | 203 | <div class="form-group"> |
204 | - <input type="text" class="form-control" id="verificationCode" placeholder="请输入短信验证码"> | 204 | + <input type="text" class="form-control" id="verificationCode" placeholder="请输入短信验证码" onblur="testCode()"> |
205 | <span id="codeTips" class="tipsInfo"></span> | 205 | <span id="codeTips" class="tipsInfo"></span> |
206 | <span class="input-group-btn"> | 206 | <span class="input-group-btn"> |
207 | <button class="btn" type="button" onclick="sendMsg()"> | 207 | <button class="btn" type="button" onclick="sendMsg()"> |
@@ -218,12 +218,12 @@ | @@ -218,12 +218,12 @@ | ||
218 | <form> | 218 | <form> |
219 | <div class="form-group"> | 219 | <div class="form-group"> |
220 | <img src="__CDN__/assets/store/images/loginUser.png" alt="loginUser"> | 220 | <img src="__CDN__/assets/store/images/loginUser.png" alt="loginUser"> |
221 | - <input type="text" class="form-control" id="phoneNum2" placeholder="手机号"> | 221 | + <input type="text" class="form-control" id="phoneNum2" placeholder="手机号" onblur="pswTestPhoneNum()"> |
222 | <span id="phoneNumTips2" class="tipsInfo"></span> | 222 | <span id="phoneNumTips2" class="tipsInfo"></span> |
223 | </div> | 223 | </div> |
224 | <div class="form-group"> | 224 | <div class="form-group"> |
225 | <img src="__CDN__/assets/store/images/lock.png" alt="loginUser"> | 225 | <img src="__CDN__/assets/store/images/lock.png" alt="loginUser"> |
226 | - <input type="password" class="form-control" id="psw" placeholder="密码"> | 226 | + <input type="password" class="form-control" id="psw" placeholder="密码" onblur="pswTest()"> |
227 | <span id="pswTips" class="tipsInfo"></span> | 227 | <span id="pswTips" class="tipsInfo"></span> |
228 | </div> | 228 | </div> |
229 | <button type="button" class="btn btn-submit" onclick="loginByPsw()">登录</button> | 229 | <button type="button" class="btn btn-submit" onclick="loginByPsw()">登录</button> |
@@ -238,8 +238,32 @@ | @@ -238,8 +238,32 @@ | ||
238 | {include file="public/js"/} | 238 | {include file="public/js"/} |
239 | <script> | 239 | <script> |
240 | var interval; | 240 | var interval; |
241 | + //验证码登录校验手机号 | ||
242 | + function testPhoneNum() { | ||
243 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
244 | + var phoneNum = $('#phoneNum').val(); | ||
245 | + if(!reg.test(phoneNum)){ | ||
246 | + $('#phoneNumTips1').html('请输入正确的手机号码'); | ||
247 | + return false; | ||
248 | + } | ||
249 | + $('#phoneNumTips1').html(''); | ||
250 | + return true; | ||
251 | + } | ||
252 | + | ||
253 | + //校验验证码 | ||
254 | + function testCode() { | ||
255 | + var code = $('#verificationCode').val(); | ||
256 | + if(code.trim() == ''){ | ||
257 | + $('#codeTips').html('请输入验证码'); | ||
258 | + return false; | ||
259 | + } | ||
260 | + $('#codeTips').html(''); | ||
261 | + return true; | ||
262 | + } | ||
263 | + | ||
241 | //发送短信验证码 | 264 | //发送短信验证码 |
242 | function sendMsg() { | 265 | function sendMsg() { |
266 | + testPhoneNum(); | ||
243 | var mobile = $('#phoneNum').val(); | 267 | var mobile = $('#phoneNum').val(); |
244 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 268 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
245 | if(mobile == ''){ | 269 | if(mobile == ''){ |
@@ -279,6 +303,8 @@ | @@ -279,6 +303,8 @@ | ||
279 | 303 | ||
280 | //短信验证码登录 | 304 | //短信验证码登录 |
281 | function loginByCode() { | 305 | function loginByCode() { |
306 | + testPhoneNum(); | ||
307 | + testCode(); | ||
282 | var mobile = $('#phoneNum').val(); | 308 | var mobile = $('#phoneNum').val(); |
283 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 309 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
284 | var code = $('#verificationCode').val(); | 310 | var code = $('#verificationCode').val(); |
@@ -326,8 +352,32 @@ | @@ -326,8 +352,32 @@ | ||
326 | $('#phoneNumTips1,#phoneNumTips2').html(''); | 352 | $('#phoneNumTips1,#phoneNumTips2').html(''); |
327 | } | 353 | } |
328 | 354 | ||
355 | + //密码登录校验手机号 | ||
356 | + function pswTestPhoneNum() { | ||
357 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
358 | + var phoneNum = $('#phoneNum2').val(); | ||
359 | + if(!reg.test(phoneNum)){ | ||
360 | + $('#phoneNumTips2').html('请输入正确的手机号码'); | ||
361 | + return false; | ||
362 | + } | ||
363 | + return true; | ||
364 | + $('#phoneNumTips2').html(''); | ||
365 | + } | ||
366 | + | ||
367 | + //密码登录校验密码 | ||
368 | + function pswTest() { | ||
369 | + if($('#psw').val() == ''){ | ||
370 | + $('#pswTips').html('请输入密码'); | ||
371 | + return false; | ||
372 | + } | ||
373 | + $('#pswTips').html(''); | ||
374 | + return true; | ||
375 | + } | ||
376 | + | ||
329 | //密码登录 | 377 | //密码登录 |
330 | function loginByPsw() { | 378 | function loginByPsw() { |
379 | + pswTestPhoneNum(); | ||
380 | + pswTest(); | ||
331 | var mobile = $('#phoneNum2').val(); | 381 | var mobile = $('#phoneNum2').val(); |
332 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 382 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
333 | var password = $('#psw').val(); | 383 | var password = $('#psw').val(); |
@@ -165,17 +165,17 @@ | @@ -165,17 +165,17 @@ | ||
165 | <div class="formBox"> | 165 | <div class="formBox"> |
166 | <form> | 166 | <form> |
167 | <div class="form-group"> | 167 | <div class="form-group"> |
168 | - <input type="text" class="form-control" id="userName" placeholder="请设置用户名"> | 168 | + <input type="text" class="form-control" id="userName" placeholder="请设置用户名" onblur="testUserName()"> |
169 | <span id="userNameTips" class="tipsInfo"></span> | 169 | <span id="userNameTips" class="tipsInfo"></span> |
170 | </div> | 170 | </div> |
171 | 171 | ||
172 | <div class="form-group"> | 172 | <div class="form-group"> |
173 | - <input type="text" class="form-control" id="phoneNum" placeholder="请输入手机号"> | 173 | + <input type="text" class="form-control" id="phoneNum" placeholder="请输入手机号" onblur="testPhoneNum()"> |
174 | <span id="phoneNumTips" class="tipsInfo"></span> | 174 | <span id="phoneNumTips" class="tipsInfo"></span> |
175 | </div> | 175 | </div> |
176 | 176 | ||
177 | <div class="form-group"> | 177 | <div class="form-group"> |
178 | - <input type="text" class="form-control" id="verificationCode" placeholder="请输入验证码"> | 178 | + <input type="text" class="form-control" id="verificationCode" placeholder="请输入验证码" onblur="testVerificationCode()"> |
179 | <span id="verificationCodeTips" class="tipsInfo"></span> | 179 | <span id="verificationCodeTips" class="tipsInfo"></span> |
180 | <span class="input-group-btn"> | 180 | <span class="input-group-btn"> |
181 | <button class="btn" type="button" onclick="sendMsg()"> | 181 | <button class="btn" type="button" onclick="sendMsg()"> |
@@ -185,7 +185,7 @@ | @@ -185,7 +185,7 @@ | ||
185 | </div> | 185 | </div> |
186 | 186 | ||
187 | <div class="form-group"> | 187 | <div class="form-group"> |
188 | - <input type="password" class="form-control" id="psw" placeholder="请设置登录密码"> | 188 | + <input type="password" class="form-control" id="psw" placeholder="请设置登录密码" onblur="testPassword()"> |
189 | <span id="pswTips" class="tipsInfo"></span> | 189 | <span id="pswTips" class="tipsInfo"></span> |
190 | </div> | 190 | </div> |
191 | 191 | ||
@@ -249,10 +249,58 @@ | @@ -249,10 +249,58 @@ | ||
249 | $("#checkbox").change(function() { | 249 | $("#checkbox").change(function() { |
250 | testCheckbox(); | 250 | testCheckbox(); |
251 | }); | 251 | }); |
252 | - }) | 252 | + }); |
253 | + | ||
254 | + //校验用户名 | ||
255 | + function testUserName() { | ||
256 | + if($('#userName').val().trim() == ''){ | ||
257 | + $('#userNameTips').html('请输入用户名'); | ||
258 | + return false; | ||
259 | + } | ||
260 | + $('#userNameTips').html(''); | ||
261 | + return true; | ||
262 | + } | ||
263 | + | ||
264 | + //校验手机号 | ||
265 | + function testPhoneNum() { | ||
266 | + var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | ||
267 | + var phoneNum = $('#phoneNum').val(); | ||
268 | + if(!reg.test(phoneNum)){ | ||
269 | + $('#phoneNumTips').html('请输入正确的手机号码'); | ||
270 | + return false; | ||
271 | + } | ||
272 | + $('#phoneNumTips').html(''); | ||
273 | + return true; | ||
274 | + } | ||
275 | + | ||
276 | + //校验验证码 | ||
277 | + function testVerificationCode(){ | ||
278 | + if($('#verificationCode').val().trim() == ''){ | ||
279 | + $('#verificationCodeTips').html('请输入验证码'); | ||
280 | + return false; | ||
281 | + } | ||
282 | + $('#verificationCodeTips').html(''); | ||
283 | + return true; | ||
284 | + } | ||
285 | + | ||
286 | + //校验密码 | ||
287 | + function testPassword(){ | ||
288 | + var psw_test = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/; | ||
289 | + var psw = $('#psw').val(); | ||
290 | + if(psw.trim() == ''){ | ||
291 | + $('#pswTips').html('请输入密码'); | ||
292 | + return false; | ||
293 | + }else if(!psw_test.test(psw)){ | ||
294 | + $('#pswTips').html('至少8个字符,包括1个大写字母,1个小写字母和1个数字'); | ||
295 | + return false; | ||
296 | + } | ||
297 | + $('#pswTips').html(''); | ||
298 | + return true; | ||
299 | + } | ||
253 | 300 | ||
254 | //发送验证码 | 301 | //发送验证码 |
255 | function sendMsg() { | 302 | function sendMsg() { |
303 | + testPhoneNum(); | ||
256 | var mobile = $('#phoneNum').val(); | 304 | var mobile = $('#phoneNum').val(); |
257 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 305 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
258 | if(mobile == ''){ | 306 | if(mobile == ''){ |
@@ -303,6 +351,11 @@ | @@ -303,6 +351,11 @@ | ||
303 | 351 | ||
304 | //调用注册接口 | 352 | //调用注册接口 |
305 | function register() { | 353 | function register() { |
354 | + testUserName(); | ||
355 | + testPhoneNum(); | ||
356 | + testVerificationCode(); | ||
357 | + testPassword(); | ||
358 | + testCheckbox(); | ||
306 | var username = $('#userName').val(); | 359 | var username = $('#userName').val(); |
307 | var mobile = $('#phoneNum').val(); | 360 | var mobile = $('#phoneNum').val(); |
308 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; | 361 | var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/; |
@@ -433,7 +433,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi | @@ -433,7 +433,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi | ||
433 | $.ajax({ | 433 | $.ajax({ |
434 | url:"index/forget", | 434 | url:"index/forget", |
435 | type:"POST", | 435 | type:"POST", |
436 | - data:{'email':email}, | 436 | + data:{'mobile':mobile}, |
437 | success:function(res){ | 437 | success:function(res){ |
438 | console.log(res); | 438 | console.log(res); |
439 | if(res.code == 1){ | 439 | if(res.code == 1){ |
-
请 注册 或 登录 后发表评论