|
@@ -1,49 +1,29 @@
|
|
|
import axios from 'axios'
|
|
|
+import config from './config'
|
|
|
// 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)
|
|
|
-console.log(formData)
|
|
|
-export default({
|
|
|
+console.log(config)
|
|
|
+console.log(config.formData)
|
|
|
+export default ({
|
|
|
// 获取用户信息
|
|
|
getO2oUserInfo: function (cb) {
|
|
|
- axios.post(apiPath + 'o2o/user/info', formData).then(function (res) {
|
|
|
+ console.log(config.userId)
|
|
|
+ axios.post('o2o/user/info', config.formData).then(function (res) {
|
|
|
+ console.log(res.data)
|
|
|
cb(res.data)
|
|
|
})
|
|
|
},
|
|
|
// 获取商品列表
|
|
|
getProductList: function (cb) {
|
|
|
- axios.get(apiPath + 'o2o/product/list').then(function (res) {
|
|
|
+ axios.get('o2o/product/list').then(function (res) {
|
|
|
cb(res.data)
|
|
|
})
|
|
|
},
|
|
|
- // 充值卡支付
|
|
|
- getPayCharge: function (data, cb) {
|
|
|
- axios.get(apiPath + 'o2o/recharge/payRecharge', formData + data).then(function (res) {
|
|
|
+ // 充值卡支付状态获取
|
|
|
+ getPayCharge: function (cb, data) {
|
|
|
+ axios.get('o2o/recharge/payRecharge', config.formData).then(function (res) {
|
|
|
cb(res.data)
|
|
|
+ }).catch(function (error) {
|
|
|
+ console.log(error)
|
|
|
})
|
|
|
}
|
|
|
})
|