imetting_frontend/src/pages/HomePage.jsx

181 lines
5.6 KiB
React
Raw Normal View History

2025-08-05 01:44:28 +00:00
import React, { useState } from 'react';
import { Brain, Users, Calendar, TrendingUp, X, User, Lock } from 'lucide-react';
2025-08-29 08:37:55 +00:00
import apiClient from '../utils/apiClient';
2025-08-05 01:44:28 +00:00
import { buildApiUrl, API_ENDPOINTS } from '../config/api';
import './HomePage.css';
const HomePage = ({ onLogin }) => {
const [showLoginModal, setShowLoginModal] = useState(false);
const [loginForm, setLoginForm] = useState({ username: '', password: '' });
const [loginError, setLoginError] = useState('');
const [isLoading, setIsLoading] = useState(false);
const handleLogin = async (e) => {
e.preventDefault();
setIsLoading(true);
setLoginError('');
try {
2025-08-29 08:37:55 +00:00
const response = await apiClient.post(buildApiUrl(API_ENDPOINTS.AUTH.LOGIN), loginForm);
2025-08-05 01:44:28 +00:00
onLogin(response.data);
setShowLoginModal(false);
} catch (error) {
setLoginError(error.response?.data?.detail || '登录失败,请重试');
} finally {
setIsLoading(false);
}
};
const handleInputChange = (e) => {
setLoginForm({
...loginForm,
[e.target.name]: e.target.value
});
};
const closeModal = () => {
setShowLoginModal(false);
setLoginForm({ username: '', password: '' });
setLoginError('');
};
return (
<div className="homepage">
{/* Header */}
<header className="homepage-header">
<div className="header-content">
<div className="logo">
<Brain className="logo-icon" />
2025-09-11 05:16:24 +00:00
<span className="logo-text-white">iMeeting</span>
2025-08-05 01:44:28 +00:00
</div>
<button
className="login-btn"
onClick={() => setShowLoginModal(true)}
>
登录
</button>
</div>
</header>
{/* Hero Section */}
<section className="hero">
<div className="hero-content">
<h1 className="hero-title">智慧会议让会议更高效</h1>
<p className="hero-subtitle">
通过AI技术将会议音视频转化为结构化信息提升团队协作效率
</p>
<button
className="cta-button"
onClick={() => setShowLoginModal(true)}
>
开始使用
</button>
</div>
</section>
{/* Features Section */}
<section className="features">
<div className="features-container">
<h2 className="features-title">核心功能</h2>
<div className="features-grid">
<div className="feature-card">
<Brain className="feature-icon" />
<h3>AI智能转录</h3>
<p>自动将会议音频转为文字并识别不同发言人</p>
</div>
<div className="feature-card">
<Users className="feature-icon" />
<h3>参会人管理</h3>
<p>轻松管理会议参与者追踪会议参与情况</p>
</div>
<div className="feature-card">
<Calendar className="feature-icon" />
<h3>时间轴视图</h3>
<p>按时间顺序展示所有会议快速回顾历史记录</p>
</div>
<div className="feature-card">
<TrendingUp className="feature-icon" />
<h3>智能摘要</h3>
<p>AI自动生成会议摘要提取关键信息和决策</p>
</div>
</div>
</div>
</section>
2025-09-11 05:16:24 +00:00
{/* Footer */}
<footer className="homepage-footer">
<p>© 2025 紫光汇智信息技术有限公司. All rights reserved.</p>
<p>备案号渝ICP备2023007695号-11</p>
</footer>
2025-08-05 01:44:28 +00:00
{/* Login Modal */}
{showLoginModal && (
<div className="modal-overlay" onClick={closeModal}>
<div className="login-modal" onClick={e => e.stopPropagation()}>
<div className="modal-header">
<h2>登录到iMeeting</h2>
<button className="close-btn" onClick={closeModal}>
<X size={20} />
</button>
</div>
<form className="login-form" onSubmit={handleLogin}>
<div className="form-group">
<label htmlFor="username">
<User size={18} />
用户名
</label>
<input
type="text"
id="username"
name="username"
value={loginForm.username}
onChange={handleInputChange}
placeholder="请输入用户名"
required
/>
</div>
<div className="form-group">
<label htmlFor="password">
<Lock size={18} />
密码
</label>
<input
type="password"
id="password"
name="password"
value={loginForm.password}
onChange={handleInputChange}
placeholder="请输入密码"
required
/>
</div>
{loginError && (
<div className="error-message">{loginError}</div>
)}
<button
type="submit"
className="submit-btn"
disabled={isLoading}
>
{isLoading ? '登录中...' : '登录'}
</button>
</form>
<div className="demo-info">
2025-09-11 05:16:24 +00:00
<p>开通业务账号</p>
<p>请联系平台管理员</p>
2025-08-05 01:44:28 +00:00
</div>
</div>
</div>
)}
</div>
);
};
export default HomePage;