123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- import '../css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import '../css/public.css';
- import '../css/register.css';
- import './public.js'
- (function(){
- //查看技淘网协议
- var hht=$(window).height();
- $('.login_').height(hht);
- $('.login_').hide()
- $('.head_login_').click(function(e){
- e.preventDefault();
- $('.login_').fadeIn(800)
- })
- $('.login_close_').click(function(){
- $('.login_').fadeOut(800)
- })
- //登陆
- var hht=$(window).height();
- $('.login').height(hht);
- $('.login').hide()
- $('.head_login').click(function(e){
- e.preventDefault();
- $('.login').fadeIn(800)
- })
- $('.login_close').click(function(){
- $('.login').fadeOut(800)
- })
- //选择专家和企业时要切换
- var panduan;
- $("#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");
- }
- });
- $("#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");
- }
- });
- //点击账号后面那个×,清空账号
- $(".log_del").click(function(){
- $("#username").val("");
- $('#photo').attr('disabled', true);
- $("#photo").css("color","#ccc");
- $('.sub').attr('disabled', true)
- $('.sub').css({background: '#CCCCCC',border: 'none'})
- });
- //修改单选框的样式
- //$('.leibie input').css("display","none");
- $(".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).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{
- $('#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 pp = $('#username').val();//手机号码
- var mim = $('#userpassword').val();//密码
- var mim2=$('#userpassword2').val();//密码
- var toname = $('#business').val();//企业名称
- var lxr = $('#linkman').val();//企业联系人
- var zj=$('#man').val();//联系人
- var yzm = $('#piccode').val();//验证码
- var sjyzm = $('#photo_num').val();//手机验证码
- var typel = $('#zhuangjia').prop("checked") ? '0' : '1';
- var xieyi=$('#protocol').prop("checked");
- if(typel==1){
- if(pp!==''&&toname!==''&&lxr!==''&&mim!==''&& pass_pattern.test(mim) && sjyzm!==''&& yzm!==''&&pattern.test(pp)&&(mim==mim2)&&(xieyi==true)){
- $('.sub').attr('disabled', false);
- $('.sub').css({background: '#F18101',border: 'none'})
- }
- }
- if(typel==0){
- if(pp!==''&&zj!==''&&mim!==''&& pass_pattern.test(mim) && sjyzm!==''&& yzm!==''&&pattern.test(pp)&&(mim==mim2)&&(xieyi==true)){
- $('.sub').attr('disabled', false);
- $('.sub').css({background: '#F18101',border: 'none'})
- }
- }
- })
- //表单验证
- $('.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,#userpassword2,#piccode,#photo_num,#business,#linkman,#man').keyup(function() {
- $('.sub').attr('disabled', true)
- $('.sub').css({background: '#CCCCCC',border: 'none'})
- var pp = $('#username').val();//手机号码
- var mim = $('#userpassword').val();//密码
- var mim2=$('#userpassword2').val();//密码
- var toname = $('#business').val();//企业名称
- var lxr = $('#linkman').val();//企业联系人
- var zj=$('#man').val();//联系人
- var yzm = $('#piccode').val();//验证码
- var sjyzm = $('#photo_num').val();//手机验证码
- var typel = $('#zhuangjia').prop("checked") ? '0' : '1';
- var xieyi=$('#protocol').prop("checked");
- if(typel==1){
- if(pp!==''&&toname!==''&&lxr!==''&&mim!==''&& pass_pattern.test(mim) && sjyzm!==''&& yzm!==''&&pattern.test(pp)&&(mim==mim2)&&(xieyi==true)){
- $('.sub').attr('disabled', false);
- $('.sub').css({background: '#F18101',border: 'none'})
- }
- }
- if(typel==0){
- if(pp!==''&&zj!==''&&mim!==''&& pass_pattern.test(mim) && sjyzm!==''&& yzm!==''&&pattern.test(pp)&&(mim==mim2)&&(xieyi==true)){
- $('.sub').attr('disabled', false);
- $('.sub').css({background: '#F18101',border: 'none'})
- }
- }
- })
- //密码
- function pass1(){
- $('#userpassword').blur(function () {
- var pass1 = $(this).val();
- if (pass1=='') {
- $(this).val('');
- $(this).attr('placeholder', '请输入6-12位数密码');
- } else if (!pass_pattern.test(pass1)) {
- //$(this).val('');
- $(this).attr('placeholder', '格式:字母、数字、下划线');
- }
- });
- }
- pass1();
- //密码相同
- pass2();
- function pass2(){
- //密码相同验证
- $('#userpassword2').blur(function () {
- var orepeat = $(this).val();
- var passw = $('#userpassword').val();
- if (passw !== orepeat) {
- //$(this).val('');
- $(this).attr('placeholder', '两次密码不相同')
- } else if (passw == '') {
- //$(this).val('');
- $(this).attr('placeholder', '请再次输入密码')
- }
- });
- $('#userpassword').blur(function () {
- var tt=$(userpassword2).val();
- var kk=$(this).val();
- if ($(this).val() == '') {
- $('#userpassword2').attr('placeholder', '请再次输入密码')
- }else if(tt!==kk){
- // $('#userpassword2').val('');
- $('#userpassword2').attr('placeholder', '两次密码不相同')
- }
- })
- }
- //手机号码
- function photo1(){
- var pho_pattern=/^1[3|4|5|7|8][0-9]{9}$/;
- $("#username").keyup(function(){
- var phol= $(this).val();
- console.log(pho_pattern.test(phol));
- if(pho_pattern.test(phol)){
- $('#photo').attr('disabled', false);
- $("#photo").css("color","#F18101");
- }else if(!pho_pattern.test(phol)){
- $('#photo').attr('disabled', true);
- $("#photo").css("color","#ccc");
- }
- });
- $('#username').blur(function () {
- var pho= $(this).val();
- if (pho=='') {
- $(this).val('');
- $(this).attr('placeholder', '请输入您的手机号码');
- } else if (!pho_pattern.test(pho)) {
- // $(this).val('');
- $(this).attr('placeholder', '请输入正确的手机号码');
- }else if(pho_pattern.test(pho)){
- $('#photo').attr('disabled', false);
- $("#photo").css("color","#F18101");
- }
- })
- }
- photo1();
- //手机号码验证
- function photo_num(){
- $('#photo_num').blur(function () {
- var phoa = $(this).val();
- if (phoa=='') {
- $(this).val('');
- $(this).attr('placeholder', '请输入手机上的验证码');
- }
- })
- }
- photo_num();
- //单位名称
- function photo_name(){
- $('#business').blur(function () {
- var name = $(this).val();
- if (name=='') {
- $(this).val('');
- $(this).attr('placeholder', '请填写工商局注册的全称');
- }
- })
- }
- photo_name();
- //联系人名称
- function lxr_name(){
- $('#linkman').blur(function () {
- var name = $(this).val();
- if (name=='') {
- $(this).val('');
- $(this).attr('placeholder', '请填写单位联系人的姓名');
- }
- })
- }
- lxr_name();
- //专家名称
- function zj_name(){
- $('#man').blur(function () {
- var name = $(this).val();
- if (name=='') {
- $(this).val('');
- $(this).attr('placeholder', '请填写您的姓名');
- }
- })
- }
- zj_name();
- //手机号码验证
- //$('#username').blur(function() {
- // var kk = $(this).val();
- // if (pattern.test(kk) && kk !=='') {
- // $('.sub').attr('disabled', false);
- // $('.sub').css({
- // background: '#428bca',
- // border: '1px solid #428bca'
- // })
- // } else {
- // $('.sub').attr('disabled', true)
- // $('.sub').css({
- // background: '#CCCCCC',
- // border: 'none'
- // })
- // };
- //
- //});
- //表单提交
- $("form").submit(function(e) {
- var user = $("#username").val();
- var password = $("#userpassword").val();
- var types = $('#zhuangjia').prop("checked") ? '0' : '1';//团体/个人
- var oname = $('#business').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);
- 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 () {
- $('.yanzhengma_cont img').attr('src', (globalConfig.context + "/open/getVCode?t=" + Math.random()))
- })
- var tt = 30;
- $('#photo').click(function () {
- //手机验证功能
- var ophoto = $('#username').val();
- var types = $('#zhuangjia').prop("checked") ? '0' : '1';
- console.log(types);
- var phott = $('#piccode').val();
- //验证码倒计时
- $('#photo').attr('disabled', true);
- $(this).attr('disabled', true);
- var timer = setInterval(function () {
- tt -= 1;
- $('#photo').attr('disabled', true);
- $(this).val(tt + ' s');
- if (tt == 0) {
- clearInterval(timer);
- $('#photo').attr('disabled', false);
- $(this).attr('disabled', false);
- tt=30;
- $(this).val('重新发送');
- }
- }.bind(this), 1000);
- $.ajax({
- type: "GET",
- url: globalConfig.context + "/open/getMCode",
- data: {
- "mobile": ophoto,
- "sign": false,
- "type": types,
- "verificationCode": phott
- },
- 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);
- $('#photo').html("发送成功!")
- }
- return true
- }
- });
- })
- })();
|