Authored by 姜枫

优化浏览记录

... ... @@ -75,7 +75,14 @@ exports.myDetails = (req, res, next) => {
* @param next
*/
exports.record = (req, res) => {
exports.record = (req, res, next) => {
let uid = req.user.uid;
let udid = req.user.udid;
let page = req.query.page || 1;
let limit = 10;
let headerData = headerModel.setNav({
navTitle: '浏览记录'
... ... @@ -87,10 +94,20 @@ exports.record = (req, res) => {
page: 'browse-record',
title: '浏览记录',
browseRecordPage: true,
pageFooter: true
pageFooter: true,
_noLazy: true,
localCss: true
};
res.render('browse-record', responseData);
indexModel.recordContent(uid, udid, page, limit).then((result) => {
if (result.browseRecord && result.browseRecord.length > 0) {
responseData.browseRecord = result.browseRecord;
}
res.render('browse-record', responseData);
}).catch(next);
};
... ... @@ -107,7 +124,7 @@ exports.recordContent = (req, res, next) => {
let page = req.query.page || 1;
let limit = 30;
let limit = 10;
indexModel.recordContent(uid, udid, page, limit).then((result) => {
... ...
{{# browseRecord}}
<a class="browse-record-good clearfix {{#if invalidGoods}}invalidGoods{{/if}}" data-skn="{{product_skn}}" href="{{link}}">
<img class="thumb lazy" data-original="{{image image 447 596}}">
<div class="deps clearfix">
<p class="name row">{{product_name}}</p>
<p class="price row">
<span class="sale-price{{#unless market_price}} original-price{{/unless}}">¥{{sales_price}}</span>
&nbsp;&nbsp;
{{#if market_price}}
<span class="market-price">¥{{market_price}}</span>
{{/if}}
</p>
<p class="sold-out row">
{{#unless storage}}
<span class="sold-out-tag">已售罄</span>
{{/unless}}
</p>
<span class="iconfont del-icon">&#xe621;</span>
</div>
</a>
{{> browse-record-info}}
{{/ browseRecord}}
{{#if noRecord}}
<div class="no-record">
<div class="icon"></div>
<span>暂无浏览记录</span>
<a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a>
</div>
{{/if}}
\ No newline at end of file
... ...
<div class="browse-record-page yoho-page">
<div class="records">
{{# browseRecord}}
{{> browse-record-info}}
{{/ browseRecord}}
{{#if noRecord}}
<div class="no-record">
<div class="icon"></div>
<span>暂无浏览记录</span>
<a class="walk-way" href="{{walkwayUrl}}">随便逛逛</a>
</div>
{{/if}}
</div>
<div class="load-more hide">
<span class="more">正在加载...</span>
<span class="no-more hide">没有更多了</span>
</div>
</div>
\ No newline at end of file
</div>
... ...
<a class="browse-record-good clearfix {{#if invalidGoods}}invalidGoods{{/if}}" data-skn="{{product_skn}}" href="{{link}}">
{{#if @root._noLazy}}
<img class="thumb" src="{{image2 image w=447 h=596}}">
{{^}}
<img class="thumb lazy" data-original="{{image2 image w=447 h=596}}">
{{/if}}
<div class="deps clearfix">
<p class="name row">{{product_name}}</p>
<p class="price row">
<span class="sale-price{{#unless market_price}} original-price{{/unless}}">¥{{sales_price}}</span> &nbsp;&nbsp;
{{#if market_price}}
<span class="market-price">¥{{market_price}}</span> {{/if}}
</p>
<p class="sold-out row">
{{#unless storage}}
<span class="sold-out-tag">已售罄</span> {{/unless}}
</p>
<span class="iconfont del-icon">&#xe621;</span>
</div>
</a>
... ...
... ... @@ -17,13 +17,15 @@ var $loadMore = $('.load-more'),
$more = $loadMore.children('.more'),
$noMore = $loadMore.children('.no-more');
var page = 0;
var page = 1;
var end = false,
loading = false;
var winH = $(window).height();
require('home/record.page.css');
require('../common');
load.init();
function moreRecord(cb) {
... ...
... ... @@ -10,49 +10,51 @@ var $ = require('yoho-jquery'),
var $recommendForYou = $('.recommend-for-you');
$.get('/product/recommend-for-you/userCenter').then(function(html) {
var PRDID = [];
setTimeout(function () {
$.get('/product/recommend-for-you/userCenter').then(function (html) {
var PRDID = [];
$recommendForYou.html(html);
$recommendForYou.html(html);
lazyLoad($('img.lazy'));
lazyLoad($('img.lazy'));
// 为您优选埋点 http://redmine.yoho.cn/issues/10116
$recommendForYou.find('.good-info').each(function() {
PRDID.push($(this).data('id'));
});
var $recommendSonLen = $recommendForYou.find('.good-info').length;
// 为您优选埋点 http://redmine.yoho.cn/issues/10116
$recommendForYou.find('.good-info').each(function () {
PRDID.push($(this).data('id'));
});
if ($recommendSonLen === 0) {
$recommendForYou.hide();
} else {
$recommendForYou.show();
}
window.givePoint({
REC_POSE: 110004,
PRD_ID: PRDID.join(','),
PRD_NUM: $('.recommend-for-you .good-info').length,
ACTION_ID: 0,
PAGE_NUM: 1
});
var $recommendSonLen = $recommendForYou.find('.good-info').length;
$recommendForYou.find('.good-info').on('click', 'a', function() {
var index = $(this).closest('.good-info').index() + 1;
if ($recommendSonLen === 0) {
$recommendForYou.hide();
} else {
$recommendForYou.show();
}
window.givePoint({
REC_POSE: 110004,
PRD_ID: $(this).closest('.good-info').data('id'),
PRD_NUM: index,
ACTION_ID: 1,
PRD_ID: PRDID.join(','),
PRD_NUM: $('.recommend-for-you .good-info').length,
ACTION_ID: 0,
PAGE_NUM: 1
});
return true;
});
$recommendForYou.find('.good-info').on('click', 'a', function () {
var index = $(this).closest('.good-info').index() + 1;
}).fail(function() {
$recommendForYou.hide();
});
window.givePoint({
REC_POSE: 110004,
PRD_ID: $(this).closest('.good-info').data('id'),
PRD_NUM: index,
ACTION_ID: 1,
PAGE_NUM: 1
});
return true;
});
}).fail(function () {
$recommendForYou.hide();
});
}, 500);
... ...
@import '../common/dialog';
@import './browse-record';
... ...