Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts: # star_lock/lib/main/lockDetail/doorLockLog/doorLockLog_page.dart # star_lock/lib/main/lockDetail/fingerprint/fingerprintDetail/fingerprintDetail_page.dart # star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart # star_lock/lib/mine/addLock/saveLock/saveLock_state.dart
This commit is contained in:
commit
76347a27ee
@ -581,7 +581,7 @@
|
||||
"您好,您的电子钥匙生成成功": "Hello, your electronic key is generated successfully",
|
||||
"生效时间不能小于当前时间": "The effective time cannot be less than the current time",
|
||||
"结束时间不能小于当前时间": "The end time cannot be less than the current time",
|
||||
"是否是管理员": "Is it an administrator",
|
||||
"是否为管理员": "Is it an administrator",
|
||||
"已连接到锁,请将卡靠近锁的读卡区": "Connected to the lock, please put the card close to the card reading area of the lock",
|
||||
"尝试连接设备...": "Trying to connect to the device...",
|
||||
"地理位置": "Geographical location",
|
||||
@ -833,5 +833,12 @@
|
||||
"姓名":"Name",
|
||||
"发送":"Send",
|
||||
"请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct",
|
||||
"传输期间请勿离开当前页面":"Do not leave the current page during transfer"
|
||||
"传输期间请勿离开当前页面":"Do not leave the current page during transfer",
|
||||
"机型": "models",
|
||||
"硬件版本": "Hardware version",
|
||||
"固件版本": "Firmware version",
|
||||
"手动升级": "Manual upgrade",
|
||||
"设备连接中...": "Device Connecting...",
|
||||
"升级过程中无法开锁,请先开锁后再升级": "The lock cannot be unlocked during the upgrade, please unlock the lock before upgrading",
|
||||
"钥匙无效": "The key is invalid"
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@
|
||||
"您好,您的电子钥匙生成成功": "您好,您的电子钥匙生成成功",
|
||||
"生效时间不能小于当前时间": "生效时间不能小于当前时间",
|
||||
"结束时间不能小于当前时间": "结束时间不能小于当前时间",
|
||||
"是否是管理员": "是否是管理员",
|
||||
"是否为管理员": "是否为管理员",
|
||||
"已连接到锁,请将卡靠近锁的读卡区": "已连接到锁,请将卡靠近锁的读卡区",
|
||||
"尝试连接设备...": "尝试连接设备...",
|
||||
"地理位置": "地理位置",
|
||||
@ -861,5 +861,12 @@
|
||||
"姓名":"姓名",
|
||||
"发送":"发送",
|
||||
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确",
|
||||
"传输期间请勿离开当前页面":"传输期间请勿离开当前页面"
|
||||
"传输期间请勿离开当前页面":"传输期间请勿离开当前页面",
|
||||
"机型": "机型",
|
||||
"硬件版本": "硬件版本",
|
||||
"固件版本": "固件版本",
|
||||
"手动升级": "手动升级",
|
||||
"设备连接中...": "设备连接中...",
|
||||
"升级过程中无法开锁,请先开锁后再升级": "升级过程中无法开锁,请先开锁后再升级",
|
||||
"钥匙无效": "钥匙无效"
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,8 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:star_lock/debug/debug_console.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_console.dart';
|
||||
|
||||
|
||||
class AppLog {
|
||||
static bool _printLog = false;
|
||||
@ -13,6 +14,7 @@ class AppLog {
|
||||
_onlyError = onlyError ?? false;
|
||||
}
|
||||
static log(String msg,{bool? error}){
|
||||
DebugConsole.info(msg);
|
||||
if(!kDebugMode)return;
|
||||
error = error ?? false;
|
||||
// if(!_printLog)return;
|
||||
@ -20,7 +22,6 @@ class AppLog {
|
||||
if(error){
|
||||
msg = '----->>> $msg';
|
||||
}
|
||||
DebugConsole.info(msg);
|
||||
Get.log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,6 +280,17 @@ class BlueManage {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// String listStr = scanDevices
|
||||
// // .where((element) =>
|
||||
// // element.advertisementData.advName == 'TMH_dc8f928369ed')
|
||||
// .map((e) => 'advName:${e.advertisementData.advName} '
|
||||
// 'serviceUuids:${e.advertisementData.serviceUuids} '
|
||||
// '是否被重置:${e.advertisementData.serviceUuids[0].toString()[31]}')
|
||||
// .join(',')
|
||||
// .toString();
|
||||
// AppLog.log('--->扫描到的设备 ${listStr} ');
|
||||
|
||||
scanDevicesCallBack(scanDevices);
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// FlutterBluePlus.stopScan();
|
||||
@ -364,7 +375,7 @@ class BlueManage {
|
||||
(d.device.platformName == deviceName) ||
|
||||
(d.advertisementData.advName == deviceName));
|
||||
|
||||
ScanResult? scanResult;//使用局部变量防止出现缓存
|
||||
ScanResult? scanResult; //使用局部变量防止出现缓存
|
||||
if (knownDeviceIndex >= 0) {
|
||||
// 存在的时候赋值
|
||||
connectDeviceMacAddress =
|
||||
@ -381,7 +392,7 @@ class BlueManage {
|
||||
}
|
||||
// AppLog.log("1 connectDeviceId:$connectDeviceMacAddress connectDeviceName:$connectDeviceName");
|
||||
// stopScan();
|
||||
if (scanResult == null ||connectDeviceMacAddress.isEmpty) {
|
||||
if (scanResult == null || connectDeviceMacAddress.isEmpty) {
|
||||
// connectStateCallBack(BluetoothConnectionState.disconnected!);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ abstract class Reply{
|
||||
case 0x0e:
|
||||
// 钥匙已存在
|
||||
showErrorMessage("钥匙已存在");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙无效");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0x0e 钥匙已存在");
|
||||
break;
|
||||
case 0x0f:
|
||||
// 用户已存在
|
||||
@ -124,7 +124,7 @@ abstract class Reply{
|
||||
break;
|
||||
case 0xff:
|
||||
// 异常,未知错误
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0xff");
|
||||
AppLog.log("$logTag ${commandType!.typeName} 0xff 异常,未知错误");
|
||||
showErrorMessage("异常,未知错误");
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -3,7 +3,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/widget/star_input_formatter.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -48,6 +47,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
state.pwdController.text = data['pwd'];
|
||||
logic.checkNext(state.pwdController);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@ -223,6 +223,7 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
state.pwdController.text = data['pwd'];
|
||||
logic.checkNext(state.pwdController);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:star_lock/debug/debug_console.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
import 'app.dart';
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||
@ -259,13 +260,17 @@ class _AddCardPageState extends State<AddCardPage>
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
Obx(() => Visibility(
|
||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin())))),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||
@ -369,7 +374,7 @@ class _AddCardPageState extends State<AddCardPage>
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
@ -41,7 +40,8 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
body: ListView(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||
leftTitel:
|
||||
"${TranslationLoader.lanKeys!.card!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||
rightTitle: state.typeNumber.value,
|
||||
isHaveDirection: false,
|
||||
isHaveLine: true)),
|
||||
@ -54,8 +54,8 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
"", (){
|
||||
if(state.changeNameController.text.isEmpty){
|
||||
"", () {
|
||||
if (state.changeNameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名".tr);
|
||||
return;
|
||||
}
|
||||
@ -65,7 +65,11 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
});
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: (state.keyType.value == 4 || state.keyType.value == 2 || state.keyType.value == 1) ? true : false,
|
||||
visible: (state.keyType.value == 4 ||
|
||||
state.keyType.value == 2 ||
|
||||
state.keyType.value == 1)
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 70.h,
|
||||
@ -162,13 +166,15 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
isTipsImg: false,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
@ -217,7 +223,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
@ -225,9 +231,9 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isAdministrator.value,
|
||||
onChanged: (value) {
|
||||
state.isAdministrator.value = value;
|
||||
state.isDeletCard.value = false;
|
||||
logic.senderAddICCard();
|
||||
// state.isAdministrator.value = value;
|
||||
// state.isDeletCard.value = false;
|
||||
// logic.senderAddICCard();
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -282,5 +288,4 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,32 +1,30 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
|
||||
class CardDetailState{
|
||||
class CardDetailState {
|
||||
final fingerprintItemData = FingerprintItemData().obs;
|
||||
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
var isDeletCard = true.obs;// 是否删除卡
|
||||
var isStressCard = false.obs;// 是否胁迫
|
||||
var isAdministrator = false.obs;// 是否是管理员
|
||||
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||
var isDeletCard = true.obs; // 是否删除卡
|
||||
var isStressCard = false.obs; // 是否胁迫
|
||||
var isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
final typeNumber = "".obs;// 指纹号
|
||||
final typeName = "".obs;// 指纹名字
|
||||
var startDate = "".obs;// 开始时间
|
||||
var endDate = "".obs;// 结束时间
|
||||
var starTime = "".obs;// 生效时间
|
||||
var endTime = "".obs;// 失效时间
|
||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs;// 有效日
|
||||
var adder = "".obs;// 添加者
|
||||
var addTime = 0.obs;// 添加时间
|
||||
var keyId = 0.obs;// 卡id
|
||||
final typeNumber = "".obs; // 指纹号
|
||||
final typeName = "".obs; // 指纹名字
|
||||
var startDate = "".obs; // 开始时间
|
||||
var endDate = "".obs; // 结束时间
|
||||
var starTime = "".obs; // 生效时间
|
||||
var endTime = "".obs; // 失效时间
|
||||
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs; // 有效日
|
||||
var adder = "".obs; // 添加者
|
||||
var addTime = 0.obs; // 添加时间
|
||||
var keyId = 0.obs; // 卡id
|
||||
|
||||
CardDetailState() {
|
||||
Map map = Get.arguments;
|
||||
@ -43,9 +41,11 @@ class CardDetailState{
|
||||
keyType.value = fingerprintItemData.value.cardType!;
|
||||
adder.value = fingerprintItemData.value.senderUsername!;
|
||||
addTime.value = fingerprintItemData.value.createDate!;
|
||||
isStressCard.value = fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||
isStressCard.value =
|
||||
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||
isAdministrator.value = fingerprintItemData.value.cardRight! == 1 ? true : false;
|
||||
isAdministrator.value =
|
||||
fingerprintItemData.value.cardRight! == 1 ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ class DoorLockLogPage extends StatefulWidget {
|
||||
State<DoorLockLogPage> createState() => _DoorLockLogPageState();
|
||||
}
|
||||
|
||||
class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware{
|
||||
class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware {
|
||||
final logic = Get.put(DoorLockLogLogic());
|
||||
final state = Get.find<DoorLockLogLogic>().state;
|
||||
|
||||
@ -162,19 +162,11 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware{
|
||||
child: Stack(
|
||||
children: [
|
||||
timelineData.imagesUrl!.isNotEmpty
|
||||
?
|
||||
Image.network(
|
||||
timelineData.imagesUrl!,
|
||||
width: 260.w,
|
||||
height: 260.h,
|
||||
)
|
||||
// Image(
|
||||
// image: const AssetImage(
|
||||
// 'images/main/icon_lockDetail_monitoringvoiceFrist.png'),
|
||||
// width: 240.w,
|
||||
// height: 180.h,
|
||||
// fit: BoxFit.contain,
|
||||
// )
|
||||
? Image.network(
|
||||
timelineData.imagesUrl!,
|
||||
width: 260.w,
|
||||
height: 260.h,
|
||||
)
|
||||
: Container(),
|
||||
Positioned(
|
||||
top: 150.h,
|
||||
@ -263,5 +255,4 @@ class _DoorLockLogPageState extends State<DoorLockLogPage> with RouteAware{
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
state.ifCurrentScreen.value = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -139,14 +139,9 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
state.getIDCardNumber.value.isEmpty) {
|
||||
ShowCupertinoAlertView()
|
||||
.showOpenAuthWithIDCardInfoAlert((idCard, realName) {
|
||||
if (idCard.isNotEmpty && realName.isNotEmpty) {
|
||||
state.getIDCardNumber.value = idCard;
|
||||
state.getRealName.value = realName;
|
||||
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
|
||||
} else {
|
||||
showToast("请输入完整信息".tr);
|
||||
return;
|
||||
}
|
||||
state.getIDCardNumber.value = idCard ?? '';
|
||||
state.getRealName.value = realName ?? '';
|
||||
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
|
||||
});
|
||||
} else {
|
||||
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
|
||||
@ -234,11 +229,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
|
||||
Future openModalBottomSheet(BuildContext context) async {
|
||||
var textList = <String>[];
|
||||
if(CommonDataManage().currentKeyInfo.keyRight == 1){
|
||||
if (CommonDataManage().currentKeyInfo.keyRight == 1) {
|
||||
textList = [
|
||||
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr
|
||||
];
|
||||
}else if(CommonDataManage().currentKeyInfo.isLockOwner == 1){
|
||||
} else if (CommonDataManage().currentKeyInfo.isLockOwner == 1) {
|
||||
if (state.keyType.value == 1 || state.keyType.value == 2) {
|
||||
textList = [
|
||||
state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen ? '取消冻结'.tr : "冻结".tr,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
|
||||
@ -227,11 +228,10 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
() => Visibility(
|
||||
// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
|
||||
visible: CommonDataManage()
|
||||
.currentKeyInfo
|
||||
.lockSetting!
|
||||
.remoteUnlock ==
|
||||
1 &&
|
||||
state.itemData.value.keyRight != 1
|
||||
.currentKeyInfo
|
||||
.lockSetting!
|
||||
.remoteUnlock ==
|
||||
1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
@ -332,6 +332,10 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
title: tipsTitle,
|
||||
tipTitle: "请输入".tr,
|
||||
controller: logic.getCurrentController(alertEnum),
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(50),
|
||||
],
|
||||
sureClick: () {
|
||||
if (alertEnum == ShowAlertEnum.name) {
|
||||
logic.modifyKeyNameRequest();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
|
||||
@ -144,7 +145,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
endDate: int.parse(endDate),
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock == true ? '1' : '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||
keyNameForAdmin: state.keyNameController.text,
|
||||
keyRight: '0',
|
||||
keyType: getKeyType,
|
||||
|
||||
@ -525,13 +525,13 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
: false),
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.remoteUnlockingAllowed!.tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _remoteSwitch(true, logic)),
|
||||
action: () {}),
|
||||
action: () {})),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
),
|
||||
@ -546,11 +546,11 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: isRemote
|
||||
? logic.state.isRemoteUnlock
|
||||
? logic.state.isRemoteUnlock.value
|
||||
: logic.state.isAuthentication.value,
|
||||
onChanged: (value) {
|
||||
if (isRemote) {
|
||||
logic.state.isRemoteUnlock = !logic.state.isRemoteUnlock;
|
||||
logic.state.isRemoteUnlock.value = !logic.state.isRemoteUnlock.value;
|
||||
} else {
|
||||
logic.state.isAuthentication.value =
|
||||
!logic.state.isAuthentication.value;
|
||||
|
||||
@ -13,7 +13,7 @@ class SendElectronicKeyViewState {
|
||||
final FlutterContactPicker contactPicker = FlutterContactPicker();
|
||||
late Contact contact;
|
||||
|
||||
bool isRemoteUnlock = false; //是否允许远程开锁
|
||||
var isRemoteUnlock = false.obs; //是否允许远程开锁
|
||||
var isAuthentication = false.obs; //是否可以实名认证
|
||||
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.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';
|
||||
@ -164,8 +165,8 @@ class _AddFaceTypePageState extends State<AddFaceTypePage>
|
||||
rightTitle: state.timeLimitEndTime.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
PDuration selectDate =
|
||||
PDuration.parse(DateTime.tryParse(state.timeLimitEndTime.value));
|
||||
PDuration selectDate = PDuration.parse(
|
||||
DateTime.tryParse(state.timeLimitEndTime.value));
|
||||
Pickers.showDatePicker(context,
|
||||
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (p) {
|
||||
state.timeLimitEndTime.value =
|
||||
@ -259,13 +260,17 @@ class _AddFaceTypePageState extends State<AddFaceTypePage>
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))),
|
||||
Obx(() => Visibility(
|
||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))))),
|
||||
SizedBox(height: 30.h),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||
@ -339,7 +344,7 @@ class _AddFaceTypePageState extends State<AddFaceTypePage>
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -8,15 +8,19 @@ class AddFaceTypeState {
|
||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs; // 是否是管理员
|
||||
final isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
var timeLimitBeginTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时开始时间
|
||||
var timeLimitEndTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时结束时间
|
||||
|
||||
var cycleBeginTime = "".obs;// 循环开始时间
|
||||
var cycleEndTime = "".obs;// 循环结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var cycleBeginTime = "".obs; // 循环开始时间
|
||||
var cycleEndTime = "".obs; // 循环结束时间
|
||||
var effectiveDateTime = "".obs; // 生效时间
|
||||
var failureDateTime = "".obs; // 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
||||
|
||||
@ -27,8 +31,9 @@ class AddFaceTypeState {
|
||||
lockId.value = map["lockId"];
|
||||
fromType.value = map["fromType"];
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
if(fromType.value == 2){
|
||||
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
if (fromType.value == 2) {
|
||||
fromTypeTwoStaffName.value =
|
||||
map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,8 +52,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
"", (){
|
||||
if(state.changeNameController.text.isEmpty){
|
||||
"", () {
|
||||
if (state.changeNameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名".tr);
|
||||
return;
|
||||
}
|
||||
@ -177,12 +177,12 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
// isHaveLine: true,
|
||||
// rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFace()))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
@ -205,7 +205,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr,
|
||||
() async {
|
||||
state.isDeletFace.value = true;
|
||||
logic.senderAddFace();
|
||||
});
|
||||
@ -231,7 +232,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
@ -239,9 +240,9 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isAdministrator.value,
|
||||
onChanged: (value) {
|
||||
state.isAdministrator.value = value;
|
||||
state.isDeletFace.value = false;
|
||||
logic.senderAddFace();
|
||||
// state.isAdministrator.value = value;
|
||||
// state.isDeletFace.value = false;
|
||||
// logic.senderAddFace();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -21,9 +21,9 @@ class FaceDetailState {
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||
var isDeletFace = true.obs;// 是否删除卡
|
||||
var isStressFace = false.obs;// 是否胁迫
|
||||
var isAdministrator = false.obs;// 是否是管理员
|
||||
var isDeletFace = true.obs; // 是否删除卡
|
||||
var isStressFace = false.obs; // 是否胁迫
|
||||
var isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
FaceDetailState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
|
||||
@ -249,13 +250,17 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
Obx(() => Visibility(
|
||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin())))),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.stressFingerprint!.tr,
|
||||
@ -424,7 +429,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -1,22 +1,25 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../tools/dateTool.dart';
|
||||
|
||||
class AddFingerprintState{
|
||||
class AddFingerprintState {
|
||||
final lockId = 0.obs;
|
||||
final selectType = "0".obs;// 0永久 1显示 2循环
|
||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs;// 是否是管理员
|
||||
final isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||
var cycleBeginTime = "".obs;// 循环开始时间
|
||||
var cycleEndTime = "".obs;// 循环结束时间
|
||||
var effectiveDateTime = "".obs;// 生效时间
|
||||
var failureDateTime = "".obs;// 失效时间
|
||||
var timeLimitBeginTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时开始时间
|
||||
var timeLimitEndTime = DateTool()
|
||||
.dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString())
|
||||
.obs; // 限时结束时间
|
||||
var cycleBeginTime = "".obs; // 循环开始时间
|
||||
var cycleEndTime = "".obs; // 循环结束时间
|
||||
var effectiveDateTime = "".obs; // 生效时间
|
||||
var failureDateTime = "".obs; // 失效时间
|
||||
var weekdaysList = [].obs;
|
||||
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
||||
|
||||
@ -27,8 +30,9 @@ class AddFingerprintState{
|
||||
lockId.value = map["lockId"];
|
||||
fromType.value = map["fromType"];
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
if(fromType.value == 2){
|
||||
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
if (fromType.value == 2) {
|
||||
fromTypeTwoStaffName.value =
|
||||
map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
@ -26,7 +25,8 @@ class FingerprintDetailPage extends StatefulWidget {
|
||||
State<FingerprintDetailPage> createState() => _FingerprintDetailPageState();
|
||||
}
|
||||
|
||||
class _FingerprintDetailPageState extends State<FingerprintDetailPage> with RouteAware {
|
||||
class _FingerprintDetailPageState extends State<FingerprintDetailPage>
|
||||
with RouteAware {
|
||||
final logic = Get.put(FingerprintDetailLogic());
|
||||
final state = Get.find<FingerprintDetailLogic>().state;
|
||||
|
||||
@ -42,7 +42,8 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
body: Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||
leftTitel:
|
||||
"${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}",
|
||||
rightTitle: state.typeNumber.value,
|
||||
isHaveDirection: false,
|
||||
isHaveLine: true)),
|
||||
@ -55,8 +56,8 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
ShowTipView().showTFViewAlertDialog(
|
||||
state.changeNameController,
|
||||
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}",
|
||||
"", (){
|
||||
if(state.changeNameController.text.isEmpty){
|
||||
"", () {
|
||||
if (state.changeNameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名".tr);
|
||||
return;
|
||||
}
|
||||
@ -64,10 +65,13 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
state.typeName.value = state.changeNameController.text;
|
||||
logic.editFingerprintsData();
|
||||
});
|
||||
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: (state.keyType.value == 4 || state.keyType.value == 2 || state.keyType.value == 1) ? true : false,
|
||||
visible: (state.keyType.value == 4 ||
|
||||
state.keyType.value == 2 ||
|
||||
state.keyType.value == 1)
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
allHeight: 70.h,
|
||||
@ -76,26 +80,32 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
if(state.keyType.value == 2 || state.keyType.value == 1){
|
||||
if (state.keyType.value == 2 || state.keyType.value == 1) {
|
||||
// 限时
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeDatePage,
|
||||
arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData":
|
||||
state.fingerprintItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["beginTimeTimestamp"];
|
||||
state.endDate.value = data["endTimeTimestamp"];
|
||||
state.keyType.value = 2;
|
||||
});
|
||||
}
|
||||
}else if(state.keyType.value == 4){
|
||||
} else if (state.keyType.value == 4) {
|
||||
// 循环
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeValidityDatePage,
|
||||
arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData":
|
||||
state.fingerprintItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
@ -114,11 +124,14 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeValidityDatePage,
|
||||
arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData":
|
||||
state.fingerprintItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
@ -132,14 +145,18 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
child: Obx(() => CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${DateTool().dateToHNString(state.startDate.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||
rightTitle:
|
||||
"${DateTool().dateToHNString(state.startDate.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.otherTypeKeyChangeValidityDatePage, arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData": state.fingerprintItemData.value,
|
||||
});
|
||||
if(data != null) {
|
||||
var data = await Get.toNamed(
|
||||
Routers.otherTypeKeyChangeValidityDatePage,
|
||||
arguments: {
|
||||
"pushType": 1,
|
||||
"fingerprintItemData":
|
||||
state.fingerprintItemData.value,
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.starDate.value = data["starDate"];
|
||||
state.endDate.value = data["endDate"];
|
||||
@ -154,12 +171,11 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
leftTitel: TranslationLoader.lanKeys!.additive!.tr,
|
||||
rightTitle: state.adder.value,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
|
||||
})),
|
||||
action: () {})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||
rightTitle: DateTool().dateToYMDHNString(state.addTime.value.toString()),
|
||||
leftTitel: TranslationLoader.lanKeys!.addTime!.tr,
|
||||
rightTitle: DateTool()
|
||||
.dateToYMDHNString(state.addTime.value.toString()),
|
||||
)),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
@ -171,11 +187,12 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isStressFingerprint()))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
rightWidget:
|
||||
SizedBox(width: 60.w, height: 50.h, child: _isAdmin()))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
@ -195,10 +212,12 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
btnName: TranslationLoader.lanKeys!.delete!.tr,
|
||||
isDelete: true,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
margin: EdgeInsets.only(
|
||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr,
|
||||
() async {
|
||||
state.isDeletFingerprint.value = true;
|
||||
logic.senderAddFingerprint();
|
||||
});
|
||||
@ -225,7 +244,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
@ -233,9 +252,9 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isAdministrator.value,
|
||||
onChanged: (value) {
|
||||
state.isAdministrator.value = value;
|
||||
state.isDeletFingerprint.value = false;
|
||||
logic.senderAddFingerprint();
|
||||
// state.isAdministrator.value = value;
|
||||
// state.isDeletFingerprint.value = false;
|
||||
// logic.senderAddFingerprint();
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -290,5 +309,4 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage> with Rout
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,31 +1,30 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../fingerprintList/fingerprintListData_entity.dart';
|
||||
|
||||
class FingerprintDetailState{
|
||||
class FingerprintDetailState {
|
||||
final fingerprintItemData = FingerprintItemData().obs;
|
||||
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
final typeNumber = "".obs;// 指纹号
|
||||
final typeName = "".obs;// 指纹名字
|
||||
var starDate = "".obs;// 开始时间
|
||||
var endDate = "".obs;// 结束时间
|
||||
var startDate = "".obs;// 生效时间
|
||||
var endTime = "".obs;// 失效时间
|
||||
final keyType = 0.obs;// 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs;// 有效日
|
||||
var adder = "".obs;// 添加者
|
||||
var addTime = 0.obs;// 添加时间
|
||||
final typeNumber = "".obs; // 指纹号
|
||||
final typeName = "".obs; // 指纹名字
|
||||
var starDate = "".obs; // 开始时间
|
||||
var endDate = "".obs; // 结束时间
|
||||
var startDate = "".obs; // 生效时间
|
||||
var endTime = "".obs; // 失效时间
|
||||
final keyType = 0.obs; // 永久:1;限时2,单次3,循环:4
|
||||
var weekDay = [].obs; // 有效日
|
||||
var adder = "".obs; // 添加者
|
||||
var addTime = 0.obs; // 添加时间
|
||||
var keyId = 0.obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
var isDeletFingerprint = true.obs;// 是否删除卡
|
||||
var sureBtnState = 0.obs; // 0普通状态(可用) 1连接中(不可用)
|
||||
var isDeletFingerprint = true.obs; // 是否删除卡
|
||||
final isStressFingerprint = false.obs;
|
||||
var isAdministrator = false.obs;// 是否是管理员
|
||||
var isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
FingerprintDetailState() {
|
||||
Map map = Get.arguments;
|
||||
@ -42,9 +41,11 @@ class FingerprintDetailState{
|
||||
keyType.value = fingerprintItemData.value.fingerprintType!;
|
||||
adder.value = fingerprintItemData.value.senderUsername!;
|
||||
addTime.value = fingerprintItemData.value.createDate!;
|
||||
isStressFingerprint.value = fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||
isStressFingerprint.value =
|
||||
fingerprintItemData.value.isCoerced! == 2 ? true : false;
|
||||
weekDay.value = fingerprintItemData.value.weekDay!;
|
||||
isAdministrator.value = fingerprintItemData.value.fingerRight! == 1 ? true : false;
|
||||
isAdministrator.value =
|
||||
fingerprintItemData.value.fingerRight! == 1 ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/iris/addIrisType/addIrisType_logic.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.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';
|
||||
@ -249,13 +250,17 @@ class _AddIrisTypePageState extends State<AddIrisTypePage> {
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))),
|
||||
Obx(() => Visibility(
|
||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))))),
|
||||
SizedBox(height: 30.h),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||
@ -329,7 +334,7 @@ class _AddIrisTypePageState extends State<AddIrisTypePage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -7,7 +7,7 @@ class AddIrisTypeState {
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs; // 是否是管理员
|
||||
final isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
var beginTime = "".obs; // 开始时间
|
||||
var endTime = "".obs; // 结束时间
|
||||
@ -24,6 +24,5 @@ class AddIrisTypeState {
|
||||
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||
// // nameController.text = fromTypeTwoStaffName.value;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import 'package:intl/intl.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
|
||||
import '../../../app_settings/app_settings.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_protocol/io_openLock.dart';
|
||||
@ -16,7 +18,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 '../../../permission/permission_dialog.dart';
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import '../../../tools/commonDataManage.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
@ -32,7 +33,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 监听设备返回的数据
|
||||
void initReplySubscription() {
|
||||
state.replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
state.replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// 开门
|
||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||
_replyOpenLock(reply);
|
||||
@ -88,7 +90,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
state.electricQuantity.value = power;
|
||||
|
||||
// 备用电量
|
||||
if(state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1){
|
||||
if (state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1) {
|
||||
int powerStandby = reply.data[9];
|
||||
state.electricQuantityStandby.value = powerStandby;
|
||||
}
|
||||
@ -123,10 +125,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
|
||||
break;
|
||||
case 0x16:
|
||||
// 正在开锁中...
|
||||
@ -136,8 +134,20 @@ class LockDetailLogic extends BaseGetXController {
|
||||
cancelBlueConnetctToastTimer();
|
||||
});
|
||||
break;
|
||||
case 0x0d:
|
||||
// 正在开锁中...
|
||||
showToast('钥匙无效'.tr);
|
||||
state.openLockBtnState.value = 0;
|
||||
state.openDoorBtnisUneable.value = false;
|
||||
state.animationController!.stop();
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
state.openLockBtnState.value = 0;
|
||||
state.openDoorBtnisUneable.value = false;
|
||||
state.animationController!.stop();
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -173,7 +183,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
if (dataLength > 0) {
|
||||
reply.data.removeRange(0, 7);
|
||||
// 把得到的数据按8位分割成数组 然后塞进一个新的数组里面
|
||||
if(reply.data.length < 17){
|
||||
if (reply.data.length < 17) {
|
||||
return;
|
||||
}
|
||||
var getList = splitList(reply.data, 17);
|
||||
@ -185,29 +195,29 @@ class LockDetailLogic extends BaseGetXController {
|
||||
var indexMap = {};
|
||||
indexMap["type"] = indexList[0].toString();
|
||||
|
||||
if(indexList[0] == 2){
|
||||
if (indexList[0] == 2) {
|
||||
var passwordData = reply.data.sublist(7, 17);
|
||||
var password = utf8String(passwordData);
|
||||
indexMap["user"] = password.toString();
|
||||
}else{
|
||||
int userNo = (indexList[1]*255) + indexList[2];
|
||||
} else {
|
||||
int userNo = (indexList[1] * 255) + indexList[2];
|
||||
indexMap["user"] = userNo.toString();
|
||||
}
|
||||
|
||||
indexMap["success"] = "1";
|
||||
|
||||
int time = ((0xff & indexList[(3)]) << 24 |
|
||||
(0xff & indexList[4]) << 16 |
|
||||
(0xff & indexList[5]) << 8 |
|
||||
(0xFF & indexList[6]));
|
||||
(0xff & indexList[4]) << 16 |
|
||||
(0xff & indexList[5]) << 8 |
|
||||
(0xFF & indexList[6]));
|
||||
indexMap["date"] = "${time * 1000}";
|
||||
uploadList.add(indexMap);
|
||||
}
|
||||
lockRecordUploadData(uploadList);
|
||||
|
||||
if(dataLength == state.logCountPage){
|
||||
if (dataLength == state.logCountPage) {
|
||||
senderReferEventRecordTime();
|
||||
}else{
|
||||
} else {
|
||||
await BlueManage().disconnect();
|
||||
}
|
||||
}
|
||||
@ -351,7 +361,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
|
||||
BlueManage()
|
||||
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
IoSenderManage.senderOpenLock(
|
||||
keyID: BlueManage().connectDeviceName,
|
||||
@ -377,13 +389,15 @@ class LockDetailLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 查询事件记录(时间查询)
|
||||
Future<void> senderReferEventRecordTime() async {
|
||||
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: () {
|
||||
BlueManage().disconnect();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
|
||||
showBlueConnetctToastTimer(
|
||||
isShowBlueConnetctToast: false,
|
||||
action: () {
|
||||
BlueManage().disconnect();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
@ -410,27 +424,30 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 从服务器获取锁的时间 开锁时传入
|
||||
void getServerDatetime() async{
|
||||
void getServerDatetime() async {
|
||||
var entity = await ApiRepository.to.getServerDatetimeData();
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
int getUTCNetTime(){
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||
int getUTCNetTime() {
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
||||
state.differentialTime;
|
||||
}
|
||||
|
||||
// 获取手机联网token,根据锁设置里面获取的开锁时是否联网来判断是否调用这个接口
|
||||
void getLockNetToken() async {
|
||||
LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||
LockNetTokenEntity entity = await ApiRepository.to
|
||||
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.lockNetToken = entity.data!.token!.toString();
|
||||
AppLog.log("从服务器获取联网token:${state.lockNetToken}");
|
||||
openDoorAction();
|
||||
}else{
|
||||
showToast("网络访问失败,请检查网络是否正常".tr, something: (){
|
||||
} else {
|
||||
showToast("网络访问失败,请检查网络是否正常".tr, something: () {
|
||||
state.openLockBtnState.value = 0;
|
||||
state.animationController!.forward();
|
||||
cancelBlueConnetctToastTimer();
|
||||
@ -442,12 +459,13 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
//电量更新请求
|
||||
Future<void> uploadElectricQuantityRequest() async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
|
||||
electricQuantity:state.electricQuantity.value.toString(),
|
||||
electricQuantityStandby: state.electricQuantityStandby.value.toString(),
|
||||
lockId: state.keyInfos.value.lockId.toString(),
|
||||
isUnShowLoading: true
|
||||
);
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.uploadElectricQuantity(
|
||||
electricQuantity: state.electricQuantity.value.toString(),
|
||||
electricQuantityStandby:
|
||||
state.electricQuantityStandby.value.toString(),
|
||||
lockId: state.keyInfos.value.lockId.toString(),
|
||||
isUnShowLoading: true);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
@ -476,9 +494,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 查询锁记录最后时间
|
||||
void getLockRecordLastUploadDataTime() async {
|
||||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to.getLockRecordLastUploadDataTime(
|
||||
lockId: state.keyInfos.value.lockId.toString()
|
||||
);
|
||||
LockOperatingRecordGetLastRecordTimeEntity entity = await ApiRepository.to
|
||||
.getLockRecordLastUploadDataTime(
|
||||
lockId: state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.operateDate = entity.data!.operateDate! ~/ 1000;
|
||||
senderReferEventRecordTime();
|
||||
@ -487,14 +505,14 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
// 操作记录上传
|
||||
void lockRecordUploadData(List list) async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.lockRecordUploadData(
|
||||
lockId: state.keyInfos.value.lockId.toString(),
|
||||
records: list
|
||||
);
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.lockRecordUploadData(
|
||||
lockId: state.keyInfos.value.lockId.toString(), records: list);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// mockNetworkDataRequest();
|
||||
AppLog.log("state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
|
||||
if(state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce){
|
||||
AppLog.log(
|
||||
"state.keyInfos.value.keyType:${state.keyInfos.value.keyType}");
|
||||
if (state.keyInfos.value.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
// 单次删除
|
||||
deletKeyData();
|
||||
}
|
||||
@ -504,9 +522,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// 普通用户或者授权管理员删除钥匙
|
||||
void deletKeyData() async {
|
||||
var entity = await ApiRepository.to.deleteElectronicKey(
|
||||
keyId:state.keyInfos.value.keyId.toString(),
|
||||
includeUnderlings: 0
|
||||
);
|
||||
keyId: state.keyInfos.value.keyId.toString(), includeUnderlings: 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().connectDeviceMacAddress = "";
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
@ -516,21 +532,24 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 锁设置里面开启关闭考勤刷新锁详情
|
||||
void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
|
||||
eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
|
||||
eventBus
|
||||
.on<LockSetChangeSetRefreshLockDetailWithType>()
|
||||
.listen((event) {
|
||||
if (event.type == 0) {
|
||||
// 0考勤
|
||||
state.isAttendance.value = int.parse(event.setResult);
|
||||
state.keyInfos.value.lockSetting!.attendance = int.parse(event.setResult);
|
||||
state.keyInfos.value.lockSetting!.attendance =
|
||||
int.parse(event.setResult);
|
||||
} else if (event.type == 1) {
|
||||
// 1 开锁时是否需联网
|
||||
state.isOpenLockNeedOnline.value = int.parse(event.setResult);
|
||||
state.keyInfos.value.lockSetting!.appUnlockOnline = int.parse(event.setResult);
|
||||
state.lockNetToken = "";// 改变开锁时是否联网状态的时候清空token
|
||||
state.keyInfos.value.lockSetting!.appUnlockOnline =
|
||||
int.parse(event.setResult);
|
||||
state.lockNetToken = ""; // 改变开锁时是否联网状态的时候清空token
|
||||
} else if (event.type == 2) {
|
||||
// 2 常开模式
|
||||
state.isOpenPassageMode.value = int.parse(event.setResult);
|
||||
@ -562,7 +581,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired ||
|
||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted ||
|
||||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) {
|
||||
text = "${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
||||
text =
|
||||
"${"你的钥匙".tr}${XSConstantMacro.getKeyStatusStr(state.keyInfos.value.keyStatus!)}";
|
||||
} else {
|
||||
text = state.isOpenPassageMode.value == 1
|
||||
? "常开模式启动!长按闭锁".tr
|
||||
@ -587,5 +607,4 @@ class LockDetailLogic extends BaseGetXController {
|
||||
await PermissionDialog.request(Permission.location);
|
||||
await PermissionDialog.requestBluetooth();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
|
||||
import 'package:star_lock/tools/aliyunRealNameAuth/aliyunRealNameAuthHandle.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/widget/flavors_img.dart';
|
||||
|
||||
@ -147,23 +146,35 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Obx(() {
|
||||
return Column(
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
xhjInfoView(),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
labelText('images/icon_slider_horizontal.png', '功能'.tr, () {
|
||||
Get.to(LockDetailListPage(
|
||||
title: '功能'.tr, items: getBottomWidget()));
|
||||
}),
|
||||
labelText('images/icon_puzzlepiece_extension.png', '配件'.tr, () {
|
||||
Get.to(LockDetailListPage(
|
||||
title: '配件'.tr, items: getAttachmentWidget()));
|
||||
}),
|
||||
],
|
||||
),
|
||||
xhjInfoView(),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
labelText('images/icon_slider_horizontal.png', '功能'.tr, () {
|
||||
Get.to(
|
||||
LockDetailListPage(title: '功能'.tr, items: getBottomWidget()));
|
||||
}),
|
||||
labelText('images/icon_puzzlepiece_extension.png', '配件'.tr, () {
|
||||
Get.to(LockDetailListPage(
|
||||
title: '配件'.tr, items: getAttachmentWidget()));
|
||||
}),
|
||||
Visibility(
|
||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
child: _unlockSuccessWidget()),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
@ -182,7 +193,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: Offset(0, 0),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 10.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
@ -257,7 +268,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
offset: Offset(0, 0),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 10.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
@ -449,19 +460,11 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
),
|
||||
Visibility(
|
||||
visible: state.iSClosedUnlockSuccessfulPopup.value,
|
||||
// visible: true,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
child: _unlockSuccessWidget()),
|
||||
),
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.black.withOpacity(0.3),
|
||||
child: _unlockSuccessWidget()),
|
||||
)
|
||||
]),
|
||||
],
|
||||
@ -631,6 +634,33 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
],
|
||||
),
|
||||
)),
|
||||
Positioned(
|
||||
right: 90.w,
|
||||
bottom: 1,
|
||||
child: Obx(() => Visibility(
|
||||
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1
|
||||
? true
|
||||
: false,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
ShowCupertinoAlertView()
|
||||
.isToRemoteUnLockAlert((idCard, name) {
|
||||
if (state.keyInfos.value.hasGateway != 1) {
|
||||
logic.showToast('附近没有可用网关');
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Align(
|
||||
alignment: const Alignment(0.6, 1),
|
||||
child: FlavorsImg(
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_remoteUnlocking.png',
|
||||
width: 50.w,
|
||||
height: 52.w,
|
||||
),
|
||||
)),
|
||||
))),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -652,7 +682,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
F.sw(defaultCall: () => adminInfoView(), xhjCall: () => SizedBox()),
|
||||
F.sw(
|
||||
defaultCall: () => adminInfoView(),
|
||||
xhjCall: () => const SizedBox()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
@ -691,7 +723,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
if (add) SizedBox(width: 20.w) else SizedBox(width: 40.w),
|
||||
FlavorsImg(
|
||||
child: Image.asset(
|
||||
state.keyInfos.value.remoteEnable == 1
|
||||
state.keyInfos.value.hasGateway == 1
|
||||
? 'images/main/icon_main_remoteUnlocking.png'
|
||||
: 'images/main/icon_main_remoteUnlocking_grey.png',
|
||||
width: 24.w,
|
||||
@ -703,7 +735,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
TranslationLoader.lanKeys!.gatewayDevice!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
color: state.keyInfos.value.remoteEnable == 1
|
||||
color: state.keyInfos.value.hasGateway == 1
|
||||
? AppColors.mainColor
|
||||
: AppColors.btnDisableColor),
|
||||
),
|
||||
@ -1222,36 +1254,54 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
}
|
||||
|
||||
Widget _unlockSuccessWidget() {
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
state.iSOpenLock.value == true
|
||||
? 'images/main/unlocked_bg.png'
|
||||
: 'images/main/locked_bg.png',
|
||||
width: 358.w,
|
||||
height: 348.h,
|
||||
),
|
||||
Positioned(
|
||||
top: (1.sh - ScreenUtil().statusBarHeight * 2) / 2,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
state.keyInfos.value.lockAlias!,
|
||||
style: TextStyle(
|
||||
color: AppColors.placeholderTextColor, fontSize: 24.sp),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
getCurrentFormattedTime(),
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
return Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
state.iSOpenLock.value == true
|
||||
? 'images/main/unlocked_bg.png'
|
||||
: 'images/main/locked_bg.png',
|
||||
width: 358.w,
|
||||
height: 348.h,
|
||||
),
|
||||
Positioned(
|
||||
top: 180.h,
|
||||
left: 55.w,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
state.keyInfos.value.lockAlias!,
|
||||
style: TextStyle(
|
||||
color: AppColors.placeholderTextColor, fontSize: 24.sp),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
getCurrentFormattedTime(),
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
|
||||
)
|
||||
],
|
||||
)),
|
||||
Positioned(
|
||||
top: 288.h,
|
||||
left: 155.w,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: 60.r,
|
||||
height: 60.r,
|
||||
color: Colors.transparent,
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import 'dart:typed_data';
|
||||
import 'package:crypto/crypto.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/blue_manage.dart';
|
||||
@ -16,10 +17,11 @@ import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||
import 'package:star_lock/blue/sender_manage.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_logic.dart';
|
||||
import 'package:star_lock/permission/permission_dialog.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
|
||||
import '../../../../app_settings/app_settings.dart';
|
||||
import 'lockEscalation_state.dart';
|
||||
@ -67,7 +69,15 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
}
|
||||
String md5Str = md5.convert(otaBin!).toString();
|
||||
headJson!['fwMd5'] = md5Str;
|
||||
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
|
||||
ShowTipView().showIosTipWithContentDialog("升级过程中无法开锁,请先开锁后再升级".tr,
|
||||
() async {
|
||||
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
|
||||
EasyLoading.show(
|
||||
status: '设备连接中...'.tr, maskType: EasyLoadingMaskType.black);
|
||||
Future.delayed(const Duration(seconds: 4), () {
|
||||
EasyLoading.dismiss();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//蓝牙操作 ota 升级
|
||||
@ -217,7 +227,7 @@ class LockEscalationLogic extends BaseGetXController {
|
||||
Uint8List bin = data.sublist(binOffset.toInt(), data.length);
|
||||
//md5 校验有问题,暂时不解析
|
||||
String md5Str = md5.convert(bin).toString().toUpperCase();
|
||||
AppLog.log('---> $md5Str ${meta['fwMd5']}');
|
||||
AppLog.log('固件 md5 检验md5:$md5Str 固件信息 md5:${meta['fwMd5']}');
|
||||
if (md5Str != meta['fwMd5']) {
|
||||
showToast('文件校验失败 0x02'.tr);
|
||||
return null;
|
||||
|
||||
@ -31,136 +31,161 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(30.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(() {
|
||||
return logic.state.otaUpdateIng.value
|
||||
? PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) async {
|
||||
if (logic.state.otaUpdateIng.value) {
|
||||
logic.closeOTADAta();
|
||||
}
|
||||
},
|
||||
child: const SizedBox(),
|
||||
)
|
||||
: const SizedBox();
|
||||
}),
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/main/icon_main_lockSet_lockEscalation.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
||||
"未发现新版本",
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.currentVersion!.tr}:1.0.0",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
Obx(() {
|
||||
return !logic.state.otaUpdateIng.value
|
||||
? SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.upgrade!.tr,
|
||||
onClick: () {})
|
||||
: SizedBox();
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Obx(() {
|
||||
return !logic.state.otaUpdateIng.value
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 8, bottom: 8),
|
||||
// width: Get.width,
|
||||
// child: Center(
|
||||
// child: Text(
|
||||
// // "${TranslationLoader.lanKeys!.newVersion!.tr}:1.0.1",
|
||||
// "未发现新版本",
|
||||
// style: TextStyle(
|
||||
// color: AppColors.mainColor,
|
||||
// fontSize: 18.sp),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
logic.otaUpdate();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'手动升级',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 50.w, vertical: 15.h),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'固件传输中',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10.r)),
|
||||
child: LinearProgressIndicator(
|
||||
value: logic
|
||||
.state.otaProgress.value, // 50% 进度
|
||||
backgroundColor: Colors.grey[200],
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation<Color>(
|
||||
AppColors.mainColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
child: Obx(() {
|
||||
return updateView(logic);
|
||||
}),
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
Widget updateView(LockEscalationLogic logic) {
|
||||
if (logic.state.otaUpdateIng.value) {
|
||||
return otaUpdate(logic);
|
||||
}
|
||||
return defaultUpdate(logic);
|
||||
}
|
||||
|
||||
//升级
|
||||
Widget defaultUpdate(LockEscalationLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/main/icon_main_lockSet_lockEscalation.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
// TranslationLoader.lanKeys!.haveNewVersion!.tr,
|
||||
"未发现新版本",
|
||||
style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.currentVersion!.tr}:1.0.0",
|
||||
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
Obx(() {
|
||||
return !logic.state.otaUpdateIng.value
|
||||
? SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.upgrade!.tr,
|
||||
onClick: () {})
|
||||
: SizedBox();
|
||||
}),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
logic.otaUpdate();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'手动升级'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
//ota升级
|
||||
Widget otaUpdate(LockEscalationLogic logic) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
'${'机型'.tr}:${logic.headJson?['platform']}-${logic.headJson?['product']}',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 22.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
'${'硬件版本'.tr}:${logic.headJson?['hwVersion']}',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 22.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
'${'固件版本'.tr}:${logic.headJson?['fwVersion']}',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 22.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
'传输期间请勿离开当前页面'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.h),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'固件传输中',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.r)),
|
||||
child: LinearProgressIndicator(
|
||||
value: logic.state.otaProgress.value, // 50% 进度
|
||||
backgroundColor: Colors.grey[200],
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmType_logic.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.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';
|
||||
@ -249,13 +250,17 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))),
|
||||
Obx(() => Visibility(
|
||||
visible: CommonDataManage().currentKeyInfo.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
child: CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: Obx(() => _isAdmin()))))),
|
||||
SizedBox(height: 30.h),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||
@ -329,7 +334,7 @@ class _AddPalmTypePageState extends State<AddPalmTypePage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -7,7 +7,7 @@ class AddPalmTypeState {
|
||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
||||
final isStressFingerprint = false.obs;
|
||||
final isAdministrator = false.obs; // 是否是管理员
|
||||
final isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
var beginTime = "".obs; // 开始时间
|
||||
var endTime = "".obs; // 结束时间
|
||||
|
||||
@ -25,7 +25,8 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
||||
State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState();
|
||||
}
|
||||
|
||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with RouteAware {
|
||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
|
||||
with RouteAware {
|
||||
final logic = Get.put(PasswordKeyDetailLogic());
|
||||
final state = Get.find<PasswordKeyDetailLogic>().state;
|
||||
|
||||
@ -64,13 +65,15 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||
rightTitle: state.keyboardPwd.value,
|
||||
isHaveDirection: state.itemData.value.isCustom! == 1 ? true : false,
|
||||
isHaveDirection:
|
||||
state.itemData.value.isCustom! == 1 ? true : false,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
if (state.itemData.value.isCustom! != 1) {
|
||||
return;
|
||||
} else {
|
||||
showCupertinoAlertDialog(context, state.inputPwdController);
|
||||
showCupertinoAlertDialog(
|
||||
context, state.inputPwdController);
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -86,31 +89,37 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
leftTitel: "有效期",
|
||||
rightTitle: logic.getUseDateStr(),
|
||||
isHaveLine: state.isCirculation.value,
|
||||
isHaveDirection: state.itemData.value.isCustom! == 1 ? true : false,
|
||||
isHaveDirection:
|
||||
state.itemData.value.isCustom! == 1 ? true : false,
|
||||
allHeight:
|
||||
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
|
||||
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
|
||||
action: () async {
|
||||
if (state.itemData.value.isCustom! != 1) {
|
||||
return;
|
||||
}
|
||||
var backData = await Get.toNamed(Routers.passwordKeyDetailChangeDatePage, arguments: {
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
var backData = await Get.toNamed(
|
||||
Routers.passwordKeyDetailChangeDatePage,
|
||||
arguments: {
|
||||
'itemData': state.itemData.value,
|
||||
});
|
||||
if (backData != null) {
|
||||
state.itemData.value.startDate = int.parse(backData["beginTimeTimestamp"])*1000;
|
||||
state.itemData.value.endDate = int.parse(backData["endTimeTimestamp"])*1000;
|
||||
state.itemData.value.startDate =
|
||||
int.parse(backData["beginTimeTimestamp"]) * 1000;
|
||||
state.itemData.value.endDate =
|
||||
int.parse(backData["endTimeTimestamp"]) * 1000;
|
||||
// 改了日期之后,永久只能改限时的
|
||||
state.itemData.value.keyboardPwdType = 3;
|
||||
setState(() {});
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.isCirculation.value,
|
||||
child: CommonItem(
|
||||
leftTitel: "结束时间",
|
||||
rightTitle: DateTool().dateToYMDHNString(state.itemData.value.endDate.toString()),
|
||||
isHaveLine: true),
|
||||
)),
|
||||
visible: state.isCirculation.value,
|
||||
child: CommonItem(
|
||||
leftTitel: "结束时间",
|
||||
rightTitle: DateTool().dateToYMDHNString(
|
||||
state.itemData.value.endDate.toString()),
|
||||
isHaveLine: true),
|
||||
)),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||
@ -123,19 +132,20 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
action: () {}),
|
||||
Container(height: 10.h),
|
||||
Obx(() => Visibility(
|
||||
visible: state.itemData.value.isCustom! == 1,
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isAdmin())),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
),
|
||||
)),
|
||||
visible: state.itemData.value.isCustom! == 1,
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdmin())),
|
||||
Container(height: 10.h),
|
||||
],
|
||||
),
|
||||
)),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
|
||||
rightTitle: "",
|
||||
@ -223,7 +233,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, (){
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () {
|
||||
state.isDeletPasswordKey.value = true;
|
||||
logic.senderCustomPasswords();
|
||||
});
|
||||
@ -233,7 +243,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
));
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
@ -241,9 +251,9 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isAdministrator.value,
|
||||
onChanged: (value) {
|
||||
state.isAdministrator.value = value;
|
||||
state.isDeletPasswordKey.value = false;
|
||||
logic.senderCustomPasswords();
|
||||
// state.isAdministrator.value = value;
|
||||
// state.isDeletPasswordKey.value = false;
|
||||
// logic.senderCustomPasswords();
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -251,7 +261,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
//发送时间
|
||||
String getSenderDate(PasswordKeyListItem indexEntity) {
|
||||
String senderDate = '';
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
DateTime dateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||
return senderDate;
|
||||
}
|
||||
@ -265,28 +276,33 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
title: inputController == state.inputNameController
|
||||
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}"
|
||||
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
tipTitle: inputController.text.isNotEmpty ? inputController.text : "请输入6-9位密码",
|
||||
tipTitle: inputController.text.isNotEmpty
|
||||
? inputController.text
|
||||
: "请输入6-9位密码",
|
||||
controller: inputController,
|
||||
keyboardType: inputController == state.inputNameController
|
||||
? TextInputType.text
|
||||
: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(inputController == state.inputNameController ? 50 : 9),
|
||||
],
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.deny('\n'),
|
||||
LengthLimitingTextInputFormatter(
|
||||
inputController == state.inputNameController ? 50 : 9),
|
||||
],
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if(inputController == state.inputPwdController){
|
||||
if (inputController.text.isEmpty || inputController.text.length < 6 || inputController.text.length > 9) {
|
||||
if (inputController == state.inputPwdController) {
|
||||
if (inputController.text.isEmpty ||
|
||||
inputController.text.length < 6 ||
|
||||
inputController.text.length > 9) {
|
||||
logic.showToast("请输入6-9位密码");
|
||||
return;
|
||||
}
|
||||
}
|
||||
state.isDeletPasswordKey.value = false;
|
||||
if(inputController == state.inputNameController){
|
||||
if (inputController == state.inputNameController) {
|
||||
// 修改密码名称
|
||||
logic.updatePwdRequest(1);
|
||||
}else{
|
||||
} else {
|
||||
// 修改密码
|
||||
logic.senderCustomPasswords();
|
||||
}
|
||||
@ -386,13 +402,13 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -404,7 +420,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with Rout
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -335,18 +335,22 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
|
||||
// 自定义是管理员密码
|
||||
Widget keyIfAdministratorWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
// SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdministrator()))),
|
||||
SizedBox(height: 10.h),
|
||||
],
|
||||
return Visibility(
|
||||
visible:
|
||||
CommonDataManage().currentKeyInfo.isLockOwner == 1 ? true : false,
|
||||
child: Column(
|
||||
children: [
|
||||
// SizedBox(height: 10.h),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否为管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdministrator()))),
|
||||
SizedBox(height: 10.h),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -629,7 +633,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
// 是否为管理员
|
||||
CupertinoSwitch _isAdministrator() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -12,7 +12,7 @@ class PasswordKeyPerpetualState {
|
||||
final isPermanent = true.obs; //是否永久
|
||||
var getPwdStr = ''.obs;
|
||||
var pwdNameStr = '';
|
||||
final isAdministrator = false.obs; // 是否是管理员
|
||||
final isAdministrator = false.obs; // 是否为管理员
|
||||
|
||||
var beginTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 开始时间
|
||||
var endTime = DateTool().getNowDateWithType(3).obs; //默认为当前时间 结束时间
|
||||
|
||||
@ -130,6 +130,7 @@ class LockListInfoItemEntity {
|
||||
Bluetooth? bluetooth;
|
||||
LockFeature? lockFeature;
|
||||
LockSetting? lockSetting;
|
||||
int? hasGateway;
|
||||
|
||||
LockListInfoItemEntity(
|
||||
{this.keyId,
|
||||
@ -163,7 +164,8 @@ class LockListInfoItemEntity {
|
||||
this.isOnlyManageSelf,
|
||||
this.restoreCount,
|
||||
this.model,
|
||||
this.vendor});
|
||||
this.vendor,
|
||||
this.hasGateway});
|
||||
|
||||
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
|
||||
keyId = json['keyId'];
|
||||
@ -204,6 +206,7 @@ class LockListInfoItemEntity {
|
||||
lockSetting = json['lockSetting'] != null
|
||||
? LockSetting.fromJson(json['lockSetting'])
|
||||
: null;
|
||||
hasGateway = json['hasGateway'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -246,6 +249,7 @@ class LockListInfoItemEntity {
|
||||
if (lockSetting != null) {
|
||||
data['lockSetting'] = lockSetting!.toJson();
|
||||
}
|
||||
data['hasGateway'] = hasGateway;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/debug/debug_tool.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_tool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
class AboutConsole extends GetxController {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
@ -11,14 +10,10 @@ import 'package:rxdart/rxdart.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
|
||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||
import 'package:star_lock/blue/sender_data.dart';
|
||||
import 'package:star_lock/blue/sender_manage.dart';
|
||||
import 'package:star_lock/debug/log.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/mine/about/debug/log.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
@ -4,11 +4,10 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:star_lock/mine/about/debug/controller.dart';
|
||||
import 'package:star_lock/mine/about/debug/log.dart';
|
||||
import 'package:star_lock/mine/about/debug/tile.dart';
|
||||
|
||||
import 'package:star_lock/debug/controller.dart';
|
||||
import 'package:star_lock/debug/log.dart';
|
||||
import 'package:star_lock/debug/tile.dart';
|
||||
import 'package:star_lock/debug/utils/scrollable.dart';
|
||||
|
||||
/// # Debug Console
|
||||
///
|
||||
@ -1,7 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/debug/controller.dart';
|
||||
import 'package:star_lock/debug/debug_console.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_console.dart';
|
||||
|
||||
class DeBug {
|
||||
static void log(String message, {String? tag}) {
|
||||
@ -24,7 +25,15 @@ class DeBug {
|
||||
offset.value += details.delta;
|
||||
},
|
||||
child: FloatingActionButton(
|
||||
child: Icon(Icons.bug_report),
|
||||
backgroundColor: AppColors.mainColor,
|
||||
shape: ContinuousRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.r)),
|
||||
side: BorderSide(color: Colors.white, width: 2.w),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.bug_report,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
if (openInfo) {
|
||||
Get.back();
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:star_lock/debug/controller.dart';
|
||||
import 'package:star_lock/debug/debug_console.dart';
|
||||
import 'package:star_lock/mine/about/debug/controller.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_console.dart';
|
||||
|
||||
/// A widget that adds a floating button for debugging purposes.
|
||||
class DebugConsolePopup extends StatefulWidget {
|
||||
@ -4,8 +4,8 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/debug/debug_tool.dart';
|
||||
import 'package:star_lock/debug/log.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_tool.dart';
|
||||
import 'package:star_lock/mine/about/debug/log.dart';
|
||||
|
||||
class DebugConsoleTile extends StatefulWidget {
|
||||
final DebugConsoleLog log;
|
||||
@ -4,8 +4,8 @@ import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/mine/addLock/addLock/addLock_state.dart';
|
||||
import 'package:star_lock/permission/permission_dialog.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
|
||||
|
||||
class AddLockLogic extends BaseGetXController {
|
||||
|
||||
@ -10,7 +10,7 @@ import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:amap_flutter_map/amap_flutter_map.dart';
|
||||
import 'package:amap_flutter_base/amap_flutter_base.dart';
|
||||
import 'package:star_lock/permission/permission_dialog.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
|
||||
@ -14,8 +14,8 @@ import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
||||
import 'package:star_lock/mine/addLock/nearbyLock/nearbyLock_page.dart';
|
||||
import 'package:star_lock/permission/permission_dialog.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_settings.dart';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -27,12 +26,17 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(barTitle: TranslationLoader.lanKeys!.addLock!.tr, haveBack:true, backgroundColor: AppColors.mainColor),
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.addLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 80.h,),
|
||||
SizedBox(
|
||||
height: 80.h,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 50.w, right: 50.w),
|
||||
width: 1.sw,
|
||||
@ -40,22 +44,29 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500))
|
||||
),
|
||||
child: Text(
|
||||
TranslationLoader
|
||||
.lanKeys!.addSuccessfullyPleaseRename!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, fontWeight: FontWeight.w500))),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 80.h,),
|
||||
SizedBox(
|
||||
height: 80.h,
|
||||
),
|
||||
Container(
|
||||
height: 80.h,
|
||||
// color: Colors.red,
|
||||
padding: EdgeInsets.only(left: 50.w, right: 50.w),
|
||||
child: TextField(
|
||||
controller: state.aliNameController,
|
||||
onChanged: (v){
|
||||
focusNode: state.focusNode,
|
||||
autofocus: true,
|
||||
controller: state.aliNameController,
|
||||
onChanged: (v) {
|
||||
state.aliName.value = v;
|
||||
},
|
||||
textAlign:TextAlign.center,
|
||||
textAlign: TextAlign.center,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(32),
|
||||
],
|
||||
@ -63,58 +74,44 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
decoration: InputDecoration(
|
||||
hintText: '请填写信息'.tr,
|
||||
hintStyle: TextStyle(
|
||||
// height: 1.1,
|
||||
// height: 1.1,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: const Color(0xFF999999)
|
||||
),
|
||||
color: const Color(0xFF999999)),
|
||||
border: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.h)),
|
||||
///用来配置边框的样式
|
||||
borderSide: BorderSide(
|
||||
///设置边框的颜色
|
||||
color: AppColors.mainColor,
|
||||
///设置边框的粗细
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
///用来配置输入框获取焦点时的颜色
|
||||
focusedBorder: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.h)),
|
||||
///用来配置边框的样式
|
||||
borderSide: BorderSide(
|
||||
///设置边框的颜色
|
||||
color: AppColors.mainColor,
|
||||
///设置边框的粗细
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
)),
|
||||
),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
SizedBox(height: 120.h,),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(
|
||||
left: 50.w,
|
||||
right: 50.w,
|
||||
// top: 30.w,
|
||||
// bottom: 30.w
|
||||
left: 50.w,
|
||||
right: 50.w,
|
||||
// top: 30.w,
|
||||
// bottom: 30.w
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 25.w,
|
||||
bottom: 25.w
|
||||
),
|
||||
onClick: (){
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
logic.addUserConnectBlue();
|
||||
}
|
||||
),
|
||||
}),
|
||||
],
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@ -130,6 +127,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
/// 取消路由订阅
|
||||
state.focusNode.unfocus();
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
super.dispose();
|
||||
BlueManage().stopScan();
|
||||
|
||||
@ -7,12 +7,12 @@ import 'package:get/get.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
|
||||
class SaveLockState {
|
||||
|
||||
var aliName = ''.obs;
|
||||
var pwdTimestamp= 0.obs;
|
||||
var pwdTimestamp = 0.obs;
|
||||
var addressInfo = {}.obs;
|
||||
|
||||
TextEditingController aliNameController = TextEditingController();
|
||||
FocusNode focusNode = FocusNode();
|
||||
|
||||
var lockUserNo = 0;
|
||||
var lockInfo = {};
|
||||
@ -22,15 +22,16 @@ class SaveLockState {
|
||||
var isFromMap = 0; // 0:不是从地图界面进入 1:从地图界面进入
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0可点击 1 不可点击
|
||||
var sureBtnState = 0.obs; // 0可点击 1 不可点击
|
||||
|
||||
// 管理员密码
|
||||
// var adminPasswordTF = TextEditingController();
|
||||
var adminPasswordTF = TextEditingController();
|
||||
|
||||
var adminPassword = '';
|
||||
var lockId = 0;
|
||||
|
||||
SaveLockState() {
|
||||
aliName.value = BlueManage().connectDeviceName;
|
||||
aliName.value = BlueManage().connectDeviceName;
|
||||
aliNameController.text = aliName.value;
|
||||
adminPassword = getAdminPassword();
|
||||
|
||||
@ -53,4 +54,5 @@ class SaveLockState {
|
||||
var number = rng.nextInt(900000) + 100000; // 生成 100000 到 999999 之间的随机整数
|
||||
return number.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:fluwx/fluwx.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
|
||||
import 'package:star_lock/mine/mall/lockMall_entity.dart';
|
||||
import 'package:star_lock/mine/mall/lockMall_state.dart';
|
||||
import 'package:star_lock/mine/mall/webview/webview_logic.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/pay/wx_pay_tool.dart';
|
||||
import 'package:star_lock/webview/webview_logic.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
import '../../app_settings/app_settings.dart';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/webview/webview_logic.dart';
|
||||
import 'package:star_lock/mine/mall/webview/webview_logic.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class LockMallState {
|
||||
|
||||
@ -6,7 +6,7 @@ import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
|
||||
import 'package:star_lock/permission/permission_dialog.dart';
|
||||
import 'package:star_lock/widget/permission/permission_dialog.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
@ -23,14 +24,15 @@ class AuthorizedAdministratorListPage extends StatefulWidget {
|
||||
_AuthorizedAdministratorListPageState();
|
||||
}
|
||||
|
||||
class _AuthorizedAdministratorListPageState extends State<AuthorizedAdministratorListPage> {
|
||||
class _AuthorizedAdministratorListPageState
|
||||
extends State<AuthorizedAdministratorListPage> {
|
||||
final logic = Get.put(AuthorizedAdministratorListLogic());
|
||||
final state = Get.find<AuthorizedAdministratorListLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest().then((AuthorizedAdminListEntity value){
|
||||
logic.mockNetworkDataRequest().then((AuthorizedAdminListEntity value) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
@ -60,7 +62,9 @@ class _AuthorizedAdministratorListPageState extends State<AuthorizedAdministrato
|
||||
),
|
||||
onPressed: () {
|
||||
// 处理操作按钮的点击事件
|
||||
Navigator.pushNamed(context, Routers.addAuthorizedAdministratorPage).then((value) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.addAuthorizedAdministratorPage)
|
||||
.then((value) {
|
||||
setState(() {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
@ -71,119 +75,98 @@ class _AuthorizedAdministratorListPageState extends State<AuthorizedAdministrato
|
||||
],
|
||||
),
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
// _searchWidget(),
|
||||
Expanded(child: _buildMainUI()),
|
||||
],
|
||||
)),
|
||||
onRefresh: () {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
},
|
||||
onLoad: () {
|
||||
getHttpData();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
// _searchWidget(),
|
||||
Expanded(child: _buildMainUI()),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _searchWidget() {
|
||||
// return Container(
|
||||
// height: 60.h,
|
||||
// margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
// child: TextField(
|
||||
// //输入框一行
|
||||
// maxLines: 1,
|
||||
// // controller: _controller,
|
||||
// autofocus: false,
|
||||
//
|
||||
// decoration: InputDecoration(
|
||||
// //输入里面输入文字内边距设置
|
||||
// contentPadding: const EdgeInsets.only(
|
||||
// top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||
// hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||
// hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
|
||||
// //不需要输入框下划线
|
||||
// border: InputBorder.none,
|
||||
// //左边图标设置
|
||||
// icon: Padding(
|
||||
// padding: EdgeInsets.only(
|
||||
// top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
|
||||
// child: Image.asset(
|
||||
// 'images/main/icon_main_search.png',
|
||||
// width: 40.w,
|
||||
// height: 40.w,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => state.itemDataList.value.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
? NoData(
|
||||
noDataHeight: 1.sh -
|
||||
ScreenUtil().statusBarHeight -
|
||||
ScreenUtil().bottomBarHeight -
|
||||
190.h -
|
||||
64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
AuthorizedAdminListItem authorizedAdminListItem = state.itemDataList.value[index];
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
AuthorizedAdminListItem authorizedAdminListItem =
|
||||
state.itemDataList.value[index];
|
||||
|
||||
return Slidable(
|
||||
key:ValueKey(authorizedAdminListItem.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
logic.deleteAdministratorRequest(authorizedAdminListItem.uid.toString(), isAllData ? 1 : 0);
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
return Slidable(
|
||||
key: ValueKey(authorizedAdminListItem.uid),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) {
|
||||
ShowTipView()
|
||||
.showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
logic.deleteAdministratorRequest(
|
||||
authorizedAdminListItem.uid.toString(),
|
||||
isAllData ? 1 : 0);
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(authorizedAdminListItem),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
child: _electronicKeyItem(authorizedAdminListItem),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
));
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(AuthorizedAdminListItem itemData) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.administratorDetailsPage, arguments: {'itemData': itemData}).then((value) {
|
||||
setState(() {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
onTap: () async {
|
||||
//高级功能
|
||||
var isVip = await Storage.getBool(saveIsVip);
|
||||
if (isVip == true) {
|
||||
Get.toNamed(Routers.administratorDetailsPage,
|
||||
arguments: {'itemData': itemData})?.then((value) {
|
||||
setState(() {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
ShowCupertinoAlertView().advancedFeatureAlert();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: 100.h,
|
||||
color: Colors.white,
|
||||
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
// decoration: const BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(10.w),
|
||||
// ),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w,),
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset('images/controls_user.png', width: 60.w, height: 60.w),
|
||||
SizedBox(width: 20.w),
|
||||
Expanded(
|
||||
@ -193,24 +176,18 @@ class _AuthorizedAdministratorListPageState extends State<AuthorizedAdministrato
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
// Text(
|
||||
// itemData.name ?? '',
|
||||
// style: TextStyle(
|
||||
// fontSize: 24.sp, color: AppColors.blackColor),
|
||||
// ),
|
||||
SizedBox(
|
||||
width: 1.sw - 110.w - 100.w,
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
itemData.name ?? '',
|
||||
child: Text(itemData.name ?? '',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor)),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -243,5 +220,4 @@ class _AuthorizedAdministratorListPageState extends State<AuthorizedAdministrato
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/weChatQRCodeEntity.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/showCupertinoAlertView.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
|
||||
@ -85,7 +85,7 @@ class MineSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
void showQRImageAlert(String qrCodeUrl, BuildContext widgetContext) {
|
||||
AppFirstEnterHandle().showQRImageAlert(widgetContext, qrCodeUrl);
|
||||
ShowCupertinoAlertView().showQRImageAlert(widgetContext, qrCodeUrl);
|
||||
}
|
||||
|
||||
//退出登录请求
|
||||
|
||||
@ -5,12 +5,12 @@ import 'package:fluwx/fluwx.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mall/webview/webview_logic.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/pay/wx_pay_tool.dart';
|
||||
import 'package:star_lock/webview/webview_logic.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
@ -23,8 +23,8 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
AdvancedFeaturesWebEntity entity =
|
||||
await ApiRepository.to.getServicePackageBuyUrl();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.vipBuyUrl.value = state.isShop.value == true
|
||||
? entity.data!.shopList!
|
||||
state.vipBuyUrl.value = state.isVipShop.value == true
|
||||
? entity.data!.vipBuyUrl!
|
||||
: entity.data!.cloudauthBuyUrl!;
|
||||
state.vipBuyWebView.setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
|
||||
@ -32,8 +32,9 @@ class _AdvancedFeaturesWebPageState extends State<AdvancedFeaturesWebPage> {
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
logic.state.isShop.value == true ? '高级功能'.tr : '实名认证'.tr,
|
||||
barTitle: logic.state.isVipShop.value == true
|
||||
? '高级功能'.tr
|
||||
: '实名认证'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
backAction: () => logic.canGoBack(false),
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/webview/webview_logic.dart';
|
||||
import 'package:star_lock/mine/mall/webview/webview_logic.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class AdvancedFeaturesWebState {
|
||||
@ -8,7 +8,7 @@ class AdvancedFeaturesWebState {
|
||||
var webProgress = 0.0.obs;
|
||||
bool allowReturn = true;
|
||||
late WebViewController vipBuyWebView = initWebViewController();
|
||||
var isShop = true.obs; //是否为高级功能购买页面
|
||||
var isVipShop = true.obs; //是否为高级功能购买页面
|
||||
bool canGoBack = false;
|
||||
|
||||
//初始化webView控制器
|
||||
@ -23,7 +23,7 @@ class AdvancedFeaturesWebState {
|
||||
AdvancedFeaturesWebState() {
|
||||
Map map = Get.arguments;
|
||||
if (map['isShop'] != null) {
|
||||
isShop.value = map['isShop'];
|
||||
isVipShop.value = map['isShop'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_page.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_xhj_page.dart';
|
||||
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart';
|
||||
import 'package:star_lock/mine/about/debug/debug_tool.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/debug/debug_tool.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../main/lockMian/lockMain/lockMain_page.dart';
|
||||
@ -31,7 +30,6 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
AppFirstEnterHandle().getAppFirstEnter(context, isAgreePrivacy);
|
||||
getAgreePrivacyShowUpdate();
|
||||
|
||||
return FutureBuilder<bool>(
|
||||
@ -48,6 +46,8 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
xhjCall: () => const StarLockMainXHJPage());
|
||||
} else {
|
||||
// 如果用户未登录,返回登录页面
|
||||
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
|
||||
|
||||
return F.sw(
|
||||
defaultCall: () => const StarLockLoginPage(),
|
||||
xhjCall: () => const StarLockLoginXHJPage());
|
||||
@ -73,7 +73,7 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
Future<void> getAgreePrivacyShowUpdate() async {
|
||||
final data = await Storage.getString(isAgreePrivacy);
|
||||
if (data == isAgreePrivacy) {
|
||||
AppFirstEnterHandle().getAppFirstEnter(context, isShowUpdateVersion);
|
||||
AppFirstEnterHandle().getAppFirstEnter(isShowUpdateVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ import 'dart:io';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
@ -14,24 +13,24 @@ import 'package:star_lock/tools/storage.dart';
|
||||
import '../versionUndate/versionUndateTool.dart';
|
||||
|
||||
class AppFirstEnterHandle {
|
||||
Future getAppFirstEnter(BuildContext widgetContext, String flagStr) async {
|
||||
Future getAppFirstEnter(String flagStr) async {
|
||||
var getFlag = await Storage.getString(flagStr);
|
||||
switch (flagStr) {
|
||||
case isAgreePrivacy: // 隐私协议
|
||||
{
|
||||
if (getFlag != isAgreePrivacy) {
|
||||
showPrivacyAgreementAlert(widgetContext);
|
||||
showPrivacyAgreementAlert();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case isAgreePosition: // 位置权限
|
||||
{
|
||||
if (getFlag != isAgreePosition) showPositionAlert(widgetContext);
|
||||
if (getFlag != isAgreePosition) showPositionAlert();
|
||||
}
|
||||
break;
|
||||
case isAgreeCamera: // 相机权限
|
||||
{
|
||||
if (getFlag != isAgreeCamera) showCameraAlert(widgetContext);
|
||||
if (getFlag != isAgreeCamera) showCameraAlert();
|
||||
}
|
||||
break;
|
||||
case isShowUpdateVersion: // 版本更新
|
||||
@ -45,9 +44,9 @@ class AppFirstEnterHandle {
|
||||
}
|
||||
|
||||
//隐私协议弹窗
|
||||
void showPrivacyAgreementAlert(BuildContext widgetContext) {
|
||||
void showPrivacyAgreementAlert() {
|
||||
showCupertinoDialog(
|
||||
context: widgetContext,
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
@ -118,7 +117,7 @@ class AppFirstEnterHandle {
|
||||
onPressed: () {
|
||||
Storage.setString(isAgreePrivacy, isAgreePrivacy);
|
||||
Navigator.of(context).pop();
|
||||
getAppFirstEnter(context, isShowUpdateVersion);
|
||||
getAppFirstEnter(isShowUpdateVersion);
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -188,7 +187,7 @@ class AppFirstEnterHandle {
|
||||
onPressed: () {
|
||||
Storage.setString(isAgreePrivacy, isAgreePrivacy);
|
||||
Navigator.of(context).pop();
|
||||
getAppFirstEnter(context, isShowUpdateVersion);
|
||||
getAppFirstEnter(isShowUpdateVersion);
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -196,9 +195,9 @@ class AppFirstEnterHandle {
|
||||
}
|
||||
|
||||
//位置权限弹窗
|
||||
void showPositionAlert(BuildContext widgetContext) {
|
||||
void showPositionAlert() {
|
||||
showCupertinoDialog(
|
||||
context: widgetContext,
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
@ -226,9 +225,9 @@ class AppFirstEnterHandle {
|
||||
}
|
||||
|
||||
//相机权限弹窗
|
||||
void showCameraAlert(BuildContext widgetContext) {
|
||||
void showCameraAlert() {
|
||||
showCupertinoDialog(
|
||||
context: widgetContext,
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
@ -255,55 +254,6 @@ class AppFirstEnterHandle {
|
||||
);
|
||||
}
|
||||
|
||||
//微信公众号二维码弹窗
|
||||
void showQRImageAlert(BuildContext widgetContext, String qrCodeUrl) {
|
||||
showCupertinoModalPopup(
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoActionSheet(
|
||||
actions: [
|
||||
Container(
|
||||
color: Colors.white, // 设置底色为白色
|
||||
child: CupertinoActionSheetAction(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
),
|
||||
Image.network(
|
||||
qrCodeUrl,
|
||||
width: 400.w,
|
||||
height: 400.w,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 60.w, right: 60.w),
|
||||
child: Text(
|
||||
'开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置'.tr,
|
||||
style:
|
||||
TextStyle(fontSize: 24.sp, color: Colors.black),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// _launchURL(String url) async {
|
||||
// if (await canLaunchUrl(Uri.parse(url))) {
|
||||
// await launchUrl(Uri.parse(url));
|
||||
|
||||
@ -1,13 +1,63 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
|
||||
typedef AuthInfoCallback = void Function(String idCard, String name);
|
||||
typedef AuthInfoCallback = void Function(String? idCard, String? name);
|
||||
|
||||
class ShowCupertinoAlertView {
|
||||
//微信公众号二维码弹窗
|
||||
void showQRImageAlert(BuildContext widgetContext, String qrCodeUrl) {
|
||||
showCupertinoModalPopup(
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoActionSheet(
|
||||
actions: [
|
||||
Container(
|
||||
color: Colors.white, // 设置底色为白色
|
||||
child: CupertinoActionSheetAction(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
),
|
||||
Image.network(
|
||||
qrCodeUrl,
|
||||
width: 400.w,
|
||||
height: 400.w,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 60.w, right: 60.w),
|
||||
child: Text(
|
||||
'开启微信接收报警消息需要先关注斯凯智能锁微信公众号,请保存二维码并使用微信扫一扫设置'.tr,
|
||||
style:
|
||||
TextStyle(fontSize: 24.sp, color: Colors.black),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 60.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//高级功能弹窗
|
||||
void advancedFeatureAlert() {
|
||||
showCupertinoDialog(
|
||||
@ -207,6 +257,10 @@ class ShowCupertinoAlertView {
|
||||
CupertinoDialogAction(
|
||||
onPressed: () {
|
||||
// 在这里处理确认按钮的逻辑
|
||||
if (idCard.isEmpty || name.isEmpty) {
|
||||
EasyLoading.showToast('请输入身份证号和真实姓名'.tr);
|
||||
return;
|
||||
}
|
||||
callback(idCard, name);
|
||||
Get.back();
|
||||
},
|
||||
@ -220,4 +274,39 @@ class ShowCupertinoAlertView {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//是否要远程开锁弹窗
|
||||
void isToRemoteUnLockAlert(AuthInfoCallback callback) {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Container(),
|
||||
content: Text('是否要远程开锁?'.tr),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Text(
|
||||
'取消'.tr,
|
||||
style: TextStyle(color: AppColors.mainColor),
|
||||
),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
onPressed: () {
|
||||
// 在这里处理确认按钮的逻辑
|
||||
callback(null, null);
|
||||
Get.back();
|
||||
},
|
||||
child: Text(
|
||||
'远程开锁'.tr,
|
||||
style: TextStyle(color: AppColors.mainColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ const saveIsVip = "saveIsVip"; //是否是VIP
|
||||
|
||||
const saveUserLoginData = "userLoginData";
|
||||
const saveLockMainListData = "lockMainListData";
|
||||
const isOpenDeBug = "isOpenDeBug";//是否打开 debug
|
||||
const isOpenDeBug = "isOpenDeBug"; //是否打开 debug
|
||||
|
||||
class Storage {
|
||||
Storage._internal();
|
||||
@ -145,6 +145,12 @@ class Storage {
|
||||
static Future<void> clearAll() async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
sp.clear();
|
||||
|
||||
// 重新设置需要保留的数据
|
||||
if (isAgreePrivacy != null) {
|
||||
//退出登录不清除隐私协议同意状态
|
||||
await setString(isAgreePrivacy, isAgreePrivacy);
|
||||
}
|
||||
}
|
||||
|
||||
static Future<String?> getUid() async {
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class StarInputFormatter extends TextInputFormatter {
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(
|
||||
TextEditingValue oldValue, TextEditingValue newValue) {
|
||||
// 将新输入的文本转换为星号
|
||||
return TextEditingValue(
|
||||
text: '*' * newValue.text.length,
|
||||
selection: TextSelection.collapsed(offset: newValue.text.length),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user