index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * @Author: ZhengXiaowei
  3. * @Date: 2019-10-15 14:05:33
  4. * @LastEditors: ZhengXiaowei
  5. * @LastEditTime: 2019-10-15 14:05:59
  6. * @Description: api
  7. */
  8. import fly from "./fly";
  9. // 获取首页数据
  10. export const getHomeList = (sex) => {
  11. console.log(sex);
  12. return fly.get(`/books/${sex}/index`);
  13. };
  14. // 获取分类
  15. export const getCategory = () => {
  16. return fly.get("/books/getCategory");
  17. }
  18. // 获取书库
  19. export const getBooksList = (params) => {
  20. return fly.get("/books/library", params);
  21. }
  22. // 获取图书详情
  23. export const getBooksInfo = (bid) => {
  24. return fly.get(`/book/${bid}`);
  25. }
  26. // 获取详情页相似数据
  27. export const getSimilarBooks = (category_id, bid) => {
  28. return fly.get("/books/similar", {
  29. category_id,
  30. bid
  31. })
  32. }
  33. // 获取详情页中的目录
  34. export const getShortCatalog = (bid) => {
  35. return fly.get(`/books/${bid}/catalog`, {
  36. page_size: 10,
  37. page: 1
  38. }).then(r => r.list);
  39. }
  40. // 获取充值列表
  41. export const getChargeList = () => {
  42. return fly.get("/order/chargeList");
  43. }
  44. // 获取书架数据
  45. export const getUserShelfBooks = () => {
  46. return fly.get(`/userShelfBooks`);
  47. };