homeAPI.dart 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import 'package:dio/dio.dart';
  2. import 'package:farmer_client/utils/Request.dart';
  3. import 'showError.dart';
  4. /**
  5. * banner轮播图
  6. * @param {*} data
  7. * @returns
  8. */
  9. Future getHomeBanner(String position) async {
  10. return request('/banner',
  11. options: Options(method: 'GET'), data: {'position': position})
  12. .catchError(showError);
  13. }
  14. /**
  15. * 农机列表
  16. * @param {*} data
  17. * @returns
  18. */
  19. Future getMachinery(params) async {
  20. return request('/machinery',
  21. options: Options(method: 'GET'), queryParameters: params)
  22. .catchError(showError);
  23. }
  24. /**
  25. * 农机列表搜索
  26. * @param {*} data
  27. * @returns
  28. */
  29. Future searchMachinery(params) async {
  30. return request('/machinery',
  31. options: Options(method: 'GET'),
  32. queryParameters: params,
  33. data: params)
  34. .catchError(showError);
  35. }
  36. /**
  37. * 农机分类
  38. * @param {*} data
  39. * @returns
  40. */
  41. Future typeMachinery(
  42. String location,
  43. String typeId,
  44. ) async {
  45. return request('/machinery',
  46. options: Options(method: 'GET'),
  47. queryParameters: {
  48. 'location': location,
  49. 'typeId': typeId,
  50. },
  51. data: {
  52. 'typeId': typeId,
  53. 'location': location
  54. }).catchError(showError);
  55. }
  56. /**
  57. * 农机详情
  58. * @param {*} data
  59. * @returns
  60. */
  61. Future getMachineryInfo(String id, String location, bool attached) async {
  62. return request('/machinery-summary/$id',
  63. options: Options(method: 'GET'),
  64. queryParameters: {'location': location, 'attached': attached});
  65. }
  66. /**
  67. * 农机分类Tab列查询
  68. * @param {*} data
  69. * @returns
  70. */
  71. Future getMachineryType(params) async {
  72. return request('/machinery-type',
  73. options: Options(method: 'GET'), queryParameters: params);
  74. }