Files
Nexusphp-Panel/templates/site/torrent_detail.html
DengDai ad2c65affb init
2025-12-08 14:31:21 +08:00

101 lines
4.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<div class="mt-2">
{% if error %}
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
{{ error }}
</div>
{% elif torrent %}
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="text-lg font-medium text-gray-900 mb-2">{{ torrent.name }}</h3>
<p class="text-gray-600 mb-4">{{ torrent.data.data.small_descr }}</p>
<div class="space-y-2">
<div class="flex">
<span class="w-24 text-gray-600">文件大小:</span>
<span class="font-medium">{{ torrent.data.data.size_human }}</span>
</div>
<div class="flex">
<span class="w-24 text-gray-600">做种人数:</span>
<span class="font-medium">{{ torrent.data.data.seeders }}</span>
</div>
<div class="flex">
<span class="w-24 text-gray-600">下载人数:</span>
<span class="font-medium">{{ torrent.data.data.leechers }}</span>
</div>
<div class="flex">
<span class="w-24 text-gray-600">完成次数:</span>
<span class="font-medium">{{ torrent.data.data.times_completed }}</span>
</div>
<div class="flex">
<span class="w-24 text-gray-600">发布者:</span>
<span class="font-medium">{{ torrent.data.data.user.username }}</span>
</div>
<div class="flex">
<span class="w-24 text-gray-600">发布时间:</span>
<span class="font-medium">{{ torrent.data.data.added_human }}</span>
</div>
</div>
</div>
<div>
<h4 class="font-medium text-gray-900 mb-2">标签</h4>
<div class="flex flex-wrap gap-2 mb-4">
{% for tag in torrent.data.data.tags %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
{{ tag.name }}
</span>
{% endfor %}
</div>
<h4 class="font-medium text-gray-900 mb-2">操作</h4>
<div class="flex space-x-2">
<button onclick=f"downloadTorrent({{ torrent.data.data.download_url }})"
class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded text-sm">
下载种子
</button>
<button onclick=f"addBookmark({{ torrent.data.data.id }})"
class="bg-yellow-600 hover:bg-yellow-700 text-white font-bold py-2 px-4 rounded text-sm">
{% if torrent.has_bookmarked %}已收藏{% else %}收藏{% endif %}
</button>
</div>
</div>
</div>
<div class="mt-6">
<h4 class="font-medium text-gray-900 mb-2">描述</h4>
<div class="bg-gray-50 p-4 rounded-md">
<p class="text-gray-700">{{ torrent.description }}</p>
</div>
</div>
{% else %}
<p>暂无种子详情数据</p>
{% endif %}
</div>
<script>
function downloadTorrent(torrentId) {
// 在实际应用中,这里会触发种子下载
alert('下载种子功能待实现种子ID: ' + torrentId);
}
function addBookmark(torrentId) {
fetch(`/site/bookmark/add/${torrentId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
})
.then(response => response.json())
.then(data => {
if (data.success) {
alert('收藏状态已更新');
// 可以刷新页面或更新按钮状态
} else {
alert('操作失败: ' + data.error);
}
})
.catch(error => {
alert('操作失败: ' + error.message);
});
}
</script>