Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release

This commit is contained in:
Daisy 2024-06-07 11:16:32 +08:00
commit 71f7d3a3b2
77 changed files with 988 additions and 844 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
images/.DS_Store vendored

Binary file not shown.

View File

@ -862,16 +862,25 @@
"五": "Fri",
"六": "Sat",
"日": "Sun",
"新建短信模版": "New SMS template",
"新建邮件模版": "New email template",
"自定义短信模版": "Custom SMS template",
"自定义邮件模版": "Custom email template",
"名称": "Name",
"新建短信模版":"New SMS template",
"新建邮件模版":"New email template",
"自定义短信模版":"Custom SMS template",
"自定义邮件模版":"Custom email template",
"名称":"Name",
"星星锁": "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",
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "To receive important updates, please click 'OK' and enable notifications in the settings.",
"开启后可通过长按锁上的设置键重新上电用APP重新添加": "After turning on, you can re-power on by long pressing the setting key on the lock, and re-add it with the APP",
"已有": "Already has",
"新增": "New",
"账号格式错误": "The account format is incorrect",
"接收者信息为空": "The recipient information is empty"
}

View File

@ -900,10 +900,19 @@
"自定义邮件模版":"自定义邮件模版",
"名称":"名称",
"星星锁": "星星锁",
"无考勤记录": "无考勤记录",
"大家干劲十足": "大家干劲十足",
"工作时长未出炉": "工作时长未出炉",
"国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续": "国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续",
"确认国家或地区": "确认国家或地区",
"我知道了": "我知道了",
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。",
"开启后可通过长按锁上的设置键重新上电用APP重新添加":"开启后可通过长按锁上的设置键重新上电用APP重新添加",
"已有": "已有",
"新增": "新增",
"账号格式错误": "账号格式错误",
"接收者信息为空": "接收者信息为空"
}

View File

@ -862,6 +862,14 @@
"五": "五",
"六": "六",
"日": "日",
"无考勤记录": "无考勤记录",
"大家干劲十足": "大家干劲十足",
"工作时长未出炉": "工作时长未出炉",
"国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续": "国家地区的选择将影响数据安全,你当前选择的是阿尔巴尼亚,请确认后再继续",
"确认国家或地区": "确认国家或地区",
"我知道了": "我知道了",
"新建短信模版": "新建短信模版",
"新建邮件模版": "新建邮件模版",
"自定义短信模版": "自定义短信模版",
@ -874,4 +882,5 @@
"新增": "新增",
"账号格式错误": "账号格式错误",
"接收者信息为空": "接收者信息为空"
}

View File

@ -14,6 +14,7 @@ import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/tools/app_manager.dart';
import 'package:star_lock/tools/bindings/app_binding.dart';
import 'package:star_lock/tools/customer_tool.dart';
import 'package:star_lock/tools/pay/wx_pay_tool.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/translations/app_dept.dart';
@ -117,7 +118,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
getPages: AppRouters.routePages,
builder: EasyLoading.init(),
initialBinding: AppBindings(),
initialRoute: initialRoute );
initialRoute: initialRoute);
}
@override
@ -178,4 +179,5 @@ Future<void> getAgreePrivacyShowUpdate() async {
Future<void> getAppInfo() async {
final GetAppInfo entity = await ApiRepository.to.getAppInfo();
CustomerTool.init(entity.data?.wechatServiceUrl ?? '');
}
WxPayTool.associationUrl = entity.data?.appSiteUrl ?? '';
}

View File

@ -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;
}

View File

@ -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'];

View File

@ -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);
}),
],

View File

@ -28,13 +28,16 @@ class GetAppInfo {
class Data {
Data.fromJson(Map<String, dynamic> json) {
wechatServiceUrl = json['wechat_service_url'];
appSiteUrl = json['app_site_url'];
}
String? wechatServiceUrl;
String? appSiteUrl;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['wechat_service_url'] = wechatServiceUrl;
data['app_site_url'] = appSiteUrl;
return data;
}
}

View File

@ -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();

View File

@ -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();
}
},
)),

View File

@ -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(

View File

@ -1,28 +0,0 @@
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;
}
}

View File

@ -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;
}
}

View 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;
}
}

View File

@ -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();
}

View File

@ -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}');

View File

@ -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}");
},

View File

@ -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>{};

View File

@ -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
}

