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

View File

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

View File

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

View File

@@ -15,33 +15,6 @@ const routes: RouteRecordRaw[] = [
name: 'Examples',
path: '/examples',
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',
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 { UserInfo } from '@vben/types';
import type { Recordable, UserInfo } from '@vben/types';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
@@ -27,7 +26,7 @@ export const useAuthStore = defineStore('auth', () => {
* @param onSuccess 成功之后的回调函数
*/
async function authLogin(
params: LoginAndRegisterParams,
params: Recordable<any>,
onSuccess?: () => Promise<void> | void,
) {
// 异步处理用户登录操作并获取 accessToken
@@ -86,7 +85,7 @@ export const useAuthStore = defineStore('auth', () => {
resetAllStores();
accessStore.setLoginExpired(false);
// 回登页带上当前路由地址
// 回登页带上当前路由地址
await router.replace({
path: LOGIN_PATH,
query: redirect

View File

@@ -1,5 +1,6 @@
<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';
@@ -49,7 +50,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* Asynchronously handle the login process
* @param values 登录表单数据
*/
async function handleLogin(values: LoginCodeParams) {
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
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
console.log('reset email:', value);
}

View File

@@ -1,5 +1,6 @@
<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';
@@ -45,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => {
rules(values) {
const { password } = values;
return z
.string()
.string({ required_error: $t('authentication.passwordTip') })
.min(1, { message: $t('authentication.passwordTip') })
.refine((value) => value === password, {
message: $t('authentication.confirmPasswordTip'),
@@ -55,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => {
},
fieldName: 'confirmPassword',
label: $t('authentication.confirmPassword'),
rules: z.string().min(1, { message: $t('authentication.passwordTip') }),
},
{
component: 'VbenCheckbox',
@@ -67,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => {
h(
'a',
{
class:
'cursor-pointer text-primary ml-1 hover:text-primary-hover',
class: 'vben-link ml-1 ',
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
console.log('register submit:', value);
}

View File

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

View File

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