fix 修复 ruoyi 关于 配置应用前缀路径的bug 改为配置文件统一配置
This commit is contained in:
parent
57df7f8dfe
commit
4d5048435c
@ -7,6 +7,9 @@ ENV = 'development'
|
|||||||
# 若依管理系统/开发环境
|
# 若依管理系统/开发环境
|
||||||
VUE_APP_BASE_API = '/dev-api'
|
VUE_APP_BASE_API = '/dev-api'
|
||||||
|
|
||||||
|
# 应用访问路径 例如使用前缀 /admin/index
|
||||||
|
VUE_APP_CONTEXT_PATH = '/index'
|
||||||
|
|
||||||
# 监控地址
|
# 监控地址
|
||||||
VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/login'
|
VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/login'
|
||||||
|
|
||||||
|
@ -4,6 +4,9 @@ VUE_APP_TITLE = RuoYi-Vue-Plus后台管理系统
|
|||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
|
# 应用访问路径 例如使用前缀 /admin/index
|
||||||
|
VUE_APP_CONTEXT_PATH = '/index'
|
||||||
|
|
||||||
# 监控地址
|
# 监控地址
|
||||||
VUE_APP_MONITRO_ADMIN = '/admin/login'
|
VUE_APP_MONITRO_ADMIN = '/admin/login'
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ NODE_ENV = production
|
|||||||
# 测试环境配置
|
# 测试环境配置
|
||||||
ENV = 'staging'
|
ENV = 'staging'
|
||||||
|
|
||||||
|
# 应用访问路径 例如使用前缀 /admin/index
|
||||||
|
VUE_APP_CONTEXT_PATH = '/index'
|
||||||
|
|
||||||
# 监控地址
|
# 监控地址
|
||||||
VUE_APP_MONITRO_ADMIN = '/admin/login'
|
VUE_APP_MONITRO_ADMIN = '/admin/login'
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$store.dispatch('LogOut').then(() => {
|
this.$store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.$router.options.base + '/index';
|
location.href = process.env.VUE_APP_CONTEXT_PATH;
|
||||||
})
|
})
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,6 @@ export const constantRoutes = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
base: "", // 项目前缀 与 publicPath 同步 例如 /api
|
|
||||||
mode: 'history', // 去掉url中的#
|
mode: 'history', // 去掉url中的#
|
||||||
scrollBehavior: () => ({ y: 0 }),
|
scrollBehavior: () => ({ y: 0 }),
|
||||||
routes: constantRoutes
|
routes: constantRoutes
|
||||||
|
@ -65,7 +65,7 @@ service.interceptors.response.use(res => {
|
|||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = this.$router.options.base + '/index';
|
location.href = process.env.VUE_APP_CONTEXT_PATH;
|
||||||
})
|
})
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
|
@ -16,8 +16,7 @@ module.exports = {
|
|||||||
// 部署生产环境和开发环境下的URL。
|
// 部署生产环境和开发环境下的URL。
|
||||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
// 设置基路径参考文档: http://doc.ruoyi.vip/ruoyi-vue/document/qdsc.html#应用路径
|
publicPath: process.env.VUE_APP_CONTEXT_PATH,
|
||||||
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
|
||||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||||
outputDir: 'dist',
|
outputDir: 'dist',
|
||||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user