From 5613cdd6c94296d8b05f9dcc8522bda318d664df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A0=91=E8=90=8C=E8=8A=BD?= <3205788256@qq.com> Date: Wed, 17 Sep 2025 18:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAI=E5=B7=A5=E5=85=B7=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InfoGenie-frontend/.env.development | 1 - InfoGenie-frontend/.env.local | 1 - InfoGenie-frontend/.env.production | 1 - .../public/aimodelapp/AI写诗小助手/env.js | 2 +- .../public/aimodelapp/AI写诗小助手/script.js | 17 +- .../public/aimodelapp/AI变量命名助手/env.js | 2 +- .../aimodelapp/AI变量命名助手/script.js | 2 +- .../public/aimodelapp/AI姓名评测/env.js | 2 +- .../public/aimodelapp/AI姓名评测/script.js | 17 +- .../public/aimodelapp/AI文章转文言文/env.js | 2 +- .../aimodelapp/AI文章转文言文/script.js | 17 +- .../public/aimodelapp/AI生成Linux命令/env.js | 2 +- .../aimodelapp/AI生成Linux命令/script.js | 4 +- .../public/aimodelapp/AI生成表情包/env.js | 2 +- .../public/aimodelapp/AI生成表情包/script.js | 25 +- .../public/aimodelapp/AI语言翻译助手/env.js | 2 +- .../aimodelapp/AI语言翻译助手/script.js | 17 +- .../public/aimodelapp/API测试页面.html | 228 ------------------ InfoGenie-frontend/src/components/Header.js | 4 + InfoGenie-frontend/src/config/env.js | 40 +++ .../src/pages/UserProfilePage.js | 146 ++++++++++- InfoGenie-frontend/src/utils/api.js | 8 +- 22 files changed, 260 insertions(+), 282 deletions(-) delete mode 100755 InfoGenie-frontend/.env.development delete mode 100755 InfoGenie-frontend/.env.local delete mode 100755 InfoGenie-frontend/.env.production delete mode 100755 InfoGenie-frontend/public/aimodelapp/API测试页面.html create mode 100644 InfoGenie-frontend/src/config/env.js diff --git a/InfoGenie-frontend/.env.development b/InfoGenie-frontend/.env.development deleted file mode 100755 index 86b2c5e2..00000000 --- a/InfoGenie-frontend/.env.development +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://infogenie.api.shumengya.top \ No newline at end of file diff --git a/InfoGenie-frontend/.env.local b/InfoGenie-frontend/.env.local deleted file mode 100755 index 61e0b90d..00000000 --- a/InfoGenie-frontend/.env.local +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://infogenie.api.shumengya.top diff --git a/InfoGenie-frontend/.env.production b/InfoGenie-frontend/.env.production deleted file mode 100755 index 86b2c5e2..00000000 --- a/InfoGenie-frontend/.env.production +++ /dev/null @@ -1 +0,0 @@ -REACT_APP_API_URL=https://infogenie.api.shumengya.top \ No newline at end of file diff --git a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js index c0bdbc79..4bc7ea92 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { poetry: '/api/aimodelapp/poetry' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js index d342d613..d7062ac6 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI写诗小助手/script.js @@ -10,18 +10,19 @@ const themeInput = document.getElementById('theme'); // 调用后端API async function callBackendAPI(theme) { try { - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.poetry}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/poetry`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify({ theme: theme }) diff --git a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js index a777e992..61150c19 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { variableNaming: '/api/aimodelapp/variable-naming' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js index bc733cca..f375d41b 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI变量命名助手/script.js @@ -47,7 +47,7 @@ async function callBackendAPI(description) { throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch('http://127.0.0.1:5002/api/aimodelapp/variable-naming', { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/variable-naming`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js index acf8ec64..35654ec1 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { nameAnalysis: '/api/aimodelapp/name-analysis' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js index 4a230889..8e570ee9 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI姓名评测/script.js @@ -193,18 +193,19 @@ async function analyzeName() { try { // 调用后端API - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.nameAnalysis}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/name-analysis`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify(requestBody) }); diff --git a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js index f69465ef..8b9eb2aa 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { classicalConversion: '/api/aimodelapp/classical_conversion' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js index 6e27f030..c434b742 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI文章转文言文/script.js @@ -12,18 +12,19 @@ const conversionResultContainer = document.getElementById('conversionResult'); // 调用后端API async function callBackendAPI(modernText, style, articleType) { try { - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.classicalConversion}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/classical_conversion`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify({ modern_text: modernText, style: style, diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js index ac15a195..8c8b0741 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { linuxCommand: '/api/aimodelapp/linux-command' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js index 41a25bdf..bdbeccba 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成Linux命令/script.js @@ -11,7 +11,7 @@ const commandsContainer = document.getElementById('commands'); // 调用后端API async function callBackendAPI(taskDescription, difficultyLevel) { try { - const token = AUTH_CONFIG.getToken(); + const token = localStorage.getItem('token'); const headers = { 'Content-Type': 'application/json' }; @@ -20,7 +20,7 @@ async function callBackendAPI(taskDescription, difficultyLevel) { headers['Authorization'] = `Bearer ${token}`; } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.linuxCommand}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}${window.API_CONFIG.endpoints.linuxCommand}`, { method: 'POST', headers: headers, body: JSON.stringify({ diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js index 650807b1..3c81ab49 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { expressionMaker: '/api/aimodelapp/expression-maker' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js index 471e7237..9cb1d130 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI生成表情包/script.js @@ -1,6 +1,29 @@ // 从配置文件导入设置 // 配置在 env.js 文件中定义 +// 表情配置 +const CONFIG = { + intensityLevels: { + 'low': { color: '#4CAF50' }, + 'medium': { color: '#FF9800' }, + 'high': { color: '#F44336' }, + 'very_high': { color: '#9C27B0' } + }, + expressionCategories: { + 'emoji': { className: 'emoji' }, + 'kaomoji': { className: 'kaomoji' }, + 'combination': { className: 'combination' } + }, + expressionStyles: { + 'cute': { name: '可爱风', description: '适合表达可爱、萌系情感' }, + 'cool': { name: '酷炫风', description: '适合表达酷炫、帅气情感' }, + 'angry': { name: '愤怒风', description: '适合表达愤怒、生气情感' }, + 'sad': { name: '悲伤风', description: '适合表达悲伤、难过情感' }, + 'happy': { name: '开心风', description: '适合表达开心、快乐情感' }, + 'mixed': { name: '混合风', description: '多种风格混合,适应各种情感' } + } +}; + // DOM 元素 const textInput = document.getElementById('text-input'); const styleSelect = document.getElementById('style-select'); @@ -18,7 +41,7 @@ async function callBackendAPI(text, style) { throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.expressionMaker}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/expression-maker`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js index 8b3c1a0f..4f8f6d21 100644 --- a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js +++ b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/env.js @@ -3,7 +3,7 @@ // API配置 window.API_CONFIG = { - baseUrl: 'http://127.0.0.1:5002', + baseUrl: window.parent.ENV_CONFIG.API_URL, endpoints: { translation: '/api/aimodelapp/translation' } diff --git a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js index 87495ab2..929ddedd 100755 --- a/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js +++ b/InfoGenie-frontend/public/aimodelapp/AI语言翻译助手/script.js @@ -11,18 +11,19 @@ const translationResultContainer = document.getElementById('translationResult'); // 调用后端API async function callBackendAPI(sourceText, targetLanguage) { try { - const token = AUTH_CONFIG.getToken(); - const headers = { - 'Content-Type': 'application/json' - }; + // 获取JWT token + const token = localStorage.getItem('token'); - if (token) { - headers['Authorization'] = `Bearer ${token}`; + if (!token) { + throw new Error('未登录,请先登录后使用AI功能'); } - const response = await fetch(`${API_CONFIG.baseUrl}${API_CONFIG.endpoints.translation}`, { + const response = await fetch(`${window.API_CONFIG.baseUrl}/api/aimodelapp/translation`, { method: 'POST', - headers: headers, + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + }, body: JSON.stringify({ source_text: sourceText, target_language: targetLanguage diff --git a/InfoGenie-frontend/public/aimodelapp/API测试页面.html b/InfoGenie-frontend/public/aimodelapp/API测试页面.html deleted file mode 100755 index 19ff3b18..00000000 --- a/InfoGenie-frontend/public/aimodelapp/API测试页面.html +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - API超时修复测试 - - - -
-

