Browse Source

打印try catch日志;

maqiang 7 months ago
parent
commit
0b610e635f

+ 3 - 0
lib/model/num_converter.dart

@@ -1,5 +1,7 @@
1
 import 'package:json_annotation/json_annotation.dart';
1
 import 'package:json_annotation/json_annotation.dart';
2
 
2
 
3
+import '../main.dart';
4
+
3
 /// Json解析num类型
5
 /// Json解析num类型
4
 class NumConverter extends JsonConverter<num?, dynamic> {
6
 class NumConverter extends JsonConverter<num?, dynamic> {
5
   const NumConverter();
7
   const NumConverter();
@@ -13,6 +15,7 @@ class NumConverter extends JsonConverter<num?, dynamic> {
13
       try {
15
       try {
14
         return num.parse(json);
16
         return num.parse(json);
15
       } catch (e) {
17
       } catch (e) {
18
+        logger.e(e);
16
         return null;
19
         return null;
17
       }
20
       }
18
     }
21
     }

+ 2 - 4
lib/page/login/login_page.dart

@@ -12,13 +12,10 @@ import 'package:lszlgl/service/user_service.dart';
12
 import 'package:lszlgl/widget/button.dart';
12
 import 'package:lszlgl/widget/button.dart';
13
 
13
 
14
 import '../../config/reresh_config.dart';
14
 import '../../config/reresh_config.dart';
15
-import '../../drfit/database.dart';
16
 import '../../network/base_dio.dart';
15
 import '../../network/base_dio.dart';
17
 import '../../utils/location_utils.dart';
16
 import '../../utils/location_utils.dart';
18
 import '../../utils/sp_utils.dart';
17
 import '../../utils/sp_utils.dart';
19
 import 'package:lszlgl/service/print_service.dart';
18
 import 'package:lszlgl/service/print_service.dart';
20
-import 'package:path_provider/path_provider.dart';
21
-import 'package:path/path.dart' as p;
22
 
19
 
23
 /// 登录页面
20
 /// 登录页面
24
 class LoginPage extends StatefulWidget {
21
 class LoginPage extends StatefulWidget {
@@ -46,7 +43,8 @@ class _LoginPageState extends BaseLifecycleState<LoginPage> {
46
       await UserService.get().saveLogin(login.data);
43
       await UserService.get().saveLogin(login.data);
47
       getSystemData();
44
       getSystemData();
48
     } on DioException catch (_) {
45
     } on DioException catch (_) {
49
-    } catch (_) {
46
+    } catch (e) {
47
+      logger.e(e);
50
       MyNavigator.showToast('获取数据失败');
48
       MyNavigator.showToast('获取数据失败');
51
     }
49
     }
52
     MyNavigator.dismissLoading();
50
     MyNavigator.dismissLoading();

+ 1 - 2
lib/page/sample_task/reap_sample_detail/reap_sample_task_page.dart

@@ -19,11 +19,9 @@ import 'package:lszlgl/page/signature/signature_page.dart';
19
 import '../../../base/base_vm.dart';
19
 import '../../../base/base_vm.dart';
20
 import '../../../main.dart';
20
 import '../../../main.dart';
21
 import '../../../network/my_api.dart';
21
 import '../../../network/my_api.dart';
22
-import '../../../plugin/bluetooth_plugin.dart';
23
 import '../../../utils/file_utils.dart';
22
 import '../../../utils/file_utils.dart';
24
 import '../../../widget/button.dart';
23
 import '../../../widget/button.dart';
25
 import '../../../widget/page_widget.dart';
24
 import '../../../widget/page_widget.dart';
26
-import 'dart:ui' as ui;
27
 
25
 
28
 class ReapSampleTaskPageArgs {
26
 class ReapSampleTaskPageArgs {
29
   final bool detail;
27
   final bool detail;
@@ -144,6 +142,7 @@ class _ReapSampleTaskPageState extends BaseLifecycleState<ReapSampleTaskPage> wi
144
         pageStatus.update(pageStatus.value.success(data: data));
142
         pageStatus.update(pageStatus.value.success(data: data));
145
       }
143
       }
146
     } catch (e) {
144
     } catch (e) {
145
+      logger.e(e);
147
       pageStatus.update(pageStatus.value.error());
146
       pageStatus.update(pageStatus.value.error());
148
     }
147
     }
149
   }
148
   }

+ 2 - 0
lib/page/sample_task/sample_task_list_page.dart

@@ -14,6 +14,7 @@ import 'package:lszlgl/utils/inject.dart';
14
 import 'package:lszlgl/widget/button.dart';
