|
@@ -1,8 +1,7 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import type { ExtendedModalApi } from '@vben/common-ui';
|
|
|
|
|
import type { NotificationItem } from '@vben/layouts';
|
|
import type { NotificationItem } from '@vben/layouts';
|
|
|
|
|
|
|
|
-import { computed, onMounted, ref, unref, watch } from 'vue';
|
|
|
|
|
|
|
+import { computed, ref, watch } from 'vue';
|
|
|
|
|
|
|
|
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
|
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
|
|
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
|
|
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
|
|
@@ -12,21 +11,16 @@ import {
|
|
|
BasicLayout,
|
|
BasicLayout,
|
|
|
LockScreen,
|
|
LockScreen,
|
|
|
Notification,
|
|
Notification,
|
|
|
- TimezoneButton,
|
|
|
|
|
UserDropdown,
|
|
UserDropdown,
|
|
|
} from '@vben/layouts';
|
|
} from '@vben/layouts';
|
|
|
import { preferences } from '@vben/preferences';
|
|
import { preferences } from '@vben/preferences';
|
|
|
import { useAccessStore, useUserStore } from '@vben/stores';
|
|
import { useAccessStore, useUserStore } from '@vben/stores';
|
|
|
import { openWindow } from '@vben/utils';
|
|
import { openWindow } from '@vben/utils';
|
|
|
|
|
|
|
|
-import { useMessage } from 'naive-ui';
|
|
|
|
|
-
|
|
|
|
|
-import { getTimezoneOptionsApi } from '#/api';
|
|
|
|
|
import { $t } from '#/locales';
|
|
import { $t } from '#/locales';
|
|
|
-import { useAuthStore, useUserProfileStore } from '#/store';
|
|
|
|
|
|
|
+import { useAuthStore } from '#/store';
|
|
|
import LoginForm from '#/views/_core/authentication/login.vue';
|
|
import LoginForm from '#/views/_core/authentication/login.vue';
|
|
|
|
|
|
|
|
-const message = useMessage();
|
|
|
|
|
const notifications = ref<NotificationItem[]>([
|
|
const notifications = ref<NotificationItem[]>([
|
|
|
{
|
|
{
|
|
|
avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB',
|
|
avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB',
|
|
@@ -66,32 +60,6 @@ const showDot = computed(() =>
|
|
|
notifications.value.some((item) => !item.isRead),
|
|
notifications.value.some((item) => !item.isRead),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
-const userProfileStore = useUserProfileStore();
|
|
|
|
|
-const computedTimezone = computed(() => unref(userProfileStore.timezone));
|
|
|
|
|
-
|
|
|
|
|
-const timezoneOptions = ref<string[]>([]);
|
|
|
|
|
-onMounted(async () => {
|
|
|
|
|
- timezoneOptions.value = ((await getTimezoneOptionsApi()) || []).map(
|
|
|
|
|
- (item) => item.timezone,
|
|
|
|
|
- );
|
|
|
|
|
-});
|
|
|
|
|
-const handleSetTimezone = async (
|
|
|
|
|
- modalApi: ExtendedModalApi,
|
|
|
|
|
- timezone?: string,
|
|
|
|
|
-) => {
|
|
|
|
|
- if (!timezone) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- try {
|
|
|
|
|
- modalApi.setState({ confirmLoading: true });
|
|
|
|
|
- await userProfileStore.setTimezone(timezone);
|
|
|
|
|
- message.success($t('ui.widgets.timezone.setSuccess'));
|
|
|
|
|
- modalApi.close();
|
|
|
|
|
- } finally {
|
|
|
|
|
- modalApi.setState({ confirmLoading: false });
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
const menus = computed(() => [
|
|
const menus = computed(() => [
|
|
|
{
|
|
{
|
|
|
handler: () => {
|
|
handler: () => {
|
|
@@ -180,14 +148,6 @@ watch(
|
|
|
@make-all="handleMakeAll"
|
|
@make-all="handleMakeAll"
|
|
|
/>
|
|
/>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #timezone>
|
|
|
|
|
- <TimezoneButton
|
|
|
|
|
- :ok-handler="handleSetTimezone"
|
|
|
|
|
- :timezone="computedTimezone"
|
|
|
|
|
- :timezone-options="timezoneOptions"
|
|
|
|
|
- name="out"
|
|
|
|
|
- />
|
|
|
|
|
- </template>
|
|
|
|
|
<template #extra>
|
|
<template #extra>
|
|
|
<AuthenticationLoginExpiredModal
|
|
<AuthenticationLoginExpiredModal
|
|
|
v-model:open="accessStore.loginExpired"
|
|
v-model:open="accessStore.loginExpired"
|