|
@@ -14,13 +14,22 @@ const sign = require(`${lRoot}/sign`); |
|
@@ -14,13 +14,22 @@ const sign = require(`${lRoot}/sign`); |
14
|
|
14
|
|
15
|
const api = new API('http://testservice.yoho.cn:28077');
|
15
|
const api = new API('http://testservice.yoho.cn:28077');
|
16
|
|
16
|
|
|
|
17
|
+/**
|
|
|
18
|
+ * 获取接口配置
|
|
|
19
|
+ * @param undefined
|
|
|
20
|
+ * @return {Object} 配置对象
|
|
|
21
|
+ */
|
17
|
const getConfig = () => ({
|
22
|
const getConfig = () => ({
|
18
|
title: 'home',
|
23
|
title: 'home',
|
19
|
devEnv: true,
|
24
|
devEnv: true,
|
20
|
version: '0.0.1'
|
25
|
version: '0.0.1'
|
21
|
});
|
26
|
});
|
22
|
|
27
|
|
23
|
-
|
28
|
+/**
|
|
|
29
|
+ * 获取菜单
|
|
|
30
|
+ * @param undefined
|
|
|
31
|
+ * @return {array} 菜单数组
|
|
|
32
|
+ */
|
24
|
const getMenuData = () => (
|
33
|
const getMenuData = () => (
|
25
|
[
|
34
|
[
|
26
|
{
|
35
|
{
|
|
@@ -51,8 +60,11 @@ const getMenuData = () => ( |
|
@@ -51,8 +60,11 @@ const getMenuData = () => ( |
51
|
]
|
60
|
]
|
52
|
);
|
61
|
);
|
53
|
|
62
|
|
54
|
-
|
|
|
55
|
-
|
63
|
+/**
|
|
|
64
|
+ * 获取导航
|
|
|
65
|
+ * @param undefined
|
|
|
66
|
+ * @return {array} 导航数组
|
|
|
67
|
+ */
|
56
|
const getNavBar = (data) => {
|
68
|
const getNavBar = (data) => {
|
57
|
let navBars = [];
|
69
|
let navBars = [];
|
58
|
|
70
|
|
|
@@ -69,6 +81,12 @@ const getNavBar = (data) => { |
|
@@ -69,6 +81,12 @@ const getNavBar = (data) => { |
69
|
return navBars;
|
81
|
return navBars;
|
70
|
};
|
82
|
};
|
71
|
|
83
|
|
|
|
84
|
+
|
|
|
85
|
+/**
|
|
|
86
|
+ * 获取品牌名字
|
|
|
87
|
+ * @param undefined
|
|
|
88
|
+ * @return {array} 品牌数组
|
|
|
89
|
+ */
|
72
|
const getBrandItems = (data) => {
|
90
|
const getBrandItems = (data) => {
|
73
|
let brandItems = [];
|
91
|
let brandItems = [];
|
74
|
|
92
|
|
|
@@ -86,6 +104,11 @@ const getBrandItems = (data) => { |
|
@@ -86,6 +104,11 @@ const getBrandItems = (data) => { |
86
|
return brandItems;
|
104
|
return brandItems;
|
87
|
};
|
105
|
};
|
88
|
|
106
|
|
|
|
107
|
+/**
|
|
|
108
|
+ * 获取三级菜单
|
|
|
109
|
+ * @param undefined
|
|
|
110
|
+ * @return {array} 三级菜单数组
|
|
|
111
|
+ */
|
89
|
const getThirdNav = (data) => {
|
112
|
const getThirdNav = (data) => {
|
90
|
let thirdNav = [];
|
113
|
let thirdNav = [];
|
91
|
|
114
|
|
|
@@ -107,6 +130,11 @@ const getThirdNav = (data) => { |
|
@@ -107,6 +130,11 @@ const getThirdNav = (data) => { |
107
|
return thirdNav;
|
130
|
return thirdNav;
|
108
|
};
|
131
|
};
|
109
|
|
132
|
|
|
|
133
|
+/**
|
|
|
134
|
+ * 获取子菜单
|
|
|
135
|
+ * @param undefined
|
|
|
136
|
+ * @return {array} 子菜单数组
|
|
|
137
|
+ */
|
110
|
const getSubNav = (data) => {
|
138
|
const getSubNav = (data) => {
|
111
|
let subNav = [];
|
139
|
let subNav = [];
|
112
|
|
140
|
|
|
@@ -125,13 +153,15 @@ const getSubNav = (data) => { |
|
@@ -125,13 +153,15 @@ const getSubNav = (data) => { |
125
|
subNav.push(obj);
|
153
|
subNav.push(obj);
|
126
|
});
|
154
|
});
|
127
|
|
155
|
|
128
|
-
|
|
|
129
|
- console.log(subNav);
|
|
|
130
|
-
|
|
|
131
|
return subNav;
|
156
|
return subNav;
|
132
|
};
|
157
|
};
|
133
|
|
158
|
|
134
|
|
159
|
|
|
|
160
|
+/**
|
|
|
161
|
+ * 处理接口返回的数据
|
|
|
162
|
+ * @param {object} 接口返回的对象
|
|
|
163
|
+ * @return {object} 头部数据
|
|
|
164
|
+ */
|
135
|
exports.getAllHeaderData = function(resData) {
|
165
|
exports.getAllHeaderData = function(resData) {
|
136
|
let config = getConfig();
|
166
|
let config = getConfig();
|
137
|
let data = {
|
167
|
let data = {
|
|
@@ -147,6 +177,11 @@ exports.getAllHeaderData = function(resData) { |
|
@@ -147,6 +177,11 @@ exports.getAllHeaderData = function(resData) { |
147
|
return _.merge(config, data);
|
177
|
return _.merge(config, data);
|
148
|
};
|
178
|
};
|
149
|
|
179
|
|
|
|
180
|
+/**
|
|
|
181
|
+ * 请求头部数据
|
|
|
182
|
+ * @param undefined
|
|
|
183
|
+ * @return {promise}
|
|
|
184
|
+ */
|
150
|
exports.getHeaderData = function() {
|
185
|
exports.getHeaderData = function() {
|
151
|
let data = sign.apiSign({
|
186
|
let data = sign.apiSign({
|
152
|
|
187
|
|