...
|
...
|
@@ -159,12 +159,13 @@ const _getSlideData = srcData => { |
|
|
* @param {Object} srcData 原始数据
|
|
|
* @return {Object} 转换后的数据
|
|
|
*/
|
|
|
const _getNewReportFloorData = (args, type, code) => {
|
|
|
const _getNewReportFloorData = (args) => {
|
|
|
const title = args[0].data.text;
|
|
|
let item = args[1].data;
|
|
|
let secondItem = args[2].data;
|
|
|
let thirdItem = args[3].data;
|
|
|
let forthItem = args.length === 5 ? args[4] : {};
|
|
|
let forthItem = args[4] || {};
|
|
|
let brandLogos = {logoBrand: [], moreBrand: ''};
|
|
|
|
|
|
let list = [];
|
|
|
|
...
|
...
|
@@ -199,8 +200,20 @@ const _getNewReportFloorData = (args, type, code) => { |
|
|
|
|
|
// logo列表
|
|
|
if (forthItem.template_name && forthItem.template_name === 'floor') {
|
|
|
data.newReport.brandUrl = '/getbrandFloorDataAjax?channelType=' + type +
|
|
|
'&contentCode=' + code;
|
|
|
// 品牌数据
|
|
|
_.forEach(forthItem.data, (floorData) => {
|
|
|
let o = {};
|
|
|
|
|
|
o.href = floorData.url;
|
|
|
o.img = helpers.image(floorData.src, 185, 86, 2);
|
|
|
brandLogos.logoBrand.push(o);
|
|
|
});
|
|
|
|
|
|
if (args[5] && args[5].data[0] && args[5].data[0].url) {
|
|
|
brandLogos.moreBrand = args[5].data[0].url || '';
|
|
|
}
|
|
|
|
|
|
data.newReport.brandLogos = brandLogos;
|
|
|
}
|
|
|
return floorDatas;
|
|
|
};
|
...
|
...
|
@@ -224,16 +237,32 @@ const _setChannelType = (obj, type) => { |
|
|
*/
|
|
|
const _getPreBrandTopData = (args, type) => {
|
|
|
const title = args[0].data.text;
|
|
|
let item = args[1].data;
|
|
|
let item = args[1].data,
|
|
|
logoItems = args[2] || {},
|
|
|
brandLogos = {logoBrand: [], moreBrand: ''};
|
|
|
|
|
|
const data = {
|
|
|
preferenceBrands: {
|
|
|
name: title,
|
|
|
imgBrand: [],
|
|
|
brandUrl: '/getbrandFloorDataAjax?channelType=' + type
|
|
|
imgBrand: []
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// logo列表
|
|
|
if (logoItems.template_name && logoItems.template_name === 'floor') {
|
|
|
// 品牌数据
|
|
|
_.forEach(args[2].data, (floorData) => {
|
|
|
let o = {};
|
|
|
|
|
|
o.href = floorData.url;
|
|
|
o.img = helpers.image(floorData.src, 185, 86, 2);
|
|
|
brandLogos.logoBrand.push(o);
|
|
|
});
|
|
|
if (args[3] && args[3].data[0] && args[3].data[0].url) {
|
|
|
brandLogos.moreBrand = args[3].data[0].url;
|
|
|
}
|
|
|
data.preferenceBrands.brandLogos = brandLogos;
|
|
|
}
|
|
|
data.preferenceBrands.imgBrand = item;
|
|
|
if (type === 'kids') {
|
|
|
data.preferenceBrands.sliderColor = '#7AD3F8';
|
...
|
...
|
@@ -798,7 +827,7 @@ const _processJKFloorData = (rawData, type, code) => { |
|
|
|
|
|
// 最新速报
|
|
|
if (text.indexOf('最新速报') >= 0) {
|
|
|
floorData = _getNewReportFloorData(rawData.slice(index, index + 5), type, code);
|
|
|
floorData = _getNewReportFloorData(rawData.slice(index, index + 6));
|
|
|
|
|
|
// 单个图作为最新速报模块用过的,标识一下,不作为广告位了
|
|
|
_.filter(rawData.slice(index, index + 5), function(o) {
|
...
|
...
|
@@ -1119,39 +1148,39 @@ const getJKContent = (req) => { |
|
|
return Promise.all([headerModel.requestHeaderData(channel),
|
|
|
_requestContent(channel, {}, contentCode)]).then(res => {
|
|
|
|
|
|
let headerData = res[0].data || res[0],
|
|
|
contentData = res[1].data ? res[1].data.list : res[1];
|
|
|
let headerData = res[0].data || res[0],
|
|
|
contentData = res[1].data ? res[1].data.list : res[1];
|
|
|
|
|
|
let data = {};
|
|
|
let data = {};
|
|
|
|
|
|
const processResult = _processJKFloorData(contentData, channel, contentCode);
|
|
|
const processResult = _processJKFloorData(contentData, channel, contentCode);
|
|
|
|
|
|
data = headerData;
|
|
|
data.module = 'channel';
|
|
|
data.page = 'channel';
|
|
|
data.pageType = channel;
|
|
|
data.mchannel = 'japanKorean';// 子频道,如日韩馆
|
|
|
data.footerTop = true;
|
|
|
data.channel = processResult.floors;
|
|
|
data = headerData;
|
|
|
data.module = 'channel';
|
|
|
data.page = 'channel';
|
|
|
data.pageType = channel;
|
|
|
data.mchannel = 'japanKorean';// 子频道,如日韩馆
|
|
|
data.footerTop = true;
|
|
|
data.channel = processResult.floors;
|
|
|
|
|
|
|
|
|
return {
|
|
|
rawData: contentData,
|
|
|
floorData: data,
|
|
|
searchPromise: processResult.promise,
|
|
|
singlehotFloorIndex: processResult.singlehotFloorIndex,
|
|
|
singlehotFloorTitle: processResult.singlehotFloorTitle,
|
|
|
queryParams: processResult.queryParams,
|
|
|
channelType: channel
|
|
|
};
|
|
|
return {
|
|
|
rawData: contentData,
|
|
|
floorData: data,
|
|
|
searchPromise: processResult.promise,
|
|
|
singlehotFloorIndex: processResult.singlehotFloorIndex,
|
|
|
singlehotFloorTitle: processResult.singlehotFloorTitle,
|
|
|
queryParams: processResult.queryParams,
|
|
|
channelType: channel
|
|
|
};
|
|
|
|
|
|
}).then(result => {
|
|
|
}).then(result => {
|
|
|
|
|
|
// 如果有promise则做相应处理
|
|
|
if (result.searchPromise.length) {
|
|
|
return Promise.all(result.searchPromise).then(res => {
|
|
|
_.forEach(res, (data, index) => {
|
|
|
result.floorData.channel
|
|
|
if (result.searchPromise.length) {
|
|
|
return Promise.all(result.searchPromise).then(res => {
|
|
|
_.forEach(res, (data, index) => {
|
|
|
result.floorData.channel
|
|
|
.splice(result.singlehotFloorIndex[index], 0,
|
|
|
_processFloorDataWithQueryReusult(
|
|
|
result.rawData,
|
...
|
...
|
@@ -1160,57 +1189,14 @@ const getJKContent = (req) => { |
|
|
result.singlehotFloorTitle[index],
|
|
|
result.channelType
|
|
|
));
|
|
|
});
|
|
|
});
|
|
|
|
|
|
return result.floorData;
|
|
|
return result.floorData;
|
|
|
});
|
|
|
} else {
|
|
|
return result.floorData || result;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
return result.floorData || result;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
// 品牌楼层floorData-ajax
|
|
|
const getbrandFloorDataAjax = (type, code) => {
|
|
|
let params = {new_device: 'Y'};
|
|
|
|
|
|
return _requestContent(type, params, code).then(res => {
|
|
|
let contentData = res.data ? res.data.list : [];
|
|
|
|
|
|
let data = {
|
|
|
logoBrand: [],
|
|
|
moreBrand: ''
|
|
|
};
|
|
|
|
|
|
_.forEach(contentData, (d, index) => {
|
|
|
let logoIndex = index;
|
|
|
|
|
|
// 频道页,有两处logo列表,一处优选品牌后面;一处最新速报后面,此处判断
|
|
|
if (d.data && d.data.text && d.data.text.indexOf('优选品牌') >= 0) {
|
|
|
logoIndex = index + 2;
|
|
|
} else if (d.data && d.data.text && d.data.text.indexOf('最新速报') >= 0) {
|
|
|
logoIndex = index + 4;
|
|
|
}
|
|
|
|
|
|
if (logoIndex !== index) {
|
|
|
_.forEach(contentData[logoIndex].data, (floorData) => {
|
|
|
let o = {};
|
|
|
|
|
|
o.href = floorData.url;
|
|
|
o.img = helpers.image(floorData.src, 185, 86, 2);
|
|
|
|
|
|
data.logoBrand.push(o);
|
|
|
});
|
|
|
data.moreBrand = contentData[logoIndex + 1].data[0].url;
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
return data;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getResourceData = (formatData) => {
|
...
|
...
|
@@ -1273,7 +1259,6 @@ module.exports = { |
|
|
getNewArrival: getNewArrival,
|
|
|
getContent: getContent,
|
|
|
getJKContent: getJKContent,
|
|
|
getbrandFloorDataAjax: getbrandFloorDataAjax,
|
|
|
getIndexGuideData: getIndexGuideData,
|
|
|
formatIndexGuideData: formatIndexGuideData,
|
|
|
getResourceData: getResourceData,
|
...
|
...
|
|