feat(web): 创作者审核页支持开号/重置密码;登录落地按角色分流 + 首登强制改密
为什么:后台能开号了,但界面还没有入口;而且创作者登录后会落到 /dashboard/index(他没有运营后台权限) 直接掉 404。这批把开号入口、一次性凭据展示、落地分流与首登改密一次补齐。 - 创作者入驻页:「新增创作者」按钮(名称/类型/联系人/邮箱/国家)、「账号」列(已开通/未开通)、 行内「开通账号 / 重置密码」;密码一次性弹窗展示(等宽可选中 + 一键复制 + 提示只显示这一次) - 落地分流:新增 landingPath()(取账号能进的第一个菜单),登录与访问根路径都走它 —— 创作者落 /creator-center/workspace,超管第一条仍是工作台(行为不变) - 首登强制改密:Layout 挂 MustChangePasswordDialog,登录或刷新后若 profile 带 mustChangePassword 就弹不可关闭的 改密框,改完清标记;只能改密或退出登录
This commit is contained in:
1 parent
bac070b60b
commit
8ce43ccd4c
10 files changed
+378
-7
No files matched your search
@@ -8,6 +8,7 @@ import { usePageLoading } from '@/hooks/web/usePageLoading'
|
||||
import { NO_REDIRECT_WHITE_LIST } from '@/constants'
|
||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||
import { getAdminRoleApi, getProfileApi } from '@/api/login'
|
||||
import { landingPath } from '@/utils/landing'
|
||||
|
||||
const { start, done } = useNProgress()
|
||||
|
||||
@@ -63,6 +64,15 @@ router.beforeEach(async (to, from, next) => {
|
||||
permissionStore.getAddRouters.forEach((route) => {
|
||||
router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表
|
||||
})
|
||||
|
||||
// 根路径按"这个账号能进的第一个菜单"落地:路由表里写死的 redirect 是 /dashboard/index,
|
||||
// 创作者没有运营后台权限,访问 '/' 会直接掉 404
|
||||
if (to.path === '/') {
|
||||
permissionStore.setIsAddRouters(true)
|
||||
next({ path: landingPath(), replace: true })
|
||||
return
|
||||
}
|
||||
|
||||
const redirectPath = from.query.redirect || to.path
|
||||
const redirect = decodeURIComponent(redirectPath as string)
|
||||
const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }
|
||||
|
||||
Reference in new issue
Block a user