Showing
6 changed files
with
30 additions
and
22 deletions
1 | 'use strict'; | 1 | 'use strict'; |
2 | const api = global.yoho.ServiceAPI; | 2 | const api = global.yoho.ServiceAPI; |
3 | -const contentCode = require('../../../config/content-code'); | ||
4 | const resourcesProcess = require('../../../utils/resources-process'); | 3 | const resourcesProcess = require('../../../utils/resources-process'); |
5 | 4 | ||
6 | let channel = { | 5 | let channel = { |
7 | getResourcesData(params) { | 6 | getResourcesData(params) { |
8 | - let code; | ||
9 | - | ||
10 | - if (params.channel) { | ||
11 | - code = contentCode.channel[params.channel]; | ||
12 | - } else if (params.contentCode) { | ||
13 | - code = params.contentCode; | ||
14 | - } else { | ||
15 | - code = contentCode.channel.men; | 7 | + if (!params.contentCode) { |
8 | + return Promise.reject([]); | ||
16 | } | 9 | } |
17 | return api.get('operations/api/v5/resource/get', { | 10 | return api.get('operations/api/v5/resource/get', { |
18 | - content_code: code | 11 | + content_code: params.contentCode |
19 | }, { | 12 | }, { |
20 | cache: true, | 13 | cache: true, |
21 | code: 200 | 14 | code: 200 |
@@ -13,9 +13,6 @@ const channel = require(cRoot + '/channel'); | @@ -13,9 +13,6 @@ const channel = require(cRoot + '/channel'); | ||
13 | const router = expressRouter(); | 13 | const router = expressRouter(); |
14 | 14 | ||
15 | router.get('/', channel.index); // 首页 | 15 | router.get('/', channel.index); // 首页 |
16 | -router.get('/men', channel.index); // 首页 | ||
17 | -router.get('/women', channel.index); // 首页 | ||
18 | -router.get('/lifestyle', channel.index); // 首页 | ||
19 | router.get('/resources', channel.resources); // 资源位接口 | 16 | router.get('/resources', channel.resources); // 资源位接口 |
20 | 17 | ||
21 | module.exports = router; | 18 | module.exports = router; |
public/js/content-code.js
0 → 100644
@@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
27 | const $ = require('yoho-jquery'); | 27 | const $ = require('yoho-jquery'); |
28 | const tip = require('common/tip'); | 28 | const tip = require('common/tip'); |
29 | const bus = require('common/vue-bus'); | 29 | const bus = require('common/vue-bus'); |
30 | + const contentCode = require('content-code'); | ||
30 | 31 | ||
31 | const focus = require('component/resources/focus.vue'); | 32 | const focus = require('component/resources/focus.vue'); |
32 | const focusLeftRight = require('component/resources/focus-left-right.vue'); | 33 | const focusLeftRight = require('component/resources/focus-left-right.vue'); |
@@ -38,7 +39,7 @@ | @@ -38,7 +39,7 @@ | ||
38 | const dataCache = {}; | 39 | const dataCache = {}; |
39 | 40 | ||
40 | module.exports = { | 41 | module.exports = { |
41 | - props: ['channel', 'contentCode'], | 42 | + props: ['contentCode'], |
42 | data() { | 43 | data() { |
43 | return { | 44 | return { |
44 | resources: [] | 45 | resources: [] |
@@ -53,9 +54,6 @@ | @@ -53,9 +54,6 @@ | ||
53 | goods | 54 | goods |
54 | }, | 55 | }, |
55 | watch: { | 56 | watch: { |
56 | - channel() { | ||
57 | - this.getResourcesData(); | ||
58 | - }, | ||
59 | contentCode() { | 57 | contentCode() { |
60 | this.getResourcesData(); | 58 | this.getResourcesData(); |
61 | } | 59 | } |
@@ -67,7 +65,7 @@ | @@ -67,7 +65,7 @@ | ||
67 | if (this.contentCode) { | 65 | if (this.contentCode) { |
68 | data.contentCode = this.contentCode; | 66 | data.contentCode = this.contentCode; |
69 | } else { | 67 | } else { |
70 | - data.channel = this.channel; | 68 | + data.contentCode = contentCode.channel.men; |
71 | } | 69 | } |
72 | 70 | ||
73 | let param = $.param(data); | 71 | let param = $.param(data); |
@@ -77,7 +75,7 @@ | @@ -77,7 +75,7 @@ | ||
77 | return; | 75 | return; |
78 | } | 76 | } |
79 | 77 | ||
80 | - $.ajax({ | 78 | + return $.ajax({ |
81 | url: '/resources', | 79 | url: '/resources', |
82 | data: data | 80 | data: data |
83 | }).then(result => { | 81 | }).then(result => { |
@@ -94,7 +92,7 @@ | @@ -94,7 +92,7 @@ | ||
94 | created() { | 92 | created() { |
95 | this.getResourcesData(); | 93 | this.getResourcesData(); |
96 | bus.$on('changeChannel', channel => { | 94 | bus.$on('changeChannel', channel => { |
97 | - this.channel = channel; | 95 | + this.contentCode = contentCode.channel[channel]; |
98 | }); | 96 | }); |
99 | } | 97 | } |
100 | }; | 98 | }; |
@@ -10,9 +10,14 @@ | @@ -10,9 +10,14 @@ | ||
10 | const bus = require('common/vue-bus'); | 10 | const bus = require('common/vue-bus'); |
11 | 11 | ||
12 | module.exports = { | 12 | module.exports = { |
13 | + props: { | ||
14 | + current: { | ||
15 | + type: Number, | ||
16 | + default: 0 | ||
17 | + }, | ||
18 | + }, | ||
13 | data() { | 19 | data() { |
14 | return { | 20 | return { |
15 | - current: 0, | ||
16 | channel: [{ | 21 | channel: [{ |
17 | name: 'MEN男士', | 22 | name: 'MEN男士', |
18 | channel: 'men' | 23 | channel: 'men' |
-
Please register or login to post a comment