增加设备保养
This commit is contained in:
39
utils/api.js
39
utils/api.js
@@ -1,5 +1,5 @@
|
||||
import config from './envConfig.js';
|
||||
import wf from './public.js'
|
||||
import wf from './public.js';
|
||||
|
||||
const request = (url = '', data = {}, header = {
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('mes_token') ? 'Bearer '+uni.getStorageSync('mes_token') : '',
|
||||
@@ -61,13 +61,13 @@ const request = (url = '', data = {}, header = {
|
||||
})
|
||||
})
|
||||
}
|
||||
const postFuncLoading = (url = '', data = {}, header = {
|
||||
const postFuncLoading = (url = '', data = {}, header = {
|
||||
'Authorization': 'Bearer '+uni.getStorageSync('mes_token') ? 'Bearer '+uni.getStorageSync('mes_token') : '',
|
||||
}) => {
|
||||
uni.showLoading({
|
||||
}) => {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
})
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: config.dev.VITE_BASE_API + url, //接口地址:前缀+方法中传入的地址
|
||||
@@ -123,9 +123,34 @@ const request = (url = '', data = {}, header = {
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getOss = (url = '', data = {}, header = {
|
||||
'content-type':'application/json; charset=UTF-8',
|
||||
'Authorization':''
|
||||
})=>{
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: config.dev.VITE_OSS_URL + url, //接口地址:前缀+方法中传入的地址
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
data: data,
|
||||
header: header,
|
||||
success:(res)=>{
|
||||
if(res.data.code == 200){
|
||||
resolve(res.data);
|
||||
}
|
||||
},
|
||||
fail:(err)=>{
|
||||
reject(err);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
request,
|
||||
postFuncLoading
|
||||
postFuncLoading,
|
||||
getOss
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user