李志伟 3 lat temu
rodzic
commit
8201cd6782

+ 4
- 4
lib/models/app.dart Wyświetl plik

1
 import 'dart:convert';
1
 import 'dart:convert';
2
 import 'dart:io';
2
 import 'dart:io';
3
 import 'package:amap_flutter_location/amap_flutter_location.dart';
3
 import 'package:amap_flutter_location/amap_flutter_location.dart';
4
+import 'package:get/get.dart';
4
 import 'package:get_storage/get_storage.dart';
5
 import 'package:get_storage/get_storage.dart';
5
 import 'package:worker_client/services/amap.dart';
6
 import 'package:worker_client/services/amap.dart';
6
 import 'package:worker_client/services/user.dart';
7
 import 'package:worker_client/services/user.dart';
7
-import '/models/entities/person.dart';
8
+import 'entities/person.dart';
8
 import '/widgets/Modal.dart';
9
 import '/widgets/Modal.dart';
9
-import 'package:get/get.dart';
10
 import '../utils/location.dart';
10
 import '../utils/location.dart';
11
 
11
 
12
 class AppController extends GetxController {
12
 class AppController extends GetxController {
29
   }
29
   }
30
 
30
 
31
   void onLocationChange(Map<String, Object> result) {
31
   void onLocationChange(Map<String, Object> result) {
32
-    if (box.read('token') == null){
32
+    if (box.read('token') == null) {
33
       location(result);
33
       location(result);
34
-    }else if(result['address']==null ){
34
+    } else if (result['address'] == '') {
35
       setAmap({
35
       setAmap({
36
         //定位有问题
36
         //定位有问题
37
         // 'params': 'location=${result['longitude'].toString()},${result['latitude'].toString()}',
37
         // 'params': 'location=${result['longitude'].toString()},${result['latitude'].toString()}',

+ 3
- 1
lib/pages/addBankCard/index.dart Wyświetl plik

89
         });
89
         });
90
         bankList(list);
90
         bankList(list);
91
       },
91
       },
92
-    );
92
+    ).catchError((error){
93
+      Fluttertoast.showToast(msg: error.error['message']);
94
+    });
93
   }
95
   }
94
 
96
 
95
   @override
97
   @override

+ 6
- 0
lib/pages/bankList/index.dart Wyświetl plik

55
           }
55
           }
56
           bankCardListStore.bankCardList(list1);
56
           bankCardListStore.bankCardList(list1);
57
           EasyLoading.dismiss();
57
           EasyLoading.dismiss();
58
+        }).catchError((error){
59
+          EasyLoading.dismiss();
60
+          Fluttertoast.showToast(msg: error.error['message']);
58
         });
61
         });
62
+      }).catchError((error2){
63
+        EasyLoading.dismiss();
64
+        Fluttertoast.showToast(msg: error2.error['message']);
59
       });
65
       });
60
     }
66
     }
61
   }
67
   }

+ 33
- 19
lib/pages/jobDetail/index.dart Wyświetl plik

1
 import 'dart:convert';
1
 import 'dart:convert';
2
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
3
+import 'package:flutter_easyloading/flutter_easyloading.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
 import 'package:fluttertoast/fluttertoast.dart';
5
 import 'package:fluttertoast/fluttertoast.dart';
5
 import 'package:get/get.dart';
6
 import 'package:get/get.dart';
67
 
68
 
68
   Widget endContent() {
69
   Widget endContent() {
69
     return Container(
70
     return Container(
70
-        margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
71
+        margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 25.h),
71
         padding: EdgeInsets.symmetric(vertical: 18.h, horizontal: 15.w),
72
         padding: EdgeInsets.symmetric(vertical: 18.h, horizontal: 15.w),
72
         decoration: BoxDecoration(
73
         decoration: BoxDecoration(
73
             border: Border.all(
74
             border: Border.all(
102
               ),
103
               ),
103
             )
104
             )
104
           ],
105
           ],
105
-        ));
106
+        )
107
+    );
106
   }
108
   }
107
 
109
 
