feat: increase support for multiple time zones
This commit is contained in:
@@ -5,6 +5,5 @@ export const setTimezone = (timeZone: string) => {
|
||||
};
|
||||
|
||||
export const getTimezone = () => {
|
||||
console.log('mockTimeZone', mockTimeZone);
|
||||
return mockTimeZone;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { ExtendedModalApi } from '@vben/common-ui';
|
||||
import type { NotificationItem } from '@vben/layouts';
|
||||
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, onMounted, ref, unref, watch } from 'vue';
|
||||
|
||||
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
||||
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
|
||||
@@ -66,7 +66,7 @@ const showDot = computed(() =>
|
||||
);
|
||||
|
||||
const userProfileStore = useUserProfileStore();
|
||||
const computedTimezone = computed(() => userProfileStore.timezone);
|
||||
const computedTimezone = computed(() => unref(userProfileStore.timezone));
|
||||
|
||||
const timezoneOptions = ref<string[]>([]);
|
||||
onMounted(async () => {
|
||||
@@ -75,9 +75,12 @@ onMounted(async () => {
|
||||
);
|
||||
});
|
||||
const handleSetTimezone = async (
|
||||
timezone: string,
|
||||
modalApi: ExtendedModalApi,
|
||||
timezone?: string,
|
||||
) => {
|
||||
if (!timezone) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
await userProfileStore.setTimezone(timezone);
|
||||
|
||||
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
|
||||
* @param timezone 时区字符串
|
||||
*/
|
||||
async function setTimezone(timezone: string) {
|
||||
// 保存用户的时区设置
|
||||
await setUserTimezoneApi(timezone);
|
||||
timezoneRef.value = timezone;
|
||||
// 设置dayjs默认时区
|
||||
setDefaultTimezone(timezone);
|
||||
// 保存用户的时区设置
|
||||
await setUserTimezoneApi(timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { ExtendedModalApi } from '@vben/common-ui';
|
||||
import type { NotificationItem } from '@vben/layouts';
|
||||
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, onMounted, ref, unref, watch } from 'vue';
|
||||
|
||||
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
||||
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
|
||||
@@ -66,7 +66,7 @@ const showDot = computed(() =>
|
||||
);
|
||||
|
||||
const userProfileStore = useUserProfileStore();
|
||||
const computedTimezone = computed(() => userProfileStore.timezone);
|
||||
const computedTimezone = computed(() => unref(userProfileStore.timezone));
|
||||
|
||||
const timezoneOptions = ref<string[]>([]);
|
||||
onMounted(async () => {
|
||||
@@ -75,9 +75,12 @@ onMounted(async () => {
|
||||
);
|
||||
});
|
||||
const handleSetTimezone = async (
|
||||
timezone: string,
|
||||
modalApi: ExtendedModalApi,
|
||||
timezone?: string,
|
||||
) => {
|
||||
if (!timezone) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
await userProfileStore.setTimezone(timezone);
|
||||
|
||||
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
|
||||
* @param timezone 时区字符串
|
||||
*/
|
||||
async function setTimezone(timezone: string) {
|
||||
// 保存用户的时区设置
|
||||
await setUserTimezoneApi(timezone);
|
||||
timezoneRef.value = timezone;
|
||||
// 设置dayjs默认时区
|
||||
setDefaultTimezone(timezone);
|
||||
// 保存用户的时区设置
|
||||
await setUserTimezoneApi(timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { ExtendedModalApi } from '@vben/common-ui';
|
||||
import type { NotificationItem } from '@vben/layouts';
|
||||
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { computed, onMounted, ref, unref, watch } from 'vue';
|
||||
|
||||
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
||||
import { VBEN_DOC_URL, VBEN_GITHUB_URL } from '@vben/constants';
|
||||
@@ -67,7 +67,7 @@ const showDot = computed(() =>
|
||||
);
|
||||
|
||||
const userProfileStore = useUserProfileStore();
|
||||
const computedTimezone = computed(() => userProfileStore.timezone);
|
||||
const computedTimezone = computed(() => unref(userProfileStore.timezone));
|
||||
|
||||
const timezoneOptions = ref<string[]>([]);
|
||||
onMounted(async () => {
|
||||
@@ -76,9 +76,12 @@ onMounted(async () => {
|
||||
);
|
||||
});
|
||||
const handleSetTimezone = async (
|
||||
timezone: string,
|
||||
modalApi: ExtendedModalApi,
|
||||
timezone?: string,
|
||||
) => {
|
||||
if (!timezone) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
modalApi.setState({ confirmLoading: true });
|
||||
await userProfileStore.setTimezone(timezone);
|
||||
|
||||
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
|
||||
* @param timezone 时区字符串
|
||||
*/
|
||||
async function setTimezone(timezone: string) {
|
||||
// 保存用户的时区设置
|
||||
await setUserTimezoneApi(timezone);
|
||||
timezoneRef.value = timezone;
|
||||
// 设置dayjs默认时区
|
||||
setDefaultTimezone(timezone);
|
||||
// 保存用户的时区设置
|
||||
await setUserTimezoneApi(timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user