2022-08-06 00:57:46 +08:00
|
|
|
import config from '@/config'
|
|
|
|
const baseUrl = config.baseUrl
|
2022-08-06 00:59:24 +08:00
|
|
|
export const myRequest = (option = {}) => {
|
|
|
|
return new Promise((reslove, reject) => {
|
2022-08-06 00:57:46 +08:00
|
|
|
uni.request({
|
2022-08-06 00:59:24 +08:00
|
|
|
url: baseUrl + option.url,
|
|
|
|
data: option.data,
|
|
|
|
method: option.method || "GET",
|
2022-08-06 00:57:46 +08:00
|
|
|
success: (result) => {
|
|
|
|
reslove(result)
|
|
|
|
},
|
2022-08-06 00:59:24 +08:00
|
|
|
fail: (error) => {
|
2022-08-06 00:57:46 +08:00
|
|
|
reject(error)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|