22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 1 | import React, { useState, useEffect } from 'react'; |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 2 | import { Link } from 'wouter'; |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 3 | import axios from 'axios'; |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 4 | import Recommend from './Recommend/Recommend'; |
22301009 | f9641c5 | 2025-04-15 21:14:56 +0800 | [diff] [blame] | 5 | import Header from '../../components/Header'; // 引入 Header 组件 |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 6 | import './SeedList.css'; |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 7 | import { useUser } from '../../context/UserContext'; |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 8 | |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 9 | const SeedList = () => { |
| 10 | const [seeds, setSeeds] = useState([]); |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 11 | const [loading, setLoading] = useState(true); |
| 12 | const [searchTerm, setSearchTerm] = useState(''); |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 13 | const [sortOption, setSortOption] = useState('最新'); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 14 | const [activeTab, setActiveTab] = useState('种子列表'); |
| 15 | const [filters, setFilters] = useState({}); |
| 16 | const [selectedFilters, setSelectedFilters] = useState({}); |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 17 | const [tagMode, setTagMode] = useState('any'); // 与接口对应,any / all |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 18 | const [errorMsg, setErrorMsg] = useState(''); |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 19 | const { user } = useUser(); |
| 20 | |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 21 | |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 22 | const TAGS = ['猜你喜欢', '电影', '电视剧', '动漫', '音乐', '游戏', '综艺', '软件', '体育', '学习', '纪录片', '其他']; |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 23 | |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 24 | const CATEGORY_MAP = { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 25 | '电影': '电影', |
| 26 | '电视剧': '电视剧', |
| 27 | '动漫': '动漫', |
| 28 | '音乐': '音乐', |
| 29 | '游戏': '游戏', |
| 30 | '综艺': '综艺', |
| 31 | '软件': '软件', |
| 32 | '体育': '体育', |
| 33 | '学习': '学习', |
| 34 | '纪录片': '纪录片', |
| 35 | '其他': '其他', |
| 36 | '猜你喜欢': '', |
| 37 | '种子列表': '', |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | const buildQueryParams = () => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 41 | const category = CATEGORY_MAP[activeTab] || ''; |
| 42 | const orderKey = sortOption === '最新' ? ['upload_time'] : (sortOption === '最热' ? ['downloads'] : ['upload_time']); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 43 | const params = { |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 44 | page: 1, |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 45 | size: 20, |
| 46 | orderKey, |
| 47 | orderDesc: true, |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 48 | }; |
| 49 | |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 50 | if (searchTerm.trim()) { |
| 51 | params.title = searchTerm.trim(); |
| 52 | } |
| 53 | if (category) { |
| 54 | params.category = category; |
| 55 | } |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 56 | |
| 57 | const tags = Object.entries(selectedFilters) |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 58 | .filter(([_, value]) => value !== '不限') |
| 59 | .map(([_, value]) => value); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 60 | |
| 61 | if (tags.length > 0) { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 62 | params.tags = tags; |
| 63 | params.tagMode = tagMode; // any 或 all |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | return params; |
| 67 | }; |
| 68 | |
| 69 | const fetchSeeds = async () => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 70 | if (activeTab === '猜你喜欢') return; |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 71 | setLoading(true); |
| 72 | setErrorMsg(''); |
| 73 | try { |
| 74 | const params = buildQueryParams(); |
22301009 | 4158f3a | 2025-06-06 19:59:10 +0800 | [diff] [blame] | 75 | const response = await axios.get('/seeds/list', params); |
| 76 | // const response = await axios.get('/seeds/list', { params }); |
Krishya | 6bf199c | 2025-06-06 21:14:23 +0800 | [diff] [blame] | 77 | |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 78 | const data = response.data; |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 79 | |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 80 | if (data.code !== 0) { |
| 81 | throw new Error(data.msg || '获取失败'); |
| 82 | } |
| 83 | |
| 84 | setSeeds(data.data || []); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 85 | } catch (error) { |
| 86 | console.error('获取种子列表失败:', error); |
| 87 | setErrorMsg(error.message || '获取失败,请稍后再试。'); |
| 88 | setSeeds([]); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 89 | } finally { |
| 90 | setLoading(false); |
| 91 | } |
| 92 | }; |
| 93 | |
| 94 | const fetchFilterOptions = async () => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 95 | if (activeTab === '猜你喜欢' || !CATEGORY_MAP[activeTab]) return; |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 96 | const category = CATEGORY_MAP[activeTab]; |
| 97 | try { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 98 | const res = await axios.get(`/seed-filters?category=${category}`); |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 99 | const filterData = res.data || {}; |
| 100 | setFilters(filterData); |
| 101 | |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 102 | const defaultSelections = {}; |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 103 | for (const key in filterData) { |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 104 | defaultSelections[key] = '不限'; |
| 105 | } |
| 106 | setSelectedFilters(defaultSelections); |
| 107 | } catch (err) { |
| 108 | console.error('获取筛选项失败:', err); |
| 109 | setFilters({}); |
| 110 | setSelectedFilters({}); |
| 111 | } |
| 112 | }; |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 113 | |
| 114 | useEffect(() => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 115 | fetchFilterOptions(); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 116 | }, [activeTab]); |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 117 | |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 118 | useEffect(() => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 119 | fetchSeeds(); |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 120 | }, [activeTab, sortOption, selectedFilters, tagMode, searchTerm]); |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 121 | |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 122 | // ✅ 修改后的下载函数 |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 123 | const handleDownload = async (seedId) => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 124 | if (!user || !user.userId) { |
| 125 | alert('请先登录再下载种子文件'); |
| 126 | return; |
| 127 | } |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 128 | |
| 129 | try { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 130 | const response = await axios.get(`/seeds/${seedId}/download`, { |
| 131 | params: { |
| 132 | passkey: user.userId, |
| 133 | }, |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 134 | responseType: 'blob' |
| 135 | }); |
| 136 | |
| 137 | const blob = new Blob([response.data], { type: 'application/x-bittorrent' }); |
| 138 | const downloadUrl = URL.createObjectURL(blob); |
| 139 | const a = document.createElement('a'); |
| 140 | a.href = downloadUrl; |
| 141 | a.download = `${seedId}.torrent`; |
| 142 | a.click(); |
| 143 | URL.revokeObjectURL(downloadUrl); |
| 144 | } catch (error) { |
| 145 | console.error('下载失败:', error); |
| 146 | alert('下载失败,请稍后再试。'); |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 147 | } |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 148 | }; |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 149 | |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 150 | const handleFilterChange = (key, value) => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 151 | setSelectedFilters(prev => ({ |
| 152 | ...prev, |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 153 | [key]: value |
| 154 | })); |
| 155 | }; |
| 156 | |
| 157 | const clearFilter = (key) => { |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 158 | setSelectedFilters(prev => ({ |
| 159 | ...prev, |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 160 | [key]: '不限' |
| 161 | })); |
| 162 | }; |
| 163 | |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 164 | return ( |
Krishya | f1d0ea8 | 2025-05-03 17:01:58 +0800 | [diff] [blame] | 165 | <div className="seed-list-container"> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 166 | <Header /> |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 167 | |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 168 | <div className="controls"> |
| 169 | <input |
| 170 | type="text" |
| 171 | placeholder="搜索种子..." |
| 172 | value={searchTerm} |
| 173 | onChange={(e) => setSearchTerm(e.target.value)} |
| 174 | className="search-input" |
| 175 | /> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 176 | <select |
| 177 | value={sortOption} |
| 178 | onChange={(e) => setSortOption(e.target.value)} |
| 179 | className="sort-select" |
| 180 | > |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 181 | <option value="最新">最新</option> |
| 182 | <option value="最热">最热</option> |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 183 | </select> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 184 | <select |
| 185 | value={tagMode} |
| 186 | onChange={(e) => setTagMode(e.target.value)} |
| 187 | className="tag-mode-select" |
| 188 | > |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 189 | <option value="any">包含任意标签</option> |
| 190 | <option value="all">包含所有标签</option> |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 191 | </select> |
| 192 | </div> |
| 193 | |
| 194 | <div className="tag-filters"> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 195 | {TAGS.map(tag => ( |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 196 | <button |
| 197 | key={tag} |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 198 | className={`tag-button ${activeTab === tag ? 'active-tag' : ''}`} |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 199 | onClick={() => { |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 200 | setActiveTab(tag); |
| 201 | setFilters({}); |
| 202 | setSelectedFilters({}); |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 203 | }} |
| 204 | > |
| 205 | {tag} |
| 206 | </button> |
| 207 | ))} |
| 208 | </div> |
| 209 | |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 210 | {activeTab !== '猜你喜欢' && Object.keys(filters).length > 0 && ( |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 211 | <div className="filter-bar"> |
| 212 | {Object.entries(filters).map(([key, options]) => ( |
| 213 | <div className="filter-group" key={key}> |
| 214 | <label>{key}:</label> |
| 215 | <select |
| 216 | value={selectedFilters[key]} |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 217 | onChange={(e) => handleFilterChange(key, e.target.value)} |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 218 | > |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 219 | {options.map(opt => ( |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 220 | <option key={opt} value={opt}>{opt}</option> |
| 221 | ))} |
| 222 | </select> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 223 | {selectedFilters[key] !== '不限' && ( |
| 224 | <button |
| 225 | className="clear-filter-btn" |
| 226 | onClick={() => clearFilter(key)} |
| 227 | > |
| 228 | ✕ |
| 229 | </button> |
22301009 | 5b28c67 | 2025-04-10 20:12:45 +0800 | [diff] [blame] | 230 | )} |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 231 | </div> |
| 232 | ))} |
| 233 | </div> |
| 234 | )} |
| 235 | |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 236 | <div className="seed-list-content"> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 237 | {activeTab === '猜你喜欢' ? ( |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 238 | <Recommend /> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 239 | ) : loading ? ( |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 240 | <p>加载中...</p> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 241 | ) : errorMsg ? ( |
22301009 | afbcf4b | 2025-04-10 16:08:39 +0800 | [diff] [blame] | 242 | <p className="error-text">{errorMsg}</p> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 243 | ) : seeds.length === 0 ? ( |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 244 | <p>未找到符合条件的种子。</p> |
| 245 | ) : ( |
Krishya | 25590de | 2025-04-21 19:03:49 +0800 | [diff] [blame] | 246 | <div className="seed-list-card"> |
| 247 | <div className="seed-list-header"> |
| 248 | <div className="seed-header-cover"></div> |
| 249 | <div className="seed-header-title">种子名称</div> |
| 250 | <div className="seed-header-size">大小</div> |
| 251 | <div className="seed-header-upload-time">上传时间</div> |
| 252 | <div className="seed-header-downloads">下载次数</div> |
| 253 | <div className="seed-header-actions">操作</div> |
| 254 | </div> |
| 255 | <div className="seed-list-body"> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 256 | {seeds.map((seed, index) => { |
| 257 | // 处理 tags 字段,兼容字符串和数组 |
| 258 | let tagsArray = []; |
| 259 | if (seed.tags) { |
| 260 | if (Array.isArray(seed.tags)) { |
| 261 | tagsArray = seed.tags; |
| 262 | } else if (typeof seed.tags === 'string') { |
| 263 | try { |
| 264 | tagsArray = JSON.parse(seed.tags); |
| 265 | if (!Array.isArray(tagsArray)) { |
| 266 | // 解析后不是数组,按逗号分割 |
| 267 | tagsArray = seed.tags.split(',').map(t => t.trim()).filter(t => t); |
| 268 | } |
| 269 | } catch { |
| 270 | // 解析失败,按逗号分割 |
| 271 | tagsArray = seed.tags.split(',').map(t => t.trim()).filter(t => t); |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | return ( |
| 277 | |
| 278 | <Link to={`/seed/${seed.id}`} key={index} className="seed-item-link"> |
| 279 | <div className="seed-item"> |
22301009 | 4158f3a | 2025-06-06 19:59:10 +0800 | [diff] [blame] | 280 | {seed.imageUrl && ( |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 281 | <img |
22301009 | 4158f3a | 2025-06-06 19:59:10 +0800 | [diff] [blame] | 282 | src={seed.imageUrl} |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 283 | alt={seed.title} |
| 284 | className="seed-item-cover" |
| 285 | /> |
| 286 | )} |
22301009 | 4158f3a | 2025-06-06 19:59:10 +0800 | [diff] [blame] | 287 | |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 288 | <div className="seed-item-title"> |
| 289 | <div className="seed-title-row"> |
| 290 | <h3 className="seed-title">{seed.title}</h3> |
| 291 | <div className="seed-tags"> |
| 292 | {tagsArray.map((tag, i) => ( |
| 293 | <span key={i} className="tag-label">{tag}</span> |
| 294 | ))} |
| 295 | </div> |
Krishya | 25590de | 2025-04-21 19:03:49 +0800 | [diff] [blame] | 296 | </div> |
| 297 | </div> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 298 | <div className="seed-item-size">{seed.size || '未知'}</div> |
| 299 | <div className="seed-item-upload-time">{seed.upload_time?.split('T')[0] || '未知'}</div> |
| 300 | <div className="seed-item-downloads">{seed.downloads ?? 0} 次下载</div> |
| 301 | <div |
| 302 | className="seed-item-actions" |
| 303 | onClick={e => e.stopPropagation()} // 阻止事件冒泡,避免跳转 |
Krishya | 25590de | 2025-04-21 19:03:49 +0800 | [diff] [blame] | 304 | > |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 305 | <button |
| 306 | className="btn-primary" |
| 307 | onClick={e => { |
| 308 | e.preventDefault(); |
| 309 | e.stopPropagation(); |
| 310 | handleDownload(seed.id); |
| 311 | }} |
| 312 | > |
| 313 | 下载 |
| 314 | </button> |
| 315 | <button |
| 316 | className="btn-outline" |
| 317 | onClick={async (e) => { |
| 318 | e.preventDefault(); |
| 319 | e.stopPropagation(); |
| 320 | |
| 321 | if (!user || !user.userId) { |
| 322 | alert('请先登录再收藏'); |
| 323 | return; |
| 324 | } |
| 325 | |
| 326 | try { |
| 327 | const res = await axios.post(`/seeds/${seed.id}/favorite-toggle`, null, { |
| 328 | params: { user_id: user.userId }, |
| 329 | }); |
| 330 | |
| 331 | if (res.data.code === 0) { |
| 332 | alert('操作成功'); // 你可以改成 toast 或 icon 状态提示 |
| 333 | } else { |
| 334 | alert(res.data.msg || '操作失败'); |
| 335 | } |
| 336 | } catch (err) { |
| 337 | console.error('收藏失败:', err); |
| 338 | alert('收藏失败,请稍后再试。'); |
| 339 | } |
| 340 | }} |
| 341 | > |
| 342 | 收藏 |
| 343 | </button> |
| 344 | |
| 345 | </div> |
Krishya | 25590de | 2025-04-21 19:03:49 +0800 | [diff] [blame] | 346 | </div> |
22301009 | 80aaf0d | 2025-06-05 23:20:05 +0800 | [diff] [blame] | 347 | </Link> |
| 348 | ); |
| 349 | })} |
Krishya | 25590de | 2025-04-21 19:03:49 +0800 | [diff] [blame] | 350 | </div> |
22301009 | ecc1c1c | 2025-04-09 21:56:23 +0800 | [diff] [blame] | 351 | </div> |
| 352 | )} |
| 353 | </div> |
| 354 | </div> |
| 355 | ); |
| 356 | }; |
| 357 | |
| 358 | export default SeedList; |