Authored by biao

update for comment

... ... @@ -14,13 +14,22 @@ const sign = require(`${lRoot}/sign`);
const api = new API('http://testservice.yoho.cn:28077');
/**
* 获取接口配置
* @param undefined
* @return {Object} 配置对象
*/
const getConfig = () => ({
title: 'home',
devEnv: true,
version: '0.0.1'
});
/**
* 获取菜单
* @param undefined
* @return {array} 菜单数组
*/
const getMenuData = () => (
[
{
... ... @@ -51,8 +60,11 @@ const getMenuData = () => (
]
);
/**
* 获取导航
* @param undefined
* @return {array} 导航数组
*/
const getNavBar = (data) => {
let navBars = [];
... ... @@ -69,6 +81,12 @@ const getNavBar = (data) => {
return navBars;
};
/**
* 获取品牌名字
* @param undefined
* @return {array} 品牌数组
*/
const getBrandItems = (data) => {
let brandItems = [];
... ... @@ -86,6 +104,11 @@ const getBrandItems = (data) => {
return brandItems;
};
/**
* 获取三级菜单
* @param undefined
* @return {array} 三级菜单数组
*/
const getThirdNav = (data) => {
let thirdNav = [];
... ... @@ -107,6 +130,11 @@ const getThirdNav = (data) => {
return thirdNav;
};
/**
* 获取子菜单
* @param undefined
* @return {array} 子菜单数组
*/
const getSubNav = (data) => {
let subNav = [];
... ... @@ -125,13 +153,15 @@ const getSubNav = (data) => {
subNav.push(obj);
});
console.log(subNav);
return subNav;
};
/**
* 处理接口返回的数据
* @param {object} 接口返回的对象
* @return {object} 头部数据
*/
exports.getAllHeaderData = function(resData) {
let config = getConfig();
let data = {
... ... @@ -147,6 +177,11 @@ exports.getAllHeaderData = function(resData) {
return _.merge(config, data);
};
/**
* 请求头部数据
* @param undefined
* @return {promise}
*/
exports.getHeaderData = function() {
let data = sign.apiSign({
... ...
... ... @@ -13,10 +13,14 @@ const api = require('../config/common').domains.api;
const Timer = require('./timer');
const ApiUrl = api;
let ApiUrl;
class API {
constructor(url) {
ApiUrl = url || api;
}
/**
* get
* @param url String
... ...
... ... @@ -51,10 +51,12 @@ const makeSign = argument => {
// 生成API签名,调用后端接口的时候有私钥校验
exports.apiSign = (params) => {
var clientType = params.client_type || 'h5';
/* eslint-disable */
var sign = packageSort(Object.assign({
client_type: 'h5',
private_key: privateKey.h5,
client_type: clientType,
private_key: privateKey[clientType],
app_version: '3.8.2',
os_version: 'yohobuy:h5',
screen_size: '720x1280',
... ...