Browse Source

签名图片上传增加loading; 版本更新去掉取消功能;

maqiang 7 months ago
parent
commit
effba633e3

+ 16 - 9
lib/page/sample_task/reap_sample_detail/reap_sample_task_page.dart

@@ -101,17 +101,24 @@ class _ReapSampleTaskPageState extends BaseLifecycleState<ReapSampleTaskPage> wi
101 101
     var args = SignaturePageArgs(count: req.dgryName?.split(',').length ?? 0);
102 102
     List<Uint8List?>? list = await MyRouter.startSignature(args: args);
103 103
     if (list == null || list.isEmpty) return;
104
-    // 字节转文件
105
-    List<File> fileList = [];
106
-    for (int i = 0; i < list.length; i++) {
107
-      fileList.add(await FileUtils.convertUint8ListToFile(list[i]!, 'signatrue_$i.png'));
104
+    MyNavigator.showLoading(msg: '提交中...');
105
+      // 上传图片
106
+    try {
107
+      // 字节转文件
108
+      List<File> fileList = [];
109
+      for (int i = 0; i < list.length; i++) {
110
+        fileList.add(await FileUtils.convertUint8ListToFile(list[i]!, 'signatrue_$i.png'));
111
+      }
112
+      var rspList = await Future.wait(fileList.map((file) => MyApi.get().upload(file)));
113
+      logger.d('图片url:${rspList.map((e) => e.data)}');
114
+      req.filePictureList = rspList.map((e) => UrlItem(url: e.data)).toList();
115
+    } catch (e) {
116
+      logger.e(e);
117
+      MyNavigator.dismissLoading();
118
+      MyNavigator.showToast('签名上传失败');
119
+      return;
108 120
     }
109
-    // 上传图片
110
-    var rspList = await Future.wait(fileList.map((file) => MyApi.get().upload(file)));
111
-    logger.d('图片url:${rspList.map((e) => e.data)}');
112
-    req.filePictureList = rspList.map((e) => UrlItem(url: e.data)).toList();
113 121
 
114
-    MyNavigator.showLoading();
115 122
     // 已分解
116 123
     pageStatus.value.data?.state = 2;
117 124
     try {

+ 1 - 1
lib/service/upgrade_service.dart

@@ -61,7 +61,7 @@ class UpgradeService {
61 61
     if (!Platform.isAndroid) return;
62 62
     if (checking) return;
63 63
     checking = true;
64
-    if (showLoading) MyNavigator.showLoading();
64
+    if (showLoading) MyNavigator.showLoading(msg: '正在获取版本更新');
65 65
     try {
66 66
       // 获取apk下载地址
67 67
       var path = (await MyApi.get().getAppDownloadUrl()).data;

+ 21 - 18
lib/widget/upgrade_dialog.dart

@@ -61,7 +61,7 @@ class UpgradeDialog extends StatelessWidget {
61 61
   void installApk(String path) async {
62 62
     bool success = await UpgradeService.installApk(path);
63 63
     if (success) {
64
-      dismiss();
64
+      // dismiss();
65 65
     } else {
66 66
       progress.value = -1;
67 67
     }
@@ -79,24 +79,27 @@ class UpgradeDialog extends StatelessWidget {
79 79
       child: Column(
80 80
         mainAxisSize: MainAxisSize.min,
81 81
         children: [
82
-          Row(
83
-            children: [
84
-              Text(
85
-                '发现新版本 $versionName',
86
-                style: const TextStyle(color: Color(0xFF333333), fontSize: 16, fontWeight: FontWeight.w500),
87
-              ),
88
-              const Spacer(),
89
-              progress.builder((v) => v == -1
90
-                  ? GestureDetector(
91
-                      onTap: dismiss,
92
-                      child: const Text(
93
-                        '取消',
94
-                        style: TextStyle(color: Color(0xFF333333), fontSize: 14),
95
-                      ),
96
-                    )
97
-                  : const SizedBox.shrink()),
98
-            ],
82
+          Container(
83
+            alignment: Alignment.topLeft,
84
+            child: Text(
85
+              '发现新版本 $versionName',
86
+              style: const TextStyle(color: Color(0xFF333333), fontSize: 16, fontWeight: FontWeight.w500),
87
+            ),
99 88
           ),
89
+          // Row(
90
+          //   children: [
91
+          //     const Spacer(),
92
+          //     progress.builder((v) => v == -1
93
+          //         ? GestureDetector(
94
+          //             onTap: dismiss,
95
+          //             child: const Text(
96
+          //               '取消',
97
+          //               style: TextStyle(color: Color(0xFF333333), fontSize: 14),
98
+          //             ),
99
+          //           )
100
+          //         : const SizedBox.shrink()),
101
+          //   ],
102
+          // ),
100 103
           const SizedBox(height: 24),
101 104
           progress.builder((v) => v == -1 ? MyButton('立即下载安装', onTap: onDownload, alignment: null) : buildProgress(v)),
102 105
         ],