appraise.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // const { useParamsEaseFuncs } = require('XrFrame/xrFrameSystem');
  2. const { request } = require('../utils/request')
  3. const API = {
  4. createCommentURL: '/appraise/create',
  5. loginURL: '/user/login',
  6. getUserInfoURL: '/user/info',
  7. registerURL: '/user/register',
  8. modifyURL: '/user/modify',
  9. getOrderURL: '/order/user',
  10. getCategoryURL: '/category',
  11. getCategoryGoodsURL: '/goods/category',
  12. getAllGoodsURL: '/goods',
  13. getSearchGoodsURL: '/goods/search'
  14. }
  15. //查询列表时传参---注意参数数据类型
  16. function createCommont(data) {
  17. //Promise
  18. return request.post(
  19. API.createCommentURL,
  20. {
  21. data: data
  22. }
  23. );
  24. }
  25. /**
  26. * @param: {pageNum, pageSize}
  27. */
  28. //传对象给params
  29. function getCommentList(params) {
  30. return request.get(
  31. API.createCommentURL,
  32. {
  33. params: params,//是传入的形参
  34. }
  35. );
  36. }
  37. // //超时设置:timeout: 1000 * 60 * 30
  38. // function deleteComment() {
  39. // }
  40. function login(params) {
  41. return request.post(
  42. API.loginURL,
  43. {
  44. header: params.header,
  45. data: params.data,
  46. }
  47. );
  48. }
  49. function getUserInfo(params) {
  50. return request.get(
  51. API.getUserInfoURL,
  52. {
  53. header: params.header,
  54. params: params.data,
  55. }
  56. );
  57. }
  58. function register(params) {
  59. return request.post(
  60. API.registerURL,
  61. {
  62. data: params.data,
  63. }
  64. );
  65. }
  66. function modify(params) {
  67. return request.post(
  68. API.modifyURL,
  69. {
  70. data: params.data,
  71. }
  72. );
  73. }
  74. function getOrder(params) {
  75. return request.get(
  76. API.getOrderURL,
  77. {
  78. params: params.data,
  79. }
  80. )
  81. }
  82. // 获取分类信息
  83. function getCategoryAPI() {
  84. // return http( API.getCategoryURL, {data: data})
  85. return request.get(
  86. API.getCategoryURL,
  87. )
  88. }
  89. // 获取分类出来的商品信息
  90. function getClassifyGoods(data) {
  91. return request.get(
  92. API.getCategoryGoodsURL + `/${data.page}/${data.pageSize}` + '?category=' + data.id
  93. )
  94. }
  95. //获取所有的商品
  96. function getAllGoods(data) {
  97. return request.get(
  98. API.getAllGoodsURL + `/${data.page}/${data.pageSize}`
  99. )
  100. }
  101. //搜索获取商品
  102. function searchGoods(data) {
  103. return request.get(
  104. API.getSearchGoodsURL + `/${data.page}/${data.pageSize}` + '?search=' + data.inputValue
  105. )
  106. }
  107. module.exports = {
  108. createCommont,
  109. getCommentList,
  110. login,
  111. getUserInfo,
  112. register,
  113. modify,
  114. getOrder,
  115. getCategoryAPI,
  116. getClassifyGoods,
  117. loginURl: API.loginURL,
  118. registerURL: API.registerURL,
  119. getAllGoods,
  120. searchGoods
  121. }