aWxRequest.js 1.07 KB
Newer Older
xd's avatar
xd committed
1 2 3 4 5 6 7 8 9 10 11
import axios from 'axios'
import envConfig from '@/config/env-config'
export function wxRequest(inUrl, data = {}, header = {}, method = 'post') {
  // let URL = `http://172.16.0.111:8081${url}`
  // let URL = `http://139.155.48.151:8081${url}`

  // Z-BasicInfo
  let INFO = {
    // corpId: 'wwd1cdbca7b8b2b6c4',
    // agentId: '1000015',
    corpId: 'ww4df265003b43fa0d',
xd's avatar
xd committed
12
    agentId: '1000033',
xd's avatar
xd committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    // url: 'http://139.155.48.151:8085' + inUrl,
    url: envConfig.appBaseUrlA + inUrl,
  }

  if (method == 'post') {
    return new Promise(function (resolve, reject) {
      axios({
        url: INFO.url,
        method: method,
        headers: header,
        data: data
      }).then(res => {
        resolve(res.data)
      }).catch(res => {
        reject(res)
      })
    })
  }

  if (method == 'get') {
    return new Promise(function (resolve, reject) {
      axios({
        url: INFO.url,
        method: method,
        headers: header,
        params: data
      }).then(res => {
        resolve(res.data)
      }).catch(res => {
        reject(res)
      })
    })
  }

}