提交 8b5b5a78 编写于 作者: yi.li's avatar yi.li

同上

上级 184e71dd
import fetch from '../fetch'; import fetch from '../fetch';
import { getFollowUpApi } from '@/utils/index' import { getFollowUpApi, getBasicDataApi } from '@/utils/index'
import utils from './followupUtils'; import utils from './followupUtils';
...@@ -56,15 +56,38 @@ const reservationManageApi = [ ...@@ -56,15 +56,38 @@ const reservationManageApi = [
] ]
/*常量API*/
const basicDataApi = [
{
url: '/basic-data/constants/',
method: 'get',
params: 'params',
name: 'getBasicData',
description: '获取常量',
},
]
const api = {}; const api = {};
const apis = [...planManageApi, ...reservationManageApi]; const apis = [...planManageApi, ...reservationManageApi, ...basicDataApi];
apis.forEach(item => api[item.name] = (params = {}, extraConfig = {}) => { apis.forEach(item => api[item.name] = (params = {}, extraConfig = {}) => {
const config = { // const config = {
// url: getFollowUpApi(item.url),
// method: item.method,
// };
let config = {};
if(item.name == 'getBasicData'){
config = {
url: getBasicDataApi(item.url),
method: item.method,
};
}else {
config = {
url: getFollowUpApi(item.url), url: getFollowUpApi(item.url),
method: item.method, method: item.method,
}; };
}
if (extraConfig.urlSuffix) { // 需要做URL拼接的情况(比如*.do/2),,,可以根据自己的实际情况进行扩展 if (extraConfig.urlSuffix) { // 需要做URL拼接的情况(比如*.do/2),,,可以根据自己的实际情况进行扩展
config.url = `${config.url}${extraConfig.urlSuffix}`; config.url = `${config.url}${extraConfig.urlSuffix}`;
......
...@@ -171,6 +171,11 @@ export function getFollowUpApi(url) { ...@@ -171,6 +171,11 @@ export function getFollowUpApi(url) {
return getConfigByEnvType('followUpApiSoSoApi') + url //当前使用sosoapi mock数据 return getConfigByEnvType('followUpApiSoSoApi') + url //当前使用sosoapi mock数据
} }
// 获取常量接口域名地址
export function getBasicDataApi(url) {
return getConfigByEnvType('basicDataUrl') + url
}
// 根据不同环境,生成URL // 根据不同环境,生成URL
function getConfigByEnvType(urlType) { function getConfigByEnvType(urlType) {
return envConfig[process.env.BUILD_ENV][urlType] return envConfig[process.env.BUILD_ENV][urlType]
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册