Authored by 陈轩

Merge remote-tracking branch 'origin/develop' into develop

  1 +
1 Name | Path | Note 2 Name | Path | Note
2 -------- | ------------------------------------ | --------- 3 -------- | ------------------------------------ | ---------
3 首页 | / | 4 首页 | / |
@@ -34,10 +35,10 @@ yoho币 | /me/mycurrency | @@ -34,10 +35,10 @@ yoho币 | /me/mycurrency |
34 退换货物流详情| /me/logistic?order_code=1609827614&type=refund| 35 退换货物流详情| /me/logistic?order_code=1609827614&type=refund|
35 -------------------------------------------------------------------------------- 36 --------------------------------------------------------------------------------
36 37
37 -----  
38 ### order 常亮 38 ### order 常亮
  39 +
39 Name | Note 40 Name | Note
40 ----------|-------- 41 +-------- | ------
41 s_t_desc | 默认(最新) 42 s_t_desc | 默认(最新)
42 s_p_asc | 价格升序 43 s_p_asc | 价格升序
43 s_p_desc | 价格降序 44 s_p_desc | 价格降序
@@ -7,10 +7,14 @@ @@ -7,10 +7,14 @@
7 'use strict'; 7 'use strict';
8 8
9 const api = global.yoho.API; 9 const api = global.yoho.API;
10 -const helpers = global.yoho.helpers;  
11 const brandApi = require('./brand-api'); 10 const brandApi = require('./brand-api');
12 const logger = global.yoho.logger; 11 const logger = global.yoho.logger;
13 const _ = require('lodash'); 12 const _ = require('lodash');
  13 +const querystring = require('querystring');
  14 +
  15 +const urlFormat = (path, qs) => {
  16 + return path + '?' + querystring.stringify(qs);
  17 +};
