...
|
...
|
@@ -52,10 +52,13 @@ const getNavBar = (data, type) => { |
|
|
let obj = {};
|
|
|
let lowEn = _.camelCase(item.sort_name_en).toLowerCase();
|
|
|
|
|
|
obj.link = item.sort_url;
|
|
|
obj.cn = item.sort_name;
|
|
|
obj.en = item.sort_name_en;
|
|
|
obj.isNewPage = item.is_new_page === 'Y' ? true : false;
|
|
|
Object.assign(obj, {
|
|
|
type: lowEn,
|
|
|
link: item.sort_url,
|
|
|
cn: item.sort_name,
|
|
|
en: item.sort_name_en,
|
|
|
isNewPage: item.is_new_page === 'Y'
|
|
|
});
|
|
|
|
|
|
if (type === lowEn) {
|
|
|
obj.active = true;
|
...
|
...
|
@@ -135,30 +138,38 @@ const getThirdNav = (data) => { |
|
|
* @param {String} type 频道类型
|
|
|
* @return {array} 子菜单数组
|
|
|
*/
|
|
|
const getSubNav = (data, type) => {
|
|
|
let subNav = [];
|
|
|
const getSubNavGroup = (data, type) => {
|
|
|
let subNavGroup = [];
|
|
|
|
|
|
_.forEach(data, it => {
|
|
|
if (type === _.camelCase(it.sort_name_en).toLowerCase()) {
|
|
|
_.forEach(it.sub, item => {
|
|
|
let obj = {};
|
|
|
|
|
|
obj.link = item.sort_url;
|
|
|
obj.name = item.sort_name;
|
|
|
obj.isHot = item.is_hot === 'Y' ? true : false;
|
|
|
obj.isNew = item.is_new === 'Y' ? true : false;
|
|
|
|
|
|
if (item.sub) {
|
|
|
obj.thirdNav = getThirdNav(item.sub);
|
|
|
obj.imgCode = item.content_code;
|
|
|
}
|
|
|
|
|
|
subNav.push(obj);
|
|
|
});
|
|
|
}
|
|
|
let subNav = [];
|
|
|
|
|
|
_.forEach(it.sub, item => {
|
|
|
let obj = {};
|
|
|
|
|
|
obj.link = item.sort_url;
|
|
|
obj.name = item.sort_name;
|
|
|
obj.isHot = item.is_hot === 'Y' ? true : false;
|
|
|
obj.isNew = item.is_new === 'Y' ? true : false;
|
|
|
|
|
|
if (item.sub) {
|
|
|
obj.thirdNav = getThirdNav(item.sub);
|
|
|
obj.imgCode = item.content_code;
|
|
|
}
|
|
|
|
|
|
subNav.push(obj);
|
|
|
});
|
|
|
|
|
|
let lowEn = _.camelCase(it.sort_name_en).toLowerCase();
|
|
|
|
|
|
subNavGroup.push({
|
|
|
subType: lowEn,
|
|
|
subNav: subNav,
|
|
|
active: lowEn === type
|
|
|
});
|
|
|
});
|
|
|
|
|
|
return subNav;
|
|
|
return subNavGroup;
|
|
|
};
|
|
|
|
|
|
|
...
|
...
|
@@ -174,7 +185,7 @@ const setHeaderData = (resData, type) => ( |
|
|
headType: type,
|
|
|
yohoGroup: getMenuData(),
|
|
|
navbars: resData ? getNavBar(resData, type) : [],
|
|
|
subNav: resData ? getSubNav(resData, type) : []
|
|
|
subNavGroup: resData ? getSubNavGroup(resData, type) : []
|
|
|
}
|
|
|
);
|
|
|
|
...
|
...
|
|