This commit is contained in:
dap 2024-10-21 07:58:31 +08:00
commit ea59f7d9e6
77 changed files with 188 additions and 223 deletions

View File

@ -16,7 +16,7 @@ categories:
- title: '🐞 Bug Fixes' - title: '🐞 Bug Fixes'
labels: labels:
- 'bug' - 'bug'
- title: '📈 Performance' - title: '📈 Performance & Enhancement'
labels: labels:
- 'perf' - 'perf'
- 'enhancement' - 'enhancement'

View File

@ -112,6 +112,7 @@ async function handleLogin(values: LoginCodeParams) {
smsCode: values.code, smsCode: values.code,
grantType: 'sms', grantType: 'sms',
}; };
console.log('login params', requestParams);
await authStore.authLogin(requestParams); await authStore.authLogin(requestParams);
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
@ -27,7 +28,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: string) { function handleSubmit(value: Recordable<any>) {
console.log('reset email:', value); console.log('reset email:', value);
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui'; import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui';
import { computed, onMounted, ref, useTemplateRef } from 'vue'; import { computed, onMounted, ref, useTemplateRef } from 'vue';
@ -125,15 +125,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
interface LoginForm { async function handleAccountLogin(values: LoginAndRegisterParams) {
code?: string;
grantType: string;
password: string;
tenantId: string;
username: string;
}
async function handleAccountLogin(values: LoginForm) {
try { try {
const requestParam: any = omit(values, ['code']); const requestParam: any = omit(values, ['code']);
// //

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, h, ref } from 'vue'; import { computed, h, ref } from 'vue';
@ -45,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => {
rules(values) { rules(values) {
const { password } = values; const { password } = values;
return z return z
.string() .string({ required_error: $t('authentication.passwordTip') })
.min(1, { message: $t('authentication.passwordTip') }) .min(1, { message: $t('authentication.passwordTip') })
.refine((value) => value === password, { .refine((value) => value === password, {
message: $t('authentication.confirmPasswordTip'), message: $t('authentication.confirmPasswordTip'),
@ -55,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => {
}, },
fieldName: 'confirmPassword', fieldName: 'confirmPassword',
label: $t('authentication.confirmPassword'), label: $t('authentication.confirmPassword'),
rules: z.string().min(1, { message: $t('authentication.passwordTip') }),
}, },
{ {
component: 'VbenCheckbox', component: 'VbenCheckbox',
@ -67,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => {
h( h(
'a', 'a',
{ {
class: class: 'vben-link ml-1 ',
'cursor-pointer text-primary ml-1 hover:text-primary-hover',
href: '', href: '',
}, },
[ `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`,
$t('authentication.privacyPolicy'),
'&',
$t('authentication.terms'),
],
), ),
]), ]),
}), }),
@ -86,7 +81,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: LoginAndRegisterParams) { function handleSubmit(value: Recordable<any>) {
console.log('register submit:', value); console.log('register submit:', value);
} }
</script> </script>

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/web-ele", "name": "@vben/web-ele",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://vben.pro", "homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,9 +1,9 @@
{ {
"auth": { "auth": {
"login": "登", "login": "登",
"register": "注册", "register": "注册",
"codeLogin": "验证码登", "codeLogin": "验证码登",
"qrcodeLogin": "二维码登", "qrcodeLogin": "二维码登",
"forgetPassword": "忘记密码" "forgetPassword": "忘记密码"
}, },
"dashboard": { "dashboard": {

View File

@ -1,5 +1,4 @@
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { Recordable, UserInfo } from '@vben/types';
import type { UserInfo } from '@vben/types';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -26,7 +25,7 @@ export const useAuthStore = defineStore('auth', () => {
* @param params * @param params
*/ */
async function authLogin( async function authLogin(
params: LoginAndRegisterParams, params: Recordable<any>,
onSuccess?: () => Promise<void> | void, onSuccess?: () => Promise<void> | void,
) { ) {
// 异步处理用户登录操作并获取 accessToken // 异步处理用户登录操作并获取 accessToken
@ -85,7 +84,7 @@ export const useAuthStore = defineStore('auth', () => {
resetAllStores(); resetAllStores();
accessStore.setLoginExpired(false); accessStore.setLoginExpired(false);
// 回登页带上当前路由地址 // 回登页带上当前路由地址
await router.replace({ await router.replace({
path: LOGIN_PATH, path: LOGIN_PATH,
query: redirect query: redirect

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginCodeParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
@ -49,7 +50,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* Asynchronously handle the login process * Asynchronously handle the login process
* @param values 登录表单数据 * @param values 登录表单数据
*/ */
async function handleLogin(values: LoginCodeParams) { async function handleLogin(values: Recordable<any>) {
console.log(values); console.log(values);
} }
</script> </script>

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
@ -27,7 +28,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: string) { function handleSubmit(value: Recordable<any>) {
console.log('reset email:', value); console.log('reset email:', value);
} }
</script> </script>

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, h, ref } from 'vue'; import { computed, h, ref } from 'vue';
@ -45,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => {
rules(values) { rules(values) {
const { password } = values; const { password } = values;
return z return z
.string() .string({ required_error: $t('authentication.passwordTip') })
.min(1, { message: $t('authentication.passwordTip') }) .min(1, { message: $t('authentication.passwordTip') })
.refine((value) => value === password, { .refine((value) => value === password, {
message: $t('authentication.confirmPasswordTip'), message: $t('authentication.confirmPasswordTip'),
@ -55,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => {
}, },
fieldName: 'confirmPassword', fieldName: 'confirmPassword',
label: $t('authentication.confirmPassword'), label: $t('authentication.confirmPassword'),
rules: z.string().min(1, { message: $t('authentication.passwordTip') }),
}, },
{ {
component: 'VbenCheckbox', component: 'VbenCheckbox',
@ -67,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => {
h( h(
'a', 'a',
{ {
class: class: 'vben-link ml-1 ',
'cursor-pointer text-primary ml-1 hover:text-primary-hover',
href: '', href: '',
}, },
[ `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`,
$t('authentication.privacyPolicy'),
'&',
$t('authentication.terms'),
],
), ),
]), ]),
}), }),
@ -86,7 +81,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: LoginAndRegisterParams) { function handleSubmit(value: Recordable<any>) {
console.log('register submit:', value); console.log('register submit:', value);
} }
</script> </script>

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/web-naive", "name": "@vben/web-naive",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://vben.pro", "homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"auth": { "auth": {
"login": "登", "login": "登",
"register": "注册", "register": "注册",
"codeLogin": "验证码登陆", "codeLogin": "验证码登陆",
"qrcodeLogin": "二维码登陆", "qrcodeLogin": "二维码登陆",

View File

@ -1,5 +1,4 @@
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { Recordable, UserInfo } from '@vben/types';
import type { UserInfo } from '@vben/types';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -26,7 +25,7 @@ export const useAuthStore = defineStore('auth', () => {
* @param params * @param params
*/ */
async function authLogin( async function authLogin(
params: LoginAndRegisterParams, params: Recordable<any>,
onSuccess?: () => Promise<void> | void, onSuccess?: () => Promise<void> | void,
) { ) {
// 异步处理用户登录操作并获取 accessToken // 异步处理用户登录操作并获取 accessToken
@ -85,7 +84,7 @@ export const useAuthStore = defineStore('auth', () => {
resetAllStores(); resetAllStores();
accessStore.setLoginExpired(false); accessStore.setLoginExpired(false);
// 回登页带上当前路由地址 // 回登页带上当前路由地址
await router.replace({ await router.replace({
path: LOGIN_PATH, path: LOGIN_PATH,
query: redirect query: redirect

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginCodeParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
@ -49,7 +50,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* Asynchronously handle the login process * Asynchronously handle the login process
* @param values 登录表单数据 * @param values 登录表单数据
*/ */
async function handleLogin(values: LoginCodeParams) { async function handleLogin(values: Recordable<any>) {
console.log(values); console.log(values);
} }
</script> </script>

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
@ -27,7 +28,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: string) { function handleSubmit(value: Recordable<any>) {
console.log('reset email:', value); console.log('reset email:', value);
} }
</script> </script>

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, h, ref } from 'vue'; import { computed, h, ref } from 'vue';
@ -45,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => {
rules(values) { rules(values) {
const { password } = values; const { password } = values;
return z return z
.string() .string({ required_error: $t('authentication.passwordTip') })
.min(1, { message: $t('authentication.passwordTip') }) .min(1, { message: $t('authentication.passwordTip') })
.refine((value) => value === password, { .refine((value) => value === password, {
message: $t('authentication.confirmPasswordTip'), message: $t('authentication.confirmPasswordTip'),
@ -55,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => {
}, },
fieldName: 'confirmPassword', fieldName: 'confirmPassword',
label: $t('authentication.confirmPassword'), label: $t('authentication.confirmPassword'),
rules: z.string().min(1, { message: $t('authentication.passwordTip') }),
}, },
{ {
component: 'VbenCheckbox', component: 'VbenCheckbox',
@ -67,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => {
h( h(
'a', 'a',
{ {
class: class: 'vben-link ml-1',
'cursor-pointer text-primary ml-1 hover:text-primary-hover',
href: '', href: '',
}, },
[ `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`,
$t('authentication.privacyPolicy'),
'&',
$t('authentication.terms'),
],
), ),
]), ]),
}), }),
@ -86,7 +81,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: LoginAndRegisterParams) { function handleSubmit(value: Recordable<any>) {
console.log('register submit:', value); console.log('register submit:', value);
} }
</script> </script>

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/docs", "name": "@vben/docs",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "vitepress build", "build": "vitepress build",

View File

@ -11,7 +11,7 @@ outline: deep
## 前端访问控制 ## 前端访问控制
**实现原理**: 在前端固定写死路由的权限,指定路由有哪些权限可以查看。只初始化通用的路由,需要权限才能访问的路由没有被加入路由表内。在登后或者其他方式获取用户角色后,通过角色去遍历路由表,获取该角色可以访问的路由表,生成路由表,再通过 `router.addRoute` 添加到路由实例,实现权限的过滤。 **实现原理**: 在前端固定写死路由的权限,指定路由有哪些权限可以查看。只初始化通用的路由,需要权限才能访问的路由没有被加入路由表内。在登后或者其他方式获取用户角色后,通过角色去遍历路由表,获取该角色可以访问的路由表,生成路由表,再通过 `router.addRoute` 添加到路由实例,实现权限的过滤。
**缺点**: 权限相对不自由,如果后台改动角色,前台也需要跟着改动。适合角色较固定的系统 **缺点**: 权限相对不自由,如果后台改动角色,前台也需要跟着改动。适合角色较固定的系统

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/commitlint-config", "name": "@vben/commitlint-config",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/stylelint-config", "name": "@vben/stylelint-config",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/node-utils", "name": "@vben/node-utils",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -11,13 +11,10 @@ import { findUpSync } from 'find-up';
* @param cwd * @param cwd
*/ */
function findMonorepoRoot(cwd: string = process.cwd()) { function findMonorepoRoot(cwd: string = process.cwd()) {
const lockFile = findUpSync( const lockFile = findUpSync('pnpm-lock.yaml', {
['pnpm-lock.yaml', 'yarn.lock', 'package-lock.json'], cwd,
{ type: 'file',
cwd, });
type: 'file',
},
);
return dirname(lockFile || ''); return dirname(lockFile || '');
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/tailwind-config", "name": "@vben/tailwind-config",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/tsconfig", "name": "@vben/tsconfig",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/vite-config", "name": "@vben/vite-config",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",

View File

@ -84,7 +84,7 @@ function defineApplicationConfig(userConfigPromise?: DefineApplicationOptions) {
// 预热文件 // 预热文件
clientFiles: [ clientFiles: [
'./index.html', './index.html',
'./bootstrap.ts', './src/bootstrap.ts',
'./src/{views,layouts,router,store,api}/*', './src/{views,layouts,router,store,api}/*',
], ],
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "vben-admin-monorepo", "name": "vben-admin-monorepo",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"keywords": [ "keywords": [
"monorepo", "monorepo",

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/design", "name": "@vben-core/design",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -142,6 +142,10 @@
@apply outline-primary left-0 top-0 h-full w-full p-1 opacity-100; @apply outline-primary left-0 top-0 h-full w-full p-1 opacity-100;
} }
.vben-link {
@apply text-primary hover:text-primary-hover active:text-primary-active cursor-pointer;
}
.card-box { .card-box {
@apply bg-card text-card-foreground border-border rounded-xl border; @apply bg-card text-card-foreground border-border rounded-xl border;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/icons", "name": "@vben-core/icons",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/shared", "name": "@vben-core/shared",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/typings", "name": "@vben-core/typings",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/composables", "name": "@vben-core/composables",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/preferences", "name": "@vben-core/preferences",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -22,6 +22,7 @@ export function useExpandable(props: FormRenderProps) {
for (let index = 1; index <= rows; index++) { for (let index = 1; index <= rows; index++) {
maxItem += mapping?.[index] ?? 0; maxItem += mapping?.[index] ?? 0;
} }
// 保持一行
return maxItem - 1 || 1; return maxItem - 1 || 1;
}); });
@ -35,6 +36,7 @@ export function useExpandable(props: FormRenderProps) {
if (val) { if (val) {
await nextTick(); await nextTick();
rowMapping.value = {}; rowMapping.value = {};
isCalculated.value = false;
await calculateRowMapping(); await calculateRowMapping();
} }
}, },

View File

@ -279,7 +279,7 @@ function autofocus() {
'flex leading-6', 'flex leading-6',
{ {
'mr-2 flex-shrink-0 justify-end': !isVertical, 'mr-2 flex-shrink-0 justify-end': !isVertical,
'flex-row': isVertical, 'mb-1 flex-row': isVertical,
}, },
labelClass, labelClass,
) )

View File

@ -12,7 +12,7 @@ const props = defineProps<Props>();
</script> </script>
<template> <template>
<FormLabel :class="cn('mb-1 flex items-center', props.class)"> <FormLabel :class="cn('flex items-center', props.class)">
<span v-if="required" class="text-destructive mr-[2px]">*</span> <span v-if="required" class="text-destructive mr-[2px]">*</span>
<slot></slot> <slot></slot>
<VbenHelpTooltip v-if="help" trigger-class="size-3.5 ml-1"> <VbenHelpTooltip v-if="help" trigger-class="size-3.5 ml-1">

View File

@ -39,7 +39,14 @@ const handleUpdateCollapsed = (value: boolean) => {
props.formApi?.setState({ collapsed: !!value }); props.formApi?.setState({ collapsed: !!value });
}; };
function handleKeyDownEnter() { function handleKeyDownEnter(event: KeyboardEvent) {
// textarea
// textarea
if (event.target instanceof HTMLTextAreaElement) {
return;
}
event.preventDefault();
if (!state.value.submitOnEnter || !formActionsRef.value) { if (!state.value.submitOnEnter || !formActionsRef.value) {
return; return;
} }
@ -49,7 +56,7 @@ function handleKeyDownEnter() {
<template> <template>
<Form <Form
@keydown.enter.prevent="handleKeyDownEnter" @keydown.enter="handleKeyDownEnter"
v-bind="forward" v-bind="forward"
:collapsed="state.collapsed" :collapsed="state.collapsed"
:component-bind-event-map="COMPONENT_BIND_EVENT_MAP" :component-bind-event-map="COMPONENT_BIND_EVENT_MAP"

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/layout-ui", "name": "@vben-core/layout-ui",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/menu-ui", "name": "@vben-core/menu-ui",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/shadcn-ui", "name": "@vben-core/shadcn-ui",
"version": "5.4.1", "version": "5.4.2",
"#main": "./dist/index.mjs", "#main": "./dist/index.mjs",
"#module": "./dist/index.mjs", "#module": "./dist/index.mjs",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",

View File

@ -12,12 +12,7 @@ const collapsed = defineModel({ default: false });
<template> <template>
<div <div
:class=" :class="cn('vben-link inline-flex items-center', props.class)"
cn(
'text-primary hover:text-primary-hover inline-flex cursor-pointer items-center',
props.class,
)
"
@click="collapsed = !collapsed" @click="collapsed = !collapsed"
> >
<slot :is-expanded="collapsed"> <slot :is-expanded="collapsed">

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben-core/tabs-ui", "name": "@vben-core/tabs-ui",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/constants", "name": "@vben/constants",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,5 +1,5 @@
/** /**
* @zh_CN url * @zh_CN url
*/ */
export const LOGIN_PATH = '/auth/login'; export const LOGIN_PATH = '/auth/login';

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/access", "name": "@vben/access",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/common-ui", "name": "@vben/common-ui",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -44,7 +44,7 @@ declare global {
const renderLink = (href: string, text: string) => const renderLink = (href: string, text: string) =>
h( h(
'a', 'a',
{ href, target: '_blank', class: 'text-primary hover:text-primary-hover' }, { href, target: '_blank', class: 'vben-link' },
{ default: () => text }, { default: () => text },
); );
@ -114,11 +114,7 @@ const devDependenciesItems = Object.keys(devDependencies).map((key) => ({
<Page :title="title"> <Page :title="title">
<template #description> <template #description>
<p class="text-foreground mt-3 text-sm leading-6"> <p class="text-foreground mt-3 text-sm leading-6">
<a <a :href="VBEN_GITHUB_URL" class="vben-link" target="_blank">
:href="VBEN_GITHUB_URL"
class="text-primary hover:text-primary-hover"
target="_blank"
>
{{ name }} {{ name }}
</a> </a>
{{ description }} {{ description }}

View File

@ -1,8 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormSchema } from '@vben-core/form-ui'; import type { VbenFormSchema } from '@vben-core/form-ui';
import type { LoginCodeEmits } from './types';
import { computed, reactive } from 'vue'; import { computed, reactive } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -19,7 +17,7 @@ interface Props {
*/ */
loading?: boolean; loading?: boolean;
/** /**
* @zh_CN 路径 * @zh_CN 路径
*/ */
loginPath?: string; loginPath?: string;
/** /**
@ -49,12 +47,12 @@ const props = withDefaults(defineProps<Props>(), {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
submit: LoginCodeEmits['submit']; submit: [{ code: string; phoneNumber: string; tenantId: string }];
}>(); }>();
const router = useRouter(); const router = useRouter();
const [Form, { validate, setFieldValue }] = useVbenForm( const [Form, { validate, setFieldValue, getValues }] = useVbenForm(
reactive({ reactive({
commonConfig: { commonConfig: {
hideLabel: true, hideLabel: true,
@ -66,8 +64,8 @@ const [Form, { validate, setFieldValue }] = useVbenForm(
); );
async function handleSubmit() { async function handleSubmit() {
const { valid, values } = await validate(); const { valid } = await validate();
const values = await getValues();
if (valid) { if (valid) {
emit('submit', { emit('submit', {
tenantId: values?.tenantId, tenantId: values?.tenantId,

View File

@ -17,7 +17,7 @@ interface Props {
*/ */
loading?: boolean; loading?: boolean;
/** /**
* @zh_CN 路径 * @zh_CN 路径
*/ */
loginPath?: string; loginPath?: string;
/** /**
@ -47,10 +47,10 @@ const props = withDefaults(defineProps<Props>(), {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
submit: [string]; submit: [Record<string, any>];
}>(); }>();
const [Form, { validate }] = useVbenForm( const [Form, { validate, getValues }] = useVbenForm(
reactive({ reactive({
commonConfig: { commonConfig: {
hideLabel: true, hideLabel: true,
@ -64,10 +64,10 @@ const [Form, { validate }] = useVbenForm(
const router = useRouter(); const router = useRouter();
async function handleSubmit() { async function handleSubmit() {
const { valid, values } = await validate(); const { valid } = await validate();
const values = await getValues();
if (valid) { if (valid) {
emit('submit', values?.email); emit('submit', values);
} }
} }

View File

@ -1,11 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormSchema } from '@vben-core/form-ui'; import type { VbenFormSchema } from '@vben-core/form-ui';
import type { import type { AuthenticationProps, LoginAndRegisterParams } from './types';
AuthenticationProps,
LoginAndRegisterParams,
LoginEmits,
} from './types';
import { computed, onMounted, reactive, ref } from 'vue'; import { computed, onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -13,6 +9,7 @@ import { useRouter } from 'vue-router';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { useVbenForm } from '@vben-core/form-ui'; import { useVbenForm } from '@vben-core/form-ui';
import { VbenButton, VbenCheckbox } from '@vben-core/shadcn-ui'; import { VbenButton, VbenCheckbox } from '@vben-core/shadcn-ui';
import { cloneDeep } from '@vben-core/shared/utils';
import Title from './auth-title.vue'; import Title from './auth-title.vue';
import ThirdPartyLogin from './third-party-login.vue'; import ThirdPartyLogin from './third-party-login.vue';
@ -44,10 +41,10 @@ const props = withDefaults(defineProps<Props>(), {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
submit: LoginEmits['submit']; submit: [LoginAndRegisterParams];
}>(); }>();
const [Form, { setFieldValue, validate }] = useVbenForm( const [Form, { setFieldValue, validate, getValues }] = useVbenForm(
reactive({ reactive({
commonConfig: { commonConfig: {
hideLabel: true, hideLabel: true,
@ -66,7 +63,8 @@ const localUsername = localStorage.getItem(REMEMBER_ME_KEY) || '';
const rememberMe = ref(!!localUsername); const rememberMe = ref(!!localUsername);
async function handleSubmit() { async function handleSubmit() {
const { valid, values } = await validate(); const { valid } = await validate();
const values = cloneDeep(await getValues());
if (valid) { if (valid) {
localStorage.setItem( localStorage.setItem(
REMEMBER_ME_KEY, REMEMBER_ME_KEY,
@ -126,7 +124,7 @@ defineExpose({ setFieldValue });
<span <span
v-if="showForgetPassword" v-if="showForgetPassword"
class="text-primary hover:text-primary-hover active:text-primary-active cursor-pointer text-sm font-normal" class="vben-link text-sm font-normal"
@click="handleGo(forgetPasswordPath)" @click="handleGo(forgetPasswordPath)"
> >
{{ $t('authentication.forgetPassword') }} {{ $t('authentication.forgetPassword') }}
@ -175,7 +173,7 @@ defineExpose({ setFieldValue });
<div v-if="showRegister" class="mt-3 text-center text-sm"> <div v-if="showRegister" class="mt-3 text-center text-sm">
{{ $t('authentication.accountTip') }} {{ $t('authentication.accountTip') }}
<span <span
class="text-primary hover:text-primary-hover active:text-primary-active cursor-pointer text-sm font-normal" class="vben-link text-sm font-normal"
@click="handleGo(registerPath)" @click="handleGo(registerPath)"
> >
{{ $t('authentication.createAccount') }} {{ $t('authentication.createAccount') }}

View File

@ -15,7 +15,7 @@ interface Props {
*/ */
loading?: boolean; loading?: boolean;
/** /**
* @zh_CN 路径 * @zh_CN 路径
*/ */
loginPath?: string; loginPath?: string;
/** /**

View File

@ -1,8 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import type { VbenFormSchema } from '@vben-core/form-ui'; import type { VbenFormSchema } from '@vben-core/form-ui';
import type { RegisterEmits } from './types';
import { computed, reactive } from 'vue'; import { computed, reactive } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -19,7 +18,7 @@ interface Props {
*/ */
loading?: boolean; loading?: boolean;
/** /**
* @zh_CN 路径 * @zh_CN 路径
*/ */
loginPath?: string; loginPath?: string;
/** /**
@ -50,10 +49,10 @@ const props = withDefaults(defineProps<Props>(), {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
submit: RegisterEmits['submit']; submit: [Recordable<any>];
}>(); }>();
const [Form, { validate }] = useVbenForm( const [Form, { validate, getValues }] = useVbenForm(
reactive({ reactive({
commonConfig: { commonConfig: {
hideLabel: true, hideLabel: true,
@ -67,7 +66,8 @@ const [Form, { validate }] = useVbenForm(
const router = useRouter(); const router = useRouter();
async function handleSubmit() { async function handleSubmit() {
const { valid, values } = await validate(); const { valid } = await validate();
const values = await getValues();
if (valid) { if (valid) {
emit('submit', values as { password: string; username: string }); emit('submit', values as { password: string; username: string });
} }
@ -107,10 +107,7 @@ function goToLogin() {
</VbenButton> </VbenButton>
<div class="mt-4 text-center text-sm"> <div class="mt-4 text-center text-sm">
{{ $t('authentication.alreadyHaveAccount') }} {{ $t('authentication.alreadyHaveAccount') }}
<span <span class="vben-link text-sm font-normal" @click="goToLogin()">
class="text-primary hover:text-primary-hover cursor-pointer text-sm font-normal"
@click="goToLogin()"
>
{{ $t('authentication.goToLogin') }} {{ $t('authentication.goToLogin') }}
</span> </span>
</div> </div>

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/hooks", "name": "@vben/hooks",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/layouts", "name": "@vben/layouts",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import { computed, reactive } from 'vue'; import { computed, reactive } from 'vue';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
@ -11,14 +13,6 @@ interface Props {
text?: string; text?: string;
} }
interface LockAndRegisterParams {
lockScreenPassword: string;
}
interface RegisterEmits {
submit: [LockAndRegisterParams];
}
defineOptions({ defineOptions({
name: 'LockScreenModal', name: 'LockScreenModal',
}); });
@ -29,10 +23,10 @@ withDefaults(defineProps<Props>(), {
}); });
const emit = defineEmits<{ const emit = defineEmits<{
submit: RegisterEmits['submit']; submit: [Recordable<any>];
}>(); }>();
const [Form, { resetForm, validate }] = useVbenForm( const [Form, { resetForm, validate, getValues }] = useVbenForm(
reactive({ reactive({
commonConfig: { commonConfig: {
hideLabel: true, hideLabel: true,
@ -68,7 +62,8 @@ const [Modal] = useVbenModal({
}); });
async function handleSubmit() { async function handleSubmit() {
const { valid, values } = await validate(); const { valid } = await validate();
const values = await getValues();
if (valid) { if (valid) {
emit('submit', values?.lockScreenPassword); emit('submit', values?.lockScreenPassword);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/plugins", "name": "@vben/plugins",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/request", "name": "@vben/request",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/icons", "name": "@vben/icons",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/locales", "name": "@vben/locales",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/preferences", "name": "@vben/preferences",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/stores", "name": "@vben/stores",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/styles", "name": "@vben/styles",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/types", "name": "@vben/types",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/utils", "name": "@vben/utils",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://github.com/vbenjs/vue-vben-admin", "homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/playground", "name": "@vben/playground",
"version": "5.4.1", "version": "5.4.2",
"homepage": "https://vben.pro", "homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues", "bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": { "repository": {

View File

@ -1,9 +1,9 @@
{ {
"auth": { "auth": {
"login": "登", "login": "登",
"register": "注册", "register": "注册",
"codeLogin": "验证码登", "codeLogin": "验证码登",
"qrcodeLogin": "二维码登", "qrcodeLogin": "二维码登",
"forgetPassword": "忘记密码" "forgetPassword": "忘记密码"
}, },
"dashboard": { "dashboard": {

View File

@ -15,33 +15,6 @@ const routes: RouteRecordRaw[] = [
name: 'Examples', name: 'Examples',
path: '/examples', path: '/examples',
children: [ children: [
{
name: 'ModalExample',
path: '/examples/modal',
component: () => import('#/views/examples/modal/index.vue'),
meta: {
icon: 'system-uicons:window-content',
title: $t('examples.modal.title'),
},
},
{
name: 'DrawerExample',
path: '/examples/drawer',
component: () => import('#/views/examples/drawer/index.vue'),
meta: {
icon: 'iconoir:drawer',
title: $t('examples.drawer.title'),
},
},
{
name: 'EllipsisExample',
path: '/examples/ellipsis',
component: () => import('#/views/examples/ellipsis/index.vue'),
meta: {
icon: 'ion:ellipsis-horizontal',
title: $t('examples.ellipsis.title'),
},
},
{ {
name: 'FormExample', name: 'FormExample',
path: '/examples/form', path: '/examples/form',
@ -228,6 +201,33 @@ const routes: RouteRecordRaw[] = [
}, },
], ],
}, },
{
name: 'ModalExample',
path: '/examples/modal',
component: () => import('#/views/examples/modal/index.vue'),
meta: {
icon: 'system-uicons:window-content',
title: $t('examples.modal.title'),
},
},
{
name: 'DrawerExample',
path: '/examples/drawer',
component: () => import('#/views/examples/drawer/index.vue'),
meta: {
icon: 'iconoir:drawer',
title: $t('examples.drawer.title'),
},
},
{
name: 'EllipsisExample',
path: '/examples/ellipsis',
component: () => import('#/views/examples/ellipsis/index.vue'),
meta: {
icon: 'ion:ellipsis-horizontal',
title: $t('examples.ellipsis.title'),
},
},
], ],
}, },
]; ];

View File

@ -1,5 +1,4 @@
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { Recordable, UserInfo } from '@vben/types';
import type { UserInfo } from '@vben/types';
import { ref } from 'vue'; import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -27,7 +26,7 @@ export const useAuthStore = defineStore('auth', () => {
* @param onSuccess * @param onSuccess
*/ */
async function authLogin( async function authLogin(
params: LoginAndRegisterParams, params: Recordable<any>,
onSuccess?: () => Promise<void> | void, onSuccess?: () => Promise<void> | void,
) { ) {
// 异步处理用户登录操作并获取 accessToken // 异步处理用户登录操作并获取 accessToken
@ -86,7 +85,7 @@ export const useAuthStore = defineStore('auth', () => {
resetAllStores(); resetAllStores();
accessStore.setLoginExpired(false); accessStore.setLoginExpired(false);
// 回登页带上当前路由地址 // 回登页带上当前路由地址
await router.replace({ await router.replace({
path: LOGIN_PATH, path: LOGIN_PATH,
query: redirect query: redirect

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginCodeParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
@ -49,7 +50,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* Asynchronously handle the login process * Asynchronously handle the login process
* @param values 登录表单数据 * @param values 登录表单数据
*/ */
async function handleLogin(values: LoginCodeParams) { async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(values); console.log(values);
} }

View File

@ -27,7 +27,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: string) { function handleSubmit(value: Record<string, any>) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log('reset email:', value); console.log('reset email:', value);
} }

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui'; import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, h, ref } from 'vue'; import { computed, h, ref } from 'vue';
@ -45,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => {
rules(values) { rules(values) {
const { password } = values; const { password } = values;
return z return z
.string() .string({ required_error: $t('authentication.passwordTip') })
.min(1, { message: $t('authentication.passwordTip') }) .min(1, { message: $t('authentication.passwordTip') })
.refine((value) => value === password, { .refine((value) => value === password, {
message: $t('authentication.confirmPasswordTip'), message: $t('authentication.confirmPasswordTip'),
@ -55,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => {
}, },
fieldName: 'confirmPassword', fieldName: 'confirmPassword',
label: $t('authentication.confirmPassword'), label: $t('authentication.confirmPassword'),
rules: z.string().min(1, { message: $t('authentication.passwordTip') }),
}, },
{ {
component: 'VbenCheckbox', component: 'VbenCheckbox',
@ -67,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => {
h( h(
'a', 'a',
{ {
class: class: 'vben-link ml-1 ',
'cursor-pointer text-primary ml-1 hover:text-primary-hover',
href: '', href: '',
}, },
[ `${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`,
$t('authentication.privacyPolicy'),
'&',
$t('authentication.terms'),
],
), ),
]), ]),
}), }),
@ -86,7 +81,7 @@ const formSchema = computed((): VbenFormSchema[] => {
]; ];
}); });
function handleSubmit(value: LoginAndRegisterParams) { function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log('register submit:', value); console.log('register submit:', value);
} }

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { Recordable } from '@vben/types';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -11,7 +11,7 @@ import { Button, Card } from 'ant-design-vue';
import { useAuthStore } from '#/store'; import { useAuthStore } from '#/store';
const accounts: Record<string, LoginAndRegisterParams> = { const accounts: Record<string, Recordable<any>> = {
admin: { admin: {
password: '123456', password: '123456',
username: 'admin', username: 'admin',

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { LoginAndRegisterParams } from '@vben/common-ui'; import type { Recordable } from '@vben/types';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -11,7 +11,7 @@ import { Button, Card } from 'ant-design-vue';
import { useAuthStore } from '#/store'; import { useAuthStore } from '#/store';
const accounts: Record<string, LoginAndRegisterParams> = { const accounts: Record<string, Recordable<any>> = {
admin: { admin: {
password: '123456', password: '123456',
username: 'admin', username: 'admin',

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/turbo-run", "name": "@vben/turbo-run",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",

View File

@ -1,6 +1,6 @@
{ {
"name": "@vben/vsh", "name": "@vben/vsh",
"version": "5.4.1", "version": "5.4.2",
"private": true, "private": true,
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",