From a312b3380be47450c828aca03697f3d239109191 Mon Sep 17 00:00:00 2001 From: liuqimichale <123456lq> Date: Mon, 7 Jan 2019 16:00:08 +0800 Subject: [PATCH] 公用url --- src/api/httpRequest.js | 15 +++++++++++++-- src/components/memberNum/index.vue | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/api/httpRequest.js b/src/api/httpRequest.js index 3ba026a..3b0c964 100644 --- a/src/api/httpRequest.js +++ b/src/api/httpRequest.js @@ -1,12 +1,23 @@ //引入axios import axios from 'axios' - +import qs from 'qs' let cancel ,promiseArr = {} const CancelToken = axios.CancelToken; //请求拦截器 // 在发送请求之前做些什么 axios.interceptors.request.use(config => { //发起请求时,取消掉当前正在进行的相同请求 config.headers['x-auth-token'] = '5a706458-5a67-4297-a009-30fb82a2fa45' + // if(config.method === 'post') { + // let data = qs.parse(config.data) + // + // config.data = qs.stringify({ + // sysCode: '1001' + // }) + // } else if(config.method === 'get') { + // config.params = { + // sysCode: '1001' + // } + // } return config }, error => { return Promise.reject(error) @@ -68,7 +79,7 @@ axios.interceptors.response.use(response => { }) //基础url前缀 //axios.defaults.baseURL = '/api' -// axios.defaults.baseURL = 'http://10.0.2.31:8096/'; +axios.defaults.baseURL = 'http://39.98.54.240:8093/'; //设置默认请求头 // axios.defaults.withCredentials=true;//让ajax携带cookie diff --git a/src/components/memberNum/index.vue b/src/components/memberNum/index.vue index bed067b..6524ecc 100644 --- a/src/components/memberNum/index.vue +++ b/src/components/memberNum/index.vue @@ -38,7 +38,7 @@ mounted() { //会员总数 this.memberNumTotal=this.formatNumToStr(); - this.axios.post('http://39.98.54.240:8093/urban/intelligence/appuser/queryUserPersonStatistic', { + this.axios.post('urban/intelligence/appuser/queryUserPersonStatistic', { sysCode: '1001' }).then((response)=>{ console.log(response) -- libgit2 0.21.4