Authored by whb

index js css

@@ -399,7 +399,8 @@ function getSource(column, postition, event) { @@ -399,7 +399,8 @@ function getSource(column, postition, event) {
399 } catch (e) {} 399 } catch (e) {}
400 } 400 }
401 401
402 -function submitSearch() { 402 +
  403 +window.submitSearch = function() {
403 var $keywordinput = $('#query_key').val(); 404 var $keywordinput = $('#query_key').val();
404 var column = 'Search'; 405 var column = 'Search';
405 var postition = 'Head Search'; 406 var postition = 'Head Search';
@@ -421,6 +422,7 @@ function submitSearch() { @@ -421,6 +422,7 @@ function submitSearch() {
421 } 422 }
422 } 423 }
423 } 424 }
  425 +
424 /** 426 /**
425 * 定义购物车扩展 427 * 定义购物车扩展
426 */ 428 */
@@ -509,7 +511,7 @@ function actionGoodsCart() { @@ -509,7 +511,7 @@ function actionGoodsCart() {
509 listIndex = (listIndex + 1) % queryNum; 511 listIndex = (listIndex + 1) % queryNum;
510 getText(this); 512 getText(this);
511 } else if (event.which === 13) { 513 } else if (event.which === 13) {
512 - submitSearch(); 514 + window.submitSearch();
513 } else { 515 } else {
514 getKeywords(this); 516 getKeywords(this);
515 } 517 }
@@ -1830,6 +1832,8 @@ require("js/product/filter"); @@ -1830,6 +1832,8 @@ require("js/product/filter");
1830 1832
1831 require("js/product/sort-pager"); 1833 require("js/product/sort-pager");
1832 1834
  1835 +require("js/product/latest-walk");
  1836 +
