Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
@ -42,7 +42,7 @@
|
||||
<application
|
||||
android:label="star_lock"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
android:icon="@mipmap/ic_logo">
|
||||
<!-- 配置定位Service -->
|
||||
<service android:name="com.amap.api.location.APSService"/>
|
||||
<activity
|
||||
|
||||
|
Before Width: | Height: | Size: 544 B |
BIN
star_lock/android/app/src/main/res/mipmap-hdpi/ic_logo.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
star_lock/android/app/src/main/res/mipmap-ldpi/ic_logo.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 442 B |
BIN
star_lock/android/app/src/main/res/mipmap-mdpi/ic_logo.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 721 B |
BIN
star_lock/android/app/src/main/res/mipmap-xhdpi/ic_logo.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
BIN
star_lock/android/app/src/main/res/mipmap-xxhdpi/ic_logo.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
star_lock/android/app/src/main/res/mipmap-xxxhdpi/ic_logo.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
star_lock/images/main/icon_addFingerprint_fingerprint_five.png
Normal file
|
After Width: | Height: | Size: 361 KiB |
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 336 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 156 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 303 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 182 KiB |
@ -106,7 +106,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
|
||||
itemCount: 2,
|
||||
itemBuilder: (c, index) {
|
||||
return _electronicKeyItem('images/icon_round_unSelet.png', "张三",
|
||||
"2023.6.21 11.15", "2023.6.21 11.15", () {
|
||||
"2023.6.21 11.15", "2023.6.21 11.15", index,() {
|
||||
// Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
|
||||
});
|
||||
},
|
||||
@ -120,7 +120,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
||||
String beginTime, String endTime, Function() action) {
|
||||
String beginTime, String endTime, int index,Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -144,7 +144,7 @@ class _ImportOtherLockDataPageState extends State<ImportOtherLockDataPage> {
|
||||
width: 10.w,
|
||||
),
|
||||
Text(
|
||||
'test锁',
|
||||
'锁${index+1}',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 22.sp,
|
||||
|
||||
@ -57,7 +57,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}解析成功");
|
||||
deletLockInfoData();
|
||||
deletKeyData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
@ -113,7 +113,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
|
||||
deletLockInfoData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
@ -155,7 +155,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
// 删除用户蓝牙协议
|
||||
// 删除用户
|
||||
Future<void> deletUserAction() async {
|
||||
BlueManage().judgeReconnect(
|
||||
BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
|
||||
@ -209,9 +209,9 @@ class LockSetLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
// 删除锁调用后台接口
|
||||
// 当是锁拥有者的时候,删除锁
|
||||
void deletLockInfoData() async {
|
||||
var entity = await ApiRepository.to.deletLockData(
|
||||
var entity = await ApiRepository.to.deletOwnerLockData(
|
||||
lockId: state.getKeyInfosData.value.lockId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -219,13 +219,28 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
// 当不是锁拥有者的时候,删除钥匙
|
||||
void deletKeyData() async {
|
||||
var entity = await ApiRepository.to.deletOwnerKeyData(
|
||||
lockId: state.getKeyInfosData.value.lockId.toString(),
|
||||
keyId: state.getKeyInfosData.value.keyId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Get.offAllNamed(Routers.starLockMain);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询账户密码
|
||||
void checkLoginPassword() async {
|
||||
var entity = await ApiRepository.to.checkLoginPassword(
|
||||
password: state.passwordTF.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
|
||||
if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
factoryDataResetAction();
|
||||
}else{
|
||||
deletKeyData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -449,7 +449,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
onClick: () {
|
||||
// logic.deletUserAction();
|
||||
|
||||
logic.deletLockInfoData();
|
||||
// logic.deletLockInfoData();
|
||||
showDeletAlertDialog(context);
|
||||
// showDeletPasswordAlertDialog(context);
|
||||
}),
|
||||
),
|
||||
@ -521,7 +522,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('创建公司号,考勤功能才能使用'),
|
||||
title: const Text("提示"),
|
||||
content: const Text('创建公司号,考勤功能才能使用'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
@ -543,6 +545,52 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void showDeletAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowIosTipView(
|
||||
// title: "提示",
|
||||
// tipTitle: "删除锁后,所有信息都会一起删除,确定删除锁吗?",
|
||||
// sureClick: () {
|
||||
// Navigator.pop(context);
|
||||
// showDeletPasswordAlertDialog(context);
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: const Text('删除锁后,所有信息都会一起删除,确定删除锁吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
showDeletPasswordAlertDialog(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// void showCupertinoAlertDialog(
|
||||
// BuildContext context,
|
||||
// ) {
|
||||
@ -577,8 +625,12 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
tipTitle: "",
|
||||
controller: state.passwordTF,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (state.passwordTF.text.isNotEmpty) {}
|
||||
//发送删除锁请求
|
||||
if (state.passwordTF.text.isEmpty) {
|
||||
Toast.show(msg: "请输入登录密码");
|
||||
return;
|
||||
}
|
||||
logic.checkLoginPassword();
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
|
||||
@ -423,7 +423,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
privateKey:getPrivateKeyList,
|
||||
);
|
||||
}
|
||||
}, isShowLoading: true);
|
||||
}, isShowLoading: false);
|
||||
}
|
||||
|
||||
void startScanAction(){
|
||||
|
||||
@ -126,7 +126,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
// 注册指纹失败
|
||||
print("${reply.commandType!.typeValue} 注册指纹失败");
|
||||
Toast.show(msg: "添加失败");
|
||||
Get.close(3);
|
||||
Get.close(2);
|
||||
}else{
|
||||
state.addFingerprintProcessNumber.value++;
|
||||
print("state.addFingerprintProcessNumber.value:${state.addFingerprintProcessNumber.value}");
|
||||
@ -334,7 +334,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
||||
}else if(state.fromType.value == 1){
|
||||
eventBus.fire(OtherTypeRefreshListEvent());
|
||||
}
|
||||
Get.close(3);
|
||||
Get.close(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -86,29 +86,32 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> {
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
height: 100.h,
|
||||
),
|
||||
Obx(() => Image.asset(
|
||||
getIconNumber(state.addFingerprintProcessNumber.value),
|
||||
width: 270.w,
|
||||
height: 457.h,
|
||||
width: 185.w,
|
||||
height: 295.h,
|
||||
),),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"根据提示,抬起手指后再进行下一次指纹采集,共4次",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
Container(
|
||||
margin: EdgeInsets.all(10.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"根据提示,抬起手指后再进行下一次指纹采集",
|
||||
// TranslationLoader.lanKeys!.lightTouchScreenTip!.tr,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines:null,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -126,9 +129,9 @@ class _AddFingerprintPageState extends State<AddFingerprintPage> {
|
||||
case 3:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_four.png';
|
||||
break;
|
||||
// case 4:
|
||||
// return 'images/main/icon_addFingerprint_fingerprint_four.png';
|
||||
// break;
|
||||
case 4:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_five.png';
|
||||
break;
|
||||
default:
|
||||
return 'images/main/icon_addFingerprint_fingerprint_one.png';
|
||||
break;
|
||||
|
||||
@ -57,7 +57,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.cardNumber.value = reply.data.last.toString();
|
||||
// state.cardNumber.value = reply.data.last.toString();
|
||||
state.ifConnectScuess.value = true;
|
||||
break;
|
||||
case 0x06:
|
||||
@ -116,7 +116,15 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// print("添加指纹确认成功,调用添加指纹接口");
|
||||
if(state.isCoerced.value == "2"){
|
||||
// 非胁迫指纹
|
||||
addICCardData();
|
||||
int addResultStatus = reply.data[5];
|
||||
if(addResultStatus == 0){
|
||||
// 成功更新序列号
|
||||
state.cardNumber.value = (reply.data[6]+1).toString();
|
||||
addICCardData();
|
||||
}else if(addResultStatus == 255){
|
||||
// 255 自动退出
|
||||
Get.close(2);
|
||||
}
|
||||
}else{
|
||||
// 如果是胁迫指纹在 添加完之后以后再调用添加胁迫指纹的
|
||||
senderAddStressICCard();
|
||||
@ -264,7 +272,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
var entity = await ApiRepository.to.updateIdCardUserNoLoadData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
cardId: cardId,
|
||||
cardUserNo: "0",
|
||||
cardUserNo: state.cardNumber.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Toast.show(msg: "添加成功");
|
||||
|
||||
@ -29,7 +29,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
// 添加指纹开始(重置锁里面所有指纹)
|
||||
if(reply is SenderAddFingerprintReply) {
|
||||
if((reply is SenderAddFingerprintReply) && (state.isDeletFingerprintData.value == true)) {
|
||||
_replyAddFingerprintBegin(reply);
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.isDeletFingerprintData.value = false;
|
||||
deletAllFingerprintsData();
|
||||
break;
|
||||
case 0x06:
|
||||
@ -346,7 +347,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
keyID:"1",
|
||||
userID:"Delete All !@#",
|
||||
userID:"DeleteAll!@#",
|
||||
fingerNo:255,
|
||||
useCountLimit:0,
|
||||
startTime:0x11223344,
|
||||
@ -385,6 +386,7 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
Toast.show(msg: "重置成功");
|
||||
state.isDeletFingerprintData.value = false;
|
||||
getFingerprintsListData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,11 +45,13 @@ class _OtherTypeKeyListPageState extends State<OtherTypeKeyListPage> {
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
state.isDeletICCardData.value = true;
|
||||
logic.deletICCardData();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
// logic.deletAllFingerprintsData();
|
||||
state.isDeletFingerprintData.value = true;
|
||||
logic.senderAddFingerprint();
|
||||
break;
|
||||
case 2:
|
||||
|
||||
@ -8,6 +8,9 @@ class OtherTypeKeyListState{
|
||||
final lockId = 0.obs;
|
||||
final fromType = 0.obs;
|
||||
|
||||
var isDeletFingerprintData = false.obs;
|
||||
var isDeletICCardData = false.obs;
|
||||
|
||||
final fingerprintItemListData = <FingerprintItemData>[].obs;
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
|
||||
@ -228,6 +228,7 @@ class KeyInfos {
|
||||
int? displayPasscode;
|
||||
int? lockId;
|
||||
int? doubleVerification;
|
||||
int? isLockOwner;
|
||||
String? keyName;
|
||||
LockVersion? lockVersion;
|
||||
Bluetooth? bluetooth;
|
||||
@ -283,6 +284,7 @@ class KeyInfos {
|
||||
this.displayPasscode,
|
||||
this.lockId,
|
||||
this.doubleVerification,
|
||||
this.isLockOwner,
|
||||
this.keyName,
|
||||
this.lockVersion,
|
||||
this.lockName,
|
||||
@ -339,6 +341,7 @@ class KeyInfos {
|
||||
displayPasscode = json['displayPasscode'];
|
||||
lockId = json['lockId'];
|
||||
doubleVerification = json['doubleVerification'];
|
||||
isLockOwner = json['isLockOwner'];
|
||||
keyName = json['keyName'];
|
||||
lockVersion = json['lockVersion'] != null
|
||||
? LockVersion.fromJson(json['lockVersion'])
|
||||
@ -401,6 +404,7 @@ class KeyInfos {
|
||||
data['displayPasscode'] = displayPasscode;
|
||||
data['lockId'] = lockId;
|
||||
data['doubleVerification'] = doubleVerification;
|
||||
data['isLockOwner'] = isLockOwner;
|
||||
data['keyName'] = keyName;
|
||||
if (lockVersion != null) {
|
||||
data['lockVersion'] = lockVersion!.toJson();
|
||||
|
||||
@ -313,6 +313,14 @@ class ApiProvider extends BaseProvider {
|
||||
'lockId': lockId,
|
||||
}));
|
||||
|
||||
// 删除拥有的当前钥匙
|
||||
Future<Response> deletOwnerKeyInfo(String lockId, String keyId) => post(
|
||||
deletLockURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'keyId': keyId
|
||||
}));
|
||||
|
||||
// 检查账户密码
|
||||
Future<Response> checkLoginPassword(String password) => post(
|
||||
checkPasswordURL.toUrl,
|
||||
|
||||
@ -328,11 +328,17 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 删除锁
|
||||
Future<LockMainEntity> deletLockData({required String lockId}) async {
|
||||
Future<LockMainEntity> deletOwnerLockData({required String lockId}) async {
|
||||
final res = await apiProvider.deletLockInfo(lockId);
|
||||
return LockMainEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 删除钥匙
|
||||
Future<LockMainEntity> deletOwnerKeyData({required String lockId, required String keyId}) async {
|
||||
final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId);
|
||||
return LockMainEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 检查账户密码
|
||||
Future<LockMainEntity> checkLoginPassword({required String password}) async {
|
||||
final res = await apiProvider.checkLoginPassword(password);
|
||||
|
||||