修改省局的端口的判断为51707
This commit is contained in:
@@ -214,14 +214,14 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '', selec
|
|||||||
// const visibleMenuIds = APP_MENU_MAP[currentApp as keyof typeof APP_MENU_MAP]
|
// const visibleMenuIds = APP_MENU_MAP[currentApp as keyof typeof APP_MENU_MAP]
|
||||||
// console.log('当前应用模式:', currentApp, '可见菜单ID:', visibleMenuIds);
|
// console.log('当前应用模式:', currentApp, '可见菜单ID:', visibleMenuIds);
|
||||||
|
|
||||||
// 检查是否通过51708端口访问
|
// 检查是否通过51707端口访问(省局)
|
||||||
// const isPort51708 = typeof window !== 'undefined' && window.location.port === '51708';
|
// const isPort51708 = typeof window !== 'undefined' && window.location.port === '51708';
|
||||||
const isPort51708 = typeof window !== 'undefined' && window.location.port === '5178';
|
const isPort51707 = typeof window !== 'undefined' && window.location.port === '51707';
|
||||||
|
|
||||||
// 根据当前应用模式过滤菜单项
|
// 根据当前应用模式过滤菜单项
|
||||||
const filteredMenuItems = menuItems.filter(item => {
|
const filteredMenuItems = menuItems.filter(item => {
|
||||||
// 如果是51708端口,只显示交叉评查相关菜单
|
// 如果是51707端口,只显示交叉评查相关菜单
|
||||||
if (isPort51708) {
|
if (isPort51707) {
|
||||||
// 如果当前应用是智慧法务大模型,只显示AI对话菜单
|
// 如果当前应用是智慧法务大模型,只显示AI对话菜单
|
||||||
if (currentApp === 'model') {
|
if (currentApp === 'model') {
|
||||||
return item.id === 'chat-with-llm' ||
|
return item.id === 'chat-with-llm' ||
|
||||||
|
|||||||
@@ -156,7 +156,8 @@ const configs: Record<string, ApiConfig> = {
|
|||||||
// 文件上传
|
// 文件上传
|
||||||
uploadUrl: 'http://10.79.97.17:8000/admin/documents',
|
uploadUrl: 'http://10.79.97.17:8000/admin/documents',
|
||||||
oauth: {
|
oauth: {
|
||||||
serverUrl: 'http://10.79.112.85', // IDaaS服务器地址
|
serverUrl: 'http://10.79.112.85', // IDaaS服务器地址(测试)
|
||||||
|
// serverUrl: 'http://10.79.97.252', // IDaaS服务器地址(生产)
|
||||||
clientId: '54d2a619fe5c81ae1250434c441fccccqMtKwh7H4fO',
|
clientId: '54d2a619fe5c81ae1250434c441fccccqMtKwh7H4fO',
|
||||||
// clientSecret: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb', // 需要替换为实际的Client Secret
|
// clientSecret: 'VYk1AC5XIJEfnEXwyq0u9JEY3fi3byCfSD58zANGeb', // 需要替换为实际的Client Secret
|
||||||
// ⚠️ 安全警告:clientSecret 不应该硬编码在代码中
|
// ⚠️ 安全警告:clientSecret 不应该硬编码在代码中
|
||||||
|
|||||||
+6
-6
@@ -109,9 +109,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
return redirect("/");
|
return redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查5178端口访问控制
|
// 检查51707端口访问控制
|
||||||
|
|
||||||
// 由于应用直接运行在5178端口,我们需要从环境变量或运行时获取端口
|
// 由于应用直接运行在51707端口,我们需要从环境变量或运行时获取端口
|
||||||
const currentPort = process.env.PORT || process.env.API_PORT_CONFIG;
|
const currentPort = process.env.PORT || process.env.API_PORT_CONFIG;
|
||||||
// console.log("currentPort-----------",currentPort)
|
// console.log("currentPort-----------",currentPort)
|
||||||
|
|
||||||
@@ -119,17 +119,17 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
const runtimePort = url.port || currentPort;
|
const runtimePort = url.port || currentPort;
|
||||||
// console.log("runtimePort-----------",runtimePort)
|
// console.log("runtimePort-----------",runtimePort)
|
||||||
|
|
||||||
const isPort51708 = currentPort === '5178' || runtimePort === '5178';
|
const isPort51707 = currentPort === '51707' || runtimePort === '51707';
|
||||||
|
|
||||||
if (isPort51708 && !isPublicPath) {
|
if (isPort51707 && !isPublicPath) {
|
||||||
// 51708端口只允许访问交叉评查相关路径和首页
|
// 51707端口(省局)只允许访问交叉评查相关路径和首页
|
||||||
const allowedPaths = ['/', '/cross-checking','/chat-with-llm'];
|
const allowedPaths = ['/', '/cross-checking','/chat-with-llm'];
|
||||||
const isAllowedPath = allowedPaths.some(path => pathname === path) ||
|
const isAllowedPath = allowedPaths.some(path => pathname === path) ||
|
||||||
pathname.startsWith('/cross-checking/') ||
|
pathname.startsWith('/cross-checking/') ||
|
||||||
pathname.startsWith('/chat-with-llm/');
|
pathname.startsWith('/chat-with-llm/');
|
||||||
|
|
||||||
if (!isAllowedPath) {
|
if (!isAllowedPath) {
|
||||||
// console.log("5178端口访问受限,重定向到交叉评查页面");
|
// console.log("51707端口访问受限,重定向到交叉评查页面");
|
||||||
return redirect("/cross-checking");
|
return redirect("/cross-checking");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ export default function Index() {
|
|||||||
time: ''
|
time: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检查是否通过51708端口访问
|
// 检查是否通过51707端口访问
|
||||||
const [isPort51708, setIsPort51708] = useState(false);
|
const [isPort51707, setIsPort51707] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
setIsPort51708(window.location.port === '51708');
|
setIsPort51707(window.location.port === '51707');
|
||||||
// setIsPort51708(window.location.port === '5178');
|
// setIsPort51707(window.location.port === '5178');
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ export default function Index() {
|
|||||||
|
|
||||||
<div className="modules-container">
|
<div className="modules-container">
|
||||||
{/* 合同管理模块 - 51708端口时隐藏 */}
|
{/* 合同管理模块 - 51708端口时隐藏 */}
|
||||||
{!isPort51708 && (
|
{!isPort51707 && (
|
||||||
<div
|
<div
|
||||||
className="module-card"
|
className="module-card"
|
||||||
onClick={() => handleModuleClick('/contract-template/search', 'contract')}
|
onClick={() => handleModuleClick('/contract-template/search', 'contract')}
|
||||||
|
|||||||
Reference in New Issue
Block a user