Prechádzať zdrojové kódy

update 更新关于全局路径设置与文档链接

疯狂的狮子Li 3 rokov pred
rodič
commit
2173ed504d

+ 1 - 1
ruoyi-ui/src/layout/components/Navbar.vue

@@ -102,7 +102,7 @@ export default {
         type: 'warning'
       }).then(() => {
         this.$store.dispatch('LogOut').then(() => {
-          this.$router.push({ path: "/login" })
+          location.href = this.$router.options.base + '/index';
         })
       }).catch(() => {});
     }

+ 1 - 0
ruoyi-ui/src/router/index.js

@@ -167,6 +167,7 @@ export const constantRoutes = [
 ]
 
 export default new Router({
+  base: "", // 项目前缀 与 publicPath 同步 例如 /api
   mode: 'history', // 去掉url中的#
   scrollBehavior: () => ({ y: 0 }),
   routes: constantRoutes

+ 1 - 1
ruoyi-ui/src/utils/request.js

@@ -65,7 +65,7 @@ service.interceptors.response.use(res => {
         }
       ).then(() => {
         store.dispatch('LogOut').then(() => {
-          location.href = '/index';
+          location.href = this.$router.options.base + '/index';
         })
       }).catch(() => {});
       return Promise.reject('无效的会话,或者会话已过期,请重新登录。')

+ 1 - 0
ruoyi-ui/vue.config.js

@@ -16,6 +16,7 @@ module.exports = {
   // 部署生产环境和开发环境下的URL。
   // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
   // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
+  // 设置基路径参考文档: http://doc.ruoyi.vip/ruoyi-vue/document/qdsc.html#应用路径
   publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
   // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
   outputDir: 'dist',