You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

repos.js 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import service from '../service';
  2. // 获取首页数据
  3. export const getHomePageData = () => {
  4. return service({
  5. url: '/recommend/home',
  6. method: 'get',
  7. params: {},
  8. });
  9. }
  10. // 获取项目广场上方tab数据 tab=preferred 项目优选|incubation 启智孵化管道|hot-paper 热门论文项目
  11. export const getReposSquareTabData = (tab) => {
  12. return service({
  13. url: '/explore/repos/square/tab',
  14. method: 'get',
  15. params: {
  16. type: tab
  17. },
  18. });
  19. }
  20. // 搜索项目
  21. // q string 否 关键词
  22. // topic string 否 标签名
  23. // sort string 是 mostpopular 近期热门 | mostactive 近期活跃 | recentupdate 最近更新 | newest 最近创建
  24. // moststars 点赞最多 | mostforks 派生最多 | mostdatasets 数据集最多 | mostaitasks AI任务最多 | mostmodels 模型最多
  25. // pageSize int 是 每页大小,可选值为15 | 30 | 50
  26. // page int 是 页码
  27. export const getReposListData = (params) => {
  28. return service({
  29. url: '/explore/repos/search',
  30. method: 'get',
  31. params: {
  32. q: params.q || '',
  33. topic: params.topic || '',
  34. sort: params.sort || 'mostpopular',
  35. pageSize: params.pageSize || 15,
  36. page: params.page || 1,
  37. },
  38. });
  39. }
  40. // 获取活跃用户列表
  41. export const getActiveUsers = () => {
  42. return service({
  43. url: '/explore/repos/square/active-user',
  44. method: 'get',
  45. params: {},
  46. });
  47. }
  48. // 关注用户
  49. export const followingUsers = (userName, isFollowing) => {
  50. return service({
  51. url: `/api/v1/user/following/${userName}`,
  52. method: isFollowing ? 'put' : 'delete',
  53. params: {},
  54. });
  55. }
  56. // 获取活跃组织列表
  57. export const getActiveOrgs = () => {
  58. return service({
  59. url: '/explore/repos/square/active-org',
  60. method: 'get',
  61. params: {},
  62. });
  63. }