Merge remote-tracking branch 'pr-8019-temp/main'
This commit is contained in:
@@ -217,7 +217,12 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicLayout @clear-preferences-and-logout="handleLogout">
|
<BasicLayout
|
||||||
|
:avatar
|
||||||
|
:text="userStore.userInfo?.realName"
|
||||||
|
@clear-preferences-and-logout="handleLogout"
|
||||||
|
@logout="handleLogout"
|
||||||
|
>
|
||||||
<template #user-dropdown>
|
<template #user-dropdown>
|
||||||
<UserDropdown
|
<UserDropdown
|
||||||
:avatar
|
:avatar
|
||||||
@@ -225,7 +230,6 @@ watch(
|
|||||||
:text="userStore.userInfo?.realName"
|
:text="userStore.userInfo?.realName"
|
||||||
description="ann.vben@gmail.com"
|
description="ann.vben@gmail.com"
|
||||||
tag-text="Pro"
|
tag-text="Pro"
|
||||||
@logout="handleLogout"
|
|
||||||
@clear-preferences-and-logout="handleLogout"
|
@clear-preferences-and-logout="handleLogout"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -217,7 +217,12 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicLayout @clear-preferences-and-logout="handleLogout">
|
<BasicLayout
|
||||||
|
:avatar
|
||||||
|
:text="userStore.userInfo?.realName"
|
||||||
|
@clear-preferences-and-logout="handleLogout"
|
||||||
|
@logout="handleLogout"
|
||||||
|
>
|
||||||
<template #user-dropdown>
|
<template #user-dropdown>
|
||||||
<UserDropdown
|
<UserDropdown
|
||||||
:avatar
|
:avatar
|
||||||
@@ -225,7 +230,6 @@ watch(
|
|||||||
:text="userStore.userInfo?.realName"
|
:text="userStore.userInfo?.realName"
|
||||||
description="ann.vben@gmail.com"
|
description="ann.vben@gmail.com"
|
||||||
tag-text="Pro"
|
tag-text="Pro"
|
||||||
@logout="handleLogout"
|
|
||||||
@clear-preferences-and-logout="handleLogout"
|
@clear-preferences-and-logout="handleLogout"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -217,7 +217,12 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicLayout @clear-preferences-and-logout="handleLogout">
|
<BasicLayout
|
||||||
|
:avatar
|
||||||
|
:text="userStore.userInfo?.realName"
|
||||||
|
@clear-preferences-and-logout="handleLogout"
|
||||||
|
@logout="handleLogout"
|
||||||
|
>
|
||||||
<template #user-dropdown>
|
<template #user-dropdown>
|
||||||
<UserDropdown
|
<UserDropdown
|
||||||
:avatar
|
:avatar
|
||||||
@@ -225,7 +230,6 @@ watch(
|
|||||||
:text="userStore.userInfo?.realName"
|
:text="userStore.userInfo?.realName"
|
||||||
description="ann.vben@gmail.com"
|
description="ann.vben@gmail.com"
|
||||||
tag-text="Pro"
|
tag-text="Pro"
|
||||||
@logout="handleLogout"
|
|
||||||
@clear-preferences-and-logout="handleLogout"
|
@clear-preferences-and-logout="handleLogout"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -217,7 +217,12 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicLayout @clear-preferences-and-logout="handleLogout">
|
<BasicLayout
|
||||||
|
:avatar
|
||||||
|
:text="userStore.userInfo?.realName"
|
||||||
|
@clear-preferences-and-logout="handleLogout"
|
||||||
|
@logout="handleLogout"
|
||||||
|
>
|
||||||
<template #user-dropdown>
|
<template #user-dropdown>
|
||||||
<UserDropdown
|
<UserDropdown
|
||||||
:avatar
|
:avatar
|
||||||
@@ -225,7 +230,6 @@ watch(
|
|||||||
:text="userStore.userInfo?.realName"
|
:text="userStore.userInfo?.realName"
|
||||||
description="ann.vben@gmail.com"
|
description="ann.vben@gmail.com"
|
||||||
tag-text="Pro"
|
tag-text="Pro"
|
||||||
@logout="handleLogout"
|
|
||||||
@clear-preferences-and-logout="handleLogout"
|
@clear-preferences-and-logout="handleLogout"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -217,7 +217,12 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BasicLayout @clear-preferences-and-logout="handleLogout">
|
<BasicLayout
|
||||||
|
:avatar
|
||||||
|
:text="userStore.userInfo?.realName"
|
||||||
|
@clear-preferences-and-logout="handleLogout"
|
||||||
|
@logout="handleLogout"
|
||||||
|
>
|
||||||
<template #user-dropdown>
|
<template #user-dropdown>
|
||||||
<UserDropdown
|
<UserDropdown
|
||||||
:avatar
|
:avatar
|
||||||
@@ -225,7 +230,6 @@ watch(
|
|||||||
:text="userStore.userInfo?.realName"
|
:text="userStore.userInfo?.realName"
|
||||||
description="ann.vben@gmail.com"
|
description="ann.vben@gmail.com"
|
||||||
tag-text="Pro"
|
tag-text="Pro"
|
||||||
@logout="handleLogout"
|
|
||||||
@clear-preferences-and-logout="handleLogout"
|
@clear-preferences-and-logout="handleLogout"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,25 +2,38 @@
|
|||||||
import { computed, useSlots } from 'vue';
|
import { computed, useSlots } from 'vue';
|
||||||
|
|
||||||
import { useRefresh } from '@vben/hooks';
|
import { useRefresh } from '@vben/hooks';
|
||||||
import { RotateCw } from '@vben/icons';
|
import { LockKeyhole, LogOut, RotateCw } from '@vben/icons';
|
||||||
|
import { $t } from '@vben/locales';
|
||||||
import { preferences, usePreferences } from '@vben/preferences';
|
import { preferences, usePreferences } from '@vben/preferences';
|
||||||
import { useAccessStore } from '@vben/stores';
|
import { useAccessStore } from '@vben/stores';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben-core/popup-ui';
|
||||||
import { VbenFullScreen, VbenIconButton } from '@vben-core/shadcn-ui';
|
import { VbenFullScreen, VbenIconButton } from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
|
import { useMagicKeys, whenever } from '@vueuse/core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
GlobalSearch,
|
GlobalSearch,
|
||||||
LanguageToggle,
|
LanguageToggle,
|
||||||
|
LockScreenModal,
|
||||||
PreferencesButton,
|
PreferencesButton,
|
||||||
ThemeToggle,
|
ThemeToggle,
|
||||||
TimezoneButton,
|
TimezoneButton,
|
||||||
} from '../../widgets';
|
} from '../../widgets';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
/**
|
||||||
|
* 头像
|
||||||
|
*/
|
||||||
|
avatar?: string;
|
||||||
/**
|
/**
|
||||||
* Logo 主题
|
* Logo 主题
|
||||||
*/
|
*/
|
||||||
theme?: string;
|
theme?: string;
|
||||||
|
/**
|
||||||
|
* 用户文本
|
||||||
|
*/
|
||||||
|
text?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@@ -28,18 +41,79 @@ defineOptions({
|
|||||||
});
|
});
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
withDefaults(defineProps<Props>(), {
|
||||||
|
avatar: '',
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
|
text: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
|
const emit = defineEmits<{
|
||||||
|
clearPreferencesAndLogout: [];
|
||||||
|
logout: [];
|
||||||
|
openLockScreen: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
const REFERENCE_VALUE = 100;
|
const REFERENCE_VALUE = 100;
|
||||||
|
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
const { globalSearchShortcutKey, preferencesButtonPosition } = usePreferences();
|
const {
|
||||||
|
globalLockScreenShortcutKey,
|
||||||
|
globalLogoutShortcutKey,
|
||||||
|
globalSearchShortcutKey,
|
||||||
|
preferencesButtonPosition,
|
||||||
|
} = usePreferences();
|
||||||
const slots = useSlots();
|
const slots = useSlots();
|
||||||
const { refresh } = useRefresh();
|
const { refresh } = useRefresh();
|
||||||
|
|
||||||
|
const [LockModal, lockModalApi] = useVbenModal({
|
||||||
|
connectedComponent: LockScreenModal,
|
||||||
|
});
|
||||||
|
const [LogoutModal, logoutModalApi] = useVbenModal({
|
||||||
|
onConfirm() {
|
||||||
|
handleSubmitLogout();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleOpenLock() {
|
||||||
|
lockModalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSubmitLock(lockScreenPassword: string) {
|
||||||
|
lockModalApi.close();
|
||||||
|
accessStore.lockScreen(lockScreenPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLogout() {
|
||||||
|
logoutModalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSubmitLogout() {
|
||||||
|
emit('logout');
|
||||||
|
logoutModalApi.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 快捷键
|
||||||
|
if (preferences.shortcutKeys.enable) {
|
||||||
|
const keys = useMagicKeys();
|
||||||
|
const lockKey = keys['Alt+KeyL'];
|
||||||
|
const logoutKey = keys['Alt+KeyQ'];
|
||||||
|
|
||||||
|
if (lockKey) {
|
||||||
|
whenever(lockKey, () => {
|
||||||
|
if (globalLockScreenShortcutKey?.value) {
|
||||||
|
handleOpenLock();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (logoutKey) {
|
||||||
|
whenever(logoutKey, () => {
|
||||||
|
if (globalLogoutShortcutKey?.value) {
|
||||||
|
handleLogout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插槽列表类型
|
* 插槽列表类型
|
||||||
*/
|
*/
|
||||||
@@ -95,6 +169,18 @@ const rightSlots = computed(() => {
|
|||||||
name: 'notification',
|
name: 'notification',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 锁定屏幕
|
||||||
|
if (preferences.widget.lockScreen) {
|
||||||
|
list.push({
|
||||||
|
index: REFERENCE_VALUE + 70,
|
||||||
|
name: 'lock-screen-btn',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 退出登录
|
||||||
|
list.push({
|
||||||
|
index: REFERENCE_VALUE + 80,
|
||||||
|
name: 'logout-btn',
|
||||||
|
});
|
||||||
|
|
||||||
Object.keys(slots).forEach((key) => {
|
Object.keys(slots).forEach((key) => {
|
||||||
// 适配插槽名称,例如第一个插槽名:header-right-1
|
// 适配插槽名称,例如第一个插槽名:header-right-1
|
||||||
@@ -151,6 +237,26 @@ function clearPreferencesAndLogout() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<LockModal
|
||||||
|
v-if="preferences.widget.lockScreen"
|
||||||
|
:avatar="avatar"
|
||||||
|
:text="text"
|
||||||
|
@submit="handleSubmitLock"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LogoutModal
|
||||||
|
:cancel-text="$t('common.cancel')"
|
||||||
|
:confirm-text="$t('common.confirm')"
|
||||||
|
:fullscreen-button="false"
|
||||||
|
:title="$t('common.prompt')"
|
||||||
|
centered
|
||||||
|
content-class="px-8 min-h-10"
|
||||||
|
footer-class="border-none mb-3 mr-3"
|
||||||
|
header-class="border-none"
|
||||||
|
>
|
||||||
|
{{ $t('ui.widgets.logoutTip') }}
|
||||||
|
</LogoutModal>
|
||||||
|
|
||||||
<template
|
<template
|
||||||
v-for="slot in leftSlots.filter((item) => item.index < REFERENCE_VALUE)"
|
v-for="slot in leftSlots.filter((item) => item.index < REFERENCE_VALUE)"
|
||||||
:key="slot.name"
|
:key="slot.name"
|
||||||
@@ -207,6 +313,24 @@ function clearPreferencesAndLogout() {
|
|||||||
<template v-else-if="slot.name === 'timezone'">
|
<template v-else-if="slot.name === 'timezone'">
|
||||||
<TimezoneButton class="mt-0.5 mr-1" />
|
<TimezoneButton class="mt-0.5 mr-1" />
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="slot.name === 'lock-screen-btn'">
|
||||||
|
<VbenIconButton
|
||||||
|
class="mr-1"
|
||||||
|
:tooltip="$t('ui.widgets.lockScreen.title')"
|
||||||
|
@click="handleOpenLock"
|
||||||
|
>
|
||||||
|
<LockKeyhole class="size-4" />
|
||||||
|
</VbenIconButton>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="slot.name === 'logout-btn'">
|
||||||
|
<VbenIconButton
|
||||||
|
class="mr-1"
|
||||||
|
:tooltip="$t('common.logout')"
|
||||||
|
@click="handleLogout"
|
||||||
|
>
|
||||||
|
<LogOut class="size-4" />
|
||||||
|
</VbenIconButton>
|
||||||
|
</template>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,7 +36,21 @@ import { LayoutTabbar } from './tabbar';
|
|||||||
|
|
||||||
defineOptions({ name: 'BasicLayout' });
|
defineOptions({ name: 'BasicLayout' });
|
||||||
|
|
||||||
const emit = defineEmits<{ clearPreferencesAndLogout: []; clickLogo: [] }>();
|
withDefaults(defineProps<Props>(), {
|
||||||
|
avatar: '',
|
||||||
|
text: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
clearPreferencesAndLogout: [];
|
||||||
|
clickLogo: [];
|
||||||
|
logout: [];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
avatar?: string;
|
||||||
|
text?: string;
|
||||||
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isDark,
|
isDark,
|
||||||
@@ -176,6 +190,10 @@ function clearPreferencesAndLogout() {
|
|||||||
emit('clearPreferencesAndLogout');
|
emit('clearPreferencesAndLogout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleLogout() {
|
||||||
|
emit('logout');
|
||||||
|
}
|
||||||
|
|
||||||
function clickLogo() {
|
function clickLogo() {
|
||||||
emit('clickLogo');
|
emit('clickLogo');
|
||||||
}
|
}
|
||||||
@@ -317,8 +335,11 @@ const headerSlots = computed(() => {
|
|||||||
<!-- 头部区域 -->
|
<!-- 头部区域 -->
|
||||||
<template #header>
|
<template #header>
|
||||||
<LayoutHeader
|
<LayoutHeader
|
||||||
|
:avatar="avatar"
|
||||||
:theme="theme"
|
:theme="theme"
|
||||||
|
:text="text"
|
||||||
@clear-preferences-and-logout="clearPreferencesAndLogout"
|
@clear-preferences-and-logout="clearPreferencesAndLogout"
|
||||||
|
@logout="handleLogout"
|
||||||
>
|
>
|
||||||
<template
|
<template
|
||||||
v-if="!showHeaderNav && preferences.breadcrumb.enable"
|
v-if="!showHeaderNav && preferences.breadcrumb.enable"
|
||||||
|
|||||||
@@ -3,16 +3,13 @@ import type { Component } from 'vue';
|
|||||||
|
|
||||||
import type { AnyFunction } from '@vben/types';
|
import type { AnyFunction } from '@vben/types';
|
||||||
|
|
||||||
import { computed, useTemplateRef, watch } from 'vue';
|
import { useTemplateRef, watch } from 'vue';
|
||||||
|
|
||||||
import { useHoverToggle } from '@vben/hooks';
|
import { useHoverToggle } from '@vben/hooks';
|
||||||
import { LockKeyhole, LogOut, Settings } from '@vben/icons';
|
import { Settings } from '@vben/icons';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
import { preferences, usePreferences } from '@vben/preferences';
|
import { usePreferences } from '@vben/preferences';
|
||||||
import { useAccessStore } from '@vben/stores';
|
|
||||||
import { isWindowsOs } from '@vben/utils';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben-core/popup-ui';
|
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@@ -20,15 +17,11 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuLabel,
|
DropdownMenuLabel,
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuShortcut,
|
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
VbenAvatar,
|
VbenAvatar,
|
||||||
VbenIcon,
|
VbenIcon,
|
||||||
} from '@vben-core/shadcn-ui';
|
} from '@vben-core/shadcn-ui';
|
||||||
|
|
||||||
import { useMagicKeys, whenever } from '@vueuse/core';
|
|
||||||
|
|
||||||
import { LockScreenModal } from '../lock-screen';
|
|
||||||
import { Preferences } from '../preferences';
|
import { Preferences } from '../preferences';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -40,10 +33,6 @@ interface Props {
|
|||||||
* @zh_CN 描述
|
* @zh_CN 描述
|
||||||
*/
|
*/
|
||||||
description?: string;
|
description?: string;
|
||||||
/**
|
|
||||||
* 是否启用快捷键
|
|
||||||
*/
|
|
||||||
enableShortcutKey?: boolean;
|
|
||||||
/**
|
/**
|
||||||
* 菜单数组
|
* 菜单数组
|
||||||
*/
|
*/
|
||||||
@@ -74,31 +63,16 @@ defineOptions({
|
|||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
description: '',
|
description: '',
|
||||||
enableShortcutKey: true,
|
|
||||||
menus: () => [],
|
menus: () => [],
|
||||||
showShortcutKey: true,
|
|
||||||
tagText: '',
|
tagText: '',
|
||||||
text: '',
|
text: '',
|
||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
hoverDelay: 500,
|
hoverDelay: 500,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{ clearPreferencesAndLogout: []; logout: [] }>();
|
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
|
||||||
|
|
||||||
const {
|
const { preferencesButtonPosition } = usePreferences();
|
||||||
globalLockScreenShortcutKey,
|
|
||||||
globalLogoutShortcutKey,
|
|
||||||
preferencesButtonPosition,
|
|
||||||
} = usePreferences();
|
|
||||||
const accessStore = useAccessStore();
|
|
||||||
const [LockModal, lockModalApi] = useVbenModal({
|
|
||||||
connectedComponent: LockScreenModal,
|
|
||||||
});
|
|
||||||
const [LogoutModal, logoutModalApi] = useVbenModal({
|
|
||||||
onConfirm() {
|
|
||||||
handleSubmitLogout();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const refTrigger = useTemplateRef('refTrigger');
|
const refTrigger = useTemplateRef('refTrigger');
|
||||||
const refContent = useTemplateRef('refContent');
|
const refContent = useTemplateRef('refContent');
|
||||||
@@ -122,89 +96,13 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const altView = computed(() => (isWindowsOs() ? 'Alt' : '⌥'));
|
|
||||||
|
|
||||||
const enableLogoutShortcutKey = computed(() => {
|
|
||||||
return props.enableShortcutKey && globalLogoutShortcutKey.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
const enableLockScreenShortcutKey = computed(() => {
|
|
||||||
return props.enableShortcutKey && globalLockScreenShortcutKey.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
const enableShortcutKey = computed(() => {
|
|
||||||
return props.enableShortcutKey && preferences.shortcutKeys.enable;
|
|
||||||
});
|
|
||||||
|
|
||||||
function handleOpenLock() {
|
|
||||||
lockModalApi.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSubmitLock(lockScreenPassword: string) {
|
|
||||||
lockModalApi.close();
|
|
||||||
accessStore.lockScreen(lockScreenPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleLogout() {
|
|
||||||
// emit
|
|
||||||
logoutModalApi.open();
|
|
||||||
openPopover.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSubmitLogout() {
|
|
||||||
emit('logout');
|
|
||||||
logoutModalApi.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置 - 打开偏好设置抽屉
|
// 设置 - 打开偏好设置抽屉
|
||||||
function handleOpenSettings() {
|
function handleOpenSettings() {
|
||||||
refPreferences.value?.open();
|
refPreferences.value?.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableShortcutKey.value) {
|
|
||||||
const keys = useMagicKeys();
|
|
||||||
const logoutKey = keys['Alt+KeyQ'];
|
|
||||||
const lockKey = keys['Alt+KeyL'];
|
|
||||||
|
|
||||||
if (logoutKey) {
|
|
||||||
whenever(logoutKey, () => {
|
|
||||||
if (enableLogoutShortcutKey.value) {
|
|
||||||
handleLogout();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lockKey) {
|
|
||||||
whenever(lockKey, () => {
|
|
||||||
if (enableLockScreenShortcutKey.value) {
|
|
||||||
handleOpenLock();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LockModal
|
|
||||||
v-if="preferences.widget.lockScreen"
|
|
||||||
:avatar="avatar"
|
|
||||||
:text="text"
|
|
||||||
@submit="handleSubmitLock"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LogoutModal
|
|
||||||
:cancel-text="$t('common.cancel')"
|
|
||||||
:confirm-text="$t('common.confirm')"
|
|
||||||
:fullscreen-button="false"
|
|
||||||
:title="$t('common.prompt')"
|
|
||||||
centered
|
|
||||||
content-class="px-8 min-h-10"
|
|
||||||
footer-class="border-none mb-3 mr-3"
|
|
||||||
header-class="border-none"
|
|
||||||
>
|
|
||||||
{{ $t('ui.widgets.logoutTip') }}
|
|
||||||
</LogoutModal>
|
|
||||||
|
|
||||||
<Preferences
|
<Preferences
|
||||||
v-if="preferencesButtonPosition.userDropdown"
|
v-if="preferencesButtonPosition.userDropdown"
|
||||||
ref="refPreferences"
|
ref="refPreferences"
|
||||||
@@ -261,7 +159,7 @@ if (enableShortcutKey.value) {
|
|||||||
<VbenIcon :icon="menu.icon" class="mr-2 size-4" />
|
<VbenIcon :icon="menu.icon" class="mr-2 size-4" />
|
||||||
{{ menu.text }}
|
{{ menu.text }}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator v-if="preferencesButtonPosition.userDropdown" />
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
v-if="preferencesButtonPosition.userDropdown"
|
v-if="preferencesButtonPosition.userDropdown"
|
||||||
class="mx-1 flex cursor-pointer items-center rounded-sm py-1 leading-8"
|
class="mx-1 flex cursor-pointer items-center rounded-sm py-1 leading-8"
|
||||||
@@ -270,28 +168,6 @@ if (enableShortcutKey.value) {
|
|||||||
<Settings class="mr-2 size-4" />
|
<Settings class="mr-2 size-4" />
|
||||||
{{ $t('preferences.title') }}
|
{{ $t('preferences.title') }}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem
|
|
||||||
v-if="preferences.widget.lockScreen"
|
|
||||||
class="mx-1 flex cursor-pointer items-center rounded-sm py-1 leading-8"
|
|
||||||
@click="handleOpenLock"
|
|
||||||
>
|
|
||||||
<LockKeyhole class="mr-2 size-4" />
|
|
||||||
{{ $t('ui.widgets.lockScreen.title') }}
|
|
||||||
<DropdownMenuShortcut v-if="enableLockScreenShortcutKey">
|
|
||||||
{{ altView }} L
|
|
||||||
</DropdownMenuShortcut>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuSeparator v-if="preferences.widget.lockScreen" />
|
|
||||||
<DropdownMenuItem
|
|
||||||
class="mx-1 flex cursor-pointer items-center rounded-sm py-1 leading-8"
|
|
||||||
@click="handleLogout"
|
|
||||||
>
|
|
||||||
<LogOut class="mr-2 size-4" />
|
|
||||||
{{ $t('common.logout') }}
|
|
||||||
<DropdownMenuShortcut v-if="enableLogoutShortcutKey">
|
|
||||||
{{ altView }} Q
|
|
||||||
</DropdownMenuShortcut>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|||||||
Reference in New Issue
Block a user