From 6ccda55b929db20c315e10e0564cbb7ae08a7bfe Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Mon, 25 Aug 2025 11:30:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=9F=B3=E9=A2=91=E7=9A=84?= =?UTF-8?q?=E4=BA=BA=E5=A3=B0=E5=88=86=E7=A6=BB=E5=92=8C=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/api.js | 2 +- src/pages/CreateMeeting.jsx | 1 + src/pages/EditMeeting.jsx | 2 +- src/pages/MeetingDetails.css | 21 ++++++++------------- src/pages/MeetingDetails.jsx | 21 ++++++++++++--------- vite.config.js | 15 +++++++++++++++ 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/config/api.js b/src/config/api.js index 46460cc..1f24f66 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -1,6 +1,6 @@ // API配置文件 const API_CONFIG = { - BASE_URL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000', + BASE_URL: "", ENDPOINTS: { AUTH: { LOGIN: '/api/auth/login' diff --git a/src/pages/CreateMeeting.jsx b/src/pages/CreateMeeting.jsx index cd81f31..8896898 100644 --- a/src/pages/CreateMeeting.jsx +++ b/src/pages/CreateMeeting.jsx @@ -93,6 +93,7 @@ const CreateMeeting = ({ user }) => { try { // Create meeting const meetingData = { + user_id: user.user_id, title: formData.title, meeting_time: formData.meeting_time || null, attendee_ids: formData.attendees.map(a => a.user_id) diff --git a/src/pages/EditMeeting.jsx b/src/pages/EditMeeting.jsx index 4dfdf9e..288e070 100644 --- a/src/pages/EditMeeting.jsx +++ b/src/pages/EditMeeting.jsx @@ -220,7 +220,7 @@ const EditMeeting = ({ user }) => { } ); - return `${API_BASE_URL}${response.data.url}`; + return `${API_BASE_URL}${response.data.file_path}`; } catch (err) { setError('上传图片失败,请重试'); return null; diff --git a/src/pages/MeetingDetails.css b/src/pages/MeetingDetails.css index ef8085c..485458c 100644 --- a/src/pages/MeetingDetails.css +++ b/src/pages/MeetingDetails.css @@ -441,6 +441,12 @@ background: #f8fafc; border-radius: 8px; border-left: 3px solid #667eea; + cursor: pointer; + transition: background-color 0.3s ease; +} + +.transcript-item:hover { + background-color: #f0f2ff; } .transcript-header-item { @@ -456,21 +462,10 @@ font-size: 0.9rem; } -.timestamp-button { - background: #667eea; - border: none; - border-radius: 4px; - padding: 0.25rem 0.5rem; - color: white; - cursor: pointer; +.timestamp { font-size: 0.8rem; font-weight: 500; - transition: all 0.3s ease; -} - -.timestamp-button:hover { - background: #5a67d8; - transform: scale(1.05); + color: #64748b; } .transcript-text { diff --git a/src/pages/MeetingDetails.jsx b/src/pages/MeetingDetails.jsx index e39d4c4..56cde5f 100644 --- a/src/pages/MeetingDetails.jsx +++ b/src/pages/MeetingDetails.jsx @@ -35,7 +35,7 @@ const MeetingDetails = ({ user }) => { setLoading(true); // Fallback URL construction in case config fails - const baseUrl = API_BASE_URL || 'http://localhost:8000'; + const baseUrl = "" const detailEndpoint = API_ENDPOINTS?.MEETINGS?.DETAIL?.(meeting_id) || `/api/meetings/${meeting_id}`; const audioEndpoint = API_ENDPOINTS?.MEETINGS?.AUDIO?.(meeting_id) || `/api/meetings/${meeting_id}/audio`; const transcriptEndpoint = API_ENDPOINTS?.MEETINGS?.TRANSCRIPT?.(meeting_id) || `/api/meetings/${meeting_id}/transcript`; @@ -47,7 +47,7 @@ const MeetingDetails = ({ user }) => { try { const audioResponse = await axios.get(`${baseUrl}${audioEndpoint}`); // Construct URL using uploads path and relative path from database - setAudioUrl(`${baseUrl}/uploads/${audioResponse.data.file_path}`); + setAudioUrl(`${baseUrl}${audioResponse.data.file_path}`); setAudioFileName(audioResponse.data.file_name); } catch (audioError) { console.warn('No audio file available:', audioError); @@ -149,6 +149,8 @@ const MeetingDetails = ({ user }) => { if (audioRef.current) { audioRef.current.currentTime = timestamp; setCurrentTime(timestamp); + audioRef.current.play(); + setIsPlaying(true); } }; @@ -343,16 +345,17 @@ const MeetingDetails = ({ user }) => { {showTranscript && (
{transcript.map((item) => ( -
+
jumpToTime(item.start_time_ms / 1000)} + title="跳转到此时间点播放" + >
{item.speaker_tag} - +
{item.text_content}
diff --git a/vite.config.js b/vite.config.js index 8b0f57b..6396b75 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,4 +4,19 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + host: true, // Optional: Allows the server to be accessible externally + port: 5173, // Optional: Specify a port if needed + allowedHosts: ['c0e02ee.r9.cpolar.top'], // Add the problematic hostname here + proxy: { + '/api': { + target: 'http://localhost:8000', // 后端服务地址 + changeOrigin: true, // 是否改变请求的源头 + }, + '/uploads': { + target: 'http://localhost:8000', // 后端服务地址 + changeOrigin: true, // 是否改变请求的源头 + }, + }, + } })