homeAPI.dart 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import 'package:dio/dio.dart';
  2. import 'package:farmer_client/utils/Request.dart';
  3. import 'package:fluttertoast/fluttertoast.dart';
  4. /**
  5. * banner轮播图
  6. * @param {*} data
  7. * @returns
  8. */
  9. Future getHomeBanner(String position)async{
  10. return request('/banner',options: Options(method: 'GET'),data: { 'position': position}).catchError((error) =>
  11. { Fluttertoast.showToast(
  12. msg: error.error['message']
  13. ),});
  14. }
  15. /**
  16. * 农机列表
  17. * @param {*} data
  18. * @returns
  19. */
  20. Future getMachinery(String location)async{
  21. return request('/machinery',options: Options(method: 'GET'),queryParameters: { 'location': location}).catchError((error) =>
  22. { Fluttertoast.showToast(
  23. msg: error.error['message']
  24. ),});
  25. }
  26. /**
  27. * 农机详情
  28. * @param {*} data
  29. * @returns
  30. */
  31. Future getMachineryInfo(String id,String location ,bool attached)async{
  32. return request('/machinery-summary/$id',options: Options(method: 'GET'),queryParameters: { 'location': location,'attached': attached}).catchError((error) =>
  33. { Fluttertoast.showToast(
  34. msg: error.error['message']
  35. ),});
  36. }
  37. /**
  38. * 农机分类Tab列查询
  39. * @param {*} data
  40. * @returns
  41. */
  42. Future getMachineryType()async{
  43. return request('/machinery-type',options: Options(method: 'GET'));
  44. }