fix: 配置局域网 API 地址用于真机调试
This commit is contained in:
1 parent
60cac4155a
commit
5db15538ad
5 files changed
+5
-5
No files matched your search
@@ -1,2 +1,2 @@
|
||||
const API='http://localhost:3001';
|
||||
const API=getApp().globalData.apiBaseUrl;
|
||||
Page({data:{loading:true,bookings:[]},onLoad(){this.load()},onShow(){this.load()},load(){const token=wx.getStorageSync('customerToken');if(!token){this.setData({loading:false});return}wx.request({url:API+'/customer/bookings',header:{Authorization:'Bearer '+token},success:r=>this.setData({bookings:r.data,loading:false}),fail:()=>this.setData({loading:false})})},cancel(e){const id=e.currentTarget.dataset.id;wx.showModal({title:'取消预约',content:'确定取消这笔预约吗?',success:r=>{if(!r.confirm)return;wx.request({url:API+'/customer/bookings/'+id+'/cancel',method:'POST',header:{Authorization:'Bearer '+wx.getStorageSync('customerToken')},success:()=>this.load()})}})}});
|
||||
Reference in new issue
Block a user