108
   void changeJob(Job item) {
110
   void changeJob(Job item) {
110
       modal.showDialog(
112
       modal.showDialog(
111
           content: startContent(),
113
           content: startContent(),
112
           onConfirm: () {
114
           onConfirm: () {
113
-            startJob(item.jobId.toString(), {'mode': true})
114
-                .then((value) => getJob());
115
+            EasyLoading.show(status: '请稍后');
116
+            startJob(item.jobId.toString(), {'mode': true}).then((value) {
117
+              getJob();
118
+              EasyLoading.dismiss();
119
+            }).catchError((error) {
120
+              Fluttertoast.showToast(msg: error.error['message']);
121
+              EasyLoading.dismiss();
122
+            });
115
           });
123
           });
116
     } else {
124
     } else {
117
       modal.showDialog(
125
       modal.showDialog(
118
-          content: endContent(),
119
-          onConfirm: () {
120
-            if (area.value == '') {
121
-              Fluttertoast.showToast(msg: '请输入正确的面积整数或最多两位小数');
122
-              return false;
123
-            } else {
124
-              overJob(item.jobId.toString(), {
125
-                ...item.toJson(),
126
-                'area': area.value.toString()
127
-              }).then((value) {
128
-                getJob();
129
-                Fluttertoast.showToast(msg: '恭喜完成作业');
130
-              });
131
-            }
132
-          },);
126
+        content: endContent(),
127
+        onConfirm: () {
128
+          if (area.value == '') {
129
+            Fluttertoast.showToast(msg: '请输入正确的面积整数或最多两位小数');
130
+            return false;
131
+          } else {
132
+            EasyLoading.show(status: '请稍后');
133
+            overJob(item.jobId.toString(), {
134
+              ...item.toJson(),
135
+              'area': area.value.toString()
136
+            }).then((value) {
137
+              getJob();
138
+              EasyLoading.dismiss();
139
+              Fluttertoast.showToast(msg: '恭喜完成作业');
140
+            }).catchError((error) {
141
+              Fluttertoast.showToast(msg: error.error['message']);
142
+              EasyLoading.dismiss();
143
+            });
144
+          }
145
+        },
146
+      );
133
     }
147
     }
134
   }
148
   }
135
 
149
 

+ 24
- 15
lib/pages/machineryDetail/index.dart Wyświetl plik

1
 import 'package:carousel_slider/carousel_slider.dart';
1
 import 'package:carousel_slider/carousel_slider.dart';
2
+import 'package:fluttertoast/fluttertoast.dart';
3
+import 'package:get/get.dart';
2
 import 'package:flutter/material.dart';
4
 import 'package:flutter/material.dart';
5
+import 'package:flutter_easyloading/flutter_easyloading.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
-import 'package:get/get.dart';
5
 import 'package:worker_client/models/entities/Machinery.dart';
7
 import 'package:worker_client/models/entities/Machinery.dart';
6
 import 'package:worker_client/services/machinery.dart';
8
 import 'package:worker_client/services/machinery.dart';
7
 import 'package:worker_client/widgets/Jianbian/index.dart';
9
 import 'package:worker_client/widgets/Jianbian/index.dart';
10
+import 'package:worker_client/widgets/NullCard.dart';
8
 import 'package:worker_client/widgets/layout/BasicPage.dart';
11
 import 'package:worker_client/widgets/layout/BasicPage.dart';
9
 
12
 
10
 class MachineryDetail extends BasicPage {
13
 class MachineryDetail extends BasicPage {
14
   final machinery = Rx<Machinery>(Machinery());
17
   final machinery = Rx<Machinery>(Machinery());
15
   @override
18
   @override
16
   void beforeShow() {
19
   void beforeShow() {
17
-    // TODO: implement beforeShow
18
     super.beforeShow();
20
     super.beforeShow();
19
     if (Get.arguments != null) {
21
     if (Get.arguments != null) {
20
-      getMachineryDetail(Get.arguments['id'], {
21
-        'attached': true,
22
-        'location': '118.84002,31.95266'
23
-      }).then((res) => {machinery(Machinery.fromJson(res))});
22
+      EasyLoading.show(status: '数据加载中...');
23
+      getMachineryDetail(Get.arguments['id'],
24
+          {'attached': true, 'location': '118.84002,31.95266'}).then((res) {
25
+        machinery(Machinery.fromJson(res));
26
+        EasyLoading.dismiss();
27
+      }).catchError((error){
28
+        EasyLoading.dismiss();
29
+        Fluttertoast.showToast(msg: error.error['message']);
30
+      });
24
     }
31
     }
25
   }
32
   }
26
 
33
 
117
                               ],
124
                               ],
118
                             ),
125
                             ),
119
                           ),
126
                           ),
