修改促销、优化页面布局
Change-Id: Iae813b5b6557efa7059fe6d94bc32e96c984e4ea
diff --git a/src/pages/Forum/promotion-part/TorrentDetailDialog.jsx b/src/pages/Forum/promotion-part/TorrentDetailDialog.jsx
new file mode 100644
index 0000000..f038b90
--- /dev/null
+++ b/src/pages/Forum/promotion-part/TorrentDetailDialog.jsx
@@ -0,0 +1,130 @@
+import React from 'react';
+
+const TorrentDetailDialog = ({
+ showTorrentDialog,
+ torrentDetail,
+ closeTorrentDialog
+}) => {
+ const formatSize = (bytes) => {
+ if (bytes === 0) return '0 B';
+
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
+
+ return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
+ };
+
+ const formatDateTime = (dateTime) => {
+ if (!dateTime) return '未知';
+ return new Date(dateTime).toLocaleString();
+ };
+
+ return (
+ showTorrentDialog && torrentDetail && (
+ <div className="torrent-detail-overlay">
+ <div className="torrent-detail-dialog">
+ <h3 className="torrent-detail-title">种子详情 - {torrentDetail.title}</h3>
+ <button
+ className="close-btn"
+ onClick={closeTorrentDialog}
+ >
+ ×
+ </button>
+
+ {/* 封面图片 */}
+ {torrentDetail.coverImage && (
+ <div className="torrent-cover-container">
+ <img
+ src={torrentDetail.coverImage}
+ alt={`${torrentDetail.name}封面`}
+ className="torrent-cover"
+ />
+ </div>
+ )}
+
+ <div className="torrent-detail-content">
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">种子ID:</span>
+ <span className="torrent-detail-value">{torrentDetail.id}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">种子名称:</span>
+ <span className="torrent-detail-value">{torrentDetail.title}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">分类:</span>
+ <span className="torrent-detail-value">{torrentDetail.category || '未分类'}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">大小:</span>
+ <span className="torrent-detail-value">{formatSize(torrentDetail.size)}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">上传者:</span>
+ <span className="torrent-detail-value">{torrentDetail.username || '匿名'}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">上传时间:</span>
+ <span className="torrent-detail-value">{formatDateTime(torrentDetail.createTime)}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">做种人数:</span>
+ <span className="torrent-detail-value">{torrentDetail.seeders || 0}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">下载人数:</span>
+ <span className="torrent-detail-value">{torrentDetail.leechers || 0}</span>
+ </div>
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">完成次数:</span>
+ <span className="torrent-detail-value">{torrentDetail.completed || 0}</span>
+ </div>
+
+ {/* 种子状态 */}
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">状态:</span>
+ <span className="torrent-detail-value">
+ {torrentDetail.seeders > 10 ? (
+ <span className="status-badge hot">热门</span>
+ ) : torrentDetail.seeders === 0 ? (
+ <span className="status-badge cold">冷门</span>
+ ) : (
+ <span className="status-badge normal">普通</span>
+ )}
+ </span>
+ </div>
+
+ {/* 种子描述 */}
+ {torrentDetail.description && (
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">描述:</span>
+ <div className="torrent-detail-value description">{torrentDetail.description}</div>
+ </div>
+ )}
+
+ {/* 下载链接 */}
+ {torrentDetail.downloadUrl && (
+ <div className="torrent-detail-item">
+ <span className="torrent-detail-label">下载:</span>
+ <a
+ href={torrentDetail.downloadUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="download-link"
+ >
+ <i className="fa fa-download"></i> 下载种子
+ </a>
+ </div>
+ )}
+ </div>
+
+ <div className="dialog-buttons">
+ <button onClick={closeTorrentDialog}>关闭</button>
+ </div>
+ </div>
+ </div>
+ )
+ );
+};
+
+export default TorrentDetailDialog;
\ No newline at end of file