...
|
...
|
@@ -4,8 +4,10 @@ const serviceAPI = global.yoho.ServiceAPI; |
|
|
// const api = global.yoho.API;
|
|
|
const camelCase = global.yoho.camelCase;
|
|
|
const _ = require('lodash');
|
|
|
const moment = require('moment');
|
|
|
const logger = global.yoho.logger;
|
|
|
//const helpers = global.yoho.helpers;
|
|
|
|
|
|
// const helpers = global.yoho.helpers;
|
|
|
|
|
|
const _processNavData = (list, type) => {
|
|
|
let formatData = [];
|
...
|
...
|
@@ -15,38 +17,24 @@ const _processNavData = (list, type) => { |
|
|
|
|
|
_.forEach(list, (data, index) => {
|
|
|
data.url = `//127.0.0.1:6003/editorial?type=${data.id}`;
|
|
|
|
|
|
if (index === _.parseInt(type)) {
|
|
|
data.isActive = true;
|
|
|
} else {
|
|
|
data.isActive = false;
|
|
|
}
|
|
|
data.isActive = index === parseInt(type) ? true : false;
|
|
|
|
|
|
formatData.push(data);
|
|
|
});
|
|
|
|
|
|
console.log(formatData);
|
|
|
|
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
const _processListData = (list) => {
|
|
|
//let formatData = [];
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
//list = camelCase(list);
|
|
|
|
|
|
'2016年06月02日 15:56'.match(/^(\d+)年(\d+)月(\d+)日 (\d+):(\d+)$/, function(data) {
|
|
|
console.log(data);
|
|
|
});
|
|
|
let data = moment('2016年06月02日 15:56', "YYYY年MM月DD日 HH:mm").format('YYYY/MM/DD HH:mm');
|
|
|
|
|
|
let artList = list.list.artList.map(data =>{
|
|
|
|
|
|
// let time = data.publish_time.match(/^(\d+)年(\d+)月(\d+)日 (\d+):(\d+)$/);
|
|
|
// data.publishTime = `${time[1]}/${time[2]}/${time[3]} ${time[4]}:${time[5]}`
|
|
|
|
|
|
data.publishTime = data.publish_time.replace(/年|月/g, '/');
|
|
|
data.publishTime = data.publishTime.replace(/年|月/g, '/');
|
|
|
data.publishTime = data.publishTime.replace(/日/g, '');
|
|
|
|
|
|
return data;
|
...
|
...
|
@@ -77,8 +65,8 @@ const _getBreakingSort = () => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const getIndexData = () => {
|
|
|
return Promise.all([_getResources(), _getBreakingSort()])
|
|
|
const getIndexData = (type) => {
|
|
|
return Promise.all([_getResources(type), _getBreakingSort()])
|
|
|
.then((result) => {
|
|
|
|
|
|
return {
|
...
|
...
|
|