120
-                          Container(
121
-                            margin: EdgeInsets.only(left: 15.w, right: 15.w),
122
-                            child: Column(
123
-                              children: machinery.value.contentList != null
124
-                                  ? machinery.value.contentList!.map((e) {
127
+                          machinery.value.contentList!.isNotEmpty
128
+                              ? Container(
129
+                                  margin:
130
+                                      EdgeInsets.only(left: 15.w, right: 15.w),
131
+                                  child: Column(
132
+                                    children:
133
+                                        machinery.value.contentList!.map((e) {
125
                                       if (e.contentType == 'image') {
134
                                       if (e.contentType == 'image') {
126
                                         return Image.network(
135
                                         return Image.network(
127
                                             e.content.toString(),
136
                                             e.content.toString(),
141
                                           ),
150
                                           ),
142
                                         );
151
                                         );
143
                                       }
152
                                       }
144
-                                    }).toList()
145
-                                  : [],
146
-                            ),
147
-                          )
153
+                                    }).toList(),
154
+                                  ),
155
+                                )
156
+                              : const NullCard(text: '该农机暂未添加详情'),
148
                         ],
157
                         ],
149
                       )),
158
                       )),
150
                 ],
159
                 ],

+ 7
- 0
lib/pages/machineryList/index.dart Wyświetl plik

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
+import 'package:flutter_easyloading/flutter_easyloading.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:fluttertoast/fluttertoast.dart';
3
 import 'package:get/get.dart';
5
 import 'package:get/get.dart';
4
 import 'package:worker_client/models/app.dart';
6
 import 'package:worker_client/models/app.dart';
5
 import 'package:worker_client/models/entities/Machinery.dart';
7
 import 'package:worker_client/models/entities/Machinery.dart';
14
   @override
16
   @override
15
   void beforeShow() {
17
   void beforeShow() {
16
     super.beforeShow();
18
     super.beforeShow();
19
+    EasyLoading.show(status: '数据加载中...');
17
     getMachineryList({'pageNum': 1, 'location': location}).then((res) {
20
     getMachineryList({'pageNum': 1, 'location': location}).then((res) {
18
       dynamic list = <Machinery>[];
21
       dynamic list = <Machinery>[];
19
       res['records'].forEach((item) => {list.add(Machinery.fromJson(item))});
22
       res['records'].forEach((item) => {list.add(Machinery.fromJson(item))});
20
       machineryList(list);
23
       machineryList(list);
24
+      EasyLoading.dismiss();
25
+    }).catchError((error) {
26
+      EasyLoading.dismiss();
27
+      Fluttertoast.showToast(msg: error.error['message']);
21
     });
28
     });
22
   }
29
   }
23
 
30
 

+ 41
- 29
lib/pages/machineryMap/index.dart Wyświetl plik

1
 import 'dart:convert';
1
 import 'dart:convert';
2
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
3
+import 'package:flutter_easyloading/flutter_easyloading.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
+import 'package:fluttertoast/fluttertoast.dart';
4
 import 'package:get/get.dart';
6
 import 'package:get/get.dart';
5
 import 'package:worker_client/models/app.dart';
7
 import 'package:worker_client/models/app.dart';
6
 import 'package:worker_client/models/entities/Machinery.dart';
8
 import 'package:worker_client/models/entities/Machinery.dart';
