更新文档和文件上传功能,新增前端JWT传递逻辑,优化用户信息处理。

This commit is contained in:
2025-09-12 12:12:45 +08:00
parent bbad3cf00d
commit 52af1008fe
2 changed files with 6 additions and 5 deletions
+4 -3
View File
@@ -38,7 +38,7 @@ export const meta: MetaFunction = () => {
export const loader = async ({ request }: LoaderFunctionArgs) => { export const loader = async ({ request }: LoaderFunctionArgs) => {
// 获取用户会话信息 // 获取用户会话信息
const { getUserSession } = await import("~/api/login/auth.server"); const { getUserSession } = await import("~/api/login/auth.server");
const { userInfo } = await getUserSession(request); const { userInfo, frontendJWT } = await getUserSession(request);
// 获取URL查询参数,只保留必要的分页参数 // 获取URL查询参数,只保留必要的分页参数
const url = new URL(request.url); const url = new URL(request.url);
@@ -61,6 +61,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
pageSize, pageSize,
documentTypeOptions, documentTypeOptions,
userInfo, // 传递用户信息到客户端 userInfo, // 传递用户信息到客户端
frontendJWT, // 传递前端JWT到客户端
initialLoad: true // 标记这是初始加载 initialLoad: true // 标记这是初始加载
}); });
}; };
@@ -793,7 +794,7 @@ export default function DocumentsIndex() {
attachmentMergeMode, attachmentMergeMode,
true, // isReprocess true, // isReprocess
attachmentRemark || undefined, attachmentRemark || undefined,
loaderData.userInfo?.token as string | undefined loaderData.frontendJWT as string | undefined
); );
if (result.error) { if (result.error) {
@@ -865,7 +866,7 @@ export default function DocumentsIndex() {
templateFile, templateFile,
selectedDocumentId, selectedDocumentId,
undefined, // comparisonId undefined, // comparisonId
loaderData.userInfo?.token as string | undefined loaderData.frontendJWT as string | undefined
); );
if (result.error) { if (result.error) {
+2 -2
View File
@@ -921,7 +921,7 @@ export default function FilesUpload() {
attachmentMergeMode, attachmentMergeMode,
true, // isReprocess true, // isReprocess
attachmentRemark || undefined, attachmentRemark || undefined,
loaderData.userInfo?.token as string | undefined loaderData.frontendJWT as string | undefined
); );
if (result.error) { if (result.error) {
@@ -991,7 +991,7 @@ export default function FilesUpload() {
templateFile, templateFile,
selectedDocumentId, selectedDocumentId,
undefined, // comparisonId undefined, // comparisonId
loaderData.userInfo?.token as string | undefined loaderData.frontendJWT as string | undefined
); );
if (result.error) { if (result.error) {