Merge pull request #20 from rehiy/master

pr: 添加缺失的卡片
This commit is contained in:
底层用户
2024-03-01 10:27:50 +08:00
committed by GitHub
10 changed files with 41 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
public/logo/github.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
public/logo/ngabbs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

BIN
public/logo/v2ex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -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,
});
};

View File

@@ -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;

View File

@@ -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: [],
// 链接跳转方式

View File

@@ -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;