35
   void beforeShow() {
37
   void beforeShow() {
36
     super.beforeShow();
38
     super.beforeShow();
37
     if (Get.arguments != null) {
39
     if (Get.arguments != null) {
40
+      EasyLoading.show(status: '数据加载中...');
38
       getMachineryDetail(Get.arguments['id'], {
41
       getMachineryDetail(Get.arguments['id'], {
39
         'attached': true,
42
         'attached': true,
40
         //查询农机详情时需要把当前定位传到服务端
43
         //查询农机详情时需要把当前定位传到服务端
41
         'location': '118.84002,31.95266'
44
         'location': '118.84002,31.95266'
42
-      }).then((res) => {
43
-            getMachineryList({'pageSize': 500, 'location': location})
44
-                .then((value) {
45
-              dynamic list = <Machinery>[];
46
-              int index;
47
-              Machinery data = Machinery.fromJson(res);
48
-              List area = [];
49
-              value['records'].forEach((item) {
50
-                index = value['records'].indexOf(item);
51
-                item['location'] = locList[index % 10];
52
-                list.add(Machinery.fromJson(item));
53
-                if (data.machineryId == item['machineryId']) {
54
-                  data.location = item['location'];
55
-                  area = item['location'].toString().split(',');
56
-                  setAmap({
57
-                    'params': 'location=${area[1]},${area[0]}',
58
-                    'path': '/v3/geocode/regeo'
59
-                  }).then((value) {
60
-                    //json字符串转Map对象
61
-                    data.address =
62
-                        jsonDecode(value)['regeocode']['formatted_address'];
63
-                    machinery(data);
64
-                    current(data);
45
+      })
46
+          .then((res) => {
47
+                getMachineryList({'pageSize': 500, 'location': location})
48
+                    .then((value) {
49
+                  dynamic list = <Machinery>[];
50
+                  int index;
51
+                  Machinery data = Machinery.fromJson(res);
52
+                  List area = [];
53
+                  value['records'].forEach((item) {
54
+                    index = value['records'].indexOf(item);
55
+                    item['location'] = locList[index % 10];
56
+                    list.add(Machinery.fromJson(item));
57
+                    if (data.machineryId == item['machineryId']) {
58
+                      data.location = item['location'];
59
+                      area = item['location'].toString().split(',');
60
+                      setAmap({
61
+                        'params': 'location=${area[1]},${area[0]}',
62
+                        'path': '/v3/geocode/regeo'
63
+                      }).then((value) {
64
+                        //json字符串转Map对象
65
+                        data.address =
66
+                            jsonDecode(value)['regeocode']['formatted_address'];
67
+                        machinery(data);
68
+                        current(data);
69
+                      });
70
+                    }
65
                   });
71
                   });
66
-                }
67
-              });
68
-              machineryList(list);
69
-            }),
70
-          });
72
+                  machineryList(list);
73
+                  EasyLoading.dismiss();
74
+                }).catchError((error) {
75
+                  EasyLoading.dismiss();
76
+                  Fluttertoast.showToast(msg: error.error['message']);
77
+                }),
78
+              })
79
+          .catchError((error2) {
80
+        EasyLoading.dismiss();
81
+        Fluttertoast.showToast(msg: error2.error['message']);
82
+      });
71
     }
83
     }
72
   }
84
   }
73
 
85
 
100
   }
112
   }
101
 
113
 
102
   void onCancel() {
114
   void onCancel() {
103
-    if (!visible.value) {
115
+    if (visible.value) {
104
       visible(false);
116
       visible(false);
105
     }
117
     }
106
   }
118
   }

+ 10
- 4
lib/pages/userInfo/index.dart Wyświetl plik

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
+import 'package:flutter_easyloading/flutter_easyloading.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:fluttertoast/fluttertoast.dart';
4
 import 'package:fluttertoast/fluttertoast.dart';
4
 import 'package:get/get.dart';
5
 import 'package:get/get.dart';
9
 import 'package:worker_client/widgets/layout/BasicPage.dart';
10
 import 'package:worker_client/widgets/layout/BasicPage.dart';
10
 
11
 
11
 class UserInfo extends BasicPage {
12
 class UserInfo extends BasicPage {
12
-  UserInfo({Key? key}) : super(key: key);
13
+  UserInfo({Key? key}) : super(key: key){
14
+    naviTitle = '个人信息';
15
+    isPop = true;
16
+  }
13
 
17
 
14
   AppController store = AppController.t;
18
   AppController store = AppController.t;
15
   late String name;
19
   late String name;
19
 
23
 
20
   @override
24
   @override
21
   void beforeShow() {
25
   void beforeShow() {
22
-    // TODO: implement beforeShow
23
     super.beforeShow();
26
     super.beforeShow();
24
     _cName = TextEditingController(text: store.user().nickName.toString());
27
     _cName = TextEditingController(text: store.user().nickName.toString());
25
     _cPhone = TextEditingController(text: store.user().phone.toString());
28
     _cPhone = TextEditingController(text: store.user().phone.toString());
37
       Fluttertoast.showToast(msg: '请输入正确的手机号');
40
       Fluttertoast.showToast(msg: '请输入正确的手机号');
38
       return;
41
       return;
39
     } else {
42
     } else {
43
+      EasyLoading.show(status: '保存中', maskType: EasyLoadingMaskType.black);
40
       updateInfo(store.user().personId.toString(), {
44
       updateInfo(store.user().personId.toString(), {
41
         ...store.user().toJson(),
45
         ...store.user().toJson(),
42
         'nickName': name,
46
         'nickName': name,
44
       }).then((value) {
48
       }).then((value) {
45
         Fluttertoast.showToast(msg: '修改成功');
49
         Fluttertoast.showToast(msg: '修改成功');
46
         store.user(Person.fromJson(value));
50
         store.user(Person.fromJson(value));
51
+        EasyLoading.dismiss();
47
         Get.offAllNamed('/main');
52
         Get.offAllNamed('/main');
53
+      }).catchError((error) {
54
+        EasyLoading.dismiss();
55
+        Fluttertoast.showToast(msg: error.error['message']);
48
       });
56
       });
49
     }
57
     }
50
   }
58
   }
