Merge branch 'feature/optim-home-index' into release/wap-optim
Showing
9 changed files
with
72 additions
and
39 deletions
@@ -34,7 +34,8 @@ exports.index = (req, res, next) => { | @@ -34,7 +34,8 @@ exports.index = (req, res, next) => { | ||
34 | pageChannel: { | 34 | pageChannel: { |
35 | boys: true | 35 | boys: true |
36 | }, | 36 | }, |
37 | - showFooterTab: footerModel.getUrlData('mine') | 37 | + showFooterTab: footerModel.getUrlData('mine'), |
38 | + localCss: true | ||
38 | })); | 39 | })); |
39 | } | 40 | } |
40 | }).catch(next); | 41 | }).catch(next); |
@@ -74,7 +75,14 @@ exports.myDetails = (req, res, next) => { | @@ -74,7 +75,14 @@ exports.myDetails = (req, res, next) => { | ||
74 | * @param next | 75 | * @param next |
75 | */ | 76 | */ |
76 | 77 | ||
77 | -exports.record = (req, res) => { | 78 | +exports.record = (req, res, next) => { |
79 | + let uid = req.user.uid; | ||
80 | + | ||
81 | + let udid = req.user.udid; | ||
82 | + | ||
83 | + let page = req.query.page || 1; | ||
84 | + | ||
85 | + let limit = 10; | ||
78 | 86 | ||
79 | let headerData = headerModel.setNav({ | 87 | let headerData = headerModel.setNav({ |
80 | navTitle: '浏览记录' | 88 | navTitle: '浏览记录' |
@@ -86,11 +94,21 @@ exports.record = (req, res) => { | @@ -86,11 +94,21 @@ exports.record = (req, res) => { | ||
86 | page: 'browse-record', | 94 | page: 'browse-record', |
87 | title: '浏览记录', | 95 | title: '浏览记录', |
88 | browseRecordPage: true, | 96 | browseRecordPage: true, |
89 | - pageFooter: true | 97 | + pageFooter: true, |
98 | + _noLazy: true, | ||
99 | + localCss: true | ||
90 | }; | 100 | }; |
91 | 101 | ||
102 | + indexModel.recordContent(uid, udid, page, limit).then((result) => { | ||
103 | + | ||
104 | + if (result.browseRecord && result.browseRecord.length > 0) { | ||
105 | + responseData.browseRecord = result.browseRecord; | ||
106 | + } | ||
107 | + | ||
92 | res.render('browse-record', responseData); | 108 | res.render('browse-record', responseData); |
93 | 109 | ||
110 | + }).catch(next); | ||
111 | + | ||
94 | }; | 112 | }; |
95 | 113 | ||
96 | /** | 114 | /** |
@@ -106,7 +124,7 @@ exports.recordContent = (req, res, next) => { | @@ -106,7 +124,7 @@ exports.recordContent = (req, res, next) => { | ||
106 | 124 | ||
107 | let page = req.query.page || 1; | 125 | let page = req.query.page || 1; |
108 | 126 | ||
109 | - let limit = 30; | 127 | + let limit = 10; |
110 | 128 | ||
111 | indexModel.recordContent(uid, udid, page, limit).then((result) => { | 129 | indexModel.recordContent(uid, udid, page, limit).then((result) => { |
112 | 130 |
1 | {{# browseRecord}} | 1 | {{# browseRecord}} |
2 | - <a class="browse-record-good clearfix {{#if invalidGoods}}invalidGoods{{/if}}" data-skn="{{product_skn}}" href="{{link}}"> | ||
3 | - <img class="thumb lazy" data-original="{{image image 447 596}}"> | ||
4 | - <div class="deps clearfix"> | ||
5 | - <p class="name row">{{product_name}}</p> | ||
6 | - <p class="price row"> | ||
7 | - <span class="sale-price{{#unless market_price}} original-price{{/unless}}">¥{{sales_price}}</span> | ||
8 | - | ||
9 | - {{#if market_price}} | ||
10 | - <span class="market-price">¥{{market_price}}</span> | ||
11 | - {{/if}} | ||
12 | - </p> | ||
13 | - <p class="sold-out row"> | ||
14 | - {{#unless storage}} | ||
15 | - <span class="sold-out-tag">已售罄</span> | ||
16 | - {{/unless}} | ||
17 | - </p> | ||
18 | - <span class="iconfont del-icon"></span> | ||
19 | - </div> | ||
20 | - </a> | ||
21 | - | 2 | + {{> browse-record-info}} |
22 | {{/ browseRecord}} | 3 | {{/ browseRecord}} |
23 | - | ||
24 | -{{#if noRecord}} | ||
25 | - <div class="no-record"> | ||
26 | - <div class="icon"></div> | ||
27 | - <span>暂无浏览记录</span> | ||
28 | - <a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a> | ||
29 | - </div> | ||
30 | -{{/if}} |
1 | <div class="browse-record-page yoho-page"> | 1 | <div class="browse-record-page yoho-page"> |
2 | <div class="records"> | 2 | <div class="records"> |
3 | - | 3 | + {{# browseRecord}} |
4 | + {{> browse-record-info}} | ||
5 | + {{/ browseRecord}} | ||
6 | + {{#if noRecord}} | ||
7 | + <div class="no-record"> | ||
8 | + <div class="icon"></div> | ||
9 | + <span>暂无浏览记录</span> | ||
10 | + <a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a> | ||
11 | + </div> | ||
12 | + {{/if}} | ||
4 | </div> | 13 | </div> |
5 | <div class="load-more hide"> | 14 | <div class="load-more hide"> |
6 | <span class="more">正在加载...</span> | 15 | <span class="more">正在加载...</span> |
1 | +<a class="browse-record-good clearfix {{#if invalidGoods}}invalidGoods{{/if}}" data-skn="{{product_skn}}" href="{{link}}"> | ||
2 | + {{#if @root._noLazy}} | ||
3 | + <img class="thumb" src="{{image2 image w=447 h=596}}"> | ||
4 | + {{^}} | ||
5 | + <img class="thumb lazy" data-original="{{image2 image w=447 h=596}}"> | ||
6 | + {{/if}} | ||
7 | + <div class="deps clearfix"> | ||
8 | + <p class="name row">{{product_name}}</p> | ||
9 | + <p class="price row"> | ||
10 | + <span class="sale-price{{#unless market_price}} original-price{{/unless}}">¥{{sales_price}}</span> | ||
11 | + {{#if market_price}} | ||
12 | + <span class="market-price">¥{{market_price}}</span> {{/if}} | ||
13 | + </p> | ||
14 | + <p class="sold-out row"> | ||
15 | + {{#unless storage}} | ||
16 | + <span class="sold-out-tag">已售罄</span> {{/unless}} | ||
17 | + </p> | ||
18 | + <span class="iconfont del-icon"></span> | ||
19 | + </div> | ||
20 | +</a> |
@@ -17,13 +17,15 @@ var $loadMore = $('.load-more'), | @@ -17,13 +17,15 @@ var $loadMore = $('.load-more'), | ||
17 | $more = $loadMore.children('.more'), | 17 | $more = $loadMore.children('.more'), |
18 | $noMore = $loadMore.children('.no-more'); | 18 | $noMore = $loadMore.children('.no-more'); |
19 | 19 | ||
20 | -var page = 0; | 20 | +var page = 1; |
21 | 21 | ||
22 | var end = false, | 22 | var end = false, |
23 | loading = false; | 23 | loading = false; |
24 | 24 | ||
25 | var winH = $(window).height(); | 25 | var winH = $(window).height(); |
26 | 26 | ||
27 | + | ||
28 | +require('home/record.page.css'); | ||
27 | require('../common'); | 29 | require('../common'); |
28 | load.init(); | 30 | load.init(); |
29 | function moreRecord(cb) { | 31 | function moreRecord(cb) { |
@@ -12,6 +12,8 @@ var $userAvatar = $('.user-avatar'), | @@ -12,6 +12,8 @@ var $userAvatar = $('.user-avatar'), | ||
12 | var myImage = new Image(), | 12 | var myImage = new Image(), |
13 | avatar; | 13 | avatar; |
14 | 14 | ||
15 | +require('home/index.page.css'); | ||
16 | + | ||
15 | require('../common'); | 17 | require('../common'); |
16 | if ($('.recommend-for-you').length) { | 18 | if ($('.recommend-for-you').length) { |
17 | require('./recommend-for-you-user-center'); | 19 | require('./recommend-for-you-user-center'); |
@@ -10,7 +10,8 @@ var $ = require('yoho-jquery'), | @@ -10,7 +10,8 @@ var $ = require('yoho-jquery'), | ||
10 | 10 | ||
11 | var $recommendForYou = $('.recommend-for-you'); | 11 | var $recommendForYou = $('.recommend-for-you'); |
12 | 12 | ||
13 | -$.get('/product/recommend-for-you/userCenter').then(function(html) { | 13 | +setTimeout(function () { |
14 | + $.get('/product/recommend-for-you/userCenter').then(function (html) { | ||
14 | var PRDID = []; | 15 | var PRDID = []; |
15 | 16 | ||
16 | $recommendForYou.html(html); | 17 | $recommendForYou.html(html); |
@@ -19,7 +20,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { | @@ -19,7 +20,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { | ||
19 | lazyLoad($('img.lazy')); | 20 | lazyLoad($('img.lazy')); |
20 | 21 | ||
21 | // 为您优选埋点 http://redmine.yoho.cn/issues/10116 | 22 | // 为您优选埋点 http://redmine.yoho.cn/issues/10116 |
22 | - $recommendForYou.find('.good-info').each(function() { | 23 | + $recommendForYou.find('.good-info').each(function () { |
23 | PRDID.push($(this).data('id')); | 24 | PRDID.push($(this).data('id')); |
24 | }); | 25 | }); |
25 | 26 | ||
@@ -39,7 +40,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { | @@ -39,7 +40,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { | ||
39 | PAGE_NUM: 1 | 40 | PAGE_NUM: 1 |
40 | }); | 41 | }); |
41 | 42 | ||
42 | - $recommendForYou.find('.good-info').on('click', 'a', function() { | 43 | + $recommendForYou.find('.good-info').on('click', 'a', function () { |
43 | var index = $(this).closest('.good-info').index() + 1; | 44 | var index = $(this).closest('.good-info').index() + 1; |
44 | 45 | ||
45 | window.givePoint({ | 46 | window.givePoint({ |
@@ -53,6 +54,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { | @@ -53,6 +54,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { | ||
53 | return true; | 54 | return true; |
54 | }); | 55 | }); |
55 | 56 | ||
56 | -}).fail(function() { | 57 | + }).fail(function () { |
57 | $recommendForYou.hide(); | 58 | $recommendForYou.hide(); |
58 | -}); | 59 | + }); |
60 | +}, 500); |
public/scss/home/index.page.css
0 → 100644
public/scss/home/record.page.css
0 → 100644
-
Please register or login to post a comment