Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
9 changed files
with
79 additions
and
73 deletions
@@ -5,16 +5,16 @@ | @@ -5,16 +5,16 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | - Hammer = require('yoho.hammer'), | ||
9 | - ellipsis = require('mlellipsis'), | ||
10 | - lazyLoad = require('yoho.lazyload'); | 8 | + Hammer = require('yoho.hammer'), |
9 | + ellipsis = require('mlellipsis'), | ||
10 | + lazyLoad = require('yoho.lazyload'); | ||
11 | 11 | ||
12 | var tip = require('../plugin/tip'); | 12 | var tip = require('../plugin/tip'); |
13 | var loading = require('../plugin/loading'); | 13 | var loading = require('../plugin/loading'); |
14 | 14 | ||
15 | var $loadMoreInfo = $('#load-more-info'); | 15 | var $loadMoreInfo = $('#load-more-info'); |
16 | var $loading = $(''), | 16 | var $loading = $(''), |
17 | - $noMore = $(''); | 17 | + $noMore = $(''); |
18 | 18 | ||
19 | var searching = false; | 19 | var searching = false; |
20 | 20 | ||
@@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) { | @@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) { | ||
34 | 34 | ||
35 | $infos.each(function() { | 35 | $infos.each(function() { |
36 | var $this = $(this), | 36 | var $this = $(this), |
37 | - $title = $this.find('.info-title'), | ||
38 | - $text = $this.find('.info-text'); | 37 | + $title = $this.find('.info-title'), |
38 | + $text = $this.find('.info-text'); | ||
39 | 39 | ||
40 | $title[0].mlellipsis(2); | 40 | $title[0].mlellipsis(2); |
41 | $text[0].mlellipsis(2); | 41 | $text[0].mlellipsis(2); |
@@ -57,10 +57,10 @@ function initInfosEvt($container) { | @@ -57,10 +57,10 @@ function initInfosEvt($container) { | ||
57 | 57 | ||
58 | cHammer.on('tap', function(e) { | 58 | cHammer.on('tap', function(e) { |
59 | var $this = $(e.target), | 59 | var $this = $(e.target), |
60 | - opt = 'ok', | ||
61 | - $likeBtn, | ||
62 | - $collectBtn, | ||
63 | - $info; | 60 | + opt = 'ok', |
61 | + $likeBtn, | ||
62 | + $collectBtn, | ||
63 | + $info; | ||
64 | 64 | ||
65 | $likeBtn = $this.closest('.like-btn'); | 65 | $likeBtn = $this.closest('.like-btn'); |
66 | if ($likeBtn.length > 0) { | 66 | if ($likeBtn.length > 0) { |
static/js/me/my-guang.js
0 → 100644
@@ -17,27 +17,32 @@ var winH = $(window).height(); | @@ -17,27 +17,32 @@ var winH = $(window).height(); | ||
17 | 17 | ||
18 | var activeType = $navLi.filter('.active').data('type'); //当前active的项的index | 18 | var activeType = $navLi.filter('.active').data('type'); //当前active的项的index |
19 | 19 | ||
20 | -var orderPage = {}; | 20 | +var order = { |
21 | + page: 0, | ||
22 | + end: false | ||
23 | +}; | ||
21 | 24 | ||
22 | var inAjax = false; | 25 | var inAjax = false; |
23 | 26 | ||
24 | var loading = require('../plugin/loading'); | 27 | var loading = require('../plugin/loading'); |
25 | 28 | ||
26 | -var navHammer, orderHammer; | 29 | +var orderHammer; |
27 | 30 | ||
28 | //加载订单 | 31 | //加载订单 |
29 | -function getOrders() { | 32 | +function getOrders(option) { |
30 | var opt = { | 33 | var opt = { |
31 | type: activeType, | 34 | type: activeType, |
32 | - page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1 | 35 | + page: order.page + 1 |
33 | }; | 36 | }; |
34 | 37 | ||
38 | + var show = option && option.showLoadingMask; | ||
39 | + | ||
35 | if (inAjax) { | 40 | if (inAjax) { |
36 | return; | 41 | return; |
37 | } | 42 | } |
38 | 43 | ||
39 | inAjax = true; | 44 | inAjax = true; |
40 | - loading.showLoadingMask(); | 45 | + show && loading.showLoadingMask(); |
41 | 46 | ||
42 | $.ajax({ | 47 | $.ajax({ |
43 | type: 'GET', | 48 | type: 'GET', |
@@ -46,23 +51,27 @@ function getOrders() { | @@ -46,23 +51,27 @@ function getOrders() { | ||
46 | success: function(data) { | 51 | success: function(data) { |
47 | var num; | 52 | var num; |
48 | 53 | ||
49 | - if (data.code === 200) { | ||
50 | - orderPage[opt.type] = opt.page; | 54 | + if (data !== ' ') { |
55 | + order.page = opt.page; | ||
51 | 56 | ||
52 | if (opt.page === 1) { | 57 | if (opt.page === 1) { |
53 | - $curContainer.html(data.data); | 58 | + $curContainer.html(data); |
54 | lazyLoad($curContainer.find('.lazy')); | 59 | lazyLoad($curContainer.find('.lazy')); |
55 | } else { | 60 | } else { |
56 | num = $curContainer.children('.order').length; | 61 | num = $curContainer.children('.order').length; |
57 | - $curContainer.append(data.data); | 62 | + $curContainer.append(data); |
58 | 63 | ||
59 | //lazyload | 64 | //lazyload |
60 | - lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy')); | 65 | + lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy')); |
61 | } | 66 | } |
67 | + | ||
68 | + window.rePosFooter(); //重新计算底部位置 | ||
69 | + } else { | ||
70 | + order.end = true; | ||
62 | } | 71 | } |
63 | 72 | ||
64 | inAjax = false; | 73 | inAjax = false; |
65 | - loading.hideLoadingMask(); | 74 | + show && loading.hideLoadingMask(); |
66 | } | 75 | } |
67 | }); | 76 | }); |
68 | } | 77 | } |
@@ -83,33 +92,6 @@ lazyLoad(); | @@ -83,33 +92,6 @@ lazyLoad(); | ||
83 | 92 | ||
84 | loading.init($('body')); //满屏loading | 93 | loading.init($('body')); //满屏loading |
85 | 94 | ||
86 | -//导航切换 | ||
87 | -navHammer = new Hammer(document.getElementById('order-nav')); | ||
88 | -navHammer.on('tap', function(e) { | ||
89 | - var $cur = $(e.target).closest('li'), | ||
90 | - index; | ||
91 | - | ||
92 | - if ($cur.length === 0 || $cur.hasClass('active')) { | ||
93 | - return; | ||
94 | - } | ||
95 | - | ||
96 | - index = $cur.index(); | ||
97 | - | ||
98 | - $navLi.filter('.active').removeClass('active'); | ||
99 | - $cur.addClass('active'); | ||
100 | - | ||
101 | - $curContainer.addClass('hide'); | ||
102 | - $curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide'); | ||
103 | - | ||
104 | - activeType = $cur.data('type'); | ||
105 | - | ||
106 | - if (orderPage[activeType]) { | ||
107 | - return; | ||
108 | - } else { | ||
109 | - getOrders(); | ||
110 | - } | ||
111 | -}); | ||
112 | - | ||
113 | //点击订单区域跳转订单详情页 | 95 | //点击订单区域跳转订单详情页 |
114 | orderHammer = new Hammer(document.getElementById('order-container')); | 96 | orderHammer = new Hammer(document.getElementById('order-container')); |
115 | orderHammer.on('tap', function(e) { | 97 | orderHammer.on('tap', function(e) { |
@@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) { | @@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) { | ||
168 | }); | 150 | }); |
169 | 151 | ||
170 | $(window).scroll(function() { | 152 | $(window).scroll(function() { |
171 | - if ($(window).scrollTop() + winH > | 153 | + if (order.end === false && $(window).scrollTop() + winH > |
172 | $(document).height() - 0.25 * $orderContainer.height()) { | 154 | $(document).height() - 0.25 * $orderContainer.height()) { |
173 | - getOrders(); | 155 | + |
156 | + //下拉请求时不显示mask | ||
157 | + getOrders({ | ||
158 | + noLoadingMask: true | ||
159 | + }); | ||
174 | } | 160 | } |
175 | }); | 161 | }); |
176 | 162 |
@@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
78 | font-size: pxToRem(32px); | 78 | font-size: pxToRem(32px); |
79 | line-height: pxToRem(88px); | 79 | line-height: pxToRem(88px); |
80 | 80 | ||
81 | - span { | 81 | + a { |
82 | color: #e0e0e0; | 82 | color: #e0e0e0; |
83 | float: right; | 83 | float: right; |
84 | } | 84 | } |
@@ -110,6 +110,7 @@ | @@ -110,6 +110,7 @@ | ||
110 | background: #fff; | 110 | background: #fff; |
111 | 111 | ||
112 | .list-item { | 112 | .list-item { |
113 | + display: block; | ||
113 | position: relative; | 114 | position: relative; |
114 | padding: 0 pxToRem(30px); | 115 | padding: 0 pxToRem(30px); |
115 | font-size: pxToRem(32px); | 116 | font-size: pxToRem(32px); |
@@ -106,7 +106,14 @@ | @@ -106,7 +106,14 @@ | ||
106 | border-bottom: 1px solid #e0e0e0; | 106 | border-bottom: 1px solid #e0e0e0; |
107 | background: #fff; | 107 | background: #fff; |
108 | 108 | ||
109 | - > li{ | 109 | + a { |
110 | + display: block; | ||
111 | + height: 100%; | ||
112 | + width: 100%; | ||
113 | + color: #b0b0b0; | ||
114 | + } | ||
115 | + | ||
116 | + > li { | ||
110 | float: left; | 117 | float: left; |
111 | height: 90rem / $pxConvertRem; | 118 | height: 90rem / $pxConvertRem; |
112 | width: 25%; | 119 | width: 25%; |
@@ -115,7 +122,7 @@ | @@ -115,7 +122,7 @@ | ||
115 | font-size: 26rem / $pxConvertRem; | 122 | font-size: 26rem / $pxConvertRem; |
116 | text-align: center; | 123 | text-align: center; |
117 | 124 | ||
118 | - &.active { | 125 | + &.active a { |
119 | color: #000; | 126 | color: #000; |
120 | } | 127 | } |
121 | } | 128 | } |
@@ -11,15 +11,15 @@ | @@ -11,15 +11,15 @@ | ||
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
13 | <div class="my-link clearfix"> | 13 | <div class="my-link clearfix"> |
14 | - <a class="link-item" href="/home"> | 14 | + <a class="link-item" href="/home/"> |
15 | {{product_favorite_total}} | 15 | {{product_favorite_total}} |
16 | <p>收藏的商品</p> | 16 | <p>收藏的商品</p> |
17 | </a> | 17 | </a> |
18 | - <a class="link-item" href="/home"> | 18 | + <a class="link-item" href="/home/"> |
19 | {{brand_favorite_total}} | 19 | {{brand_favorite_total}} |
20 | <p>收藏的品牌</p> | 20 | <p>收藏的品牌</p> |
21 | </a> | 21 | </a> |
22 | - <a class="link-item" href="/home"> | 22 | + <a class="link-item" href="/home/"> |
23 | {{product_browse}} | 23 | {{product_browse}} |
24 | <p>浏览记录</p> | 24 | <p>浏览记录</p> |
25 | </a> | 25 | </a> |
@@ -27,9 +27,9 @@ | @@ -27,9 +27,9 @@ | ||
27 | <div class="my-order"> | 27 | <div class="my-order"> |
28 | <div class="order-title"> | 28 | <div class="order-title"> |
29 | 我的订单 | 29 | 我的订单 |
30 | - <span class="iconfont"> | 30 | + <a class="iconfont" href="/home/order"> |
31 | 查看全部订单  | 31 | 查看全部订单  |
32 | - </span> | 32 | + </a> |
33 | </div> | 33 | </div> |
34 | <div class="order-type clearfix"> | 34 | <div class="order-type clearfix"> |
35 | <a class="type-item" href="/home/order"> | 35 | <a class="type-item" href="/home/order"> |
@@ -47,44 +47,44 @@ | @@ -47,44 +47,44 @@ | ||
47 | </div> | 47 | </div> |
48 | </div> | 48 | </div> |
49 | <div class="group-list"> | 49 | <div class="group-list"> |
50 | - <div class="list-item"> | 50 | + <a class="list-item" href="/home/address"> |
51 | <span class="iconfont icon"></span> | 51 | <span class="iconfont icon"></span> |
52 | 地址管理 | 52 | 地址管理 |
53 | <span class="iconfont num">3 </span> | 53 | <span class="iconfont num">3 </span> |
54 | - </div> | 54 | + </a> |
55 | </div> | 55 | </div> |
56 | <div class="group-list"> | 56 | <div class="group-list"> |
57 | - <div class="list-item"> | 57 | + <a class="list-item" href="/home/"> |
58 | <span class="iconfont icon"></span> | 58 | <span class="iconfont icon"></span> |
59 | 优惠券 | 59 | 优惠券 |
60 | <span class="iconfont num">{{coupon_num}} </span> | 60 | <span class="iconfont num">{{coupon_num}} </span> |
61 | - </div> | ||
62 | - <div class="list-item"> | 61 | + </a> |
62 | + <a class="list-item" href="/home/"> | ||
63 | <span class="iconfont icon"></span> | 63 | <span class="iconfont icon"></span> |
64 | YOHO 币 | 64 | YOHO 币 |
65 | <span class="iconfont num">{{yoho_coin_num}} </span> | 65 | <span class="iconfont num">{{yoho_coin_num}} </span> |
66 | - </div> | 66 | + </a> |
67 | </div> | 67 | </div> |
68 | <div class="group-list"> | 68 | <div class="group-list"> |
69 | - <div class="list-item"> | 69 | + <a class="list-item" href="/home/"> |
70 | <span class="iconfont icon"></span> | 70 | <span class="iconfont icon"></span> |
71 | 消息 | 71 | 消息 |
72 | <span class="iconfont num">{{inbox_total}} </span> | 72 | <span class="iconfont num">{{inbox_total}} </span> |
73 | - </div> | 73 | + </a> |
74 | </div> | 74 | </div> |
75 | <div class="group-list"> | 75 | <div class="group-list"> |
76 | - <div class="list-item"> | 76 | + <a class="list-item" href="/home/"> |
77 | <span class="iconfont icon"></span> | 77 | <span class="iconfont icon"></span> |
78 | 在线客服 | 78 | 在线客服 |
79 | <span class="iconfont num"></span> | 79 | <span class="iconfont num"></span> |
80 | - </div> | 80 | + </a> |
81 | </div> | 81 | </div> |
82 | <div class="group-list"> | 82 | <div class="group-list"> |
83 | - <div class="list-item"> | 83 | + <a class="list-item" href="/home/"> |
84 | <span class="iconfont icon"></span> | 84 | <span class="iconfont icon"></span> |
85 | 帮助 | 85 | 帮助 |
86 | <span class="iconfont num"></span> | 86 | <span class="iconfont num"></span> |
87 | - </div> | 87 | + </a> |
88 | </div> | 88 | </div> |
89 | 89 | ||
90 | {{> product/recommend-for-you}} | 90 | {{> product/recommend-for-you}} |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <ul id="order-nav" class="order-nav clearfix"> | 4 | <ul id="order-nav" class="order-nav clearfix"> |
5 | {{#each navs}} | 5 | {{#each navs}} |
6 | <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}"> | 6 | <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}"> |
7 | - {{name}} | 7 | + <a href="{{url}}">{{name}}</a> |
8 | </li> | 8 | </li> |
9 | {{/each}} | 9 | {{/each}} |
10 | </ul> | 10 | </ul> |
@@ -456,7 +456,7 @@ class HomeController extends AbstractAction | @@ -456,7 +456,7 @@ class HomeController extends AbstractAction | ||
456 | } | 456 | } |
457 | 457 | ||
458 | //ajax请求订单页面 | 458 | //ajax请求订单页面 |
459 | - public function getOrderAction() { | 459 | + public function getOrdersAction() { |
460 | //判断是不是ajax请求 | 460 | //判断是不是ajax请求 |
461 | if (!$this->isAjax()) { | 461 | if (!$this->isAjax()) { |
462 | $this->error(); | 462 | $this->error(); |
-
Please register or login to post a comment