homeAPI.dart 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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',
  35. options: Options(method: 'GET'),
  36. queryParameters: {'id': id},
  37. data: {'location': location, 'attached': attached})
  38. .catchError((error) => {
  39. Fluttertoast.showToast(msg: error.error['message']),
  40. });
  41. }
  42. /**
  43. * 农机分类Tab列查询
  44. * @param {*} data
  45. * @returns
  46. */
  47. Future getMachineryType() async {
  48. return request('/machinery-type', options: Options(method: 'GET'));
  49. }