Authored by lijing

浏览历史

... ... @@ -92,21 +92,28 @@ exports.record = (req, res) => {
};
exports.recordContent = (req, res, next) => {
let uid = req.user.uid || 6228593; // TODO
let uid = req.user.uid;
let udid = req.user.udid;
let page = req.query.page || 1;
let limit = 10;
let limit = 30;
indexModel.recordContent(uid, udid, page, limit).then((result) => {
res.render('browse-record-content', result);
if (result.browseRecord && result.browseRecord.length === 0) {
res.json(false);
} else {
res.render('browse-record-content', Object.assign({
layout: false
}, result));
}
}).catch(next);
};
exports.delRecord = (req, res, next) => {
let uid = req.user.uid || 6228593; // TODO
let uid = req.user.uid;
let skn = req.user.skn || 0;
... ...
... ... @@ -154,47 +154,49 @@ const recordContent = (uid, udid, page, limit) => {
return api.get('', {
method: 'app.browse.product',
uid: uid || 6228593, // TODO
uid: uid,
limit: limit,
page: page
}, {code: 200}).then((result) => {
let resu = {
browseRecord: []
};
let resu = {};
if (result && result.code === 200) {
let list = result;
// 不能再查到结果了
if (page > 1 && list === []) {
if (!result || page === '1' && result.data.total === 0) {
resu.walkwayUrl = helpers.urlFormat('/product/new');
resu.noRecord = true;
}
if (result.data.total === 0) {
resu.total = 0;
return resu;
}
_.forEach(list.data.product_list, function(val) {
let obj = {
productList: []
if (list.data && list.data.product_list) {
resu = {
browseRecord: []
};
obj = _.assign(obj, {
product_name: val.product_name,
product_skn: val.product_skn,
storage: val.storage,
image: val.image,
link: '/product/show_' + val.product_skn + '.html',
sales_price: val.sales_price,
market_price: (val.market_price - val.sales_price) > 0 ? val.market_price : false,
invalidGoods: val.status === 0
_.forEach(list.data.product_list, function(val) {
let obj = {
productList: []
};
obj = _.assign(obj, {
product_name: val.product_name,
product_skn: val.product_skn,
storage: val.storage,
image: val.image,
link: '/product/show_' + val.product_skn + '.html',
sales_price: val.sales_price,
market_price: (val.market_price - val.sales_price) > 0 ? val.market_price : false,
invalidGoods: val.status === 0
});
resu.browseRecord.push(obj);
});
}
resu.browseRecord.push(obj);
});
return resu;
}
});
... ...
... ... @@ -45,9 +45,8 @@ function moreRecord(cb) {
page: page + 1
},
success: function(data) {
if (data === ' ') {
if (!data) {
end = true;
$more.addClass('hide');
$noMore.removeClass('hide');
} else {
... ... @@ -65,7 +64,7 @@ function moreRecord(cb) {
page++;
if (cb) {
cb();
//cb();
}
}
},
... ...
... ... @@ -35,7 +35,7 @@
.sale-price {
color: #f00;
&.original-price {
color: #000;
}
... ... @@ -80,13 +80,13 @@
background: #fff;
text-align: center;
top: 50%;
margin-top: -220px;
margin-top: 200px;
width: 100%;
.icon {
width: 196px;
height: 207px;
background: resolve('me/no-record.png') no-repeat;
background: resolve("me/no-record.png") no-repeat;
background-size: 100%;
margin: 0 auto;
}
... ...