diff --git a/.env.testing b/.env.testing new file mode 100644 index 0000000..52745d8 --- /dev/null +++ b/.env.testing @@ -0,0 +1,10 @@ +# 页面标题 +VUE_APP_TITLE = 可视化管控平台 + +NODE_ENV = production + +# 生产环境配置 +ENV = 'testing' + +# 博诺思管理系统/生产环境 +VUE_APP_BASE_API = '/nxdt-api' diff --git a/bin/build.bat b/bin/build-prod.bat similarity index 100% rename from bin/build.bat rename to bin/build-prod.bat diff --git a/bin/build-test.bat b/bin/build-test.bat new file mode 100644 index 0000000..db46eaf --- /dev/null +++ b/bin/build-test.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [��Ϣ] ���Web���̣�����dist�ļ��� +echo. + +%~d0 +cd %~dp0 + +cd .. +npm run build:test + +pause \ No newline at end of file diff --git a/package.json b/package.json index 5e25681..47de57a 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", + "build:test": "vue-cli-service build --mode testing", "preview": "node build/index.js --preview", "lint": "eslint --ext .js,.vue src" }, diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index fa0e623..570ec9a 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -214,7 +214,7 @@ export default { }) }, openPage(type) { - if (type === 1) window.open('/screen', '_blank') + if (type === 1) window.open(process.env.ENV === 'testing' ? '/nxdt/screen' : '/screen', '_blank') if (type === 2) this.$router.push({ path: '/notice/noticeAnnouncement' }) if (type === 3) this.$router.push({ path: '/myToDoList/myToDoList' }) if (type === 4) this.$router.push({ path: '/takePhoto/takePhoto' }) @@ -230,7 +230,8 @@ export default { }) .then(() => { this.$store.dispatch('LogOut').then(() => { - location.href = '/index' + // location.href = '/index' + location.href = process.env.ENV === 'testing' ? '/nxdt/index' : 'index' }) }) .catch(() => {}) diff --git a/src/router/index.js b/src/router/index.js index 1106191..bfbdf19 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -787,7 +787,7 @@ const createRouter = () => mode: 'history', // 去掉url中的# scrollBehavior: () => ({ y: 0 }), routes: constantRoutes, - // base: '/nxdt', + base: process.env.ENV === 'testing' ? '/nxdt' : '', }) const router = createRouter() diff --git a/vue.config.js b/vue.config.js index c9756fa..81bc674 100644 --- a/vue.config.js +++ b/vue.config.js @@ -18,7 +18,7 @@ module.exports = { // 部署生产环境和开发环境下的URL。 // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 例如 https://www.bonus.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用npm被部署在 https://www.bonus.vip/admin/,则设置 baseUrl 为 /admin/。 - publicPath: process.env.NODE_ENV === 'production' ? '/' : '/', + publicPath: process.env.ENV === 'testing' ? '/nxdt' : '/', // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) outputDir: 'dist', // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) @@ -38,9 +38,9 @@ module.exports = { // target: `http://localhost:18080`, // target: 'http://192.168.0.176:18080', // target: 'http://192.168.0.58:19090', // 杰 - //target: 'http://192.168.0.38:18080', // 测试环境 + //target: 'http://192.168.0.38:18080', // 测试环境 // target: 'http://218.21.27.6:1999/prod-api', // 生产环境 - target: 'http://192.168.0.14:38080', // 郝志权 + target: 'http://192.168.0.14:38080', // 郝志权 // target: 'http://192.168.2.122:18080', // 梁超 changeOrigin: true, pathRewrite: {