Showing
1 changed file
with
24 additions
and
12 deletions
@@ -209,10 +209,19 @@ | @@ -209,10 +209,19 @@ | ||
209 | const qs = require('yoho-qs'); | 209 | const qs = require('yoho-qs'); |
210 | const bus = require('common/vue-bus'); | 210 | const bus = require('common/vue-bus'); |
211 | 211 | ||
212 | - const genderCode = { | ||
213 | - MEN男士: '1,3', | ||
214 | - WOMEN女士: '2,3', | ||
215 | - LIFESTYLE生活: '1,2,3' | 212 | + const channelTrans = { |
213 | + men: { | ||
214 | + key: 'MEN男士', | ||
215 | + code: '1,3' | ||
216 | + }, | ||
217 | + women: { | ||
218 | + key: 'WOMEN女士', | ||
219 | + code: '2,3' | ||
220 | + }, | ||
221 | + lifestyle: { | ||
222 | + key: 'LIFESTYLE生活', | ||
223 | + code: '1,2,3' | ||
224 | + } | ||
216 | }; | 225 | }; |
217 | 226 | ||
218 | module.exports = { | 227 | module.exports = { |
@@ -232,6 +241,8 @@ | @@ -232,6 +241,8 @@ | ||
232 | }, | 241 | }, |
233 | methods: { | 242 | methods: { |
234 | getCateList() { | 243 | getCateList() { |
244 | + let self = this; | ||
245 | + | ||
235 | let data = { | 246 | let data = { |
236 | channel: '' | 247 | channel: '' |
237 | }; | 248 | }; |
@@ -241,9 +252,9 @@ | @@ -241,9 +252,9 @@ | ||
241 | data: data | 252 | data: data |
242 | }).then(result => { | 253 | }).then(result => { |
243 | if (result) { | 254 | if (result) { |
244 | - this.brandCate = result; | ||
245 | - this.cateNavLeftData = result['MEN男士']; | ||
246 | - this.cateNavRightData = result['MEN男士'][0].sub; | 255 | + self.$set('brandCate', result); |
256 | + self.$set('cateNavLeftData', result['MEN男士']); | ||
257 | + self.$set('cateNavRightData', result['MEN男士'][0].sub); | ||
247 | } | 258 | } |
248 | }).fail(() => { | 259 | }).fail(() => { |
249 | tip('网络错误'); | 260 | tip('网络错误'); |
@@ -258,13 +269,14 @@ | @@ -258,13 +269,14 @@ | ||
258 | tab | 269 | tab |
259 | }, | 270 | }, |
260 | created() { | 271 | created() { |
272 | + const self = this; | ||
273 | + | ||
261 | this.getCateList(); | 274 | this.getCateList(); |
262 | 275 | ||
263 | - bus.$on('channel.change', function(index) { | ||
264 | - this.topcurrent = index; | ||
265 | - this.gender = genderCode[index]; | ||
266 | - this.cateNavLeftData = this.brandCate[index]; | ||
267 | - this.cateNavRightData = this.cateNavLeftData[0].sub; | 276 | + bus.$on('channel.change', function(page, channel) { |
277 | + self.gender = channelTrans[channel].code; | ||
278 | + self.cateNavLeftData = self.brandCate[channelTrans[channel].key]; | ||
279 | + self.cateNavRightData = self.cateNavLeftData[0].sub; | ||
268 | }); | 280 | }); |
269 | } | 281 | } |
270 | }; | 282 | }; |
-
Please register or login to post a comment