From d7ad4912ebcad6f6589074a91890480d1b97db2a Mon Sep 17 00:00:00 2001 From: machuanyu <840649825@qq.com> Date: Wed, 10 Apr 2024 10:00:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E8=AF=A6=E6=83=85=E7=94=A8?= =?UTF-8?q?=E6=97=B6=E8=BD=AC=E6=97=B6=E5=88=86=E7=A7=92=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../job_personal_detail.dart | 2 -- .../widget/student_zg_table.dart | 3 ++- marking_app/lib/utils/common_utils.dart | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/marking_app/lib/pages/homework_correction/job_personal_detail.dart b/marking_app/lib/pages/homework_correction/job_personal_detail.dart index 99b67c7..b40b7cf 100644 --- a/marking_app/lib/pages/homework_correction/job_personal_detail.dart +++ b/marking_app/lib/pages/homework_correction/job_personal_detail.dart @@ -90,8 +90,6 @@ class _JobPersonalDetailState extends State with CommonMixin, } totalPages = res.data!.pagedList.totalPages; - print('dataLists=${dataList.length}'); - print('totalpages=$totalPages'); }); } diff --git a/marking_app/lib/pages/homework_correction/widget/student_zg_table.dart b/marking_app/lib/pages/homework_correction/widget/student_zg_table.dart index 39b9edb..8156fba 100644 --- a/marking_app/lib/pages/homework_correction/widget/student_zg_table.dart +++ b/marking_app/lib/pages/homework_correction/widget/student_zg_table.dart @@ -2,6 +2,7 @@ import 'package:data_table_2/data_table_2.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:marking_app/common/model/job/job_data_report.dart'; +import 'package:marking_app/utils/common_utils.dart'; import 'package:marking_app/utils/easy_refresh/MyEmptyWidget.dart'; import 'package:photo_view/photo_view.dart'; @@ -80,7 +81,7 @@ class _StudentZgTableState extends State { DataCell(Center( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.r), - child: Text(item.useTime.toString(), + child: Text(CommonUtils.second2HMS(item.useTime!), style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))), ), )), diff --git a/marking_app/lib/utils/common_utils.dart b/marking_app/lib/utils/common_utils.dart index e7bb2a8..ce6ab22 100644 --- a/marking_app/lib/utils/common_utils.dart +++ b/marking_app/lib/utils/common_utils.dart @@ -18,4 +18,31 @@ class CommonUtils { // 这里其实就是 digest.toString() return hex.encode(digest.bytes); } + + ///补零 + static String zeroFill(int i) { + return i >= 10 ? "$i" : "0$i"; + } + /// 秒转时分秒 + static String second2HMS(int sec, {bool isEasy = false}) { + String hms = "00:00:00"; + if (!isEasy) hms = "00时00分00秒"; + if (sec > 0) { + int h = sec ~/ 3600; + int m = (sec % 3600) ~/ 60; + int s = sec % 60; + /* hms = "${zeroFill(h)}:${zeroFill(m)}:${zeroFill(s)}"; + if (!isEasy) hms = "${zeroFill(h)}时${zeroFill(m)}分${zeroFill(s)}秒";*/ + if(h>0){ + hms = "$h时$m分$s秒"; + }else{ + if(m>0){ + hms = "$m分$s秒"; + }else{ + hms = "$s秒"; + } + } + } + return hms; + } }