Skip to content

Commit

Permalink
Merge pull request #20 from rehiy/master
Browse files Browse the repository at this point in the history
pr: 添加缺失的卡片
  • Loading branch information
imsyy authored Mar 1, 2024
2 parents 90b9388 + 339248b commit a274cf6
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 5 deletions.
Binary file added public/logo/douban_group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo/netease_music_toplist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo/ngabbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo/qq_music_toplist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo/v2ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};
5 changes: 3 additions & 2 deletions src/components/HotList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
32 changes: 32 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
// 链接跳转方式
Expand Down
5 changes: 3 additions & 2 deletions src/views/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a274cf6

Please sign in to comment.