hmxc
张萌 3 years ago
parent 5905d35f5c
commit 5e734ca3e8

@ -1,5 +1,6 @@
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
part 'today_clock_record_model.g.dart';
@JsonSerializable()
@ -12,7 +13,7 @@ class TodayClockRecordModel {
final String clockName;
final String clockTel;
final String createDate;
final String status;
final int status;
final String? firstTimeStart;
final String? firstTimeEnd;
final String? secondTimeStart;

@ -17,7 +17,7 @@ TodayClockRecordModel _$TodayClockRecordModelFromJson(
clockName: json['clockName'] as String,
clockTel: json['clockTel'] as String,
createDate: json['createDate'] as String,
status: json['status'] as String,
status: json['status'] as int,
firstTimeStart: json['firstTimeStart'] as String?,
firstTimeEnd: json['firstTimeEnd'] as String?,
secondTimeStart: json['secondTimeStart'] as String?,

@ -27,6 +27,7 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage>
Timer? _clockSetState;
DateTime? _lastPressed;
TodayClockRecordModel? _model;
bool get canTap {
if (_lastPressed == null ||
DateTime.now().difference(_lastPressed!) > Duration(seconds: 15)) {
@ -81,43 +82,51 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage>
setState(() {});
},
child: Container(
margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w),
width: double.infinity,
child: Column(
children: [
DateUtil.formatDate(DateTime.now(), format: 'yyyy.MM.dd')
.text
.size(28.sp)
.color(kTextPrimaryColor)
.make(),
16.w.heightBox,
WeekDaysToChinese.fromString(DateUtil.getWeekday(DateTime.now()))
.text
.size(24.sp)
.color(kTextPrimaryColor)
.make(),
64.w.heightBox,
Row(
children: [
_buildCard(0,
time: UserTool.appProvider.clockInTime,
checkTime: _model!.startTime),
Spacer(),
_buildCard(1,
time: UserTool.appProvider.clockOutTime,
checkTime: _model!.endTime)
], //type0.1
child: _model == null
? Container()
: Container(
margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w),
width: double.infinity,
child: Column(
children: [
DateUtil.formatDate(DateTime.now(), format: 'yyyy.MM.dd')
.text
.size(28.sp)
.color(kTextPrimaryColor)
.make(),
16.w.heightBox,
WeekDaysToChinese.fromString(
DateUtil.getWeekday(DateTime.now()))
.text
.size(24.sp)
.color(kTextPrimaryColor)
.make(),
64.w.heightBox,
Row(
children: [
_buildCard(0,
time: UserTool.appProvider.clockInTime,
checkTime: _model!.startTime),
Spacer(),
_buildCard(1,
time: UserTool.appProvider.clockOutTime,
checkTime: _model!.endTime)
], //type0.1
),
150.w.heightBox,
_buildClock(),
65.w.heightBox,
'今日工时'.text.size(24.sp).bold.color(kTextSubColor).make(),
'$getWorkHours'
.text
.size(24.sp)
.bold
.color(kTextSubColor)
.make(),
],
),
),
150.w.heightBox,
_buildClock(),
65.w.heightBox,
'今日工时'.text.size(24.sp).bold.color(kTextSubColor).make(),
'$getWorkHours'.text.size(24.sp).bold.color(kTextSubColor).make(),
],
),
),
);
}

@ -39,13 +39,15 @@ class _ClockInOutPageState extends State<ClockInOutPage>
actions: [
Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 24.w,horizontal: 32.w),
child: InkWell(child: '工作申请'.text.size(30.sp).color(kTextPrimaryColor).make(),onTap: (){
Get.to(()=>WorkApplyPage());
},),
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: InkWell(
child: '工作申请'.text.size(30.sp).color(kTextPrimaryColor).make(),
onTap: () {
Get.to(() => WorkApplyPage());
},
),
),
),
],
appBarBottom: PreferredSize(
child: AkuTabBar(controller: _tabController!, tabs: _tabs),
@ -54,11 +56,10 @@ class _ClockInOutPageState extends State<ClockInOutPage>
body: TabBarView(
controller: _tabController,
children: List.generate(_tabs.length, (index) {
if (index == 0) {
return ClockInOutMainPage();
} else {
return ClockInOutView(
return ClockInOutView(
index: index,
);
}

Loading…
Cancel
Save