Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b029f77b
authored
Oct 22, 2025
by
zhongming4762
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: increase support for multiple time zones
1 parent
0a8339a4
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
33 additions
and
22 deletions
apps/backend-mock/utils/timezone-utils.ts
apps/web-antd/src/layouts/basic.vue
apps/web-antd/src/store/user-profile.ts
apps/web-ele/src/layouts/basic.vue
apps/web-ele/src/store/user-profile.ts
apps/web-naive/src/layouts/basic.vue
apps/web-naive/src/store/user-profile.ts
packages/@core/preferences/__tests__/__snapshots__/config.test.ts.snap
packages/effects/layouts/src/widgets/timezone/timezone-button.vue
packages/effects/plugins/src/echarts/use-echarts.ts
apps/backend-mock/utils/timezone-utils.ts
View file @
b029f77
...
@@ -5,6 +5,5 @@ export const setTimezone = (timeZone: string) => {
...
@@ -5,6 +5,5 @@ export const setTimezone = (timeZone: string) => {
};
};
export
const
getTimezone
=
()
=>
{
export
const
getTimezone
=
()
=>
{
console
.
log
(
'mockTimeZone'
,
mockTimeZone
);
return
mockTimeZone
;
return
mockTimeZone
;
};
};
apps/web-antd/src/layouts/basic.vue
View file @
b029f77
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
type
{
ExtendedModalApi
}
from
'@vben/common-ui'
;
import
type
{
ExtendedModalApi
}
from
'@vben/common-ui'
;
import
type
{
NotificationItem
}
from
'@vben/layouts'
;
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
{
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'
;
...
@@ -66,7 +66,7 @@ const showDot = computed(() =>
...
@@ -66,7 +66,7 @@ const showDot = computed(() =>
);
);
const
userProfileStore
=
useUserProfileStore
();
const
userProfileStore
=
useUserProfileStore
();
const
computedTimezone
=
computed
(()
=>
u
serProfileStore
.
timezone
);
const
computedTimezone
=
computed
(()
=>
u
nref
(
userProfileStore
.
timezone
)
);
const
timezoneOptions
=
ref
<
string
[]
>
([]);
const
timezoneOptions
=
ref
<
string
[]
>
([]);
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -75,9 +75,12 @@ onMounted(async () => {
...
@@ -75,9 +75,12 @@ onMounted(async () => {
);
);
});
});
const
handleSetTimezone
=
async
(
const
handleSetTimezone
=
async
(
timezone
:
string
,
modalApi
:
ExtendedModalApi
,
modalApi
:
ExtendedModalApi
,
timezone
?:
string
,
)
=>
{
)
=>
{
if
(
!
timezone
)
{
return
;
}
try
{
try
{
modalApi
.
setState
({
confirmLoading
:
true
});
modalApi
.
setState
({
confirmLoading
:
true
});
await
userProfileStore
.
setTimezone
(
timezone
);
await
userProfileStore
.
setTimezone
(
timezone
);
...
...
apps/web-antd/src/store/user-profile.ts
View file @
b029f77
...
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
...
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
* @param timezone 时区字符串
* @param timezone 时区字符串
*/
*/
async
function
setTimezone
(
timezone
:
string
)
{
async
function
setTimezone
(
timezone
:
string
)
{
// 保存用户的时区设置
await
setUserTimezoneApi
(
timezone
);
timezoneRef
.
value
=
timezone
;
timezoneRef
.
value
=
timezone
;
// 设置dayjs默认时区
// 设置dayjs默认时区
setDefaultTimezone
(
timezone
);
setDefaultTimezone
(
timezone
);
// 保存用户的时区设置
await
setUserTimezoneApi
(
timezone
);
}
}
/**
/**
...
...
apps/web-ele/src/layouts/basic.vue
View file @
b029f77
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
type
{
ExtendedModalApi
}
from
'@vben/common-ui'
;
import
type
{
ExtendedModalApi
}
from
'@vben/common-ui'
;
import
type
{
NotificationItem
}
from
'@vben/layouts'
;
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
{
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'
;
...
@@ -66,7 +66,7 @@ const showDot = computed(() =>
...
@@ -66,7 +66,7 @@ const showDot = computed(() =>
);
);
const
userProfileStore
=
useUserProfileStore
();
const
userProfileStore
=
useUserProfileStore
();
const
computedTimezone
=
computed
(()
=>
u
serProfileStore
.
timezone
);
const
computedTimezone
=
computed
(()
=>
u
nref
(
userProfileStore
.
timezone
)
);
const
timezoneOptions
=
ref
<
string
[]
>
([]);
const
timezoneOptions
=
ref
<
string
[]
>
([]);
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -75,9 +75,12 @@ onMounted(async () => {
...
@@ -75,9 +75,12 @@ onMounted(async () => {
);
);
});
});
const
handleSetTimezone
=
async
(
const
handleSetTimezone
=
async
(
timezone
:
string
,
modalApi
:
ExtendedModalApi
,
modalApi
:
ExtendedModalApi
,
timezone
?:
string
,
)
=>
{
)
=>
{
if
(
!
timezone
)
{
return
;
}
try
{
try
{
modalApi
.
setState
({
confirmLoading
:
true
});
modalApi
.
setState
({
confirmLoading
:
true
});
await
userProfileStore
.
setTimezone
(
timezone
);
await
userProfileStore
.
setTimezone
(
timezone
);
...
...
apps/web-ele/src/store/user-profile.ts
View file @
b029f77
...
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
...
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
* @param timezone 时区字符串
* @param timezone 时区字符串
*/
*/
async
function
setTimezone
(
timezone
:
string
)
{
async
function
setTimezone
(
timezone
:
string
)
{
// 保存用户的时区设置
await
setUserTimezoneApi
(
timezone
);
timezoneRef
.
value
=
timezone
;
timezoneRef
.
value
=
timezone
;
// 设置dayjs默认时区
// 设置dayjs默认时区
setDefaultTimezone
(
timezone
);
setDefaultTimezone
(
timezone
);
// 保存用户的时区设置
await
setUserTimezoneApi
(
timezone
);
}
}
/**
/**
...
...
apps/web-naive/src/layouts/basic.vue
View file @
b029f77
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
type
{
ExtendedModalApi
}
from
'@vben/common-ui'
;
import
type
{
ExtendedModalApi
}
from
'@vben/common-ui'
;
import
type
{
NotificationItem
}
from
'@vben/layouts'
;
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
{
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'
;
...
@@ -67,7 +67,7 @@ const showDot = computed(() =>
...
@@ -67,7 +67,7 @@ const showDot = computed(() =>
);
);
const
userProfileStore
=
useUserProfileStore
();
const
userProfileStore
=
useUserProfileStore
();
const
computedTimezone
=
computed
(()
=>
u
serProfileStore
.
timezone
);
const
computedTimezone
=
computed
(()
=>
u
nref
(
userProfileStore
.
timezone
)
);
const
timezoneOptions
=
ref
<
string
[]
>
([]);
const
timezoneOptions
=
ref
<
string
[]
>
([]);
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -76,9 +76,12 @@ onMounted(async () => {
...
@@ -76,9 +76,12 @@ onMounted(async () => {
);
);
});
});
const
handleSetTimezone
=
async
(
const
handleSetTimezone
=
async
(
timezone
:
string
,
modalApi
:
ExtendedModalApi
,
modalApi
:
ExtendedModalApi
,
timezone
?:
string
,
)
=>
{
)
=>
{
if
(
!
timezone
)
{
return
;
}
try
{
try
{
modalApi
.
setState
({
confirmLoading
:
true
});
modalApi
.
setState
({
confirmLoading
:
true
});
await
userProfileStore
.
setTimezone
(
timezone
);
await
userProfileStore
.
setTimezone
(
timezone
);
...
...
apps/web-naive/src/store/user-profile.ts
View file @
b029f77
...
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
...
@@ -17,11 +17,11 @@ const useUserProfileStore = defineStore('user-profile', () => {
* @param timezone 时区字符串
* @param timezone 时区字符串
*/
*/
async
function
setTimezone
(
timezone
:
string
)
{
async
function
setTimezone
(
timezone
:
string
)
{
// 保存用户的时区设置
await
setUserTimezoneApi
(
timezone
);
timezoneRef
.
value
=
timezone
;
timezoneRef
.
value
=
timezone
;
// 设置dayjs默认时区
// 设置dayjs默认时区
setDefaultTimezone
(
timezone
);
setDefaultTimezone
(
timezone
);
// 保存用户的时区设置
await
setUserTimezoneApi
(
timezone
);
}
}
/**
/**
...
...
packages/@core/preferences/__tests__/__snapshots__/config.test.ts.snap
View file @
b029f77
...
@@ -22,6 +22,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj
...
@@ -22,6 +22,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj
"enableCheckUpdates": true,
"enableCheckUpdates": true,
"enablePreferences": true,
"enablePreferences": true,
"enableRefreshToken": false,
"enableRefreshToken": false,
"enableStickyPreferencesNavigationBar": true,
"isMobile": false,
"isMobile": false,
"layout": "sidebar-nav",
"layout": "sidebar-nav",
"locale": "zh-CN",
"locale": "zh-CN",
...
@@ -29,6 +30,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj
...
@@ -29,6 +30,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj
"name": "Vben Admin",
"name": "Vben Admin",
"preferencesButtonPosition": "auto",
"preferencesButtonPosition": "auto",
"watermark": false,
"watermark": false,
"watermarkContent": "",
"zIndex": 200,
"zIndex": 200,
},
},
"breadcrumb": {
"breadcrumb": {
...
@@ -131,6 +133,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj
...
@@ -131,6 +133,7 @@ exports[`defaultPreferences immutability test > should not modify the config obj
"refresh": true,
"refresh": true,
"sidebarToggle": true,
"sidebarToggle": true,
"themeToggle": true,
"themeToggle": true,
"timezone": true,
},
},
}
}
`;
`;
packages/effects/layouts/src/widgets/timezone/timezone-button.vue
View file @
b029f77
...
@@ -16,8 +16,8 @@ import {
...
@@ -16,8 +16,8 @@ import {
interface
Props
{
interface
Props
{
timezoneOptions
:
string
[];
timezoneOptions
:
string
[];
okHandler
?:
(
okHandler
?:
(
timezone
:
string
,
modalApi
?:
ExtendedModalApi
,
modalApi
:
ExtendedModalApi
,
timezone
?:
string
,
)
=>
Promise
<
void
>
|
void
;
)
=>
Promise
<
void
>
|
void
;
timezone
?:
string
;
timezone
?:
string
;
}
}
...
@@ -34,7 +34,7 @@ const TimezoneIcon = createIconifyIcon('fluent-mdl2:world-clock');
...
@@ -34,7 +34,7 @@ const TimezoneIcon = createIconifyIcon('fluent-mdl2:world-clock');
const
[
Modal
,
modalApi
]
=
useVbenModal
({
const
[
Modal
,
modalApi
]
=
useVbenModal
({
fullscreenButton
:
false
,
fullscreenButton
:
false
,
onConfirm
:
()
=>
{
onConfirm
:
()
=>
{
props
.
okHandler
?.(
unref
(
timezoneValue
),
modalApi
);
props
.
okHandler
?.(
modalApi
,
unref
(
timezoneValue
)
);
},
},
});
});
...
@@ -42,11 +42,11 @@ const handleClick = () => {
...
@@ -42,11 +42,11 @@ const handleClick = () => {
modalApi
.
open
();
modalApi
.
open
();
};
};
const
timezoneValue
=
ref
(
props
.
timezone
);
const
timezoneValue
=
ref
<
string
|
undefined
>
(
unref
(
props
.
timezone
)
);
watch
(
watch
(
()
=>
props
.
timezone
,
()
=>
props
.
timezone
,
(
newTimezone
)
=>
{
(
newTimezone
)
=>
{
timezoneValue
.
value
=
newTimezone
;
timezoneValue
.
value
=
unref
(
newTimezone
)
;
},
},
);
);
const
handleClickItem
=
(
timezone
:
string
)
=>
{
const
handleClickItem
=
(
timezone
:
string
)
=>
{
...
...
packages/effects/plugins/src/echarts/use-echarts.ts
View file @
b029f77
...
@@ -69,7 +69,7 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
...
@@ -69,7 +69,7 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
const
renderEcharts
=
(
const
renderEcharts
=
(
options
:
EChartsOption
,
options
:
EChartsOption
,
clear
=
true
clear
=
true
,
):
Promise
<
Nullable
<
echarts
.
ECharts
>>
=>
{
):
Promise
<
Nullable
<
echarts
.
ECharts
>>
=>
{
cacheOptions
=
options
;
cacheOptions
=
options
;
const
currentOptions
=
{
const
currentOptions
=
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment