feat: 1. 将大部分的请求从fetch改成axios方便管理。

2. 给文档类型添加入口模块和相关数据的渲染。并且给文档类型进行功能上的角色权限区分
3. 新增角色权限管理页面
This commit is contained in:
2025-11-20 20:34:31 +08:00
parent 2e604e8ede
commit 3850d05bdd
25 changed files with 2299 additions and 762 deletions
+4 -11
View File
@@ -1,5 +1,6 @@
import { get } from '../axios-client';
import { API_BASE_URL } from '../../config/api-config';
import axios from 'axios';
// 用户信息接口
export interface UserInfo {
@@ -56,24 +57,16 @@ export async function getOrganizationTree(includeUsers: boolean = true, jwtToken
let responseData: OrganizationResponse;
if (jwtToken) {
// 如果提供了JWT Token,则使用fetch并携带Authorization头
// 如果提供了JWT Token,则使用axios并携带Authorization头
const url = `${API_BASE_URL}/admin/users/organizations?include_users=${includeUsers}`;
const response = await fetch(url, {
const response = await axios.get(url, {
headers: {
'Authorization': `Bearer ${jwtToken}`,
'Content-Type': 'application/json'
}
});
if (!response.ok) {
const errorText = await response.text();
console.error('获取组织架构失败 (fetch):', errorText);
return {
success: false,
error: `HTTP error! status: ${response.status}, ${errorText}`
};
}
responseData = await response.json();
responseData = response.data;
} else {
// 否则,使用原有的get方法
const response = await get<OrganizationResponse>(