1833 require("js/product/product"); 1837 require("js/product/product");
1834 }); 1838 });
1835 define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){ 1839 define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){
@@ -2144,6 +2148,9 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() { @@ -2144,6 +2148,9 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() {
2144 var $this = $(this); 2148 var $this = $(this);
2145 var index = $this.index(); 2149 var index = $this.index();
2146 2150
  2151 + if ($this.hasClass('no-sub')) {
  2152 + return;
  2153 + }
2147 $this.addClass('hover').siblings().removeClass('hover'); 2154 $this.addClass('hover').siblings().removeClass('hover');
2148 2155
2149 $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide'); 2156 $seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
@@ -2151,6 +2158,10 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() { @@ -2151,6 +2158,10 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() {
2151 var $this = $(this), 2158 var $this = $(this),
2152 index = $this.index(); 2159 index = $this.index();
2153 2160
  2161 + if ($this.hasClass('no-sub')) {
  2162 + return;
  2163 + }
  2164 +
2154 hoveredIndex = index; 2165 hoveredIndex = index;
2155 2166
2156 seniorHoverTime = setTimeout(function() { 2167 seniorHoverTime = setTimeout(function() {
@@ -2214,6 +2225,65 @@ $countPerPage.click(function() { @@ -2214,6 +2225,65 @@ $countPerPage.click(function() {
2214 } 2225 }
2215 }); 2226 });
2216 }); 2227 });
  2228 +define("js/product/latest-walk", ["jquery","handlebars","source-map","lazyload"], function(require, exports, module){
  2229 +/**
  2230 + * 最近浏览取接口渲染模板
  2231 + * @author: xuqi<qi.xu@yoho.cn>
  2232 + 8 @date: 2016/1/20
  2233 + */
  2234 +
  2235 +var $ = require("jquery");
  2236 +var Handlebars = require("handlebars");
  2237 +var lazyLoad = require("lazyload");
  2238 +
  2239 +var $latestWalkCount = $('#latest-walk-count');
  2240 +
  2241 +(function() {
  2242 + var tpl;
  2243 +
  2244 + if ($latestWalkCount.lenght < 0) {
  2245 + return;
  2246 + }
  2247 +
  2248 + tpl = Handlebars.compile($('#latest-walk-tpl').html());
  2249 +
  2250 + $.ajax({
  2251 + url: 'http://itemapi.yohobuy.com/item/item/recentreview',
  2252 + dataType: 'jsonp',
  2253 + data: {
  2254 + limit: $latestWalkCount.val()
  2255 + },
  2256 + success: function(data) {
  2257 + var latestWalk = [],
  2258 + res, i, cur;
  2259 +
  2260 + if (data.code === 200) {
  2261 + res = data.data;
  2262 +
  2263 + for (i = 0; i < res.length; i++) {
  2264 + cur = res[i];
  2265 +
  2266 + latestWalk.push({
  2267 + href: cur.url,
  2268 + img: cur.pic_url,
  2269 + name: cur.product_name,
  2270 + salePrice: cur.price,
  2271 + marketPrice: cur.market_price
  2272 + });
  2273 + }
  2274 +
  2275 + if (latestWalk.length > 0) {
  2276 + $('#latest-walk-goods').html(tpl({
  2277 + latestWalk: latestWalk
  2278 + }));
  2279 +
  2280 + lazyLoad($('#latest-walk-goods .lazy'));
  2281 + }
  2282 + }
  2283 + }
  2284 + });
  2285 +}());
  2286 +});
2217 define("js/product/product", ["jquery","lazyload"], function(require, exports, module){ 2287 define("js/product/product", ["jquery","lazyload"], function(require, exports, module){
2218 /** 2288 /**
2219 *Description: 商品列表页 2289 *Description: 商品列表页
@@ -5778,7 +5848,7 @@ $sc.click(function() { @@ -5778,7 +5848,7 @@ $sc.click(function() {
5778 $.post('/passport/back/sendbackmobile', { 5848 $.post('/passport/back/sendbackmobile', {
5779 mobile: $('#mobile').val(), 5849 mobile: $('#mobile').val(),
5780 area: $('#area').val(), 5850 area: $('#area').val(),
5781 - verifyCode: $('#captchaPic').val(), 5851 + verifyCode: $('#captchaPic').val()
5782 }, function(jsonData) { 5852 }, function(jsonData) {
5783 if (jsonData.code === 200) { 5853 if (jsonData.code === 200) {
5784 $errTip.hide(); 5854 $errTip.hide();
@@ -5832,17 +5902,34 @@ itime = setInterval(function() { @@ -5832,17 +5902,34 @@ itime = setInterval(function() {
5832 5902
5833 5903
5834 $('#captcha').keyup(function() { 5904 $('#captcha').keyup(function() {
5835 - var v = $.trim($(this).val()); 5905 + var v = $.trim($(this).val()),
  5906 + that = this;
5836 5907
5837 - if (v !== '') { 5908 + if (v.length === 4) {
  5909 + $.ajax({
  5910 + type: 'POST',
  5911 + url: '/passport/back/backmobile',
  5912 + dataType: 'json',
  5913 + data: {
  5914 + code: $('#captcha').val(),
  5915 + verifyCode: $("#captchaPic").val(),
  5916 + area: $('#area').val(),
  5917 + mobile: $('#mobile').val()
  5918 + },
  5919 + success: function(res) {
  5920 + if (res.code === 200) {
5838 5921
5839 //添加验证码正确验证 5922 //添加验证码正确验证
5840 - //$next.removeClass('disable').prop('disabled', false);  
5841 $next.removeClass('disable').removeAttr('disabled'); 5923 $next.removeClass('disable').removeAttr('disabled');
  5924 + $errTip.addClass('hide');
  5925 + $(that).removeClass('error');
5842 } else { 5926 } else {
5843 -  
5844 - //$next.addClass('disable').prop('disabled', true);  
5845 $next.addClass('disable').attr('disabled', true); 5927 $next.addClass('disable').attr('disabled', true);
  5928 + $errTip.removeClass('hide').find('em').text('验证码输入错误');
  5929 + $(that).addClass('error');
  5930 + }
  5931 + }
  5932 + });
5846 } 5933 }
5847 }).blur(function() { 5934 }).blur(function() {
5848 var v = $.trim($(this).val()); 5935 var v = $.trim($(this).val());
@@ -5851,10 +5938,7 @@ $('#captcha').keyup(function() { @@ -5851,10 +5938,7 @@ $('#captcha').keyup(function() {
5851 5938
5852 //添加验证码正确验证 5939 //添加验证码正确验证
5853 $(this).addClass('error'); 5940 $(this).addClass('error');
5854 - $errTip.removeClass('hide');  
5855 - } else {  
5856 - $(this).removeClass('error');  
5857 - $errTip.addClass('hide'); 5941 + $errTip.removeClass('hide').text('请输入验证码');
5858 } 5942 }
5859 }).focus(function() { 5943 }).focus(function() {
5860 $(this).removeClass('error'); 5944 $(this).removeClass('error');
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.