Authored by 郝肖肖

品类全部接口

@@ -37,18 +37,18 @@ module.exports = { @@ -37,18 +37,18 @@ module.exports = {
37 cate: (req, res) => { 37 cate: (req, res) => {
38 res.render('brand/cate', { 38 res.render('brand/cate', {
39 module: 'channel', 39 module: 'channel',
40 - page: 'cate' 40 + page: 'cate',
  41 + title: '全部分类'
41 }); 42 });
42 }, 43 },
43 44
44 // 全部分类api 45 // 全部分类api
45 getCateList: (req, res, next) => { 46 getCateList: (req, res, next) => {
46 - let params = req.query;  
47 -  
48 - brandModel.getCateListData(params)  
49 - .then(result => {  
50 - res.json(result);  
51 - }).catch(next); 47 + brandModel.getCateListData({
  48 + app_type: 1
  49 + }).then(result => {
  50 + res.json(result);
  51 + }).catch(next);
52 }, 52 },
53 53
54 // 品类资源位 54 // 品类资源位
@@ -79,6 +79,7 @@ const getCateListData = params => { @@ -79,6 +79,7 @@ const getCateListData = params => {
79 let oneClass = []; 79 let oneClass = [];
80 let subitem = {}; 80 let subitem = {};
81 let genderArr = {boy: '1,3', girl: '2,3', kids: '1,2,3', lifestyle: '1,2,3'}; 81 let genderArr = {boy: '1,3', girl: '2,3', kids: '1,2,3', lifestyle: '1,2,3'};
  82 + let nameArr = {boy: 'MEN男士', girl: 'WOMEN女士', kids: 'TIDE潮童', lifestyle: 'LIFESTYLE生活'};
82 83
83 return brandApi.getCateListData(params).then(result => { 84 return brandApi.getCateListData(params).then(result => {
84 85
@@ -87,7 +88,10 @@ const getCateListData = params => { @@ -87,7 +88,10 @@ const getCateListData = params => {
87 } 88 }
88 89
89 _.forEach(result.data, (category, categorykey) => { 90 _.forEach(result.data, (category, categorykey) => {
90 - oneClass = {name: categorykey, ca: []}; 91 + if (categorykey === 'kids') {
  92 + return true;
  93 + }
  94 + oneClass = {name: nameArr[categorykey], ca: []};
91 95
92 _.forEach(category, (cate) => { 96 _.forEach(category, (cate) => {
93 item = { 97 item = {
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="cate-page" id='cate-page'> 2 <div class="cate-page" id='cate-page'>
3 <div class="cate-nav clearfix"> 3 <div class="cate-nav clearfix">
4 <ul> 4 <ul>
5 - <li v-for="(index, cate) in brandCate" v-on:click='cateNavTopFun(index)' v-bind:class="{focus: index === topcurrent}" > 5 + <li v-for="(index, cate) in brandCate" v-on:click='cateNavTopFun(index)' v-bind:class="{focus: index === topcurrent}" v-bind:style="{width: widthli + '%'}">
6 <span>{{cate.name}}</span> 6 <span>{{cate.name}}</span>
7 </li> 7 </li>
8 </ul> 8 </ul>
@@ -68,13 +68,14 @@ @@ -68,13 +68,14 @@
68 .cate-nav { 68 .cate-nav {
69 height: 120px; 69 height: 120px;
70 border-bottom: 1px solid #e6e6e6; 70 border-bottom: 1px solid #e6e6e6;
  71 + font-size: 24px;
71 72
72 li { 73 li {
73 display: block; 74 display: block;
74 box-sizing: border-box; 75 box-sizing: border-box;
75 float: left; 76 float: left;
76 height: 100%; 77 height: 100%;
77 - padding: 20px 10px; 78 + padding: 20px 0px;
78 width: 25%; 79 width: 25%;
79 text-align: center; 80 text-align: center;
80 color: #999; 81 color: #999;
@@ -197,6 +198,7 @@ @@ -197,6 +198,7 @@
197 <script> 198 <script>
198 const $ = require('yoho-jquery'); 199 const $ = require('yoho-jquery');
199 const tip = require('common/tip'); 200 const tip = require('common/tip');
  201 + const qs = require('yoho-qs');
200 202
201 module.exports = { 203 module.exports = {
202 props: [], 204 props: [],
@@ -206,6 +208,7 @@ @@ -206,6 +208,7 @@
206 cateNavLeftData: [], 208 cateNavLeftData: [],
207 cateNavRightData: [], 209 cateNavRightData: [],
208 topcurrent: 0, 210 topcurrent: 0,
  211 + widthli: 25,
209 leftcurrent: 0 212 leftcurrent: 0
210 }; 213 };
211 }, 214 },
@@ -219,9 +222,13 @@ @@ -219,9 +222,13 @@
219 url: '/get-cate-list', 222 url: '/get-cate-list',
220 data: data 223 data: data
221 }).then(result => { 224 }).then(result => {
222 - this.brandCate = result;  
223 - this.cateNavLeftData = this.brandCate[0].ca;  
224 - this.cateNavRightData = this.cateNavLeftData[0].sub; 225 + let len = result.length;
  226 + if (len > 0) {
  227 + this.brandCate = result;
  228 + this.widthli = 100 / len;
  229 + this.cateNavLeftData = this.brandCate[0].ca;
  230 + this.cateNavRightData = this.cateNavLeftData[0].sub;
  231 + }
225 }).fail(() => { 232 }).fail(() => {
226 tip('网络错误'); 233 tip('网络错误');
227 }); 234 });