14
 import 'package:lszlgl/widget/button.dart';
15
 import 'package:lszlgl/widget/page_widget.dart';
15
 import 'package:lszlgl/widget/page_widget.dart';
16
 
16
 
17
+import '../../main.dart';
17
 import 'reap_sample_detail/reap_sample_task_page.dart';
18
 import 'reap_sample_detail/reap_sample_task_page.dart';
18
 import 'stock_sample_detail/stock_sample_task_page.dart';
19
 import 'stock_sample_detail/stock_sample_task_page.dart';
19
 
20
 
@@ -79,6 +80,7 @@ class _SampleTaskListPageState extends BaseLifecycleState<SampleTaskListPage> wi
79
         vm.refreshAll();
80
         vm.refreshAll();
80
       }
81
       }
81
     } catch (e) {
82
     } catch (e) {
83
+      logger.e(e);
82
       MyNavigator.dismissLoading();
84
       MyNavigator.dismissLoading();
83
     }
85
     }
84
   }
86
   }

+ 5 - 1
lib/page/sample_task/stock_sample_detail/stock_sample_task_page.dart

@@ -5,6 +5,7 @@ import 'package:lszlgl/config/colors.dart';
5
 import 'package:lszlgl/model/rsp/sample_task_rsp.dart';
5
 import 'package:lszlgl/model/rsp/sample_task_rsp.dart';
6
 
6
 
7
 import '../../../base/base_vm.dart';
7
 import '../../../base/base_vm.dart';
8
+import '../../../main.dart';
8
 import '../../../network/my_api.dart';
9
 import '../../../network/my_api.dart';
9
 import '../../../widget/button.dart';
10
 import '../../../widget/button.dart';
10
 import '../../../widget/page_widget.dart';
11
 import '../../../widget/page_widget.dart';
@@ -83,7 +84,9 @@ class _StockSampleTaskPageState extends BaseLifecycleState<StockSampleTaskPage>
83
       } else {
84
       } else {
84
         MyNavigator.showToast('提交失败');
85
         MyNavigator.showToast('提交失败');
85
       }
86
       }
86
-    } catch (e) {}
87
+    } catch (e) {
88
+      logger.e(e);
89
+    }
87
     MyNavigator.dismissLoading();
90
     MyNavigator.dismissLoading();
88
   }
91
   }
89
 
92
 
@@ -100,6 +103,7 @@ class _StockSampleTaskPageState extends BaseLifecycleState<StockSampleTaskPage>
100
         pageStatus.update(pageStatus.value.success(data: data));
103
         pageStatus.update(pageStatus.value.success(data: data));
101
       }
104
       }
102
     } catch (e) {
105
     } catch (e) {
106
+      logger.e(e);
103
       pageStatus.update(pageStatus.value.error());
107
       pageStatus.update(pageStatus.value.error());
104
     }
108
     }
105
   }
109
   }

+ 4 - 1
lib/page/user_center/user_center_page.dart

@@ -7,6 +7,7 @@ import 'package:lszlgl/model/rsp/user_rsp.dart';
7
 import 'package:lszlgl/service/user_service.dart';
7
 import 'package:lszlgl/service/user_service.dart';
8
 import 'package:lszlgl/widget/card_item.dart';
8
 import 'package:lszlgl/widget/card_item.dart';
9
 
9
 
10
+import '../../main.dart';
10
 import '../../network/my_api.dart';
11
 import '../../network/my_api.dart';
11
 
12
 
12
 /// 用户中心
13
 /// 用户中心
@@ -33,7 +34,9 @@ class _UserCenterPageState extends BaseLifecycleState<UserCenterPage> with Autom
33
       var value = await MyApi.get().userProfile();
34
       var value = await MyApi.get().userProfile();
34
       if (value.data != null) userNotify.value = value.data;
35
       if (value.data != null) userNotify.value = value.data;
35
       await UserService.get().saveUser(value.data);
36
       await UserService.get().saveUser(value.data);
36
-    } catch (err) {}
37
+    } catch (e) {
38
+      logger.e(e);
39
+    }
37
   }
40
   }
38
 
41
 
39
   @override
42
   @override

+ 1 - 0
lib/service/upgrade_service.dart

@@ -80,6 +80,7 @@ class UpgradeService {
80
         }
80
         }
81
       }
81
       }
82
     } catch (e) {
82
     } catch (e) {
83
+      logger.e(e);
83
       if (showLoading) MyNavigator.dismissLoading();
84
       if (showLoading) MyNavigator.dismissLoading();
84
     }
85
     }
85
     checking = false;
86
     checking = false;