import axios from 'axios' // let apiPath = 'http://commontest.yiguanjia.me/index.php?r=' let apiPath = '' let uri = location.href let test = true var userId = '' var formData = new FormData() if (uri.indexOf('common.yiguanjia.me') > -1) { test = false } // 正式开发判断test还是pro if (test) { apiPath = 'http://commontest.yiguanjia.me/index.php?r=' userId = localStorage.getItem('wxUserID') } else { apiPath = 'http://common.yiguanjia.me/index.php?r=' userId = localStorage.getItem('wxUserID') } // 判断是否为dev开发 if (uri.indexOf('http://localhost:8080/') > -1) { apiPath = '' userId = '57e238929f5160d6048b456d' } else if (uri.indexOf('common.yiguanjiadev.me') > -1) { apiPath = 'http://common.yiguanjiadev.me/index.php?r=' userId = '57e238929f5160d6048b456d' } formData.append('user_id', userId) // 获取 export default({ // 获取用户信息 getO2oUserInfo: function (cb) { axios.post(apiPath + 'o2o/user/info', formData).then(function (res) { cb(res.data) }) }, getProductList: function (cb) { axios.get(apiPath + 'o2o/product/list').then(function (res) { cb(res.data) }) } })