Русифицировать README и интерфейс HY2XS admin

This commit is contained in:
2026-04-25 23:51:21 +05:00
parent 84a4e94567
commit 2b4a45ad23
167 changed files with 632 additions and 699 deletions
+8 -6
View File
@@ -5,11 +5,11 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
NProgress.configure({ showSpinner: false }); // 进度条
NProgress.configure({ showSpinner: false }); // Индикатор загрузки
const permissionStore = usePermissionStoreHook();
// 白名单路由
// Разрешённые маршруты
const whiteList = ["/login", "/register"];
router.beforeEach(async (to, from, next) => {
@@ -17,14 +17,14 @@ router.beforeEach(async (to, from, next) => {
const hasToken = localStorage.getItem("accessToken");
if (hasToken) {
if (to.path === "/login") {
// 如果已登录,跳转首页
// Если пользователь уже вошёл, перейти на главную страницу
next({ path: "/" });
NProgress.done();
} else {
const AccountStore = useAccountStoreHook();
const hasRoles = AccountStore.roles && AccountStore.roles.length > 0;
if (hasRoles) {
// 未匹配到任何路由,跳转404
// Если маршрут не найден, перейти на 404
if (to.matched.length === 0) {
from.name ? next({ name: from.name }) : next("/404");
} else {
@@ -39,7 +39,7 @@ router.beforeEach(async (to, from, next) => {
});
next({ ...to, replace: true });
} catch (error) {
// 移除 token 并跳转登录页
// Удалить token и перейти на страницу входа
await AccountStore.resetToken();
next(`/login?redirect=${to.path}`);
NProgress.done();
@@ -47,7 +47,7 @@ router.beforeEach(async (to, from, next) => {
}
}
} else {
// 未登录可以访问白名单页面
// Без входа доступны только разрешённые страницы
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
@@ -60,3 +60,5 @@ router.beforeEach(async (to, from, next) => {
router.afterEach(() => {
NProgress.done();
});