diff --git a/public/logo/douban_group.png b/public/logo/douban_group.png new file mode 100644 index 0000000..7543a04 Binary files /dev/null and b/public/logo/douban_group.png differ diff --git a/public/logo/github.png b/public/logo/github.png new file mode 100644 index 0000000..dd4776c Binary files /dev/null and b/public/logo/github.png differ diff --git a/public/logo/netease_music_toplist.png b/public/logo/netease_music_toplist.png new file mode 100644 index 0000000..1c7e29f Binary files /dev/null and b/public/logo/netease_music_toplist.png differ diff --git a/public/logo/ngabbs.png b/public/logo/ngabbs.png new file mode 100644 index 0000000..99f59b5 Binary files /dev/null and b/public/logo/ngabbs.png differ diff --git a/public/logo/qq_music_toplist.png b/public/logo/qq_music_toplist.png new file mode 100644 index 0000000..a516ec8 Binary files /dev/null and b/public/logo/qq_music_toplist.png differ diff --git a/public/logo/v2ex.png b/public/logo/v2ex.png new file mode 100644 index 0000000..41b4075 Binary files /dev/null and b/public/logo/v2ex.png differ diff --git a/src/api/index.js b/src/api/index.js index 80400e5..474b1ca 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -4,11 +4,13 @@ import axios from "@/api/request"; * 获取热榜分类数据 * @param {string} type 热榜分类名称 * @param {boolean} isNew 是否拉取最新数据 + * @param {object} params 请求参数 * @returns */ -export const getHotLists = (type, isNew) => { +export const getHotLists = (type, isNew, params) => { return axios({ method: "GET", url: `/${type}${isNew ? "/new" : "/"}`, + params, }); }; diff --git a/src/components/HotList.vue b/src/components/HotList.vue index fff212f..4f43f5e 100644 --- a/src/components/HotList.vue +++ b/src/components/HotList.vue @@ -166,11 +166,12 @@ const listLoading = ref(false); const loadingError = ref(false); // 获取热榜数据 -const getHotListsData = async (type, isNew = false) => { +const getHotListsData = async (name, isNew = false) => { try { // hotListData.value = null; loadingError.value = false; - const result = await getHotLists(type, isNew); + const item = store.newsArr.find((item) => item.name == name) + const result = await getHotLists(item.name, isNew, item.params); // console.log(result); if (result.code === 200) { listLoading.value = false; diff --git a/src/store/index.js b/src/store/index.js index 84e93be..e5b76fb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -122,6 +122,38 @@ export const mainStore = defineStore("mainData", { order: 18, show: true, }, + { + label: "豆瓣讨论小组", + name: "douban_group", + order: 19, + show: true, + }, + { + label: "网易云音乐", + name: "netease_music_toplist", + params: { type: 1 }, + order: 20, + show: true, + }, + { + label: "QQ音乐热歌榜", + name: "qq_music_toplist", + params: { type: 1 }, + order: 21, + show: true, + }, + { + label: "NGA", + name: "ngabbs", + order: 22, + show: true, + }, + { + label: "V2EX", + name: "v2ex", + order: 23, + show: true, + }, ], newsArr: [], // 链接跳转方式 diff --git a/src/views/List.vue b/src/views/List.vue index c7455ef..530b2c3 100644 --- a/src/views/List.vue +++ b/src/views/List.vue @@ -141,9 +141,10 @@ const pageNumber = ref( const listData = ref(null); // 获取热榜数据 -const getHotListsData = (type, isNew = false) => { +const getHotListsData = async (name, isNew = false) => { listData.value = null; - getHotLists(type, isNew).then((res) => { + const item = store.newsArr.find((item) => item.name == name) + getHotLists(item.name, isNew, item.params).then((res) => { console.log(res); if (res.code === 200) { listData.value = res;