@liujitcn/kratos-admin-core 0.0.20 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/package/declarations/src/api/base/language.d.ts +8 -0
- package/dist/package/declarations/src/components/Dialog/ProDialog.vue.d.ts +1 -0
- package/dist/package/declarations/src/components/Dict/index.vue.d.ts +4 -3
- package/dist/package/declarations/src/components/Dict/value.d.ts +11 -0
- package/dist/package/declarations/src/components/LocaleSwitch/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/index.d.ts +2 -0
- package/dist/package/declarations/src/locales/generated.d.ts +3382 -0
- package/dist/package/declarations/src/locales/index.d.ts +53 -0
- package/dist/package/declarations/src/modules/index.d.ts +7 -2
- package/dist/package/declarations/src/request.d.ts +1 -0
- package/dist/package/declarations/src/routers/modules/staticRouter.d.ts +1 -0
- package/dist/package/declarations/src/rpc/base/v1/config.d.ts +13 -1
- package/dist/package/declarations/src/rpc/base/v1/language.d.ts +20 -0
- package/dist/package/declarations/src/rpc/base/v1/login.d.ts +13 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/auth.d.ts +1 -1
- package/dist/package/declarations/src/rpc/system/admin/v1/base_dict.d.ts +9 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/base_translation.d.ts +75 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/common.d.ts +13 -0
- package/dist/package/declarations/src/stores/interface/index.d.ts +2 -0
- package/dist/package/declarations/src/stores/modules/auth.d.ts +6 -6
- package/dist/package/declarations/src/stores/runtime.d.ts +1 -0
- package/dist/package/declarations/src/utils/dict.d.ts +2 -2
- package/dist/package/declarations/src/utils/index.d.ts +1 -1
- package/dist/package/declarations/src/utils/oauthProvider.d.ts +2 -0
- package/dist/package/declarations/src/utils/passwordCrypto.d.ts +1 -1
- package/dist/package/declarations/src/utils/passwordStrength.d.ts +0 -7
- package/dist/package/src/App.vue +5 -2
- package/dist/package/src/api/base/language.ts +20 -0
- package/dist/package/src/api/base/oauth.ts +0 -1
- package/dist/package/src/api/system/auth.ts +0 -1
- package/dist/package/src/bootstrap.ts +57 -2
- package/dist/package/src/components/CronExpression/index.vue +80 -82
- package/dist/package/src/components/Dialog/FormDialog.vue +10 -5
- package/dist/package/src/components/Dialog/ProDialog.vue +10 -4
- package/dist/package/src/components/Dict/index.vue +26 -9
- package/dist/package/src/components/Dict/value.ts +18 -0
- package/dist/package/src/components/ECharts/config/index.ts +6 -1
- package/dist/package/src/components/ErrorMessage/index.vue +3 -1
- package/dist/package/src/components/ImportExcel/index.vue +29 -18
- package/dist/package/src/components/LocaleSwitch/index.vue +28 -0
- package/dist/package/src/components/PasswordStrength/index.vue +8 -5
- package/dist/package/src/components/ProForm/components/DynamicList.vue +8 -3
- package/dist/package/src/components/ProForm/components/KvList.vue +14 -6
- package/dist/package/src/components/ProForm/index.vue +2 -2
- package/dist/package/src/components/ProTable/components/ColSetting.vue +7 -5
- package/dist/package/src/components/ProTable/components/TableColumn.vue +2 -1
- package/dist/package/src/components/ProTable/index.vue +36 -11
- package/dist/package/src/components/SearchForm/components/SearchFormItem.vue +9 -4
- package/dist/package/src/components/SearchForm/index.vue +6 -3
- package/dist/package/src/components/SelectFilter/index.vue +4 -1
- package/dist/package/src/components/SelectIcon/index.vue +8 -4
- package/dist/package/src/components/TreeFilter/index.vue +14 -6
- package/dist/package/src/components/Upload/File.vue +18 -13
- package/dist/package/src/components/Upload/Files.vue +22 -15
- package/dist/package/src/components/Upload/Img.vue +14 -11
- package/dist/package/src/components/Upload/Imgs.vue +15 -12
- package/dist/package/src/components/WangEditor/index.vue +12 -4
- package/dist/package/src/directives/modules/copy.ts +2 -1
- package/dist/package/src/hooks/useDownload.ts +3 -2
- package/dist/package/src/hooks/useHandleData.ts +5 -4
- package/dist/package/src/hooks/useTheme.ts +2 -1
- package/dist/package/src/hooks/useTime.ts +11 -2
- package/dist/package/src/index.ts +2 -0
- package/dist/package/src/layouts/components/Header/ToolBarRight.vue +2 -0
- package/dist/package/src/layouts/components/Header/components/AssemblySize.vue +8 -6
- package/dist/package/src/layouts/components/Header/components/Avatar.vue +11 -9
- package/dist/package/src/layouts/components/Header/components/Breadcrumb.vue +11 -3
- package/dist/package/src/layouts/components/Header/components/Fullscreen.vue +4 -2
- package/dist/package/src/layouts/components/Header/components/InfoDialog.vue +6 -3
- package/dist/package/src/layouts/components/Header/components/PasswordDialog.vue +6 -3
- package/dist/package/src/layouts/components/Header/components/SearchMenu.vue +5 -3
- package/dist/package/src/layouts/components/Header/components/ThemeSetting.vue +3 -1
- package/dist/package/src/layouts/components/Main/index.vue +1 -0
- package/dist/package/src/layouts/components/Tabs/components/MoreButton.vue +9 -7
- package/dist/package/src/layouts/components/Tabs/index.vue +15 -1
- package/dist/package/src/layouts/components/ThemeDrawer/index.vue +27 -24
- package/dist/package/src/locales/README.md +15 -0
- package/dist/package/src/locales/en-US.json +283 -0
- package/dist/package/src/locales/es-ES.json +283 -0
- package/dist/package/src/locales/fr-FR.json +283 -0
- package/dist/package/src/locales/generated.ts +57 -0
- package/dist/package/src/locales/index.ts +222 -0
- package/dist/package/src/locales/ja-JP.json +283 -0
- package/dist/package/src/locales/ko-KR.json +283 -0
- package/dist/package/src/locales/zh-CN.json +283 -0
- package/dist/package/src/locales/zh-TW.json +283 -0
- package/dist/package/src/modules/index.ts +7 -2
- package/dist/package/src/modules/kratosAdmin.ts +5 -1
- package/dist/package/src/request.ts +8 -1
- package/dist/package/src/routers/index.ts +4 -1
- package/dist/package/src/routers/modules/dynamicRouter.ts +5 -4
- package/dist/package/src/routers/modules/staticRouter.ts +8 -4
- package/dist/package/src/rpc/base/v1/config.ts +14 -1
- package/dist/package/src/rpc/base/v1/language.ts +31 -0
- package/dist/package/src/rpc/base/v1/login.ts +14 -1
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +9 -0
- package/dist/package/src/rpc/system/admin/v1/base_translation.ts +90 -0
- package/dist/package/src/rpc/system/admin/v1/common.ts +21 -0
- package/dist/package/src/stores/interface/index.ts +2 -0
- package/dist/package/src/stores/modules/config.ts +7 -3
- package/dist/package/src/stores/modules/user.ts +2 -1
- package/dist/package/src/stores/runtime.ts +1 -0
- package/dist/package/src/styles/element.scss +2 -0
- package/dist/package/src/utils/color.ts +5 -4
- package/dist/package/src/utils/dict.ts +27 -4
- package/dist/package/src/utils/eleValidate.ts +3 -2
- package/dist/package/src/utils/errorHandler.ts +9 -8
- package/dist/package/src/utils/index.ts +9 -8
- package/dist/package/src/utils/oauthProvider.ts +15 -10
- package/dist/package/src/utils/passwordCrypto.ts +4 -3
- package/dist/package/src/utils/passwordStrength.ts +1 -16
- package/dist/package/src/utils/request.ts +13 -8
- package/dist/package/src/views/error/403.vue +3 -1
- package/dist/package/src/views/error/404.vue +3 -1
- package/dist/package/src/views/error/500.vue +3 -1
- package/dist/package/src/views/error/pending.vue +5 -2
- package/dist/package/src/views/login/components/LoginForm.vue +58 -29
- package/dist/package/src/views/login/index.scss +6 -0
- package/dist/package/src/views/login/index.vue +2 -0
- package/dist/package/types/generated/auto-imports.d.ts +129 -111
- package/dist/package/types/generated/components.d.ts +67 -67
- package/package.json +4 -2
- package/types/generated/auto-imports.d.ts +129 -111
- package/types/generated/components.d.ts +67 -67
- package/vite.config.ts +12 -0
- package/dist/package/declarations/src/rpc/base/v1/enum.d.ts +0 -43
- package/dist/package/declarations/src/rpc/system/common/v1/enum.d.ts +0 -67
- package/dist/package/src/rpc/base/v1/enum.ts +0 -54
- package/dist/package/src/rpc/system/common/v1/enum.ts +0 -80
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import router from "../../routers/index";
|
|
2
2
|
import { LOGIN_URL } from "../../config";
|
|
3
|
+
import { t } from "../../locales";
|
|
3
4
|
import { RouteRecordRaw } from "vue-router";
|
|
4
5
|
import { ElNotification } from "element-plus";
|
|
5
6
|
import { useUserStore } from "../../stores/modules/user";
|
|
6
7
|
import { useAuthStore } from "../../stores/modules/auth";
|
|
7
8
|
import type { RouteItem } from "../../rpc/system/admin/v1/auth";
|
|
8
|
-
import { BaseMenuType } from "../../rpc/system/
|
|
9
|
+
import { BaseMenuType } from "../../rpc/system/admin/v1/common";
|
|
9
10
|
import { getRouteMetaFull } from "../../utils";
|
|
10
11
|
import { ADMIN_STATIC_VIEWS, getAdminViewRegistry } from "../../modules";
|
|
11
12
|
|
|
@@ -121,8 +122,8 @@ export const initDynamicRouter = async () => {
|
|
|
121
122
|
// 2.判断当前用户有没有菜单权限
|
|
122
123
|
if (!authStore.authMenuListGet.length) {
|
|
123
124
|
ElNotification({
|
|
124
|
-
title: "
|
|
125
|
-
message: "
|
|
125
|
+
title: t("core.auth.no_permission"),
|
|
126
|
+
message: t("core.auth.no_menu_permission"),
|
|
126
127
|
type: "warning",
|
|
127
128
|
duration: 3000
|
|
128
129
|
});
|
|
@@ -134,7 +135,7 @@ export const initDynamicRouter = async () => {
|
|
|
134
135
|
// 3.添加动态路由
|
|
135
136
|
const resolvedRouteItems = buildResolvedRouteItems(authStore.authMenuListGet);
|
|
136
137
|
resolvedRouteItems.forEach(({ item, path, redirect }) => {
|
|
137
|
-
if (item.type === BaseMenuType.
|
|
138
|
+
if (item.type === BaseMenuType.BASE_MENU_TYPE_EXT_LINK) return;
|
|
138
139
|
const routeRecord = createRouteRecord(item, path, redirect);
|
|
139
140
|
|
|
140
141
|
if (typeof routeRecord.component === "string") {
|
|
@@ -24,7 +24,8 @@ export const staticRouter: RouteRecordRaw[] = [
|
|
|
24
24
|
name: "Login",
|
|
25
25
|
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.LOGIN),
|
|
26
26
|
meta: {
|
|
27
|
-
title: "
|
|
27
|
+
title: "",
|
|
28
|
+
titleKey: "core.route.login"
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
{
|
|
@@ -46,7 +47,8 @@ export const errorRouter = [
|
|
|
46
47
|
name: "403",
|
|
47
48
|
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.FORBIDDEN),
|
|
48
49
|
meta: {
|
|
49
|
-
title: "
|
|
50
|
+
title: "",
|
|
51
|
+
titleKey: "core.route.forbidden"
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
54
|
{
|
|
@@ -54,7 +56,8 @@ export const errorRouter = [
|
|
|
54
56
|
name: "404",
|
|
55
57
|
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.NOT_FOUND),
|
|
56
58
|
meta: {
|
|
57
|
-
title: "
|
|
59
|
+
title: "",
|
|
60
|
+
titleKey: "core.route.not_found"
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
63
|
{
|
|
@@ -62,7 +65,8 @@ export const errorRouter = [
|
|
|
62
65
|
name: "500",
|
|
63
66
|
component: createAdminStaticViewLoader(ADMIN_STATIC_VIEWS.SERVER_ERROR),
|
|
64
67
|
meta: {
|
|
65
|
-
title: "
|
|
68
|
+
title: "",
|
|
69
|
+
titleKey: "core.route.server_error"
|
|
66
70
|
}
|
|
67
71
|
},
|
|
68
72
|
// Resolve refresh page, route warnings
|
|
@@ -5,7 +5,18 @@
|
|
|
5
5
|
// source: base/v1/config.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
/** 系统配置位置。 */
|
|
10
|
+
export enum BaseConfigSite {
|
|
11
|
+
/** BASE_CONFIG_SITE_UNSPECIFIED - 未指定系统配置位置。 */
|
|
12
|
+
BASE_CONFIG_SITE_UNSPECIFIED = 0,
|
|
13
|
+
/** BASE_CONFIG_SITE_SYSTEM - 系统内使用。 */
|
|
14
|
+
BASE_CONFIG_SITE_SYSTEM = 1,
|
|
15
|
+
/** BASE_CONFIG_SITE_ADMIN - 管理端。 */
|
|
16
|
+
BASE_CONFIG_SITE_ADMIN = 2,
|
|
17
|
+
/** BASE_CONFIG_SITE_APP - 移动端。 */
|
|
18
|
+
BASE_CONFIG_SITE_APP = 3,
|
|
19
|
+
}
|
|
9
20
|
|
|
10
21
|
/** 获取系统配置条件 */
|
|
11
22
|
export interface GetConfigRequest {
|
|
@@ -15,6 +26,8 @@ export interface GetConfigRequest {
|
|
|
15
26
|
|
|
16
27
|
/** 系统配置项 */
|
|
17
28
|
export interface ConfigItem {
|
|
29
|
+
/** 配置ID */
|
|
30
|
+
id: number;
|
|
18
31
|
/** 配置key */
|
|
19
32
|
key: string;
|
|
20
33
|
/** 配置value */
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: base/v1/language.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
/** 查询语言选项请求参数。 */
|
|
10
|
+
export interface OptionLanguageRequest {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 语言选择项。 */
|
|
14
|
+
export interface LanguageItem {
|
|
15
|
+
/** 标准语言代码 */
|
|
16
|
+
language_code: string;
|
|
17
|
+
/** 本地语言名称 */
|
|
18
|
+
native_name: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 当前支持的语言选项查询结果。 */
|
|
22
|
+
export interface OptionLanguageResponse {
|
|
23
|
+
/** 当前支持的语言列表 */
|
|
24
|
+
languages: LanguageItem[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 语言公共服务。 */
|
|
28
|
+
export interface LanguageService {
|
|
29
|
+
/** 查询当前支持的语言选项。 */
|
|
30
|
+
OptionLanguage(request: OptionLanguageRequest): Promise<OptionLanguageResponse>;
|
|
31
|
+
}
|
|
@@ -7,7 +7,20 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import type { PasswordCrypto } from "../../common/v1/types";
|
|
9
9
|
import type { Empty } from "../../google/protobuf/empty";
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
/** 密码加密场景枚举。 */
|
|
12
|
+
export enum PasswordCryptoScene {
|
|
13
|
+
/** PASSWORD_CRYPTO_SCENE_UNSPECIFIED - 未指定密码加密场景。 */
|
|
14
|
+
PASSWORD_CRYPTO_SCENE_UNSPECIFIED = 0,
|
|
15
|
+
/** PASSWORD_CRYPTO_SCENE_LOGIN - 登录密码加密场景。 */
|
|
16
|
+
PASSWORD_CRYPTO_SCENE_LOGIN = 1,
|
|
17
|
+
/** PASSWORD_CRYPTO_SCENE_CREATE_BASE_USER - 新增后台用户密码加密场景。 */
|
|
18
|
+
PASSWORD_CRYPTO_SCENE_CREATE_BASE_USER = 2,
|
|
19
|
+
/** PASSWORD_CRYPTO_SCENE_RESET_BASE_USER_PASSWORD - 重置后台用户密码加密场景。 */
|
|
20
|
+
PASSWORD_CRYPTO_SCENE_RESET_BASE_USER_PASSWORD = 3,
|
|
21
|
+
/** PASSWORD_CRYPTO_SCENE_UPDATE_USER_PASSWORD - 个人修改密码加密场景。 */
|
|
22
|
+
PASSWORD_CRYPTO_SCENE_UPDATE_USER_PASSWORD = 4,
|
|
23
|
+
}
|
|
11
24
|
|
|
12
25
|
/** 验证码获取条件 */
|
|
13
26
|
export interface CaptchaRequest {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import type { PasswordCrypto, StringValues } from "../../../common/v1/types";
|
|
9
9
|
import type { Empty } from "../../../google/protobuf/empty";
|
|
10
|
-
import type { BaseMenuType } from "
|
|
10
|
+
import type { BaseMenuType } from "./common";
|
|
11
11
|
|
|
12
12
|
/** 登录用户菜单树查询参数 */
|
|
13
13
|
export interface TreeUserMenuRequest {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import type { Status } from "../../../common/v1/enum";
|
|
9
9
|
import type { Empty } from "../../../google/protobuf/empty";
|
|
10
|
+
import type { BaseTranslation } from "./base_translation";
|
|
10
11
|
|
|
11
12
|
/** 字典选项查询条件 */
|
|
12
13
|
export interface OptionBaseDictRequest {
|
|
@@ -100,6 +101,8 @@ export interface BaseDictForm {
|
|
|
100
101
|
code: string;
|
|
101
102
|
/** 字典名称 */
|
|
102
103
|
name: string;
|
|
104
|
+
/** 非主语言翻译 */
|
|
105
|
+
translations: BaseTranslation[];
|
|
103
106
|
/** 状态 */
|
|
104
107
|
status: Status;
|
|
105
108
|
}
|
|
@@ -124,6 +127,8 @@ export interface BaseDictItemForm {
|
|
|
124
127
|
tag_type: string;
|
|
125
128
|
/** 排序 */
|
|
126
129
|
sort: number;
|
|
130
|
+
/** 非主语言翻译 */
|
|
131
|
+
translations: BaseTranslation[];
|
|
127
132
|
/** 状态 */
|
|
128
133
|
status: Status;
|
|
129
134
|
}
|
|
@@ -194,6 +199,8 @@ export interface BaseDict {
|
|
|
194
199
|
created_at: string;
|
|
195
200
|
/** 更新时间 */
|
|
196
201
|
updated_at: string;
|
|
202
|
+
/** 非主语言翻译 */
|
|
203
|
+
translations: BaseTranslation[];
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
/** 字典项 */
|
|
@@ -216,6 +223,8 @@ export interface BaseDictItem {
|
|
|
216
223
|
created_at: string;
|
|
217
224
|
/** 更新时间 */
|
|
218
225
|
updated_at: string;
|
|
226
|
+
/** 非主语言翻译 */
|
|
227
|
+
translations: BaseTranslation[];
|
|
219
228
|
}
|
|
220
229
|
|
|
221
230
|
/** Admin字典服务 */
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: system/admin/v1/base_translation.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import type { Empty } from "../../../google/protobuf/empty";
|
|
9
|
+
|
|
10
|
+
/** 统一翻译表目标类型,和 base_translation.target_type 的值一一对应。 */
|
|
11
|
+
export enum TranslationTargetType {
|
|
12
|
+
/** TRANSLATION_TARGET_TYPE_UNSPECIFIED - 未指定统一翻译表目标类型。 */
|
|
13
|
+
TRANSLATION_TARGET_TYPE_UNSPECIFIED = 0,
|
|
14
|
+
/** TRANSLATION_TARGET_TYPE_BASE_CONFIG_VALUE - 系统配置值。 */
|
|
15
|
+
TRANSLATION_TARGET_TYPE_BASE_CONFIG_VALUE = 1,
|
|
16
|
+
/** TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME - 系统配置名称。 */
|
|
17
|
+
TRANSLATION_TARGET_TYPE_BASE_CONFIG_NAME = 2,
|
|
18
|
+
/** TRANSLATION_TARGET_TYPE_BASE_DICT - 字典名称。 */
|
|
19
|
+
TRANSLATION_TARGET_TYPE_BASE_DICT = 3,
|
|
20
|
+
/** TRANSLATION_TARGET_TYPE_BASE_DICT_ITEM - 字典项标签。 */
|
|
21
|
+
TRANSLATION_TARGET_TYPE_BASE_DICT_ITEM = 4,
|
|
22
|
+
/** TRANSLATION_TARGET_TYPE_BASE_MENU - 菜单标题。 */
|
|
23
|
+
TRANSLATION_TARGET_TYPE_BASE_MENU = 5,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 翻译单个文本请求。 */
|
|
27
|
+
export interface DraftBaseTranslationRequest {
|
|
28
|
+
/** 待翻译文本 */
|
|
29
|
+
source: string;
|
|
30
|
+
/** 目标语言区域,不传时翻译所有启用的非主语言 */
|
|
31
|
+
locale?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** 翻译单个文本响应。 */
|
|
35
|
+
export interface DraftBaseTranslationResponse {
|
|
36
|
+
/** 翻译结果 */
|
|
37
|
+
translations: DraftBaseTranslationItem[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 翻译单个文本响应。 */
|
|
41
|
+
export interface DraftBaseTranslationItem {
|
|
42
|
+
/** 目标语言区域 */
|
|
43
|
+
locale: string;
|
|
44
|
+
/** 翻译文本 */
|
|
45
|
+
translation: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 修改单个翻译信息请求。 */
|
|
49
|
+
export interface UpdateBaseTranslationRequest {
|
|
50
|
+
/** 翻译记录ID,大于零时优先按ID更新;ID不存在时根据目标信息更新或新增 */
|
|
51
|
+
id: number;
|
|
52
|
+
/** 翻译目标类型,ID为零时用于查询或新增 */
|
|
53
|
+
target_type: TranslationTargetType;
|
|
54
|
+
/** 目标资源ID,ID为零时用于查询或新增 */
|
|
55
|
+
target_id: number;
|
|
56
|
+
/** 目标语言区域,ID为零时用于查询或新增 */
|
|
57
|
+
locale: string;
|
|
58
|
+
/** 翻译文本 */
|
|
59
|
+
name: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 国际化翻译信息 */
|
|
63
|
+
export interface BaseTranslation {
|
|
64
|
+
/** 翻译记录ID */
|
|
65
|
+
id: number;
|
|
66
|
+
/** 翻译目标类型 */
|
|
67
|
+
target_type: TranslationTargetType;
|
|
68
|
+
/** 目标资源ID */
|
|
69
|
+
target_id: number;
|
|
70
|
+
/** 语言区域 */
|
|
71
|
+
locale: string;
|
|
72
|
+
/** 翻译文本 */
|
|
73
|
+
name: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** 代码生成单语言国际化配置 */
|
|
77
|
+
export interface CodeGenLocaleConfig {
|
|
78
|
+
/** 业务或字段描述 */
|
|
79
|
+
comment: string;
|
|
80
|
+
/** 左树描述 */
|
|
81
|
+
left_tree_comment: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** 国际化翻译信息服务。 */
|
|
85
|
+
export interface BaseTranslationService {
|
|
86
|
+
/** 翻译单个文本。 */
|
|
87
|
+
DraftBaseTranslation(request: DraftBaseTranslationRequest): Promise<DraftBaseTranslationResponse>;
|
|
88
|
+
/** 修改国际化翻译信息 */
|
|
89
|
+
UpdateBaseTranslation(request: UpdateBaseTranslationRequest): Promise<Empty>;
|
|
90
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc unknown
|
|
5
|
+
// source: system/admin/v1/common.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
/** 菜单类型。 */
|
|
10
|
+
export enum BaseMenuType {
|
|
11
|
+
/** BASE_MENU_TYPE_UNSPECIFIED - 未指定菜单类型。 */
|
|
12
|
+
BASE_MENU_TYPE_UNSPECIFIED = 0,
|
|
13
|
+
/** BASE_MENU_TYPE_FOLDER - 目录。 */
|
|
14
|
+
BASE_MENU_TYPE_FOLDER = 1,
|
|
15
|
+
/** BASE_MENU_TYPE_MENU - 菜单。 */
|
|
16
|
+
BASE_MENU_TYPE_MENU = 2,
|
|
17
|
+
/** BASE_MENU_TYPE_BUTTON - 按钮。 */
|
|
18
|
+
BASE_MENU_TYPE_BUTTON = 3,
|
|
19
|
+
/** BASE_MENU_TYPE_EXT_LINK - 外部链接。 */
|
|
20
|
+
BASE_MENU_TYPE_EXT_LINK = 4,
|
|
21
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { defineStore } from "pinia";
|
|
2
2
|
import { defConfigService } from "../../api/base/config";
|
|
3
|
-
import { BaseConfigSite } from "../../rpc/base/v1/
|
|
3
|
+
import { BaseConfigSite } from "../../rpc/base/v1/config";
|
|
4
4
|
import type { LoginCaptchaConfig, SiteConfigState, SiteDisplayConfig } from "../../stores/interface";
|
|
5
5
|
import defaultLogoUrl from "../../assets/images/logo.svg";
|
|
6
6
|
import defaultBackgroundUrl from "../../assets/images/login_left.png";
|
|
7
7
|
|
|
8
8
|
const CAPTCHA_TYPE_KEY = "captchaType";
|
|
9
|
+
const TRANSLATION_DRAFT_ENABLED_KEY = "i18n.translation_draft.enabled";
|
|
9
10
|
|
|
10
11
|
const DEFAULT_SITE_DISPLAY_CONFIG: SiteDisplayConfig = {
|
|
11
12
|
sysName: "Admin",
|
|
@@ -76,7 +77,8 @@ function buildConfigMap(configs: Array<{ key?: string; value?: string }>) {
|
|
|
76
77
|
export const useConfigStore = defineStore("admin-config", {
|
|
77
78
|
state: (): SiteConfigState => ({
|
|
78
79
|
display: { ...DEFAULT_SITE_DISPLAY_CONFIG },
|
|
79
|
-
captcha: { ...DEFAULT_LOGIN_CAPTCHA_CONFIG }
|
|
80
|
+
captcha: { ...DEFAULT_LOGIN_CAPTCHA_CONFIG },
|
|
81
|
+
translationDraftEnabled: false
|
|
80
82
|
}),
|
|
81
83
|
getters: {},
|
|
82
84
|
actions: {
|
|
@@ -101,18 +103,20 @@ export const useConfigStore = defineStore("admin-config", {
|
|
|
101
103
|
resetDisplayConfig() {
|
|
102
104
|
this.display = { ...DEFAULT_SITE_DISPLAY_CONFIG };
|
|
103
105
|
this.captcha = { ...DEFAULT_LOGIN_CAPTCHA_CONFIG };
|
|
106
|
+
this.translationDraftEnabled = false;
|
|
104
107
|
},
|
|
105
108
|
/**
|
|
106
109
|
* 加载管理端站点配置,并以服务端返回值覆盖本地默认值。
|
|
107
110
|
*/
|
|
108
111
|
async loadDisplayConfig() {
|
|
109
112
|
const configResponse = await defConfigService.GetConfig({
|
|
110
|
-
site: BaseConfigSite.
|
|
113
|
+
site: BaseConfigSite.BASE_CONFIG_SITE_ADMIN
|
|
111
114
|
});
|
|
112
115
|
const configMap = buildConfigMap(configResponse.configs ?? []);
|
|
113
116
|
|
|
114
117
|
this.setDisplayConfig(normalizeSiteDisplayConfig(configMap));
|
|
115
118
|
this.setLoginCaptchaConfig(normalizeLoginCaptchaConfig(configMap));
|
|
119
|
+
this.translationDraftEnabled = configMap[TRANSLATION_DRAFT_ENABLED_KEY] === "true";
|
|
116
120
|
return this.display;
|
|
117
121
|
}
|
|
118
122
|
}
|
|
@@ -6,6 +6,7 @@ import type { UserInfoForm } from "../../rpc/system/admin/v1/auth";
|
|
|
6
6
|
import { UserState } from "../../stores/interface";
|
|
7
7
|
import piniaPersistConfig from "../../stores/helper/persist";
|
|
8
8
|
import { useDictStoreHook } from "../../stores/modules/dict";
|
|
9
|
+
import { t } from "../../locales";
|
|
9
10
|
|
|
10
11
|
const defaultUserInfo: UserInfoForm = {
|
|
11
12
|
user_name: "",
|
|
@@ -71,7 +72,7 @@ export const useUserStore = defineStore("admin-user", {
|
|
|
71
72
|
/** 刷新认证令牌 */
|
|
72
73
|
async refreshAccessToken() {
|
|
73
74
|
if (!this.refreshToken) {
|
|
74
|
-
return Promise.reject(new Error("
|
|
75
|
+
return Promise.reject(new Error(t("core.auth.refresh_token_missing")));
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
const data = await defLoginService.RefreshToken({ refresh_token: this.refreshToken });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ElMessage } from "element-plus";
|
|
2
|
+
import { t } from "../locales";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @description hex颜色转rgb颜色
|
|
@@ -8,7 +9,7 @@ import { ElMessage } from "element-plus";
|
|
|
8
9
|
export function hexToRgb(str: any) {
|
|
9
10
|
let hexs: any = "";
|
|
10
11
|
let reg = /^#?[0-9A-Fa-f]{6}$/;
|
|
11
|
-
if (!reg.test(str)) return ElMessage.warning("
|
|
12
|
+
if (!reg.test(str)) return ElMessage.warning(t("core.theme.color_hex_invalid"));
|
|
12
13
|
str = str.replace("#", "");
|
|
13
14
|
hexs = str.match(/../g);
|
|
14
15
|
for (let i = 0; i < 3; i++) hexs[i] = parseInt(hexs[i], 16);
|
|
@@ -24,7 +25,7 @@ export function hexToRgb(str: any) {
|
|
|
24
25
|
*/
|
|
25
26
|
export function rgbToHex(r: any, g: any, b: any) {
|
|
26
27
|
let reg = /^\d{1,3}$/;
|
|
27
|
-
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage.warning("
|
|
28
|
+
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) return ElMessage.warning(t("core.theme.color_rgb_invalid"));
|
|
28
29
|
let hexs = [r.toString(16), g.toString(16), b.toString(16)];
|
|
29
30
|
for (let i = 0; i < 3; i++) if (hexs[i].length == 1) hexs[i] = `0${hexs[i]}`;
|
|
30
31
|
return `#${hexs.join("")}`;
|
|
@@ -38,7 +39,7 @@ export function rgbToHex(r: any, g: any, b: any) {
|
|
|
38
39
|
*/
|
|
39
40
|
export function getDarkColor(color: string, level: number) {
|
|
40
41
|
let reg = /^#?[0-9A-Fa-f]{6}$/;
|
|
41
|
-
if (!reg.test(color)) return ElMessage.warning("
|
|
42
|
+
if (!reg.test(color)) return ElMessage.warning(t("core.theme.color_hex_invalid"));
|
|
42
43
|
let rgb = hexToRgb(color);
|
|
43
44
|
for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level));
|
|
44
45
|
return rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
@@ -52,7 +53,7 @@ export function getDarkColor(color: string, level: number) {
|
|
|
52
53
|
*/
|
|
53
54
|
export function getLightColor(color: string, level: number) {
|
|
54
55
|
let reg = /^#?[0-9A-Fa-f]{6}$/;
|
|
55
|
-
if (!reg.test(color)) return ElMessage.warning("
|
|
56
|
+
if (!reg.test(color)) return ElMessage.warning(t("core.theme.color_hex_invalid"));
|
|
56
57
|
let rgb = hexToRgb(color);
|
|
57
58
|
for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level));
|
|
58
59
|
return rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
// ? 系统全局字典
|
|
2
|
+
import { t } from "../locales";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @description:用户性别
|
|
5
6
|
*/
|
|
6
7
|
export const genderType = [
|
|
7
|
-
{
|
|
8
|
-
|
|
8
|
+
{
|
|
9
|
+
get label() {
|
|
10
|
+
return t("common.value.male");
|
|
11
|
+
},
|
|
12
|
+
value: 1
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
get label() {
|
|
16
|
+
return t("common.value.female");
|
|
17
|
+
},
|
|
18
|
+
value: 2
|
|
19
|
+
}
|
|
9
20
|
];
|
|
10
21
|
|
|
11
22
|
/**
|
|
12
23
|
* @description:用户状态
|
|
13
24
|
*/
|
|
14
25
|
export const userStatus = [
|
|
15
|
-
{
|
|
16
|
-
|
|
26
|
+
{
|
|
27
|
+
get label() {
|
|
28
|
+
return t("common.status.enabled");
|
|
29
|
+
},
|
|
30
|
+
value: 1,
|
|
31
|
+
tagType: "success"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
get label() {
|
|
35
|
+
return t("common.status.disabled");
|
|
36
|
+
},
|
|
37
|
+
value: 0,
|
|
38
|
+
tagType: "danger"
|
|
39
|
+
}
|
|
17
40
|
];
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// ? Element 常用表单校验规则
|
|
2
|
+
import { t } from "../locales";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @rule 手机号
|
|
5
6
|
*/
|
|
6
7
|
export function checkPhoneNumber(rule: any, value: any, callback: any) {
|
|
7
8
|
const regexp = /^(((13[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(17[3-8]{1})|(18[0-9]{1})|(19[0-9]{1})|(14[5-7]{1}))+\d{8})$/;
|
|
8
|
-
if (value === "") callback("
|
|
9
|
+
if (value === "") callback(t("common.validation.phone_required"));
|
|
9
10
|
if (!regexp.test(value)) {
|
|
10
|
-
callback(new Error("
|
|
11
|
+
callback(new Error(t("common.validation.phone_invalid")));
|
|
11
12
|
} else {
|
|
12
13
|
return callback();
|
|
13
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ElNotification } from "element-plus";
|
|
2
|
+
import { t } from "../locales";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @description 全局代码错误捕捉
|
|
@@ -7,15 +8,15 @@ const errorHandler = (error: any) => {
|
|
|
7
8
|
// 过滤 HTTP 请求错误
|
|
8
9
|
if (error.status || error.status == 0) return false;
|
|
9
10
|
let errorMap: { [key: string]: string } = {
|
|
10
|
-
InternalError: "
|
|
11
|
-
ReferenceError: "
|
|
12
|
-
TypeError: "
|
|
13
|
-
RangeError: "
|
|
14
|
-
SyntaxError: "
|
|
15
|
-
EvalError: "
|
|
16
|
-
URIError: "
|
|
11
|
+
InternalError: t("core.error.javascript.internal"),
|
|
12
|
+
ReferenceError: t("core.error.javascript.reference"),
|
|
13
|
+
TypeError: t("core.error.javascript.type"),
|
|
14
|
+
RangeError: t("core.error.javascript.range"),
|
|
15
|
+
SyntaxError: t("core.error.javascript.syntax"),
|
|
16
|
+
EvalError: t("core.error.javascript.eval"),
|
|
17
|
+
URIError: t("core.error.javascript.uri")
|
|
17
18
|
};
|
|
18
|
-
let errorName = errorMap[error.name] || "
|
|
19
|
+
let errorName = errorMap[error.name] || t("core.error.javascript.unknown");
|
|
19
20
|
ElNotification({
|
|
20
21
|
title: errorName,
|
|
21
22
|
message: error,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isArray } from "../utils/is";
|
|
2
2
|
import type { RouteItem, RouteMeta } from "../rpc/system/admin/v1/auth";
|
|
3
|
-
import { BaseMenuType } from "../rpc/system/
|
|
3
|
+
import { BaseMenuType } from "../rpc/system/admin/v1/common";
|
|
4
|
+
import { t } from "../locales";
|
|
4
5
|
|
|
5
6
|
const mode = import.meta.env.VITE_ROUTER_MODE;
|
|
6
7
|
|
|
@@ -22,7 +23,7 @@ export function getRouteMetaIcon(meta?: RouteMeta) {
|
|
|
22
23
|
* 获取菜单标题。
|
|
23
24
|
*/
|
|
24
25
|
export function getRouteMetaTitle(meta?: RouteMeta) {
|
|
25
|
-
return meta?.title ?? "
|
|
26
|
+
return meta?.title ?? t("core.layout.unnamed_menu");
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -169,11 +170,11 @@ export function randomNum(min: number, max: number): number {
|
|
|
169
170
|
export function getTimeState() {
|
|
170
171
|
let timeNow = new Date();
|
|
171
172
|
let hours = timeNow.getHours();
|
|
172
|
-
if (hours >= 6 && hours <= 10) return
|
|
173
|
-
if (hours >= 10 && hours <= 14) return
|
|
174
|
-
if (hours >= 14 && hours <= 18) return
|
|
175
|
-
if (hours >= 18 && hours <= 24) return
|
|
176
|
-
|
|
173
|
+
if (hours >= 6 && hours <= 10) return t("core.login.greeting.morning");
|
|
174
|
+
if (hours >= 10 && hours <= 14) return t("core.login.greeting.noon");
|
|
175
|
+
if (hours >= 14 && hours <= 18) return t("core.login.greeting.afternoon");
|
|
176
|
+
if (hours >= 18 && hours <= 24) return t("core.login.greeting.evening");
|
|
177
|
+
return t("core.login.greeting.night");
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
/**
|
|
@@ -198,7 +199,7 @@ export function isExternalPath(path?: string) {
|
|
|
198
199
|
|
|
199
200
|
/** 获取菜单项实际跳转目标,外链优先使用 redirect。 */
|
|
200
201
|
export function getRouteTarget(item: RouteItem): string {
|
|
201
|
-
if (item.type === BaseMenuType.
|
|
202
|
+
if (item.type === BaseMenuType.BASE_MENU_TYPE_EXT_LINK) return item.redirect || item.path || "";
|
|
202
203
|
return item.path ?? "";
|
|
203
204
|
}
|
|
204
205
|
|
|
@@ -6,11 +6,14 @@ import githubIconUrl from "../assets/images/oauth/github.png";
|
|
|
6
6
|
import googleIconUrl from "../assets/images/oauth/google.png";
|
|
7
7
|
import wechatIconUrl from "../assets/images/oauth/wechat.png";
|
|
8
8
|
import wechatworkIconUrl from "../assets/images/oauth/wechatwork.png";
|
|
9
|
+
import { t } from "../locales";
|
|
9
10
|
|
|
10
11
|
/** 三方登录展示信息。 */
|
|
11
12
|
export interface OauthProviderDisplay {
|
|
12
13
|
/** 登录方式名称。 */
|
|
13
14
|
name: string;
|
|
15
|
+
/** 登录方式名称对应的稳定语言键。 */
|
|
16
|
+
nameKey: string;
|
|
14
17
|
/** 登录方式图标标识。 */
|
|
15
18
|
icon: string;
|
|
16
19
|
}
|
|
@@ -21,15 +24,15 @@ export interface OauthProviderSource {
|
|
|
21
24
|
provider: string;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
const oauthProviderDisplayMap: Record<string, OauthProviderDisplay
|
|
25
|
-
github: {
|
|
26
|
-
wechat: {
|
|
27
|
-
wechatmp: {
|
|
28
|
-
gitee: {
|
|
29
|
-
google: {
|
|
30
|
-
dingtalk: {
|
|
31
|
-
feishu: {
|
|
32
|
-
wechatwork: {
|
|
27
|
+
const oauthProviderDisplayMap: Record<string, Omit<OauthProviderDisplay, "name">> = {
|
|
28
|
+
github: { nameKey: "GitHub", icon: "github" },
|
|
29
|
+
wechat: { nameKey: "core.oauth.wechat", icon: "wechat" },
|
|
30
|
+
wechatmp: { nameKey: "core.oauth.wechatmp", icon: "wechat" },
|
|
31
|
+
gitee: { nameKey: "Gitee", icon: "gitee" },
|
|
32
|
+
google: { nameKey: "Google", icon: "google" },
|
|
33
|
+
dingtalk: { nameKey: "core.oauth.dingtalk", icon: "dingtalk" },
|
|
34
|
+
feishu: { nameKey: "core.oauth.feishu", icon: "feishu" },
|
|
35
|
+
wechatwork: { nameKey: "core.oauth.wechatwork", icon: "wechatwork" }
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
/** 创建本地官方图标图片组件。 */
|
|
@@ -56,7 +59,9 @@ const oauthIconMap: Record<string, Component> = {
|
|
|
56
59
|
|
|
57
60
|
/** 根据 provider 标识获取前端展示信息。 */
|
|
58
61
|
export function getOauthProviderDisplay(provider: string): OauthProviderDisplay {
|
|
59
|
-
|
|
62
|
+
const display = oauthProviderDisplayMap[provider] ?? { nameKey: "core.oauth.unknown", icon: provider };
|
|
63
|
+
const name = display.nameKey.includes(".") ? t(display.nameKey) : display.nameKey;
|
|
64
|
+
return { ...display, name: provider ? name : t("core.oauth.unknown") };
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
/** 创建未知 provider 的文字兜底图标。 */
|