51
 
59
 
52
   @override
60
   @override
53
   Widget builder(BuildContext context) {
61
   Widget builder(BuildContext context) {
54
-    naviTitle = '个人信息';
55
-    isPop = true;
56
     return Container(
62
     return Container(
57
       padding: EdgeInsets.all(15.w),
63
       padding: EdgeInsets.all(15.w),
58
       decoration: const BoxDecoration(color: Colors.white),
64
       decoration: const BoxDecoration(color: Colors.white),

+ 2
- 0
lib/pages/withdrawal/index.dart Wyświetl plik

82
         });
82
         });
83
         bankPickerListStore.bankPickerList(pickerList);
83
         bankPickerListStore.bankPickerList(pickerList);
84
         bankCardListStore.bankCardList(list);
84
         bankCardListStore.bankCardList(list);
85
+      }).catchError((error){
86
+        Fluttertoast.showToast(msg: error.error['message']);
85
       });
87
       });
86
     }
88
     }
87
   }
89
   }

+ 3
- 8
lib/services/account.dart Wyświetl plik

6
 /// @param {*} data
6
 /// @param {*} data
7
 /// @returns
7
 /// @returns
8
 Future getAccount() async {
8
 Future getAccount() async {
9
-  return request('/account/mine',
10
-      options: Options(method: 'GET'))
11
-      .catchError((error) =>
12
-  {Fluttertoast.showToast(msg: error.error.toString()), print(error)});
9
+  return request('/account/mine', options: Options(method: 'GET'));
13
 }
10
 }
14
 
11
 
15
 /// 我的流水
12
 /// 我的流水
17
 /// @returns
14
 /// @returns
18
 Future getLogList(params) async {
15
 Future getLogList(params) async {
19
   return request('/account-log',
16
   return request('/account-log',
20
-      options: Options(method: 'GET'), queryParameters: params)
21
-      .catchError((error) =>
22
-  {Fluttertoast.showToast(msg: error.error.toString()), print(error)});
23
-}
17
+      options: Options(method: 'GET'), queryParameters: params);
18
+}

+ 11
- 14
lib/services/bank.dart Wyświetl plik

7
 /// @returns
7
 /// @returns
8
 Future getBankList(params) async {
8
 Future getBankList(params) async {
9
   return request('/bank',
9
   return request('/bank',
10
-      options: Options(method: 'GET'), queryParameters: params)
11
-      .catchError((error) =>
12
-  {Fluttertoast.showToast(msg: error.error.toString()), print(error)});
10
+      options: Options(method: 'GET'), queryParameters: params);
13
 }
11
 }
12
+
14
 /// 银行卡列表
13
 /// 银行卡列表
15
 /// @param {*} data
14
 /// @param {*} data
16
 /// @returns
15
 /// @returns
17
 Future getBankCardList(params) async {
16
 Future getBankCardList(params) async {
18
   return request('/bankcard',
17
   return request('/bankcard',
19
-      options: Options(method: 'GET'), queryParameters: params)
20
-      .catchError((error) =>
21
-  {Fluttertoast.showToast(msg: error.error.toString()), print(error)});
18
+      options: Options(method: 'GET'), queryParameters: params);
22
 }
19
 }
20
+
23
 /// 银行卡详情
21
 /// 银行卡详情
24
 /// @param {*} data
22
 /// @param {*} data
25
 /// @returns
23
 /// @returns
