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

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

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

@ -27,6 +27,7 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage>
Timer? _clockSetState; Timer? _clockSetState;
DateTime? _lastPressed; DateTime? _lastPressed;
TodayClockRecordModel? _model; TodayClockRecordModel? _model;
bool get canTap { bool get canTap {
if (_lastPressed == null || if (_lastPressed == null ||
DateTime.now().difference(_lastPressed!) > Duration(seconds: 15)) { DateTime.now().difference(_lastPressed!) > Duration(seconds: 15)) {
@ -81,43 +82,51 @@ class _ClockInOutMainPageState extends State<ClockInOutMainPage>
setState(() {}); setState(() {});
}, },
child: Container( child: _model == null
margin: EdgeInsets.all(32.w), ? Container()
padding: EdgeInsets.all(32.w), : Container(
width: double.infinity, margin: EdgeInsets.all(32.w),
child: Column( padding: EdgeInsets.all(32.w),
children: [ width: double.infinity,
DateUtil.formatDate(DateTime.now(), format: 'yyyy.MM.dd') child: Column(
.text children: [
.size(28.sp) DateUtil.formatDate(DateTime.now(), format: 'yyyy.MM.dd')
.color(kTextPrimaryColor) .text
.make(), .size(28.sp)
16.w.heightBox, .color(kTextPrimaryColor)
WeekDaysToChinese.fromString(DateUtil.getWeekday(DateTime.now())) .make(),
.text 16.w.heightBox,
.size(24.sp) WeekDaysToChinese.fromString(
.color(kTextPrimaryColor) DateUtil.getWeekday(DateTime.now()))
.make(), .text
64.w.heightBox, .size(24.sp)
Row( .color(kTextPrimaryColor)
children: [ .make(),
_buildCard(0, 64.w.heightBox,
time: UserTool.appProvider.clockInTime, Row(
checkTime: _model!.startTime), children: [
Spacer(), _buildCard(0,
_buildCard(1, time: UserTool.appProvider.clockInTime,
time: UserTool.appProvider.clockOutTime, checkTime: _model!.startTime),
checkTime: _model!.endTime) Spacer(),
], //type0.1 _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: [ actions: [
Center( Center(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 24.w,horizontal: 32.w), padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: InkWell(child: '工作申请'.text.size(30.sp).color(kTextPrimaryColor).make(),onTap: (){ child: InkWell(
Get.to(()=>WorkApplyPage()); child: '工作申请'.text.size(30.sp).color(kTextPrimaryColor).make(),
},), onTap: () {
Get.to(() => WorkApplyPage());
},
),
), ),
), ),
], ],
appBarBottom: PreferredSize( appBarBottom: PreferredSize(
child: AkuTabBar(controller: _tabController!, tabs: _tabs), child: AkuTabBar(controller: _tabController!, tabs: _tabs),
@ -54,11 +56,10 @@ class _ClockInOutPageState extends State<ClockInOutPage>
body: TabBarView( body: TabBarView(
controller: _tabController, controller: _tabController,
children: List.generate(_tabs.length, (index) { children: List.generate(_tabs.length, (index) {
if (index == 0) { if (index == 0) {
return ClockInOutMainPage(); return ClockInOutMainPage();
} else { } else {
return ClockInOutView( return ClockInOutView(
index: index, index: index,
); );
} }

Loading…
Cancel
Save