xinelu-applet-ui/api/request.js

31 lines
747 B
JavaScript
Raw Normal View History

2023-09-19 15:16:00 +08:00
import baseurl from './baseurl.js'
2023-10-10 14:43:59 +08:00
// Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
2023-09-19 15:16:00 +08:00
var request = function(config) {
return new Promise((resolve, rejected) => {
2023-10-10 14:43:59 +08:00
if (config.url != '/nurseApplet/chatRecord/updateReadStatus' && config.url !=
2023-11-01 14:30:45 +08:00
"/nurseApplet/chatRecord/sendMessage" && config.url !=
`/applet/sign/apply/checkSignApply/` + uni.getStorageSync('userinfo').cardNo) {
2023-10-10 14:43:59 +08:00
uni.showLoading({
title: ''
});
}
2023-09-19 15:16:00 +08:00
uni.request({
url: baseurl + config.url,
data: config.data,
method: config.method,
2023-10-12 09:47:40 +08:00
timeout: 60000,
2023-10-10 14:43:59 +08:00
header: config.header,
2023-09-19 15:16:00 +08:00
success(res) {
uni.hideLoading();
resolve(res.data)
},
fail(err) {
uni.hideLoading();
rejected(err)
}
})
})
}
2023-11-01 14:30:45 +08:00
export default request