@liujitcn/kratos-admin-core 0.0.35 → 0.0.37
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 -0
- package/dist/package/declarations/src/stores/interface/index.d.ts +2 -0
- package/dist/package/src/components/LocaleSwitch/index.vue +1 -1
- package/dist/package/src/stores/interface/index.ts +2 -0
- package/dist/package/src/stores/modules/config.ts +3 -0
- package/dist/package/src/views/login/components/LoginForm.vue +5 -3
- package/dist/package/src/views/login/index.vue +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -142,6 +142,8 @@ core 内部源码使用 `@/*`,不得引用任何 System 包或 System 源码
|
|
|
142
142
|
|
|
143
143
|
core 的 API 目录只保留底座运行时实际调用的请求封装。RPC 生成文件以服务为生成粒度;服务端契约尚未拆分完成时,core 所需的登录、菜单或用户服务文件可能暂含个人中心相关方法,这属于当前生成结果,不代表个人中心页面归属 core,也不在前端手工裁剪。
|
|
144
144
|
|
|
145
|
+
登录页的租户输入框读取公共配置 `showTenantCode`,配置值为 `false` 或 `0` 时隐藏,并在登录请求中使用默认租户编码。语言切换入口由 `base/language` 返回的可用语言数量控制,仅返回一种语言时不显示;其他登录方式由 `base/oauth/provider` 返回的 `providers` 数组控制,空数组不显示登录入口。
|
|
146
|
+
|
|
145
147
|
core 通过 `ADMIN_STATIC_VIEWS` 注册全部默认静态页面,后注册业务模块通过 `AdminModule.staticViews` 显式替换默认实现。固定视图键为 `login/index`、`error/403`、`error/404`、`error/500` 和 `error/pending`。普通业务页面只按 `<module>/<view>` 路径解析,不提供无前缀别名。个人中心与 AI 助手不在 core 中注册,使用这些能力的宿主必须安装并注册 System 模块。
|
|
146
148
|
|
|
147
149
|
## 公共 Interface
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-dropdown trigger="click" placement="bottom-end" @command="handleLocaleChange">
|
|
2
|
+
<el-dropdown v-if="localeOptions.length > 1" trigger="click" placement="bottom-end" @command="handleLocaleChange">
|
|
3
3
|
<Languages class="toolBar-icon" :size="20" :title="t('core.header.language')" />
|
|
4
4
|
<template #dropdown>
|
|
5
5
|
<el-dropdown-menu>
|
|
@@ -6,6 +6,7 @@ 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 SHOW_TENANT_CODE_KEY = "showTenantCode";
|
|
9
10
|
const I18N_DRAFT_ENABLED_KEY = "i18n.draft.enabled";
|
|
10
11
|
|
|
11
12
|
const DEFAULT_SITE_DISPLAY_CONFIG: SiteDisplayConfig = {
|
|
@@ -78,6 +79,7 @@ export const useConfigStore = defineStore("admin-config", {
|
|
|
78
79
|
state: (): SiteConfigState => ({
|
|
79
80
|
display: { ...DEFAULT_SITE_DISPLAY_CONFIG },
|
|
80
81
|
captcha: { ...DEFAULT_LOGIN_CAPTCHA_CONFIG },
|
|
82
|
+
showTenantCode: true,
|
|
81
83
|
i18nDraftEnabled: false
|
|
82
84
|
}),
|
|
83
85
|
getters: {},
|
|
@@ -116,6 +118,7 @@ export const useConfigStore = defineStore("admin-config", {
|
|
|
116
118
|
|
|
117
119
|
this.setDisplayConfig(normalizeSiteDisplayConfig(configMap));
|
|
118
120
|
this.setLoginCaptchaConfig(normalizeLoginCaptchaConfig(configMap));
|
|
121
|
+
this.showTenantCode = !["false", "0"].includes((configMap[SHOW_TENANT_CODE_KEY] ?? "true").toLowerCase());
|
|
119
122
|
this.i18nDraftEnabled = configMap[I18N_DRAFT_ENABLED_KEY] === "true";
|
|
120
123
|
return this.display;
|
|
121
124
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-form ref="loginFormRef" :model="loginForm" :rules="loginRules" size="large">
|
|
3
|
-
<el-form-item prop="tenant_code">
|
|
3
|
+
<el-form-item v-if="configStore.showTenantCode" prop="tenant_code">
|
|
4
4
|
<el-input v-model="loginForm.tenant_code" :placeholder="t('core.login.tenant_code')">
|
|
5
5
|
<template #prefix>
|
|
6
6
|
<el-icon class="el-input__icon">
|
|
@@ -225,7 +225,9 @@ const captchaImageWidth = ref(`${defaultCaptchaImageWidth}px`);
|
|
|
225
225
|
const behaviorDialogVisible = ref(false);
|
|
226
226
|
const behaviorLoading = ref(false);
|
|
227
227
|
const loginRules = computed(() => ({
|
|
228
|
-
|
|
228
|
+
...(configStore.showTenantCode
|
|
229
|
+
? { tenant_code: [{ required: true, message: t("core.login.tenant_code"), trigger: "blur" }] }
|
|
230
|
+
: {}),
|
|
229
231
|
user_name: [{ required: true, message: t("core.login.user_name"), trigger: "blur" }],
|
|
230
232
|
password: [{ required: true, message: t("core.login.password"), trigger: "blur" }],
|
|
231
233
|
captcha_code: [{ required: true, message: t("core.login.captcha"), trigger: "blur" }]
|
|
@@ -757,7 +759,7 @@ const submitLogin = async (captchaToken: string) => {
|
|
|
757
759
|
try {
|
|
758
760
|
const password = await encryptPassword(loginForm.password, PASSWORD_CRYPTO_SCENE.PASSWORD_CRYPTO_SCENE_LOGIN);
|
|
759
761
|
const loginRequest: LoginRequest = {
|
|
760
|
-
tenant_code: loginForm.tenant_code,
|
|
762
|
+
tenant_code: configStore.showTenantCode ? loginForm.tenant_code : "0000",
|
|
761
763
|
user_name: loginForm.user_name,
|
|
762
764
|
password,
|
|
763
765
|
captcha_code: captchaToken,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="login-container flx-center">
|
|
3
3
|
<div class="login-box">
|
|
4
4
|
<SwitchDark class="dark" />
|
|
5
|
-
<LocaleSwitch class="locale" />
|
|
5
|
+
<LocaleSwitch v-if="languageOptions.length > 1" class="locale" />
|
|
6
6
|
<div class="login-left">
|
|
7
7
|
<img class="login-left-img" :src="backgroundUrl" :alt="t('core.login.background_alt')" />
|
|
8
8
|
</div>
|
|
@@ -26,7 +26,7 @@ import { useConfigStore } from "../../stores/modules/config";
|
|
|
26
26
|
import { useLocaleStore } from "../../locales";
|
|
27
27
|
|
|
28
28
|
const configStore = useConfigStore();
|
|
29
|
-
const { t } = useLocaleStore();
|
|
29
|
+
const { t, languageOptions } = useLocaleStore();
|
|
30
30
|
const projectName = computed(() => configStore.display.sysName || import.meta.env.VITE_GLOB_APP_TITLE);
|
|
31
31
|
const logoUrl = computed(() => configStore.display.adminLogo);
|
|
32
32
|
const backgroundUrl = computed(() => configStore.display.background);
|