| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- /*登录时是否为空判断*/
- /*密码登录*/
- var bool=true;
- var mobile=null;
- var yanzhengma=null;
- $('#login-pwd').on('click', function() {
- var phone=$("input[name='phone']").val();
- var pwd = $("input[name='pwd']").val();
- if(phone==null || phone==undefined ||phone==""){
- alert("电话号码为空无法登录");
- }else{
- checkPhone();
- }
- if(pwd==null || pwd==undefined ||pwd==""){
- alert("请输入密码");
- }
- });
- /*手机验证码登录*/
- $('#login-mobile').on('click', function() {
- var mobile=$("input[name='mobile']").val();
- yanzhengma = $("input[name='yanzhengma']").val();
- if(mobile==null || mobile==undefined ||mobile==""){
- alert("电话号码为空无法登录");
- bool = false;
- }else if(!(/^1[34578]\d{9}$/.test(mobile))){
- alert("手机号码格式错误");
- bool = false;
- }
- if(yanzhengma==null || yanzhengma==undefined ||yanzhengma==""){
- alert("验证码为空");
- bool = false;
- }else if(yanzhengma.length<6){
- alert("验证码为6位");
- bool = false;
- }
- });
- function checkPhone(){
- var phone = $("phone").val();
- if(!(/^1[34578]\d{9}$/.test(phone))){
- alert("手机号码格式错误");
- bool= false;
- }
- }
- /*点击短信登录*/
- $("#message").click(function(){
- $(this).css("display","none");
- $("#user-phone").css("display","block");
- $("#phone-pwdd").css("display","none");
- $("#phone-yanzhengma").css("display","block");
- $("#111").css("display","none");
- $("#222").css("display","block")
- })
- $("#user-phone").click(function(){
- $(this).css("display","none");
- $("#222").css("display","none");
- $("#111").css("display","block");
- $("#message").css("display","block");
- $("#phone-yanzhengma").css("display","none");
- $("#phone-pwdd").css("display","block");
-
- })
-
- $("#callback").click(function(){
- $("#bbb").css("display","none");
- $("#aaa").css("display","block");
- })
- $("#weixin-login").click(function(){
- $("#bbb").css("display","block");
- $("#aaa").css("display","none");
- })
- /*验证码倒数60s*/
- $('#getting').click(function(){
- mobile=$("input[name='mobile']").val();
- debugger
- if(mobile==null || mobile==undefined ||mobile==""){
- alert("电话号码为空无法获取验证码");
- bool = false;
- }else{
- var btn = $(this);
- var count = 60;
- var resend = setInterval(function(){
- count--;
- if (count > 0){
- btn.val(count+"秒后可重新获取");
- $.cookie("captcha", count, {path: '/', expires: (1/86400)*count});
- }else {
- clearInterval(resend);
- btn.val("获取验证码").removeAttr('disabled style');
- }
- }, 1000);
- btn.attr('disabled',true).css('cursor','not-allowed');
- }
- });
- /*忘记密码弹框*/
- $(function ($) {
- //弹出登录
- $("#example").hover(function () {
- $(this).stop().animate({
- opacity: '1'
- }, 600);
- }, function () {
- $(this).stop().animate({
- opacity: '0.6'
- }, 1000);
- }).on('click', function () {
- debugger
- $("body").append("<div id='mask'></div>");
- $("#mask").addClass("mask").fadeIn("slow");
- $("#LoginBox").fadeIn("slow");
- });
- //
- //按钮的透明度
- $("#loginbtn").hover(function () {
- $(this).stop().animate({
- opacity: '1'
- }, 600);
- }, function () {
- $(this).stop().animate({
- opacity: '0.8'
- }, 1000);
- });
- //文本框不允许为空---按钮触发
- $("#loginbtn").on('click', function () {
- var txtName = $("#txtName").val();
- var txtPwd = $("#txtPwd").val();
- if (txtName == "" || txtName == undefined || txtName == null) {
- if (txtPwd == "" || txtPwd == undefined || txtPwd == null) {
- $(".warning").css({ display: 'block' });
- }
- else {
- $("#warn").css({ display: 'block' });
- $("#warn2").css({ display: 'none' });
- }
- }
- else {
- if (txtPwd == "" || txtPwd == undefined || txtPwd == null) {
- $("#warn").css({ display: 'none' });
- $(".warn2").css({ display: 'block' });
- }
- else {
- $(".warning").css({ display: 'none' });
- }
- }
- });
- //文本框不允许为空---单个文本触发
- $("#txtName").on('blur', function () {
- var txtName = $("#txtName").val();
- if (txtName == "" || txtName == undefined || txtName == null) {
- $("#warn").css({ display: 'block' });
- }
- else {
- $("#warn").css({ display: 'none' });
- }
- });
- $("#txtName").on('focus', function () {
- $("#warn").css({ display: 'none' });
- });
- //
- $("#txtPwd").on('blur', function () {
- var txtName = $("#txtPwd").val();
- if (txtName == "" || txtName == undefined || txtName == null) {
- $("#warn2").css({ display: 'block' });
- }
- else {
- $("#warn2").css({ display: 'none' });
- }
- });
- $("#txtPwd").on('focus', function () {
- $("#warn2").css({ display: 'none' });
- });
- //关闭
- $(".close_btn").hover(function () { $(this).css({ color: 'black' }) }, function () { $(this).css({ color: '#999' }) }).on('click', function () {
- $("#LoginBox").fadeOut("fast");
- $("#mask").css({ display: 'none' });
- });
- });
- /*注册校验*/
- $("#register-phone").click(function(){
- debugger
- mobile=$("input[name='registerPhone']").val();
- yanzhengma = $("input[name='registerYanzhengma']").val();
- var Newpassword= $("input[name='Newpassword']").val();
- if(mobile==null || mobile==undefined ||mobile==""){
- alert("电话号码为空无法登录");
- bool = false;
- }else if(!(/^1[34578]\d{9}$/.test(mobile))){
- alert("手机号码格式错误");
- bool = false;
- }
- if(yanzhengma==null || yanzhengma==undefined ||yanzhengma==""){
- alert("验证码为空");
- bool = false;
- }else if(yanzhengma.length<6){
- alert("验证码为6位");
- bool = false;
- }
- if(Newpassword==null || Newpassword==undefined ||Newpassword==""){
- alert("请设置密码");
- }
- });
- /*注册验证码*/
- $('#getting1').click(function(){
- mobile=$("input[name='registerPhone']").val();
- debugger
- if(mobile==null || mobile==undefined ||mobile==""){
- alert("电话号码为空无法获取验证码");
- bool = false;
- }else{
- var btn = $(this);
- var count = 60;
- var resend = setInterval(function(){
- count--;
- if (count > 0){
- btn.val(count+"秒后可重新获取");
- $.cookie("captcha", count, {path: '/', expires: (1/86400)*count});
- }else {
- clearInterval(resend);
- btn.val("获取验证码").removeAttr('disabled style');
- }
- }, 1000);
- btn.attr('disabled',true).css('cursor','not-allowed');
- }
- });
|