From ee6e220b012d6949d77e88ffdd259e01f1f96c8d Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 26 Feb 2021 15:37:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=89=8D=E7=AB=AF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/.env.development | 8 ++++++ frontend/.env.production | 7 ++++++ frontend/src/settings.js | 53 +++++++++++++++++++++++++++++++++++++++ frontend/vue.config.js | 8 +++--- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 frontend/.env.development create mode 100644 frontend/.env.production create mode 100644 frontend/src/settings.js diff --git a/frontend/.env.development b/frontend/.env.development new file mode 100644 index 0000000000..8ca882927f --- /dev/null +++ b/frontend/.env.development @@ -0,0 +1,8 @@ +ENV = 'development' + +# 接口地址 +VUE_APP_BASE_API = 'http://localhost:8081' +VUE_APP_WS_API = 'ws://localhost:8000' + +# 是否启用 babel-plugin-dynamic-import-node插件 +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 0000000000..9d1377cb36 --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1,7 @@ +ENV = 'production' + +# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 +# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http +VUE_APP_BASE_API = 'https://el-admin.xin' +# 如果接口是 http 形式, wss 需要改为 ws +VUE_APP_WS_API = 'wss://el-admin.xin' diff --git a/frontend/src/settings.js b/frontend/src/settings.js new file mode 100644 index 0000000000..49a021ca85 --- /dev/null +++ b/frontend/src/settings.js @@ -0,0 +1,53 @@ +module.exports = { + /** + * @description 网站标题 + */ + title: 'DATA-EASE', + /** + * @description 是否显示 tagsView + */ + tagsView: false, + + showSettings: true, + /** + * @description 固定头部 + */ + fixedHeader: true, + /** + * @description 记住密码状态下的token在Cookie中存储的天数,默认1天 + */ + tokenCookieExpires: 1, + /** + * @description 记住密码状态下的密码在Cookie中存储的天数,默认1天s + */ + passCookieExpires: 1, + /** + * @description 是否只保持一个子菜单的展开 + */ + uniqueOpened: true, + /** + * @description token key + */ + TokenKey: 'EL-ADMIN-TOEKN', + /** + * @description 请求超时时间,毫秒(默认2分钟) + */ + timeout: 1200000, + /** + * @description 是否显示logo + */ + sidebarLogo: false, + /** + * 是否显示设置的底部信息 + */ + showFooter: true, + /** + * 底部文字,支持html语法 + */ + footerTxt: '© 2019 Zheng Jie Apache License 2.0', + /** + * 备案号 + */ + caseNumber: '浙ICP备18005431号' + } + \ No newline at end of file diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 71d623e8f6..1c3e1e4e1a 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,16 +1,18 @@ const path = require('path') +const defaultSettings = require('./src/settings.js') function resolve(dir) { return path.join(__dirname, dir) } - +const name = defaultSettings.title // 网址标题 +const port = 8080 module.exports = { productionSourceMap: true, devServer: { - port: 8080, + port: port, proxy: { ['^(?!/login)']: { - target: 'http://localhost:8081', + target: process.env.VUE_APP_BASE_API, ws: true, } }