Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy.git into develop
Showing
3 changed files
with
29 additions
and
14 deletions
@@ -124,7 +124,7 @@ | @@ -124,7 +124,7 @@ | ||
124 | <div class="search float-left {{searchcate}}" > | 124 | <div class="search float-left {{searchcate}}" > |
125 | <form action="http://search.yohobuy.com" method="get" id="searchForm"> | 125 | <form action="http://search.yohobuy.com" method="get" id="searchForm"> |
126 | <span class="searchspan"> | 126 | <span class="searchspan"> |
127 | - <input class="searchinput" type="text" name="keyword" id="query_key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30"></span> | 127 | + <input class="searchinput" type="text" name="query" id="query_key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30"></span> |
128 | <a class="icon-search" href="javascript:submitSearch();"></a> | 128 | <a class="icon-search" href="javascript:submitSearch();"></a> |
129 | <ul class="search-list"></ul> | 129 | <ul class="search-list"></ul> |
130 | </form> | 130 | </form> |
@@ -75,7 +75,8 @@ function getSource(column, postition, event) { | @@ -75,7 +75,8 @@ function getSource(column, postition, event) { | ||
75 | } catch (e) {} | 75 | } catch (e) {} |
76 | } | 76 | } |
77 | 77 | ||
78 | -function submitSearch() { | 78 | + |
79 | +window.submitSearch = function() { | ||
79 | var $keywordinput = $('#query_key').val(); | 80 | var $keywordinput = $('#query_key').val(); |
80 | var column = 'Search'; | 81 | var column = 'Search'; |
81 | var postition = 'Head Search'; | 82 | var postition = 'Head Search'; |
@@ -97,6 +98,7 @@ function submitSearch() { | @@ -97,6 +98,7 @@ function submitSearch() { | ||
97 | } | 98 | } |
98 | } | 99 | } |
99 | } | 100 | } |
101 | + | ||
100 | /** | 102 | /** |
101 | * 定义购物车扩展 | 103 | * 定义购物车扩展 |
102 | */ | 104 | */ |
@@ -185,7 +187,7 @@ function actionGoodsCart() { | @@ -185,7 +187,7 @@ function actionGoodsCart() { | ||
185 | listIndex = (listIndex + 1) % queryNum; | 187 | listIndex = (listIndex + 1) % queryNum; |
186 | getText(this); | 188 | getText(this); |
187 | } else if (event.which === 13) { | 189 | } else if (event.which === 13) { |
188 | - submitSearch(); | 190 | + window.submitSearch(); |
189 | } else { | 191 | } else { |
190 | getKeywords(this); | 192 | getKeywords(this); |
191 | } | 193 | } |
@@ -17,7 +17,7 @@ $sc.click(function() { | @@ -17,7 +17,7 @@ $sc.click(function() { | ||
17 | $.post('/passport/back/sendbackmobile', { | 17 | $.post('/passport/back/sendbackmobile', { |
18 | mobile: $('#mobile').val(), | 18 | mobile: $('#mobile').val(), |
19 | area: $('#area').val(), | 19 | area: $('#area').val(), |
20 | - verifyCode: $('#captchaPic').val(), | 20 | + verifyCode: $('#captchaPic').val() |
21 | }, function(jsonData) { | 21 | }, function(jsonData) { |
22 | if (jsonData.code === 200) { | 22 | if (jsonData.code === 200) { |
23 | $errTip.hide(); | 23 | $errTip.hide(); |
@@ -71,17 +71,33 @@ itime = setInterval(function() { | @@ -71,17 +71,33 @@ itime = setInterval(function() { | ||
71 | 71 | ||
72 | 72 | ||
73 | $('#captcha').keyup(function() { | 73 | $('#captcha').keyup(function() { |
74 | - var v = $.trim($(this).val()); | ||
75 | - | ||
76 | - if (v !== '') { | 74 | + var v = $.trim($(this).val()), |
75 | + that = this; | ||
76 | + | ||
77 | + if (v.length === 4) { | ||
78 | + $.ajax({ | ||
79 | + type: 'POST', | ||
80 | + url: '/passport/back/backmobile', | ||
81 | + dataType: 'json', | ||
82 | + data: { | ||
83 | + verifyCode: $('#captcha').val(), | ||
84 | + area: $('#area').val(), | ||
85 | + mobile: $('#mobile').val() | ||
86 | + }, | ||
87 | + success: function(res) { | ||
88 | + if (res.code === 200) { | ||
77 | 89 | ||
78 | //添加验证码正确验证 | 90 | //添加验证码正确验证 |
79 | - //$next.removeClass('disable').prop('disabled', false); | ||
80 | $next.removeClass('disable').removeAttr('disabled'); | 91 | $next.removeClass('disable').removeAttr('disabled'); |
92 | + $errTip.addClass('hide'); | ||
93 | + $(that).removeClass('error'); | ||
81 | } else { | 94 | } else { |
82 | - | ||
83 | - //$next.addClass('disable').prop('disabled', true); | ||
84 | $next.addClass('disable').attr('disabled', true); | 95 | $next.addClass('disable').attr('disabled', true); |
96 | + $errTip.removeClass('hide').find('em').text('验证码输入错误'); | ||
97 | + $(that).addClass('error'); | ||
98 | + } | ||
99 | + } | ||
100 | + }); | ||
85 | } | 101 | } |
86 | }).blur(function() { | 102 | }).blur(function() { |
87 | var v = $.trim($(this).val()); | 103 | var v = $.trim($(this).val()); |
@@ -90,10 +106,7 @@ $('#captcha').keyup(function() { | @@ -90,10 +106,7 @@ $('#captcha').keyup(function() { | ||
90 | 106 | ||
91 | //添加验证码正确验证 | 107 | //添加验证码正确验证 |
92 | $(this).addClass('error'); | 108 | $(this).addClass('error'); |
93 | - $errTip.removeClass('hide'); | ||
94 | - } else { | ||
95 | - $(this).removeClass('error'); | ||
96 | - $errTip.addClass('hide'); | 109 | + $errTip.removeClass('hide').text('请输入验证码'); |
97 | } | 110 | } |
98 | }).focus(function() { | 111 | }).focus(function() { |
99 | $(this).removeClass('error'); | 112 | $(this).removeClass('error'); |
-
Please register or login to post a comment