$('.close').on('touchstart', function () { window.history.go(-1); }) $('input').on("focus", function () { document.activeElement.blur();//屏蔽默认键盘弹出; }); $('input').on('touchstart', function () { $('.keyboard').show(); }) $('.keyico').on('touchstart', function () { $(this).css('backgroundColor', "#ececec"); $('.keyico').on('touchend', function () { $(this).css('backgroundColor', "white"); }) $('.keyboard').hide(); }) var num = ''; var elm = $('.inp17').eq(0); var maxlength = 6; $('.inp17').on('touchstart', function () { $('.empty').hide(); if ($(this).val()) { $(this).next().show(); } $('.cursor').hide(); $(this).next().next().show(); $('.keyboard').show(); num = $(this).val(); elm = $(this); maxlength = parseInt($(this).attr('maxlength')); }) //输入密码 $('.num').on('touchstart', function () { $(this).css('backgroundColor', "#ececec"); $('.num').on('touchend', function () { $(this).css('backgroundColor', "white"); }) if (num.length < maxlength) { num += $(this).html(); var str = elm.nextAll('.pwdspan').html(); str += "•"; elm.nextAll('.pwdspan').html(str); elm.val(num); elm.next().show(); elm.next().next().css('left', elm.nextAll('.pwdspan').eq(0).width() + 15); } }) //清空密码 $('.empty').on('touchstart', function () { $(this).css('backgroundColor', "#ececec"); $('.empty').on('touchend', function () { $(this).css('backgroundColor', "white"); }) num = ''; $(this).prev().val(''); $(this).nextAll('.pwdspan').html(''); $('.empty').hide(); $(this).next().css('left', 15); }) //删除密码 $('.del').on('touchstart', function () { $(this).css('backgroundColor', "#ececec"); $('.del').on('touchend', function () { $(this).css('backgroundColor', "white"); }) if (num.length) { num = num.substr(0, num.length - 1); var str = elm.nextAll('.pwdspan').html(); str = str.substr(0, str.length - 1); elm.nextAll('.pwdspan').html(str); elm.val(num); if (!num.length) { elm.next().hide(); } if (num.length) { elm.next().next().css('left', elm.nextAll('.pwdspan').eq(0).width() + 15); } else { elm.next().next().css('left', 15); } } }) $(".change").on('touchstart', function () { if (!$('#old').val()) { alertMsg('请输入您的密码', 600); return; } if (!$('#new').val()) { alertMsg('请输入新密码', 600); return; } if ($('#new').val().length < 6) { alertMsg('密码长度为6位', 600); return; } if (!$('#renew').val()) { alertMsg('请再次输入新密码', 600); return; } if ($('#new').val() != $('#renew').val()) { alertMsg('新密码不一致,请重试', 600); return; } alertShowLoading({ title: '密码更新中' }, function () { $.post("/index.php/Vip/Set/changepwd", { oldpwd: $('#old').val(), pwd: $('#new').val() }, function (data) { alertHideLoading(); if (data.success) { alertMsg(data.msg, 1000, function () { window.location.replace("/index.php/Vip/Cardcenter/index"); }); } else { alertMsg(data.msg, 1000); } }) }) })