14 18
15 /** 19 /**
16 * 处理品牌一览品牌列表数据 20 * 处理品牌一览品牌列表数据
@@ -101,7 +105,7 @@ const getCateListData = params => { @@ -101,7 +105,7 @@ const getCateListData = params => {
101 sub: [] 105 sub: []
102 }; 106 };
103 if (_.isEmpty(cate.sub)) { 107 if (_.isEmpty(cate.sub)) {
104 - item.url = helpers.urlFormat('/list', { 108 + item.url = urlFormat('/list', {
105 sort: item.sort, 109 sort: item.sort,
106 sort_name: item.name, 110 sort_name: item.name,
107 gender: genderArr[categorykey] 111 gender: genderArr[categorykey]
@@ -115,7 +119,7 @@ const getCateListData = params => { @@ -115,7 +119,7 @@ const getCateListData = params => {
115 id: item.id, 119 id: item.id,
116 name: '全部' + item.name, 120 name: '全部' + item.name,
117 sort: item.sort, 121 sort: item.sort,
118 - url: helpers.urlFormat('/list', { 122 + url: urlFormat('/list', {
119 sort: item.sort, 123 sort: item.sort,
120 sort_name: item.name, 124 sort_name: item.name,
121 gender: genderArr[categorykey] 125 gender: genderArr[categorykey]
@@ -130,7 +134,7 @@ const getCateListData = params => { @@ -130,7 +134,7 @@ const getCateListData = params => {
130 sort: sub.relation_parameter.sort, 134 sort: sub.relation_parameter.sort,
131 url: '' 135 url: ''
132 }; 136 };
133 - subitem.url = helpers.urlFormat('/list', { 137 + subitem.url = urlFormat('/list', {
134 sort: subitem.sort, 138 sort: subitem.sort,
135 sort_name: subitem.name, 139 sort_name: subitem.name,
136 gender: genderArr[categorykey] 140 gender: genderArr[categorykey]
@@ -17,12 +17,12 @@ const camelCase = global.yoho.camelCase; @@ -17,12 +17,12 @@ const camelCase = global.yoho.camelCase;
17 const component = { 17 const component = {
18 index(req, res) { 18 index(req, res) {
19 res.render('detail', { 19 res.render('detail', {
20 - module: 'news', 20 + module: 'editorial',
21 page: 'detail', 21 page: 'detail',
22 - newsId: req.params[0] 22 + editorialId: req.params[0]
23 }); 23 });
24 }, 24 },
25 - news(req, res, next) { 25 + editorial(req, res, next) {
26 const id = req.params[0]; 26 const id = req.params[0];
27 27
28 let params = { 28 let params = {
@@ -14,20 +14,20 @@ module.exports = { @@ -14,20 +14,20 @@ module.exports = {
14 /* 资讯首页 */ 14 /* 资讯首页 */
15 index: (req, res) => { 15 index: (req, res) => {
16 res.render('index', { 16 res.render('index', {
17 - module: 'news', 17 + module: 'editorial',
18 page: 'index' 18 page: 'index'
19 }); 19 });
20 }, 20 },
21 21
22 /* 获取资讯列表数据 */ 22 /* 获取资讯列表数据 */
23 - getNewsList: (req, res, next) => { 23 + getEditorialList: (req, res, next) => {
24 let params = { 24 let params = {
25 page: req.body.page, 25 page: req.body.page,
26 channel: req.body.channel, 26 channel: req.body.channel,
27 uid: req.user.uid 27 uid: req.user.uid
28 }; 28 };
29 29
30 - listModel.newsList(params).then(result => { 30 + listModel.editorialList(params).then(result => {
31 res.json(result); 31 res.json(result);
32 }).catch(next); 32 }).catch(next);
33 } 33 }
@@ -23,7 +23,7 @@ const yhChannel = { @@ -23,7 +23,7 @@ const yhChannel = {
23 module.exports = { 23 module.exports = {
24 24
25 /* 资讯列表页数据获取 */ 25 /* 资讯列表页数据获取 */
26 - getNewsListData(params) { 26 + getEditorialListData(params) {
27 return serviceAPI.get('guang/api/v2/article/getList', { 27 return serviceAPI.get('guang/api/v2/article/getList', {
28 sort_id: '', 28 sort_id: '',
29 gender: yhChannel[params.channel || 'all'].channel, 29 gender: yhChannel[params.channel || 'all'].channel,
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 const logger = global.yoho.logger; 9 const logger = global.yoho.logger;
10 const api = global.yoho.API; 10 const api = global.yoho.API;
11 -const newsListApi = require('./list-api'); 11 +const editorialListApi = require('./list-api');
12 const camelCase = global.yoho.camelCase; 12 const camelCase = global.yoho.camelCase;
13 13
14 /** 14 /**
@@ -16,11 +16,11 @@ const camelCase = global.yoho.camelCase; @@ -16,11 +16,11 @@ const camelCase = global.yoho.camelCase;
16 * @param params 16 * @param params
17 * @returns {*|Promise.<TResult>} 17 * @returns {*|Promise.<TResult>}
18 */ 18 */
19 -const newsList = params => { 19 +const editorialList = params => {
20 let finalResult = {}; 20 let finalResult = {};
21 21
22 return api.all([ 22 return api.all([
23 - newsListApi.getNewsListData(params) 23 + editorialListApi.getEditorialListData(params)
24 ]).then(result => { 24 ]).then(result => {
25 if (result[0].code === 200 && result[0].data.list) { 25 if (result[0].code === 200 && result[0].data.list) {
26 Object.assign(finalResult, { 26 Object.assign(finalResult, {
@@ -31,7 +31,7 @@ const newsList = params => { @@ -31,7 +31,7 @@ const newsList = params => {
31 code: 200 31 code: 200
32 }); 32 });
33 } else { 33 } else {
34 - logger.error('getNewsListData api code no 200'); 34 + logger.error('getEitorialListData api code no 200');
35 } 35 }
36 36
37 return camelCase(finalResult); 37 return camelCase(finalResult);
@@ -39,5 +39,5 @@ const newsList = params => { @@ -39,5 +39,5 @@ const newsList = params => {
39 }; 39 };
40 40
41 module.exports = { 41 module.exports = {
42 - newsList 42 + editorialList
43 }; 43 };
1 /** 1 /**
2 - * router of sub app news 2 + * router of sub app editorial
3 * @author: Aiden Xu<aiden.xu@yoho.cn> 3 * @author: Aiden Xu<aiden.xu@yoho.cn>
4 * @date: 2016/07/25 4 * @date: 2016/07/25
5 */ 5 */
@@ -10,18 +10,18 @@ const expressRouter = require('express').Router; @@ -10,18 +10,18 @@ const expressRouter = require('express').Router;
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 const router = expressRouter(); 11 const router = expressRouter();
12 12
  13 +const editorial = require(`${cRoot}/index`);
  14 +
  15 +router.get('/list', editorial.index); // 首页
  16 +router.post('/list.json', editorial.getEditorialList); // 获取资讯数据
  17 +
13 // 详情controller 18 // 详情controller
14 const detail = require(`${cRoot}/detail`); 19 const detail = require(`${cRoot}/detail`);
15 20
16 -router.get(/\/([\d]+)(.*)/, detail.index); // 详情routers  
17 -router.get(/news_(\d+)\.json/, detail.news); 21 +router.get(/\/([\d]+).html/, detail.index); // 详情routers
  22 +router.get(/editorial_(\d+)\.json/, detail.editorial);
18 router.get(/like_(\d+)\.json/, detail.like); 23 router.get(/like_(\d+)\.json/, detail.like);
19 router.get(/favorite_(\d+)\.json/, detail.favorite); 24 router.get(/favorite_(\d+)\.json/, detail.favorite);
20 router.get(/misc_(\d+)\.json/, detail.misc); 25 router.get(/misc_(\d+)\.json/, detail.misc);
21 26
22 -const news = require(`${cRoot}/index`);  
23 -  
24 -router.get('', news.index); // 首页  
25 -router.post('/list.json', news.getNewsList); // 获取资讯数据  
26 -  
27 module.exports = router; 27 module.exports = router;
1 -<div id="app" class="news-page" data-news-id="{{newsId}}"> 1 +<div id="app" class="editorial-page" data-editorial-id="{{editorialId}}">
2 <app/> 2 <app/>
3 </div> 3 </div>
@@ -10,6 +10,8 @@ const search = { @@ -10,6 +10,8 @@ const search = {
10 method: 'app.search.li' 10 method: 'app.search.li'
11 }, params); 11 }, params);
12 12
  13 + delete data.client_type;
  14 + delete data.client_secret;
13 return api.post('', data, { 15 return api.post('', data, {
14 cache: true, 16 cache: true,
15 code: 200 17 code: 200
@@ -10,7 +10,7 @@ module.exports = app => { @@ -10,7 +10,7 @@ module.exports = app => {
10 app.use('/', require('./apps/product')); // 商品模块 10 app.use('/', require('./apps/product')); // 商品模块
11 app.use('/', require('./apps/me')); // 个人中心 11 app.use('/', require('./apps/me')); // 个人中心
12 app.use('/api', require('./apps/api')); // 各模块公有 API 12 app.use('/api', require('./apps/api')); // 各模块公有 API
13 - app.use('/news', require('./apps/news')); // 资讯 13 + app.use('/editorial', require('./apps/editorial')); // 资讯
14 14
15 // 组件示例 15 // 组件示例
16 if (!app.locals.proEnv) { 16 if (!app.locals.proEnv) {
@@ -24,7 +24,7 @@ const titleMap = { @@ -24,7 +24,7 @@ const titleMap = {
24 action: '' 24 action: ''
25 }, 25 },
26 title: { 26 title: {
27 - des: 'BLK', 27 + des: '',
28 action: '' 28 action: ''
29 } 29 }
30 }, 30 },
@@ -34,7 +34,7 @@ const titleMap = { @@ -34,7 +34,7 @@ const titleMap = {
34 action: '' 34 action: ''
35 }, 35 },
36 title: { 36 title: {
37 - des: 'BLK', 37 + des: '',
38 action: '' 38 action: ''
39 }, 39 },
40 right: { 40 right: {
@@ -48,7 +48,7 @@ const titleMap = { @@ -48,7 +48,7 @@ const titleMap = {
48 action: '' 48 action: ''
49 }, 49 },
50 title: { 50 title: {
51 - des: 'BLK', 51 + des: '',
52 action: '' 52 action: ''
53 }, 53 },
54 right: { 54 right: {
@@ -89,7 +89,7 @@ const titleMap = { @@ -89,7 +89,7 @@ const titleMap = {
89 6: { 89 6: {
90 headerid: '6', 90 headerid: '6',
91 title: { 91 title: {
92 - des: '资讯6', 92 + des: '资讯',
93 action: '' 93 action: ''
94 } 94 }
95 } 95 }
@@ -97,10 +97,16 @@ const titleMap = { @@ -97,10 +97,16 @@ const titleMap = {
97 97
98 const matchHeader = (url) => { 98 const matchHeader = (url) => {
99 let header = { 99 let header = {
100 - headerid: '-1' // 默认不显示头部 100 + headerid: '-1'
101 }; 101 };
102 let path = url.split('?')[0]; 102 let path = url.split('?')[0];
103 103
  104 + if (/\/cate-all$/.test(path)) {
  105 + header = titleMap[1];
  106 + header.title.des = '全部分类';
  107 + return header;
  108 + }
  109 +
104 if (/\/me\/mydetails$/.test(path)) { 110 if (/\/me\/mydetails$/.test(path)) {
105 header = titleMap[1]; 111 header = titleMap[1];
106 header.title.des = '个人信息'; 112 header.title.des = '个人信息';
@@ -201,12 +207,12 @@ module.exports = (url) => { @@ -201,12 +207,12 @@ module.exports = (url) => {
201 } 207 }
202 208
203 // 资讯 209 // 资讯
204 - if (/\/news$/.test(path)) { 210 + if (/\/editorial\/list$/.test(path)) {
205 return yoho.goTab({index: 2}); 211 return yoho.goTab({index: 2});
206 } 212 }
207 213
208 // 品牌 品类 214 // 品牌 品类
209 - if (/\/brands$/.test(path) || /\/cate$/.test(path)) { 215 + if (/\/brand$/.test(path) || /\/cate$/.test(path)) {
210 return yoho.goTab({index: 1}); 216 return yoho.goTab({index: 1});
211 } 217 }
212 218
@@ -25,7 +25,7 @@ const cate = { @@ -25,7 +25,7 @@ const cate = {
25 }; 25 };
26 26
27 /* TODO 资讯列表资源位 */ 27 /* TODO 资讯列表资源位 */
28 -const news = { 28 +const editorial = {
29 all: 'd4fdfcad1ec877d466d9780efaf4d296', 29 all: 'd4fdfcad1ec877d466d9780efaf4d296',
30 men: 'e1f8dce8cb9de1a0977479c13c4d3dcc', 30 men: 'e1f8dce8cb9de1a0977479c13c4d3dcc',
31 women: '5c0b9963d8b75e6fd788a2b49402be14' 31 women: '5c0b9963d8b75e6fd788a2b49402be14'
@@ -35,5 +35,5 @@ module.exports = { @@ -35,5 +35,5 @@ module.exports = {
35 channel, 35 channel,
36 brand, 36 brand,
37 cate, 37 cate,
38 - news 38 + editorial
39 }; 39 };
1 const Vue = require('vue'); 1 const Vue = require('vue');
2 const lazyload = require('vue-lazyload'); 2 const lazyload = require('vue-lazyload');
3 3
4 -const app = require('news/detail.vue'); 4 +const app = require('editorial/detail.vue');
5 5
6 new Vue({ 6 new Vue({
7 el: '#app', 7 el: '#app',
@@ -8,7 +8,7 @@ const Vue = require('vue'); @@ -8,7 +8,7 @@ const Vue = require('vue');
8 const lazyload = require('vue-lazyload'); 8 const lazyload = require('vue-lazyload');
9 const infinitScroll = require('vue-infinite-scroll'); 9 const infinitScroll = require('vue-infinite-scroll');
10 10
11 -const indexBox = require('news/index-box.vue'); 11 +const indexBox = require('editorial/index-box.vue');
12 12
13 Vue.use(lazyload); 13 Vue.use(lazyload);
14 Vue.use(infinitScroll); 14 Vue.use(infinitScroll);
1 <template> 1 <template>
2 <top-nav :id="id" :article="article"></top-nav> 2 <top-nav :id="id" :article="article"></top-nav>
3 <div class="show-box no-padding first-box"> 3 <div class="show-box no-padding first-box">
4 - <div class="news-box"> 4 + <div class="editorial-box">
5 <h1>{{article.articleTitle}}</h1> 5 <h1>{{article.articleTitle}}</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 | formatUnixTime 'MM.DD HH:mm'}}</span>
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <style class="scss" scoped> 52 <style class="scss" scoped>
53 $bgcolor: #fff; 53 $bgcolor: #fff;
54 54
55 - .news-page { 55 + .editorial-page {
56 background: #f6f6f6; 56 background: #f6f6f6;
57 } 57 }
58 58
@@ -78,7 +78,7 @@ @@ -78,7 +78,7 @@
78 margin-bottom: 0; 78 margin-bottom: 0;
79 } 79 }
80 80
81 - .news-box { 81 + .editorial-box {
82 padding: 30px; 82 padding: 30px;
83 background: $bgcolor; 83 background: $bgcolor;
84 } 84 }
@@ -201,12 +201,12 @@ @@ -201,12 +201,12 @@
201 }; 201 };
202 }, 202 },
203 init() { 203 init() {
204 - const newsId = $('#app').data('newsId'); 204 + const editorialId = $('#app').data('editorialId');
205 205
206 - this.id = newsId; 206 + this.id = editorialId;
207 let loadDeferred = null; 207 let loadDeferred = null;
208 208
209 - $.get(`/news/news_${newsId}.json`).then(result => { 209 + $.get(`/editorial/editorial_${editorialId}.json`).then(result => {
210 const article = result[0], 210 const article = result[0],
211 content = result[1], 211 content = result[1],
212 brands = result[2], 212 brands = result[2],
1 <template> 1 <template>
2 <resources v-bind:content-code.sync="contentCode"></resources> 2 <resources v-bind:content-code.sync="contentCode"></resources>
3 <div v-infinite-scroll="getNewsList()" infinite-scroll-disabled="scrollDisabled"> 3 <div v-infinite-scroll="getNewsList()" infinite-scroll-disabled="scrollDisabled">
4 - <div v-for="news in newsList" class="news-box"> 4 + <div v-for="editorial in editorialList" class="editorial-box">
5 <div class="img"> 5 <div class="img">
6 - <a href='{{"/news/" + news.id}}'>  
7 - <img v-lazy="news.src | resize 750 470" alt="" /> 6 + <a href='{{"/editorial/" + editorial.id + ".html"}}'>
  7 + <img v-lazy="editorial.src | resize 750 470" alt="" />
8 </a> 8 </a>
9 </div> 9 </div>
10 - <div class="title"><a href='{{"/news/" + news.id}}'>{{news.title}}</a></div>  
11 - <div class="news-des">  
12 - {{news.intro}} 10 + <div class="title"><a href='{{"/editorial/" + editorial.id + ".html"}}'>{{editorial.title}}</a></div>
  11 + <div class="editorial-des">
  12 + {{editorial.intro}}
13 </div> 13 </div>
14 <hr> 14 <hr>
15 <div class="bottom clearfix"> 15 <div class="bottom clearfix">
16 <span class="icon time-icon">&#xe612;</span> 16 <span class="icon time-icon">&#xe612;</span>
17 - <span class="time">{{news.publishTime}}</span>  
18 - <span class="icon icon-share share" @click="share(news.title, news.intro, news.src, news.share.url)"></span> 17 + <span class="time">{{editorial.publishTime}}</span>
  18 + <span class="icon icon-share share" @click="share(editorial.title, editorial.intro, editorial.src, editorial.share.url)"></span>
19 </div> 19 </div>
20 </div> 20 </div>
21 </div> 21 </div>
22 </template> 22 </template>
23 <style> 23 <style>
24 - .news-box { 24 + .editorial-box {
25 background: #f6f6f6; 25 background: #f6f6f6;
26 26
27 .img { 27 .img {
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 padding: 10px 20px; 42 padding: 10px 20px;
43 } 43 }
44 44
45 - .news-des { 45 + .editorial-des {
46 background: #fff; 46 background: #fff;
47 padding: 10px 20px; 47 padding: 10px 20px;
48 color: #939393; 48 color: #939393;
@@ -77,8 +77,8 @@ @@ -77,8 +77,8 @@
77 module.exports = { 77 module.exports = {
78 data() { 78 data() {
79 return { 79 return {
80 - contentCode: contentCode.news[qs.channel || 'all'],  
81 - newsList: [], 80 + contentCode: contentCode.editorial[qs.channel || 'all'],
  81 + editorialList: [],
82 page: 0, 82 page: 0,
83 scrollDisabled: false 83 scrollDisabled: false
84 }; 84 };
@@ -93,17 +93,17 @@ @@ -93,17 +93,17 @@
93 /* 获取资讯列表数据 */ 93 /* 获取资讯列表数据 */
94 getNewsList() { 94 getNewsList() {
95 $.post({ 95 $.post({
96 - url: '/news/list.json', 96 + url: '/editorial/list.json',
97 data: { 97 data: {
98 page: this.page++, 98 page: this.page++,
99 channel: qs.channel || 'all' 99 channel: qs.channel || 'all'
100 } 100 }
101 }).done(result => { 101 }).done(result => {
102 if (result.code === 200) { 102 if (result.code === 200) {
103 - if (this.newsList.length > 0 && result.data.list.length > 0) {  
104 - this.$set('newsList', this.newsList.concat(result.data.list)); 103 + if (this.editorialList.length > 0 && result.data.list.length > 0) {
  104 + this.$set('editorialList', this.editorialList.concat(result.data.list));
105 } else { 105 } else {
106 - this.newsList = result.data.list; 106 + this.editorialList = result.data.list;
107 } 107 }
108 } else { 108 } else {
109 this.scrollDisabled = true; 109 this.scrollDisabled = true;
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 }, 55 },
56 methods: { 56 methods: {
57 like: function() { 57 like: function() {
58 - $.get(`/news/like_${this.article.id}.json`, { 58 + $.get(`/editorial/like_${this.article.id}.json`, {
59 flag: !this.isLiked 59 flag: !this.isLiked
60 }, (results)=> { 60 }, (results)=> {
61 const result = results[0], misc = results[1]; 61 const result = results[0], misc = results[1];
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 }); 70 });
71 }, 71 },
72 favorite: function() { 72 favorite: function() {
73 - $.get(`/news/favorite_${this.article.id}.json`, { 73 + $.get(`/editorial/favorite_${this.article.id}.json`, {
74 flag: !this.isFavorite 74 flag: !this.isFavorite
75 }, (results)=> { 75 }, (results)=> {
76 const result = results[0], misc = results[1]; 76 const result = results[0], misc = results[1];
@@ -108,7 +108,7 @@ @@ -108,7 +108,7 @@
108 } 108 }
109 }, 109 },
110 created() { 110 created() {
111 - $.get(`/news/misc_${this.id}.json`).then(result => { 111 + $.get(`/editorial/misc_${this.id}.json`).then(result => {
112 if (result.code === 200) { 112 if (result.code === 200) {
113 this.isFavorite = result.data.isFavor === 'Y'; 113 this.isFavorite = result.data.isFavor === 'Y';
114 this.isLiked = result.data.isPraise === 'Y'; 114 this.isLiked = result.data.isPraise === 'Y';