Authored by 沈志敏

product部分

@@ -5,11 +5,7 @@ @@ -5,11 +5,7 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
8 -// const _ = require('lodash');  
9 -  
10 -// const helpers = global.yoho.helpers;  
11 const model = require('../models/detail'); 8 const model = require('../models/detail');
12 -const camelCase = global.yoho.camelCase;  
13 9
14 /** 10 /**
15 * 商品详情 11 * 商品详情
@@ -99,7 +95,7 @@ const component = { @@ -99,7 +95,7 @@ const component = {
99 }; 95 };
100 96
101 model.misc(params).then(result => { 97 model.misc(params).then(result => {
102 - res.json(camelCase(result)); 98 + res.json(result);
103 }).catch(next); 99 }).catch(next);
104 } 100 }
105 }; 101 };
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 'use strict'; 6 'use strict';
7 const serviceAPI = global.yoho.ServiceAPI; 7 const serviceAPI = global.yoho.ServiceAPI;
8 const Promise = require('bluebird'); 8 const Promise = require('bluebird');
9 -const camelCase = global.yoho.camelCase;  
10 9
11 /** 10 /**
12 * 资讯详情 11 * 资讯详情
@@ -30,7 +29,7 @@ const model = { @@ -30,7 +29,7 @@ const model = {
30 res.push(other); 29 res.push(other);
31 return res; 30 return res;
32 }); 31 });
33 - }).then(camelCase); 32 + });
34 }, 33 },
35 34
36 /** 35 /**
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 'use strict'; 7 'use strict';
8 8
9 const editorialListApi = require('./list-api'); 9 const editorialListApi = require('./list-api');
10 -const camelCase = global.yoho.camelCase;  
11 10
12 /** 11 /**
13 * 资讯列表数据 12 * 资讯列表数据
@@ -28,7 +27,7 @@ const editorialList = params => { @@ -28,7 +27,7 @@ const editorialList = params => {
28 }); 27 });
29 } 28 }
30 29
31 - return camelCase(finalResult); 30 + return finalResult;
32 }); 31 });
33 }; 32 };
34 33
1 'use strict'; 1 'use strict';
2 2
3 const api = global.yoho.API; 3 const api = global.yoho.API;
4 -const camelCase = global.yoho.camelCase;  
5 const prettyFilter = require(`${global.utils}/beautify/filters`); 4 const prettyFilter = require(`${global.utils}/beautify/filters`);
6 const processProductList = require(`${global.utils}/beautify/product`); 5 const processProductList = require(`${global.utils}/beautify/product`);
7 6
@@ -19,8 +18,9 @@ exports.getNewData = (params) => { @@ -19,8 +18,9 @@ exports.getNewData = (params) => {
19 return api.get('', params).then(result => { 18 return api.get('', params).then(result => {
20 if (result.data) { 19 if (result.data) {
21 prettyFilter(result.data.filter); 20 prettyFilter(result.data.filter);
22 - result = camelCase(result);  
23 - result.data.productList = processProductList(result.data.productList, {gender: params.gender}); 21 + result.data.product_list = processProductList(result.data.product_list, {
  22 + gender: params.gender
  23 + });
24 } 24 }
25 25
26 return result; 26 return result;
@@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
2 2
3 const _ = require('lodash'); 3 const _ = require('lodash');
4 const api = global.yoho.API; 4 const api = global.yoho.API;
5 -const camelCase = global.yoho.camelCase;  
6 const prettyFilter = require(`${global.utils}/beautify/filters`); 5 const prettyFilter = require(`${global.utils}/beautify/filters`);
7 const processProductList = require(`${global.utils}/beautify/product`); 6 const processProductList = require(`${global.utils}/beautify/product`);
8 7
@@ -37,8 +36,7 @@ const search = { @@ -37,8 +36,7 @@ const search = {
37 } 36 }
38 37
39 prettyFilter(result.data.filter); 38 prettyFilter(result.data.filter);
40 - result = camelCase(result);  
41 - result.data.productList = processProductList(result.data.productList, { 39 + result.data.product_list = processProductList(result.data.product_list, {
42 gender: params.gender 40 gender: params.gender
43 }); 41 });
44 } 42 }
@@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
8 const logger = global.yoho.logger; 8 const logger = global.yoho.logger;
9 const shopApi = require('./shop-api'); 9 const shopApi = require('./shop-api');
10 const processProductList = require(`${global.utils}/beautify/product`); 10 const processProductList = require(`${global.utils}/beautify/product`);
11 -const camelCase = global.yoho.camelCase;  
12 const _ = require('lodash'); 11 const _ = require('lodash');
13 const prettyFilter = require(`${global.utils}/beautify/filters`); 12 const prettyFilter = require(`${global.utils}/beautify/filters`);
14 13
@@ -93,7 +92,7 @@ const _getGoodsList = params => { @@ -93,7 +92,7 @@ const _getGoodsList = params => {
93 code: 200 92 code: 200
94 }; 93 };
95 } 94 }
96 - return camelCase(finalResult); 95 + return finalResult;
97 }); 96 });
98 }; 97 };
99 98
@@ -168,7 +168,7 @@ module.exports = (Vue) => { @@ -168,7 +168,7 @@ module.exports = (Vue) => {
168 size: '尺寸', 168 size: '尺寸',
169 brand: '品牌', 169 brand: '品牌',
170 priceRange: '价格', 170 priceRange: '价格',
171 - groupSort: '品类', 171 + group_sort: '品类',
172 discount: '折扣', 172 discount: '折扣',
173 style: '风格', 173 style: '风格',
174 ageLevel: '年龄' 174 ageLevel: '年龄'
@@ -180,7 +180,7 @@ module.exports = (Vue) => { @@ -180,7 +180,7 @@ module.exports = (Vue) => {
180 size: 'Size', 180 size: 'Size',
181 brand: 'Brand', 181 brand: 'Brand',
182 priceRange: 'Price', 182 priceRange: 'Price',
183 - groupSort: 'Category', 183 + group_sort: 'Category',
184 discount: 'Sale', 184 discount: 'Sale',
185 style: 'Style', 185 style: 'Style',
186 ageLevel: 'Age' 186 ageLevel: 'Age'
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 33
34 // filter 字段 对应 的 查询 字段 34 // filter 字段 对应 的 查询 字段
35 const aliasMap = { 35 const aliasMap = {
36 - groupSort: 'sort', 36 + group_sort: 'sort',
37 priceRange: 'price', 37 priceRange: 'price',
38 discount: 'p_d' 38 discount: 'p_d'
39 }; 39 };
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 }, 46 },
47 data: function() { 47 data: function() {
48 return { 48 return {
49 - itemArr: ['gender', 'ageLevel', 'brand', 'groupSort', 'color', 'size', 'priceRange', 'discount', 'style'], 49 + itemArr: ['gender', 'ageLevel', 'brand', 'group_sort', 'color', 'size', 'priceRange', 'discount', 'style'],
50 params: {}, // 选择的值 50 params: {}, // 选择的值
51 selected: {}, // 确定的值 51 selected: {}, // 确定的值
52 52
@@ -77,10 +77,10 @@ @@ -77,10 +77,10 @@
77 }, 77 },
78 78
79 // 只显示 可选值 大于 1的 筛选项 79 // 只显示 可选值 大于 1的 筛选项
80 - // groupSort 特殊处理 80 + // group_sort 特殊处理
81 showCate: function(cateName, cateVals) { 81 showCate: function(cateName, cateVals) {
82 if (toString.call(cateVals) === '[object Array]') { 82 if (toString.call(cateVals) === '[object Array]') {
83 - if (cateName === 'groupSort') { 83 + if (cateName === 'group_sort') {
84 return !hasSort; 84 return !hasSort;
85 } else if (cateVals.length >= 1) { 85 } else if (cateVals.length >= 1) {
86 return true; 86 return true;
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 </c-header> 5 </c-header>
6 <div class="filter-sub-select"> 6 <div class="filter-sub-select">
7 <brand-filter v-if="type === 'brand'" :data="data" @select="selectItem"></brand-filter> 7 <brand-filter v-if="type === 'brand'" :data="data" @select="selectItem"></brand-filter>
8 - <normal-filter v-if="type !== 'brand' && type !== 'groupSort'" :data="data" :type="type" @select="selectItem"></normal-filter>  
9 - <sort-filter class="filter-detail filter-sort" v-if="type === 'groupSort'" :category="data" @select="selectItem"></sort-filter> 8 + <normal-filter v-if="type !== 'brand' && type !== 'group_sort'" :data="data" :type="type" @select="selectItem"></normal-filter>
  9 + <sort-filter class="filter-detail filter-sort" v-if="type === 'group_sort'" :category="data" @select="selectItem"></sort-filter>
10 </div> 10 </div>
11 </div> 11 </div>
12 </template> 12 </template>
@@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
2 <top-nav :id="id" :article="article" v-if="isApp"></top-nav> 2 <top-nav :id="id" :article="article" v-if="isApp"></top-nav>
3 <div class="show-box no-padding first-box"> 3 <div class="show-box no-padding first-box">
4 <div class="editorial-box"> 4 <div class="editorial-box">
5 - <h1 class="editorial-article-title">{{article.articleTitle}}</h1> 5 + <h1 class="editorial-article-title">{{article.article_title}}</h1>
6 <div class="status-bar"> 6 <div class="status-bar">
7 - <span class="icon icon-timeshare"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span> 7 + <span class="icon icon-timeshare"></span><span class="label">{{article.publishTime}}</span>
8 <span class="icon icon-read"></span><span class="label">{{article.pageViews}}</span> 8 <span class="icon icon-read"></span><span class="label">{{article.pageViews}}</span>
9 </div> 9 </div>
10 </div> 10 </div>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 </div> 45 </div>
46 <h3><a class="line-clamp-2" :href="'/editorial/' + item.id + '.html'">{{item.title}}</a></h3> 46 <h3><a class="line-clamp-2" :href="'/editorial/' + item.id + '.html'">{{item.title}}</a></h3>
47 <div class="sub-time"> 47 <div class="sub-time">
48 - <span class="icon icon-timeshare"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span> 48 + <span class="icon icon-timeshare"></span><span class="label">{{item.publishTime}}</span>
49 </div> 49 </div>
50 <div class="clearfix"></div> 50 <div class="clearfix"></div>
51 </div> 51 </div>
@@ -262,7 +262,7 @@ @@ -262,7 +262,7 @@
262 }).join(',') 262 }).join(',')
263 }).then((data) => { 263 }).then((data) => {
264 if (data.data) { 264 if (data.data) {
265 - this.$set('recommendProducts', data.data.productList); 265 + this.$set('recommendProducts', data.data.product_list);
266 } 266 }
267 }); 267 });
268 }); 268 });
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <hr> 16 <hr>
17 <div class="bottom clearfix"> 17 <div class="bottom clearfix">
18 <span class="icon icon-timeshare"></span> 18 <span class="icon icon-timeshare"></span>
19 - <span class="time">{{editorial.publishTime}}</span> 19 + <span class="time">{{editorial.publish_time}}</span>
20 <span class="icon icon-share share" @click="share(editorial.title, editorial.intro, editorial.src, editorial.id)"></span> 20 <span class="icon icon-share share" @click="share(editorial.title, editorial.intro, editorial.src, editorial.id)"></span>
21 </div> 21 </div>
22 </div> 22 </div>
@@ -97,14 +97,14 @@ @@ -97,14 +97,14 @@
97 }); 97 });
98 }, 98 },
99 share: function() { 99 share: function() {
100 - let title = this.article.articleTitle; 100 + let title = this.article.article_title;
101 101
102 title = title.length > 15 ? title.substr(0, 15) + '...' : title; 102 title = title.length > 15 ? title.substr(0, 15) + '...' : title;
103 103
104 yoho.goShare({ 104 yoho.goShare({
105 title, 105 title,
106 des: '优质精选,BLK潮流资讯为你呈现', 106 des: '优质精选,BLK潮流资讯为你呈现',
107 - img: location.protocol + util.getImgUrl(this.article.coverImage, 300, 300, 2), 107 + img: location.protocol + util.getImgUrl(this.article.cover_image, 300, 300, 2),
108 url: `${location.origin}/editorial/${this.article.id}.html?shareTitle=${title}` 108 url: `${location.origin}/editorial/${this.article.id}.html?shareTitle=${title}`
109 }); 109 });
110 } 110 }
@@ -103,8 +103,8 @@ @@ -103,8 +103,8 @@
103 .done(res => { 103 .done(res => {
104 if (res.data) { 104 if (res.data) {
105 self.page = res.data.page; 105 self.page = res.data.page;
106 - self.totalPage = res.data.pageTotal;  
107 - self.$set('productList', self.productList.concat(res.data.productList)); 106 + self.totalPage = res.data.page_total;
  107 + self.$set('productList', self.productList.concat(res.data.product_list));
108 108
109 if (!self.filterConfig) { 109 if (!self.filterConfig) {
110 self.$set('filterConfig', res.data.filter); 110 self.$set('filterConfig', res.data.filter);
@@ -93,8 +93,8 @@ @@ -93,8 +93,8 @@
93 .done(res => { 93 .done(res => {
94 if (res.code === 200) { 94 if (res.code === 200) {
95 self.page = res.data.page; 95 self.page = res.data.page;
96 - self.totalPage = res.data.pageTotal;  
97 - self.$set('productList', self.productList.concat(res.data.productList)); 96 + self.totalPage = res.data.page_total;
  97 + self.$set('productList', self.productList.concat(res.data.product_list));
98 98
99 if (!self.filterConfig) { 99 if (!self.filterConfig) {
100 self.$set('filterConfig', res.data.filter); 100 self.$set('filterConfig', res.data.filter);
@@ -91,8 +91,8 @@ @@ -91,8 +91,8 @@
91 .done(res => { 91 .done(res => {
92 if (res.data) { 92 if (res.data) {
93 self.page = res.data.page; 93 self.page = res.data.page;
94 - self.totalPage = res.data.pageTotal;  
95 - self.$set('productList', self.productList.concat(res.data.productList)); 94 + self.totalPage = res.data.page_total;
  95 + self.$set('productList', self.productList.concat(res.data.product_list));
96 } 96 }
97 }) 97 })
98 .fail(() => { 98 .fail(() => {