Authored by zhangxiaoru

exchange

... ... @@ -7,7 +7,7 @@
'use strict';
const editorialModel = require('../models/editorial');
const md5 = require('md5');
/**
* 资讯首页数据
* @param req
... ... @@ -117,6 +117,7 @@ const list = (req, res) => {
*/
const detail = (req, res, next) => {
let id = req.params.id;
let clientType = 'pc';
editorialModel.getDetailData(id).then((result) => {
res.display('detail', {
... ... @@ -207,7 +208,7 @@ let cancelCollect = (req, res, next) => {
* @param next
*/
let setPraise = (req, res, next) => {
let udid = req.sessionID;
let udid = md5(req.ip);
let id = req.body.id;
let appType = 1;
... ... @@ -223,7 +224,7 @@ let setPraise = (req, res, next) => {
* @param next
*/
let cancelPraise = (req, res, next) => {
let udid = req.sessionID;
let udid = md5(req.ip);
let id = req.body.id;
let appType = 1;
... ...
... ... @@ -55,16 +55,17 @@ const _processListData = (list) => {
listData = _.assign(listData, {
total: list.total
});
// console.log(list)
_.forEach(list.list.artList, (data, index) => {
_.forEach(list.list.artList, (data) => {
if (data.author) {
listData = _.assign(listData, {
authorName: data.author.name
});
}
data.publishTime = data.publishTime.replace(/年|月/g, '/');
data.publishTime = data.publishTime.replace(/日/g, '');
... ... @@ -72,6 +73,7 @@ const _processListData = (list) => {
});
listData.tabs = list.list.artList;
// console.log(listData)
return listData;
};
... ... @@ -262,7 +264,7 @@ const _processHeadData = (list) => {
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) => {
... ... @@ -336,34 +338,35 @@ const _processContentData = (list) => {
if (value.goodsGroup) {
_.forEach(value.goodsGroup.data, function(data) {
// console.log(data)
_.forEach(data.list, function(value) {
sknList += value.id + ',';
formatData.push(value);
});
});
// _.forEach(value.goodsGroup.data, function(data) {
// // console.log(data)
// // _.forEach(data.list, function(value) {
// // sknList += value.id + ',';
// // formatData.push(value);
// // });
// });
}
});
_getRelatedData(sknList).then((result) => {
_.forEach(formatData, function(data, index) {
//console.log(formatData)
// console.log(formatData)
data[index] = _.assign(result[index]);
});
//console.log(formatData)
// console.log(formatData)
return formatData;
}).then(() => {
});
return contentData;
return contentData;
};
/**
... ... @@ -511,7 +514,7 @@ const cancelCollect = (id, uid, appType) => {
*/
const setPraise = (id, udid, appType) => {
return serviceAPI.get('/guang/api/*/praise/setPraise', {
return serviceAPI.get('/guang/api/v2/praise/setPraise', {
article_id: id,
udid: udid,
app_type: appType
... ... @@ -526,7 +529,7 @@ const setPraise = (id, udid, appType) => {
*/
const cancelPraise = (id, udid, appType) => {
return serviceAPI.get('/guang/api/*/praise/cancel', {
return serviceAPI.get('/guang/api/v2/praise/cancel', {
article_id: id,
udid: udid,
app_type: appType
... ...
... ... @@ -17,8 +17,8 @@ router.get('/(:id).html', editorial.detail);// 资讯详情页
router.post('/info/collect', editorial.setCollect);// 资讯收藏
router.post('/info/cancelcollect', editorial.cancelCollect);// 资讯取消收藏
router.get('/info/praise', editorial.setPraise);// 点赞
router.get('/info/cancelPraise', editorial.cancelPraise);// 取消点赞
router.post('/info/praise', editorial.setPraise);// 点赞
router.post('/info/cancelPraise', editorial.cancelPraise);// 取消点赞
router.post('/info/comment', editorial.addComment);// 添加评论
module.exports = router;
... ...
... ... @@ -39,7 +39,7 @@ $('#prise-btn').click(function() {
}
prising = true;
$.ajax({
type: 'GET',
type: 'post',
url: url,
data: {
id: articleId
... ...
... ... @@ -23,7 +23,7 @@ $('.editorial-index-page').on('click', '.like-icon', function() {
url = '/editorial/info/praise';
}
$.ajax({
type: 'GET',
type: 'POST',
url: url,
data: {
id: msgId,
... ... @@ -31,8 +31,8 @@ $('.editorial-index-page').on('click', '.like-icon', function() {
}
}).then(function(data) {
if (data.code === 200) {
$this.toggleClass('liked');
$this.next('b').html(data.data);
$this.toggleClass('liked');
} else {
new _alert(data.message).show();
}
... ... @@ -46,7 +46,7 @@ $('.msg-title').each(function() {
var $this = $(this),
$text = $this.text();
if ($text.length > 64) {
$this.html($text.substring(0, 61) + '...');
if ($text.length > 68) {
$this.html($text.substring(0, 64) + '...');
}
})
\ No newline at end of file
});
... ...
... ... @@ -26,7 +26,7 @@ $('.editorial-list-page').on('click', '.like-icon', function() {
url = '/editorial/info/praise';
}
$.ajax({
type: 'GET',
type: 'POST',
url: url,
data: {
id: msgId,
... ...
div.blk-pagination {
width: 500px;
padding: 0;
a {
... ...
... ... @@ -27,11 +27,6 @@
line-height: 30px;
max-height: 64px;
overflow: hidden;
/*word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;*/
}
.msg-title:hover {
... ...