1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- import 'package:dio/dio.dart';
- import 'package:farmer_client/utils/Request.dart';
- import 'package:fluttertoast/fluttertoast.dart';
-
- /**
- * banner轮播图
- * @param {*} data
- * @returns
- */
-
- Future getHomeBanner(String position) async {
- return request('/banner',
- options: Options(method: 'GET'), data: {'position': position})
- .catchError((error) => {
- Fluttertoast.showToast(msg: error.error['message']),
- });
- }
-
- /**
- * 农机列表
- * @param {*} data
- * @returns
- */
- Future getMachinery( params) async {
- return request('/machinery', options: Options(method: 'GET'), queryParameters:params).catchError((error) => {
- Fluttertoast.showToast(msg: error.error['message']),
- });
- }
-
- /**
- * 农机列表搜索
- * @param {*} data
- * @returns
- */
- Future searchMachinery(
- String location,
- String? q,
- ) async {
- return request('/machinery',
- options: Options(method: 'GET'),
- queryParameters: {
- 'location': location,
- 'q': q,
- },
- data: {
- 'q': q,
- 'location': location
- }).catchError((error) => {
- Fluttertoast.showToast(msg: error.error['message']),
- });
- }
-
- /**
- * 农机分类
- * @param {*} data
- * @returns
- */
- Future typeMachinery(
- String location,
- String typeId,
- ) async {
- return request('/machinery',
- options: Options(method: 'GET'),
- queryParameters: {
- 'location': location,
- 'typeId': typeId,
- },
- data: {
- 'typeId': typeId,
- 'location': location
- }).catchError((error) => {
- Fluttertoast.showToast(msg: error.error['message']),
- });
- }
-
- /**
- * 农机详情
- * @param {*} data
- * @returns
- */
-
- Future getMachineryInfo(String id, String location, bool attached) async {
- return request('/machinery-summary/$id',
- options: Options(method: 'GET'),
- queryParameters: {'location': location, 'attached': attached})
- .catchError((error) => {
- Fluttertoast.showToast(msg: error.error['message']),
- });
- }
-
- /**
- * 农机分类Tab列查询
- * @param {*} data
- * @returns
- */
- Future getMachineryType() async {
- return request('/machinery-type', options: Options(method: 'GET'));
- }
|