Authored by 姜枫

Merge branch 'feature/optim-home-index' into release/wap-optim

... ... @@ -34,7 +34,8 @@ exports.index = (req, res, next) => {
pageChannel: {
boys: true
},
showFooterTab: footerModel.getUrlData('mine')
showFooterTab: footerModel.getUrlData('mine'),
localCss: true
}));
}
}).catch(next);
... ... @@ -74,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: '浏览记录'
... ... @@ -86,11 +94,21 @@ exports.record = (req, res) => {
page: 'browse-record',
title: '浏览记录',
browseRecordPage: true,
pageFooter: true
pageFooter: true,
_noLazy: true,
localCss: true
};
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);
};
/**
... ... @@ -106,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>
... ...
<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) {
... ...
... ... @@ -12,6 +12,8 @@ var $userAvatar = $('.user-avatar'),
var myImage = new Image(),
avatar;
require('home/index.page.css');
require('../common');
if ($('.recommend-for-you').length) {
require('./recommend-for-you-user-center');
... ...
... ... @@ -10,7 +10,8 @@ var $ = require('yoho-jquery'),
var $recommendForYou = $('.recommend-for-you');
$.get('/product/recommend-for-you/userCenter').then(function(html) {
setTimeout(function () {
$.get('/product/recommend-for-you/userCenter').then(function (html) {
var PRDID = [];
$recommendForYou.html(html);
... ... @@ -19,7 +20,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) {
lazyLoad($('img.lazy'));
// 为您优选埋点 http://redmine.yoho.cn/issues/10116
$recommendForYou.find('.good-info').each(function() {
$recommendForYou.find('.good-info').each(function () {
PRDID.push($(this).data('id'));
});
... ... @@ -39,7 +40,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) {
PAGE_NUM: 1
});
$recommendForYou.find('.good-info').on('click', 'a', function() {
$recommendForYou.find('.good-info').on('click', 'a', function () {
var index = $(this).closest('.good-info').index() + 1;
window.givePoint({
... ... @@ -53,6 +54,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) {
return true;
});
}).fail(function() {
}).fail(function () {
$recommendForYou.hide();
});
});
}, 500);
... ...
@import "./home";
@import "../product/detail/recommend-for-you";
@import "../common/_good.css";
@import "../channel/_footer-tab.css";
... ...
@import '../common/dialog';
@import './browse-record';
... ...