diff --git a/app.js b/app.js index 5e8207e..7562555 100644 --- a/app.js +++ b/app.js @@ -30,6 +30,7 @@ App({ globalData:{ userInfo: null, - currentCustomer: null + currentCustomer: null, + API_URL: 'https://rapi-staging.bayekeji.com' } }) diff --git a/utils/address.js b/utils/address.js index b70f762..85accc7 100644 --- a/utils/address.js +++ b/utils/address.js @@ -1,9 +1,9 @@ -const API_URL = 'https://rapi.bayekeji.com' +const app = getApp() function postAddress (data) { wx.request({ method: 'POST', - url: `${API_URL}/addresses/new`, + url: `${app.globalData.API_URL}/addresses/new`, data: Object.assign({}, data), header: { 'Content-Type': 'application/json' }, success (res) { diff --git a/utils/order.js b/utils/order.js index a5b9aee..2f6c902 100644 --- a/utils/order.js +++ b/utils/order.js @@ -1,9 +1,9 @@ -const API_URL = 'https://rapi.bayekeji.com' +const app = getApp() function postBilling (data, resolve) { wx.request({ method: 'POST', - url: `${API_URL}/orders`, + url: `${app.globalData.API_URL}/orders`, data: data, header: { 'Content-Type': 'application/json'}, success: resolve, diff --git a/utils/product.js b/utils/product.js index ae9d494..ef87b41 100644 --- a/utils/product.js +++ b/utils/product.js @@ -1,8 +1,8 @@ -const API_URL = 'https://rapi.bayekeji.com' +const app = getApp() function getProducts (resolve) { wx.request({ - url: `${API_URL}/products`, + url: `${app.globalData.API_URL}/products`, header: { 'Content-Type': 'application/json' }, success: resolve, fail: function(){} @@ -11,7 +11,7 @@ function getProducts (resolve) { function getSlides (resolve) { wx.request({ - url: `${API_URL}/home_slides`, + url: `${app.globalData.API_URL}/home_slides`, header: { 'Content-Type': 'application/json' }, success: resolve, fail: function(){} @@ -20,7 +20,7 @@ function getSlides (resolve) { function getCategories (data, resolve, reject) { wx.request({ - url: `${API_URL}/products?type=${data}`, + url: `${app.globalData.API_URL}/products?type=${data}`, header: { 'Content-Type': 'application/json'}, success: resolve, fail: reject diff --git a/utils/profile.js b/utils/profile.js index 2993d84..1abe833 100644 --- a/utils/profile.js +++ b/utils/profile.js @@ -1,9 +1,8 @@ -const API_URL = 'https://rapi.bayekeji.com' const app = getApp() function getZichanSlides (resolve) { wx.request({ - url: `${API_URL}/profiles/zichan_sildes`, + url: `${app.globalData.API_URL}/profiles/zichan_sildes`, data: {token: app.globalData.token}, header: { 'Content-Type': 'application/json'}, success: resolve, @@ -13,7 +12,7 @@ function getZichanSlides (resolve) { function getCustomerInfo (customerMobile, cb) { wx.request({ - url: `${API_URL}/sessions/new`, + url: `${app.globalData.API_URL}/sessions/new`, header: { 'Content-Type': 'application/json'}, data: { code: app.globalData.code, @@ -32,7 +31,7 @@ function getCustomerInfo (customerMobile, cb) { function getPassCode (mobile) { wx.request({ - url: `${API_URL}/profile/send_pass_code`, + url: `${app.globalData.API_URL}/profile/send_pass_code`, header: { 'Content-Type': 'application/json'}, data: { mobile: mobile