统一角色体系为admin/agent/user,修复代理查询角色错误,添加语言切换和明暗切换
This commit is contained in:
@@ -19,10 +19,14 @@ export function createRouterGuard(router: Router) {
|
||||
const isAuthPage = to.path === '/login' || to.path === '/register'
|
||||
|
||||
if (requiresAuth && !token) {
|
||||
return '/login'
|
||||
return { path: '/login', query: { redirect: to.fullPath } }
|
||||
}
|
||||
|
||||
if (isAuthPage && token && user) {
|
||||
const redirect = (to.query.redirect as string) || ''
|
||||
if (redirect) {
|
||||
return redirect
|
||||
}
|
||||
if (user.role === 'agent' || user.parent_agent_id) {
|
||||
return '/agent'
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/developer',
|
||||
component: () => import('@/layouts/developer.vue'),
|
||||
meta: { auth: true, role: 'developer' },
|
||||
meta: { auth: true, role: 'admin' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
|
||||
Reference in New Issue
Block a user