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
-36
View File
@@ -384,42 +384,6 @@ export async function getDocumentWithNoUserId(id: string, frontendJWT?: string):
/**
* 获取文件下载链接
* @param filePath 文件路径
* @returns 下载链接
*/
export async function getFileDownloadUrl(filePath: string): Promise<{
data?: { downloadUrl: string };
error?: string;
status?: number;
}> {
try {
if (!filePath) {
return { error: '文件路径不能为空', status: 400 };
}
// 这里应该调用获取文件下载链接的API
// 假设后端有这样的端点:/api/files/generate-download-url?path=xxx
// 实际项目中需要根据你的后端API调整
// 临时解决方案:返回Remix路由路径
// 这将通过Remix服务器代理对文件的访问
return {
data: {
downloadUrl: `/documents/download?path=${encodeURIComponent(filePath)}`
}
};
} catch (error) {
console.error('获取文件下载链接失败:', error);
return {
error: error instanceof Error ? error.message : '获取文件下载链接失败',
status: 500
};
}
}
/**
* 更新文档信息
* @param id 文档ID