26
 Future getBankCardDetail(String id) async {
24
 Future getBankCardDetail(String id) async {
27
   return request('/bankcard/$id', options: Options(method: 'GET'))
25
   return request('/bankcard/$id', options: Options(method: 'GET'))
28
       .catchError((error) => {
26
       .catchError((error) => {
29
-    Fluttertoast.showToast(msg: error.error['message']),
30
-  });
27
+            Fluttertoast.showToast(msg: error.error['message']),
28
+          });
31
 }
29
 }
32
 
30
 
33
 /// 添加银行卡
31
 /// 添加银行卡
39
     options: Options(method: 'POST'),
37
     options: Options(method: 'POST'),
40
     data: data,
38
     data: data,
41
   ).catchError((error) => {
39
   ).catchError((error) => {
42
-    Fluttertoast.showToast(msg: error.error['message']),
43
-  });
40
+        Fluttertoast.showToast(msg: error.error['message']),
41
+      });
44
 }
42
 }
45
 
43
 
46
 /// 解绑银行卡
44
 /// 解绑银行卡
47
 /// @param {*}
45
 /// @param {*}
48
 /// @returns
46
 /// @returns
49
 Future unbindBankCard(String id) async {
47
 Future unbindBankCard(String id) async {
50
-  return request('/bankcard/$id/pause',
51
-      options: Options(method: 'DELETE'))
48
+  return request('/bankcard/$id/pause', options: Options(method: 'DELETE'))
52
       .catchError((error) => {
49
       .catchError((error) => {
53
-    Fluttertoast.showToast(msg: error.error['message']),
54
-  });
50
+            Fluttertoast.showToast(msg: error.error['message']),
51
+          });
55
 }
52
 }
56
 
53
 
57
 /// 添加银行卡
54
 /// 添加银行卡

+ 2
- 8
lib/services/job.dart Wyświetl plik

29
  */
29
  */
30
 Future startJob(String id, params) async {
30
 Future startJob(String id, params) async {
31
   return request('/work-job/$id/pause',
31
   return request('/work-job/$id/pause',
32
-          options: Options(method: 'PUT'), queryParameters: params)
33
-      .catchError((error) => {
34
-            Fluttertoast.showToast(msg: error.error['message']),
35
-          });
32
+          options: Options(method: 'PUT'), queryParameters: params);
36
 }
33
 }
37
 /// 开始作业
34
 /// 开始作业
38
 /// @param {*}
35
 /// @param {*}
39
 /// @returns
36
 /// @returns
40
 Future overJob(String id, data) async {
37
 Future overJob(String id, data) async {
41
   return request('/work-job/$id/stop',
38
   return request('/work-job/$id/stop',
42
-      options: Options(method: 'PUT'), data: data)
43
-      .catchError((error) => {
44
-    Fluttertoast.showToast(msg: error.error['message']),
45
-  });
39
+      options: Options(method: 'PUT'), data: data);
46
 }
40
 }

+ 2
- 7
lib/services/machinery.dart Wyświetl plik

7
 /// @returns
7
 /// @returns
8
 Future getMachineryList(params) async {
8
 Future getMachineryList(params) async {
9
   return request('/machinery',
9
   return request('/machinery',
10
-          options: Options(method: 'GET'), queryParameters: params)
11
-      .catchError((error) =>
12
-          {Fluttertoast.showToast(msg: error.error.toString()), print(error)});
10
+      options: Options(method: 'GET'), queryParameters: params);
13
 }
11
 }
14
 
12
 
15
 /// 农机详情
13
 /// 农机详情
17
 /// @returns
15
 /// @returns
18
 Future getMachineryDetail(String id, params) async {
16
 Future getMachineryDetail(String id, params) async {
19
   return request('/machinery-summary/$id',
17
   return request('/machinery-summary/$id',
20
-          options: Options(method: 'GET'), queryParameters: params)
21
-      .catchError((error) => {
22
-            Fluttertoast.showToast(msg: error.error['message']),
23
-          });
18
+      options: Options(method: 'GET'), queryParameters: params);
24
 }
19
 }

+ 1
- 4
lib/services/user.dart Wyświetl plik

31
  */
31
  */
32
 
32
 
33
 Future updateInfo(String id, Map data) async {
33
 Future updateInfo(String id, Map data) async {
34
-  return request('/person/${id}', options: Options(method: 'PUT'), data: data)
35
-      .catchError((error) => {
36
-            Fluttertoast.showToast(msg: error.error['message']),
37
-          });
34
+  return request('/person/${id}', options: Options(method: 'PUT'), data: data);
38
 }
35
 }