|
@@ -46,103 +46,96 @@ $(function () {
|
|
|
let oldPhoto='';
|
|
|
$('#photo').attr('disabled', true);
|
|
|
function photo1() {
|
|
|
- var pho_pattern = /^1[3|4|5|7|8][0-9]{9}$/;
|
|
|
+ var pho_pattern = /^1[2|3|4|5|6|7|8|9][0-9]{9}$/;
|
|
|
$("#usePhoto").keyup(function () {
|
|
|
oldPhoto = $(this).val();
|
|
|
if (pho_pattern.test(oldPhoto)) {
|
|
|
+ tipFun.call(this,false,'')
|
|
|
$('#photo').attr('disabled', false);
|
|
|
$("#photo").css("color", "#F18101");
|
|
|
- } else if (!pho_pattern.test(oldPhoto)) {
|
|
|
+ } else {
|
|
|
+ tipFun.call(this,true,'请填写正确的手机号码')
|
|
|
$('#photo').attr('disabled', true);
|
|
|
$("#photo").css("color", "#ccc");
|
|
|
}
|
|
|
});
|
|
|
+ $("#usePhoto").blur(function(){
|
|
|
+ if (pho_pattern.test(oldPhoto)) {
|
|
|
+ tipFun.call(this,false,'')
|
|
|
+ } else {
|
|
|
+ tipFun.call(this,true,'请填写正确的手机号码')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
photo1();
|
|
|
//手机验证码
|
|
|
function photo_num() {
|
|
|
$('#photo_num').blur(function () {
|
|
|
- var phoa = $(this).val();
|
|
|
+ var phoa = $(this).val().trim();
|
|
|
if (phoa == '') {
|
|
|
- $(this).val('验证码不能为空').css({color:'#f00'});
|
|
|
+ tipFun.call(this,true,'验证码不能为空')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
photo_num();
|
|
|
- /* 获得焦点处理 */
|
|
|
- $('#username,#customerName,#usePhoto').focus(function(){
|
|
|
- let val = $(this).val();
|
|
|
- if(val.indexOf('用户名')>-1||val.indexOf('下划线')>-1||val.indexOf('客户')>-1||val.indexOf('手机')>-1){
|
|
|
- $(this).val('').css({color:'#333'})
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- $('#photo_num').focus(function(){
|
|
|
- if(($(this).val()).indexOf('验证码')>-1){
|
|
|
- $(this).val('')
|
|
|
- }
|
|
|
- $(this).css({color:'#333'})
|
|
|
- })
|
|
|
- $('#userpassword,#userpassword2').focus(function(){
|
|
|
- let passVal =$(this).val();
|
|
|
- if(passVal.indexOf('密码')>-1){
|
|
|
- $(this).attr('type','password').val('').css({color:'#333'})
|
|
|
- }
|
|
|
- })
|
|
|
/*失去焦点处理 */
|
|
|
blurFun();
|
|
|
+ /* 提示框函数处理 */
|
|
|
+ function tipFun(state,txt){
|
|
|
+ let _this=this;
|
|
|
+ if(state){
|
|
|
+ $(_this).siblings('.Tips').text(txt);
|
|
|
+ $(_this).siblings('.Tips').addClass('active')
|
|
|
+ }else{
|
|
|
+ $(_this).siblings('.Tips').text('');
|
|
|
+ $(_this).siblings('.Tips').removeClass('active')
|
|
|
+ }
|
|
|
+ }
|
|
|
function blurFun(){
|
|
|
+
|
|
|
$('#username').blur(function(){
|
|
|
let nameRax = /^[a-zA-Z0-9_-]{6,32}$/;
|
|
|
-// if(!$(this).val().trim()){
|
|
|
-// $(this).val('请填写用户名').css({color:'#f00'})
|
|
|
-// }else if(!nameRax.test($(this).val())){
|
|
|
-// $(this).val('1-32位字母/数字/汉字').css({color:'#f00'})
|
|
|
-// }
|
|
|
+ if(!$(this).val().trim()){
|
|
|
+ tipFun.call(this,true,'请填写用户名')
|
|
|
+ }else if(!nameRax.test($(this).val())){
|
|
|
+ tipFun.call(this,true,'请输入6-32位字母、数字、下划线')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
+ }
|
|
|
})
|
|
|
$('#userpassword').blur(function () {
|
|
|
var pass_pattern = /^[a-zA-Z\d_]{6,12}$/;
|
|
|
var pass1 = $(this).val().trim();
|
|
|
var tt = $('#userpassword2').val().trim();
|
|
|
if (!pass1|| !pass_pattern.test(pass1)) {
|
|
|
- $(this).attr('type',"text")
|
|
|
- // $(this).val('请输入6-12位数字母开头密码').css({color:'#f00'});
|
|
|
- return;
|
|
|
+ tipFun.call(this,true,'请输入6-12位数字母开头密码')
|
|
|
+ }else if(tt&&(pass1===tt)){
|
|
|
+ tipFun.call($('#userpassword2'),false,'');
|
|
|
}else{
|
|
|
- $(this).attr('type','password');
|
|
|
- };
|
|
|
- if (pass1 && tt !== pass1) {
|
|
|
- $('#userpassword2').attr('type',"text")
|
|
|
- $('#userpassword2').val('两次密码不一致').css({color:'#f00'});
|
|
|
- return;
|
|
|
- };
|
|
|
- });
|
|
|
- $('#customerName').blur(function(){
|
|
|
- if(!$(this).val().trim()){
|
|
|
- $(this).val('请填写客户名称').css({color:'#f00'})
|
|
|
+ tipFun.call($('#userpassword2'),true,'两次密码不一致');
|
|
|
}
|
|
|
});
|
|
|
- $('#usePhoto').blur(function(){
|
|
|
+ $('#customerName').blur(function(){
|
|
|
if(!$(this).val().trim()){
|
|
|
- $(this).val('请填写手机号码').css({color:'#f00'})
|
|
|
+ tipFun.call(this,true,'请填写客户名称')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
$('#userpassword2').blur(function () {
|
|
|
var orepeat = $(this).val();
|
|
|
var passw = $('#userpassword').val();
|
|
|
if (passw !== orepeat || passw == '') {
|
|
|
- $(this).attr('type','text')
|
|
|
- $(this).val('两次密码不一致').css({color:'#f00'})
|
|
|
+ tipFun.call(this,true,'两次密码不一致')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
function initVal(){
|
|
|
- $('#userpassword2').val('确认密码');
|
|
|
- $('#userpassword1').val('请输入密码');
|
|
|
- $('#username').val('请输入用户名');
|
|
|
- $('#customerName').val('请输入客户名称');
|
|
|
- $('#usePhoto').val('请输入手机号码');
|
|
|
- $('#photo_num').val('手机验证码');
|
|
|
$('#protocol').prop("checked", false)
|
|
|
$(this).prop('checked', false)
|
|
|
$(this).parent().addClass('cheackeds_no').removeClass('cheackeds');
|
|
@@ -166,12 +159,19 @@ $(function () {
|
|
|
customerType = $('#customerTypes').val(),
|
|
|
mobileCode = $('#photo_num').val(),//手机验证码
|
|
|
codeV = $('#beInviteCode').val();
|
|
|
- if(user.indexOf('用户名')>-1||password1.indexOf('密码')>-1||password2.indexOf('密码')>-1||usePhoto.indexOf('手机')>-1||mobileCode.indexOf('验证码')>-1){
|
|
|
- msg('请填写必填项');
|
|
|
+ if(password1!==password2){
|
|
|
+ tipFun.call($('#userpassword2'),true,'两次密码不一致');
|
|
|
+ return;
|
|
|
+ };
|
|
|
+ if(!user&&!usePhoto&&!password1&&!mobileCode){
|
|
|
+ $('.Tips').text('请输入内容.');
|
|
|
+ $('.Tips').addClass('active');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if($('.Tips.active').length){
|
|
|
return;
|
|
|
} else {
|
|
|
- //$('.loading').show().css({'opacity':'0'}).find('p').html('');
|
|
|
- $('.loading').show()
|
|
|
+ $('.loading').show();
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
dataType: "json",
|
|
@@ -265,4 +265,10 @@ $(function () {
|
|
|
$('#msg').val('');
|
|
|
}, 2000)
|
|
|
}
|
|
|
+ //底部图片处理
|
|
|
+ footerImg()
|
|
|
+ function footerImg(){
|
|
|
+ $('.cont_left img').attr('src','');
|
|
|
+ $('.cont_center img').attr('src','');
|
|
|
+ }
|
|
|
});
|