Merge branch 'release/wap-optim' of http://git.yoho.cn/fe/yohobuywap-node into release/wap-optim
Showing
13 changed files
with
216 additions
and
124 deletions
@@ -9,23 +9,29 @@ | @@ -9,23 +9,29 @@ | ||
9 | const favoriteModel = require('../models/favorite'); | 9 | const favoriteModel = require('../models/favorite'); |
10 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 10 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
11 | 11 | ||
12 | -const favorite = (req, res) => { | 12 | +const favorite = (req, res, next) => { |
13 | let tab = req.query.tab || ''; | 13 | let tab = req.query.tab || ''; |
14 | + let uid = req.user.uid; | ||
15 | + let page = 1; | ||
16 | + let limit = 10; | ||
14 | 17 | ||
15 | - res.render('favorite', { | ||
16 | - module: 'home', | ||
17 | - page: 'favorite', | ||
18 | - pageHeader: headerModel.setNav({ | ||
19 | - navTitle: '我的收藏' | ||
20 | - }), | ||
21 | - title: '我的收藏', | ||
22 | - pageFooter: true, | ||
23 | - favorite: { | ||
24 | - productUrl: '//m.yohobuy.com/product/new', | ||
25 | - brandUrl: '//m.yohobuy.com/product/new', | ||
26 | - brandTab: tab === 'brand' ? true : false // 是否为品牌收藏页 | ||
27 | - } | ||
28 | - }); | 18 | + favoriteModel.index(uid, page, limit, tab === 'brand').then((result)=>{ |
19 | + res.render('favorite', { | ||
20 | + module: 'home', | ||
21 | + page: 'favorite', | ||
22 | + pageHeader: headerModel.setNav({ | ||
23 | + navTitle: '我的收藏' | ||
24 | + }), | ||
25 | + title: '我的收藏', | ||
26 | + pageFooter: true, | ||
27 | + localCss: true, | ||
28 | + favorite: Object.assign(result, { | ||
29 | + productUrl: '//m.yohobuy.com/product/new', | ||
30 | + brandUrl: '//m.yohobuy.com/product/new', | ||
31 | + brandTab: tab === 'brand' ? true : false // 是否为品牌收藏页 | ||
32 | + }) | ||
33 | + }); | ||
34 | + }).catch(next); | ||
29 | }; | 35 | }; |
30 | 36 | ||
31 | let favProduct = (req, res, next) => { | 37 | let favProduct = (req, res, next) => { |
@@ -24,7 +24,19 @@ exports.order = (req, res, next) => { | @@ -24,7 +24,19 @@ exports.order = (req, res, next) => { | ||
24 | uid: req.user.uid | 24 | uid: req.user.uid |
25 | }; | 25 | }; |
26 | 26 | ||
27 | - orderModel.order(params).then(result => { | 27 | + // 获取第一页数据做服务端渲染 |
28 | + let initialData = { | ||
29 | + type: 1, | ||
30 | + page: 1, | ||
31 | + gender: req.query.gender || '1,3', | ||
32 | + yh_channel: req.query.channel || 1, | ||
33 | + uid: req.user.uid | ||
34 | + }; | ||
35 | + | ||
36 | + return Promise.all([ | ||
37 | + orderModel.order(params), | ||
38 | + orderModel.getOrders(initialData) | ||
39 | + ]).then(result => { | ||
28 | res.render('order', { | 40 | res.render('order', { |
29 | module: 'home', | 41 | module: 'home', |
30 | page: 'order', | 42 | page: 'order', |
@@ -33,9 +45,11 @@ exports.order = (req, res, next) => { | @@ -33,9 +45,11 @@ exports.order = (req, res, next) => { | ||
33 | }), | 45 | }), |
34 | title: 'Yoho!Buy 有货', | 46 | title: 'Yoho!Buy 有货', |
35 | pageFooter: true, | 47 | pageFooter: true, |
36 | - order: result | 48 | + order: result[0] || [], |
49 | + firstPageOrdersList: result[1] || [] | ||
37 | }); | 50 | }); |
38 | }).catch(next); | 51 | }).catch(next); |
52 | + | ||
39 | }; | 53 | }; |
40 | 54 | ||
41 | /** | 55 | /** |
@@ -45,13 +59,20 @@ exports.order = (req, res, next) => { | @@ -45,13 +59,20 @@ exports.order = (req, res, next) => { | ||
45 | * @param next | 59 | * @param next |
46 | */ | 60 | */ |
47 | exports.getOrders = (req, res, next) => { | 61 | exports.getOrders = (req, res, next) => { |
48 | - orderModel.getOrders({ | 62 | + let start = req.query.start || 0; |
63 | + | ||
64 | + let params = { | ||
49 | type: req.query.type || 1, | 65 | type: req.query.type || 1, |
50 | page: req.query.page || 1, | 66 | page: req.query.page || 1, |
51 | gender: req.query.gender || '1,3', | 67 | gender: req.query.gender || '1,3', |
52 | yh_channel: req.query.channel || 1, | 68 | yh_channel: req.query.channel || 1, |
53 | uid: req.user.uid | 69 | uid: req.user.uid |
54 | - }).then(result => { | 70 | + }; |
71 | + | ||
72 | + orderModel.getOrders(params).then(result => { | ||
73 | + if (result && parseInt(params.page, 10) === 1 && parseInt(start, 10) > 0) { | ||
74 | + result = result.slice(start || 0); | ||
75 | + } | ||
55 | res.render('order-content', { | 76 | res.render('order-content', { |
56 | layout: false, | 77 | layout: false, |
57 | orders: result | 78 | orders: result |
@@ -173,13 +173,14 @@ const favfavBrand = (uid, page, limit) => { | @@ -173,13 +173,14 @@ const favfavBrand = (uid, page, limit) => { | ||
173 | update: val.newProductNum | 173 | update: val.newProductNum |
174 | }); | 174 | }); |
175 | 175 | ||
176 | - _.forEach(val.newProduct, function(data) { | 176 | + _.forEach(val.newProduct, function(data, key) { |
177 | obj.productList.push({ | 177 | obj.productList.push({ |
178 | link: '/product/pro_' + data.productId + '_' + | 178 | link: '/product/pro_' + data.productId + '_' + |
179 | data.goods[0].id + '/' + data.cnAlphabet + '.html', | 179 | data.goods[0].id + '/' + data.cnAlphabet + '.html', |
180 | imgUrl: data.defaultImages, | 180 | imgUrl: data.defaultImages, |
181 | price: '¥' + Number(data.marketPrice).toFixed(2), | 181 | price: '¥' + Number(data.marketPrice).toFixed(2), |
182 | - discount: data.marketPrice > data.salesPrice ? '¥' + Number(data.salesPrice).toFixed(2) : false | 182 | + discount: data.marketPrice > data.salesPrice ? '¥' + Number(data.salesPrice).toFixed(2) : false, |
183 | + top3: key < 3 ? 1 : 0 | ||
183 | }); | 184 | }); |
184 | }); | 185 | }); |
185 | 186 | ||
@@ -209,9 +210,27 @@ const favoriteDelete = (uid, type, favId) => { | @@ -209,9 +210,27 @@ const favoriteDelete = (uid, type, favId) => { | ||
209 | fav_id: favId | 210 | fav_id: favId |
210 | }); | 211 | }); |
211 | }; | 212 | }; |
213 | +const index = (uid, page, limit, isbrand) => { | ||
214 | + if (isbrand) { | ||
215 | + return favfavBrand(uid, page, limit).then(result=>{ | ||
216 | + if (result.total === 0) { | ||
217 | + result = {nobrandData: 1 }; | ||
218 | + } | ||
219 | + return result; | ||
220 | + }); | ||
221 | + } else { | ||
222 | + return favProduct(uid, page, limit).then(result=>{ | ||
223 | + if (result.total === 0) { | ||
224 | + result = {noproductData: 1}; | ||
225 | + } | ||
226 | + return result; | ||
227 | + }); | ||
228 | + } | ||
229 | +}; | ||
212 | 230 | ||
213 | module.exports = { | 231 | module.exports = { |
214 | favProduct, | 232 | favProduct, |
215 | favfavBrand, | 233 | favfavBrand, |
216 | - favoriteDelete | 234 | + favoriteDelete, |
235 | + index | ||
217 | }; | 236 | }; |
1 | <div class="yoho-favorite-page yoho-page"> | 1 | <div class="yoho-favorite-page yoho-page"> |
2 | {{# favorite}} | 2 | {{# favorite}} |
3 | <ul id="fav-tab" class="fav-tab {{# brandTab}}brand-tab{{/ brandTab}}"> | 3 | <ul id="fav-tab" class="fav-tab {{# brandTab}}brand-tab{{/ brandTab}}"> |
4 | - <li>收藏的商品</li> | ||
5 | - <li>收藏的品牌</li> | 4 | + <li class="{{#unless brandTab}}active{{/ unless}}">收藏的商品</li> |
5 | + <li class="{{# brandTab}}active{{/ brandTab}}">收藏的品牌</li> | ||
6 | </ul> | 6 | </ul> |
7 | <div class="fav-content" id="fav-content"> | 7 | <div class="fav-content" id="fav-content"> |
8 | - <div class="fav-type"> | ||
9 | - <ul class="fav-product-list"></ul> | ||
10 | - <div class="fav-content-loading"></div> | 8 | + <div class="fav-type {{#unless brandTab}}show{{/unless}}"> |
9 | + <ul class="fav-product-list"> | ||
10 | + {{>favorite/favorite-product}} | ||
11 | + </ul> | ||
12 | + <div class="fav-content-loading hide"></div> | ||
11 | 13 | ||
12 | - <div class="fav-null-box hide"> | 14 | + <div class="fav-null-box {{#if noproductData}}show{{/if}}"> |
13 | <span class="fav-null">您暂无收藏任何商品</span> | 15 | <span class="fav-null">您暂无收藏任何商品</span> |
14 | <a class="go-shopping" href="{{productUrl}}">随便逛逛</a> | 16 | <a class="go-shopping" href="{{productUrl}}">随便逛逛</a> |
15 | </div> | 17 | </div> |
16 | <div class="fav-load-more fav-load-background hide"></div> | 18 | <div class="fav-load-more fav-load-background hide"></div> |
17 | </div> | 19 | </div> |
18 | - <div class="fav-type"> | ||
19 | - <div class="fav-brand-swiper-wrapper"></div> | ||
20 | - <div class="fav-content-loading"></div> | 20 | + <div class="fav-type {{# brandTab}}show{{/brandTab}}"> |
21 | + <div class="fav-brand-swiper-wrapper"> | ||
22 | + {{>favorite/favorite-brand}} | ||
23 | + </div> | ||
24 | + <div class="fav-content-loading hide"></div> | ||
21 | 25 | ||
22 | - <div class="fav-null-box hide"> | 26 | + <div class="fav-null-box {{#if nobrandData}}show{{/if}}"> |
23 | <span class="fav-null">您暂无收藏任何品牌</span> | 27 | <span class="fav-null">您暂无收藏任何品牌</span> |
24 | <a class="go-shopping" href="{{brandUrl}}">随便逛逛</a> | 28 | <a class="go-shopping" href="{{brandUrl}}">随便逛逛</a> |
25 | </div> | 29 | </div> |
@@ -27,4 +31,4 @@ | @@ -27,4 +31,4 @@ | ||
27 | </div> | 31 | </div> |
28 | </div> | 32 | </div> |
29 | {{/ favorite}} | 33 | {{/ favorite}} |
30 | -</div> | ||
34 | +</div> |
1 | -{{# hasFavBrand}} | ||
2 | -<div class="fav-brand-swiper"> | ||
3 | - <a class="swiper-header" href="{{link}}"> | ||
4 | - <div class="swiper-logo"> | ||
5 | - {{#if brandImg}} | ||
6 | - <img src="{{image brandImg 30 30}}" onerror="this.remove()" alt=""/> | ||
7 | - {{/if}} | ||
8 | - </div> | ||
9 | - <div class="brand-info"> | ||
10 | - <span class="brand-name">{{brandName}}</span> | ||
11 | - <div class="brand-update"> | ||
12 | - {{# update}} | ||
13 | - <span class="brand-new">上新<b>{{.}}</b></span> | ||
14 | - {{/ update}} | ||
15 | - {{# discount}} | ||
16 | - <span class="brand-discount">折扣<b>{{.}}</b></span> | ||
17 | - {{/ discount}} | ||
18 | - </div> | ||
19 | - </div> | ||
20 | - <span class="fav-more"></span> | ||
21 | - </a> | ||
22 | - {{#if productList}} | ||
23 | - <div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}"> | ||
24 | - <ul class="swiper-wrapper swiper-wrapper-{{id}}"> | ||
25 | - {{# productList}} | ||
26 | - <li class="swiper-slide"> | ||
27 | - <a href="{{link}}"> | ||
28 | - <img class="swiper-lazy" data-src="{{image imgUrl 235 314}}" alt=""/> | ||
29 | - </a> | ||
30 | - <div class="brand-product"> | ||
31 | - <div class="{{# discount}}price-discount{{/ discount}}"> | ||
32 | - {{# discount}}<span>{{.}}<span>{{/ discount}} | ||
33 | - <b>{{price}}</b> | ||
34 | - </div> | ||
35 | - </div> | ||
36 | - </li> | ||
37 | - {{/ productList}} | ||
38 | - </ul> | ||
39 | - </div> | ||
40 | - {{/if}} | ||
41 | -</div> | ||
42 | -{{/ hasFavBrand}} | 1 | +{{>favorite/favorite-brand}} |
1 | -{{# hasFavProduct}} | ||
2 | -<li data-id="{{favId}}" class="{{#if invalidGoods}}invalidGoods{{/if}}"> | ||
3 | - <a href="{{link}}"> | ||
4 | - <div class="fav-img-box"> | ||
5 | - <img src="{{imgUrl}}" alt=""/> | ||
6 | - </div> | ||
7 | - <div class="fav-info-list"> | ||
8 | - <h2>{{title}}</h2> | ||
9 | - <div class="fav-price"> | ||
10 | - {{# discountPrice}} | ||
11 | - <span class="new-price">{{.}}</span> | ||
12 | - {{/ discountPrice}} | ||
13 | - <span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span> | ||
14 | - </div> | ||
15 | - {{# savePrice}} | ||
16 | - <div class="save-price save-price-number"> | ||
17 | - 比收藏时降价了<span>{{.}}</span> | ||
18 | - <span class="del-fav iconfont"></span> | ||
19 | - </div> | ||
20 | - {{/ savePrice}} | ||
21 | - | ||
22 | - {{^ savePrice}} | ||
23 | - <div class="save-price"> | ||
24 | - {{# sellOut}} | ||
25 | - <span class="sell-out">已售罄</span> | ||
26 | - {{/ sellOut}} | ||
27 | - <span class="del-fav iconfont"></span> | ||
28 | - </div> | ||
29 | - {{/ savePrice}} | ||
30 | - </div> | ||
31 | - </a> | ||
32 | -</li> | ||
33 | -{{/ hasFavProduct}} | 1 | +{{>favorite/favorite-product}} |
@@ -9,6 +9,21 @@ | @@ -9,6 +9,21 @@ | ||
9 | </ul> | 9 | </ul> |
10 | 10 | ||
11 | <div id="order-container" class="order-container"> | 11 | <div id="order-container" class="order-container"> |
12 | + {{#if walkwayUrl}} | ||
13 | + <div class="no-order"> | ||
14 | + <div class="icon"></div> | ||
15 | + <span>你还没有订单!</span> | ||
16 | + <a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a> | ||
17 | + </div> | ||
18 | + {{^}} | ||
19 | + <div class="firstscreen-orders"> | ||
20 | + {{#each @root.firstPageOrdersList}} | ||
21 | + {{> order/order}} | ||
22 | + {{/each}} | ||
23 | + </div> | ||
24 | + {{/if}} | ||
25 | + | ||
26 | + | ||
12 | {{#each navs}} | 27 | {{#each navs}} |
13 | <div class="orders{{#unless active}} hide{{/unless}}"></div> | 28 | <div class="orders{{#unless active}} hide{{/unless}}"></div> |
14 | {{/each}} | 29 | {{/each}} |
1 | +{{# hasFavBrand}} | ||
2 | + <div class="fav-brand-swiper"> | ||
3 | + <a class="swiper-header" href="{{link}}"> | ||
4 | + <div class="swiper-logo"> | ||
5 | + {{#if brandImg}} | ||
6 | + <img src="{{image2 brandImg w=30 h=30 q=60}}" onerror="this.remove()" alt=""/> | ||
7 | + {{/if}} | ||
8 | + </div> | ||
9 | + <div class="brand-info"> | ||
10 | + <span class="brand-name">{{brandName}}</span> | ||
11 | + <div class="brand-update"> | ||
12 | + {{# update}} | ||
13 | + <span class="brand-new">上新<b>{{.}}</b></span> | ||
14 | + {{/ update}} | ||
15 | + {{# discount}} | ||
16 | + <span class="brand-discount">折扣<b>{{.}}</b></span> | ||
17 | + {{/ discount}} | ||
18 | + </div> | ||
19 | + </div> | ||
20 | + <span class="fav-more"></span> | ||
21 | + </a> | ||
22 | + {{#if productList}} | ||
23 | + <div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}"> | ||
24 | + <ul class="swiper-wrapper swiper-wrapper-{{id}}"> | ||
25 | + {{# productList}} | ||
26 | + <li class="swiper-slide"> | ||
27 | + <a href="{{link}}"> | ||
28 | + <img class="swiper-lazy" {{#if top3}}src{{else}}data-src{{/if}}="{{image2 imgUrl w=235 h=314 q=60}}" alt=""/> | ||
29 | + </a> | ||
30 | + <div class="brand-product"> | ||
31 | + <div class="{{# discount}}price-discount{{/ discount}}"> | ||
32 | + {{# discount}}<span>{{.}}<span>{{/ discount}} | ||
33 | + <b>{{price}}</b> | ||
34 | + </div> | ||
35 | + </div> | ||
36 | + </li> | ||
37 | + {{/ productList}} | ||
38 | + </ul> | ||
39 | + </div> | ||
40 | + {{/if}} | ||
41 | + </div> | ||
42 | +{{/ hasFavBrand}} |
1 | +{{# hasFavProduct}} | ||
2 | +<li data-id="{{favId}}" class="{{#if invalidGoods}}invalidGoods{{/if}}"> | ||
3 | + <a href="{{link}}"> | ||
4 | + <div class="fav-img-box"> | ||
5 | + <img src="{{image2 imgUrl w=30 h=30 q=60}}" alt=""/> | ||
6 | + </div> | ||
7 | + <div class="fav-info-list"> | ||
8 | + <h2>{{title}}</h2> | ||
9 | + <div class="fav-price"> | ||
10 | + {{# discountPrice}} | ||
11 | + <span class="new-price">{{.}}</span> | ||
12 | + {{/ discountPrice}} | ||
13 | + <span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span> | ||
14 | + </div> | ||
15 | + {{# savePrice}} | ||
16 | + <div class="save-price save-price-number"> | ||
17 | + 比收藏时降价了<span>{{.}}</span> | ||
18 | + <span class="del-fav iconfont"></span> | ||
19 | + </div> | ||
20 | + {{/ savePrice}} | ||
21 | + | ||
22 | + {{^ savePrice}} | ||
23 | + <div class="save-price"> | ||
24 | + {{# sellOut}} | ||
25 | + <span class="sell-out">已售罄</span> | ||
26 | + {{/ sellOut}} | ||
27 | + <span class="del-fav iconfont"></span> | ||
28 | + </div> | ||
29 | + {{/ savePrice}} | ||
30 | + </div> | ||
31 | + </a> | ||
32 | +</li> | ||
33 | +{{/ hasFavProduct}} |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | * @author: zxr | 3 | * @author: zxr |
4 | * @date: 2016/8/16 | 4 | * @date: 2016/8/16 |
5 | */ | 5 | */ |
6 | +require('../../scss/home/_favorite.css'); | ||
6 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
7 | Hammer = require('yoho-hammer'), | 8 | Hammer = require('yoho-hammer'), |
8 | Swiper = require('yoho-swiper'); | 9 | Swiper = require('yoho-swiper'); |
@@ -131,15 +132,18 @@ function loadData($parent, url, page) { | @@ -131,15 +132,18 @@ function loadData($parent, url, page) { | ||
131 | 132 | ||
132 | // 如果从品牌收藏入口进入 | 133 | // 如果从品牌收藏入口进入 |
133 | if ($('#fav-tab').hasClass('brand-tab')) { | 134 | if ($('#fav-tab').hasClass('brand-tab')) { |
134 | - showFavTab(1); | ||
135 | - loadData($favBrandList, 'favBrand', 1); | 135 | + // showFavTab(1); |
136 | + // loadData($favBrandList, 'favBrand', 1); | ||
137 | + initSwiper($favBrandList.html()); | ||
136 | brandTab = true; | 138 | brandTab = true; |
137 | window.rePosFooter(); | 139 | window.rePosFooter(); |
140 | + brandLockId = false;// 请求成功后解锁品牌收藏page++ | ||
138 | } else { | 141 | } else { |
139 | - showFavTab(0); | ||
140 | - loadData($favProductList, 'favProduct', 1); | 142 | + // showFavTab(0); |
143 | + // loadData($favProductList, 'favProduct', 1); | ||
141 | brandTab = false; | 144 | brandTab = false; |
142 | window.rePosFooter(); | 145 | window.rePosFooter(); |
146 | + lockId = false;// 请求成功后解锁商品收藏page++ | ||
143 | } | 147 | } |
144 | 148 | ||
145 | favTabHammer = new Hammer(document.getElementById('fav-tab')); | 149 | favTabHammer = new Hammer(document.getElementById('fav-tab')); |
@@ -156,13 +160,13 @@ favTabHammer.on('tap', function(e) { | @@ -156,13 +160,13 @@ favTabHammer.on('tap', function(e) { | ||
156 | if (index === 0) { | 160 | if (index === 0) { |
157 | brandTab = false; | 161 | brandTab = false; |
158 | if ($favProductList.find('li').length === 0 && | 162 | if ($favProductList.find('li').length === 0 && |
159 | - $favProductList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) { | 163 | + !$favProductList.closest('.fav-type').find('.fav-null-box').hasClass('show')) { |
160 | loadData($favProductList, 'favProduct', 1); | 164 | loadData($favProductList, 'favProduct', 1); |
161 | } | 165 | } |
162 | } else { | 166 | } else { |
163 | brandTab = true; | 167 | brandTab = true; |
164 | if ($favBrandList.find('div').length === 0 && | 168 | if ($favBrandList.find('div').length === 0 && |
165 | - $favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) { | 169 | + !$favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('show')) { |
166 | loadData($favBrandList, 'favBrand', 1); | 170 | loadData($favBrandList, 'favBrand', 1); |
167 | } | 171 | } |
168 | } | 172 | } |
@@ -20,7 +20,7 @@ var winH = $(window).height(); | @@ -20,7 +20,7 @@ var winH = $(window).height(); | ||
20 | var activeType = $navLi.filter('.active').data('type'); // 当前active的项的index | 20 | var activeType = $navLi.filter('.active').data('type'); // 当前active的项的index |
21 | 21 | ||
22 | var order = { | 22 | var order = { |
23 | - page: 0, | 23 | + page: 1, |
24 | end: false | 24 | end: false |
25 | }; | 25 | }; |
26 | 26 | ||
@@ -34,6 +34,9 @@ var orderHammer, | @@ -34,6 +34,9 @@ var orderHammer, | ||
34 | $reaMask = $('.reason-mask'), | 34 | $reaMask = $('.reason-mask'), |
35 | reasonSwiper; | 35 | reasonSwiper; |
36 | 36 | ||
37 | +// 首屏加载标志 | ||
38 | +var firstScreen = $('.firstscreen-orders').children().size() > 0; | ||
39 | + | ||
37 | require('../common'); | 40 | require('../common'); |
38 | 41 | ||
39 | // 减少计时 | 42 | // 减少计时 |
@@ -58,8 +61,8 @@ function downCount(item) { | @@ -58,8 +61,8 @@ function downCount(item) { | ||
58 | seconds; | 61 | seconds; |
59 | 62 | ||
60 | // calculate dates | 63 | // calculate dates |
61 | - hours = Math.floor((difference % _day) / _hour), | ||
62 | - minutes = Math.floor((difference % _hour) / _minute), | 64 | + hours = Math.floor((difference % _day) / _hour); |
65 | + minutes = Math.floor((difference % _hour) / _minute); | ||
63 | seconds = Math.floor((difference % _minute) / _second); | 66 | seconds = Math.floor((difference % _minute) / _second); |
64 | 67 | ||
65 | // fix dates so that it will show two digets | 68 | // fix dates so that it will show two digets |
@@ -106,6 +109,11 @@ function getOrders(option) { | @@ -106,6 +109,11 @@ function getOrders(option) { | ||
106 | page: order.page + 1 | 109 | page: order.page + 1 |
107 | }; | 110 | }; |
108 | 111 | ||
112 | + if (firstScreen) { | ||
113 | + // 如果首屏加载了,则去掉10条记录 | ||
114 | + opt.start = 10; | ||
115 | + } | ||
116 | + | ||
109 | var show = option && !option.noLoadingMask; | 117 | var show = option && !option.noLoadingMask; |
110 | 118 | ||
111 | if (inAjax) { | 119 | if (inAjax) { |
@@ -154,6 +162,9 @@ function getOrders(option) { | @@ -154,6 +162,9 @@ function getOrders(option) { | ||
154 | setTime(); | 162 | setTime(); |
155 | } | 163 | } |
156 | }); | 164 | }); |
165 | + | ||
166 | + // 还原参数 | ||
167 | + firstScreen = false; | ||
157 | } | 168 | } |
158 | 169 | ||
159 | lazyLoad({ | 170 | lazyLoad({ |
@@ -265,7 +276,7 @@ $(window).scroll(function() { | @@ -265,7 +276,7 @@ $(window).scroll(function() { | ||
265 | }); | 276 | }); |
266 | 277 | ||
267 | // 初始化请求第一页数据 | 278 | // 初始化请求第一页数据 |
268 | -getOrders(); | 279 | +//getOrders(); |
269 | 280 | ||
270 | $(function() { | 281 | $(function() { |
271 | reasonSwiper = new Swiper('.box-main', { | 282 | reasonSwiper = new Swiper('.box-main', { |
@@ -273,7 +284,7 @@ $(function() { | @@ -273,7 +284,7 @@ $(function() { | ||
273 | slidesPerView: 5, | 284 | slidesPerView: 5, |
274 | centeredSlides: true, | 285 | centeredSlides: true, |
275 | initialSlide: 0, | 286 | initialSlide: 0, |
276 | - onSlideChangeStart: function(reasonSwiper) { | 287 | + onSlideChangeStart: function(reasonSwiper) {//eslint-disable-line |
277 | var activeIndex = reasonSwiper.activeIndex, | 288 | var activeIndex = reasonSwiper.activeIndex, |
278 | slides = reasonSwiper.slides, | 289 | slides = reasonSwiper.slides, |
279 | i = 0; | 290 | i = 0; |
@@ -301,7 +312,7 @@ $(function() { | @@ -301,7 +312,7 @@ $(function() { | ||
301 | }); | 312 | }); |
302 | }); | 313 | }); |
303 | 314 | ||
304 | -$reaMask.find('.box-cmp').on('touchend', function(e) { | 315 | +$reaMask.find('.box-cmp').on('touchend', function() { |
305 | var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex], | 316 | var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex], |
306 | reason = $(selSolid).text(), | 317 | reason = $(selSolid).text(), |
307 | reasonId = $(selSolid).data('reasonId'); | 318 | reasonId = $(selSolid).data('reasonId'); |
1 | +@import "fav"; | ||
2 | +@import "../layout/swiper"; | ||
3 | + | ||
1 | .yoho-favorite-page { | 4 | .yoho-favorite-page { |
2 | width: 100%; | 5 | width: 100%; |
3 | height: auto; | 6 | height: auto; |
@@ -39,10 +42,10 @@ | @@ -39,10 +42,10 @@ | ||
39 | } | 42 | } |
40 | 43 | ||
41 | .fav-content { | 44 | .fav-content { |
42 | - | ||
43 | .fav-type { | 45 | .fav-type { |
44 | display: none; | 46 | display: none; |
45 | } | 47 | } |
48 | + | ||
46 | .show { | 49 | .show { |
47 | display: block; | 50 | display: block; |
48 | } | 51 | } |
@@ -77,6 +80,10 @@ | @@ -77,6 +80,10 @@ | ||
77 | font-size: 26px; | 80 | font-size: 26px; |
78 | border-radius: 0.2rem; | 81 | border-radius: 0.2rem; |
79 | } | 82 | } |
83 | + | ||
84 | + .fav-null-box { | ||
85 | + display: none; | ||
86 | + } | ||
80 | } | 87 | } |
81 | 88 | ||
82 | .fav-product-list { | 89 | .fav-product-list { |
@@ -178,13 +185,12 @@ | @@ -178,13 +185,12 @@ | ||
178 | background: url("/home/fav/save-price.png"); | 185 | background: url("/home/fav/save-price.png"); |
179 | width: 32px; | 186 | width: 32px; |
180 | height: 32px; | 187 | height: 32px; |
181 | - | ||
182 | position: absolute; | 188 | position: absolute; |
183 | top: 50%; | 189 | top: 50%; |
184 | left: 0; | 190 | left: 0; |
185 | margin-top: -16px; | 191 | margin-top: -16px; |
186 | - | ||
187 | } | 192 | } |
193 | + | ||
188 | span { | 194 | span { |
189 | margin-left: 15px; | 195 | margin-left: 15px; |
190 | } | 196 | } |
@@ -264,6 +270,7 @@ | @@ -264,6 +270,7 @@ | ||
264 | color: #86bf4a; | 270 | color: #86bf4a; |
265 | margin-right: 24px; | 271 | margin-right: 24px; |
266 | } | 272 | } |
273 | + | ||
267 | .brand-discount { | 274 | .brand-discount { |
268 | color: #d1021c; | 275 | color: #d1021c; |
269 | } | 276 | } |
@@ -302,6 +309,7 @@ | @@ -302,6 +309,7 @@ | ||
302 | height: 300px; | 309 | height: 300px; |
303 | overflow: hidden; | 310 | overflow: hidden; |
304 | } | 311 | } |
312 | + | ||
305 | .brand-product { | 313 | .brand-product { |
306 | height: 65px; | 314 | height: 65px; |
307 | line-height: 65px; | 315 | line-height: 65px; |
@@ -314,6 +322,7 @@ | @@ -314,6 +322,7 @@ | ||
314 | span { | 322 | span { |
315 | color: #d1021c; | 323 | color: #d1021c; |
316 | } | 324 | } |
325 | + | ||
317 | b { | 326 | b { |
318 | color: #b0b0b0; | 327 | color: #b0b0b0; |
319 | text-decoration: line-through; | 328 | text-decoration: line-through; |
@@ -337,6 +346,7 @@ | @@ -337,6 +346,7 @@ | ||
337 | background-size: auto 40%; | 346 | background-size: auto 40%; |
338 | } | 347 | } |
339 | } | 348 | } |
349 | + | ||
340 | .fav-content-loading { | 350 | .fav-content-loading { |
341 | width: 100%; | 351 | width: 100%; |
342 | height: 2rem; | 352 | height: 2rem; |
-
Please register or login to post a comment