feat: 增加管理首页运行面板并支持用户改密
This commit is contained in:
+5
-3
@@ -4,6 +4,7 @@ import App from "./App.vue";
|
||||
import InstallView from "./features/install/InstallView.vue";
|
||||
import LoginView from "./features/auth/LoginView.vue";
|
||||
import TasksView from "./features/user/TasksView.vue";
|
||||
import DashboardView from "./features/admin/DashboardView.vue";
|
||||
import SettingsView from "./features/admin/SettingsView.vue";
|
||||
import UsersView from "./features/admin/UsersView.vue";
|
||||
import PoolView from "./features/admin/PoolView.vue";
|
||||
@@ -17,12 +18,13 @@ const router = createRouter({
|
||||
routes: [
|
||||
{ path: "/install", component: InstallView },
|
||||
{ path: "/login", component: LoginView },
|
||||
{ path: "/", redirect: "/tasks" },
|
||||
{ path: "/", redirect: () => sessionStorage.getItem("decom-role") === "admin" ? "/admin" : "/tasks" },
|
||||
{ path: "/tasks", component: TasksView, meta: { role: "user" } },
|
||||
{ path: "/admin/settings", component: SettingsView, meta: { role: "admin" } },
|
||||
{ path: "/admin", component: DashboardView, meta: { role: "admin" } },
|
||||
{ path: "/admin/users", component: UsersView, meta: { role: "admin" } },
|
||||
{ path: "/admin/pool", component: PoolView, meta: { role: "admin" } },
|
||||
{ path: "/admin/sources", component: SourcesView, meta: { role: "admin" } },
|
||||
{ path: "/admin/settings", component: SettingsView, meta: { role: "admin" } },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -35,7 +37,7 @@ router.beforeEach(async (to) => {
|
||||
if (!token()) return "/login";
|
||||
const role = sessionStorage.getItem("decom-role");
|
||||
if (to.meta.role === "admin" && role !== "admin") return "/tasks";
|
||||
if (to.meta.role === "user" && role === "admin") return "/admin/settings";
|
||||
if (to.meta.role === "user" && role === "admin") return "/admin";
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user