@ -1,4 +1,5 @@ |
|||||
NODE_ENV=production |
NODE_ENV=production |
||||
VUE_APP_API_SERVER = https://epmet-cloud.elinkservice.cn/api |
VUE_APP_API_SERVER = https://epmet-cloud.elinkservice.cn/api |
||||
|
VUE_APP_BIPASS_API_SERVER = http://bipaas.elinkservice.cn/linkdata/linkdata-gateway/route |
||||
VUE_APP_NODE_ENV=prod |
VUE_APP_NODE_ENV=prod |
||||
VUE_APP_PUBLIC_PATH=epmet-oper |
VUE_APP_PUBLIC_PATH=epmet-oper |
||||
|
@ -1,4 +1,5 @@ |
|||||
NODE_ENV=production |
NODE_ENV=production |
||||
VUE_APP_API_SERVER = https://epdc-shibei.elinkservice.cn/api |
VUE_APP_API_SERVER = https://epdc-shibei.elinkservice.cn/api |
||||
|
# VUE_APP_BIPASS_API_SERVER = http://bipaas.elinkservice.cn/linkdata/linkdata-gateway/route |
||||
VUE_APP_NODE_ENV=shibei_prod |
VUE_APP_NODE_ENV=shibei_prod |
||||
VUE_APP_PUBLIC_PATH=epmet-oper |
VUE_APP_PUBLIC_PATH=epmet-oper |
After Width: | Height: | Size: 689 B |
After Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,114 @@ |
|||||
|
/*--------------------------------------------------------------- |
||||
|
| 【数据中台专用】请求接口封装 | |
||||
|
---------------------------------------------------------------*/ |
||||
|
import axios from "axios"; |
||||
|
import curry from "dai-js/tools/curry"; |
||||
|
import { Message } from "element-ui"; |
||||
|
import { clearLoginInfo } from "@/utils"; |
||||
|
|
||||
|
axios.defaults.withCredentials = true; |
||||
|
axios.defaults.crossDomain = true; |
||||
|
|
||||
|
const request = curry((method, uri, data = {}, params = {}) => { |
||||
|
return new Promise((reslove) => { |
||||
|
let returnIniData = { |
||||
|
httpCode: "", |
||||
|
data: {}, |
||||
|
msg: "", |
||||
|
code: "", |
||||
|
}; |
||||
|
|
||||
|
const { headers, mockId } = params; |
||||
|
|
||||
|
// env文件配置接口
|
||||
|
let url = process.env.VUE_APP_BIPASS_API_SERVER; |
||||
|
|
||||
|
// mock 开发临时用接口
|
||||
|
if (mockId) { |
||||
|
url = "https://mock.apifox.cn/m2/2242395-0-default/" + mockId; |
||||
|
} |
||||
|
|
||||
|
const succFn = (res) => { |
||||
|
// log(`[request成功] ${url}`, data, res);
|
||||
|
let retData = { |
||||
|
...returnIniData, |
||||
|
...res.data, |
||||
|
httpCode: res.statusCode, |
||||
|
}; |
||||
|
// if(typeof Vue.$afterRequestHook == 'function'){
|
||||
|
// retData = Vue.$afterRequestHook(retData);
|
||||
|
// }
|
||||
|
if (res.data.code > 8000 && res.data.code < 10000) { |
||||
|
// Message.error(res.data.msg);
|
||||
|
} |
||||
|
if (res.code == 1007 || res.code == 1024 || res.code == 2003) { |
||||
|
// 10005 token为空 10006登陆超时 10007别处登录
|
||||
|
console.log("登录失效"); |
||||
|
Message.error(res.data.msg); |
||||
|
clearLoginInfo(); |
||||
|
return next({ |
||||
|
name: "login", |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
reslove(retData); |
||||
|
}; |
||||
|
|
||||
|
const failFn = (err) => { |
||||
|
// log(`[request失败] ${url}`, data, err);
|
||||
|
|
||||
|
reslove( |
||||
|
Object.assign({}, returnIniData, { |
||||
|
httpCode: "9999", //访问出现意外
|
||||
|
msg: "网络错误", |
||||
|
}) |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
if (method.toUpperCase() == "POST") { |
||||
|
axios |
||||
|
.post( |
||||
|
url, |
||||
|
{ |
||||
|
apiCode: "/api/post", |
||||
|
dispatcherSystem: "dataservice", |
||||
|
param: { |
||||
|
ds_code: uri, |
||||
|
app_code: "empet", |
||||
|
orderby: "[]", |
||||
|
...data, |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
headers, |
||||
|
responseType: "json", |
||||
|
} |
||||
|
) |
||||
|
.then(succFn) |
||||
|
.catch(failFn); |
||||
|
} else { |
||||
|
axios |
||||
|
.post( |
||||
|
url, |
||||
|
{ |
||||
|
apiCode: "/api/get", |
||||
|
dispatcherSystem: "dataservice", |
||||
|
param: { |
||||
|
ds_code: uri, |
||||
|
app_code: "empet", |
||||
|
orderby: "[]", |
||||
|
...data, |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
headers, |
||||
|
responseType: "json", |
||||
|
} |
||||
|
) |
||||
|
.then(succFn) |
||||
|
.catch(failFn); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
export const requestPostBi = request("post"); |