const base = ({ url, method, data }) => { return new Promise((resolve, reject) => { wx.request({ // url: "http://127.0.0.1:8000" + url, url: "https://www.suzuran.fun" + url, method, data, header: { "content-type": "application/json", // 默认值 }, success(res) { if (res.data.code === 200) { return resolve(res.data.data); } reject(res); }, error(res) { reject(res); }, }); }); }; const get = ({ url, data }) => base({ url, data, method: "GET" }); const post = ({ url, data }) => { console.log(url); return base({ url, data, method: "POST" }); }; module.exports = { post, get, };