ADD .env.development .env.production 调整本地环境和生产环境模式
This commit is contained in:
parent
b31ae9d8ea
commit
8b805eb6cc
|
@ -0,0 +1,14 @@
|
||||||
|
# 本地环境
|
||||||
|
NODE_ENV = development
|
||||||
|
|
||||||
|
# 标题
|
||||||
|
VUE_APP_TITLE = SCUI(DEV)
|
||||||
|
|
||||||
|
# 接口地址
|
||||||
|
VUE_APP_API_BASEURL = https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api
|
||||||
|
|
||||||
|
# 本地端口
|
||||||
|
VUE_APP_PORT = 2800
|
||||||
|
|
||||||
|
# 是否开启代理
|
||||||
|
VUE_APP_PROXY = true
|
|
@ -0,0 +1,8 @@
|
||||||
|
# 生产环境
|
||||||
|
NODE_ENV = production
|
||||||
|
|
||||||
|
# 标题
|
||||||
|
VUE_APP_TITLE = SCUI
|
||||||
|
|
||||||
|
# 接口地址
|
||||||
|
VUE_APP_API_BASEURL = https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
const APP_CONFIG = {
|
const APP_CONFIG = {
|
||||||
//标题
|
//标题
|
||||||
APP_NAME: "SCUI",
|
//APP_NAME: "SCUI",
|
||||||
|
|
||||||
//接口地址,如遇跨域需使用nginx代理
|
//接口地址,如遇跨域需使用nginx代理
|
||||||
API_URL: "https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api"
|
//API_URL: "https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title><%= VUE_APP_TITLE %></title>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.write("<script src='config.js?"+new Date().getTime()+"'><\/script>");
|
document.write("<script src='config.js?"+new Date().getTime()+"'><\/script>");
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript
|
<strong>We're sorry but <%= VUE_APP_TITLE %> doesn't work properly without JavaScript
|
||||||
enabled. Please enable it to continue.</strong>
|
enabled. Please enable it to continue.</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<img src="img/logo.png"/>
|
<img src="img/logo.png"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="app-loading__loader"></div>
|
<div class="app-loading__loader"></div>
|
||||||
<div class="app-loading__title"><%= htmlWebpackPlugin.options.title %></div>
|
<div class="app-loading__title"><%= VUE_APP_TITLE %></div>
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
.app-loading {position: absolute;top:0px;left:0px;right:0px;bottom:0px;display: flex;justify-content: center;align-items: center;flex-direction: column;background: #fff;}
|
.app-loading {position: absolute;top:0px;left:0px;right:0px;bottom:0px;display: flex;justify-content: center;align-items: center;flex-direction: column;background: #fff;}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const DEFAULT_CONFIG = {
|
const DEFAULT_CONFIG = {
|
||||||
//标题
|
//标题
|
||||||
APP_NAME: "SCUI",
|
APP_NAME: process.env.VUE_APP_TITLE,
|
||||||
|
|
||||||
//首页地址
|
//首页地址
|
||||||
DASHBOARD_URL: "/dashboard",
|
DASHBOARD_URL: "/dashboard",
|
||||||
|
@ -12,7 +12,7 @@ const DEFAULT_CONFIG = {
|
||||||
CORE_VER: "1.6.0",
|
CORE_VER: "1.6.0",
|
||||||
|
|
||||||
//接口地址
|
//接口地址
|
||||||
API_URL: "/api",
|
API_URL: process.env.NODE_ENV === 'development' && process.env.VUE_APP_PROXY === 'true' ? "/api" : process.env.VUE_APP_API_BASEURL,
|
||||||
|
|
||||||
//请求超时
|
//请求超时
|
||||||
TIMEOUT: 10000,
|
TIMEOUT: 10000,
|
||||||
|
|
|
@ -10,10 +10,10 @@ module.exports = {
|
||||||
//开发服务,build后的生产模式还需nginx代理
|
//开发服务,build后的生产模式还需nginx代理
|
||||||
devServer: {
|
devServer: {
|
||||||
open: false, //运行后自动打开浏览器
|
open: false, //运行后自动打开浏览器
|
||||||
port: 2800, //挂载端口
|
port: process.env.VUE_APP_PORT, //挂载端口
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api',
|
target: process.env.VUE_APP_API_BASEURL,
|
||||||
ws: true,
|
ws: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/api': '/'
|
'^/api': '/'
|
||||||
|
|
Loading…
Reference in New Issue