mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 01:59:20 +08:00
update: 升级vben5.5.9到5.7.0
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export * from './auth';
|
||||
export * from './menu';
|
||||
export * from './timezone';
|
||||
export * from './user';
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 获取系统支持的时区列表
|
||||
*/
|
||||
export async function getTimezoneOptionsApi() {
|
||||
return await requestClient.get<
|
||||
{
|
||||
label: string;
|
||||
value: string;
|
||||
}[]
|
||||
>('/timezone/getTimezoneOptions');
|
||||
}
|
||||
/**
|
||||
* 获取用户时区
|
||||
*/
|
||||
export async function getTimezoneApi(): Promise<null | string | undefined> {
|
||||
return requestClient.get<null | string | undefined>('/timezone/getTimezone');
|
||||
}
|
||||
/**
|
||||
* 设置用户时区
|
||||
* @param timezone 时区
|
||||
*/
|
||||
export async function setTimezoneApi(timezone: string): Promise<void> {
|
||||
return requestClient.post('/timezone/setTimezone', { timezone });
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
import { message } from 'antdv-next';
|
||||
import JSONBigInt from 'json-bigint';
|
||||
|
||||
import { useAuthStore } from '#/store';
|
||||
@@ -29,11 +29,15 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
|
||||
baseURL,
|
||||
transformResponse: (data: any, header: AxiosResponseHeaders) => {
|
||||
// storeAsString指示将BigInt存储为字符串,设为false则会存储为内置的BigInt类型
|
||||
return header.getContentType()?.toString().includes('application/json')
|
||||
? cloneDeep(
|
||||
JSONBigInt({ storeAsString: true, strict: true }).parse(data),
|
||||
)
|
||||
: data;
|
||||
if (
|
||||
header.getContentType()?.toString().includes('application/json') &&
|
||||
typeof data === 'string'
|
||||
) {
|
||||
return cloneDeep(
|
||||
JSONBigInt({ storeAsString: true, strict: true }).parse(data),
|
||||
);
|
||||
}
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './dept';
|
||||
export * from './menu';
|
||||
export * from './role';
|
||||
export * from './user';
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace SystemUserApi {
|
||||
export interface SystemUser {
|
||||
[key: string]: any;
|
||||
id: string;
|
||||
name: string;
|
||||
permissions: string[];
|
||||
remark?: string;
|
||||
status: 0 | 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表数据
|
||||
*/
|
||||
async function getUserList(params: Recordable<any>) {
|
||||
return requestClient.get<Array<SystemUserApi.SystemUser>>(
|
||||
'/system/user/list',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
* @param data 用户数据
|
||||
*/
|
||||
async function createUser(data: Omit<SystemUserApi.SystemUser, 'id'>) {
|
||||
return requestClient.post('/system/user', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*
|
||||
* @param id 用户 ID
|
||||
* @param data 用户数据
|
||||
*/
|
||||
async function updateUser(
|
||||
id: string,
|
||||
data: Omit<SystemUserApi.SystemUser, 'id'>,
|
||||
) {
|
||||
return requestClient.put(`/system/user/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param id 用户 ID
|
||||
*/
|
||||
async function deleteUser(id: string) {
|
||||
return requestClient.delete(`/system/user/${id}`);
|
||||
}
|
||||
|
||||
export { createUser, deleteUser, getUserList, updateUser };
|
||||
Reference in New Issue
Block a user