Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
6 changed files
with
322 additions
and
295 deletions
@@ -143,6 +143,16 @@ function showPage() { | @@ -143,6 +143,16 @@ function showPage() { | ||
143 | $pageList.css('visibility', 'visible'); | 143 | $pageList.css('visibility', 'visible'); |
144 | } | 144 | } |
145 | 145 | ||
146 | +function bindTouchedEvent() { | ||
147 | + var $boxs = $('.box'); | ||
148 | + | ||
149 | + $boxs.on('touchstart', function(e) { | ||
150 | + $(this).addClass('bytouch'); | ||
151 | + }).on('touchend touchcancel', function() { | ||
152 | + $boxs.removeClass('bytouch'); | ||
153 | + }); | ||
154 | +} | ||
155 | + | ||
146 | if (wxHammer) { | 156 | if (wxHammer) { |
147 | wxHammer.on('tap', function() { | 157 | wxHammer.on('tap', function() { |
148 | callpay(theOrderCode); | 158 | callpay(theOrderCode); |
@@ -154,9 +164,11 @@ function main() { | @@ -154,9 +164,11 @@ function main() { | ||
154 | loading.hideLoadingMask(); | 164 | loading.hideLoadingMask(); |
155 | showPage(); | 165 | showPage(); |
156 | loadIcon(); | 166 | loadIcon(); |
167 | + bindTouchedEvent(); | ||
157 | } | 168 | } |
158 | 169 | ||
159 | loading.showLoadingMask(); | 170 | loading.showLoadingMask(); |
160 | 171 | ||
161 | $(document).ready(main); | 172 | $(document).ready(main); |
162 | 173 | ||
174 | + |
@@ -5,6 +5,10 @@ | @@ -5,6 +5,10 @@ | ||
5 | visibility: hidden; | 5 | visibility: hidden; |
6 | } | 6 | } |
7 | 7 | ||
8 | + .box.bytouch { | ||
9 | + background-color:#eee; | ||
10 | + } | ||
11 | + | ||
8 | .box { | 12 | .box { |
9 | border: 1px solid #eee; | 13 | border: 1px solid #eee; |
10 | border-radius: 10rem / $pxConvertRem; | 14 | border-radius: 10rem / $pxConvertRem; |
@@ -23,6 +27,7 @@ | @@ -23,6 +27,7 @@ | ||
23 | @include flexbox((display: flex, align-items: center)); | 27 | @include flexbox((display: flex, align-items: center)); |
24 | } | 28 | } |
25 | 29 | ||
30 | + | ||
26 | .icon { | 31 | .icon { |
27 | width: 15%; | 32 | width: 15%; |
28 | 33 | ||
@@ -38,7 +43,7 @@ | @@ -38,7 +43,7 @@ | ||
38 | height: 60rem / $pxConvertRem; | 43 | height: 60rem / $pxConvertRem; |
39 | background-image: image-url("layout/pay-icon.png"); | 44 | background-image: image-url("layout/pay-icon.png"); |
40 | background-size: 90%; | 45 | background-size: 90%; |
41 | - background-position-y: 8rem / $pxConvertRem; | 46 | + background-position-y: 12rem / $pxConvertRem; |
42 | background-position-x: center; | 47 | background-position-x: center; |
43 | background-repeat: no-repeat; | 48 | background-repeat: no-repeat; |
44 | } | 49 | } |
@@ -614,6 +614,15 @@ handlebars.registerHelper('equalone', function(v1, options) { | @@ -614,6 +614,15 @@ handlebars.registerHelper('equalone', function(v1, options) { | ||
614 | } | 614 | } |
615 | }); | 615 | }); |
616 | /** | 616 | /** |
617 | + * 时间戳 | ||
618 | + * @param {[type]} v1 [description] | ||
619 | + * @param {[type]} options) { if (v1 [description] | ||
620 | + * @return {[type]} [description] | ||
621 | + */ | ||
622 | +handlebars.registerHelper('timestamp', function() { | ||
623 | + return new Date().getTime(); | ||
624 | +}); | ||
625 | +/** | ||
617 | * 判断等级为3的helper | 626 | * 判断等级为3的helper |
618 | * @param {[type]} v1 [description] | 627 | * @param {[type]} v1 [description] |
619 | * @param {[type]} options) { if (v1 [description] | 628 | * @param {[type]} options) { if (v1 [description] |
@@ -5539,300 +5548,301 @@ $('#find-btn').click(function(e) { | @@ -5539,300 +5548,301 @@ $('#find-btn').click(function(e) { | ||
5539 | }); | 5548 | }); |
5540 | }); | 5549 | }); |
5541 | define("js/passport/login", ["jquery","jquery.placeholder"], function(require, exports, module){ | 5550 | define("js/passport/login", ["jquery","jquery.placeholder"], function(require, exports, module){ |
5542 | -/** | ||
5543 | - * 登录 | ||
5544 | - * @author: xuqi<qi.xu@yoho.cn> | ||
5545 | - * @date: 2015/12/11 | ||
5546 | - */ | ||
5547 | -var $ = require("jquery"); | ||
5548 | - | ||
5549 | -var mailPostfix = { | ||
5550 | - num: ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'], | ||
5551 | - other: ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'] | ||
5552 | -}; | ||
5553 | - | ||
5554 | -var $account = $('#account'), | ||
5555 | - $password = $('#password'); | ||
5556 | - | ||
5557 | -var $accountTip = $account.siblings('.err-tip'), | ||
5558 | - $passwordTip = $password.siblings('.err-tip'), | ||
5559 | - $capsLock = $('#caps-lock'); | ||
5560 | - | ||
5561 | -var $countryCodeHide = $('#country-code-hide'), | ||
5562 | - $countryCodeEm = $('#country-code > em'), | ||
5563 | - $countryList = $('#country-list'); | ||
5564 | - | ||
5565 | -var $emailAutoComplete = $('#email-autocomplete'); | ||
5566 | - | ||
5567 | -var mailPhoneRegx = require("js/passport/mail-phone-regx"); | ||
5568 | - | ||
5569 | -var $remember = $('.remember-me'); | ||
5570 | - | ||
5571 | -//checkbox status unicode | ||
5572 | -var checkbox = { | ||
5573 | - checked: '', | ||
5574 | - unchecked: '' | ||
5575 | -}; | ||
5576 | - | ||
5577 | -var authing = false; | ||
5578 | - | ||
5579 | -var emailAcTime; | ||
5580 | - | ||
5581 | -require("jquery.placeholder"); | ||
5582 | - | ||
5583 | - | ||
5584 | -//验证账户名 | ||
5585 | -function validateAccount() { | ||
5586 | - var pass = false, | ||
5587 | - account = $.trim($account.val()), | ||
5588 | - err; | ||
5589 | - | ||
5590 | - if (account !== '') { | ||
5591 | - if (/^[0-9]+$/.test(account)) { | ||
5592 | - | ||
5593 | - //如果是纯数字,则作为手机号码处理 | ||
5594 | - if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) { | ||
5595 | - pass = true; | ||
5596 | - } else { | ||
5597 | - pass = false; | ||
5598 | - err = '手机号码不正确,请重新输入'; | ||
5599 | - } | ||
5600 | - } else { | ||
5601 | - if (mailPhoneRegx.emailRegx.test(account)) { | ||
5602 | - pass = true; | ||
5603 | - } else { | ||
5604 | - pass = false; | ||
5605 | - err = '邮箱格式不正确,请重新输入'; | ||
5606 | - } | ||
5607 | - } | ||
5608 | - } else { | ||
5609 | - err = '请输入账户名'; | ||
5610 | - } | ||
5611 | - | ||
5612 | - if (pass) { | ||
5613 | - $accountTip.addClass('hide'); | ||
5614 | - $account.removeClass('error'); | ||
5615 | - } else { | ||
5616 | - $accountTip.removeClass('hide').children('em').text(err); | ||
5617 | - $account.addClass('error'); | ||
5618 | - } | ||
5619 | - return pass; | ||
5620 | -} | ||
5621 | - | ||
5622 | -//验证密码 | ||
5623 | -function validatePassword() { | ||
5624 | - var pass = false, | ||
5625 | - password = $.trim($password.val()), | ||
5626 | - err; | ||
5627 | - | ||
5628 | - if (password !== '') { | ||
5629 | - if (password.length < 6) { | ||
5630 | - err = '请输入长度为6-20字符的密码'; | ||
5631 | - } else { | ||
5632 | - pass = true; | ||
5633 | - } | ||
5634 | - } else { | ||
5635 | - err = '请输入密码'; | ||
5636 | - } | ||
5637 | - | ||
5638 | - if (pass) { | ||
5639 | - $passwordTip.addClass('hide'); | ||
5640 | - $password.removeClass('error'); | ||
5641 | - } else { | ||
5642 | - $passwordTip.removeClass('hide').children('em').text(err); | ||
5643 | - $password.addClass('error'); | ||
5644 | - } | ||
5645 | - return pass; | ||
5646 | -} | ||
5647 | - | ||
5648 | -//验证 | ||
5649 | -function validate() { | ||
5650 | - var pass = true, | ||
5651 | - account = $.trim($account.val()), | ||
5652 | - password = $.trim($password.val()); | ||
5653 | - | ||
5654 | - if (account !== '') { | ||
5655 | - pass = validateAccount() && validatePassword(); | ||
5656 | - } else { | ||
5657 | - pass = false; | ||
5658 | - $account.addClass('error'); | ||
5659 | - | ||
5660 | - if (password === '') { | ||
5661 | - | ||
5662 | - //账户名和密码都为空的情况下点击登陆,只在账户输入框后显示错误提示 | ||
5663 | - $accountTip.addClass('both-error').removeClass('hide').children('em').text('请输入账户名和密码'); | ||
5664 | - $passwordTip.addClass('hide'); | ||
5665 | - $password.addClass('error'); | ||
5666 | - } else { | ||
5667 | - $accountTip.removeClass('hide').children('em').text('请输入账户名'); | ||
5668 | - } | ||
5669 | - } | ||
5670 | - | ||
5671 | - return pass; | ||
5672 | -} | ||
5673 | - | ||
5674 | -$('[placeholder]').placeholder(); | ||
5675 | - | ||
5676 | -//展开地区列表 | ||
5677 | -$('#country-code').on('click', function() { | ||
5678 | - if ($countryList.css('display') === 'none') { | ||
5679 | - $countryList.slideDown(); | ||
5680 | - } | ||
5681 | -}); | ||
5682 | - | ||
5683 | -//选中地区列表项 | ||
5684 | -$countryList.on('click', 'li', function() { | ||
5685 | - var $this = $(this), | ||
5686 | - cc = $this.data('cc'); | ||
5687 | - | ||
5688 | - $countryCodeEm.html($this.html()); | ||
5689 | - | ||
5690 | - $countryCodeHide.val(cc); | ||
5691 | - | ||
5692 | - $countryList.slideUp(); | ||
5693 | -}); | ||
5694 | - | ||
5695 | -//点击其他区域,收起区域列表 | ||
5696 | -$(document).on('click', function(e) { | ||
5697 | - if ($(e.target).closest('#country-code').length > 0) { | ||
5698 | - return; | ||
5699 | - } | ||
5700 | - | ||
5701 | - if ($countryList.css('display') === 'block') { | ||
5702 | - $countryList.slideUp(); | ||
5703 | - } | ||
5704 | -}); | ||
5705 | - | ||
5706 | -//邮箱 | ||
5707 | -$account.on('keyup', function() { | ||
5708 | - var account = $.trim($(this).val()), | ||
5709 | - html = '', | ||
5710 | - accountMatch, | ||
5711 | - matchStr, | ||
5712 | - postfix, | ||
5713 | - i; | ||
5714 | - | ||
5715 | - //输入@时自动补全邮箱后缀 | ||
5716 | - //此处>0非错误,用于避免输入的第一个字符为@被识别为邮箱 | ||
5717 | - if (account.indexOf('@') > 0) { | ||
5718 | - accountMatch = account.match(/^[0-9]+@(.*)/); | ||
5719 | - if (accountMatch) { | ||
5720 | - | ||
5721 | - //数字邮箱补全 | ||
5722 | - postfix = mailPostfix.num; | ||
5723 | - } else { | ||
5724 | - postfix = mailPostfix.other; | ||
5725 | - } | ||
5726 | - | ||
5727 | - matchStr = accountMatch[1]; | ||
5728 | - for (i = 0; i < postfix.length; i++) { | ||
5729 | - if (postfix[i].indexOf(matchStr) > -1) { | ||
5730 | - html += '<li>' + account.slice(0, account.indexOf('@')) + '@' + postfix[i] + '</li>'; | ||
5731 | - } | ||
5732 | - } | ||
5733 | - | ||
5734 | - if (html !== '') { | ||
5735 | - $emailAutoComplete.html(html).removeClass('hide'); | ||
5736 | - } else { | ||
5737 | - | ||
5738 | - //隐藏autocomplete | ||
5739 | - $emailAutoComplete.html('').addClass('hide'); | ||
5740 | - } | ||
5741 | - } | ||
5742 | -}).on('blur', function() { | ||
5743 | - emailAcTime = setTimeout(function() { | ||
5744 | - $emailAutoComplete.addClass('hide'); | ||
5745 | - | ||
5746 | - //验证 | ||
5747 | - validateAccount(); | ||
5748 | - }, 200); | ||
5749 | - | ||
5750 | -}); | ||
5751 | - | ||
5752 | -//密码 | ||
5753 | -$password.on('blur', function() { | ||
5754 | - validatePassword(); | ||
5755 | - | ||
5756 | - if ($capsLock.hasClass('hide')) { | ||
5757 | - return; | ||
5758 | - } | ||
5759 | - | ||
5760 | - $capsLock.addClass('hide'); | ||
5761 | -}).on('keypress', function(e) { | ||
5762 | - var code = e.which; | ||
5763 | - | ||
5764 | - //CapsLock检测 | ||
5765 | - if (code >= 65 && code <= 90) { | ||
5766 | - $capsLock.removeClass('hide'); | ||
5767 | - return; | ||
5768 | - } | ||
5769 | - $capsLock.addClass('hide'); | ||
5770 | -}); | ||
5771 | - | ||
5772 | -//邮箱自动完成列表项点击 | ||
5773 | -$emailAutoComplete.on('click', 'li', function() { | ||
5774 | - clearTimeout(emailAcTime); //清空默认关闭 | ||
5775 | - | ||
5776 | - $account.val($(this).text()).focus(); | ||
5777 | - | ||
5778 | - $emailAutoComplete.addClass('hide'); | ||
5779 | -}); | ||
5780 | - | ||
5781 | -//记住登录状态 | ||
5782 | -$remember.on('click', function() { | ||
5783 | - var $this = $(this); | ||
5784 | - | ||
5785 | - $this.toggleClass('checked'); | ||
5786 | - | ||
5787 | - if ($this.hasClass('checked')) { | ||
5788 | - $this.children('i').html(checkbox.checked); | ||
5789 | - } else { | ||
5790 | - $this.children('i').html(checkbox.unchecked); | ||
5791 | - } | ||
5792 | -}); | ||
5793 | - | ||
5794 | -//focus到输入框则隐藏错误提示和样式 | ||
5795 | -$('.va').on('focus', function() { | ||
5796 | - var $this = $(this); | ||
5797 | - | ||
5798 | - $this.removeClass('error'); | ||
5799 | - | ||
5800 | - $this.siblings('.err-tip').addClass('hide'); | ||
5801 | -}); | ||
5802 | - | ||
5803 | -//登录 | ||
5804 | -$('#login-btn').on('click', function() { | ||
5805 | - var pass = validate(); | ||
5806 | - | ||
5807 | - if (pass && authing === false) { | ||
5808 | - authing = true; | ||
5809 | - | ||
5810 | - $.ajax({ | ||
5811 | - url: '/passport/login/auth', | ||
5812 | - type: 'POST', | ||
5813 | - data: { | ||
5814 | - areaCode: $countryCodeHide.val().replace('+', ''), | ||
5815 | - account: $.trim($account.val()), | ||
5816 | - password: $.trim($password.val()), | ||
5817 | - isRemember: $remember.hasClass('checked') ? true : false | ||
5818 | - }, | ||
5819 | - success: function(data) { | ||
5820 | - if (data.code === 200) { | ||
5821 | - if (data.data) { | ||
5822 | - | ||
5823 | - //防止data.data为undefined时下行语句执行出错而导致脚本不能走到complete去处理authing | ||
5824 | - location.href = data.data.session; | ||
5825 | - } | ||
5826 | - } else { | ||
5827 | - $passwordTip.removeClass('hide').children('em').text(data.message); | ||
5828 | - $password.addClass('error'); | ||
5829 | - } | ||
5830 | - }, | ||
5831 | - complete: function() { | ||
5832 | - authing = false; | ||
5833 | - } | ||
5834 | - }); | ||
5835 | - } | 5551 | +/** |
5552 | + * 登录 | ||
5553 | + * @author: xuqi<qi.xu@yoho.cn> | ||
5554 | + * @date: 2015/12/11 | ||
5555 | + */ | ||
5556 | +var $ = require("jquery"); | ||
5557 | + | ||
5558 | +var mailPostfix = { | ||
5559 | + num: ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'], | ||
5560 | + other: ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'] | ||
5561 | +}; | ||
5562 | + | ||
5563 | +var $account = $('#account'), | ||
5564 | + $password = $('#password'); | ||
5565 | + | ||
5566 | +var $accountTip = $account.siblings('.err-tip'), | ||
5567 | + $passwordTip = $password.siblings('.err-tip'), | ||
5568 | + $capsLock = $('#caps-lock'); | ||
5569 | + | ||
5570 | +var $countryCodeHide = $('#country-code-hide'), | ||
5571 | + $countryCodeEm = $('#country-code > em'), | ||
5572 | + $countryList = $('#country-list'); | ||
5573 | + | ||
5574 | +var $emailAutoComplete = $('#email-autocomplete'); | ||
5575 | + | ||
5576 | +var mailPhoneRegx = require("js/passport/mail-phone-regx"); | ||
5577 | + | ||
5578 | +var $remember = $('.remember-me'); | ||
5579 | + | ||
5580 | +//checkbox status unicode | ||
5581 | +var checkbox = { | ||
5582 | + checked: '', | ||
5583 | + unchecked: '' | ||
5584 | +}; | ||
5585 | + | ||
5586 | +var authing = false; | ||
5587 | + | ||
5588 | +var emailAcTime; | ||
5589 | + | ||
5590 | +require("jquery.placeholder"); | ||
5591 | + | ||
5592 | + | ||
5593 | +//验证账户名 | ||
5594 | +function validateAccount() { | ||
5595 | + var pass = false, | ||
5596 | + account = $.trim($account.val()), | ||
5597 | + err; | ||
5598 | + | ||
5599 | + if (account !== '') { | ||
5600 | + if (/^[0-9]+$/.test(account)) { | ||
5601 | + | ||
5602 | + //如果是纯数字,则作为手机号码处理 | ||
5603 | + if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) { | ||
5604 | + pass = true; | ||
5605 | + } else { | ||
5606 | + pass = false; | ||
5607 | + err = '手机号码不正确,请重新输入'; | ||
5608 | + } | ||
5609 | + } else { | ||
5610 | + if (mailPhoneRegx.emailRegx.test(account)) { | ||
5611 | + pass = true; | ||
5612 | + } else { | ||
5613 | + pass = false; | ||
5614 | + err = '邮箱格式不正确,请重新输入'; | ||
5615 | + } | ||
5616 | + } | ||
5617 | + } else { | ||
5618 | + err = '请输入账户名'; | ||
5619 | + } | ||
5620 | + | ||
5621 | + if (pass) { | ||
5622 | + $accountTip.addClass('hide'); | ||
5623 | + $account.removeClass('error'); | ||
5624 | + } else { | ||
5625 | + $accountTip.removeClass('hide').children('em').text(err); | ||
5626 | + $account.addClass('error'); | ||
5627 | + } | ||
5628 | + return pass; | ||
5629 | +} | ||
5630 | + | ||
5631 | +//验证密码 | ||
5632 | +function validatePassword() { | ||
5633 | + var pass = false, | ||
5634 | + password = $.trim($password.val()), | ||
5635 | + err; | ||
5636 | + | ||
5637 | + if (password !== '') { | ||
5638 | + if (password.length < 6) { | ||
5639 | + err = '请输入长度为6-20字符的密码'; | ||
5640 | + } else { | ||
5641 | + pass = true; | ||
5642 | + } | ||
5643 | + } else { | ||
5644 | + err = '请输入密码'; | ||
5645 | + } | ||
5646 | + | ||
5647 | + if (pass) { | ||
5648 | + $passwordTip.addClass('hide'); | ||
5649 | + $password.removeClass('error'); | ||
5650 | + } else { | ||
5651 | + $passwordTip.removeClass('hide').children('em').text(err); | ||
5652 | + $password.addClass('error'); | ||
5653 | + } | ||
5654 | + return pass; | ||
5655 | +} | ||
5656 | + | ||
5657 | +//验证 | ||
5658 | +function validate() { | ||
5659 | + var pass = true, | ||
5660 | + account = $.trim($account.val()), | ||
5661 | + password = $.trim($password.val()); | ||
5662 | + | ||
5663 | + if (account !== '') { | ||
5664 | + pass = validateAccount() && validatePassword(); | ||
5665 | + } else { | ||
5666 | + pass = false; | ||
5667 | + $account.addClass('error'); | ||
5668 | + | ||
5669 | + if (password === '') { | ||
5670 | + | ||
5671 | + //账户名和密码都为空的情况下点击登陆,只在账户输入框后显示错误提示 | ||
5672 | + $accountTip.addClass('both-error').removeClass('hide').children('em').text('请输入账户名和密码'); | ||
5673 | + $passwordTip.addClass('hide'); | ||
5674 | + $password.addClass('error'); | ||
5675 | + } else { | ||
5676 | + $accountTip.removeClass('hide').children('em').text('请输入账户名'); | ||
5677 | + } | ||
5678 | + } | ||
5679 | + | ||
5680 | + return pass; | ||
5681 | +} | ||
5682 | + | ||
5683 | +$('[placeholder]').placeholder(); | ||
5684 | + | ||
5685 | +//展开地区列表 | ||
5686 | +$('#country-code').on('click', function() { | ||
5687 | + if ($countryList.css('display') === 'none') { | ||
5688 | + $countryList.slideDown(); | ||
5689 | + } | ||
5690 | +}); | ||
5691 | + | ||
5692 | +//选中地区列表项 | ||
5693 | +$countryList.on('click', 'li', function() { | ||
5694 | + var $this = $(this), | ||
5695 | + cc = $this.data('cc'); | ||
5696 | + | ||
5697 | + $countryCodeEm.html($this.html()); | ||
5698 | + | ||
5699 | + $countryCodeHide.val(cc); | ||
5700 | + | ||
5701 | + $countryList.slideUp(); | ||
5702 | +}); | ||
5703 | + | ||
5704 | +//点击其他区域,收起区域列表 | ||
5705 | +$(document).on('click', function(e) { | ||
5706 | + if ($(e.target).closest('#country-code').length > 0) { | ||
5707 | + return; | ||
5708 | + } | ||
5709 | + | ||
5710 | + if ($countryList.css('display') === 'block') { | ||
5711 | + $countryList.slideUp(); | ||
5712 | + } | ||
5713 | +}); | ||
5714 | + | ||
5715 | +//邮箱 | ||
5716 | +$account.on('keyup', function() { | ||
5717 | + var account = $.trim($(this).val()), | ||
5718 | + html = '', | ||
5719 | + accountMatch, | ||
5720 | + matchStr, | ||
5721 | + postfix, | ||
5722 | + i; | ||
5723 | + | ||
5724 | + //输入@时自动补全邮箱后缀 | ||
5725 | + //此处>0非错误,用于避免输入的第一个字符为@被识别为邮箱 | ||
5726 | + if (account.indexOf('@') > 0) { | ||
5727 | + accountMatch = account.match(/^[0-9]+@(.*)/); | ||
5728 | + if (accountMatch) { | ||
5729 | + | ||
5730 | + //数字邮箱补全 | ||
5731 | + postfix = mailPostfix.num; | ||
5732 | + matchStr = accountMatch[1]; | ||
5733 | + } else { | ||
5734 | + postfix = mailPostfix.other; | ||
5735 | + matchStr = account.match(/@(.*)/)[1]; | ||
5736 | + } | ||
5737 | + | ||
5738 | + for (i = 0; i < postfix.length; i++) { | ||
5739 | + if (postfix[i].indexOf(matchStr) > -1) { | ||
5740 | + html += '<li>' + account.slice(0, account.indexOf('@')) + '@' + postfix[i] + '</li>'; | ||
5741 | + } | ||
5742 | + } | ||
5743 | + | ||
5744 | + if (html !== '' && /.com$/.test(account) === false) { | ||
5745 | + $emailAutoComplete.html(html).removeClass('hide'); | ||
5746 | + } else { | ||
5747 | + | ||
5748 | + //隐藏autocomplete | ||
5749 | + $emailAutoComplete.html('').addClass('hide'); | ||
5750 | + } | ||
5751 | + } | ||
5752 | +}).on('blur', function() { | ||
5753 | + emailAcTime = setTimeout(function() { | ||
5754 | + $emailAutoComplete.addClass('hide'); | ||
5755 | + | ||
5756 | + //验证 | ||
5757 | + validateAccount(); | ||
5758 | + }, 200); | ||
5759 | + | ||
5760 | +}); | ||
5761 | + | ||
5762 | +//密码 | ||
5763 | +$password.on('blur', function() { | ||
5764 | + validatePassword(); | ||
5765 | + | ||
5766 | + if ($capsLock.hasClass('hide')) { | ||
5767 | + return; | ||
5768 | + } | ||
5769 | + | ||
5770 | + $capsLock.addClass('hide'); | ||
5771 | +}).on('keypress', function(e) { | ||
5772 | + var code = e.which; | ||
5773 | + | ||
5774 | + //CapsLock检测 | ||
5775 | + if (code >= 65 && code <= 90) { | ||
5776 | + $capsLock.removeClass('hide'); | ||
5777 | + return; | ||
5778 | + } | ||
5779 | + $capsLock.addClass('hide'); | ||
5780 | +}); | ||
5781 | + | ||
5782 | +//邮箱自动完成列表项点击 | ||
5783 | +$emailAutoComplete.on('click', 'li', function() { | ||
5784 | + clearTimeout(emailAcTime); //清空默认关闭 | ||
5785 | + | ||
5786 | + $account.val($(this).text()).focus(); | ||
5787 | + | ||
5788 | + $emailAutoComplete.addClass('hide'); | ||
5789 | +}); | ||
5790 | + | ||
5791 | +//记住登录状态 | ||
5792 | +$remember.on('click', function() { | ||
5793 | + var $this = $(this); | ||
5794 | + | ||
5795 | + $this.toggleClass('checked'); | ||
5796 | + | ||
5797 | + if ($this.hasClass('checked')) { | ||
5798 | + $this.children('i').html(checkbox.checked); | ||
5799 | + } else { | ||
5800 | + $this.children('i').html(checkbox.unchecked); | ||
5801 | + } | ||
5802 | +}); | ||
5803 | + | ||
5804 | +//focus到输入框则隐藏错误提示和样式 | ||
5805 | +$('.va').on('focus', function() { | ||
5806 | + var $this = $(this); | ||
5807 | + | ||
5808 | + $this.removeClass('error'); | ||
5809 | + | ||
5810 | + $this.siblings('.err-tip').addClass('hide'); | ||
5811 | +}); | ||
5812 | + | ||
5813 | +//登录 | ||
5814 | +$('#login-btn').on('click', function() { | ||
5815 | + var pass = validate(); | ||
5816 | + | ||
5817 | + if (pass && authing === false) { | ||
5818 | + authing = true; | ||
5819 | + | ||
5820 | + $.ajax({ | ||
5821 | + url: '/passport/login/auth', | ||
5822 | + type: 'POST', | ||
5823 | + data: { | ||
5824 | + areaCode: $countryCodeHide.val().replace('+', ''), | ||
5825 | + account: $.trim($account.val()), | ||
5826 | + password: $.trim($password.val()), | ||
5827 | + isRemember: $remember.hasClass('checked') ? true : false | ||
5828 | + }, | ||
5829 | + success: function(data) { | ||
5830 | + if (data.code === 200) { | ||
5831 | + if (data.data) { | ||
5832 | + | ||
5833 | + //防止data.data为undefined时下行语句执行出错而导致脚本不能走到complete去处理authing | ||
5834 | + location.href = data.data.session; | ||
5835 | + } | ||
5836 | + } else { | ||
5837 | + $passwordTip.removeClass('hide').children('em').html(data.message); | ||
5838 | + $password.addClass('error'); | ||
5839 | + } | ||
5840 | + }, | ||
5841 | + complete: function() { | ||
5842 | + authing = false; | ||
5843 | + } | ||
5844 | + }); | ||
5845 | + } | ||
5836 | }); | 5846 | }); |
5837 | }); | 5847 | }); |
5838 | define("js/passport/reset", ["jquery","jquery.placeholder"], function(require, exports, module){ | 5848 | define("js/passport/reset", ["jquery","jquery.placeholder"], function(require, exports, module){ |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
-
Please register or login to post a comment