Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
9 years ago
Commit
7331e06aceb18014942ccfead3698cfea21d9ea9
1 parent
f1835695
'cate拆分数据OK'
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
51 deletions
apps/channel/views/action/brand/cate.hbs
public/js/channel/cate.page.js
public/vue/channel/brand-cate-box.vue
public/vue/channel/brand-cate.vue
apps/channel/views/action/brand/cate.hbs
View file @
7331e06
<div
id=
"brand-cate"
>
<brand-cate></brand-cate>
</div>
\ No newline at end of file
<div
id=
"brand-cate-box"
>
<brand-cate-box></brand-cate-box>
</div>
...
...
public/js/channel/cate.page.js
View file @
7331e06
const
Vue
=
require
(
'vue'
);
const
brandCate
=
require
(
'channel/brand-cate
.vue'
);
const
brandCate
Box
=
require
(
'channel/brand-cate-box
.vue'
);
new
Vue
({
el
:
'#brand-cate'
,
el
:
'#brand-cate
-box
'
,
components
:
{
'brand-cate
'
:
brandCate
'brand-cate
-box'
:
brandCateBox
}
});
...
...
public/vue/channel/brand-cate-box.vue
0 → 100644
View file @
7331e06
<template>
<tab v-bind:page="'cate'"></tab>
<brand-cate v-bind:category="category"></brand-cate>
</template>
<script>
const tip = require('common/tip');
const brandCate = require('channel/brand-cate.vue');
const tab = require('channel/tab.vue');
const $ = require('jquery');
module.exports = {
data() {
return {
category: {}
};
},
components: {
tab,
brandCate
},
methods: {
getCateList() {
$.ajax({
url: '/cate/list.json'
}).then(result => {
if (result.code === 200 && result.data) {
this.$set('category', result.data);
}
}).fail(() => {
tip('网络错误');
});
}
},
created() {
this.getCateList();
}
};
</script>
...
...
public/vue/channel/brand-cate.vue
View file @
7331e06
<template>
<tab v-bind:page="'cate'"></tab>
<div class="cate-page" id='cate-page'>
<div class="cate-container clearfix">
<div class="content" style="height: 522px;">
...
...
@@ -199,11 +198,6 @@
}
</style>
<script>
const $ = require('jquery');
const tip = require('common/tip');
const tab = require('channel/tab.vue');
const contentCode = require('content-code');
const qs = require('yoho-qs');
const bus = require('common/vue-bus');
const channelTrans = {
...
...
@@ -222,45 +216,37 @@
};
module.exports = {
props: [],
props: {
category: {
type: Object
},
jump: {
type: Boolean
}
},
data() {
return {
brandCate: [],
cateNavLeftData: [],
cateNavRightData: [],
topcurrent: 0,
widthli: 33.33,
leftcurrent: 0,
page: 'cate',
gender: '1,2,3',
rightAll: {},
contentCode: contentCode.brand[qs.channel || 'men']
brandCate: [], // 频道切换时取数据使用
cateNavLeftData: [], // 左侧分类数据
cateNavRightData: [], // 右侧分类数据
leftcurrent: 0, // 标记当前左侧选中条目
gender: '1,2,3', // 跳转到商品列表页的参数
rightAll: {} // 全部XX
};
},
methods: {
getCateList() {
let data = {
channel: ''
};
$.ajax({
url: '/cate/list.json',
data: data
}).then(result => {
if (result.code === 200 && result.data) {
this.$set('brandCate', result.data);
this.$set('cateNavLeftData', result.data['MEN男士']);
this.$set('cateNavRightData', result.data['MEN男士'] ? result.data['MEN男士'][0].sub : []);
watch: {
category() {
this.$set('brandCate', this.category);
this.$set('cateNavLeftData', this.category['MEN男士']);
this.$set('cateNavRightData', this.category['MEN男士'] ? this.category['MEN男士'][0].sub : []);
this.$set('rightAll', result.data['MEN男士'] ? {
sortId: result.data['MEN男士'][0].relationParameter.sort,
categoryName: result.data['MEN男士'][0].categoryName
} : {});
}
}).fail(() => {
tip('网络错误');
});
},
this.$set('rightAll', this.category['MEN男士'] ? {
sortId: this.category['MEN男士'][0].relationParameter.sort,
categoryName: this.category['MEN男士'][0].categoryName
} : {});
}
},
methods: {
cateNavLeftFun(index, categoryId, categoryName) {
this.leftcurrent = index;
this.cateNavRightData = this.cateNavLeftData[index].sub;
...
...
@@ -270,12 +256,7 @@
};
}
},
components: {
tab
},
created() {
this.getCateList();
bus.$on('channel.change', (page, channel) => {
this.gender = channelTrans[channel].code;
this.cateNavLeftData = this.brandCate[channelTrans[channel].key];
...
...
Please
register
or
login
to post a comment