httpRequestApi.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { httpUrls } from './consts'
  2. import { RequestService } from './httpRequest'
  3. import wepy from 'wepy'
  4. const HOST = httpUrls.baseApi
  5. function genAPIUrl(action) {
  6. return HOST + action
  7. }
  8. export class httpRequestApi {
  9. // 请求任务列表
  10. static getTaskList (pageNo, pageSize) {
  11. const url = genAPIUrl('wx/joinUser')
  12. return RequestService.sendRequest().url(url).header({
  13. uid: wepy.getStorageSync('uid')
  14. }).data({
  15. pageNo,
  16. pageSize,
  17. uid: wepy.getStorageSync('uid')
  18. }).send()
  19. }
  20. // 列表详情
  21. static getTaskFile (taskId) {
  22. const url = genAPIUrl('wx/taskFile')
  23. return RequestService.sendRequest().url(url).data({
  24. taskId
  25. }).send()
  26. }
  27. // 删除
  28. static delFile (id, fileStatus) {
  29. const url = genAPIUrl('wx/joinUser')
  30. return RequestService.sendRequest().header({
  31. uid: wepy.getStorageSync('uid')
  32. }).url(url).method('PUT').data({
  33. id,
  34. fileStatus
  35. }).send()
  36. }
  37. // 添加观看记录
  38. static addViewLog (fileId, taskId) {
  39. const url = genAPIUrl('wx/viewLog')
  40. return RequestService.sendRequest().header({
  41. uid: wepy.getStorageSync('uid')
  42. }).url(url).method('POST').data({
  43. fileId,
  44. taskId
  45. }).send()
  46. }
  47. // 观看记录列表
  48. static getLogList (pageNo, pageSize) {
  49. const url = genAPIUrl('wx/viewLog')
  50. return RequestService.sendRequest().header({
  51. uid: wepy.getStorageSync('uid')
  52. }).data({
  53. pageNo,
  54. pageSize
  55. }).url(url).send()
  56. }
  57. }