ypzycp/utils/utils.js

26 lines
625 B
JavaScript
Raw Normal View History

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