打包环境变量配置修改

This commit is contained in:
BianLzhaoMin 2025-02-27 10:56:58 +08:00
parent 2e20db58ce
commit d5f06d3049
7 changed files with 21 additions and 10 deletions

View File

@ -4,6 +4,8 @@ VUE_APP_TITLE = 可视化管控平台
# 开发环境配置
ENV = 'development'
VUE_APP_ENV = 'development'
# 博诺思管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'

View File

@ -4,5 +4,7 @@ VUE_APP_TITLE = 可视化管控平台
# 生产环境配置
ENV = 'production'
VUE_APP_ENV = 'production'
# 博诺思管理系统/生产环境
VUE_APP_BASE_API = '/nxdt-api'

View File

@ -6,5 +6,7 @@ NODE_ENV = production
# 生产环境配置
ENV = 'testing'
VUE_APP_ENV = 'testing'
# 博诺思管理系统/生产环境
VUE_APP_BASE_API = '/nxdt-api'

View File

@ -214,7 +214,7 @@ export default {
})
},
openPage(type) {
if (type === 1) window.open(process.env.ENV === 'testing' ? '/nxdt/screen' : '/screen', '_blank')
if (type === 1) window.open(process.env.VUE_APP_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' })
@ -231,7 +231,7 @@ export default {
.then(() => {
this.$store.dispatch('LogOut').then(() => {
// location.href = '/index'
location.href = process.env.ENV === 'testing' ? '/nxdt/index' : 'index'
location.href = process.env.VUE_APP_ENV === 'testing' ? '/nxdt/index' : 'index'
})
})
.catch(() => {})

View File

@ -787,7 +787,7 @@ const createRouter = () =>
mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes,
base: process.env.ENV === 'testing' ? '/nxdt' : '',
base: process.env.VUE_APP_ENV === 'testing' ? '/nxdt' : '',
})
const router = createRouter()

View File

@ -112,14 +112,19 @@ export default {
trigger: 'blur',
},
],
code: [{ required: true, trigger: "change", message: "请输入验证码" },
{ validator: (rule, value, callback) => {
code: [
{ required: true, trigger: 'change', message: '请输入验证码' },
{
validator: (rule, value, callback) => {
if (/\s/.test(value)) {
callback(new Error("验证码中不允许包含空格"));
callback(new Error('验证码中不允许包含空格'))
} else {
callback();
callback()
}
}, trigger: "blur" }]
},
trigger: 'blur',
},
],
},
loading: false,
//

View File

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