diff --git a/src/api/base.js b/src/api/base.js index b68c2fb7a2746c26f8af9aa00c2bc0ce583fe872..bfcdfb6589478406e5921f2cdce024d127864a02 100644 --- a/src/api/base.js +++ b/src/api/base.js @@ -1,6 +1,7 @@ import axios from "axios"; -const BASIC_URL = "http://zacharyzlj.cn:3000/"; +//const BASIC_URL = "http://zacharyzlj.cn:3000/"; +const BASIC_URL = "http://localhost:3000/"; function createBaseInstance() { const instance = axios.create({ baseURL: BASIC_URL }); diff --git a/src/api/data.js b/src/api/data.js new file mode 100644 index 0000000000000000000000000000000000000000..ce62c2e82da3db8d5948d6c1cd94b234f60d49a9 --- /dev/null +++ b/src/api/data.js @@ -0,0 +1,7 @@ +export const toplistTypes = { + NEW: 3779629, + SOAR: 19723756, + ORIGINAL: 2884035, + HOT: 3778678, + RB: 991319590 +}; diff --git a/src/api/index.js b/src/api/index.js index 916b3e017a70c7acbf47665b0805602ac30afe7e..632d30d1440560057febce67e8d4a3fbc5808db9 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,17 +1,36 @@ import { requset } from "./base"; +export * from "./data"; export const getBanner = () => requset.get("/banner?type=0"); export const getSongers = (initial, type, area, page) => { - let offset = parseInt(page) - 1; + let limit = 80; + let offset = (parseInt(page) - 1) * limit; let params = { initial: initial, type: type, area: area, - limit: 80, + limit: limit, offset: offset }; return requset.get("/artist/list", { params: params }); }; export const getUserDetail = id => requset.get(`/user/detail?uid=${id}`); + +export const getCatList = () => requset.get("(/playlist/catlist"); + +export const getPlayList = (limit, page, cat) => { + let order = "hot"; + let offset = (parseInt(page) - 1) * limit; + let params = { + limit: limit, + offset: offset, + cat: cat, + order: order + }; + return requset.get("/top/playlist", { params: params }); +}; + +export const getTopList = toplistType => + requset.get(`/top/list?id=${toplistType}`);