Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
23c56631
Commit
23c56631
authored
Apr 26, 2022
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持多环境打包配置
parent
b87383a2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
4 deletions
+108
-4
front/.env.prod
front/.env.prod
+4
-0
front/package.json
front/package.json
+7
-2
front/src/config/index.js
front/src/config/index.js
+37
-0
front/src/libs/axios.js
front/src/libs/axios.js
+6
-0
front/src/styles/tree-common.less
front/src/styles/tree-common.less
+2
-1
front/vue.config.js
front/vue.config.js
+52
-1
No files found.
front/.env.prod
0 → 100644
View file @
23c56631
NODE_ENV = 'production'
VUE_APP_ENV = 'prod'
VUE_APP_MOCK = false
BASE_URL= '/adminapi'
front/package.json
View file @
23c56631
...
...
@@ -5,8 +5,13 @@
"author"
:
"Exrick <1012139570@qq.com>"
,
"private"
:
true
,
"scripts"
:
{
"dev"
:
"vue-cli-service serve"
,
"build"
:
"vue-cli-service build"
"build"
:
"vue-cli-service build"
,
"dev"
:
"vue-cli-service serve --open --mode dev"
,
"build:test"
:
"vue-cli-service build --mode beta"
,
"build:prod"
:
"vue-cli-service build --mode prod"
,
"lint"
:
"vue-cli-service lint"
,
"test:unit"
:
"vue-cli-service test:unit"
,
"test:e2e"
:
"vue-cli-service test:e2e"
},
"dependencies"
:
{
"@mapbox/mapbox-gl-geocoder"
:
"^4.7.1"
,
...
...
front/src/config/index.js
0 → 100644
View file @
23c56631
export
default
{
/**
* @description 配置显示在浏览器标签的title
*/
title
:
'
管理后台
'
,
/**
* @description token在Cookie中存储的天数,默认1天
*/
cookieExpires
:
1
,
/**
* @description 是否使用国际化,默认为false
* 如果不使用,则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'}
* 用来在菜单中显示文字
*/
useI18n
:
true
,
/**
* @description api请求基础路径
*/
baseUrl
:
{
dev
:
''
,
pro
:
'
http://localhost:8211/
'
},
/**
* @description 默认打开的首页的路由name值,默认为home
*/
homeName
:
'
home
'
,
/**
* @description 需要加载的插件
*/
plugin
:
{
'
error-store
'
:
{
showInHeader
:
true
,
// 设为false后不会在顶部显示错误日志徽标
developmentOff
:
true
// 设为true后在开发环境不会收集错误信息,方便开发中排查错误
}
}
}
\ No newline at end of file
front/src/libs/axios.js
View file @
23c56631
...
...
@@ -3,12 +3,18 @@ import { getStore, setStore } from './storage';
import
{
router
}
from
'
../router/index
'
;
import
{
Message
}
from
'
view-design
'
;
import
Cookies
from
'
js-cookie
'
;
import
config
from
'
@/config
'
const
{
dev
,
pro
}
=
config
.
baseUrl
;
// 统一请求路径前缀
let
base
=
'
/adminapi
'
;
// 超时设定
axios
.
defaults
.
timeout
=
15000
;
axios
.
interceptors
.
request
.
use
(
config
=>
{
config
.
baseURL
=
process
.
env
.
NODE_ENV
===
"
development
"
?
dev
:
pro
;
return
config
;
},
err
=>
{
Message
.
error
(
'
请求超时
'
);
...
...
front/src/styles/tree-common.less
View file @
23c56631
...
...
@@ -2,11 +2,12 @@
.operation {
margin-bottom: 2vh;
overflow-y: auto;
height:100%
}
.content {
margin-bottom: 2vh;
height:
56vh
;
height:
100%
;
width: 50vw;
}
...
...
front/vue.config.js
View file @
23c56631
const
CompressionPlugin
=
require
(
'
compression-webpack-plugin
'
);
const
path
=
require
(
"
path
"
);
const
resolve
=
dir
=>
{
return
path
.
join
(
__dirname
,
dir
);
};
// 项目部署基础
// 默认情况下,我们假设你的应用将被部署在域的根目录下,
// 例如:https://www.my-app.com/
// 默认:'/'
// 如果您的应用程序部署在子路径中,则需要在这指定子路径
// 例如:https://www.foobar.com/my-app/
// 需要将它改为'/my-app/'
// iview-admin线上演示打包路径: https://file.iviewui.com/admin-dist/
const
BASE_URL
=
process
.
env
.
NODE_ENV
===
"
production
"
?
"
http://localhost:8399/
"
:
"
/
"
;
module
.
exports
=
{
devServer
:
{
host
:
'
127.0.0.1
'
,
port
:
9999
,
proxy
:
{
'
/adminapi
'
:
{
target
:
'
http://127.0.0.1:8211
'
,
// 请求本地 需要xboot后端项目
target
:
'
http://127.0.0.1:8211
'
,
ws
:
true
},
}
},
publicPath
:
BASE_URL
,
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// 如果你不需要使用eslint,把lintOnSave设为false即可
lintOnSave
:
true
,
//兼容低版本浏览器不能解析es6语法,先安装需要的包
// npm install -D babel-loader@7 babel-core babel-preset-env webpack
// 打包时不生成.map文件 避免看到源码
productionSourceMap
:
false
,
// 部署优化
...
...
@@ -35,6 +64,28 @@ module.exports = {
// vuedraggable: 'vuedraggable',
// viewerjs: 'Viewer'
// },
module
:
{
rules
:
[
{
test
:
/
\.
m
?
js$/
,
//exclude用下面配置的话,默认是过滤不编译node_modules 路径下的文件
//exclude: /(node_modules|bower_components)/,
//include 指定需要编译的文件路径
include
:
[
resolve
(
"
src
"
),
resolve
(
"
node_modules/tree-table-vue/lib
"
),
resolve
(
"
node_modules/v-org-tree/dist
"
),
resolve
(
"
node_modules/view-design/src/locale
"
)
// 我的是把iview 升级为4的版本,所以是view-design包,之前是iview 包
],
use
:
{
loader
:
"
babel-loader
"
,
options
:
{
presets
:
[
"
@babel/preset-env
"
]
}
}
}
]
},
// GZIP压缩
plugins
:
[
new
CompressionPlugin
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment