This commit is contained in:
shijing 2023-03-30 09:04:18 +08:00
parent 894e096c3a
commit 58e8529b59
7 changed files with 17099 additions and 11862 deletions

View File

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

View File

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

View File

@ -5,8 +5,8 @@
"author": "Pan <panfree23@gmail.com>",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
@ -49,9 +49,9 @@
"eslint-plugin-vue": "5.2.2",
"html-webpack-plugin": "3.2.0",
"mockjs": "1.0.1-beta3",
"node-sass": "^4.14.1",
"sass": "^1.26.5",
"runjs": "^4.3.2",
"sass-loader": "^7.1.0",
"sass-loader": "^8.0",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "^1.13.2",

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 { 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
})

View File

@ -32,11 +32,17 @@ module.exports = {
devServer: {
port: port,
open: true,
overlay: {
warnings: false,
errors: true
},
before: require('./mock/mock-server.js')
proxy: {
'/api': {
target: process.env.VUE_APP_BASE_API,
ws: true,
changeOrigin:true,
pathRewrite: {
'^/api': '/'
}
}
},
// before: require('./mock/mock-server.js')
},
configureWebpack: {
// provide the app's title in webpack's name field, so that