// const BASE_URL = 'https://chtech.ncjti.edu.cn/carstop/carBuy' const BASE_URL = 'https://car.meiyishuoo.com/ride-sharing/carBuy' export function myRequest(options : any) { uni.showLoading({ title: '加载中', mask: true, }) // 当前时间 const timestamp = new Date().getTime() // 将时间戳添加到URL中 options.url += `${options.url.includes('?') ? '&' : '?'}timestamp=${timestamp}` return new Promise((resolve, reject) => { uni.request({ url: BASE_URL + options.url, method: options.method || 'GET', data: options.data || {}, header: options.header || { // token: uni.getStorageSync('auth').token || '', }, success: (res : any) => { // console.log(res); uni.hideLoading() if (res.data.code === 200) { resolve(res.data) } else { uni.showToast({ title: res.data.message || "接口报错", icon: 'none', }) } }, fail: (err) => { uni.hideLoading() uni.showToast({ title: '请求数据失败', icon: 'none', }) reject(err) }, }) }) }