上传种子部分
Change-Id: I6657a3a9e57fbbab330e0844ff0b04b78fa3f2dd
diff --git a/src/views/search/search.tsx b/src/views/search/search.tsx
index cd9db91..6dba69c 100644
--- a/src/views/search/search.tsx
+++ b/src/views/search/search.tsx
@@ -16,12 +16,36 @@
tags?: number[];
}
-const tagMap: Record<number, string> = {
- 1: "搞笑",
- 2: "悬疑",
- 3: "教育",
- 4: "动作",
- 5: "剧情"
+const tagMap: Record<string, Record<number, string>> = {
+ Game: {
+ 0: "android",
+ 1: "mac",
+ 2: "pc",
+ 3: "ios",
+ 4: "other",
+ 5: "action",
+ 6: "adventure",
+ 7: "leisure",
+ 8: "riddle",
+ 9: "sport",
+ 10: "strategy",
+ 11: "table",
+ },
+ video: {
+ 20: "视频标签1",
+ 21: "视频标签2",
+ 22: "视频标签3",
+ },
+ music: {
+ 40: "音乐标签1",
+ 41: "音乐标签2",
+ 42: "音乐标签3",
+ },
+ software: {
+ 60: "软件标签1",
+ 61: "软件标签2",
+ 62: "软件标签3",
+ },
};
const SearchPage: React.FC = () => {
@@ -35,6 +59,10 @@
const params = new URLSearchParams(location.search);
const keyword = params.get("keyword");
+ const getTagsForPostType = (postType: string) => {
+ return tagMap[postType] || {};
+ };
+
useEffect(() => {
fetch('/api/posts')
.then((res) => res.json())
@@ -62,6 +90,7 @@
}
setFilteredPosts(filtered);
+
};
return (
@@ -73,10 +102,10 @@
className={styles.selectBox}
>
<option value="all">所有分区</option>
- <option value="影视">影视</option>
- <option value="音乐">音乐</option>
- <option value="游戏">游戏</option>
- <option value="软件">软件</option>
+ <option value="video">影视</option>
+ <option value="music">音乐</option>
+ <option value="Game">游戏</option>
+ <option value="software">软件</option>
</select>
<select
@@ -97,7 +126,7 @@
<div className={styles.centerSection}>
<div className={styles.tagFilters}>
- {Object.entries(tagMap).map(([tagId, tagName]) => (
+ {Object.entries(getTagsForPostType(selectedPostType)).map(([tagId, tagName]) => (
<label key={tagId}>
<input
type="checkbox"