zycp-ddxcx/utils/utils.js

26 lines
625 B
JavaScript
Raw Normal View History

2022-03-09 07:06:54 +00:00
import config from '/config/config'
export default {
$http(url, method, data,token) {
return new Promise(function(resolve, reject) {
dd.httpRequest({
url: config.BASE_URL+url,
method: method,
data: data,
headers:{
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Authorization': 'Bearer '+token || ''
},
success: (res) => {
if (res.status == 200) {
resolve(res);
} else {
reject(res);
}
},
fail: () => {
reject();
}
})
})
}
}