Authored by 郭成尧

'资讯列表资源码'

@@ -23,7 +23,7 @@ module.exports = { @@ -23,7 +23,7 @@ module.exports = {
23 getNewsList: (req, res, next) => { 23 getNewsList: (req, res, next) => {
24 let params = { 24 let params = {
25 page: req.body.page, 25 page: req.body.page,
26 - gender: req.body.gender, 26 + channel: req.body.channel,
27 uid: req.user.uid 27 uid: req.user.uid
28 }; 28 };
29 29
@@ -8,13 +8,25 @@ @@ -8,13 +8,25 @@
8 'use strict'; 8 'use strict';
9 const serviceAPI = global.yoho.ServiceAPI; 9 const serviceAPI = global.yoho.ServiceAPI;
10 10
  11 +const yhChannel = {
  12 + men: {
  13 + channel: '1,3'
  14 + },
  15 + women: {
  16 + channel: '2,3'
  17 + },
  18 + all: {
  19 + channel: '1,2,3'
  20 + }
  21 +};
  22 +
11 module.exports = { 23 module.exports = {
12 24
13 /* 资讯列表页数据获取 */ 25 /* 资讯列表页数据获取 */
14 getNewsListData(params) { 26 getNewsListData(params) {
15 return serviceAPI.get('guang/api/v2/article/getList', { 27 return serviceAPI.get('guang/api/v2/article/getList', {
16 sort_id: '', 28 sort_id: '',
17 - gender: params.gender, 29 + gender: yhChannel[params.channel].channel,
18 uid: params.uid || '0', 30 uid: params.uid || '0',
19 page: params.page, 31 page: params.page,
20 limit: '10' 32 limit: '10'
@@ -24,13 +24,11 @@ const cate = { @@ -24,13 +24,11 @@ const cate = {
24 lifestyle: '6f7b590ed3844e680d4052fc5c4d98ad' 24 lifestyle: '6f7b590ed3844e680d4052fc5c4d98ad'
25 }; 25 };
26 26
27 -/* 资讯列表资源位 */ 27 +/* TODO 资讯列表资源位 */
28 const news = { 28 const news = {
29 - new: 'd4fdfcad1ec877d466d9780efaf4d296',  
30 - sports: 'e1f8dce8cb9de1a0977479c13c4d3dcc',  
31 - life: '5c0b9963d8b75e6fd788a2b49402be14',  
32 - sneakers: 'c4a62196c30cae5301e419aa3f77747b',  
33 - fashion: '70bc6b9d5c96bb7698eab85c7cd5ebbe' 29 + all: 'd4fdfcad1ec877d466d9780efaf4d296',
  30 + men: 'e1f8dce8cb9de1a0977479c13c4d3dcc',
  31 + women: '5c0b9963d8b75e6fd788a2b49402be14'
34 }; 32 };
35 33
36 module.exports = { 34 module.exports = {
@@ -77,15 +77,14 @@ @@ -77,15 +77,14 @@
77 module.exports = { 77 module.exports = {
78 data() { 78 data() {
79 return { 79 return {
80 - contentCode: contentCode.news[qs.cate || 'new'], 80 + contentCode: contentCode.news[qs.channel || 'all'],
81 newsList: [], 81 newsList: [],
82 - gender: qs.gender,  
83 page: 0, 82 page: 0,
84 scrollDisabled: false 83 scrollDisabled: false
85 }; 84 };
86 }, 85 },
87 watch: { 86 watch: {
88 - gender() { 87 + channel() {
89 this.getNewsList(); 88 this.getNewsList();
90 } 89 }
91 }, 90 },
@@ -96,9 +95,8 @@ @@ -96,9 +95,8 @@
96 $.post({ 95 $.post({
97 url: '/news/list.json', 96 url: '/news/list.json',
98 data: { 97 data: {
99 - sortId: this.crntCateId,  
100 page: this.page++, 98 page: this.page++,
101 - gender: this.gender || '1,2,3' 99 + channel: qs.channel || 'all'
102 } 100 }
103 }).done(result => { 101 }).done(result => {
104 if (result.code === 200) { 102 if (result.code === 200) {