APIClient.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const request = require('./WXHttpRequest.js');
  2. const url = require('./const.js');
  3. const HOST = url.apiUrl;
  4. function genAPIUrl(action) {
  5. return HOST + action;
  6. }
  7. module.exports = {
  8. // 获取我的data
  9. getMySchedule(header) {
  10. let url = genAPIUrl('wx/ucenter');
  11. return request.getInstance().url(url).header(header).send();
  12. },
  13. //获取推荐课程
  14. getRecommendSchedule(header) {
  15. let url = genAPIUrl('wx/course/recommend');
  16. return request.getInstance().url(url).header(header).send();
  17. },
  18. //发送上传图片
  19. getSendSchedule(header, data) {
  20. let url = genAPIUrl('wx/posts');
  21. return request.getInstance().url(url).header(header).data(data).method('POST').send();
  22. },
  23. //获取分享作品list
  24. getProductionSchedule(header, data) {
  25. let url = genAPIUrl('wx/posts/reply');
  26. return request.getInstance().url(url).header(header).data(data).method('GET').send();
  27. },
  28. //保存评论
  29. getDiscussSchedule(header, data) {
  30. let url = genAPIUrl('wx/reply');
  31. return request.getInstance().url(url).header(header).data(data).method('POST').send();
  32. },
  33. //分享查询单条
  34. getOneSchedule(header, data) {
  35. let url = genAPIUrl('wx/posts/one');
  36. return request.getInstance().url(url).header(header).data(data).method('GET').send();
  37. },
  38. //各个科目信息
  39. getEachSchedule(header, data) {
  40. let url = genAPIUrl('wx/course');
  41. return request.getInstance().url(url).header(header).data(data).method('GET').send();
  42. },
  43. //各个排名
  44. getFriendSchedule(urls, header) {
  45. let url = genAPIUrl(urls);
  46. return request.getInstance().url(url).header(header).method('GET').send();
  47. },
  48. //更改昵称
  49. getSetNameSchedule(header, data) {
  50. let url = genAPIUrl('wx/ucenter/user/update');
  51. return request.getInstance().url(url).header(header).data(data).method('GET').send();
  52. },
  53. //分享后点赞
  54. getLikeSchedule(header, data) {
  55. let url = genAPIUrl('wx/posts/attribute');
  56. return request.getInstance().url(url).header(header).data(data).method('GET').send();
  57. },
  58. //取消小点
  59. cancelDian(header, data) {
  60. let url = genAPIUrl('wx/posts/readCount');
  61. return request.getInstance().url(url).header(header).data(data).method('GET').send();
  62. }
  63. }