dengzhiguo 7 yıl önce
ebeveyn
işleme
2bf0211476
4 değiştirilmiş dosya ile 133 ekleme ve 53 silme
  1. 5 3
      src/css/registered.css
  2. 0 1
      src/js/public.js
  3. 116 40
      src/js/registered.js
  4. 12 9
      template/registered.html

+ 5 - 3
src/css/registered.css

@@ -40,7 +40,7 @@ margin-bottom:10px;line-height:38px;}
 .yanzhengma>input{border:none;padding-left:10px;}
 .yanzhengma_cont{display:inline-block;width:80px;height:40px;line-height: 38px;
     position: absolute;top:0;right:0;}
-.cellcode{width:255px;height:40px;position: relative;margin-bottom:10px;}
+.cellcode{width:255px;height:40px;position: relative;}
 .cellcode>div{width:165px;height:40px;border:1px solid #E5E5E5;
     line-height: 38px;display:inline-block;margin-right:10px;}
 input{border:none;padding-left:10px;}
@@ -49,8 +49,9 @@ input{border:none;padding-left:10px;}
 #photo_num{display: inline-block;}
 .leibie{width:120px;height:30px;display:inline-block;color:#F18101;font-size: 1.4rem;
     line-height: 28px;font-weight: bold;padding-left: 20px;position: relative;}
-.leibie>input{display:inline-block;width:15px;height:15px;margin-right: 5px;position: absolute;
-    top:5px;left:0;background: transparent;}
+.leibie input{display:inline-block;width:15px;height:15px;margin-right: 5px;position: absolute;
+    top:5px;left:0;visibility: hidden;}
+.login_check .qiye_lab,.login_check .zhuangjia_lab{height:34px;}
 .businessName{width:255px;height:40px;border:1px solid #E5E5E5;
     margin-bottom:10px;line-height:38px;}
 .linkmanName{width:255px;height:40px;border:1px solid #E5E5E5;
@@ -64,6 +65,7 @@ input{border:none;padding-left:10px;}
 font-size: 1.8rem;font-weight: bold;letter-spacing:20px;}
 .protocol{width:255px;height:30px;line-height: 20px;}
 .protocol a{color:#F18101;font-weight: 400;}
+#protocol{visibility: hidden;}
 .picture{width:420px;height:420px;border-left:1px solid #E5E5E5;
     display: inline-block;position: absolute;top:50px;left:350px;}
 .denglu{width:400px;height:20px;text-align: right;display: inline-block;

+ 0 - 1
src/js/public.js

@@ -178,7 +178,6 @@ $(function(){
                         }
                         return true;
 					}
-				
 			   }
           })
                 

+ 116 - 40
src/js/registered.js

