1、修改关于时间的3点讨论结果
a,领锁,点击+号时,如果获取网络时间失败,不进入下一页,提示必须联网 b. 开锁时:有网络时间则同步,无网络则不同步时间 c. 同步时间功能:必须有网才同步时间,确定和通通锁不一致 2、修改登录、注册、修改密码选择跟当前ip不是用一个国家的时候,弹窗提示
This commit is contained in:
parent
b86fef2b55
commit
fe7cb98cf9
BIN
images/.DS_Store
vendored
BIN
images/.DS_Store
vendored
Binary file not shown.
@ -867,5 +867,11 @@
|
|||||||
"自定义短信模版":"Custom SMS template",
|
"自定义短信模版":"Custom SMS template",
|
||||||
"自定义邮件模版":"Custom email template",
|
"自定义邮件模版":"Custom email template",
|
||||||
"名称":"Name",
|
"名称":"Name",
|
||||||
"星星锁": "Star lock"
|
"星星锁": "Star lock",
|
||||||
|
"无考勤记录": "No attendance record",
|
||||||
|
"大家干劲十足": "Everyone is full of energy",
|
||||||
|
"工作时长未出炉": "Working hours are not available",
|
||||||
|
"国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续": "The selection of the country or region will affect data security. You have currently selected Albania. Please confirm before continuing",
|
||||||
|
"确认国家或地区": "Confirm country or region",
|
||||||
|
"我知道了": "I know",
|
||||||
}
|
}
|
||||||
|
|||||||
@ -899,5 +899,11 @@
|
|||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁"
|
"星星锁": "星星锁",
|
||||||
|
"无考勤记录": "无考勤记录",
|
||||||
|
"大家干劲十足": "大家干劲十足",
|
||||||
|
"工作时长未出炉": "工作时长未出炉",
|
||||||
|
"国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续": "国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续",
|
||||||
|
"确认国家或地区": "确认国家或地区",
|
||||||
|
"我知道了": "我知道了"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -867,5 +867,12 @@
|
|||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁"
|
"星星锁": "星星锁",
|
||||||
|
|
||||||
|
"无考勤记录": "无考勤记录",
|
||||||
|
"大家干劲十足": "大家干劲十足",
|
||||||
|
"工作时长未出炉": "工作时长未出炉",
|
||||||
|
"国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续": "国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续",
|
||||||
|
"确认国家或地区": "确认国家或地区",
|
||||||
|
"我知道了": "我知道了"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,16 +3,20 @@ import 'dart:async';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
|
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
|
import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart';
|
||||||
|
|
||||||
import '../../network/api_repository.dart';
|
import '../../network/api_repository.dart';
|
||||||
import '../../tools/baseGetXController.dart';
|
import '../../tools/baseGetXController.dart';
|
||||||
|
import '../../tools/showTipView.dart';
|
||||||
|
import '../register/entity/checkIP_entity.dart';
|
||||||
|
|
||||||
class StarLockForgetPasswordLogic extends BaseGetXController {
|
class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||||
final StarLockForgetPasswordState state = StarLockForgetPasswordState();
|
final StarLockForgetPasswordState state = StarLockForgetPasswordState();
|
||||||
|
|
||||||
late Timer _timer;
|
late Timer _timer;
|
||||||
void _startTimer() {
|
void _startTimer() {
|
||||||
_timer = Timer.periodic(1.seconds, (timer) {
|
_timer = Timer.periodic(1.seconds, (Timer timer) {
|
||||||
if (state.currentSecond > 1) {
|
if (state.currentSecond > 1) {
|
||||||
state.currentSecond--;
|
state.currentSecond--;
|
||||||
} else {
|
} else {
|
||||||
@ -28,22 +32,22 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
|||||||
// _timer = null;
|
// _timer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetPassword() async {
|
Future<void> resetPassword() async {
|
||||||
var entity = await ApiRepository.to.resetPassword(
|
final LoginEntity entity = await ApiRepository.to.resetPassword(
|
||||||
state.countryCode.value,
|
state.countryCode.value,
|
||||||
state.phoneStr.value,
|
state.phoneStr.value,
|
||||||
state.date.value,
|
state.date.value,
|
||||||
state.pwd.value,
|
state.pwd.value,
|
||||||
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
|
'B748F838-94EE-4BDB-A0E6-7B2D16849792',
|
||||||
state.verificationCode.value);
|
state.verificationCode.value);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("重置成功".tr);
|
showToast('重置成功'.tr);
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendValidationCode() async {
|
Future<void> sendValidationCode() async {
|
||||||
var entity = await ApiRepository.to.sendValidationCodeUnLogin(
|
final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin(
|
||||||
// state.countryCode.value,
|
// state.countryCode.value,
|
||||||
countryCode:state.countryCode.value,
|
countryCode:state.countryCode.value,
|
||||||
account:state.phoneStr.value,
|
account:state.phoneStr.value,
|
||||||
@ -55,6 +59,17 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> checkIpAction() async {
|
||||||
|
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(
|
||||||
|
ip: ''
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if(state.countryName.value == entity.data!.name){
|
||||||
|
ShowTipView().showSureAlertDialog('国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, tipTitle: '确认国家或地区'.tr, sureStr: '我知道了'.tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void checkNext(TextEditingController controller) {
|
void checkNext(TextEditingController controller) {
|
||||||
changeInput(controller);
|
changeInput(controller);
|
||||||
}
|
}
|
||||||
@ -62,10 +77,10 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
|||||||
void changeInput(TextEditingController controller) {
|
void changeInput(TextEditingController controller) {
|
||||||
if (controller == state.phoneController) {
|
if (controller == state.phoneController) {
|
||||||
state.phoneStr.value = controller.text;
|
state.phoneStr.value = controller.text;
|
||||||
if(state.phoneStr.value.contains("@")){
|
if(state.phoneStr.value.contains('@')){
|
||||||
state.codeType.value = "2";
|
state.codeType.value = '2';
|
||||||
}else{
|
}else{
|
||||||
state.codeType.value = "1";
|
state.codeType.value = '1';
|
||||||
}
|
}
|
||||||
state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty;
|
state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
|
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
|
||||||
|
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
|
||||||
|
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
import '../../app_settings/app_colors.dart';
|
import '../../app_settings/app_colors.dart';
|
||||||
@ -22,10 +23,9 @@ class StarLockForgetPasswordPage extends StatefulWidget {
|
|||||||
_StarLockForgetPasswordPageState();
|
_StarLockForgetPasswordPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _StarLockForgetPasswordPageState
|
class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage> {
|
||||||
extends State<StarLockForgetPasswordPage> {
|
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic());
|
||||||
final logic = Get.put(StarLockForgetPasswordLogic());
|
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state;
|
||||||
final state = Get.find<StarLockForgetPasswordLogic>().state;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -33,27 +33,28 @@ class _StarLockForgetPasswordPageState
|
|||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
backgroundColor: const Color(0xFFFFFFFF),
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: "忘记密码".tr,
|
barTitle: '忘记密码'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
|
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var result = await Navigator.pushNamed(
|
final Object? result = await Navigator.pushNamed(
|
||||||
context, Routers.selectCountryRegionPage);
|
context, Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
|
logic.checkIpAction();
|
||||||
}
|
}
|
||||||
// AppLog.log("路由返回值: $result, countryCode:${state.countryName.value} ,state.countryName.value:${state.countryName.value}");
|
// AppLog.log("路由返回值: $result, countryCode:${state.countryName.value} ,state.countryName.value:${state.countryName.value}");
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 70.h,
|
height: 70.h,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
@ -62,7 +63,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => Text(
|
Obx(() => Text(
|
||||||
'${state.countryName} +${state.countryCode}',
|
'${state.countryName} +${state.countryCode}',
|
||||||
// state.isIphoneType.value
|
// state.isIphoneType.value
|
||||||
@ -103,7 +104,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText:TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
hintText:TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
@ -125,7 +126,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 15.w),
|
SizedBox(height: 15.w),
|
||||||
@ -153,12 +154,12 @@ class _StarLockForgetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoginInput(
|
child: LoginInput(
|
||||||
controller: state.codeController,
|
controller: state.codeController,
|
||||||
@ -174,7 +175,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
@ -185,11 +186,11 @@ class _StarLockForgetPasswordPageState
|
|||||||
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
||||||
? () async {
|
? () async {
|
||||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||||
var result = await Navigator.pushNamed(
|
final Object? result = await Navigator.pushNamed(
|
||||||
context, Routers.safetyVerificationPage,
|
context, Routers.safetyVerificationPage,
|
||||||
arguments: {
|
arguments: <String, String>{
|
||||||
"countryCode": state.countryCode.value,
|
'countryCode': state.countryCode.value,
|
||||||
"account": state.phoneStr.value
|
'account': state.phoneStr.value
|
||||||
});
|
});
|
||||||
logic.state.xWidth.value =
|
logic.state.xWidth.value =
|
||||||
(result as Map<String, dynamic>)['xWidth'];
|
(result as Map<String, dynamic>)['xWidth'];
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -7,6 +6,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
|
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
|
||||||
|
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
|
||||||
import 'package:star_lock/tools/submitBtn.dart';
|
import 'package:star_lock/tools/submitBtn.dart';
|
||||||
import 'package:star_lock/tools/tf_loginInput.dart';
|
import 'package:star_lock/tools/tf_loginInput.dart';
|
||||||
import 'package:star_lock/tools/titleAppBar.dart';
|
import 'package:star_lock/tools/titleAppBar.dart';
|
||||||
@ -22,8 +22,8 @@ class StarLockForgetPasswordXHJPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _StarLockForgetPasswordPageState
|
class _StarLockForgetPasswordPageState
|
||||||
extends State<StarLockForgetPasswordXHJPage> {
|
extends State<StarLockForgetPasswordXHJPage> {
|
||||||
final logic = Get.put(StarLockForgetPasswordLogic());
|
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic());
|
||||||
final state = Get.find<StarLockForgetPasswordLogic>().state;
|
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -31,28 +31,29 @@ class _StarLockForgetPasswordPageState
|
|||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
backgroundColor: const Color(0xFFFFFFFF),
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: "忘记密码".tr,
|
barTitle: '忘记密码'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
iconColor: AppColors.blackColor,
|
iconColor: AppColors.blackColor,
|
||||||
titleColor: AppColors.blackColor,
|
titleColor: AppColors.blackColor,
|
||||||
backgroundColor: Colors.white),
|
backgroundColor: Colors.white),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: EdgeInsets.only(left: 40.w, right: 40.w),
|
padding: EdgeInsets.only(left: 40.w, right: 40.w),
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
var result = await Navigator.pushNamed(
|
Object? result = await Navigator.pushNamed(
|
||||||
context, Routers.selectCountryRegionPage);
|
context, Routers.selectCountryRegionPage);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
|
logic.checkIpAction();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 70.h,
|
height: 70.h,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -60,7 +61,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
SizedBox(width: 60.w),
|
SizedBox(width: 60.w),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => Text(
|
Obx(() => Text(
|
||||||
'${state.countryName} +${state.countryCode}',
|
'${state.countryName} +${state.countryCode}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
@ -87,7 +88,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
),
|
),
|
||||||
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
]),
|
]),
|
||||||
LoginInput(
|
LoginInput(
|
||||||
@ -101,8 +102,8 @@ class _StarLockForgetPasswordPageState
|
|||||||
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
||||||
),
|
),
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
Text(
|
Text(
|
||||||
@ -121,12 +122,12 @@ class _StarLockForgetPasswordPageState
|
|||||||
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
||||||
),
|
),
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: LoginInput(
|
child: LoginInput(
|
||||||
controller: state.codeController,
|
controller: state.codeController,
|
||||||
@ -135,22 +136,22 @@ class _StarLockForgetPasswordPageState
|
|||||||
},
|
},
|
||||||
leftWidget: SizedBox(),
|
leftWidget: SizedBox(),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
|
||||||
inputFormatters: [
|
inputFormatters: <TextInputFormatter>[
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
||||||
? () async {
|
? () async {
|
||||||
var result = await Navigator.pushNamed(
|
Object? result = await Navigator.pushNamed(
|
||||||
context, Routers.safetyVerificationPage,
|
context, Routers.safetyVerificationPage,
|
||||||
arguments: {
|
arguments: <String, String>{
|
||||||
"countryCode": state.countryCode.value,
|
'countryCode': state.countryCode.value,
|
||||||
"account": state.phoneStr.value
|
'account': state.phoneStr.value
|
||||||
});
|
});
|
||||||
logic.state.xWidth.value =
|
logic.state.xWidth.value =
|
||||||
(result as Map<String, dynamic>)['xWidth'];
|
(result! as Map<String, dynamic>)['xWidth'];
|
||||||
logic.sendValidationCode();
|
logic.sendValidationCode();
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
@ -178,16 +179,14 @@ class _StarLockForgetPasswordPageState
|
|||||||
Obx(() {
|
Obx(() {
|
||||||
return SubmitBtn(
|
return SubmitBtn(
|
||||||
btnName:
|
btnName:
|
||||||
"${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
'${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}',
|
||||||
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
|
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
|
||||||
fontSize: 30.sp,
|
fontSize: 30.sp,
|
||||||
borderRadius: 20.w,
|
borderRadius: 20.w,
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
isDisabled: state.canSub.value,
|
isDisabled: state.canSub.value,
|
||||||
onClick: state.canSub.value
|
onClick: state.canSub.value
|
||||||
? () {
|
? logic.resetPassword
|
||||||
logic.resetPassword();
|
|
||||||
}
|
|
||||||
: null);
|
: null);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -14,7 +14,9 @@ import 'package:star_lock/tools/xs_jPhush.dart';
|
|||||||
import '../../mine/mine/starLockMine_logic.dart';
|
import '../../mine/mine/starLockMine_logic.dart';
|
||||||
import '../../network/api_repository.dart';
|
import '../../network/api_repository.dart';
|
||||||
import '../../tools/eventBusEventManage.dart';
|
import '../../tools/eventBusEventManage.dart';
|
||||||
|
import '../../tools/showTipView.dart';
|
||||||
import '../../tools/storage.dart';
|
import '../../tools/storage.dart';
|
||||||
|
import '../register/entity/checkIP_entity.dart';
|
||||||
import 'starLock_login_state.dart';
|
import 'starLock_login_state.dart';
|
||||||
|
|
||||||
class StarLockLoginLogic extends BaseGetXController {
|
class StarLockLoginLogic extends BaseGetXController {
|
||||||
@ -58,7 +60,16 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> checkIpAction() async {
|
||||||
|
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(
|
||||||
|
ip: ''
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if(state.countryName.value == entity.data!.name){
|
||||||
|
ShowTipView().showSureAlertDialog('国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, tipTitle: '确认国家或地区'.tr, sureStr: '我知道了'.tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void changeAgreeState() {
|
void changeAgreeState() {
|
||||||
_resetCanNext();
|
_resetCanNext();
|
||||||
|
|||||||
@ -101,6 +101,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
|
logic.checkIpAction();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
|||||||
@ -80,6 +80,7 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
|||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
|
logic.checkIpAction();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import 'Data.dart';
|
|
||||||
|
|
||||||
class SendValidationCodeEntity {
|
class SendValidationCodeEntity {
|
||||||
SendValidationCodeEntity({
|
SendValidationCodeEntity({
|
||||||
@ -29,4 +28,33 @@ class SendValidationCodeEntity {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
Data({
|
||||||
|
this.originalImageBase64,
|
||||||
|
this.jigsawImageBase64,
|
||||||
|
this.secretKey,
|
||||||
|
this.token});
|
||||||
|
|
||||||
|
Data.fromJson(dynamic json) {
|
||||||
|
originalImageBase64 = json['originalImageBase64'];
|
||||||
|
jigsawImageBase64 = json['jigsawImageBase64'];
|
||||||
|
secretKey = json['secretKey'];
|
||||||
|
token = json['token'];
|
||||||
|
}
|
||||||
|
int? originalImageBase64;
|
||||||
|
String? jigsawImageBase64;
|
||||||
|
String? secretKey;
|
||||||
|
String? token;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final map = <String, dynamic>{};
|
||||||
|
map['originalImageBase64'] = originalImageBase64;
|
||||||
|
map['jigsawImageBase64'] = jigsawImageBase64;
|
||||||
|
map['secretKey'] = secretKey;
|
||||||
|
map['token'] = token;
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
47
lib/login/register/entity/checkIP_entity.dart
Normal file
47
lib/login/register/entity/checkIP_entity.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
class CheckIPEntity {
|
||||||
|
CheckIPEntity({this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
CheckIPEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
|
||||||
|
Data({this.ip, this.name, this.abbreviation});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
ip = json['ip'];
|
||||||
|
name = json['name'];
|
||||||
|
abbreviation = json['abbreviation'];
|
||||||
|
}
|
||||||
|
String? ip;
|
||||||
|
String? name;
|
||||||
|
String? abbreviation;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['ip'] = ip;
|
||||||
|
data['name'] = name;
|
||||||
|
data['abbreviation'] = abbreviation;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,6 +15,8 @@ import 'package:star_lock/tools/xs_jPhush.dart';
|
|||||||
|
|
||||||
import '../../network/api_repository.dart';
|
import '../../network/api_repository.dart';
|
||||||
import '../../tools/baseGetXController.dart';
|
import '../../tools/baseGetXController.dart';
|
||||||
|
import '../../tools/showTipView.dart';
|
||||||
|
import 'entity/checkIP_entity.dart';
|
||||||
import 'starLock_register_state.dart';
|
import 'starLock_register_state.dart';
|
||||||
|
|
||||||
class StarLockRegisterLogic extends BaseGetXController {
|
class StarLockRegisterLogic extends BaseGetXController {
|
||||||
@ -77,6 +79,17 @@ class StarLockRegisterLogic extends BaseGetXController {
|
|||||||
} else {}
|
} else {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> checkIpAction() async {
|
||||||
|
final CheckIPEntity entity = await ApiRepository.to.checkIpAction(
|
||||||
|
ip: ''
|
||||||
|
);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if(state.countryName.value == entity.data!.name){
|
||||||
|
ShowTipView().showSureAlertDialog('国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续'.tr, tipTitle: '确认国家或地区'.tr, sureStr: '我知道了'.tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void changeAgreeState() {
|
void changeAgreeState() {
|
||||||
_resetCanSub();
|
_resetCanSub();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,6 +148,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
|
logic.checkIpAction();
|
||||||
}
|
}
|
||||||
AppLog.log(
|
AppLog.log(
|
||||||
'路由返回值: $result, countryCode:${logic.state.countryCode}');
|
'路由返回值: $result, countryCode:${logic.state.countryCode}');
|
||||||
|
|||||||
@ -104,6 +104,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
result as Map<String, dynamic>;
|
result as Map<String, dynamic>;
|
||||||
state.countryCode.value = result['code'];
|
state.countryCode.value = result['code'];
|
||||||
state.countryName.value = result['countryName'];
|
state.countryName.value = result['countryName'];
|
||||||
|
logic.checkIpAction();
|
||||||
}
|
}
|
||||||
Get.log("路由返回值: $result, countryCode:${logic.state.countryCode}");
|
Get.log("路由返回值: $result, countryCode:${logic.state.countryCode}");
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
class CheckingInDetailEntity {
|
class CheckingInDetailEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
Data? data;
|
|
||||||
|
|
||||||
CheckingInDetailEntity(
|
CheckingInDetailEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -13,6 +9,10 @@ class CheckingInDetailEntity {
|
|||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -27,10 +27,6 @@ class CheckingInDetailEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
int? noPunchTimes;
|
|
||||||
int? lateTimes;
|
|
||||||
int? earlyTimes;
|
|
||||||
List<MonthList>? monthList;
|
|
||||||
|
|
||||||
Data({this.noPunchTimes, this.lateTimes, this.earlyTimes, this.monthList});
|
Data({this.noPunchTimes, this.lateTimes, this.earlyTimes, this.monthList});
|
||||||
|
|
||||||
@ -45,6 +41,10 @@ class Data {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int? noPunchTimes;
|
||||||
|
int? lateTimes;
|
||||||
|
int? earlyTimes;
|
||||||
|
List<MonthList>? monthList;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -59,9 +59,6 @@ class Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MonthList {
|
class MonthList {
|
||||||
int? openingTimeStart;
|
|
||||||
int? openingTimeEnd;
|
|
||||||
int? colorType;
|
|
||||||
|
|
||||||
MonthList({this.openingTimeStart, this.openingTimeEnd, this.colorType});
|
MonthList({this.openingTimeStart, this.openingTimeEnd, this.colorType});
|
||||||
|
|
||||||
@ -70,6 +67,9 @@ class MonthList {
|
|||||||
openingTimeEnd = json['openingTimeEnd'];
|
openingTimeEnd = json['openingTimeEnd'];
|
||||||
colorType = json['colorType'];
|
colorType = json['colorType'];
|
||||||
}
|
}
|
||||||
|
int? openingTimeStart;
|
||||||
|
int? openingTimeEnd;
|
||||||
|
int? colorType;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
@ -28,7 +27,6 @@ class CheckingInDetailLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// getCheckInDetailData();
|
// getCheckInDetailData();
|
||||||
@ -36,14 +34,12 @@ class CheckingInDetailLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_state.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
@ -15,19 +16,17 @@ class CheckingInDetailPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
||||||
|
final CheckingInDetailLogic logic = Get.put(CheckingInDetailLogic());
|
||||||
final logic = Get.put(CheckingInDetailLogic());
|
final CheckingInDetailState state = Get.find<CheckingInDetailLogic>().state;
|
||||||
final state = Get.find<CheckingInDetailLogic>().state;
|
|
||||||
|
|
||||||
int _year = DateTime.now().year;
|
int _year = DateTime.now().year;
|
||||||
int _month = DateTime.now().month;
|
int _month = DateTime.now().month;
|
||||||
int _day = DateTime.now().day;
|
int _day = DateTime.now().day;
|
||||||
final List<CalendarModel> _datas = [];
|
final List<CalendarModel> _datas = <CalendarModel>[];
|
||||||
final List<CalendarModel> _listDatas = [];
|
final List<CalendarModel> _listDatas = <CalendarModel>[];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
//设置默认当前月日期
|
//设置默认当前月日期
|
||||||
@ -35,7 +34,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
|
|
||||||
logic.getCheckInDetailData((){
|
logic.getCheckInDetailData((){
|
||||||
//设置模拟数据,日历月事件,可根据接口返回的结果
|
//设置模拟数据,日历月事件,可根据接口返回的结果
|
||||||
_loadAttendanceMonthRecord("$_year-$_month");
|
_loadAttendanceMonthRecord('$_year-$_month');
|
||||||
});
|
});
|
||||||
|
|
||||||
//设置模拟数据,日历月事件,可根据接口返回的结果
|
//设置模拟数据,日历月事件,可根据接口返回的结果
|
||||||
@ -47,9 +46,9 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
//加载月历事件,请求接口
|
//加载月历事件,请求接口
|
||||||
_loadAttendanceMonthRecord(String dateTime) async {
|
_loadAttendanceMonthRecord(String dateTime) async {
|
||||||
// 显示的上个月的天数
|
// 显示的上个月的天数
|
||||||
var placeholderDays = _getPlaceholderDays(year: _year, month: _month);
|
final int placeholderDays = _getPlaceholderDays(year: _year, month: _month);
|
||||||
// 当月多少天
|
// 当月多少天
|
||||||
var currentMonthDays = _getCurrentMonthDays(year: _year, month: _month);
|
final int currentMonthDays = _getCurrentMonthDays(year: _year, month: _month);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
// 因为_datas这个月上个月都包含的都有 遍历把本月的赋值
|
// 因为_datas这个月上个月都包含的都有 遍历把本月的赋值
|
||||||
@ -68,7 +67,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
state.checkDate.value = DateTime.parse(dateTime).millisecondsSinceEpoch;
|
state.checkDate.value = DateTime.parse(dateTime).millisecondsSinceEpoch;
|
||||||
logic.getCheckInDetailData((){
|
logic.getCheckInDetailData((){
|
||||||
//设置模拟数据,日历月事件,可根据接口返回的结果
|
//设置模拟数据,日历月事件,可根据接口返回的结果
|
||||||
_loadAttendanceMonthRecord("$_year-$_month");
|
_loadAttendanceMonthRecord('$_year-$_month');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
// margin: EdgeInsets.all(20.sp),
|
// margin: EdgeInsets.all(20.sp),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -91,7 +90,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
//设置四周边框
|
//设置四周边框
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
_yearHeader(),
|
_yearHeader(),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
_weekHeader(),
|
_weekHeader(),
|
||||||
@ -114,26 +113,17 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
margin: const EdgeInsets.only(top: 10),
|
margin: const EdgeInsets.only(top: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: _lastMonth,
|
||||||
_lastMonth();
|
child: Image(width: 50.w, height: 30.w, image: const AssetImage('images/icon_left_black.png'),),
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
// margin: EdgeInsets.only(left: 20.w),
|
|
||||||
child: Image(width: 50.w, height: 30.w, image: const AssetImage("images/icon_left_black.png"),),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 60.w,),
|
SizedBox(width: 60.w,),
|
||||||
Text("$_year-$_month", style: TextStyle(fontSize: 28.sp, color: Colors.black, fontWeight: FontWeight.w500)),
|
Text('$_year-$_month', style: TextStyle(fontSize: 28.sp, color: Colors.black, fontWeight: FontWeight.w500)),
|
||||||
SizedBox(width: 60.w),
|
SizedBox(width: 60.w),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: _nextMonth,
|
||||||
_nextMonth();
|
child: Image(width: 50.w, height: 30.w, image: const AssetImage('images/icon_right_black.png')),
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
child: Image(width: 50.w, height: 30.w, image: const AssetImage("images/icon_right_black.png")),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -142,7 +132,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
|
|
||||||
//中部周
|
//中部周
|
||||||
Widget _weekHeader() {
|
Widget _weekHeader() {
|
||||||
var array = [
|
final List<String> array = <String>[
|
||||||
TranslationLoader.lanKeys!.mondayShort!.tr,
|
TranslationLoader.lanKeys!.mondayShort!.tr,
|
||||||
TranslationLoader.lanKeys!.tuesdayShort!.tr,
|
TranslationLoader.lanKeys!.tuesdayShort!.tr,
|
||||||
TranslationLoader.lanKeys!.wednesdayShort!.tr,
|
TranslationLoader.lanKeys!.wednesdayShort!.tr,
|
||||||
@ -151,7 +141,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
TranslationLoader.lanKeys!.saturdayShort!.tr,
|
TranslationLoader.lanKeys!.saturdayShort!.tr,
|
||||||
TranslationLoader.lanKeys!.sundayShort!.tr
|
TranslationLoader.lanKeys!.sundayShort!.tr
|
||||||
];
|
];
|
||||||
return Container(
|
return SizedBox(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
@ -167,7 +157,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
// crossAxisSpacing: ScreenUtil().setWidth(15),
|
// crossAxisSpacing: ScreenUtil().setWidth(15),
|
||||||
//子组件宽高长度比例
|
//子组件宽高长度比例
|
||||||
childAspectRatio: 2),
|
childAspectRatio: 2),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -186,122 +176,118 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
|
|
||||||
//底部日
|
//底部日
|
||||||
Widget _everyDay() {
|
Widget _everyDay() {
|
||||||
return Container(
|
return GridView.builder(
|
||||||
child: GridView.builder(
|
padding: EdgeInsets.only(left: 10.sp, top: 10.sp, right: 10.sp),
|
||||||
padding: EdgeInsets.only(left: 10.sp, top: 10.sp, right: 10.sp),
|
itemCount: _getRowsForMonthYear(year: _year, month: _month) * 7,
|
||||||
itemCount: _getRowsForMonthYear(year: _year, month: _month) * 7,
|
shrinkWrap: true,
|
||||||
shrinkWrap: true,
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
//横轴元素个数
|
||||||
//横轴元素个数
|
crossAxisCount: 7,
|
||||||
crossAxisCount: 7,
|
// //纵轴间距
|
||||||
// //纵轴间距
|
// mainAxisSpacing: ScreenUtil().setHeight(10),
|
||||||
// mainAxisSpacing: ScreenUtil().setHeight(10),
|
// // 横轴间距
|
||||||
// // 横轴间距
|
// crossAxisSpacing: ScreenUtil().setWidth(10),
|
||||||
// crossAxisSpacing: ScreenUtil().setWidth(10),
|
//子组件宽高长度比例
|
||||||
//子组件宽高长度比例
|
childAspectRatio: 1),
|
||||||
childAspectRatio: 1),
|
itemBuilder: (BuildContext context, int index) {
|
||||||
itemBuilder: (context, index) {
|
Color backColor = Colors.white;
|
||||||
Color backColor = Colors.white;
|
// Color textColor = const Color(0xFFFFFFFF);
|
||||||
// Color textColor = const Color(0xFFFFFFFF);
|
if(_datas[index].workType == '1'){
|
||||||
if(_datas[index].workType == "1"){
|
// 迟到
|
||||||
// 迟到
|
backColor = const Color(0xFFE83523);
|
||||||
backColor = const Color(0xFFE83523);
|
}else if( _datas[index].workType == '2'){
|
||||||
}else if( _datas[index].workType == "2"){
|
// 早退
|
||||||
// 早退
|
backColor = const Color(0xFFEDB459);
|
||||||
backColor = const Color(0xFFEDB459);
|
}else if( _datas[index].workType == '3'){
|
||||||
}else if( _datas[index].workType == "3"){
|
// 未打卡
|
||||||
// 未打卡
|
backColor = const Color(0xFF666666);
|
||||||
backColor = const Color(0xFF666666);
|
}
|
||||||
}
|
return GestureDetector(
|
||||||
return GestureDetector(
|
onTap: () {
|
||||||
onTap: () {
|
// setState(() {
|
||||||
// setState(() {
|
// if (_datas[index].month == _month) {
|
||||||
// if (_datas[index].month == _month) {
|
// //判断点击的是否是当月日期,只对当前月点击的日期做处理
|
||||||
// //判断点击的是否是当月日期,只对当前月点击的日期做处理
|
// for (int i = 0; i < _datas.length; i++) {
|
||||||
// for (int i = 0; i < _datas.length; i++) {
|
// if (i == index) {
|
||||||
// if (i == index) {
|
// //切换至选中的日期
|
||||||
// //切换至选中的日期
|
// _day = _datas[i].day!;
|
||||||
// _day = _datas[i].day!;
|
// _datas[i].isSelect = true;
|
||||||
// _datas[i].isSelect = true;
|
//
|
||||||
//
|
// //加载选中的日期事件
|
||||||
// //加载选中的日期事件
|
// _loadAttendanceDayRecord(
|
||||||
// _loadAttendanceDayRecord(
|
// "${_datas[i].year}-${_datas[i].month}-${_datas[i].day}");
|
||||||
// "${_datas[i].year}-${_datas[i].month}-${_datas[i].day}");
|
// } else {
|
||||||
// } else {
|
// _datas[i].isSelect = false;
|
||||||
// _datas[i].isSelect = false;
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// } else {
|
||||||
// } else {
|
// //不是当月的不做处理
|
||||||
// //不是当月的不做处理
|
// // _datas[index].is_select=false;
|
||||||
// // _datas[index].is_select=false;
|
// }
|
||||||
// }
|
// });
|
||||||
// });
|
},
|
||||||
},
|
child: Column(
|
||||||
child: Container(
|
children: <Widget>[
|
||||||
child: Column(
|
Container(
|
||||||
children: [
|
width: 40.w,
|
||||||
Container(
|
height: 40.w,
|
||||||
width: 40.w,
|
//设置底部背景
|
||||||
height: 40.w,
|
decoration: BoxDecoration(
|
||||||
//设置底部背景
|
color: backColor,
|
||||||
decoration: BoxDecoration(
|
shape: BoxShape.circle,
|
||||||
color: backColor,
|
),
|
||||||
shape: BoxShape.circle,
|
child: Center(
|
||||||
),
|
child: Text(
|
||||||
child: Center(
|
//不是当前月不显示值
|
||||||
child: Text(
|
_datas[index].month == _month
|
||||||
//不是当前月不显示值
|
? _datas[index].day.toString()
|
||||||
_datas[index].month == _month
|
: '',
|
||||||
? _datas[index].day.toString()
|
textAlign: TextAlign.center,
|
||||||
: "",
|
//设置选中字体颜色 休息的颜色都是黑色 其余的都是白色因为有背景色
|
||||||
textAlign: TextAlign.center,
|
style: (int.parse(_datas[index].workType!) > 0)
|
||||||
//设置选中字体颜色 休息的颜色都是黑色 其余的都是白色因为有背景色
|
? TextStyle(
|
||||||
style: (int.parse(_datas[index].workType!) > 0)
|
fontSize: 24.sp, color: const Color(0xFFFFFFFF))
|
||||||
? TextStyle(
|
: TextStyle(
|
||||||
fontSize: 24.sp, color: const Color(0xFFFFFFFF))
|
fontSize: 24.sp,
|
||||||
: TextStyle(
|
color: Colors.black),
|
||||||
fontSize: 24.sp,
|
|
||||||
color: Colors.black),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 5),
|
),
|
||||||
//设置底部小圆点,非当前月的不显示,设置为透明,其余的根据状态判断显示
|
|
||||||
// _datas[index].month == _month &&
|
|
||||||
// _datas[index].workType != "" &&
|
|
||||||
// _datas[index].workType != "0"
|
|
||||||
// ? Container(
|
|
||||||
// height: 6.0,
|
|
||||||
// width: 6.0,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// shape: BoxShape.circle,
|
|
||||||
// color: _datas[index].workType == "1"
|
|
||||||
// ? const Color(0xFFF48835)
|
|
||||||
// : const Color(0xFF2C91F6)),
|
|
||||||
// )
|
|
||||||
// : Container(),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
);
|
//设置底部小圆点,非当前月的不显示,设置为透明,其余的根据状态判断显示
|
||||||
},
|
// _datas[index].month == _month &&
|
||||||
),
|
// _datas[index].workType != "" &&
|
||||||
|
// _datas[index].workType != "0"
|
||||||
|
// ? Container(
|
||||||
|
// height: 6.0,
|
||||||
|
// width: 6.0,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// shape: BoxShape.circle,
|
||||||
|
// color: _datas[index].workType == "1"
|
||||||
|
// ? const Color(0xFFF48835)
|
||||||
|
// : const Color(0xFF2C91F6)),
|
||||||
|
// )
|
||||||
|
// : Container(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomStatisticsWidget() {
|
Widget _bottomStatisticsWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
// height: 40.h,
|
// height: 40.h,
|
||||||
padding: EdgeInsets.only(left: 50.w, top: 5.h, bottom: 5.h),
|
padding: EdgeInsets.only(left: 50.w, top: 5.h, bottom: 5.h),
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
child: Text(
|
child: Text(
|
||||||
"月统计".tr,
|
'月统计'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 26.sp,
|
fontSize: 26.sp,
|
||||||
@ -310,9 +296,9 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_bottomStatisticsItemWidget(const Color(0xFFE83523), "迟到".tr, state.lateTimes.value),
|
_bottomStatisticsItemWidget(const Color(0xFFE83523), '迟到'.tr, state.lateTimes.value),
|
||||||
_bottomStatisticsItemWidget(const Color(0xFFEDB459), "早退".tr, state.earlyTimes.value),
|
_bottomStatisticsItemWidget(const Color(0xFFEDB459), '早退'.tr, state.earlyTimes.value),
|
||||||
_bottomStatisticsItemWidget(const Color(0xFF666666), "未打卡".tr, state.noPunchTimes.value),
|
_bottomStatisticsItemWidget(const Color(0xFF666666), '未打卡'.tr, state.noPunchTimes.value),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -323,13 +309,13 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
String rightTitle,
|
String rightTitle,
|
||||||
) {
|
) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
// height: 70.h,
|
// height: 70.h,
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
EdgeInsets.only(left: 20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Container(
|
Container(
|
||||||
width: 30.w,
|
width: 30.w,
|
||||||
@ -363,13 +349,13 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
// 获取行数
|
// 获取行数
|
||||||
int _getRowsForMonthYear({int? year, int? month}) {
|
int _getRowsForMonthYear({int? year, int? month}) {
|
||||||
// 当前月天数
|
// 当前月天数
|
||||||
var currentMonthDays = _getCurrentMonthDays(year: year, month: month);
|
final int currentMonthDays = _getCurrentMonthDays(year: year, month: month);
|
||||||
// 这个月1号前面有几天
|
// 这个月1号前面有几天
|
||||||
var placeholderDays = _getPlaceholderDays(year: year, month: month);
|
final int placeholderDays = _getPlaceholderDays(year: year, month: month);
|
||||||
|
|
||||||
int rows = (currentMonthDays + placeholderDays) ~/ 7;
|
int rows = (currentMonthDays + placeholderDays) ~/ 7;
|
||||||
|
|
||||||
int remainder = (currentMonthDays + placeholderDays) % 7;
|
final int remainder = (currentMonthDays + placeholderDays) % 7;
|
||||||
if (remainder > 0) {
|
if (remainder > 0) {
|
||||||
rows = rows + 1;
|
rows = rows + 1;
|
||||||
}
|
}
|
||||||
@ -406,61 +392,61 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
/// 获取展示信息
|
/// 获取展示信息
|
||||||
_setDatas({int? year, int? month}) {
|
_setDatas({int? year, int? month}) {
|
||||||
/// 上个月占位
|
/// 上个月占位
|
||||||
var lastYear = year;
|
int? lastYear = year;
|
||||||
var lastMonth = month! - 1;
|
int lastMonth = month! - 1;
|
||||||
if (month == 1) {
|
if (month == 1) {
|
||||||
lastYear = (year! - 1)!;
|
lastYear = (year! - 1)!;
|
||||||
lastMonth = 12;
|
lastMonth = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
var placeholderDays = _getPlaceholderDays(year: year, month: month);
|
final int placeholderDays = _getPlaceholderDays(year: year, month: month);
|
||||||
var lastMonthDays = _getCurrentMonthDays(year: lastYear, month: lastMonth);
|
final int lastMonthDays = _getCurrentMonthDays(year: lastYear, month: lastMonth);
|
||||||
var firstDay = lastMonthDays - placeholderDays;
|
final int firstDay = lastMonthDays - placeholderDays;
|
||||||
for (var i = 0; i < placeholderDays; i++) {
|
for (int i = 0; i < placeholderDays; i++) {
|
||||||
_datas.add(CalendarModel(
|
_datas.add(CalendarModel(
|
||||||
year: lastYear,
|
year: lastYear,
|
||||||
month: lastMonth,
|
month: lastMonth,
|
||||||
day: firstDay + i + 1,
|
day: firstDay + i + 1,
|
||||||
isSelect: false,
|
isSelect: false,
|
||||||
workType: "0"));
|
workType: '0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 本月显示
|
/// 本月显示
|
||||||
var currentMonthDays = _getCurrentMonthDays(year: year, month: month);
|
final int currentMonthDays = _getCurrentMonthDays(year: year, month: month);
|
||||||
for (var i = 0; i < currentMonthDays; i++) {
|
for (int i = 0; i < currentMonthDays; i++) {
|
||||||
if (i == _day - 1) {
|
if (i == _day - 1) {
|
||||||
_datas.add(CalendarModel(
|
_datas.add(CalendarModel(
|
||||||
year: year,
|
year: year,
|
||||||
month: month,
|
month: month,
|
||||||
day: i + 1,
|
day: i + 1,
|
||||||
isSelect: true,
|
isSelect: true,
|
||||||
workType: "0"));
|
workType: '0'));
|
||||||
} else {
|
} else {
|
||||||
_datas.add(CalendarModel(
|
_datas.add(CalendarModel(
|
||||||
year: year,
|
year: year,
|
||||||
month: month,
|
month: month,
|
||||||
day: i + 1,
|
day: i + 1,
|
||||||
isSelect: false,
|
isSelect: false,
|
||||||
workType: "0"));
|
workType: '0'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 下个月占位
|
/// 下个月占位
|
||||||
var nextYear = year;
|
int? nextYear = year;
|
||||||
var nextMonth = month + 1;
|
int nextMonth = month + 1;
|
||||||
if (month == 12) {
|
if (month == 12) {
|
||||||
nextYear = (year! + 1)!;
|
nextYear = year! + 1;
|
||||||
nextMonth = 1;
|
nextMonth = 1;
|
||||||
}
|
}
|
||||||
var nextPlaceholderDays =
|
final int nextPlaceholderDays =
|
||||||
_getPlaceholderDays(year: nextYear, month: nextMonth);
|
_getPlaceholderDays(year: nextYear, month: nextMonth);
|
||||||
for (var i = 0; i < 7 - nextPlaceholderDays; i++) {
|
for (int i = 0; i < 7 - nextPlaceholderDays; i++) {
|
||||||
_datas.add(CalendarModel(
|
_datas.add(CalendarModel(
|
||||||
year: nextYear,
|
year: nextYear,
|
||||||
month: nextMonth,
|
month: nextMonth,
|
||||||
day: i + 1,
|
day: i + 1,
|
||||||
isSelect: false,
|
isSelect: false,
|
||||||
workType: "0"));
|
workType: '0'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +505,7 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
_datas.clear();
|
_datas.clear();
|
||||||
_setDatas(year: _year, month: _month);
|
_setDatas(year: _year, month: _month);
|
||||||
//更新月历事件
|
//更新月历事件
|
||||||
_loadAttendanceMonthRecord("$_year-$_month");
|
_loadAttendanceMonthRecord('$_year-$_month');
|
||||||
//更新日事件
|
//更新日事件
|
||||||
// _loadAttendanceDayRecord("$_year-$_month-$_day");
|
// _loadAttendanceDayRecord("$_year-$_month-$_day");
|
||||||
_loadAttendanceDayRecord("$_year-${_month.toString().padLeft(2,'0')}-${_day.toString().padLeft(2,'0')}");
|
_loadAttendanceDayRecord("$_year-${_month.toString().padLeft(2,'0')}-${_day.toString().padLeft(2,'0')}");
|
||||||
@ -529,12 +515,12 @@ class _CheckingInDetailPageState extends State<CheckingInDetailPage> {
|
|||||||
|
|
||||||
//日历bean
|
//日历bean
|
||||||
class CalendarModel {
|
class CalendarModel {
|
||||||
int? year;
|
|
||||||
int? month;
|
|
||||||
int? day;
|
|
||||||
String? workType = ""; //日期事件,0休息,1迟到,2早退,3未打卡
|
|
||||||
bool? isSelect = false;
|
|
||||||
|
|
||||||
CalendarModel(
|
CalendarModel(
|
||||||
{this.year, this.month, this.day, this.isSelect, this.workType});
|
{this.year, this.month, this.day, this.isSelect, this.workType});
|
||||||
|
int? year;
|
||||||
|
int? month;
|
||||||
|
int? day;
|
||||||
|
String? workType = ''; //日期事件,0休息,1迟到,2早退,3未打卡
|
||||||
|
bool? isSelect = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,29 +4,29 @@ import '../../../lockMian/entity/lockListInfo_entity.dart';
|
|||||||
import 'checkingInDetail_entity.dart';
|
import 'checkingInDetail_entity.dart';
|
||||||
|
|
||||||
class CheckingInDetailState{
|
class CheckingInDetailState{
|
||||||
|
|
||||||
// final getKeyInfosData = LockListInfoItemEntity().obs;
|
|
||||||
final companyId = "".obs;
|
|
||||||
final staffId = 0.obs;
|
|
||||||
final staffName = "".obs;
|
|
||||||
|
|
||||||
final checkDate = DateTime.now().millisecondsSinceEpoch.obs;
|
|
||||||
|
|
||||||
var lateTimes = "".obs;// 迟到
|
|
||||||
var earlyTimes = "".obs;// 早退
|
|
||||||
var noPunchTimes = "".obs;// 未打车
|
|
||||||
final monthListData = <MonthList>[].obs;
|
|
||||||
CheckingInDetailState() {
|
CheckingInDetailState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
if(companyId.value.isEmpty && map["companyId"] != null){
|
if(companyId.value.isEmpty && map['companyId'] != null){
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
}
|
}
|
||||||
if(map["staffId"] != null){
|
if(map['staffId'] != null){
|
||||||
staffId.value = map["staffId"];
|
staffId.value = map['staffId'];
|
||||||
}
|
}
|
||||||
if(staffName.value.isEmpty && map["staffName"] != null){
|
if(staffName.value.isEmpty && map['staffName'] != null){
|
||||||
staffName.value = map["staffName"];
|
staffName.value = map['staffName'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// final getKeyInfosData = LockListInfoItemEntity().obs;
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
final RxInt staffId = 0.obs;
|
||||||
|
final RxString staffName = ''.obs;
|
||||||
|
|
||||||
|
final RxInt checkDate = DateTime.now().millisecondsSinceEpoch.obs;
|
||||||
|
|
||||||
|
RxString lateTimes = ''.obs;// 迟到
|
||||||
|
RxString earlyTimes = ''.obs;// 早退
|
||||||
|
RxString noPunchTimes = ''.obs;// 未打车
|
||||||
|
final RxList<MonthList> monthListData = <MonthList>[].obs;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
import 'checkingInAddHolidays_state.dart';
|
import 'checkingInAddHolidays_state.dart';
|
||||||
@ -8,43 +9,41 @@ class CheckingInAddHolidaysLogic extends BaseGetXController{
|
|||||||
CheckingInAddHolidaysState state = CheckingInAddHolidaysState();
|
CheckingInAddHolidaysState state = CheckingInAddHolidaysState();
|
||||||
|
|
||||||
// 添加假期
|
// 添加假期
|
||||||
void editStaffLoadData() async{
|
Future<void> editStaffLoadData() async{
|
||||||
if(state.staffNameController.text.isEmpty){
|
if(state.staffNameController.text.isEmpty){
|
||||||
showToast("请输入姓名");
|
showToast('请输入姓名');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = await ApiRepository.to.addHolidaysData(
|
LoginEntity entity = await ApiRepository.to.addHolidaysData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
fillClassDate: state.makeUpWorkDate.value.isNotEmpty ? DateTime.parse(state.makeUpWorkDate.value).millisecondsSinceEpoch.toString() : "",
|
fillClassDate: state.makeUpWorkDate.value.isNotEmpty ? DateTime.parse(state.makeUpWorkDate.value).millisecondsSinceEpoch.toString() : '',
|
||||||
vacationEndDate: DateTime.parse(state.endDate.value).millisecondsSinceEpoch.toString(),
|
vacationEndDate: DateTime.parse(state.endDate.value).millisecondsSinceEpoch.toString(),
|
||||||
vacationName: state.staffNameController.text,
|
vacationName: state.staffNameController.text,
|
||||||
vacationStartDate: DateTime.parse(state.beginDate.value).millisecondsSinceEpoch.toString()
|
vacationStartDate: DateTime.parse(state.beginDate.value).millisecondsSinceEpoch.toString()
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("添加成功");
|
showToast('添加成功');
|
||||||
Get.back(result: "addScuess");
|
Get.back(result: 'addScuess');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void onReady() {
|
// void onReady() {
|
||||||
// TODO: implement onReady
|
// super.onReady();
|
||||||
super.onReady();
|
//
|
||||||
|
// }
|
||||||
}
|
//
|
||||||
|
// @override
|
||||||
@override
|
// void onInit() {
|
||||||
void onInit() {
|
// super.onInit();
|
||||||
// TODO: implement onInit
|
//
|
||||||
super.onInit();
|
// }
|
||||||
|
//
|
||||||
}
|
// @override
|
||||||
|
// void onClose() {
|
||||||
@override
|
// super.onInit();
|
||||||
void onClose() {
|
//
|
||||||
// TODO: implement onClose
|
// }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,19 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class CheckingInAddHolidaysState{
|
class CheckingInAddHolidaysState{
|
||||||
final TextEditingController staffNameController = TextEditingController();
|
|
||||||
|
|
||||||
final companyId = "".obs;
|
|
||||||
final beginDate = "".obs;
|
|
||||||
final endDate = "".obs;
|
|
||||||
final makeUpWorkDate = "".obs;
|
|
||||||
|
|
||||||
CheckingInAddHolidaysState() {
|
CheckingInAddHolidaysState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
}
|
}
|
||||||
|
final TextEditingController staffNameController = TextEditingController();
|
||||||
|
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
final RxString beginDate = ''.obs;
|
||||||
|
final RxString endDate = ''.obs;
|
||||||
|
final RxString makeUpWorkDate = ''.obs;
|
||||||
}
|
}
|
||||||
@ -8,13 +8,13 @@ class CheckingInDeletHolidaysLogic extends BaseGetXController{
|
|||||||
CheckingInDeletHolidaysState state = CheckingInDeletHolidaysState();
|
CheckingInDeletHolidaysState state = CheckingInDeletHolidaysState();
|
||||||
|
|
||||||
// 删除假期
|
// 删除假期
|
||||||
void deletStaffLoadData() async{
|
Future<void> deletStaffLoadData() async{
|
||||||
var entity = await ApiRepository.to.deletHolidaysData(
|
var entity = await ApiRepository.to.deletHolidaysData(
|
||||||
vacationId: state.listItem.value.vacationId.toString()
|
vacationId: state.listItem.value.vacationId.toString()
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("删除成功");
|
showToast('删除成功');
|
||||||
Get.back(result: "deletScuess");
|
Get.back(result: 'deletScuess');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInHolidays/checkingInDeletHolidays/checkingInDeletHolidays_state.dart';
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
@ -18,8 +19,8 @@ class CheckingInDeletHolidaysPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInDeletHolidaysPageState extends State<CheckingInDeletHolidaysPage> {
|
class _CheckingInDeletHolidaysPageState extends State<CheckingInDeletHolidaysPage> {
|
||||||
final logic = Get.put(CheckingInDeletHolidaysLogic());
|
final CheckingInDeletHolidaysLogic logic = Get.put(CheckingInDeletHolidaysLogic());
|
||||||
final state = Get.find<CheckingInDeletHolidaysLogic>().state;
|
final CheckingInDeletHolidaysState state = Get.find<CheckingInDeletHolidaysLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -29,15 +30,13 @@ class _CheckingInDeletHolidaysPageState extends State<CheckingInDeletHolidaysPag
|
|||||||
barTitle: TranslationLoader.lanKeys!.holidayInfo!.tr,
|
barTitle: TranslationLoader.lanKeys!.holidayInfo!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
actionsList: [
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.delete!.tr,
|
TranslationLoader.lanKeys!.delete!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: logic.deletStaffLoadData,
|
||||||
logic.deletStaffLoadData();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
// GestureDetector(
|
// GestureDetector(
|
||||||
// onTap: () async {
|
// onTap: () async {
|
||||||
@ -53,7 +52,7 @@ class _CheckingInDeletHolidaysPageState extends State<CheckingInDeletHolidaysPag
|
|||||||
// ),
|
// ),
|
||||||
],),
|
],),
|
||||||
body: Obx(() => Column(
|
body: Obx(() => Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: state.listItem.value.vacationName,
|
rightTitle: state.listItem.value.vacationName,
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import 'package:get/get.dart';
|
|||||||
import '../checkingInSetHolidays/checkingInSetHolidays_entity.dart';
|
import '../checkingInSetHolidays/checkingInSetHolidays_entity.dart';
|
||||||
|
|
||||||
class CheckingInDeletHolidaysState{
|
class CheckingInDeletHolidaysState{
|
||||||
final listItem = ListItem().obs;
|
|
||||||
|
|
||||||
CheckingInDeletHolidaysState() {
|
CheckingInDeletHolidaysState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
listItem.value = map["listItem"];
|
listItem.value = map['listItem'];
|
||||||
}
|
}
|
||||||
|
final Rx<ListItem> listItem = ListItem().obs;
|
||||||
}
|
}
|
||||||
@ -9,7 +9,7 @@ class CheckingInSetHolidaysLogic extends BaseGetXController{
|
|||||||
CheckingInSetHolidaysState state = CheckingInSetHolidaysState();
|
CheckingInSetHolidaysState state = CheckingInSetHolidaysState();
|
||||||
|
|
||||||
// 获取员工列表
|
// 获取员工列表
|
||||||
void editStaffLoadData() async{
|
Future<void> editStaffLoadData() async{
|
||||||
var entity = await ApiRepository.to.holidaysListData(
|
var entity = await ApiRepository.to.holidaysListData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
vacationYear: state.selectYear.value.toString(),
|
vacationYear: state.selectYear.value.toString(),
|
||||||
@ -21,7 +21,6 @@ class CheckingInSetHolidaysLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
editStaffLoadData();
|
editStaffLoadData();
|
||||||
@ -29,14 +28,13 @@ class CheckingInSetHolidaysLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import 'checkingInSetHolidays_entity.dart';
|
import 'checkingInSetHolidays_entity.dart';
|
||||||
|
|
||||||
class CheckingInSetHolidaysState{
|
class CheckingInSetHolidaysState{
|
||||||
final companyId = "".obs;
|
|
||||||
final mouth = "".obs;
|
|
||||||
final selectYear = DateTime.now().year.obs;
|
|
||||||
final holidaysListData = <HolidaysMonthListData>[].obs;
|
|
||||||
|
|
||||||
CheckingInSetHolidaysState() {
|
CheckingInSetHolidaysState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
}
|
}
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
final RxString mouth = ''.obs;
|
||||||
|
final RxInt selectYear = DateTime.now().year.obs;
|
||||||
|
final RxList<HolidaysMonthListData> holidaysListData = <HolidaysMonthListData>[].obs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
class CheckingInListDayEntity {
|
class CheckingInListDayEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
Data? data;
|
|
||||||
|
|
||||||
CheckingInListDayEntity(
|
CheckingInListDayEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -13,6 +9,10 @@ class CheckingInListDayEntity {
|
|||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -27,10 +27,6 @@ class CheckingInListDayEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
int? noPunchTimes;
|
|
||||||
int? lateTimes;
|
|
||||||
int? earlyTimes;
|
|
||||||
List<AttendanceRecordDayList>? attendanceRecordList;
|
|
||||||
|
|
||||||
Data(
|
Data(
|
||||||
{this.noPunchTimes,
|
{this.noPunchTimes,
|
||||||
@ -49,6 +45,10 @@ class Data {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int? noPunchTimes;
|
||||||
|
int? lateTimes;
|
||||||
|
int? earlyTimes;
|
||||||
|
List<AttendanceRecordDayList>? attendanceRecordList;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -64,14 +64,6 @@ class Data {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AttendanceRecordDayList {
|
class AttendanceRecordDayList {
|
||||||
String? headurl;
|
|
||||||
int? isSelf;
|
|
||||||
String? staffName;
|
|
||||||
int? staffId;
|
|
||||||
int? attendanceType;
|
|
||||||
int? openingTimeEnd;
|
|
||||||
int? openingTimeStart;
|
|
||||||
int? colorType;
|
|
||||||
|
|
||||||
AttendanceRecordDayList(
|
AttendanceRecordDayList(
|
||||||
{this.headurl,
|
{this.headurl,
|
||||||
@ -93,6 +85,14 @@ class AttendanceRecordDayList {
|
|||||||
openingTimeStart = json['openingTimeStart'];
|
openingTimeStart = json['openingTimeStart'];
|
||||||
colorType = json['colorType'];
|
colorType = json['colorType'];
|
||||||
}
|
}
|
||||||
|
String? headurl;
|
||||||
|
int? isSelf;
|
||||||
|
String? staffName;
|
||||||
|
int? staffId;
|
||||||
|
int? attendanceType;
|
||||||
|
int? openingTimeEnd;
|
||||||
|
int? openingTimeStart;
|
||||||
|
int? colorType;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
class CheckingInListMonthEntity {
|
class CheckingInListMonthEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
List<AttendanceRecordMonthList>? data;
|
|
||||||
|
|
||||||
CheckingInListMonthEntity(
|
CheckingInListMonthEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -18,6 +14,10 @@ class CheckingInListMonthEntity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<AttendanceRecordMonthList>? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -32,15 +32,6 @@ class CheckingInListMonthEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AttendanceRecordMonthList {
|
class AttendanceRecordMonthList {
|
||||||
String? headurl;
|
|
||||||
int? isSelf;
|
|
||||||
String? staffName;
|
|
||||||
int? staffId;
|
|
||||||
int? attendanceType;
|
|
||||||
int? countryCode;
|
|
||||||
int? openingTimeStart;
|
|
||||||
String? attendanceWay;
|
|
||||||
int? avgTime;
|
|
||||||
|
|
||||||
AttendanceRecordMonthList(
|
AttendanceRecordMonthList(
|
||||||
{this.headurl,
|
{this.headurl,
|
||||||
@ -64,6 +55,15 @@ class AttendanceRecordMonthList {
|
|||||||
attendanceWay = json['attendanceWay'];
|
attendanceWay = json['attendanceWay'];
|
||||||
avgTime = json['avgTime'];
|
avgTime = json['avgTime'];
|
||||||
}
|
}
|
||||||
|
String? headurl;
|
||||||
|
int? isSelf;
|
||||||
|
String? staffName;
|
||||||
|
int? staffId;
|
||||||
|
int? attendanceType;
|
||||||
|
int? countryCode;
|
||||||
|
int? openingTimeStart;
|
||||||
|
String? attendanceWay;
|
||||||
|
int? avgTime;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -0,0 +1,98 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class CheckingInListSeletMonthPage extends StatefulWidget {
|
||||||
|
const CheckingInListSeletMonthPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CheckingInListSeletMonthPage> createState() => _CheckingInListSeletMonthPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CheckingInListSeletMonthPageState extends State<CheckingInListSeletMonthPage> {
|
||||||
|
var _selectMonth = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Dialog(
|
||||||
|
// insetPadding: EdgeInsets.all(10), //距离
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.w))), //形状
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
clipBehavior: Clip.antiAlias, //强制裁剪
|
||||||
|
elevation: 10,
|
||||||
|
child: SizedBox(
|
||||||
|
//需要在内部限制下高度和宽度才能更好的显示
|
||||||
|
height: 270.h,
|
||||||
|
width: 1.sw - 20.w,
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
SizedBox(
|
||||||
|
height: 80.h,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
GestureDetector(
|
||||||
|
onTap:(){
|
||||||
|
|
||||||
|
},
|
||||||
|
child: Image(width: 50.w, height: 40.w, image: const AssetImage('images/icon_left_black.png'),),
|
||||||
|
),
|
||||||
|
SizedBox(width: 50.w,),
|
||||||
|
Text('2024', style: TextStyle(fontSize: 30.sp, color: Colors.black, fontWeight: FontWeight.w500)),
|
||||||
|
SizedBox(width: 50.w),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: (){
|
||||||
|
|
||||||
|
},
|
||||||
|
child: Image(width: 50.w, height: 40.w, image: const AssetImage('images/icon_right_black.png')),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Container(
|
||||||
|
// padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
|
child: Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(left: 10.w, right: 10.w),
|
||||||
|
child: GridView.builder(
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 6,
|
||||||
|
// crossAxisSpacing: 5.w,
|
||||||
|
// mainAxisSpacing: 5.h,
|
||||||
|
// childAspectRatio: 1.0,
|
||||||
|
),
|
||||||
|
itemCount: 12,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: (){
|
||||||
|
setState(() {
|
||||||
|
Get.back();
|
||||||
|
_selectMonth = index + 1;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: index+1 == _selectMonth ? Colors.blue : null,
|
||||||
|
// color: Colors.blue,
|
||||||
|
borderRadius: BorderRadius.circular(40.w),
|
||||||
|
),
|
||||||
|
child: Text('${index + 1}月', style: TextStyle(fontSize: 24.sp, color: index+1 == _selectMonth ? Colors.white : Colors.black)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,20 +1,23 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListDay_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInList/checkingInListMonth_entity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/eventBusEventManage.dart';
|
import '../../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
|
|
||||||
import 'checkingInList_state.dart';
|
import 'checkingInList_state.dart';
|
||||||
|
|
||||||
class CheckingInListLogic extends BaseGetXController{
|
class CheckingInListLogic extends BaseGetXController{
|
||||||
CheckingInListState state = CheckingInListState();
|
CheckingInListState state = CheckingInListState();
|
||||||
|
|
||||||
// 开启考勤获取是否有公司
|
// 开启考勤获取是否有公司
|
||||||
void openCheckingInData() async{
|
Future<void> openCheckingInData() async{
|
||||||
var entity = await ApiRepository.to.openCheckingInData(
|
final CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
|
||||||
lockId:state.getKeyInfosData.value.lockId.toString(),
|
lockId:state.getKeyInfosData.value.lockId.toString(),
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
@ -24,16 +27,16 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadDataByType(){
|
void loadDataByType(){
|
||||||
if(state.isDay.value == true && (state.listType.value == "1")){
|
if(state.isDay.value == true && (state.listType.value == '1')){
|
||||||
// 早到日榜
|
// 早到日榜
|
||||||
getCheckInListEarlyArrivalWithDateData();
|
getCheckInListEarlyArrivalWithDateData();
|
||||||
}else if(state.isDay.value == false && (state.listType.value == "1")){
|
}else if(state.isDay.value == false && (state.listType.value == '1')){
|
||||||
// 早到月榜
|
// 早到月榜
|
||||||
getCheckInListEarlyArrivalWithMonthData();
|
getCheckInListEarlyArrivalWithMonthData();
|
||||||
}else if(state.isDay.value == true && (state.listType.value == "2")){
|
}else if(state.isDay.value == true && (state.listType.value == '2')){
|
||||||
// 迟到日榜
|
// 迟到日榜
|
||||||
getCheckInListLateTimesWithDateData();
|
getCheckInListLateTimesWithDateData();
|
||||||
}else if(state.isDay.value == false && (state.listType.value == "2")){
|
}else if(state.isDay.value == false && (state.listType.value == '2')){
|
||||||
// 迟到月榜
|
// 迟到月榜
|
||||||
getCheckInListLateTimesWithMonthData();
|
getCheckInListLateTimesWithMonthData();
|
||||||
}else {
|
}else {
|
||||||
@ -43,8 +46,8 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取考勤信息列表--早到榜(按日期查询)
|
// 获取考勤信息列表--早到榜(按日期查询)
|
||||||
void getCheckInListEarlyArrivalWithDateData() async{
|
Future<void> getCheckInListEarlyArrivalWithDateData() async{
|
||||||
var entity = await ApiRepository.to.getCheckInListEarlyArrivalWithDateData(
|
final CheckingInListDayEntity entity = await ApiRepository.to.getCheckInListEarlyArrivalWithDateData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
||||||
);
|
);
|
||||||
@ -57,8 +60,8 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取考勤信息列表--早到榜(按月榜查询)
|
// 获取考勤信息列表--早到榜(按月榜查询)
|
||||||
void getCheckInListEarlyArrivalWithMonthData() async{
|
Future<void> getCheckInListEarlyArrivalWithMonthData() async{
|
||||||
var entity = await ApiRepository.to.getCheckInListEarlyArrivalWithMonthData(
|
final CheckingInListMonthEntity entity = await ApiRepository.to.getCheckInListEarlyArrivalWithMonthData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
||||||
);
|
);
|
||||||
@ -68,8 +71,8 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取考勤信息列表--迟到榜(按日期查询)
|
// 获取考勤信息列表--迟到榜(按日期查询)
|
||||||
void getCheckInListLateTimesWithDateData() async{
|
Future<void> getCheckInListLateTimesWithDateData() async{
|
||||||
var entity = await ApiRepository.to.getCheckInListLateTimesWithDateData(
|
final CheckingInListDayEntity entity = await ApiRepository.to.getCheckInListLateTimesWithDateData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
||||||
);
|
);
|
||||||
@ -82,8 +85,8 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取考勤信息列表--迟到榜(按月榜查询)
|
// 获取考勤信息列表--迟到榜(按月榜查询)
|
||||||
void getCheckInListLateTimesWithMonthData() async{
|
Future<void> getCheckInListLateTimesWithMonthData() async{
|
||||||
var entity = await ApiRepository.to.getCheckInListLateTimesWithMonthData(
|
final CheckingInListMonthEntity entity = await ApiRepository.to.getCheckInListLateTimesWithMonthData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
||||||
);
|
);
|
||||||
@ -93,11 +96,11 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取考勤信息列表--勤奋榜(按月榜查询)
|
// 获取考勤信息列表--勤奋榜(按月榜查询)
|
||||||
void getCheckInListHardworkingData() async{
|
Future<void> getCheckInListHardworkingData() async{
|
||||||
var entity = await ApiRepository.to.getCheckInListHardworkingData(
|
final CheckingInListMonthEntity entity = await ApiRepository.to.getCheckInListHardworkingData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
attendanceDate:state.checkListDateTimestamp.value.toString(),
|
||||||
type: state.isDay.value == true ? "1" : "2",
|
type: state.isDay.value == true ? '1' : '2',
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
state.checkingInMonthListData.value = entity.data!;
|
state.checkingInMonthListData.value = entity.data!;
|
||||||
@ -106,18 +109,17 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
|
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus.on<RefreshCheckInListEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshCheckInListEvent>().listen((RefreshCheckInListEvent event) {
|
||||||
loadDataByType();
|
loadDataByType();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onReady() async {
|
Future<void> onReady() async {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 获取是否是演示模式 演示模式不获取接口
|
// 获取是否是演示模式 演示模式不获取接口
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if(isDemoMode == false){
|
if(isDemoMode == false){
|
||||||
_initLoadDataAction();
|
_initLoadDataAction();
|
||||||
|
|
||||||
@ -125,16 +127,8 @@ class CheckingInListLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import '../../../../tools/storage.dart';
|
|||||||
import '../../../../tools/titleAppBar.dart';
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
import 'checkingInListDay_entity.dart';
|
import 'checkingInListDay_entity.dart';
|
||||||
|
import 'checkingInListSeletMonth_page.dart';
|
||||||
import 'checkingInList_logic.dart';
|
import 'checkingInList_logic.dart';
|
||||||
|
|
||||||
class CheckingInListPage extends StatefulWidget {
|
class CheckingInListPage extends StatefulWidget {
|
||||||
@ -51,7 +52,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast('演示模式');
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
@ -122,7 +123,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast('演示模式');
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -205,28 +206,26 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final bool? isDemoMode =
|
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
await Storage.getBool(ifIsDemoModeOrNot);
|
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowCalendar(
|
// if(state.isDay.value){
|
||||||
datePickerMode: DatePickerMode.day,
|
return ShowCalendar(
|
||||||
selectAction: (DateTime dateTime) {
|
datePickerMode: DatePickerMode.day,
|
||||||
setState(() {
|
selectAction: (DateTime dateTime) {
|
||||||
state.checkListDateTimestamp.value =
|
setState(() {
|
||||||
dateTime.millisecondsSinceEpoch;
|
state.checkListDateTimestamp.value = dateTime.millisecondsSinceEpoch;
|
||||||
final String beginDate = formatDate(
|
final String beginDate = formatDate(dateTime, state.isDay.value ? <String>[mm, '-', dd] : <String>[mm]);
|
||||||
dateTime,
|
state.checkListDate.value = beginDate;
|
||||||
state.isDay.value
|
logic.loadDataByType();
|
||||||
? <String>[mm, '-', dd]
|
Get.back();
|
||||||
: <String>[mm]);
|
});
|
||||||
state.checkListDate.value = beginDate;
|
|
||||||
logic.loadDataByType();
|
|
||||||
Get.back();
|
|
||||||
});
|
});
|
||||||
});
|
// }else{
|
||||||
|
// return CheckingInListSeletMonthPage();
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
@ -485,7 +484,7 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
showListType();
|
showListType();
|
||||||
} else {
|
} else {
|
||||||
// Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.selectLockTypePage);
|
||||||
logic.showToast('演示模式');
|
logic.showToast('演示模式'.tr);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Obx(() => Container(
|
child: Obx(() => Container(
|
||||||
@ -561,11 +560,11 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
|
|||||||
|
|
||||||
String getTopTitle() {
|
String getTopTitle() {
|
||||||
if (state.listType.value == '1') {
|
if (state.listType.value == '1') {
|
||||||
return '无考勤记录';
|
return '无考勤记录'.tr;
|
||||||
} else if (state.listType.value == '2') {
|
} else if (state.listType.value == '2') {
|
||||||
return '大家干劲十足';
|
return '大家干劲十足'.tr;
|
||||||
} else {
|
} else {
|
||||||
return '工作时长未出炉';
|
return '工作时长未出炉'.tr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,24 +7,24 @@ import '../../../lockMian/entity/lockListInfo_entity.dart';
|
|||||||
import 'checkingInListDay_entity.dart';
|
import 'checkingInListDay_entity.dart';
|
||||||
import 'checkingInListMonth_entity.dart';
|
import 'checkingInListMonth_entity.dart';
|
||||||
|
|
||||||
class CheckingInListState{
|
class CheckingInListState{// 未打车
|
||||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
|
||||||
final companyId = "".obs;
|
|
||||||
|
|
||||||
final listType = "1".obs;// 1早到榜 2迟到榜 3勤奋榜
|
|
||||||
final listTypeStr = TranslationLoader.lanKeys!.earlyArrivalList!.tr.obs;// 1早到榜 2迟到榜 3勤奋榜
|
|
||||||
final isDay = true.obs;// 日榜还是月榜
|
|
||||||
final checkListDateTimestamp = DateTime.now().millisecondsSinceEpoch.obs;// 查询日期时间戳
|
|
||||||
final checkListDate = formatDate(DateTime.now(), [mm,'-',dd]).obs;// 查询日期
|
|
||||||
|
|
||||||
final checkingInDayListData = <AttendanceRecordDayList>[].obs;
|
|
||||||
final checkingInMonthListData = <AttendanceRecordMonthList>[].obs;
|
|
||||||
|
|
||||||
var lateTimes = "".obs;// 迟到
|
|
||||||
var earlyTimes = "".obs;// 早退
|
|
||||||
var noPunchTimes = "".obs;// 未打车
|
|
||||||
|
|
||||||
CheckingInListState() {
|
CheckingInListState() {
|
||||||
getKeyInfosData.value = Get.arguments as LockListInfoItemEntity;
|
getKeyInfosData.value = Get.arguments as LockListInfoItemEntity;
|
||||||
}
|
}
|
||||||
|
final Rx<LockListInfoItemEntity> getKeyInfosData = LockListInfoItemEntity().obs;
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
|
||||||
|
final RxString listType = '1'.obs;// 1早到榜 2迟到榜 3勤奋榜
|
||||||
|
final RxString listTypeStr = TranslationLoader.lanKeys!.earlyArrivalList!.tr.obs;// 1早到榜 2迟到榜 3勤奋榜
|
||||||
|
final RxBool isDay = true.obs;// 日榜还是月榜
|
||||||
|
final RxInt checkListDateTimestamp = DateTime.now().millisecondsSinceEpoch.obs;// 查询日期时间戳
|
||||||
|
final RxString checkListDate = formatDate(DateTime.now(), <String>[mm,'-',dd]).obs;// 查询日期
|
||||||
|
|
||||||
|
final RxList<AttendanceRecordDayList> checkingInDayListData = <AttendanceRecordDayList>[].obs;
|
||||||
|
final RxList<AttendanceRecordMonthList> checkingInMonthListData = <AttendanceRecordMonthList>[].obs;
|
||||||
|
|
||||||
|
RxString lateTimes = ''.obs;// 迟到
|
||||||
|
RxString earlyTimes = ''.obs;// 早退
|
||||||
|
RxString noPunchTimes = ''.obs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
|
|
||||||
class CheckingInSetEntity {
|
class CheckingInSetEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
CheckingInSetInfo? data;
|
|
||||||
|
|
||||||
CheckingInSetEntity(
|
CheckingInSetEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -14,6 +10,10 @@ class CheckingInSetEntity {
|
|||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
data = json['data'] != null ? CheckingInSetInfo.fromJson(json['data']) : null;
|
data = json['data'] != null ? CheckingInSetInfo.fromJson(json['data']) : null;
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
CheckingInSetInfo? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -28,13 +28,6 @@ class CheckingInSetEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CheckingInSetInfo {
|
class CheckingInSetInfo {
|
||||||
int? staffNum;
|
|
||||||
int? workEndTime;
|
|
||||||
int? attendanceType;
|
|
||||||
int? companyId;
|
|
||||||
String? companyName;
|
|
||||||
int? workStartTime;
|
|
||||||
List<int>? workDay;
|
|
||||||
|
|
||||||
CheckingInSetInfo(
|
CheckingInSetInfo(
|
||||||
{this.staffNum,
|
{this.staffNum,
|
||||||
@ -54,6 +47,13 @@ class CheckingInSetInfo {
|
|||||||
workStartTime = json['workStartTime'];
|
workStartTime = json['workStartTime'];
|
||||||
workDay = json['workDay'].cast<int>();
|
workDay = json['workDay'].cast<int>();
|
||||||
}
|
}
|
||||||
|
int? staffNum;
|
||||||
|
int? workEndTime;
|
||||||
|
int? attendanceType;
|
||||||
|
int? companyId;
|
||||||
|
String? companyName;
|
||||||
|
int? workStartTime;
|
||||||
|
List<int>? workDay;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.tr}",
|
'${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.tr}',
|
||||||
rightTitle: (state.beginTime.value.isNotEmpty) ? '${state.beginTime.value} - ${state.endTime.value}' : '',
|
rightTitle: (state.beginTime.value.isNotEmpty) ? '${state.beginTime.value} - ${state.endTime.value}' : '',
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
@ -78,7 +78,7 @@ class _CheckingInSetPageState extends State<CheckingInSetPage> {
|
|||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel:
|
leftTitel:
|
||||||
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}",
|
'${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.tr}',
|
||||||
rightTitle: state.isCustom.value == true ? state.weekDaysStr.value : (state.weekDays.value.length == 6 ? '单休' : '双休'),
|
rightTitle: state.isCustom.value == true ? state.weekDaysStr.value : (state.weekDays.value.length == 6 ? '单休' : '双休'),
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
|||||||
@ -9,19 +9,19 @@ class CheckingInSetWorkTimeLogic extends BaseGetXController{
|
|||||||
CheckingInSetWorkTimeState state = CheckingInSetWorkTimeState();
|
CheckingInSetWorkTimeState state = CheckingInSetWorkTimeState();
|
||||||
|
|
||||||
// 编辑考勤设置信息
|
// 编辑考勤设置信息
|
||||||
void editCheckInSetInfoData() async{
|
Future<void> editCheckInSetInfoData() async{
|
||||||
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
||||||
attendanceType: state.checkingInSetInfo.value.attendanceType.toString(),
|
attendanceType: state.checkingInSetInfo.value.attendanceType.toString(),
|
||||||
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
||||||
type: "2",
|
type: '2',
|
||||||
companyName: state.checkingInSetInfo.value.companyName ?? "",
|
companyName: state.checkingInSetInfo.value.companyName ?? '',
|
||||||
workEndTime: state.endTimeTimestamp.value.toString(),
|
workEndTime: state.endTimeTimestamp.value.toString(),
|
||||||
workStartTime: state.beginTimeTimestamp.value.toString(),
|
workStartTime: state.beginTimeTimestamp.value.toString(),
|
||||||
workDay:state.checkingInSetInfo.value.workDay!,
|
workDay:state.checkingInSetInfo.value.workDay!,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功", something: (){
|
showToast('修改成功', something: (){
|
||||||
Get.back(result: "scuess");
|
Get.back(result: 'scuess');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_state.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||||
@ -22,8 +23,8 @@ class CheckingInSetWorkTimePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
||||||
final logic = Get.put(CheckingInSetWorkTimeLogic());
|
final CheckingInSetWorkTimeLogic logic = Get.put(CheckingInSetWorkTimeLogic());
|
||||||
final state = Get.find<CheckingInSetWorkTimeLogic>().state;
|
final CheckingInSetWorkTimeState state = Get.find<CheckingInSetWorkTimeLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -31,7 +32,7 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle:
|
barTitle:
|
||||||
"${TranslationLoader.lanKeys!.work!.tr} ${TranslationLoader.lanKeys!.time!.tr} ${TranslationLoader.lanKeys!.set!.tr}",
|
'${TranslationLoader.lanKeys!.work!.tr} ${TranslationLoader.lanKeys!.time!.tr} ${TranslationLoader.lanKeys!.set!.tr}',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: buildMainUI(),
|
body: buildMainUI(),
|
||||||
@ -40,16 +41,16 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
|
|
||||||
Widget buildMainUI() {
|
Widget buildMainUI() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.officeHours!.tr,
|
leftTitel: TranslationLoader.lanKeys!.officeHours!.tr,
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.beginTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.beginTime.value, 0));
|
final PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.beginTime.value, 0));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) {
|
selectDate: selectDate, mode: DateMode.HM, onConfirm: (PDuration p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 3);
|
state.beginTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
state.beginTimeTimestamp.value = DateTool()
|
state.beginTimeTimestamp.value = DateTool()
|
||||||
@ -63,9 +64,9 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
rightTitle: state.endTime.value,
|
rightTitle: state.endTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
|
final PDuration selectDate = PDuration.parse(DateTool().dateToDateTime(state.endTime.value, 0));
|
||||||
Pickers.showDatePicker(context,
|
Pickers.showDatePicker(context,
|
||||||
selectDate: selectDate, mode: DateMode.HM, onConfirm: (p) {
|
selectDate: selectDate, mode: DateMode.HM, onConfirm: (PDuration p) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
state.endTime.value = DateTool().getYMDHNDateString(p, 3);
|
||||||
state.endTimeTimestamp.value = DateTool()
|
state.endTimeTimestamp.value = DateTool()
|
||||||
@ -85,28 +86,28 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
if (state.beginTimeTimestamp.value.isEmpty) {
|
if (state.beginTimeTimestamp.value.isEmpty) {
|
||||||
logic.showToast("请选择开始时间");
|
logic.showToast('请选择开始时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.endTimeTimestamp.value.isEmpty) {
|
if (state.endTimeTimestamp.value.isEmpty) {
|
||||||
logic.showToast("请选择结束时间");
|
logic.showToast('请选择结束时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (int.parse(state.beginTimeTimestamp.value) >=
|
if (int.parse(state.beginTimeTimestamp.value) >=
|
||||||
int.parse(state.endTimeTimestamp.value)) {
|
int.parse(state.endTimeTimestamp.value)) {
|
||||||
logic.showToast("结束时间必须要比开始时间晚,请重新选择");
|
logic.showToast('结束时间必须要比开始时间晚,请重新选择');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (state.pushType.value == "2") {
|
if (state.pushType.value == '2') {
|
||||||
logic.editCheckInSetInfoData();
|
logic.editCheckInSetInfoData();
|
||||||
} else {
|
} else {
|
||||||
Get.back(result: {
|
Get.back(result: <String, String>{
|
||||||
"beginTime": state.beginTime.value,
|
'beginTime': state.beginTime.value,
|
||||||
"beginTimeTimestamp": state.beginTimeTimestamp.value,
|
'beginTimeTimestamp': state.beginTimeTimestamp.value,
|
||||||
"endTime": state.endTime.value,
|
'endTime': state.endTime.value,
|
||||||
"endTimeTimestamp": state.endTimeTimestamp.value,
|
'endTimeTimestamp': state.endTimeTimestamp.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -116,8 +117,8 @@ class _CheckingInSetWorkTimePageState extends State<CheckingInSetWorkTimePage> {
|
|||||||
|
|
||||||
String getNowDate() {
|
String getNowDate() {
|
||||||
// 获取当前时间对象
|
// 获取当前时间对象
|
||||||
DateTime today = DateTime.now();
|
final DateTime today = DateTime.now();
|
||||||
String dateSlug =
|
final String dateSlug =
|
||||||
"${today.hour.toString().padLeft(2, '0')}:${today.minute.toString().padLeft(2, '0')}";
|
"${today.hour.toString().padLeft(2, '0')}:${today.minute.toString().padLeft(2, '0')}";
|
||||||
|
|
||||||
// //获取当前时间的年
|
// //获取当前时间的年
|
||||||
|
|||||||
@ -4,25 +4,15 @@ import '../../../../tools/dateTool.dart';
|
|||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../checkingInSet/checkingInSet_entity.dart';
|
import '../checkingInSet/checkingInSet_entity.dart';
|
||||||
|
|
||||||
class CheckingInSetWorkTimeState{
|
class CheckingInSetWorkTimeState{// 2考勤设置信息选择时间
|
||||||
// final getKeyInfosData = LockListInfoItemEntity().obs;
|
|
||||||
final checkingInSetInfo = CheckingInSetInfo().obs;
|
|
||||||
final companyId = "".obs;
|
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
|
||||||
var endTime = "".obs;// 结束时间
|
|
||||||
var beginTimeTimestamp = "".obs;// 开始时间时间戳
|
|
||||||
var endTimeTimestamp = "".obs;// 结束时间时间戳
|
|
||||||
|
|
||||||
var pushType = "".obs;// 2考勤设置信息选择时间
|
|
||||||
|
|
||||||
CheckingInSetWorkTimeState() {
|
CheckingInSetWorkTimeState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
pushType.value = map["pushType"];
|
pushType.value = map['pushType'];
|
||||||
// getKeyInfosData.value = map["getKeyInfosData"];
|
// getKeyInfosData.value = map["getKeyInfosData"];
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
checkingInSetInfo.value = map["checkingInSetInfo"];
|
checkingInSetInfo.value = map['checkingInSetInfo'];
|
||||||
if(pushType.value != "0"){
|
if(pushType.value != '0'){
|
||||||
beginTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workStartTime.toString());
|
beginTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workStartTime.toString());
|
||||||
endTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workEndTime.toString());
|
endTime.value = DateTool().dateToHNString(checkingInSetInfo.value.workEndTime.toString());
|
||||||
beginTimeTimestamp.value = checkingInSetInfo.value.workStartTime.toString();
|
beginTimeTimestamp.value = checkingInSetInfo.value.workStartTime.toString();
|
||||||
@ -30,5 +20,14 @@ class CheckingInSetWorkTimeState{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// final getKeyInfosData = LockListInfoItemEntity().obs;
|
||||||
|
final Rx<CheckingInSetInfo> checkingInSetInfo = CheckingInSetInfo().obs;
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
|
||||||
|
RxString beginTime = ''.obs;// 开始时间
|
||||||
|
RxString endTime = ''.obs;// 结束时间
|
||||||
|
RxString beginTimeTimestamp = ''.obs;// 开始时间时间戳
|
||||||
|
RxString endTimeTimestamp = ''.obs;// 结束时间时间戳
|
||||||
|
|
||||||
|
RxString pushType = ''.obs;
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../network/api_repository.dart';
|
import '../../../../network/api_repository.dart';
|
||||||
@ -9,22 +10,22 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|||||||
CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState();
|
CheckingInSetWorkdaySetState state = CheckingInSetWorkdaySetState();
|
||||||
|
|
||||||
// 编辑考勤设置信息
|
// 编辑考勤设置信息
|
||||||
void editCheckInSetInfoData() async{
|
Future<void> editCheckInSetInfoData() async{
|
||||||
var entity = await ApiRepository.to.editCheckInSetInfoData(
|
final LoginEntity entity = await ApiRepository.to.editCheckInSetInfoData(
|
||||||
attendanceType: (state.isCustom.value == true) ? "0" : "1",
|
attendanceType: (state.isCustom.value == true) ? '0' : '1',
|
||||||
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
companyId: state.checkingInSetInfo.value.companyId.toString(),
|
||||||
type: (state.isCustom.value == true) ? "3" : "4",
|
type: (state.isCustom.value == true) ? '3' : '4',
|
||||||
companyName: state.checkingInSetInfo.value.companyName ?? "",
|
companyName: state.checkingInSetInfo.value.companyName ?? '',
|
||||||
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
workEndTime: state.checkingInSetInfo.value.workEndTime.toString(),
|
||||||
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
workStartTime: state.checkingInSetInfo.value.workStartTime.toString(),
|
||||||
workDay:state.weekDays.value,
|
workDay:state.weekDays.value,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
showToast("修改成功", something: (){
|
showToast('修改成功', something: (){
|
||||||
eventBus.fire(RefreshCheckInSetDataEvent());
|
eventBus.fire(RefreshCheckInSetDataEvent());
|
||||||
Get.back(result: {
|
Get.back(result: <String, Object>{
|
||||||
"attendanceType":state.isCustom.value,
|
'attendanceType':state.isCustom.value,
|
||||||
"weekDays":state.weekDays.value,
|
'weekDays':state.weekDays.value,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -32,18 +33,17 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
Map map = Get.arguments;
|
final Map map = Get.arguments;
|
||||||
state.pushType.value = map["pushType"];
|
state.pushType.value = map['pushType'];
|
||||||
if(state.pushType.value == "2"){
|
if(state.pushType.value == '2'){
|
||||||
state.getKeyInfosData.value = map["getKeyInfosData"];
|
state.getKeyInfosData.value = map['getKeyInfosData'];
|
||||||
state.companyId.value = map["companyId"];
|
state.companyId.value = map['companyId'];
|
||||||
state.checkingInSetInfo.value = map["checkingInSetInfo"];
|
state.checkingInSetInfo.value = map['checkingInSetInfo'];
|
||||||
|
|
||||||
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
state.weekDays.value = state.checkingInSetInfo.value.workDay!;
|
||||||
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
state.isCustom.value = (state.checkingInSetInfo.value.attendanceType! == 0);
|
||||||
if(state.isCustom.value == false){
|
if(state.isCustom.value == false){
|
||||||
if(state.checkingInSetInfo.value.workDay!.length == 5){
|
if(state.checkingInSetInfo.value.workDay!.length == 5){
|
||||||
state.isSingledayWeekend.value = 1;
|
state.isSingledayWeekend.value = 1;
|
||||||
@ -56,14 +56,12 @@ class CheckingInSetWorkdaySetLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
// _teamEvent.cancel();
|
// _teamEvent.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_state.dart';
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
@ -18,8 +19,8 @@ class CheckingInSetWorkdaySet extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
||||||
final logic = Get.put(CheckingInSetWorkdaySetLogic());
|
final CheckingInSetWorkdaySetLogic logic = Get.put(CheckingInSetWorkdaySetLogic());
|
||||||
final state = Get.find<CheckingInSetWorkdaySetLogic>().state;
|
final CheckingInSetWorkdaySetState state = Get.find<CheckingInSetWorkdaySetLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -27,11 +28,11 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle:
|
barTitle:
|
||||||
"${TranslationLoader.lanKeys!.workday!.tr} ${TranslationLoader.lanKeys!.set!.tr}",
|
'${TranslationLoader.lanKeys!.workday!.tr} ${TranslationLoader.lanKeys!.set!.tr}',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: <Widget>[
|
||||||
topBtnWidget(),
|
topBtnWidget(),
|
||||||
Obx(() => Visibility(visible: state.isCustom.value, child: bottomCustomSelectBtn())),
|
Obx(() => Visibility(visible: state.isCustom.value, child: bottomCustomSelectBtn())),
|
||||||
Obx(() => Visibility(visible: !state.isCustom.value, child: bottomOddOrEvenDaysOffSelectBtn())),
|
Obx(() => Visibility(visible: !state.isCustom.value, child: bottomOddOrEvenDaysOffSelectBtn())),
|
||||||
@ -39,12 +40,12 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
child: SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {
|
child: SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () {
|
||||||
if(state.pushType.value == "2"){
|
if(state.pushType.value == '2'){
|
||||||
logic.editCheckInSetInfoData();
|
logic.editCheckInSetInfoData();
|
||||||
}else{
|
}else{
|
||||||
Get.back(result: {
|
Get.back(result: <String, Object>{
|
||||||
"attendanceType":state.isCustom.value,
|
'attendanceType':state.isCustom.value,
|
||||||
"weekDays":state.weekDays.value,
|
'weekDays':state.weekDays.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
padding: EdgeInsets.all(10.w),
|
padding: EdgeInsets.all(10.w),
|
||||||
child: Obx(() => Row(
|
child: Obx(() => Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: (){
|
onTap: (){
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -76,7 +77,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
color: state.isCustom.value ? AppColors.mainColor : AppColors.btnDisableColor,
|
color: state.isCustom.value ? AppColors.mainColor : AppColors.btnDisableColor,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Center(child: Text(TranslationLoader.lanKeys!.custom!.tr, style: TextStyle(fontSize: 26.sp, color: Colors.white))),
|
Center(child: Text(TranslationLoader.lanKeys!.custom!.tr, style: TextStyle(fontSize: 26.sp, color: Colors.white))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -96,7 +97,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
padding: EdgeInsets.all(10.w),
|
padding: EdgeInsets.all(10.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -117,44 +118,44 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(left: 10.w, right: 10.w),
|
padding: EdgeInsets.only(left: 10.w, right: 10.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.thisWeek!.tr,
|
leftTitel: TranslationLoader.lanKeys!.thisWeek!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
allHeight: 60.h,
|
allHeight: 60.h,
|
||||||
isHaveLine: true),
|
isHaveLine: true),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.singleDayWeekend!.tr,
|
leftTitel: TranslationLoader.lanKeys!.singleDayWeekend!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
allHeight: 60.h,
|
allHeight: 60.h,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
action: (){
|
action: (){
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isSingledayWeekend.value = 0;
|
state.isSingledayWeekend.value = 0;
|
||||||
state.weekDays.value = [1, 2 , 3, 4, 5, 6];
|
state.weekDays.value = <int>[1, 2 , 3, 4, 5, 6];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
Image.asset(state.isSingledayWeekend.value == 0 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
)),
|
)),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.twoDaysOff!.tr,
|
leftTitel: TranslationLoader.lanKeys!.twoDaysOff!.tr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
allHeight: 60.h,
|
allHeight: 60.h,
|
||||||
isHaveLine: false,
|
isHaveLine: false,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
action: (){
|
action: (){
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isSingledayWeekend.value = 1;
|
state.isSingledayWeekend.value = 1;
|
||||||
state.weekDays.value = [1, 2 , 3, 4, 5];
|
state.weekDays.value = <int>[1, 2 , 3, 4, 5];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
Image.asset(state.isSingledayWeekend.value == 1 ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -171,7 +172,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: 7,
|
itemCount: 7,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (BuildContext c, int index) {
|
||||||
index += 1;
|
index += 1;
|
||||||
String dateStr;
|
String dateStr;
|
||||||
switch (index) {
|
switch (index) {
|
||||||
@ -197,12 +198,12 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
dateStr = TranslationLoader.lanKeys!.sunday!.tr;
|
dateStr = TranslationLoader.lanKeys!.sunday!.tr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dateStr = "";
|
dateStr = '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return Obx(() => CommonItem(
|
return Obx(() => CommonItem(
|
||||||
leftTitel: dateStr,
|
leftTitel: dateStr,
|
||||||
rightTitle: "",
|
rightTitle: '',
|
||||||
allHeight: 60.h,
|
allHeight: 60.h,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
@ -218,7 +219,7 @@ class _CheckingInSetWorkdaySetState extends State<CheckingInSetWorkdaySet> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
rightWidget: Row(
|
rightWidget: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
Image.asset(state.weekDays.value.contains(index) ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', width: 30.w, height: 30.w,),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,29 +3,18 @@ import 'package:get/get.dart';
|
|||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
import '../checkingInSet/checkingInSet_entity.dart';
|
import '../checkingInSet/checkingInSet_entity.dart';
|
||||||
|
|
||||||
class CheckingInSetWorkdaySetState{
|
class CheckingInSetWorkdaySetState{// 2考勤设置信息 1考勤创建公司
|
||||||
var isCustom = true.obs; // 自定义
|
|
||||||
var isSingledayWeekend = 2.obs; // 0单休 1双休
|
|
||||||
var weekDays = <int>[].obs;// 工作天数
|
|
||||||
|
|
||||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
|
||||||
final checkingInSetInfo = CheckingInSetInfo().obs;
|
|
||||||
final companyId = "".obs;
|
|
||||||
|
|
||||||
// var changeType = "3".obs;// 3修改workDay自定义 4修改workDay
|
|
||||||
|
|
||||||
var pushType = "".obs;// 2考勤设置信息 1考勤创建公司
|
|
||||||
|
|
||||||
CheckingInSetWorkdaySetState() {
|
CheckingInSetWorkdaySetState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
pushType.value = map["pushType"];
|
pushType.value = map['pushType'];
|
||||||
if(pushType.value == "2"){
|
if(pushType.value == '2'){
|
||||||
getKeyInfosData.value = map["getKeyInfosData"];
|
getKeyInfosData.value = map['getKeyInfosData'];
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
checkingInSetInfo.value = map["checkingInSetInfo"];
|
checkingInSetInfo.value = map['checkingInSetInfo'];
|
||||||
|
|
||||||
weekDays.value = checkingInSetInfo.value.workDay!;
|
weekDays.value = checkingInSetInfo.value.workDay!;
|
||||||
isCustom.value = (checkingInSetInfo.value.attendanceType! == 0) ? true : false;
|
isCustom.value = (checkingInSetInfo.value.attendanceType! == 0);
|
||||||
if(isCustom.value == false){
|
if(isCustom.value == false){
|
||||||
if(checkingInSetInfo.value.workDay!.length == 5){
|
if(checkingInSetInfo.value.workDay!.length == 5){
|
||||||
isSingledayWeekend.value = 1;
|
isSingledayWeekend.value = 1;
|
||||||
@ -35,4 +24,15 @@ class CheckingInSetWorkdaySetState{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RxBool isCustom = true.obs; // 自定义
|
||||||
|
RxInt isSingledayWeekend = 2.obs; // 0单休 1双休
|
||||||
|
RxList<int> weekDays = <int>[].obs;// 工作天数
|
||||||
|
|
||||||
|
final Rx<LockListInfoItemEntity> getKeyInfosData = LockListInfoItemEntity().obs;
|
||||||
|
final Rx<CheckingInSetInfo> checkingInSetInfo = CheckingInSetInfo().obs;
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
|
||||||
|
// var changeType = "3".obs;// 3修改workDay自定义 4修改workDay
|
||||||
|
|
||||||
|
RxString pushType = ''.obs;
|
||||||
}
|
}
|
||||||
@ -1,9 +1,5 @@
|
|||||||
|
|
||||||
class CheckingInAddStaffSelectKeyEntity {
|
class CheckingInAddStaffSelectKeyEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
List<CheckingInAddStaffKeyEntity>? data;
|
|
||||||
|
|
||||||
CheckingInAddStaffSelectKeyEntity(
|
CheckingInAddStaffSelectKeyEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -19,6 +15,10 @@ class CheckingInAddStaffSelectKeyEntity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<CheckingInAddStaffKeyEntity>? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -33,8 +33,6 @@ class CheckingInAddStaffSelectKeyEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CheckingInAddStaffKeyEntity {
|
class CheckingInAddStaffKeyEntity {
|
||||||
String? attendanceWay;
|
|
||||||
String? staffName;
|
|
||||||
|
|
||||||
CheckingInAddStaffKeyEntity({this.attendanceWay, this.staffName});
|
CheckingInAddStaffKeyEntity({this.attendanceWay, this.staffName});
|
||||||
|
|
||||||
@ -42,6 +40,8 @@ class CheckingInAddStaffKeyEntity {
|
|||||||
attendanceWay = json['attendanceWay'];
|
attendanceWay = json['attendanceWay'];
|
||||||
staffName = json['staffName'];
|
staffName = json['staffName'];
|
||||||
}
|
}
|
||||||
|
String? attendanceWay;
|
||||||
|
String? staffName;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
class CheckingInAddStaffListEntity {
|
class CheckingInAddStaffListEntity {
|
||||||
int? errorCode;
|
|
||||||
String? description;
|
|
||||||
String? errorMsg;
|
|
||||||
List<CheckingInAddStaffListItemEntity>? data;
|
|
||||||
|
|
||||||
CheckingInAddStaffListEntity(
|
CheckingInAddStaffListEntity(
|
||||||
{this.errorCode, this.description, this.errorMsg, this.data});
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
@ -18,6 +14,10 @@ class CheckingInAddStaffListEntity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<CheckingInAddStaffListItemEntity>? data;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@ -32,14 +32,6 @@ class CheckingInAddStaffListEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CheckingInAddStaffListItemEntity {
|
class CheckingInAddStaffListItemEntity {
|
||||||
String? headurl;
|
|
||||||
String? staffName;
|
|
||||||
int? staffId;
|
|
||||||
int? attendanceType;
|
|
||||||
int? countryCode;
|
|
||||||
int? cardStatus;//0正常 1打卡失败
|
|
||||||
String? attendanceWay;
|
|
||||||
String? reason;
|
|
||||||
|
|
||||||
CheckingInAddStaffListItemEntity(
|
CheckingInAddStaffListItemEntity(
|
||||||
{this.headurl,
|
{this.headurl,
|
||||||
@ -61,6 +53,14 @@ class CheckingInAddStaffListItemEntity {
|
|||||||
attendanceWay = json['attendanceWay'];
|
attendanceWay = json['attendanceWay'];
|
||||||
reason = json['reason'];
|
reason = json['reason'];
|
||||||
}
|
}
|
||||||
|
String? headurl;
|
||||||
|
String? staffName;
|
||||||
|
int? staffId;
|
||||||
|
int? attendanceType;
|
||||||
|
int? countryCode;
|
||||||
|
int? cardStatus;//0正常 1打卡失败
|
||||||
|
String? attendanceWay;
|
||||||
|
String? reason;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import '../../../../../network/api_repository.dart';
|
import '../../../../../network/api_repository.dart';
|
||||||
import '../../../../../tools/eventBusEventManage.dart';
|
import '../../../../../tools/eventBusEventManage.dart';
|
||||||
@ -10,8 +12,8 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
|||||||
CheckingInStaffManageState state = CheckingInStaffManageState();
|
CheckingInStaffManageState state = CheckingInStaffManageState();
|
||||||
|
|
||||||
// 获取员工列表
|
// 获取员工列表
|
||||||
void getStaffList() async{
|
Future<void> getStaffList() async{
|
||||||
var entity = await ApiRepository.to.getStaffListData(
|
final CheckingInAddStaffListEntity entity = await ApiRepository.to.getStaffListData(
|
||||||
companyId: state.companyId.value,
|
companyId: state.companyId.value,
|
||||||
lockId:state.getKeyInfosData.value.lockId.toString(),
|
lockId:state.getKeyInfosData.value.lockId.toString(),
|
||||||
);
|
);
|
||||||
@ -21,8 +23,8 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除员工
|
// 删除员工
|
||||||
void deletStaff(int staffId, int deleteKey) async{
|
Future<void> deletStaff(int staffId, int deleteKey) async{
|
||||||
var entity = await ApiRepository.to.deletStaffData(
|
final LoginEntity entity = await ApiRepository.to.deletStaffData(
|
||||||
lockId: state.getKeyInfosData.value.lockId!,
|
lockId: state.getKeyInfosData.value.lockId!,
|
||||||
staffId:staffId,
|
staffId:staffId,
|
||||||
deleteKey:deleteKey
|
deleteKey:deleteKey
|
||||||
@ -34,14 +36,13 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
|||||||
|
|
||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus.on<RefreshCheckInStaffListDataEvent>().listen((event) {
|
_teamEvent = eventBus.on<RefreshCheckInStaffListDataEvent>().listen((RefreshCheckInStaffListDataEvent event) {
|
||||||
getStaffList();
|
getStaffList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
getStaffList();
|
getStaffList();
|
||||||
@ -51,14 +52,12 @@ class CheckingInStaffManageLogic extends BaseGetXController{
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
_teamEvent.cancel();
|
_teamEvent.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
@ -8,9 +9,7 @@ import 'package:star_lock/tools/showTipView.dart';
|
|||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/customNetworkImage.dart';
|
|
||||||
import '../../../../../tools/noData.dart';
|
import '../../../../../tools/noData.dart';
|
||||||
import '../../../../../tools/showIosTipView.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../../translations/trans_lib.dart';
|
import '../../../../../translations/trans_lib.dart';
|
||||||
import 'checkingInStaffList_entity.dart';
|
import 'checkingInStaffList_entity.dart';
|
||||||
@ -238,22 +237,4 @@ class _CheckingInStaffListPageState extends State<CheckingInStaffListPage> {
|
|||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void showIosTipViewDialog(int staffId, BuildContext context) {
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return ShowIosTipView(
|
|
||||||
// title: "提示",
|
|
||||||
// tipTitle: "确定要删除员工吗?",
|
|
||||||
// sureClick: () async {
|
|
||||||
// Get.back();
|
|
||||||
// logic.deletStaff(staffId, 0);
|
|
||||||
// },
|
|
||||||
// cancelClick: () {
|
|
||||||
// Get.back();
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,15 +5,13 @@ import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
|||||||
import 'checkingInStaffList_entity.dart';
|
import 'checkingInStaffList_entity.dart';
|
||||||
|
|
||||||
class CheckingInStaffManageState{
|
class CheckingInStaffManageState{
|
||||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
|
||||||
final companyId = "".obs;
|
|
||||||
|
|
||||||
final staffListData = <CheckingInAddStaffListItemEntity>[].obs;
|
|
||||||
|
|
||||||
CheckingInStaffManageState() {
|
CheckingInStaffManageState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
getKeyInfosData.value = map["getKeyInfosData"];
|
getKeyInfosData.value = map['getKeyInfosData'];
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
}
|
}
|
||||||
|
final Rx<LockListInfoItemEntity> getKeyInfosData = LockListInfoItemEntity().obs;
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
|
||||||
|
final RxList<CheckingInAddStaffListItemEntity> staffListData = <CheckingInAddStaffListItemEntity>[].obs;
|
||||||
}
|
}
|
||||||
@ -5,32 +5,32 @@ import '../../../../lockMian/entity/lockListInfo_entity.dart';
|
|||||||
import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
|
import '../checkingInSetStaffList/checkingInStaffList_entity.dart';
|
||||||
|
|
||||||
class CheckingInStaffDetailState{
|
class CheckingInStaffDetailState{
|
||||||
final getKeyInfosData = LockListInfoItemEntity().obs;
|
|
||||||
final companyId = "".obs;
|
|
||||||
|
|
||||||
final staffListItemData = CheckingInAddStaffListItemEntity().obs;
|
|
||||||
|
|
||||||
var attendanceType = "".obs;
|
|
||||||
|
|
||||||
CheckingInStaffDetailState() {
|
CheckingInStaffDetailState() {
|
||||||
Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
staffListItemData.value = map["staffListItem"];
|
staffListItemData.value = map['staffListItem'];
|
||||||
getKeyInfosData.value = map["getKeyInfosData"];
|
getKeyInfosData.value = map['getKeyInfosData'];
|
||||||
companyId.value = map["companyId"];
|
companyId.value = map['companyId'];
|
||||||
|
|
||||||
switch(staffListItemData.value.attendanceType){
|
switch(staffListItemData.value.attendanceType){
|
||||||
case 1:
|
case 1:
|
||||||
attendanceType.value = "APP";
|
attendanceType.value = 'APP';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
attendanceType.value = "密码".tr;
|
attendanceType.value = '密码'.tr;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
attendanceType.value = "卡".tr;
|
attendanceType.value = '卡'.tr;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
attendanceType.value = "指纹".tr;
|
attendanceType.value = '指纹'.tr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final Rx<LockListInfoItemEntity> getKeyInfosData = LockListInfoItemEntity().obs;
|
||||||
|
final RxString companyId = ''.obs;
|
||||||
|
|
||||||
|
final Rx<CheckingInAddStaffListItemEntity> staffListItemData = CheckingInAddStaffListItemEntity().obs;
|
||||||
|
|
||||||
|
RxString attendanceType = ''.obs;
|
||||||
}
|
}
|
||||||
@ -348,17 +348,20 @@ class LockDetailLogic extends BaseGetXController {
|
|||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
Future<void> getServerDatetime() async {
|
Future<void> getServerDatetime() async {
|
||||||
final GetServerDatetimeEntity entity =
|
final GetServerDatetimeEntity entity =
|
||||||
await ApiRepository.to.getServerDatetimeData();
|
await ApiRepository.to.getServerDatetimeData(isUnShowLoading:true);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
}else{
|
||||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
state.isHaveNetwork = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getUTCNetTime() {
|
int getUTCNetTime() {
|
||||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
if(state.isHaveNetwork){
|
||||||
state.differentialTime;
|
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||||
|
|||||||
@ -15,7 +15,8 @@ class LockDetailState {
|
|||||||
StreamSubscription? LockSetChangeSetRefreshLockDetailWithTypeSubscription;
|
StreamSubscription? LockSetChangeSetRefreshLockDetailWithTypeSubscription;
|
||||||
|
|
||||||
String lockNetToken = '0';
|
String lockNetToken = '0';
|
||||||
int differentialTime = 0;
|
int differentialTime = 0;// 服务器时间与本地时间差值
|
||||||
|
bool isHaveNetwork = true;
|
||||||
int lockUserNo = 0;
|
int lockUserNo = 0;
|
||||||
int senderUserId = 0;
|
int senderUserId = 0;
|
||||||
bool isOnlyOneData = false;
|
bool isOnlyOneData = false;
|
||||||
@ -51,6 +52,7 @@ class LockDetailState {
|
|||||||
int operateDate = 0; // 按日期查询消息记录的时间戳
|
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||||
int logCountPage = 10; // 蓝牙记录一页多少个
|
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||||
RxInt nextAuthTime = 0.obs; // 下次认证时间
|
RxInt nextAuthTime = 0.obs; // 下次认证时间
|
||||||
|
|
||||||
// LockDetailState() {
|
// LockDetailState() {
|
||||||
// Map map = Get.arguments;
|
// Map map = Get.arguments;
|
||||||
// lockCount = map["lockCount"];
|
// lockCount = map["lockCount"];
|
||||||
|
|||||||
@ -56,18 +56,15 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
utcTimeStamp: getUTCTime(),
|
utcTimeStamp: state.serverTime,
|
||||||
unixTimeStamp: getLocalTime(),
|
unixTimeStamp: getLocalTime(),
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
@ -133,7 +130,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
utcTimeStamp: getUTCTime(),
|
utcTimeStamp: state.serverTime,
|
||||||
unixTimeStamp: getLocalTime(),
|
unixTimeStamp: getLocalTime(),
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
@ -148,29 +145,18 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
Future<void> getServerDatetime() async {
|
Future<void> getServerDatetime() async {
|
||||||
final GetServerDatetimeEntity entity =
|
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false);
|
||||||
await ApiRepository.to.getServerDatetimeData();
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 -
|
state.serverTime = entity.data!.date! ~/ 1000;
|
||||||
DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
getStarLockStatus();
|
||||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getLocalTime() {
|
int getLocalTime(){
|
||||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
final DateTime now = DateTime.now();
|
||||||
state.differentialTime;
|
final Duration timeZoneOffset = now.timeZoneOffset;
|
||||||
}
|
AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
|
||||||
|
return state.serverTime + timeZoneOffset.inSeconds;
|
||||||
int getUTCTime() {
|
|
||||||
final DateTime utcTime =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000, isUtc: true);
|
|
||||||
|
|
||||||
final String appointmentDate =
|
|
||||||
DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
|
|
||||||
final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
|
|
||||||
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
|
|
||||||
return utcTimeValue ~/ 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -178,7 +164,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
getServerDatetime();
|
// getServerDatetime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
|
|||||||
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
|
// margin: EdgeInsets.only(left: 03.w, right: 30.w, top: 20.w),
|
||||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
logic.getStarLockStatus();
|
logic.getServerDatetime();
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -23,4 +23,5 @@ class UploadElectricQuantityState {// 0普通状态可用 1不可用
|
|||||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
RxInt sureBtnState = 0.obs;
|
RxInt sureBtnState = 0.obs;
|
||||||
|
|
||||||
|
int serverTime = 0;// 服务器时间即UTC+0时间
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
switch(status){
|
switch(status){
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
final String dataEime = DateTool().dateToYMDHNString('${getLocalTime()}');
|
final String dataEime = DateTool().dateToYMDHNString('${state.differentialTime}');
|
||||||
state.dateTime.value = dataEime;
|
state.dateTime.value = dataEime;
|
||||||
|
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
@ -124,7 +124,7 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
IoSenderManage.senderTimingCommand(
|
IoSenderManage.senderTimingCommand(
|
||||||
lockID:BlueManage().connectDeviceName,
|
lockID:BlueManage().connectDeviceName,
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
nowTime: getLocalTime(),
|
nowTime: state.differentialTime,
|
||||||
token:getTokenList,
|
token:getTokenList,
|
||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
signKey:getSignKeyList,
|
signKey:getSignKeyList,
|
||||||
@ -183,27 +183,14 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
Future<void> getServerDatetime() async{
|
Future<void> getServerDatetime() async{
|
||||||
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
|
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
state.differentialTime = entity.data!.date! ~/ 1000;
|
||||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||||
getStarLockStatus();
|
sendTiming();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getLocalTime(){
|
|
||||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getUTCTime(){
|
|
||||||
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
|
|
||||||
|
|
||||||
final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
|
|
||||||
final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
|
|
||||||
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
|
|
||||||
return utcTimeValue ~/ 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
@ -211,7 +198,8 @@ class LockTimeLogic extends BaseGetXController{
|
|||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
|
|
||||||
// getLockTimeFromGateway();
|
// getLockTimeFromGateway();
|
||||||
getServerDatetime();
|
|
||||||
|
getStarLockStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -56,8 +56,8 @@ class _LockTimePageState extends State<LockTimePage> with RouteAware{
|
|||||||
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||||
onClick: () {
|
onClick: () {
|
||||||
// logic.sendTiming();
|
// logic.sendTiming();
|
||||||
// logic.getServerDatetime();
|
logic.getServerDatetime();
|
||||||
logic.sendTiming();
|
// logic.sendTiming();
|
||||||
}),
|
}),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40.h,
|
height: 40.h,
|
||||||
|
|||||||
@ -14,4 +14,6 @@ class LockTimeState{// 0普通状态(可用) 1连接中(不可用)
|
|||||||
|
|
||||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
RxInt sureBtnState = 0.obs;
|
RxInt sureBtnState = 0.obs;
|
||||||
|
|
||||||
|
int serverTime = 0;// 服务器时间即UTC+0时间
|
||||||
}
|
}
|
||||||
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
|
import 'package:date_format/date_format.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
|
||||||
import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart';
|
import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart';
|
import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
||||||
@ -27,7 +27,6 @@ import '../../../blue/io_tool/io_tool.dart';
|
|||||||
import '../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../blue/sender_manage.dart';
|
import '../../../blue/sender_manage.dart';
|
||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
import '../../../tools/dateTool.dart';
|
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
import 'nearbyLock_state.dart';
|
import 'nearbyLock_state.dart';
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
lockId: BlueManage().connectDeviceName,
|
lockId: BlueManage().connectDeviceName,
|
||||||
keyID: '1',
|
keyID: '1',
|
||||||
authUserID: await Storage.getUid(),
|
authUserID: await Storage.getUid(),
|
||||||
nowTime: getUTCTime(),
|
nowTime: state.serverTime,
|
||||||
publicKeyData: publicKey,
|
publicKeyData: publicKey,
|
||||||
needAuthor: 1);
|
needAuthor: 1);
|
||||||
break;
|
break;
|
||||||
@ -353,7 +352,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
utcTimeStamp: getUTCTime(),
|
utcTimeStamp: state.serverTime,
|
||||||
unixTimeStamp: getLocalTime(),
|
unixTimeStamp: getLocalTime(),
|
||||||
isBeforeAddUser: true,
|
isBeforeAddUser: true,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
@ -377,10 +376,17 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
|
||||||
|
final String getUTCDate = formatDate(DateTime.fromMillisecondsSinceEpoch(state.serverTime*1000), <String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
|
||||||
|
final String getLocalDate = formatDate(DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000), <String>[yyyy, '-', mm, '-', dd, ' ', HH, ':', nn, ':', ss]);
|
||||||
|
|
||||||
|
AppLog.log('state.serverTime:${state.serverTime} getUTCDate:$getUTCDate '
|
||||||
|
'getLocalTime:${getLocalTime()} getLocalDate:$getLocalDate '
|
||||||
|
'差值:${getLocalTime() - state.serverTime}');
|
||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
utcTimeStamp: getUTCTime(),
|
utcTimeStamp: state.serverTime,
|
||||||
unixTimeStamp: getLocalTime(),
|
unixTimeStamp: getLocalTime(),
|
||||||
isBeforeAddUser: true,
|
isBeforeAddUser: true,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
@ -494,10 +500,10 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
//首次
|
//首次
|
||||||
final int difference = length % 240;
|
final int difference = length % 240;
|
||||||
otaCount = length ~/ 240 + (difference > 0 ? 1 : 0);
|
otaCount = length ~/ 240 + (difference > 0 ? 1 : 0);
|
||||||
startSecond = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
startSecond = DateTime.now().millisecondsSinceEpoch;
|
||||||
}
|
}
|
||||||
if (otaCount <= otaIndex) {
|
if (otaCount <= otaIndex) {
|
||||||
final int now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
final int now = DateTime.now().millisecondsSinceEpoch;
|
||||||
final String msg =
|
final String msg =
|
||||||
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
|
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
|
||||||
closeOTADAta();
|
closeOTADAta();
|
||||||
@ -624,24 +630,25 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 从服务器获取锁的时间 开锁时传入
|
// 从服务器获取锁的时间 开锁时传入
|
||||||
Future<void> getServerDatetime() async{
|
Future<void> getServerDatetime() async{
|
||||||
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
|
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:false);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
state.serverTime = entity.data!.date! ~/ 1000;
|
||||||
|
|
||||||
|
if (state.otaState.value) {
|
||||||
|
oTAUpgrade(state.selectLockName.value);
|
||||||
|
} else {
|
||||||
|
connect(state.selectLockName.value);
|
||||||
|
}
|
||||||
|
// state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getLocalTime(){
|
int getLocalTime(){
|
||||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
final DateTime now = DateTime.now();
|
||||||
}
|
final Duration timeZoneOffset = now.timeZoneOffset;
|
||||||
|
AppLog.log('timeZoneOffset.inSeconds:$timeZoneOffset.inSeconds');
|
||||||
int getUTCTime(){
|
return state.serverTime + timeZoneOffset.inSeconds;
|
||||||
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
|
|
||||||
|
|
||||||
final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
|
|
||||||
final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
|
|
||||||
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
|
|
||||||
return utcTimeValue ~/ 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -649,7 +656,6 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
super.onReady();
|
super.onReady();
|
||||||
_initReplySubscription();
|
_initReplySubscription();
|
||||||
state.ifCurrentScreen.value = true;
|
state.ifCurrentScreen.value = true;
|
||||||
getServerDatetime();
|
|
||||||
startScanBlueList();
|
startScanBlueList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,11 +71,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
|
|||||||
'images/icon_lockGroup_item.png', state.devices[index], () {
|
'images/icon_lockGroup_item.png', state.devices[index], () {
|
||||||
String advName = state.devices[index].advertisementData.advName;
|
String advName = state.devices[index].advertisementData.advName;
|
||||||
state.selectLockName.value = advName;
|
state.selectLockName.value = advName;
|
||||||
if (state.otaState.value) {
|
logic.getServerDatetime();
|
||||||
logic.oTAUpgrade(advName);
|
|
||||||
} else {
|
|
||||||
logic.connect(advName);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
|||||||
@ -3,20 +3,21 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
class NearbyLockState {
|
class NearbyLockState {
|
||||||
RxList<ScanResult> devices = <ScanResult>[].obs;
|
RxList<ScanResult> devices = <ScanResult>[].obs;
|
||||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||||
// var sureBtnState = 0.obs;// 0可点击 1 不可点击
|
// var sureBtnState = 0.obs;// 0可点击 1 不可点击
|
||||||
int differentialTime = 0;
|
// int differentialTime = 0;
|
||||||
|
int serverTime = 0;// 服务器时间即UTC+0时间
|
||||||
|
|
||||||
var selectLockName = "".obs;
|
RxString selectLockName = ''.obs;
|
||||||
|
|
||||||
var timestampValue = 0;
|
int timestampValue = 0;
|
||||||
var lockInfo = {};
|
Map lockInfo = {};
|
||||||
var featureValue = '';
|
String featureValue = '';
|
||||||
var featureSettingValue = '';
|
String featureSettingValue = '';
|
||||||
var featureSettingParams = [];
|
List featureSettingParams = [];
|
||||||
|
|
||||||
var otaState = false.obs; //ota 升级
|
RxBool otaState = false.obs; //ota 升级
|
||||||
var otaUpdateIng = false.obs;
|
RxBool otaUpdateIng = false.obs;
|
||||||
var otaProgress = 0.00.obs;
|
RxDouble otaProgress = 0.00.obs;
|
||||||
bool oTAProgressDialog = false;
|
bool oTAProgressDialog = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ class SelectLockTypeLogic extends BaseGetXController {
|
|||||||
SelectLockTypeState state = SelectLockTypeState();
|
SelectLockTypeState state = SelectLockTypeState();
|
||||||
|
|
||||||
void getServerDatetime() async{
|
void getServerDatetime() async{
|
||||||
var entity = await ApiRepository.to.getServerDatetimeData();
|
var entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:true);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,7 +182,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
|
|||||||
logic.showToast(
|
logic.showToast(
|
||||||
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
|
||||||
}
|
}
|
||||||
});
|
}, isShowSuffixIcon: true);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 100.w,
|
width: 100.w,
|
||||||
|
|||||||
@ -252,4 +252,6 @@ abstract class Api {
|
|||||||
final String keydetail = ' /key/detail'; //获取钥匙详情
|
final String keydetail = ' /key/detail'; //获取钥匙详情
|
||||||
final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息
|
final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息
|
||||||
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
||||||
|
|
||||||
|
final String checkIpURL = '/checkIp/ip';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -840,8 +840,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// 获取服务器当前时间
|
// 获取服务器当前时间
|
||||||
Future<Response> getServerDatetimeLoadData() =>
|
Future<Response> getServerDatetimeLoadData(bool isUnShowLoading) =>
|
||||||
post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: true);
|
post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: isUnShowLoading);
|
||||||
|
|
||||||
// 锁诊断
|
// 锁诊断
|
||||||
Future<Response> setLockDiagnoseData(
|
Future<Response> setLockDiagnoseData(
|
||||||
@ -2225,6 +2225,12 @@ class ApiProvider extends BaseProvider {
|
|||||||
jsonEncode(<String, dynamic>{'id': id}),
|
jsonEncode(<String, dynamic>{'id': id}),
|
||||||
isUnShowLoading: true,
|
isUnShowLoading: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Future<Response<dynamic>> checkIpAction(String ip) => post(
|
||||||
|
checkIpURL.toUrl,
|
||||||
|
jsonEncode(<String, dynamic>{'ip': ip}),
|
||||||
|
isUnShowLoading: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -46,6 +46,7 @@ import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
|||||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
import '../login/login/entity/LoginEntity.dart';
|
||||||
import '../login/register/entity/SendValidationCodeEntity.dart';
|
import '../login/register/entity/SendValidationCodeEntity.dart';
|
||||||
|
import '../login/register/entity/checkIP_entity.dart';
|
||||||
import '../main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
|
import '../main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
|
||||||
import '../main/lockDetail/card/addICCard/addICCard_entity.dart';
|
import '../main/lockDetail/card/addICCard/addICCard_entity.dart';
|
||||||
import '../main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_entity.dart';
|
import '../main/lockDetail/checkingIn/checkingInDetail/checkingInDetail_entity.dart';
|
||||||
@ -890,8 +891,8 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取服务器当前时间
|
// 获取服务器当前时间
|
||||||
Future<GetServerDatetimeEntity> getServerDatetimeData() async {
|
Future<GetServerDatetimeEntity> getServerDatetimeData({bool? isUnShowLoading}) async {
|
||||||
final res = await apiProvider.getServerDatetimeLoadData();
|
final res = await apiProvider.getServerDatetimeLoadData(isUnShowLoading ?? true);
|
||||||
return GetServerDatetimeEntity.fromJson(res.body);
|
return GetServerDatetimeEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2237,4 +2238,10 @@ class ApiRepository {
|
|||||||
final Response<dynamic> res = await apiProvider.deleteTemplateInfo(id);
|
final Response<dynamic> res = await apiProvider.deleteTemplateInfo(id);
|
||||||
return LoginEntity.fromJson(res.body);
|
return LoginEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查看ip是否是国外还是国内
|
||||||
|
Future<CheckIPEntity> checkIpAction({required String ip}) async {
|
||||||
|
final Response<dynamic> res = await apiProvider.checkIpAction(ip);
|
||||||
|
return CheckIPEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ class ShowTFView extends StatelessWidget {
|
|||||||
String? tipTitle;
|
String? tipTitle;
|
||||||
String? leftBtnTitle;
|
String? leftBtnTitle;
|
||||||
String? rightBtnTitle;
|
String? rightBtnTitle;
|
||||||
|
bool? isShowSuffixIcon;
|
||||||
TextEditingController? controller;
|
TextEditingController? controller;
|
||||||
List<TextInputFormatter>? inputFormatters;
|
List<TextInputFormatter>? inputFormatters;
|
||||||
TextInputType? keyboardType;
|
TextInputType? keyboardType;
|
||||||
@ -24,6 +25,7 @@ class ShowTFView extends StatelessWidget {
|
|||||||
this.tipTitle,
|
this.tipTitle,
|
||||||
this.leftBtnTitle,
|
this.leftBtnTitle,
|
||||||
this.rightBtnTitle,
|
this.rightBtnTitle,
|
||||||
|
this.isShowSuffixIcon,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.inputFormatters,
|
this.inputFormatters,
|
||||||
this.keyboardType,
|
this.keyboardType,
|
||||||
@ -58,14 +60,16 @@ class ShowTFView extends StatelessWidget {
|
|||||||
inputFormatters: inputFormatters,
|
inputFormatters: inputFormatters,
|
||||||
keyboardType: keyboardType,
|
keyboardType: keyboardType,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding:
|
contentPadding: EdgeInsets.only(left: 5, top: isShowSuffixIcon! ? 0 : -8, bottom: 6),
|
||||||
const EdgeInsets.only(left: 5, top: -8, bottom: 6),
|
|
||||||
hintText: tipTitle??TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
hintText: tipTitle??TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
hintStyle: TextStyle(fontSize: 22.sp, height: 1.0),
|
hintStyle: TextStyle(fontSize: 22.sp, height: 1.0),
|
||||||
//不需要输入框下划线
|
//不需要输入框下划线
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
suffixIcon: isShowSuffixIcon! ? IconButton(
|
||||||
|
onPressed: () => controller?.clear(),
|
||||||
|
icon: const Icon(Icons.clear),
|
||||||
|
) : null,
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@ -13,18 +13,17 @@ typedef BlockIsHaveAllDataCallback = void Function(bool isAllData);
|
|||||||
|
|
||||||
class ShowTipView {
|
class ShowTipView {
|
||||||
// 只有一个确定按钮
|
// 只有一个确定按钮
|
||||||
void showSureAlertDialog(String contentStr) {
|
void showSureAlertDialog(String contentStr, {String? tipTitle, String? sureStr}) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
|
title: Text(tipTitle ?? ''),
|
||||||
content: Text(contentStr),
|
content: Text(contentStr),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(sureStr ?? TranslationLoader.lanKeys!.sure!.tr),
|
||||||
onPressed: () {
|
onPressed: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -40,7 +39,7 @@ class ShowTipView {
|
|||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return CupertinoAlertDialog(
|
return CupertinoAlertDialog(
|
||||||
title: Text("提示".tr),
|
title: Text('提示'.tr),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
// height: 100.h,
|
// height: 100.h,
|
||||||
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
child: ShowDeleteAdministratorIsHaveAllDataWidget(
|
||||||
@ -53,9 +52,7 @@ class ShowTipView {
|
|||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||||
onPressed: () {
|
onPressed: Get.back,
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||||
@ -97,7 +94,7 @@ class ShowTipView {
|
|||||||
|
|
||||||
void showTFViewAlertDialog(TextEditingController controller, String title,
|
void showTFViewAlertDialog(TextEditingController controller, String title,
|
||||||
String tipTitle, Function sureClick,
|
String tipTitle, Function sureClick,
|
||||||
{List<TextInputFormatter>? inputFormatters}) {
|
{List<TextInputFormatter>? inputFormatters, bool? isShowSuffixIcon}) {
|
||||||
// 点击删除 开始扫描
|
// 点击删除 开始扫描
|
||||||
showDialog(
|
showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
@ -107,6 +104,7 @@ class ShowTipView {
|
|||||||
tipTitle: tipTitle,
|
tipTitle: tipTitle,
|
||||||
inputFormatters: inputFormatters,
|
inputFormatters: inputFormatters,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
isShowSuffixIcon: isShowSuffixIcon ?? false,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
//发送删除锁请求
|
//发送删除锁请求
|
||||||
if (controller.text.isEmpty) {
|
if (controller.text.isEmpty) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user