View File

@ -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 = ""; //012退3
bool? isSelect = false;
CalendarModel(
{this.year, this.month, this.day, this.isSelect, this.workType});
int? year;
int? month;
int? day;
String? workType = ''; //012退3
bool? isSelect = false;
}

View File

@ -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;
}

View File

@ -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();
//
// }
}

View File

@ -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;
}

View File

@ -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');
}
}

View File

@ -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,

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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>{};

View File

@ -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>{};

View File

@ -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)),
),
);
},
),
),
),),
],
)
),
);
}
}

View File

@ -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();

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -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>{};

View File

@ -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,

View File

@ -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');
});
}
}

View File

@ -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')}";
// //

View File

@ -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;
}

View File

@ -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();
}
}

View File

@ -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,),
],
)

View File

@ -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;// 3workDay自定义 4workDay
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;// 3workDay自定义 4workDay
RxString pushType = ''.obs;
}

View File

@ -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>{};

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'package:flutter/material.dart';

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

View File

@ -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>{};

View File

@ -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();
}
}

View File

@ -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();
// },
// );
// },
// );
// }
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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"];

View File

@ -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

View File

@ -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();
}),
],
),

View File

@ -23,4 +23,5 @@ class UploadElectricQuantityState {// 0普通状态可用 1不可用
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
int serverTime = 0;// UTC+0
}

View File

@ -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

View File

@ -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,

View File

@ -14,4 +14,6 @@ class LockTimeState{// 0普通状态(可用) 1连接中(不可用)
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
int serverTime = 0;// UTC+0
}

View File

@ -33,7 +33,7 @@ class StarLockMainPage extends StatefulWidget {
State<StarLockMainPage> createState() => _StarLockMainPageState();
}
class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget ,AutomaticKeepAliveClientMixin {
final logic = Get.put(LockMainLogic());
final state = Get.find<LockMainLogic>().state;
@ -265,8 +265,10 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_teamEvent.cancel();
}
@override
bool get wantKeepAlive => true;
}

View File

