...
|
...
|
@@ -8,6 +8,7 @@ |
|
|
const _ = require('lodash');
|
|
|
const helpApi = require('./help-api');
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const pager = require(`${global.utils}/pager`).setPager;
|
|
|
|
|
|
/**
|
|
|
* 根据id获取当前所在位置,拼接面包屑
|
...
|
...
|
@@ -23,7 +24,7 @@ const _getNav = (id, menuData)=> { |
|
|
if (menuData[i].subsets[j].id === id) {
|
|
|
return [
|
|
|
{
|
|
|
link: ' ',
|
|
|
href: ' ',
|
|
|
name: menuData[i].categoryName
|
|
|
}, {
|
|
|
name: menuData[i].subsets[j].categoryName
|
...
|
...
|
@@ -62,6 +63,38 @@ const _processLink = (list, id) => { |
|
|
return list;
|
|
|
};
|
|
|
|
|
|
// 处理分类
|
|
|
const _processMenuType = (item) => {
|
|
|
let curMenu = {
|
|
|
id: item.id,
|
|
|
categoryName: item.categoryName
|
|
|
};
|
|
|
|
|
|
let subsets = [];
|
|
|
|
|
|
if (item.categoryItems) {
|
|
|
_.forEach(item.categoryItems, c => {
|
|
|
subsets.push({
|
|
|
id: c.id,
|
|
|
parendId: item.id,
|
|
|
categoryName: c.categoryName
|
|
|
});
|
|
|
});
|
|
|
curMenu.subsets = subsets;
|
|
|
}
|
|
|
|
|
|
return curMenu;
|
|
|
};
|
|
|
|
|
|
// 统计当前分类下的内容是否大于1
|
|
|
const _processCountLength = (c) => {
|
|
|
if (!c.contentItems) {
|
|
|
return false;
|
|
|
} else {
|
|
|
return c.contentItems.length > 1;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 首页模块内容处理
|
|
|
const _processHomeCategoryFaq = (list) => {
|
|
|
let result = {
|
...
|
...
|
@@ -120,38 +153,6 @@ const _processHomeCategoryFaq = (list) => { |
|
|
return result;
|
|
|
};
|
|
|
|
|
|
// 处理分类
|
|
|
const _processMenuType = (item) => {
|
|
|
let curMenu = {
|
|
|
id: item.id,
|
|
|
categoryName: item.categoryName
|
|
|
};
|
|
|
|
|
|
let subsets = [];
|
|
|
|
|
|
if (item.categoryItems) {
|
|
|
_.forEach(item.categoryItems, c => {
|
|
|
subsets.push({
|
|
|
id: c.id,
|
|
|
parendId: item.id,
|
|
|
categoryName: c.categoryName
|
|
|
});
|
|
|
});
|
|
|
curMenu.subsets = subsets;
|
|
|
}
|
|
|
|
|
|
return curMenu;
|
|
|
};
|
|
|
|
|
|
// 统计当前分类下的内容是否大于1
|
|
|
const _processCountLength = (c) => {
|
|
|
if (!c.contentItems) {
|
|
|
return false;
|
|
|
} else {
|
|
|
return c.contentItems.length > 1;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const returnCont = (data, contId) => {
|
|
|
let curCont = {};
|
|
|
|
...
|
...
|
@@ -203,17 +204,13 @@ const _processSearch = (list, params) => { |
|
|
error: true
|
|
|
};
|
|
|
} else {
|
|
|
let page = pager(_.get(list, 'page_total', 0), {
|
|
|
page: params.page,
|
|
|
helpQuery: params.keywords
|
|
|
});
|
|
|
|
|
|
list = _.assign({
|
|
|
paginationData: {
|
|
|
page: list.page,
|
|
|
limit: list.page_size || 10,
|
|
|
total: list.total,
|
|
|
pageTotal: list.page_total,
|
|
|
queryParams: {
|
|
|
page: params.page,
|
|
|
helpQuery: params.keywords
|
|
|
}
|
|
|
}
|
|
|
footPager: page
|
|
|
}, list);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -224,7 +221,7 @@ const _processSearch = (list, params) => { |
|
|
const _processDetailData = (result, params) => {
|
|
|
let menuData = [];
|
|
|
let contData = false;
|
|
|
let data = result[2].data;
|
|
|
let data = result[2].data || {};
|
|
|
let nav = [];
|
|
|
|
|
|
// 常见问题
|
...
|
...
|
@@ -300,7 +297,7 @@ const helpData = (channel) => { |
|
|
list: result[3].data
|
|
|
}
|
|
|
}, _processHomeCategoryFaq(result[2].data))
|
|
|
}
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -332,20 +329,18 @@ const searchData = (params) => { |
|
|
return helpApi.helpSearch(params).then(result => {
|
|
|
return _.assign({
|
|
|
keywords: params.keywords
|
|
|
}, _processSearch(_.get(result, 'data.data', []), params));
|
|
|
}, _processSearch(_.get(result, 'data', []), params));
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 在线客服
|
|
|
const onlineService = () => {
|
|
|
return helpApi.onlineService().then(result => {
|
|
|
let url = '';
|
|
|
|
|
|
if (result.data) {
|
|
|
url = result.data.url;
|
|
|
if (result.code === 200) {
|
|
|
return result.data.url;
|
|
|
} else {
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
return url;
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|