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