🔧 API超时修复测试

- -
-

🎭 表情制作器API测试

- - - -
-
- -
-

📝 变量命名API测试

- - -
-
-
- - - - \ No newline at end of file diff --git a/InfoGenie-frontend/src/components/Header.js b/InfoGenie-frontend/src/components/Header.js index ac89ce0d..74ecf0c1 100755 --- a/InfoGenie-frontend/src/components/Header.js +++ b/InfoGenie-frontend/src/components/Header.js @@ -243,6 +243,7 @@ const Header = () => { API聚合应用 玩玩小游戏 AI工具 + 个人中心 @@ -302,6 +303,9 @@ const Header = () => { 🤖AI工具 + + 👤个人中心 + {isLoggedIn && user ? ( <> diff --git a/InfoGenie-frontend/src/config/env.js b/InfoGenie-frontend/src/config/env.js new file mode 100644 index 00000000..9913ea6d --- /dev/null +++ b/InfoGenie-frontend/src/config/env.js @@ -0,0 +1,40 @@ +// 环境配置文件 +// 统一管理所有环境变量配置 + +// 统一环境配置 +const config = { + API_URL: 'https://infogenie.api.shumengya.top', + DEBUG: true, + LOG_LEVEL: 'debug' +}; + +// 导出配置对象 +export const ENV_CONFIG = { + // API相关配置 + API_URL: config.API_URL, + + // 调试相关配置 + DEBUG: config.DEBUG, + LOG_LEVEL: config.LOG_LEVEL, + + // 应用信息 + APP_NAME: 'InfoGenie', + APP_VERSION: '1.0.0' +}; + +// 兼容性函数:模拟 process.env 的行为 +export const getEnvVar = (key, defaultValue = '') => { + switch (key) { + case 'REACT_APP_API_URL': + return ENV_CONFIG.API_URL; + default: + return process.env[key] || defaultValue; + } +}; + +// 将配置暴露到window对象上,以便子应用(iframe)可以访问 +if (typeof window !== 'undefined') { + window.ENV_CONFIG = ENV_CONFIG; +} + +export default ENV_CONFIG; \ No newline at end of file diff --git a/InfoGenie-frontend/src/pages/UserProfilePage.js b/InfoGenie-frontend/src/pages/UserProfilePage.js index d96dd439..5b2302fd 100755 --- a/InfoGenie-frontend/src/pages/UserProfilePage.js +++ b/InfoGenie-frontend/src/pages/UserProfilePage.js @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import { useUser } from '../contexts/UserContext'; import { FiUser, FiStar, FiTrendingUp, FiGift, FiCalendar, FiAward } from 'react-icons/fi'; @@ -68,11 +69,11 @@ const StatsGrid = styled.div` margin-bottom: 24px; @media (max-width: 768px) { - grid-template-columns: repeat(2, 1fr); + gap: 12px; } @media (max-width: 480px) { - grid-template-columns: 1fr; + gap: 8px; } `; @@ -90,6 +91,16 @@ const StatCard = styled.div` transform: translateY(-2px); box-shadow: 0 8px 24px rgba(168, 230, 207, 0.3); } + + @media (max-width: 768px) { + padding: 16px; + border-radius: 12px; + } + + @media (max-width: 480px) { + padding: 12px 8px; + border-radius: 10px; + } `; const StatIcon = styled.div` @@ -103,6 +114,21 @@ const StatIcon = styled.div` margin: 0 auto 12px; color: white; font-size: 20px; + + @media (max-width: 768px) { + width: 40px; + height: 40px; + font-size: 18px; + margin: 0 auto 8px; + } + + @media (max-width: 480px) { + width: 32px; + height: 32px; + font-size: 16px; + margin: 0 auto 6px; + border-radius: 8px; + } `; const StatValue = styled.div` @@ -110,11 +136,29 @@ const StatValue = styled.div` font-weight: bold; color: #2e7d32; margin-bottom: 4px; + + @media (max-width: 768px) { + font-size: 20px; + } + + @media (max-width: 480px) { + font-size: 16px; + margin-bottom: 2px; + } `; const StatLabel = styled.div` font-size: 14px; color: #666; + + @media (max-width: 768px) { + font-size: 13px; + } + + @media (max-width: 480px) { + font-size: 11px; + line-height: 1.2; + } `; const CheckinSection = styled.div` @@ -199,8 +243,60 @@ const SuccessMessage = styled.div` text-align: center; `; +const LoginPrompt = styled.div` + background: rgba(255, 255, 255, 0.95); + border-radius: 20px; + padding: 60px 40px; + text-align: center; + box-shadow: 0 8px 32px rgba(168, 230, 207, 0.3); + backdrop-filter: blur(10px); + border: 1px solid rgba(168, 230, 207, 0.2); + margin-bottom: 40px; +`; + +const LoginIcon = styled.div` + font-size: 64px; + margin-bottom: 24px; +`; + +const LoginTitle = styled.h2` + font-size: 24px; + font-weight: bold; + color: #2e7d32; + margin-bottom: 16px; +`; + +const LoginText = styled.p` + color: #666; + font-size: 16px; + line-height: 1.6; + margin-bottom: 24px; +`; + +const LoginButton = styled.button` + background: linear-gradient(135deg, #81c784 0%, #a5d6a7 100%); + color: white; + border: none; + padding: 14px 32px; + border-radius: 16px; + font-size: 16px; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + display: inline-flex; + align-items: center; + gap: 8px; + box-shadow: 0 4px 16px rgba(129, 199, 132, 0.3); + + &:hover { + transform: translateY(-2px); + box-shadow: 0 8px 24px rgba(129, 199, 132, 0.4); + } +`; + const UserProfilePage = () => { - const { user } = useUser(); + const { user, isLoggedIn, isLoading } = useUser(); + const navigate = useNavigate(); const [gameData, setGameData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(''); @@ -226,9 +322,17 @@ const UserProfilePage = () => { return null; }; + const handleLogin = () => { + navigate('/login'); + }; + useEffect(() => { - fetchGameData(); - }, []); + if (isLoggedIn) { + fetchGameData(); + } else { + setLoading(false); + } + }, [isLoggedIn]); const fetchGameData = async () => { try { @@ -280,6 +384,38 @@ const UserProfilePage = () => { return Math.floor(100 * Math.pow(1.2, level)); }; + if (isLoading) { + return ( + + + 加载中... + + + ); + } + + if (!isLoggedIn) { + return ( + + + + 🔒 + 需要登录访问 + + 个人中心需要登录后才能查看,请先登录您的账户。 +
+ 登录后即可查看您的个人信息、萌芽币余额、签到记录等。 +
+ + + 立即登录 + +
+
+
+ ); + } + if (loading) { return ( diff --git a/InfoGenie-frontend/src/utils/api.js b/InfoGenie-frontend/src/utils/api.js index 9cee216a..8a8f5ae4 100755 --- a/InfoGenie-frontend/src/utils/api.js +++ b/InfoGenie-frontend/src/utils/api.js @@ -1,9 +1,10 @@ import axios from 'axios'; import toast from 'react-hot-toast'; +import { ENV_CONFIG } from '../config/env.js'; // 创建axios实例 const api = axios.create({ - baseURL: process.env.REACT_APP_API_URL || 'https://infogenie.api.shumengya.top', + baseURL: ENV_CONFIG.API_URL, timeout: 10000, withCredentials: true, // 支持携带cookie headers: { @@ -12,8 +13,9 @@ const api = axios.create({ }); // 打印当前使用的API URL,便于调试 -console.log('🔧 环境变量 REACT_APP_API_URL:', process.env.REACT_APP_API_URL); -console.log('🌐 最终使用的 API Base URL:', process.env.REACT_APP_API_URL || 'https://infogenie.api.shumengya.top'); +if (ENV_CONFIG.DEBUG) { + console.log('🌐 使用的 API Base URL:', ENV_CONFIG.API_URL); +} // 请求拦截器 api.interceptors.request.use(