resources-process.js
963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
/**
* 处理楼层数据
* @param {[array]} list
* @return {[array]}
*/
module.exports = (list) => {
const formatData = [];
list = list || [];
// TODO:
list = camelCase(list);
_.forEach(list, (floor) => {
floor[_.camelCase(floor.templateName)] = true;
// 特殊资源位处理
// PLUS
if (floor.singleNameImage && floor.data) {
floor.data.title = {
title: floor.data.title
};
}
// 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装
if (floor.recommendContentOne && floor.data) {
if (floor.data.bigImage && floor.data.bigImage.length > 1) {
floor.data.bigImage = {
bigList: floor.data.bigImage
};
}
}
formatData.push(floor);
});
return formatData;
};