Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: userInfo.homePath 指定路径时表现异常 #5152

Closed
5 tasks done
RanMaoting opened this issue Dec 16, 2024 · 7 comments · Fixed by #5166
Closed
5 tasks done

Bug: userInfo.homePath 指定路径时表现异常 #5152

RanMaoting opened this issue Dec 16, 2024 · 7 comments · Fixed by #5166
Labels
enhancement New feature or request

Comments

@RanMaoting
Copy link

RanMaoting commented Dec 16, 2024

Version

Vben Admin V5

Describe the bug?

如图
image
设置userInfo.homePath = '/dashboard/more-get';
同时配置路由
image

    path: '/dashboard',
    name: 'Dashboard',
    meta: {
      hideChildrenInMenu: true,
      hideInBreadcrumb: true,
      hideInMenu: true,
      hideInTab: true,
      title: $t('page.dashboard.title'),
    },
    children: [
      {
        path: '/dashboard/more-get',
        name: 'DashboardMoreGet',
        component: () => import('#/views/dashboard/more-get/index.vue'),
        meta: {
          title: $t('page.dashboard.moreGet'),
          hideChildrenInMenu: true,
          hideInBreadcrumb: true,
          hideInMenu: true,
          hideInTab: true,
        },
      },
    ],
  },

当从登录页面进入时可以跳转到指定的页面,但是当登录后手动修改url地址,配置不会生效,它会直接进入默认的/目录下,如果这时没有配置/analytics,页面就会404

QQ20241216-16364.mp4

Reproduction

/

System Info

/

Relevant log output

No response

Validations

@axinss
Copy link

axinss commented Dec 17, 2024

那你想要的是什么效果

@RanMaoting
Copy link
Author

感觉这里应该保持统一,如果指定了homepath路径,那应该不管是通过vuerouter跳转还是在地址栏手动输入都应该进入配置的页面,毕竟默认的/analytics可能是不存在的

@axinss
Copy link

axinss commented Dec 17, 2024

那你可以配置DEFAULT_HOME_PATH哦

@RanMaoting
Copy link
Author

不是啊,感觉你没有理解到这里的问题,并不是DEFAULT_HOME_PATH的问题,如果配置DEFAULT_HOME_PATH,但是用户的权限并不能进入这里的地址该怎么办呢,这种情况在实际中开发中应该经常遇到. 比如只有管理员能进入仪表盘查看一些统计信息,而普通用户只有自己的首页并不能进入仪表盘,也进入不了,当用户直接在地址栏输入url时问题就出现了,因为当前用户没有权限进入DEFAULT_HOME_PATH,而现在又不能正确跳转到他自己的首页,会直接进入404,应为DEFAULT_HOME_PATH地址不在当前用户的权限里面

@axinss
Copy link

axinss commented Dec 17, 2024

确实有这样的问题

@likui628
Copy link
Collaborator

查了下,vben2有讨论,所以应该是必要的
#2069 (comment)
#2200 (comment)

@likui628 likui628 added enhancement New feature or request and removed bug: pending triage labels Dec 17, 2024
@sosovia
Copy link

sosovia commented Dec 17, 2024

框架能不能可以提供一个方法,自动获取到菜单的第一个跳转页面,登录成功之后自动跳转就好了。这样不用配置首页之类的了。因为首页会根据不同的角色path 路径不一样。

@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants