Merge remote-tracking branch 'origin/shiy-login' into PingChuan

This commit is contained in:
PingChuan
2025-11-20 20:37:08 +08:00
25 changed files with 2299 additions and 762 deletions
+6 -6
View File
@@ -33,11 +33,11 @@ export function ClientAuthGuard({ isPublicPath }: ClientAuthGuardProps) {
const token = localStorage.getItem('access_token');
const authenticated = isAuthenticated();
console.log('🔍 [Auth Guard] 认证检查', {
token: token ? `${token.substring(0, 20)}...` : null,
authenticated,
pathname: location.pathname
});
// console.log('🔍 [Auth Guard] 认证检查', {
// token: token ? `${token.substring(0, 20)}...` : null,
// authenticated,
// pathname: location.pathname
// });
if (!authenticated) {
console.log('🔒 [Auth Guard] 未认证,重定向到登录页');
@@ -48,7 +48,7 @@ export function ClientAuthGuard({ isPublicPath }: ClientAuthGuardProps) {
// 跳转到登录页,并传递重定向目标
navigate(`/login?redirect=${encodeURIComponent(redirectTo)}`, { replace: true });
} else {
console.log('✅ [Auth Guard] 已认证,允许访问');
// console.log('✅ [Auth Guard] 已认证,允许访问');
}
}, [isPublicPath, navigate, location.pathname]);
@@ -32,6 +32,7 @@ import {
} from '../../api/cross-checking/cross-file-result';
import { useFetcher, useNavigate } from '@remix-run/react';
import { API_BASE_URL } from '~/config/api-config';
import axios from 'axios';
// import '../../styles/components/TooltipStyles.css';
/**
@@ -768,18 +769,16 @@ export function ReviewPointsList({
}
// 打印最终请求体
// console.log('最终请求体:', data);
// 用原生 fetch + application/json 提交
// 用 axios + application/json 提交
try {
const response = await fetch(`${API_BASE_URL.replace(/\/$/, '')}/admin/cross_review/proposals`, {
method: 'POST',
const response = await axios.post(`${API_BASE_URL.replace(/\/$/, '')}/admin/cross_review/proposals`, data, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${userInfo.frontend_jwt}`,
},
body: JSON.stringify(data)
}
});
const result = await response.json();
if (response.ok) {
const result = response.data;
if (response.status === 200) {
toastService.success('意见提交成功');
// 创建新的提案对象
+3 -2
View File
@@ -37,7 +37,7 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
// 获取用户路由权限
useEffect(() => {
console.log('🔍 [Sidebar] useEffect 触发,开始获取路由权限');
// console.log('🔍 [Sidebar] useEffect 触发,开始获取路由权限');
const fetchUserRoutes = async () => {
setIsLoadingRoutes(true);
@@ -69,7 +69,7 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
// 如果需要重定向到首页
if (result.shouldRedirectToHome) {
console.log('🔄 [Sidebar] 重定向到首页');
// console.log('🔄 [Sidebar] 重定向到首页');
navigate('/');
return;
}
@@ -158,6 +158,7 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
// 处理菜单项:清理子菜单结构
const processedMenuItems: MenuItem[] = menuItems.filter(item =>{
// console.log('菜单项:', item.title, 'Icon:', item.icon)
// 如果是省局访问
if(isPort51707){
if (selectedModuleName === '智慧法务大模型'){
+7 -7
View File
@@ -11,6 +11,7 @@ import { Button } from '~/components/ui/Button';
import { toastService } from '~/components/ui/Toast';
// import { DOCUMENT_URL } from "~/api/axios-client";
import { uploadContractTemplate } from '~/api/files/files-upload';
import axios from 'axios';
interface ReviewTabsProps {
activeTab: string;
@@ -65,14 +66,13 @@ export function ReviewTabs({ activeTab, onTabChange, children, fileInfo, onConfi
// 使用 PDF 代理路由获取文件,自动添加 JWT 认证
const downloadUrl = `/api/pdf-proxy?path=${encodeURIComponent(fileInfo.path || '')}`;
// 使用fetch获取文件内容
const response = await fetch(downloadUrl);
if (!response.ok) {
throw new Error(`下载失败: ${response.status} ${response.statusText}`);
}
// 使用axios获取文件内容
const response = await axios.get(downloadUrl, {
responseType: 'blob'
});
// 将响应转换为Blob
const blob = await response.blob();
// axios已经返回Blob
const blob = response.data;
// 创建Blob URL
const blobUrl = URL.createObjectURL(blob);