BIN
public/logo/douban_group.png
Normal file
BIN
public/logo/douban_group.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/logo/github.png
Normal file
BIN
public/logo/github.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
BIN
public/logo/netease_music_toplist.png
Normal file
BIN
public/logo/netease_music_toplist.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
BIN
public/logo/ngabbs.png
Normal file
BIN
public/logo/ngabbs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
BIN
public/logo/qq_music_toplist.png
Normal file
BIN
public/logo/qq_music_toplist.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
BIN
public/logo/v2ex.png
Normal file
BIN
public/logo/v2ex.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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: [],
|
||||
// 链接跳转方式
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user