引言:只是测试代码 一:引用js文件 二:调用里面的request方法 http.request('/getOrderId',{'status':status}).then(function(res){ console.log(res.data) that.setData({ dropshipping:res.data }) }) 三:http.js文件里有自带的wx.login封装的方法可以直接调用 wxlogin() { let that = this; return new Promise(function(resolve,reject){ //登录 wx.login({ success:res=>{ let url = `/getOpenid`; let data = {'code':res.code}; that.request(url,data).then(function(res){ resolve(res) }); } }) }) } <button open-type="contact" bindcontact="handleContact">客服聊天</button>