Browse Source

删除重复代码

a1140836302 2 years ago
parent
commit
ba8c63397c
3 changed files with 4 additions and 5 deletions
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 2 3
      src/utils/request.js

+ 1 - 1
.env.development

@@ -2,4 +2,4 @@
 ENV = 'development'
 
 # base api
-ZK_APP_BASE_API = 'http://zk.li-ai.com.cn:8080/api'
+VUE_APP_BASE_API = 'http://zk.li-ai.com.cn:8080/api'

+ 1 - 1
.env.production

@@ -2,4 +2,4 @@
 ENV = 'production'
 
 # base api
-ZK_APP_BASE_API = '/api'
+VUE_APP_BASE_API = '/api'

+ 2 - 3
src/utils/request.js

@@ -2,17 +2,16 @@ import axios from 'axios'
 import { Message } from 'element-ui'
 import store from '@/store'
 import { tansParams } from '@/utils/zk'
-import httpurl from '../../vue.config'
 const service = axios.create({
   // baseURL: httpurl.devServer.proxy['/api'].target+'/api',
-  baseURL:process.env.ZK_APP_BASE_API,
+  baseURL:process.env.VUE_APP_BASE_API,
   timeout: 5000 
 })
-
 // request interceptor
 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 service.interceptors.request.use(
   config => {
+    
     // do something before request is sent
     if (config.method === 'get' && config.params) {
       let url = config.url + '?' + tansParams(config.params)