homeAPI.dart 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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',
  11. options: Options(method: 'GET'), data: {'position': position})
  12. .catchError((error) => {
  13. Fluttertoast.showToast(msg: error.error['message']),
  14. });
  15. }
  16. /**
  17. * 农机列表
  18. * @param {*} data
  19. * @returns
  20. */
  21. Future getMachinery(String location) async {
  22. return request('/machinery', options: Options(method: 'GET'), queryParameters: {
  23. 'location': location
  24. }).catchError((error) => {
  25. Fluttertoast.showToast(msg: error.error['message']),
  26. });
  27. }
  28. /**
  29. * 农机详情
  30. * @param {*} data
  31. * @returns
  32. */
  33. Future getMachineryInfo(String id,String location ,bool attached)async {
  34. return request('/machinery-summary/$id', options: Options(method: 'GET'),
  35. queryParameters: { 'location': location, 'attached': attached})
  36. .catchError((error) =>
  37. { Fluttertoast.showToast(
  38. msg: error.error['message']
  39. ),});
  40. }
  41. /**
  42. * 农机分类Tab列查询
  43. * @param {*} data
  44. * @returns
  45. */
  46. Future getMachineryType() async {
  47. return request('/machinery-type', options: Options(method: 'GET'));
  48. }