let baseUrl = "http://test.cloud.boyuantech.net:9001" function request(url, method, data) { uni.showLoading({ title: '加载中' }) let header = { Token: uni.getStorageSync('Token') } return new Promise( (resolve, reject) => { uni.request({ url: baseUrl + url, method: method || 'get', data: data || {}, header, success: (result) => { uni.hideLoading() resolve(result.data) }, fail: (err) => { reject(err) console.log(err, 'err'); } }) } ) } export default request