Authored by zhangxiaoru

editorial

@@ -207,8 +207,8 @@ let cancelCollect = (req, res, next) => { @@ -207,8 +207,8 @@ let cancelCollect = (req, res, next) => {
207 * @param next 207 * @param next
208 */ 208 */
209 let setPraise = (req, res, next) => { 209 let setPraise = (req, res, next) => {
210 - let udid = req.user.udid;  
211 - let id = req.query.id; 210 + let udid = req.sessionID;
  211 + let id = req.body.id;
212 let appType = 1; 212 let appType = 1;
213 213
214 editorialModel.setPraise(id, udid, appType).then((result) => { 214 editorialModel.setPraise(id, udid, appType).then((result) => {
@@ -223,8 +223,8 @@ let setPraise = (req, res, next) => { @@ -223,8 +223,8 @@ let setPraise = (req, res, next) => {
223 * @param next 223 * @param next
224 */ 224 */
225 let cancelPraise = (req, res, next) => { 225 let cancelPraise = (req, res, next) => {
226 - let udid = req.user.udid;  
227 - let id = req.query.id; 226 + let udid = req.sessionID;
  227 + let id = req.body.id;
228 let appType = 1; 228 let appType = 1;
229 229
230 editorialModel.cancelPraise(id, udid, appType).then((result) => { 230 editorialModel.cancelPraise(id, udid, appType).then((result) => {
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 const serviceAPI = global.yoho.ServiceAPI; 7 const serviceAPI = global.yoho.ServiceAPI;
8 -  
9 const api = global.yoho.API; 8 const api = global.yoho.API;
10 const camelCase = global.yoho.camelCase; 9 const camelCase = global.yoho.camelCase;
11 const _ = require('lodash'); 10 const _ = require('lodash');
@@ -56,14 +55,16 @@ const _processListData = (list) => { @@ -56,14 +55,16 @@ const _processListData = (list) => {
56 listData = _.assign(listData, { 55 listData = _.assign(listData, {
57 total: list.total 56 total: list.total
58 }); 57 });
  58 + // console.log(list)
59 59
60 _.forEach(list.list.artList, (data, index) => { 60 _.forEach(list.list.artList, (data, index) => {
61 - if (index === 0) { 61 +
  62 + if (data.author) {
62 listData = _.assign(listData, { 63 listData = _.assign(listData, {
63 authorName: data.author.name 64 authorName: data.author.name
64 }); 65 });
65 } 66 }
66 - 67 +
67 data.publishTime = data.publishTime.replace(/年|月/g, '/'); 68 data.publishTime = data.publishTime.replace(/年|月/g, '/');
68 data.publishTime = data.publishTime.replace(/日/g, ''); 69 data.publishTime = data.publishTime.replace(/日/g, '');
69 70
@@ -258,10 +259,11 @@ const _processHeadData = (list) => { @@ -258,10 +259,11 @@ const _processHeadData = (list) => {
258 259
259 260
260 // 推荐商品 261 // 推荐商品
261 -const _getRelatedData = () => { 262 +const _getRelatedData = (sknList) => {
262 // console.log(id); 263 // console.log(id);
263 return api.get('', { 264 return api.get('', {
264 - query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256', 265 + //query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256,',
  266 + qurey: sknList,
265 method: 'app.search.li' 267 method: 'app.search.li'
266 }).then((result) => { 268 }).then((result) => {
267 let productList = []; 269 let productList = [];
@@ -317,6 +319,7 @@ const _processContentData = (list) => { @@ -317,6 +319,7 @@ const _processContentData = (list) => {
317 contentData.contents = list; 319 contentData.contents = list;
318 320
319 // let idList = ''; 321 // let idList = '';
  322 + let sknList = '';
320 let formatData = []; 323 let formatData = [];
321 324
322 _.forEach(contentData.contents, function(value) { 325 _.forEach(contentData.contents, function(value) {
@@ -330,46 +333,37 @@ const _processContentData = (list) => { @@ -330,46 +333,37 @@ const _processContentData = (list) => {
330 formatData.push(data); 333 formatData.push(data);
331 }); 334 });
332 } 335 }
333 - });  
334 336
335 - // console.log(formatData) 337 + if (value.goodsGroup) {
  338 +
  339 + _.forEach(value.goodsGroup.data, function(data) {
  340 + // console.log(data)
  341 + _.forEach(data.list, function(value) {
  342 + sknList += value.id + ',';
  343 +
  344 + formatData.push(value);
  345 +
  346 + });
  347 + });
  348 + }
  349 + });
336 350
337 - _getRelatedData().then((result) => {  
338 - // formatData.push(result);  
339 - // console.log(formatData); 351 + _getRelatedData(sknList).then((result) => {
340 352
341 _.forEach(formatData, function(data, index) { 353 _.forEach(formatData, function(data, index) {
  354 + //console.log(formatData)
342 355
343 data[index] = _.assign(result[index]); 356 data[index] = _.assign(result[index]);
344 - 357 +
345 }); 358 });
346 -  
347 - // console.log(formatData); 359 + //console.log(formatData)
348 return formatData; 360 return formatData;
349 361
350 }).then(() => { 362 }).then(() => {
351 - 363 +
352 }); 364 });
353 365
354 -// if (value.goodsGroup) {  
355 -// _.forEach(value.goodsGroup.data, function(data) {  
356 -// // console.log(data)  
357 -// _.forEach(data.list, function(value) {  
358 -// // console.log(value)  
359 -// _getRelatedData(51152761).then((result) => {  
360 -// // console.log(result)  
361 -// value = _.assign(value, result);  
362 -// value = _.assign(value, {  
363 -// link: `${config.siteUrl}/product/pro_${result.id}_${value.productSkc}/${result.cnAlphabet}`  
364 -// });  
365 -  
366 -// // console.log(value)  
367 -// });  
368 -// });  
369 -// });  
370 -// }  
371 -  
372 - return contentData; 366 + return contentData;
373 }; 367 };
374 368
375 /** 369 /**
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 </div> 42 </div>
43 {{/ text}} 43 {{/ text}}
44 44
45 - {{# goods}} 45 + {{!-- {{# goods}}
46 <div class="related-reco"> 46 <div class="related-reco">
47 <div class="article-title"> 47 <div class="article-title">
48 <div class="title-line"></div> 48 <div class="title-line"></div>
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 {{/ data}} 80 {{/ data}}
81 </div> 81 </div>
82 </div> 82 </div>
83 - {{/ goodsGroup}} 83 + {{/ goodsGroup}} --}}
84 {{/ content}} 84 {{/ content}}
85 85
86 {{#if brands}} 86 {{#if brands}}
@@ -86,6 +86,8 @@ $('#collect-btn').click(function() { @@ -86,6 +86,8 @@ $('#collect-btn').click(function() {
86 if (data.code === 200) { 86 if (data.code === 200) {
87 new _alert(data.message).show(); 87 new _alert(data.message).show();
88 $this.toggleClass('collected'); 88 $this.toggleClass('collected');
  89 + } else if (data.code === 400) {
  90 + window.location.href = 'http://www.yohobuy.com/passport/login';
89 } else { 91 } else {
90 new _alert(data.message).show(); 92 new _alert(data.message).show();
91 } 93 }
@@ -134,6 +136,8 @@ function comment() { @@ -134,6 +136,8 @@ function comment() {
134 136
135 // clear comment-text 137 // clear comment-text
136 $('#comment-info').val('').keyup(); 138 $('#comment-info').val('').keyup();
  139 + } else if (data.code === 400) {
  140 + window.location.href = 'http://www.yohobuy.com/passport/login';
137 } else { 141 } else {
138 new _alert(data.message).show(); 142 new _alert(data.message).show();
139 } 143 }
@@ -41,3 +41,12 @@ $('.editorial-index-page').on('click', '.like-icon', function() { @@ -41,3 +41,12 @@ $('.editorial-index-page').on('click', '.like-icon', function() {
41 }).on('mouseenter mouseleave', '.like-icon', function() { 41 }).on('mouseenter mouseleave', '.like-icon', function() {
42 $(this).closest('.like').toggleClass('hover'); 42 $(this).closest('.like').toggleClass('hover');
43 }); 43 });
  44 +
  45 +$('.msg-title').each(function() {
  46 + var $this = $(this),
  47 + $text = $this.text();
  48 +
  49 + if ($text.length > 64) {
  50 + $this.html($text.substring(0, 61) + '...');
  51 + }
  52 +})
@@ -430,4 +430,8 @@ @@ -430,4 +430,8 @@
430 430
431 } 431 }
432 } 432 }
  433 +
  434 + .blk-pagination {
  435 + width: 400px;
  436 + }
433 } 437 }
@@ -26,12 +26,12 @@ @@ -26,12 +26,12 @@
26 color: #333; 26 color: #333;
27 line-height: 30px; 27 line-height: 30px;
28 max-height: 64px; 28 max-height: 64px;
29 - word-wrap: break-word;  
30 overflow: hidden; 29 overflow: hidden;
  30 + /*word-wrap: break-word;
31 text-overflow: ellipsis; 31 text-overflow: ellipsis;
32 display: -webkit-box; 32 display: -webkit-box;
33 -webkit-line-clamp: 2; 33 -webkit-line-clamp: 2;
34 - -webkit-box-orient: vertical; 34 + -webkit-box-orient: vertical;*/
35 } 35 }
36 36
37 .msg-title:hover { 37 .msg-title:hover {