Authored by 郝肖肖

品类全部接口

... ... @@ -37,18 +37,18 @@ module.exports = {
cate: (req, res) => {
res.render('brand/cate', {
module: 'channel',
page: 'cate'
page: 'cate',
title: '全部分类'
});
},
// 全部分类api
getCateList: (req, res, next) => {
let params = req.query;
brandModel.getCateListData(params)
.then(result => {
res.json(result);
}).catch(next);
brandModel.getCateListData({
app_type: 1
}).then(result => {
res.json(result);
}).catch(next);
},
// 品类资源位
... ...
... ... @@ -79,6 +79,7 @@ const getCateListData = params => {
let oneClass = [];
let subitem = {};
let genderArr = {boy: '1,3', girl: '2,3', kids: '1,2,3', lifestyle: '1,2,3'};
let nameArr = {boy: 'MEN男士', girl: 'WOMEN女士', kids: 'TIDE潮童', lifestyle: 'LIFESTYLE生活'};
return brandApi.getCateListData(params).then(result => {
... ... @@ -87,7 +88,10 @@ const getCateListData = params => {
}
_.forEach(result.data, (category, categorykey) => {
oneClass = {name: categorykey, ca: []};
if (categorykey === 'kids') {
return true;
}
oneClass = {name: nameArr[categorykey], ca: []};
_.forEach(category, (cate) => {
item = {
... ...
... ... @@ -2,7 +2,7 @@
<div class="cate-page" id='cate-page'>
<div class="cate-nav clearfix">
<ul>
<li v-for="(index, cate) in brandCate" v-on:click='cateNavTopFun(index)' v-bind:class="{focus: index === topcurrent}" >
<li v-for="(index, cate) in brandCate" v-on:click='cateNavTopFun(index)' v-bind:class="{focus: index === topcurrent}" v-bind:style="{width: widthli + '%'}">
<span>{{cate.name}}</span>
</li>
</ul>
... ... @@ -68,13 +68,14 @@
.cate-nav {
height: 120px;
border-bottom: 1px solid #e6e6e6;
font-size: 24px;
li {
display: block;
box-sizing: border-box;
float: left;
height: 100%;
padding: 20px 10px;
padding: 20px 0px;
width: 25%;
text-align: center;
color: #999;
... ... @@ -197,6 +198,7 @@
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
const qs = require('yoho-qs');
module.exports = {
props: [],
... ... @@ -206,6 +208,7 @@
cateNavLeftData: [],
cateNavRightData: [],
topcurrent: 0,
widthli: 25,
leftcurrent: 0
};
},
... ... @@ -219,9 +222,13 @@
url: '/get-cate-list',
data: data
}).then(result => {
this.brandCate = result;
this.cateNavLeftData = this.brandCate[0].ca;
this.cateNavRightData = this.cateNavLeftData[0].sub;
let len = result.length;
if (len > 0) {
this.brandCate = result;
this.widthli = 100 / len;
this.cateNavLeftData = this.brandCate[0].ca;
this.cateNavRightData = this.cateNavLeftData[0].sub;
}
}).fail(() => {
tip('网络错误');
});
... ...