Akane1217 | 65b61a7 | 2025-05-17 13:52:25 +0800 | [diff] [blame] | 1 | import React from 'react';
|
| 2 | import { useNavigate,useLocation } from 'react-router-dom';
|
| 3 | import './personalSubpage.css';
|
| 4 |
|
| 5 | const Upload = ({ onLogout }) => {
|
| 6 | const navigate = useNavigate();
|
| 7 | const location = useLocation();
|
| 8 | const [uploads] = React.useState([
|
| 9 | { id: 1, name: '星际穿越', status: '已发布', date: '2023-10-15', size: '15.2GB' },
|
| 10 | { id: 2, name: '黑暗骑士', status: '审核中', date: '2023-10-18', size: '12.7GB' }
|
| 11 | ]);
|
| 12 |
|
| 13 | const handleBack = () => {
|
| 14 | // 返回个人中心,并携带来源标记
|
| 15 | navigate('/personal', {
|
| 16 | state: {
|
| 17 | fromSubpage: true, // 标记来自子页面
|
| 18 | dashboardTab: location.state?.dashboardTab // 保留Dashboard的标签页状态
|
| 19 | },
|
| 20 | replace: true // 替换当前历史记录
|
| 21 | });
|
| 22 | };
|
| 23 | return (
|
| 24 | <div className="subpage-container">
|
| 25 | <button className="back-button" onClick={(handleBack)}>
|
| 26 | ← 返回个人中心
|
| 27 | </button>
|
| 28 |
|
| 29 | <h2 className="page-title">上传记录</h2>
|
| 30 |
|
| 31 | <table className="uploads-table">
|
| 32 | <thead>
|
| 33 | <tr>
|
| 34 | <th>资源名称</th>
|
| 35 | <th>大小</th>
|
| 36 | <th>状态</th>
|
| 37 | <th>上传时间</th>
|
| 38 | <th>操作</th>
|
| 39 | </tr>
|
| 40 | </thead>
|
| 41 | <tbody>
|
| 42 | {uploads.map(item => (
|
| 43 | <tr key={item.id} className="list-item">
|
| 44 | <td>{item.name}</td>
|
| 45 | <td>{item.size}</td>
|
| 46 | <td>
|
| 47 | <span className={`status-badge ${
|
| 48 | item.status === '已发布' ? 'published' : 'pending'
|
| 49 | }`}>
|
| 50 | {item.status}
|
| 51 | </span>
|
| 52 | </td>
|
| 53 | <td>{item.date}</td>
|
| 54 | <td>
|
| 55 | <button className="action-btn">详情</button>
|
| 56 | </td>
|
| 57 | </tr>
|
| 58 | ))}
|
| 59 | </tbody>
|
| 60 | </table>
|
| 61 | </div>
|
| 62 | );
|
| 63 | };
|
| 64 |
|
| 65 | export default Upload; |