feat: login dialog (#37)

* chore: login-dialog demo

* Merge branch 'main' into login-dialog

* chore: update dialog

* Merge branch 'main' into login-dialog

* chore: accept login params

* chore: redirect to login or show login dialog
This commit is contained in:
Li Kui
2024-07-11 11:05:01 +08:00
committed by GitHub
parent 0f246f7e9e
commit 8e6c1abf19
13 changed files with 174 additions and 73 deletions

View File

@@ -1,12 +1,16 @@
<script lang="ts" setup>
import type { NotificationItem } from '@vben/layouts';
import { computed, ref } from 'vue';
import { computed, ref, toRefs } from 'vue';
import { useRouter } from 'vue-router';
import { LOGIN_PATH } from '@vben/constants';
import { IcRoundCreditScore, MdiDriveDocument, MdiGithub } from '@vben/icons';
import { BasicLayout, Notification, UserDropdown } from '@vben/layouts';
import {
BasicLayout,
LoginDialog,
Notification,
NotificationItem,
UserDropdown,
} from '@vben/layouts';
import { openWindow } from '@vben/utils';
import { preferences } from '@vben-core/preferences';
@@ -80,7 +84,8 @@ const menus = computed(() => [
]);
const appStore = useAppStore();
const { userInfo } = useAccessStore();
const accessStore = useAccessStore();
const { showLoginDialog, userInfo } = toRefs(accessStore);
const router = useRouter();
async function handleLogout() {
@@ -118,5 +123,13 @@ function handleMakeAll() {
@make-all="handleMakeAll"
/>
</template>
<template #dialog>
<LoginDialog
:open="showLoginDialog"
password-placeholder="123456"
username-placeholder="vben"
@login="accessStore.authLogin"
/>
</template>
</BasicLayout>
</template>