refactor: refactor AuthLayout to configure the login page more freely (#4294)

This commit is contained in:
Vben
2024-08-31 21:38:24 +08:00
committed by GitHub
parent a7d322019e
commit 8404c12129
31 changed files with 314 additions and 115 deletions

View File

@@ -240,7 +240,7 @@ const defaultPreferences: Preferences = {
theme: {
builtinType: 'default',
colorDestructive: 'hsl(348 100% 61%)',
colorPrimary: 'hsl(231 98% 65%)',
colorPrimary: 'hsl(212 100% 45%)',
colorSuccess: 'hsl(144 57% 58%)',
colorWarning: 'hsl(42 84% 61%)',
mode: 'dark',

View File

@@ -18,7 +18,7 @@ You just need to configure the `props` parameter of `AuthPageLayout` in `src/rou
pageTitle: "开箱即用的大型中后台管理系统",
pageDescription: "工程化、高性能、跨组件库的前端模版",
toolbar: true,
toolbarList: () => ['color', 'language', 'layout', 'theme'],
toolbarList: ['color', 'language', 'layout', 'theme'],
}
// ...
},

View File

@@ -53,7 +53,7 @@ You can check the list below to understand all the available variables.
/* Theme Colors */
--primary: 231 98% 65%;
--primary: 212 100% 45%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */
@@ -264,7 +264,7 @@ export const overridesPreferences = defineOverridesPreferences({
// Error color
colorDestructive: 'hsl(348 100% 61%)',
// Primary color
colorPrimary: 'hsl(231 98% 65%)',
colorPrimary: 'hsl(212 100% 45%)',
// Success color
colorSuccess: 'hsl(144 57% 58%)',
// Warning color
@@ -351,7 +351,7 @@ type BuiltinThemeType =
/* Theme Colors */
--primary: 231 98% 65%;
--primary: 212 100% 45%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */

View File

@@ -262,7 +262,7 @@ const defaultPreferences: Preferences = {
theme: {
builtinType: 'default',
colorDestructive: 'hsl(348 100% 61%)',
colorPrimary: 'hsl(231 98% 65%)',
colorPrimary: 'hsl(212 100% 45%)',
colorSuccess: 'hsl(144 57% 58%)',
colorWarning: 'hsl(42 84% 61%)',
mode: 'dark',

View File

@@ -8,28 +8,21 @@
![login](/guide/login.png)
只需要在应用下的 `src/router/routes/core.ts` 内,配置`AuthPageLayout``props`参数即可:
只需要在应用下的 `src/layouts/auth.vue` 内,配置`AuthPageLayout``props`参数即可:
```ts {4-8}
{
component: AuthPageLayout,
props: {
sloganImage: "xxx/xxx.png",
pageTitle: "开箱即用的大型中后台管理系统",
pageDescription: "工程化、高性能、跨组件库的前端模版",
toolbar: true,
toolbarList: () => ['color', 'language', 'layout', 'theme'],
}
// ...
},
```vue {2-7}
<AuthPageLayout
:copyright="true"
:toolbar="true"
:toolbarList="['color', 'language', 'layout', 'theme']"
:app-name="appName"
:logo="logo"
:page-description="$t('authentication.pageDesc')"
:page-title="$t('authentication.pageTitle')"
>
</AuthPageLayout>
```
::: tip
如果这些配置不能满足你的需求,你可以自行实现登录页面。直接实现自己的 `AuthPageLayout`即可。
:::
## 登录表单调整
如果你想调整登录表单的相关内容,你可以在应用下的 `src/views/_core/authentication/login.vue` 内,配置`AuthenticationLogin` 组件参数即可:

View File

@@ -53,7 +53,7 @@ css 变量内的颜色,必须使用 `hsl` 格式,如 `0 0% 100%`,不需要
/* 主题颜色 */
--primary: 231 98% 65%;
--primary: 212 100% 45%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */
@@ -264,7 +264,7 @@ export const overridesPreferences = defineOverridesPreferences({
// 错误色
colorDestructive: 'hsl(348 100% 61%)',
// 主题色
colorPrimary: 'hsl(231 98% 65%)',
colorPrimary: 'hsl(212 100% 45%)',
// 成功色
colorSuccess: 'hsl(144 57% 58%)',
// 警告色
@@ -351,7 +351,7 @@ type BuiltinThemeType =
/* 主题颜色 */
--primary: 231 98% 65%;
--primary: 212 100% 45%;
--primary-foreground: 0 0% 98%;
/* Used for destructive actions such as <Button variant="destructive"> */