mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-03-13 23:10:53 +08:00
feat: increase support for multiple time zones
* 优化实现方法
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export * from './auth';
|
||||
export * from './menu';
|
||||
export * from './timezone';
|
||||
export * from './user';
|
||||
|
||||
30
playground/src/api/core/timezone.ts
Normal file
30
playground/src/api/core/timezone.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { TimezoneOption } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 获取系统支持的时区列表
|
||||
*/
|
||||
export async function getTimezoneOptionsApi() {
|
||||
const dataList =
|
||||
(await requestClient.get<TimezoneOption[]>(
|
||||
'/timezone/getTimezoneOptions',
|
||||
)) || [];
|
||||
return dataList.map((item) => ({
|
||||
label: item.timezone,
|
||||
value: item.timezone,
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* 获取用户时区
|
||||
*/
|
||||
export async function getTimezoneApi(): Promise<null | string | undefined> {
|
||||
return requestClient.get<null | string | undefined>('/timezone/getTimezone');
|
||||
}
|
||||
/**
|
||||
* 设置用户时区
|
||||
* @param timezone 时区
|
||||
*/
|
||||
export async function setTimezoneApi(timezone: string) {
|
||||
return requestClient.post('/timezone/setTimezone', { timezone });
|
||||
}
|
||||
Reference in New Issue
Block a user