@ -26,6 +26,7 @@ class StarLockMainXHJPage extends StatefulWidget {
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
with BaseWidget {
PageController _pageController = PageController();
@override
void initState() {
@ -44,109 +45,70 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
builder: (LockMainXHJLogic logic) {
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
body: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(), //
children: <Widget>[
pageView(
widget: StarLockMainPage(
StarLockMainPage(
showAppBar: false,
showDrawer: false,
),
SafeArea(
bottom: false,
child: LockMallPage(
allowReturn: false,
),
),
SafeArea(
bottom: false,
child: MessageListXHJPage(
showAppBar: false,
showDrawer: false,
),
logic: logic,
index: 0,
),
pageView(
widget: SafeArea(
bottom: false,
child: LockMallPage(
allowReturn: false,
),
SafeArea(
bottom: false,
child: MineSetPage(
showAppBar: false,
showAbout: true,
),
logic: logic,
index: 1,
),
pageView(
widget: SafeArea(
bottom: false,
child: MessageListXHJPage(
showAppBar: false,
),
),
logic: logic,
index: 2,
),
pageView(
widget: SafeArea(
bottom: false,
child: MineSetPage(
showAppBar: false,
showAbout: true,
),
),
logic: logic,
index: 3,
),
],
),
bottomNavigationBar: Container(
padding: EdgeInsets.only(
top: 20.h, bottom: GetPlatform.isAndroid ? 20.h : 0),
decoration: const BoxDecoration(
color: Colors.transparent,
border: Border(
top: BorderSide(
color: Colors.black, //
width: 0.3, //
),
),
),
child: SafeArea(
top: false,
child: Row(
children: <Widget>[
navigationBarItem(Icons.key,
TranslationLoader.lanKeys!.device!.tr, logic, 0, () {
logic.setIndex(0);
}),
navigationBarItem(Icons.shopping_cart, '商城'.tr, logic, 1,
() {
logic.setIndex(1);
}),
navigationBarItem(Icons.message,
TranslationLoader.lanKeys!.message!.tr, logic, 2, () {
logic.setIndex(2);
}),
navigationBarItem(Icons.account_circle, '我的'.tr, logic, 3,
() {
logic.setIndex(3);
}),
],
),
),
),
bottomNavigationBar: buildBottomNavigationBar(logic),
);
});
}
//
Widget pageView(
{required Widget widget,
required LockMainXHJLogic logic,
required int index}) {
return Positioned.fill(
child: Offstage(
offstage: logic.state.index != index,
child: widget,
Widget buildBottomNavigationBar(LockMainXHJLogic logic) {
return Container(
padding:
EdgeInsets.only(top: 20.h, bottom: GetPlatform.isAndroid ? 20.h : 0),
decoration: const BoxDecoration(
color: Colors.transparent,
border: Border(top: BorderSide(color: Colors.black, width: 0.3)),
),
child: SafeArea(
top: false,
child: Row(
children: <Widget>[
navigationBarItem(logic, Icons.key, '设备'.tr, 0),
navigationBarItem(logic, Icons.shopping_cart, '商城'.tr, 1),
navigationBarItem(logic, Icons.message, '消息'.tr, 2),
navigationBarItem(logic, Icons.account_circle, '我的'.tr, 3),
],
),
),
);
}
//
Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic,
int index, GestureTapCallback? onTop) {
final bool check = logic.state.index == index;
Widget navigationBarItem(
LockMainXHJLogic logic, IconData icon, String text, int index) {
return Expanded(
child: GestureDetector(
onTap: onTop,
onTap: () {
_pageController.jumpToPage(index);
logic.setIndex(index);
},
child: Container(
color: Colors.transparent,
child: Column(
@ -157,16 +119,18 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
child: Icon(
icon,
size: 32.r,
color:
check ? AppColors.mainColor : AppColors.darkGrayTextColor,
color: logic.state.index == index
? AppColors.mainColor
: AppColors.darkGrayTextColor,
),
),
Text(
text,
style: TextStyle(
fontSize: 16.sp,
color:
check ? AppColors.mainColor : AppColors.darkGrayTextColor,
color: logic.state.index == index
? AppColors.mainColor
: AppColors.darkGrayTextColor,
),
),
],

View File

@ -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();
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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){
}
}

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
@ -25,13 +26,12 @@ class LockMallLogic extends BaseGetXController {
//
Future<void> getMallURLRequest() async {
LockMallDataEntity entity = await ApiRepository.to.getMallURLData();
final LockMallDataEntity entity = await ApiRepository.to.getMallURLData();
if (entity.errorCode!.codeIsSuccessful) {
state.lockMallUrl.value = entity.data!.url!;
state.mallWebView.setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {
// Update loading bar.
state.webProgress.value = progress / 100;
},
onPageStarted: (String url) {
@ -40,6 +40,7 @@ class LockMallLogic extends BaseGetXController {
onPageFinished: (String url) {
state.webProgress.value = 1.0;
refreshGoBack();
update();
},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) async {
@ -53,27 +54,24 @@ class LockMallLogic extends BaseGetXController {
),
);
state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value));
// FlutterBridge.postMessage({action:'',data:'{}',callFun:'回调给js的方法'})
state.mallWebView.addJavaScriptChannel(
"FlutterBridge",
'FlutterBridge',
onMessageReceived: (JavaScriptMessage message) async {
flutterBridge(message);
},
);
// onMessageReceived
}
}
//webview的调用
Future<void> flutterBridge(JavaScriptMessage message) async {
final dynamic obj = json.decode(message.message);
AppLog.log(obj.toString());
if (obj is! Map && obj['action'] is String) {
return;
}
String action = obj['action'];
dynamic data = obj['data'];
String? callFun = obj['callFun'];
final String action = obj['action'];
final dynamic data = obj['data'];
final String? callFun = obj['callFun'];
switch (action) {
case 'WechatPayParams':
//
@ -84,9 +82,9 @@ class LockMallLogic extends BaseGetXController {
//
Future<void> wxPay(dynamic data, String? callFun) async {
WxPayTool.pay(WxPayTool.mapToPayment(data), (response) {
WxPayTool.pay(WxPayTool.mapToPayment(data), (WeChatResponse response) {
if (response is WeChatPaymentResponse) {
Map data = {
final Map data = <String, dynamic>{
'type': response.type,
'extData': response.extData,
'errCode': response.errCode,
@ -101,7 +99,7 @@ class LockMallLogic extends BaseGetXController {
//webview 退退
Future<bool> canGoBack(bool didPop) async {
bool canGoBack = await state.mallWebView.canGoBack();
final bool canGoBack = await state.mallWebView.canGoBack();
bool isMall = true;
if (Get.isRegistered<LockMainXHJLogic>() && F.isXHJ) {
isMall = Get.find<LockMainXHJLogic>().isMall;
@ -131,7 +129,7 @@ class LockMallLogic extends BaseGetXController {
if (state.allowReturn) {
return;
}
state.mallWebView.canGoBack().then((value) {
state.mallWebView.canGoBack().then((bool value) {
state.canGoBack = value;
update();
});

View File

@ -17,7 +17,7 @@ class LockMallPage extends StatefulWidget {
State<LockMallPage> createState() => _LockMallPageState();
}
class _LockMallPageState extends State<LockMallPage> {
class _LockMallPageState extends State<LockMallPage> with AutomaticKeepAliveClientMixin {
@override
void initState() {
super.initState();
@ -25,8 +25,8 @@ class _LockMallPageState extends State<LockMallPage> {
@override
Widget build(BuildContext context) {
// FIXME
// FIXME url应该使用接口获取 /mall/getUrl POST请求
//
// url应该使用接口获取 /mall/getUrl POST请求
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
return GetBuilder<LockMallLogic>(
init: LockMallLogic(allowReturn: widget.allowReturn),
@ -55,7 +55,7 @@ class _LockMallPageState extends State<LockMallPage> {
PopScope(
onPopInvoked: logic.canGoBack,
canPop: false,
child: SizedBox(),
child: const SizedBox(),
),
Container(
padding: EdgeInsets.only(bottom: 10.w),
@ -76,10 +76,13 @@ class _LockMallPageState extends State<LockMallPage> {
}
String getWebTitle(LockMallLogic logic) {
String webTitleStr = "配件商城".tr;
String webTitleStr = '配件商城'.tr;
logic.state.mallWebView.getTitle().then((result) {
webTitleStr = result!;
});
return webTitleStr;
}
@override
bool get wantKeepAlive => true;
}

View File

@ -25,7 +25,7 @@ class MessageListXHJPage extends StatefulWidget {
}
class _MessageListXHJPageState extends State<MessageListXHJPage>
with TickerProviderStateMixin {
with TickerProviderStateMixin ,AutomaticKeepAliveClientMixin {
final MessageListLogic logic = Get.put(MessageListLogic());
final MessageListState state = Get.find<MessageListLogic>().state;
@ -257,4 +257,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
),
);
}
@override
bool get wantKeepAlive => true;
}

View File

@ -182,7 +182,7 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
logic.showToast(
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
}
});
}, isShowSuffixIcon: true);
},
child: Container(
width: 100.w,

View File

@ -29,7 +29,8 @@ class MineSetPage extends StatefulWidget {
State<MineSetPage> createState() => _MineSetPageState();
}
class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
class _MineSetPageState extends State<MineSetPage>
with WidgetsBindingObserver, AutomaticKeepAliveClientMixin {
final MineSetLogic logic = Get.put(MineSetLogic());
final MineSetState state = Get.find<MineSetLogic>().state;
@ -590,4 +591,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
bool get wantKeepAlive => true;
}

View File

@ -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';
}

View File

@ -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 {

View File

@ -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);
}
}

View File

@ -5,8 +5,10 @@ import 'package:fluwx/fluwx.dart';
///
///
class WxPayTool {
static bool isInit = false;
static Fluwx fluwx = Fluwx();
static bool isInit = false;
static String associationUrl = '';
static init(String appId, String universalLink) {
fluwx.registerApi(appId: appId, universalLink: universalLink);
@ -15,7 +17,7 @@ class WxPayTool {
static Future<void> pay(Payment payment, WeChatResponseSubscriber listener) async {
if (!isInit) {
isInit = true;
await init(payment.appId, 'https://lock.skychip.top/apple-app-site-association.json');
await init(payment.appId, associationUrl);
//
responseListener(WeChatResponse response) {
if (response is WeChatPaymentResponse) {
@ -30,7 +32,7 @@ class WxPayTool {
}
static Payment mapToPayment(dynamic data) {
Payment payment = Payment(
final Payment payment = Payment(
appId: data['appId'],
partnerId: data['partnerId'],
prepayId: data['prepayId'],

View File

@ -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,
),
),
)
],

View File

@ -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) {