This commit is contained in:
caoqianming 2023-03-31 17:22:24 +08:00
commit c2dafb7714
6 changed files with 17095 additions and 11858 deletions

View File

@ -2,13 +2,7 @@
ENV = 'development' ENV = 'development'
# base api # base api
VUE_APP_BASE_API = 'http://localhost:8000' #VUE_APP_BASE_API = 'http://localhost:8000'
VUE_APP_BASE_API = 'https://qw.ctc-zc.com/api'
# 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_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -3,4 +3,4 @@ ENV = 'production'
# base api # base api
# VUE_APP_BASE_API = '/prod-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

View File

@ -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

View File

@ -1,11 +1,12 @@
import axios from 'axios' import axios from 'axios'
import { MessageBox, Message } from 'element-ui' import { MessageBox, Message } from 'element-ui'
import store from '@/store' import store from '@/store'
import sysConfig from "@/config";
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
// create an axios instance // create an axios instance
const service = axios.create({ 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 // withCredentials: true, // send cookies when cross-domain requests
timeout: 30000, // request timeout timeout: 30000, // request timeout
}) })

View File

@ -32,11 +32,17 @@ module.exports = {
devServer: { devServer: {
port: port, port: port,
open: true, open: true,
overlay: { proxy: {
warnings: false, '/api': {
errors: true 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: { configureWebpack: {
// provide the app's title in webpack's name field, so that // provide the app's title in webpack's name field, so that