Authored by zhangxiaoru

editorial

... ... @@ -207,8 +207,8 @@ let cancelCollect = (req, res, next) => {
* @param next
*/
let setPraise = (req, res, next) => {
let udid = req.user.udid;
let id = req.query.id;
let udid = req.sessionID;
let id = req.body.id;
let appType = 1;
editorialModel.setPraise(id, udid, appType).then((result) => {
... ... @@ -223,8 +223,8 @@ let setPraise = (req, res, next) => {
* @param next
*/
let cancelPraise = (req, res, next) => {
let udid = req.user.udid;
let id = req.query.id;
let udid = req.sessionID;
let id = req.body.id;
let appType = 1;
editorialModel.cancelPraise(id, udid, appType).then((result) => {
... ...
... ... @@ -5,7 +5,6 @@
*/
'use strict';
const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
... ... @@ -56,14 +55,16 @@ const _processListData = (list) => {
listData = _.assign(listData, {
total: list.total
});
// console.log(list)
_.forEach(list.list.artList, (data, index) => {
if (index === 0) {
if (data.author) {
listData = _.assign(listData, {
authorName: data.author.name
});
}
data.publishTime = data.publishTime.replace(/年|月/g, '/');
data.publishTime = data.publishTime.replace(/日/g, '');
... ... @@ -258,10 +259,11 @@ const _processHeadData = (list) => {
// 推荐商品
const _getRelatedData = () => {
const _getRelatedData = (sknList) => {
// console.log(id);
return api.get('', {
query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256',
//query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256,',
qurey: sknList,
method: 'app.search.li'
}).then((result) => {
let productList = [];
... ... @@ -317,6 +319,7 @@ const _processContentData = (list) => {
contentData.contents = list;
// let idList = '';
let sknList = '';
let formatData = [];
_.forEach(contentData.contents, function(value) {
... ... @@ -330,46 +333,37 @@ const _processContentData = (list) => {
formatData.push(data);
});
}
});
// console.log(formatData)
if (value.goodsGroup) {
_.forEach(value.goodsGroup.data, function(data) {
// console.log(data)
_.forEach(data.list, function(value) {
sknList += value.id + ',';
formatData.push(value);
});
});
}
});
_getRelatedData().then((result) => {
// formatData.push(result);
// console.log(formatData);
_getRelatedData(sknList).then((result) => {
_.forEach(formatData, function(data, index) {
//console.log(formatData)
data[index] = _.assign(result[index]);
});
// console.log(formatData);
//console.log(formatData)
return formatData;
}).then(() => {
});
// if (value.goodsGroup) {
// _.forEach(value.goodsGroup.data, function(data) {
// // console.log(data)
// _.forEach(data.list, function(value) {
// // console.log(value)
// _getRelatedData(51152761).then((result) => {
// // console.log(result)
// value = _.assign(value, result);
// value = _.assign(value, {
// link: `${config.siteUrl}/product/pro_${result.id}_${value.productSkc}/${result.cnAlphabet}`
// });
// // console.log(value)
// });
// });
// });
// }
return contentData;
return contentData;
};
/**
... ...
... ... @@ -42,7 +42,7 @@
</div>
{{/ text}}
{{# goods}}
{{!-- {{# goods}}
<div class="related-reco">
<div class="article-title">
<div class="title-line"></div>
... ... @@ -80,7 +80,7 @@
{{/ data}}
</div>
</div>
{{/ goodsGroup}}
{{/ goodsGroup}} --}}
{{/ content}}
{{#if brands}}
... ...
... ... @@ -86,6 +86,8 @@ $('#collect-btn').click(function() {
if (data.code === 200) {
new _alert(data.message).show();
$this.toggleClass('collected');
} else if (data.code === 400) {
window.location.href = 'http://www.yohobuy.com/passport/login';
} else {
new _alert(data.message).show();
}
... ... @@ -134,6 +136,8 @@ function comment() {
// clear comment-text
$('#comment-info').val('').keyup();
} else if (data.code === 400) {
window.location.href = 'http://www.yohobuy.com/passport/login';
} else {
new _alert(data.message).show();
}
... ...
... ... @@ -41,3 +41,12 @@ $('.editorial-index-page').on('click', '.like-icon', function() {
}).on('mouseenter mouseleave', '.like-icon', function() {
$(this).closest('.like').toggleClass('hover');
});
$('.msg-title').each(function() {
var $this = $(this),
$text = $this.text();
if ($text.length > 64) {
$this.html($text.substring(0, 61) + '...');
}
})
\ No newline at end of file
... ...
... ... @@ -430,4 +430,8 @@
}
}
.blk-pagination {
width: 400px;
}
}
... ...
... ... @@ -26,12 +26,12 @@
color: #333;
line-height: 30px;
max-height: 64px;
word-wrap: break-word;
overflow: hidden;
/*word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
-webkit-box-orient: vertical;*/
}
.msg-title:hover {
... ...