Merge branch 'master' of https://e.coding.net/ctcdevteam/examtest
This commit is contained in:
commit
c2dafb7714
|
|
@ -2,13 +2,7 @@
|
|||
ENV = 'development'
|
||||
|
||||
# base api
|
||||
VUE_APP_BASE_API = 'http://localhost:8000'
|
||||
|
||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
||||
# It only does one thing by converting all import() to require().
|
||||
# This configuration can significantly increase the speed of hot updates,
|
||||
# when you have a large number of pages.
|
||||
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
|
||||
#VUE_APP_BASE_API = 'http://localhost:8000'
|
||||
VUE_APP_BASE_API = 'https://qw.ctc-zc.com/api'
|
||||
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ ENV = 'production'
|
|||
|
||||
# base api
|
||||
# VUE_APP_BASE_API = '/prod-api'
|
||||
VUE_APP_BASE_API = 'https://apitest.ahctc.cn'
|
||||
VUE_APP_BASE_API = 'https://qw.ctc-zc.com/api'
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,21 @@
|
|||
const DEFAULT_CONFIG = {
|
||||
//接口地址
|
||||
API_URL: get_api_url(),
|
||||
//name
|
||||
APP_TUTLE:'气味分析',
|
||||
//请求超时
|
||||
TIMEOUT: 30000,
|
||||
}
|
||||
function get_api_url(){
|
||||
if(process.env.ENV === 'development' || (process.env.ENV === 'production' && window.location.host.indexOf('localhost') > -1)){
|
||||
return process.env.VUE_APP_BASE_API
|
||||
}
|
||||
return 'http://' + window.location.host + '/api'
|
||||
}
|
||||
// // 如果生产模式,就合并动态的APP_CONFIG
|
||||
// // public/config.js
|
||||
// if (process.env.NODE_ENV === 'production') {
|
||||
// Object.assign(DEFAULT_CONFIG, APP_CONFIG)
|
||||
// }
|
||||
|
||||
module.exports = DEFAULT_CONFIG
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
import axios from 'axios'
|
||||
import { MessageBox, Message } from 'element-ui'
|
||||
import store from '@/store'
|
||||
import sysConfig from "@/config";
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
// create an axios instance
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
baseURL: sysConfig.API_URL, // url = base url + request url
|
||||
// withCredentials: true, // send cookies when cross-domain requests
|
||||
timeout: 30000, // request timeout
|
||||
})
|
||||
|
|
|
|||
|
|
@ -32,11 +32,17 @@ module.exports = {
|
|||
devServer: {
|
||||
port: port,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: process.env.VUE_APP_BASE_API,
|
||||
ws: true,
|
||||
changeOrigin:true,
|
||||
pathRewrite: {
|
||||
'^/api': '/'
|
||||
}
|
||||
}
|
||||
},
|
||||
before: require('./mock/mock-server.js')
|
||||
// before: require('./mock/mock-server.js')
|
||||
},
|
||||
configureWebpack: {
|
||||
// provide the app's title in webpack's name field, so that
|
||||
|
|
|
|||
Loading…
Reference in New Issue