Commit c682bc98 authored by liuzhaoh's avatar liuzhaoh

设备管理

parent 8fa2603f
...@@ -107,6 +107,11 @@ service.interceptors.response.use( ...@@ -107,6 +107,11 @@ service.interceptors.response.use(
) { ) {
// 数据下沉的状态码不做报错提示 // 数据下沉的状态码不做报错提示
} else { } else {
const whiteList = ['exportDeviceAndSignal']
// 判断是否是下载接口,如果是下载接口,则不进行错误提示
if (isExportUrl(whiteList, response.config.url)) {
return res
}
requestExceptCap(response.config, response.status); requestExceptCap(response.config, response.status);
const msg = res.message || res.msg || "Error"; const msg = res.message || res.msg || "Error";
// msg 是否包含英文字符 // msg 是否包含英文字符
...@@ -196,6 +201,7 @@ service.interceptors.response.use( ...@@ -196,6 +201,7 @@ service.interceptors.response.use(
* @date 2024/3/11 * @date 2024/3/11
*/ */
function requestExceptCap(capData = {}, code = "Network Error") { function requestExceptCap(capData = {}, code = "Network Error") {
return
const date = new Date(); const date = new Date();
const time = format(date); const time = format(date);
const url = ""; const url = "";
...@@ -261,4 +267,15 @@ function format(dataString) { ...@@ -261,4 +267,15 @@ function format(dataString) {
); );
} }
// 判断接口链接是否是导出接口
function isExportUrl (whiteList, targetUrl) {
let result = false;
for(let i = 0; i < whiteList.length; i++) {
if(targetUrl.indexOf(whiteList[i]) > -1) {
result = true;
break;
}
}
return result;
}
export default service; export default service;
...@@ -125,6 +125,18 @@ export function postDataScreen(url, data) { ...@@ -125,6 +125,18 @@ export function postDataScreen(url, data) {
}); });
} }
export function exportFile(method, url, data) {
return request({
url: url,
method,
data,
headers: {
"Content-Type": "multipart/form-data"
},
responseType: 'blob'
});
}
// 百度坐标转高德(传入经度、纬度) // 百度坐标转高德(传入经度、纬度)
export function bd_decrypt(bd_lng, bd_lat) { export function bd_decrypt(bd_lng, bd_lat) {
var X_PI = (Math.PI * 3000.0) / 180.0; var X_PI = (Math.PI * 3000.0) / 180.0;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment