|
@@ -0,0 +1,230 @@
|
|
|
+$(function () {
|
|
|
+ //查看技淘网协议
|
|
|
+ var hht = $(window).height();
|
|
|
+ $('.login_').height(hht);
|
|
|
+ //登陆
|
|
|
+ var hht = $(window).height();
|
|
|
+ $('.login').hide();
|
|
|
+ //点击账号后面那个×,清空账号
|
|
|
+ $(".log_del").click(function () {
|
|
|
+ $("#username").focus().val("").css('color','#666');
|
|
|
+ });
|
|
|
+
|
|
|
+ $("#register").click(function () {
|
|
|
+ $(".registered").css('display','block')
|
|
|
+ });
|
|
|
+
|
|
|
+ $("#registeredClose").click(function () {
|
|
|
+ $(".registered").css('display','none')
|
|
|
+ });
|
|
|
+
|
|
|
+ //手机号码
|
|
|
+ let oldPhoto='';
|
|
|
+ var phopoVal=[];
|
|
|
+ $('#photo').attr('disabled', true);
|
|
|
+ function photo1() {
|
|
|
+ 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 {
|
|
|
+ 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().trim();
|
|
|
+ if (phoa == '') {
|
|
|
+ tipFun.call(this,true,'验证码不能为空')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ photo_num();
|
|
|
+ /*失去焦点处理 */
|
|
|
+ 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(){
|
|
|
+ if(!$(this).val().trim()){
|
|
|
+ tipFun.call(this,true,'请填写用户名')
|
|
|
+ }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))) {
|
|
|
+ tipFun.call(this,true,'请输入6-12位数的密码')
|
|
|
+ }else if(pass1===tt){
|
|
|
+ tipFun.call($('#userpassword2'),false,'');
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
+ tipFun.call($('#userpassword2'),true,'两次密码不一致');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#customerName').blur(function(){
|
|
|
+ if(!$(this).val().trim()){
|
|
|
+ tipFun.call(this,true,'请填写客户名称')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#userpassword2').blur(function () {
|
|
|
+ var orepeat = $(this).val();
|
|
|
+ var passw = $('#userpassword').val();
|
|
|
+ if (passw !== orepeat || passw == '') {
|
|
|
+ tipFun.call(this,true,'两次密码不一致')
|
|
|
+ }else{
|
|
|
+ tipFun.call(this,false,'')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function initVal(){
|
|
|
+ $('#protocol').prop("checked", false)
|
|
|
+ $(this).prop('checked', false)
|
|
|
+ $(this).parent().addClass('cheackeds_no').removeClass('cheackeds');
|
|
|
+ $('.sub').attr('disabled', true)
|
|
|
+ $('.sub').css({
|
|
|
+ background: '#CCCCCC',
|
|
|
+ border: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //表单提交
|
|
|
+ if(window.location.search.indexOf('code')>-1){
|
|
|
+ let code = (window.location.search).split('=');
|
|
|
+ $('#beInviteCode').val(code[1]);
|
|
|
+ }
|
|
|
+ $("#form_register").submit(function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ var user = $("#username").val(),
|
|
|
+ usePhoto = $('#usePhoto').val(),
|
|
|
+ password1 = $("#userpassword").val(),
|
|
|
+ password2 = $("#userpassword2").val();
|
|
|
+ if(!usePhoto){
|
|
|
+ tipFun.call($('#usePhoto'),true,'手机号码不能为空.')
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if(!password1){
|
|
|
+ tipFun.call($('#userpassword'),true,'密码不能为空.')
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ if(password1!==password2){
|
|
|
+ tipFun.call($('#userpassword2'),true,'两次密码不一致');
|
|
|
+ return;
|
|
|
+ };
|
|
|
+ if(!user){
|
|
|
+ tipFun.call($('#username'),true,'昵称不能为空');
|
|
|
+ return;
|
|
|
+ };
|
|
|
+ alert("恭喜您!注册成功");
|
|
|
+ $("#username").val('')
|
|
|
+ $("#usePhoto").val('')
|
|
|
+ $("#userpassword").val('')
|
|
|
+ $("#userpassword2").val('')
|
|
|
+ $(".registered").css('display','none')
|
|
|
+ })
|
|
|
+ agreement();
|
|
|
+ function agreement(){
|
|
|
+ $('.head_login_').click(function(){
|
|
|
+ $('.login_').show();
|
|
|
+ })
|
|
|
+ $('.login_close_').click(function(){
|
|
|
+ $('.login_').hide();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ var tt = 30;
|
|
|
+
|
|
|
+ $('#photo').click(function () {
|
|
|
+ phopoVal=[];
|
|
|
+ var ophoto = $('#usePhoto').val().trim();
|
|
|
+ if (ophoto) {
|
|
|
+ phopoVal.push(ophoto);
|
|
|
+ $.ajax({
|
|
|
+ type: "GET",
|
|
|
+ url: globalConfig.context + "/open/getMCode",
|
|
|
+ data: {
|
|
|
+ "mobile": ophoto,
|
|
|
+ "sign": false,
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ msg(data.error[0].message);
|
|
|
+ } else {
|
|
|
+ //验证码倒计时
|
|
|
+ $('#photo').attr('disabled', true);
|
|
|
+ var timer = setInterval(function () {
|
|
|
+ tt -= 1;
|
|
|
+ $('#photo').val("发送" + '(' + tt + 's' + ')');
|
|
|
+ $('#photo').css({
|
|
|
+ color: '#cccccc'
|
|
|
+ })
|
|
|
+ if (tt == 0) {
|
|
|
+ clearInterval(timer);
|
|
|
+ $('#photo').attr('disabled', false);
|
|
|
+ tt = 30;
|
|
|
+ $('#photo').css({
|
|
|
+ color: '#f18101'
|
|
|
+ })
|
|
|
+ $('#photo').val('重新发送');
|
|
|
+ }
|
|
|
+ }.bind(this), 1000);
|
|
|
+ msg('发送成功');
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ msg('请填写手机号码!');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //提示框渐隐函数
|
|
|
+ function msg(mess) {
|
|
|
+ if($('.smg').hasClass('active')){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $('.smg').addClass('active')
|
|
|
+ $('#msg').val(mess);
|
|
|
+ setTimeout(function () {
|
|
|
+ $('.smg').removeClass('active')
|
|
|
+ $('#msg').val('');
|
|
|
+ }, 2000)
|
|
|
+ }
|
|
|
+ //注册 底部图片处理
|
|
|
+ footerImg()
|
|
|
+ function footerImg(){
|
|
|
+ $('.cont_left img').css('display','none');
|
|
|
+ $('.cont_center img').css('display','none');
|
|
|
+ $('.cont_left div').css('display','block');
|
|
|
+ $('.cont_center div').css('display','block');
|
|
|
+ }
|
|
|
+});
|