// const BASE_URL = 'https://crmeb-test.shop.lihaink.cn' const BASE_URL = '' const http = (url, method, data, { noAuth = false })=> { return new Promise((reslove, reject) => { uni.request({ url: BASE_URL + '/api' + url, method: method || 'GET', data: method != 'GET' ? data || {} : {}, params: method == 'GET' ? data : {}, success: (res) => { reslove(res.data); }, fail: (message) => { uni.showToast({ title: '网络错误', icon: 'none' }) reject('请求失败'); } }) }); } const request = {}; ['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => { request[method] = (api, data, opt) => http(api, method, data, opt || {}) }); export default request;