product.js 779 B

12345678910111213141516171819202122232425
  1. import request from '../utils/request.js'
  2. class product extends request {
  3. // static errorHandel(res) {
  4. // console.log(res);
  5. // }
  6. static async getProductList(productType=1,page = 1, pageSize = 10) {
  7. const res = await this.getRequest(`${this.BASE_URL}Product/index?productTypeId=${productType}&page=${page}&pageSize=${pageSize}`)
  8. return res.data;
  9. }
  10. static async getProductById(id) {
  11. const res = await this.getRequest(`${this.BASE_URL}Product/read?id=${id}`)
  12. return res.data;
  13. }
  14. static async getProductTypeList(page = 1, pageSize = 10) {
  15. const res = await this.getRequest(`${this.BASE_URL}Product/typeList?page=${page}&pageSize=${pageSize}`)
  16. return res.data;
  17. }
  18. }
  19. export default product