@@ -6,18 +6,20 @@ import './public.js'
 (function(){
     //选择专家和企业时要切换
     var panduan;
-    $("#zhuangjia").click(function(){
-        panduan=$("#zhuangjia").val();
-        if(panduan==0){
+    $("#qiye").click(function(){
+        panduan=$('#zhuangjia').prop("checked") ? '0' : '1';
+        console.log(panduan);
+        if(panduan==1){
             $(".businessName").css("display","block");
             $(".linkmanName").css("display","block");
             $(".zhuangjiaName").css("display","none");
 
         }
     });
-    $("#qiye").click(function(){
-        panduan=$("#qiye").val();
-        if(panduan==1){
+    $("#zhuangjia").click(function(){
+        panduan=$('#zhuangjia').prop("checked") ? '0' : '1';
+        console.log(panduan);
+        if(panduan==0){
             $(".businessName").css("display","none");
             $(".linkmanName").css("display","none");
             $(".zhuangjiaName").css("display","block");
@@ -29,25 +31,47 @@ import './public.js'
     });
     //修改单选框的样式
     //$('.leibie input').css("display","none");
-    $(".leibie").css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"});
-    $('.leibie input').click(function(){
-        var Cheack=$(this).prop('checked');
+    $(".qiye_lab").css({"background":"url(../img/checked.jpg) no-repeat center left","background-size":"13px 13px"});
+    $(".zhuangjia_lab").css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"});
+    $(".protocol_lab").css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"});
+    $('#qiye').click(function(){
+        var Cheack=$(this).prop('checked')
         if(Cheack){
-            //$(this).css("display","none");
-            $(".leibie").css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"});
             $(this).parent().css({"background":"url(../img/checked.jpg) no-repeat center left","background-size":"13px 13px"})
+            $('#zhuangjia').prop('checked',false)
+            $('#zhuangjia').parent().css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"})
         }else{
-           // $(this).css("display","none");
-            $(".leibie").css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"});
+            $('#zhuangjia').prop('checked',true)
+            $('#zhuangjia').parent().css({"background":"url(../img/checked.jpg) no-repeat center left","background-size":"13px 13px"})
             $(this).parent().css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"})
         }
-    });
+    })
+    $('#zhuangjia').click(function(){
+        var Cheack_no=$(this).prop('checked')
+        if(Cheack_no){
+            $(this).parent().css({"background":"url(../img/checked.jpg) no-repeat center left","background-size":"13px 13px"})
+            $('#qiye').prop('checked',false)
+            $('#qiye').parent().css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"})
+        }else{
+            $('#qiye').prop('checked',true)
+            $('#qiye').parent().css({"background":"url(../img/checked.jpg) no-repeat center left","background-size":"13px 13px"})
+            $(this).parent().css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"})
+        }
+    })
+    $('#protocol').click(function(){
+        var Cheack_no=$(this).prop('checked')
+        if(Cheack_no){
+            $(this).parent().css({"background":"url(../img/checked.jpg) no-repeat center left","background-size":"13px 13px"})
+            }else{
+             $(this).parent().css({"background":"url(../img/unchecked.jpg) no-repeat center left","background-size":"13px 13px"})
+        }
+    })
     //表单验证
     $('.sub').attr('disabled', true)
     $('.sub').css({background: '#CCCCCC',border: 'none'})
     var pattern = /^1[3|4|5|7|8][0-9]{9}$/;//手机验证正则
     var pass_pattern=/^\w{6,12}$/;	//密码验证正则
-    $('#username,#userpassword,#piccode,#photo_num,#business,#linkman,#man').keyup(function() {
+    $('#username,#userpassword,#userpassword2,#piccode,#photo_num,#business,#linkman,#man').keyup(function() {
         $('.sub').attr('disabled', true)
         $('.sub').css({background: '#CCCCCC',border: 'none'})
         var pp = $('#username').val();//手机号码
@@ -57,7 +81,10 @@ import './public.js'
         var zj=$('#man').val();//联系人
         var yzm = $('#piccode').val();//验证码
         var sjyzm = $('#photo_num').val();//手机验证码
-        var typel = $('#zhuangjia').prop("checked") ? '1' : '0';
+        var typel = $('#zhuangjia').prop("checked") ? '0' : '1';
+        var xieyi=$('#protocol').prop("checked");
+        console.log(xieyi);
+        console.log(typel);
         if(typel==1){
             if(pp!==''&&toname!==''&&lxr!==''&&mim!==''&& pass_pattern.test(mim) && sjyzm!==''&& yzm!==''&&pattern.test(pp)){
                 $('.sub').attr('disabled', false);
@@ -200,35 +227,84 @@ import './public.js'
         var password = $("#userpassword").val();
         var types = $('#zhuangjia').prop("checked") ? '0' : '1';//团体/个人
         var oname = $('#business').val();//企业名称
-        var opeople = $('#linkman').val();//联系人
+        var opeople = $('#linkman').val();//企业联系人
+        var people=$('#man').val();//企业联系人
         var Code = $("#piccode").val();
         var mobileCode = $('#photo_num').val();//手机验证码
         e.preventDefault();
         console.log(user, password, types, oname, opeople, Code, mobileCode);
-        $.ajax({
-            type: "POST",
-            dataType: "json",
-            url: globalConfig.context + "/register",
-            data: {
-                "mobile": user,
-                "password": password,
-                "type": types,
-                "companyName": oname,
-                "contacts": opeople,
-                "verficationCode":Code,
-                "mobileCode": mobileCode
-            },
-            success: function (data) {
-                if (data.error && data.error.length) {
-                    $('.msg span').html(data.error[0].message);
-                    console.log(data.error[0].message);
-                } else {
-                    console.log(data);
-                    $('.msg span').html("恭喜注册成功!")
-                    return true;
+        if(types==0){
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                url: globalConfig.context + "/register",
+                data: {
+                    "mobile": user,
+                    "password": password,
+                    "type": types,
+                    "contacts": people,
+                    "verficationCode":Code,
+                    "mobileCode": mobileCode
+                },
+                success: function (rest) {
+                    if (rest.error && rest.error.length) {
+                        message.warning(rest.error[0].message);
+                    } else {
+                        var  data = rest.data;
+                        if (data && data.requestURI) {
+                            var path = globalConfig.context + data.requestURI
+                            if (data.queryString) {
+                                path += '?' + data.queryString;
+                            }
+                            if (window.location.hash) {
+                                path += window.location.hash;
+                            }
+                            window.location.href = path;
+                        } else {
+                            window.location.href = globalConfig.context + "/user/account/index.html";
+                        }
+                        return true;
+                    }
                 }
-            }
-        })
+            })
+        }
+        else if(types==1){
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                url: globalConfig.context + "/register",
+                data: {
+                    "mobile": user,
+                    "password": password,
+                    "type": types,
+                    "companyName": oname,
+                    "contacts": opeople,
+                    "verficationCode":Code,
+                    "mobileCode": mobileCode
+                },
+                success: function (rest) {
+                    if (rest.error && rest.error.length) {
+                        message.warning(rest.error[0].message);
+                    } else {
+                        var  data = rest.data;
+                        if (data && data.requestURI) {
+                            var path = globalConfig.context + data.requestURI
+                            if (data.queryString) {
+                                path += '?' + data.queryString;
+                            }
+                            if (window.location.hash) {
+                                path += window.location.hash;
+                            }
+                            window.location.href = path;
+                        } else {
+                            window.location.href = globalConfig.context + "/user/account/index.html";
+                        }
+                        return true;
+                    }
+                }
+            })
+        }
+
     })
     //点击刷新图片验证码
     $('.yanzhengma_cont').click(function () {

+ 12 - 9
template/registered.html

@@ -71,13 +71,14 @@
 							</div>
 							<input type="button" id="photo" value="获取验证码" disabled/>
 						</div>
-						<div class="leibie zj">
-							<input type="radio" name="leibie" id="zhuangjia" value="0" checked/>
-							<label for="zhuangjia">我是专家</label>
-						</div>
-						<div class="leibie qy">
-							<input type="radio" name="leibie" id="qiye" value="1"/>
-							<label for="qiye">我是企业</label>
+						<div class="login_check">
+							<label for="qiye" class="qiye_lab">
+							<input type="radio" name="leibie" id="qiye" value="1" checked/>
+							我是企业</label>
+
+							<label for="zhuangjia" class="zhuangjia_lab">
+							<input type="radio" name="leibie" id="zhuangjia" value="0"/>
+							我是专家</label>
 						</div>
 						<div class="businessName">
 							<input type="text" name="businessName" placeholder="单位名称" id="business"/>
@@ -89,8 +90,10 @@
 							<input type="text" name="manName" placeholder="您的姓名" id="man"/>
 						</div>
 						<div class="protocol">
-							<input type="checkbox" name="pro" id="protocol"/>
-							<label for="protocol"><a href="#">同意技淘网会员服务协议条款</a></label>
+							<label for="protocol" class="protocol_lab">
+								<input type="checkbox" name="pro" id="protocol"/>
+								<a href="#">同意技淘网会员服务协议条款</a>
+							</label>
 						</div>
 						<div class="submit">
 							<input type="submit" class="sub"/>