Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
a0fa267d17
2
star_lock/.docker/.env.example
Normal file
2
star_lock/.docker/.env.example
Normal file
@ -0,0 +1,2 @@
|
||||
FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"
|
||||
PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"
|
||||
1
star_lock/.docker/.gitignore
vendored
Normal file
1
star_lock/.docker/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.env
|
||||
28
star_lock/.docker/README.md
Normal file
28
star_lock/.docker/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# docker持续部署
|
||||
构建镜像来自:https://github.com/MobileDevOps/flutter-sdk-image/
|
||||
|
||||
## 使用方法
|
||||
1. 复制.env文件,并编辑其中的代理设置
|
||||
```bash
|
||||
cp .docker/.env.example .docker/.env
|
||||
```
|
||||
|
||||
2. 构建命令
|
||||
```bash
|
||||
cd <path-to-this-repo>
|
||||
|
||||
# 构建sky版本APK
|
||||
docker run --env-file .docker/.env --rm -it -v .:/home/mobiledevops/app mobiledevops/flutter-sdk-image:3.16.4 \
|
||||
flutter build apk --release --flavor sky -t lib/main_sky_full.dart
|
||||
|
||||
```
|
||||
|
||||
3. 构建完成后,APK文件在build/app/outputs/flutter-apk目录下
|
||||
|
||||
|
||||
## 排除故障
|
||||
测试谷歌连接
|
||||
```bash
|
||||
# flutter以及maven 下载地址是否正常
|
||||
curl -i https://storage.googleapis.com/flutter_infra_release/
|
||||
```
|
||||
@ -23,9 +23,16 @@
|
||||
<!--允许写设备缓存,用于问题排查-->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
|
||||
<!--允许写入扩展存储,用于写入缓存定位数据-->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<!--允许读设备等信息,用于问题排查-->
|
||||
|
||||
<!--相机-->
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
|
||||
<!--允许麦克风权限,用于录音发送-->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
@ -34,6 +41,11 @@
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.REORDER_TASKS"/>
|
||||
|
||||
<!-- 相册权限 34适配 -->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
|
||||
|
||||
|
||||
<application android:label="@string/app_name" android:name="android.app.Application" android:icon="@mipmap/ic_launcher">
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
|
||||
@ -312,7 +312,7 @@
|
||||
"lightTouchScreenTip":"Light Touch Screen Tip",
|
||||
"next":"Next",
|
||||
"nearbyLock":"Nearby Lock",
|
||||
"addSuccessfullyPleaseRename":"Add Successfully Please Rename",
|
||||
"addSuccessfullyPleaseRename":"If you want to change the name, please rename, click OK to add lock",
|
||||
"whenAddingLockThePhoneMustBeNextToTheLock":"When adding a lock, the phone must be next to the lock",
|
||||
|
||||
"login":"Login",
|
||||
@ -538,6 +538,7 @@
|
||||
"清空码": "Clear code",
|
||||
"循环": "Cycle",
|
||||
"工作日": "Workday",
|
||||
"每日": "Daily",
|
||||
"周末": "Weekend",
|
||||
"周一": "Monday",
|
||||
"周二": "Tuesday",
|
||||
@ -548,5 +549,69 @@
|
||||
"周日": "Sunday",
|
||||
"确定要删除吗?": "Are you sure you want to delete?",
|
||||
"该锁的密码都将被删除": "The password of the lock will be deleted",
|
||||
"已过期": "Expired"
|
||||
"已过期": "Expired",
|
||||
"该锁的电子钥匙都将被删除": "The electronic key of the lock will be deleted",
|
||||
"同时删除其发送的所有钥匙,钥匙删除后不能恢复": "Also delete all the keys sent by it, the key can not be restored after deletion",
|
||||
"删除钥匙会在用户APP连网后生效": "Deleting the key will take effect after the user APP is connected to the network",
|
||||
"有效时间": "Effective time",
|
||||
"接收者": "Receiver",
|
||||
"仅管理自己创建的用户": "Only manage users created by yourself",
|
||||
"远程开锁": "Remote unlock",
|
||||
"请输入钥匙名称": "Please enter the key name",
|
||||
"修改成功": "Modify success",
|
||||
"冻结": "Freeze",
|
||||
"取消冻结": "Unfreeze",
|
||||
"授权": "Authorization",
|
||||
"取消授权": "Cancel authorization",
|
||||
"同时解冻其发送的钥匙": "Unfreeze the keys sent by it",
|
||||
"取消冻结会在用户APP连网后生效": "Unfreezing will take effect after the user APP is connected to the network",
|
||||
"同时冻结其发送的钥匙": "Freeze the keys sent by it",
|
||||
"冻结会在用户APP连网后生效": "Freezing will take effect after the user APP is connected to the network",
|
||||
"取消授权会在用户APP连网后生效": "Canceling authorization will take effect after the user APP is connected to the network",
|
||||
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码": "Authorized users have most of the permissions of the administrator, such as sending keys, sending passwords",
|
||||
"失效时间需大于生效时间": "The expiration time must be greater than the effective time",
|
||||
"生效时间需大于当前时间": "The effective time must be greater than the current time",
|
||||
"失效日期要大于生效日期": "The expiration date must be greater than the effective date",
|
||||
"失效时间要大于生效时间": "The expiration time must be greater than the effective time",
|
||||
"修改有效期": "Modify the validity period",
|
||||
"生效日期": "Effective date",
|
||||
"失效日期": "Expiration date",
|
||||
"开锁": "Unlock",
|
||||
"开锁成功": "Unlock success",
|
||||
"请选择锁": "Please select the lock",
|
||||
"请选择接收者": "Please select the receiver",
|
||||
"请选择有效期": "Please select the validity period",
|
||||
"请选择发送方式": "Please select the sending method",
|
||||
"请选择结束时间": "Please select the end time",
|
||||
"完成": "Complete",
|
||||
"有效日": "Effective day",
|
||||
"发送成功": "Send success",
|
||||
"请选择开始时间": "Please select the start time",
|
||||
"选择用户": "Select user",
|
||||
"已选中": "Selected",
|
||||
"确定": "Determine",
|
||||
"请选择要发送的锁": "Please select the lock to send",
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。": "Face real-name authentication refers to the user's need to verify his face before unlocking the phone APP, and the verification can be unlocked.",
|
||||
"分享": "Share",
|
||||
"请输入接收者账号": "Please enter the receiver account",
|
||||
"接收者号码未注册,请重新发送": "The receiver number is not registered, please resend",
|
||||
"是否发送电子钥匙给未注册账号": "Whether to send the electronic key to the unregistered account",
|
||||
"取消": "Cancel",
|
||||
"标记成功": "Mark success",
|
||||
"微信好友": "WeChat friends",
|
||||
"短信": "SMS",
|
||||
"邮件": "Mail",
|
||||
"更多": "More",
|
||||
"您好,您的电子钥匙生成成功": "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",
|
||||
"已连接到锁,请将卡靠近锁的读卡区": "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",
|
||||
"检查以确保以下地址是正确的": "Check to make sure the following address is correct",
|
||||
"地图加载中,请稍候。。": "The map is loading, please wait...",
|
||||
"跳过": "Skip",
|
||||
"还未获取到位置信息哦,请耐心等待一下!": "The location information has not been obtained yet, please wait patiently!",
|
||||
"请填写信息": "Please fill in the information"
|
||||
}
|
||||
|
||||
@ -525,7 +525,7 @@
|
||||
"隐私政策": "隐私政策",
|
||||
"注册成功": "注册成功",
|
||||
"你所在的": "你所在的",
|
||||
"手机号": "公司已经开通了",
|
||||
"手机号": "手机号",
|
||||
"忘记密码": "忘记密码",
|
||||
"重置成功": "重置成功",
|
||||
"确定要退出吗?": "确定要退出吗?",
|
||||
@ -539,6 +539,7 @@
|
||||
"清空码": "清空码",
|
||||
"循环": "循环",
|
||||
"工作日": "工作日",
|
||||
"每日": "每日",
|
||||
"周末": "周末",
|
||||
"周一": "周一",
|
||||
"周二": "周二",
|
||||
@ -549,5 +550,69 @@
|
||||
"周日": "周日",
|
||||
"确定要删除吗?": "确定要删除吗?",
|
||||
"该锁的密码都将被删除": "该锁的密码都将被删除",
|
||||
"已过期": "已过期"
|
||||
"已过期": "已过期",
|
||||
"该锁的电子钥匙都将被删除": "该锁的电子钥匙都将被删除",
|
||||
"同时删除其发送的所有钥匙,钥匙删除后不能恢复": "同时删除其发送的所有钥匙,钥匙删除后不能恢复",
|
||||
"删除钥匙会在用户APP连网后生效": "删除钥匙会在用户APP连网后生效",
|
||||
"有效时间": "有效时间",
|
||||
"接收者": "接收者",
|
||||
"仅管理自己创建的用户": "仅管理自己创建的用户",
|
||||
"远程开锁": "远程开锁",
|
||||
"请输入钥匙名称": "请输入钥匙名称",
|
||||
"修改成功": "修改成功",
|
||||
"冻结": "冻结",
|
||||
"取消冻结": "取消冻结",
|
||||
"授权": "授权",
|
||||
"取消授权": "取消授权",
|
||||
"同时解冻其发送的钥匙": "同时解冻其发送的钥匙",
|
||||
"取消冻结会在用户APP连网后生效": "取消冻结会在用户APP连网后生效",
|
||||
"同时冻结其发送的钥匙": "同时冻结其发送的钥匙",
|
||||
"冻结会在用户APP连网后生效": "冻结会在用户APP连网后生效",
|
||||
"取消授权会在用户APP连网后生效": "取消授权会在用户APP连网后生效",
|
||||
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码": "授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码",
|
||||
"失效时间需大于生效时间": "失效时间需大于生效时间",
|
||||
"生效时间需大于当前时间": "生效时间需大于当前时间",
|
||||
"失效日期要大于生效日期": "失效日期要大于生效日期",
|
||||
"失效时间要大于生效时间": "失效时间要大于生效时间",
|
||||
"修改有效期": "修改有效期",
|
||||
"生效日期": "生效日期",
|
||||
"失效日期": "失效日期",
|
||||
"开锁": "开锁",
|
||||
"开锁成功": "开锁成功",
|
||||
"请选择锁": "请选择锁",
|
||||
"请选择接收者": "请选择接收者",
|
||||
"请选择有效期": "请选择有效期",
|
||||
"请选择发送方式": "请选择发送方式",
|
||||
"请选择结束时间": "请选择结束时间",
|
||||
"完成": "完成",
|
||||
"有效日": "有效日",
|
||||
"发送成功": "发送成功",
|
||||
"请选择开始时间": "请选择开始时间",
|
||||
"选择用户": "选择用户",
|
||||
"已选中": "已选中",
|
||||
"确定": "确定",
|
||||
"请选择要发送的锁": "请选择要发送的锁",
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。": "人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。",
|
||||
"分享": "分享",
|
||||
"请输入接收者账号": "请输入接收者账号",
|
||||
"接收者号码未注册,请重新发送": "接收者号码未注册,请重新发送",
|
||||
"是否发送电子钥匙给未注册账号": "是否发送电子钥匙给未注册账号",
|
||||
"取消": "取消",
|
||||
"标记成功": "标记成功",
|
||||
"微信好友": "微信好友",
|
||||
"短信": "短信",
|
||||
"邮件": "邮件",
|
||||
"更多": "更多",
|
||||
"您好,您的电子钥匙生成成功": "您好,您的电子钥匙生成成功",
|
||||
"生效时间不能小于当前时间": "生效时间不能小于当前时间",
|
||||
"结束时间不能小于当前时间": "结束时间不能小于当前时间",
|
||||
"是否是管理员": "是否是管理员",
|
||||
"已连接到锁,请将卡靠近锁的读卡区": "已连接到锁,请将卡靠近锁的读卡区",
|
||||
"尝试连接设备...": "尝试连接设备...",
|
||||
"地理位置": "地理位置",
|
||||
"检查以确保以下地址是正确的": "检查以确保以下地址是正确的",
|
||||
"地图加载中,请稍候。。": "地图加载中,请稍候。。",
|
||||
"跳过": "跳过",
|
||||
"还未获取到位置信息哦,请耐心等待一下!": "还未获取到位置信息哦,请耐心等待一下!",
|
||||
"请填写信息": "请填写信息"
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@
|
||||
"lightTouchScreenTip":"摸亮触摸屏,锁进入可添加状态,点击下一步",
|
||||
"next":"下一步",
|
||||
"nearbyLock":"附近的锁",
|
||||
"addSuccessfullyPleaseRename":"添加成功,请重命名",
|
||||
"addSuccessfullyPleaseRename":"如需修改名字请重新命名,点击确定添加锁",
|
||||
"whenAddingLockThePhoneMustBeNextToTheLock":"添加锁时,手机必须在锁旁边",
|
||||
|
||||
"login":"登录",
|
||||
@ -526,7 +526,7 @@
|
||||
"隐私政策": "隐私政策",
|
||||
"注册成功": "注册成功",
|
||||
"你所在的": "你所在的",
|
||||
"手机号": "公司已经开通了",
|
||||
"手机号": "手机号",
|
||||
"忘记密码": "忘记密码",
|
||||
"重置成功": "重置成功",
|
||||
"确定要退出吗?": "确定要退出吗?",
|
||||
@ -540,6 +540,7 @@
|
||||
"清空码": "清空码",
|
||||
"循环": "循环",
|
||||
"工作日": "工作日",
|
||||
"每日": "每日",
|
||||
"周末": "周末",
|
||||
"周一": "周一",
|
||||
"周二": "周二",
|
||||
@ -550,5 +551,69 @@
|
||||
"周日": "周日",
|
||||
"确定要删除吗?": "确定要删除吗?",
|
||||
"该锁的密码都将被删除": "该锁的密码都将被删除",
|
||||
"已过期": "已过期"
|
||||
"已过期": "已过期",
|
||||
"该锁的电子钥匙都将被删除": "该锁的电子钥匙都将被删除",
|
||||
"同时删除其发送的所有钥匙,钥匙删除后不能恢复": "同时删除其发送的所有钥匙,钥匙删除后不能恢复",
|
||||
"删除钥匙会在用户APP连网后生效": "删除钥匙会在用户APP连网后生效",
|
||||
"有效时间": "有效时间",
|
||||
"接收者": "接收者",
|
||||
"仅管理自己创建的用户": "仅管理自己创建的用户",
|
||||
"远程开锁": "远程开锁",
|
||||
"请输入钥匙名称": "请输入钥匙名称",
|
||||
"修改成功": "修改成功",
|
||||
"冻结": "冻结",
|
||||
"取消冻结": "取消冻结",
|
||||
"授权": "授权",
|
||||
"取消授权": "取消授权",
|
||||
"同时解冻其发送的钥匙": "同时解冻其发送的钥匙",
|
||||
"取消冻结会在用户APP连网后生效": "取消冻结会在用户APP连网后生效",
|
||||
"同时冻结其发送的钥匙": "同时冻结其发送的钥匙",
|
||||
"冻结会在用户APP连网后生效": "冻结会在用户APP连网后生效",
|
||||
"取消授权会在用户APP连网后生效": "取消授权会在用户APP连网后生效",
|
||||
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码": "授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码",
|
||||
"失效时间需大于生效时间": "失效时间需大于生效时间",
|
||||
"生效时间需大于当前时间": "生效时间需大于当前时间",
|
||||
"失效日期要大于生效日期": "失效日期要大于生效日期",
|
||||
"失效时间要大于生效时间": "失效时间要大于生效时间",
|
||||
"修改有效期": "修改有效期",
|
||||
"生效日期": "生效日期",
|
||||
"失效日期": "失效日期",
|
||||
"开锁": "开锁",
|
||||
"开锁成功": "开锁成功",
|
||||
"请选择锁": "请选择锁",
|
||||
"请选择接收者": "请选择接收者",
|
||||
"请选择有效期": "请选择有效期",
|
||||
"请选择发送方式": "请选择发送方式",
|
||||
"请选择结束时间": "请选择结束时间",
|
||||
"完成": "完成",
|
||||
"有效日": "有效日",
|
||||
"发送成功": "发送成功",
|
||||
"请选择开始时间": "请选择开始时间",
|
||||
"选择用户": "选择用户",
|
||||
"已选中": "已选中",
|
||||
"确定": "确定",
|
||||
"请选择要发送的锁": "请选择要发送的锁",
|
||||
"人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。": "人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。",
|
||||
"分享": "分享",
|
||||
"请输入接收者账号": "请输入接收者账号",
|
||||
"接收者号码未注册,请重新发送": "接收者号码未注册,请重新发送",
|
||||
"是否发送电子钥匙给未注册账号": "是否发送电子钥匙给未注册账号",
|
||||
"取消": "取消",
|
||||
"标记成功": "标记成功",
|
||||
"微信好友": "微信好友",
|
||||
"短信": "短信",
|
||||
"邮件": "邮件",
|
||||
"更多": "更多",
|
||||
"您好,您的电子钥匙生成成功": "您好,您的电子钥匙生成成功",
|
||||
"生效时间不能小于当前时间": "生效时间不能小于当前时间",
|
||||
"结束时间不能小于当前时间": "结束时间不能小于当前时间",
|
||||
"是否是管理员": "是否是管理员",
|
||||
"已连接到锁,请将卡靠近锁的读卡区": "已连接到锁,请将卡靠近锁的读卡区",
|
||||
"尝试连接设备...": "尝试连接设备...",
|
||||
"地理位置": "地理位置",
|
||||
"检查以确保以下地址是正确的": "检查以确保以下地址是正确的",
|
||||
"地图加载中,请稍候。。": "地图加载中,请稍候。。",
|
||||
"跳过": "跳过",
|
||||
"还未获取到位置信息哦,请耐心等待一下!": "还未获取到位置信息哦,请耐心等待一下!",
|
||||
"请填写信息": "请填写信息"
|
||||
}
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>jpush.cn</key>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'io_tool/io_model.dart';
|
||||
@ -20,15 +20,19 @@ class BlueManage {
|
||||
|
||||
// 用来写入的服务id
|
||||
final Guid _serviceIdConnect = Guid("fff0");
|
||||
|
||||
// 用来写入的服务id
|
||||
final Guid _serviceIdWrite = Guid('0000FFF0-0000-1000-8000-00805F9B34FB');
|
||||
|
||||
// 用来订阅的特征id
|
||||
final Guid _characteristicIdSubscription = Guid("fff1");
|
||||
|
||||
// 用来写入的特征id
|
||||
final Guid _characteristicIdWrite = Guid("fff2");
|
||||
|
||||
// 监听发送事件
|
||||
StreamSubscription<EventSendModel>? _sendStreamSubscription;
|
||||
|
||||
// 监听蓝牙扫描的事件
|
||||
// StreamSubscription? _scanSubscription;
|
||||
// 监听蓝牙连接的事件
|
||||
@ -42,12 +46,16 @@ class BlueManage {
|
||||
|
||||
// 当前连接设备的名字
|
||||
String connectDeviceName = "";
|
||||
|
||||
// 当前连接设备的mac地址
|
||||
String connectDeviceMacAddress = "";
|
||||
|
||||
// 当前连接的设备
|
||||
BluetoothDevice? bluetoothConnectDevice;
|
||||
|
||||
// 当前扫描到结果要连接设备
|
||||
ScanResult? scanResult;
|
||||
|
||||
// 监听蓝牙连接状态
|
||||
BluetoothConnectionState? bluetoothConnectionState = BluetoothConnectionState.disconnected;
|
||||
|
||||
@ -55,7 +63,8 @@ class BlueManage {
|
||||
StreamSubscription<BluetoothAdapterState>? _adapterStateStateSubscription;
|
||||
|
||||
static BlueManage? _manager;
|
||||
BlueManage._init(){
|
||||
|
||||
BlueManage._init() {
|
||||
_initBlue();
|
||||
}
|
||||
|
||||
@ -66,9 +75,10 @@ class BlueManage {
|
||||
}
|
||||
|
||||
factory BlueManage() => shareManager()!;
|
||||
|
||||
BlueManage? get manager => shareManager();
|
||||
|
||||
void _initBlue(){
|
||||
void _initBlue() {
|
||||
Get.log("蓝牙功能初始化监听");
|
||||
_initSendStreamSubscription();
|
||||
_initAdapterStateStateSubscription();
|
||||
@ -79,7 +89,7 @@ class BlueManage {
|
||||
void _initGetMtuSubscription() {
|
||||
_mtuSubscription ??= bluetoothConnectDevice!.mtu.listen((value) {
|
||||
_mtuSize = value - 3;
|
||||
Get.log('mtuSize:$_mtuSize');
|
||||
Get.log('_mtuSizeValue:$value mtuSize:$_mtuSize');
|
||||
});
|
||||
}
|
||||
|
||||
@ -90,42 +100,42 @@ class BlueManage {
|
||||
}
|
||||
|
||||
// void _initListenscanResults() {
|
||||
// var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
// scanDevices.clear();
|
||||
// for (var scanResult in results) {
|
||||
// // 判断名字为空的直接剔除
|
||||
// // if (scanResult.device.advName.isEmpty) {
|
||||
// // return;
|
||||
// // }
|
||||
// print("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
// if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
||||
// // 查询id相同的元素
|
||||
// final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||
// // 不存在的时候返回-1
|
||||
// if (knownDeviceIndex >= 0) {
|
||||
// scanDevices[knownDeviceIndex] = scanResult;
|
||||
// } else {
|
||||
// scanDevices.add(scanResult);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// // FlutterBluePlus.stopScan();
|
||||
// }, onError: (e) {
|
||||
// print("Scan Error:$e", );
|
||||
// });
|
||||
//
|
||||
// FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
// var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
// scanDevices.clear();
|
||||
// for (var scanResult in results) {
|
||||
// // 判断名字为空的直接剔除
|
||||
// // if (scanResult.device.advName.isEmpty) {
|
||||
// // return;
|
||||
// // }
|
||||
// print("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
// if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
||||
// // 查询id相同的元素
|
||||
// final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||
// // 不存在的时候返回-1
|
||||
// if (knownDeviceIndex >= 0) {
|
||||
// scanDevices[knownDeviceIndex] = scanResult;
|
||||
// } else {
|
||||
// scanDevices.add(scanResult);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// // FlutterBluePlus.stopScan();
|
||||
// }, onError: (e) {
|
||||
// print("Scan Error:$e", );
|
||||
// });
|
||||
//
|
||||
// FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
|
||||
// FlutterBluePlus.isScanning.listen((state) {
|
||||
// if (state) {
|
||||
// print('Scanning');
|
||||
// } else {
|
||||
// print('Not scanning');
|
||||
// }
|
||||
// });
|
||||
// FlutterBluePlus.isScanning.listen((state) {
|
||||
// if (state) {
|
||||
// print('Scanning');
|
||||
// } else {
|
||||
// print('Not scanning');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
void _initListenConnectionState() {
|
||||
@ -148,9 +158,7 @@ class BlueManage {
|
||||
writeCharacteristicWithResponse(model.data);
|
||||
} else {
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
await FlutterBluePlus.turnOn();
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
Get.log("Error Turning On:");
|
||||
}
|
||||
@ -163,27 +171,27 @@ class BlueManage {
|
||||
});
|
||||
}
|
||||
|
||||
/// 开始扫描蓝牙设备
|
||||
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack, {List<Guid>? idList}) async {
|
||||
/// 开始指定设备名称的扫描蓝牙设备
|
||||
Future<void> startScanSingle(String deviceName, int timeout, ScanDevicesCallBack scanDevicesCallBack) async {
|
||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
||||
if (isAvailable) {
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
try {
|
||||
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
||||
|
||||
var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
scanDevices.clear();
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
try {
|
||||
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
||||
Completer<dynamic> completer = Completer<dynamic>();
|
||||
var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
bool isExit = results.any((element) => element.device.platformName == deviceName);
|
||||
if (isExit) {
|
||||
for (var scanResult in results) {
|
||||
// 判断名字为空的直接剔除
|
||||
// if (scanResult.device.advName.isEmpty) {
|
||||
// return;
|
||||
// }
|
||||
// Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty ? scanResult.advertisementData.serviceUuids[0] : "").toString().contains("758824")) && (scanResult.rssi >= -100)) {
|
||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
||||
? scanResult.advertisementData.serviceUuids[0]
|
||||
: "")
|
||||
.toString()
|
||||
.contains("758824")) &&
|
||||
(scanResult.rssi >= -100)) {
|
||||
// 查询id相同的元素
|
||||
final knownDeviceIndex = scanDevices.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||
final knownDeviceIndex = scanDevices
|
||||
.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||
// 不存在的时候返回-1
|
||||
if (knownDeviceIndex >= 0) {
|
||||
scanDevices[knownDeviceIndex] = scanResult;
|
||||
@ -192,49 +200,19 @@ class BlueManage {
|
||||
}
|
||||
}
|
||||
}
|
||||
scanDevicesCallBack(scanDevices);
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// FlutterBluePlus.stopScan();
|
||||
}, onError: (e) {
|
||||
Get.log("Scan Error:$e", );
|
||||
});
|
||||
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
} catch (e) {
|
||||
Get.log("扫描失败");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
await FlutterBluePlus.turnOn();
|
||||
completer.complete();
|
||||
}
|
||||
} catch (e) {
|
||||
Get.log("Error Turning On:");
|
||||
}
|
||||
};
|
||||
} else {
|
||||
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 调用发送数据
|
||||
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
|
||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
||||
if (isAvailable) {
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
if(bluetoothConnectionState != BluetoothConnectionState.connected){
|
||||
_connect(deviceName, (state){
|
||||
// if(bluetoothConnectionState != BluetoothConnectionState.connected){
|
||||
// stateCallBack(bluetoothConnectionState!);
|
||||
// }else{
|
||||
// stateCallBack(bluetoothConnectionState!);
|
||||
// }
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}, isAddEquipment: isAddEquipment);
|
||||
}else{
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}, onError: (e) {
|
||||
Get.log(
|
||||
"Scan Error:$e",
|
||||
);
|
||||
});
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
await completer.future;
|
||||
scanDevicesCallBack(scanDevices);
|
||||
subscription.cancel();
|
||||
} catch (e) {
|
||||
Get.log("扫描失败");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
@ -244,7 +222,104 @@ class BlueManage {
|
||||
} catch (e) {
|
||||
Get.log("Error Turning On:");
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 开始扫描蓝牙设备
|
||||
Future<void> startScan(int timeout, ScanDevicesCallBack scanDevicesCallBack, {List<Guid>? idList}) async {
|
||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
||||
if (isAvailable) {
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
try {
|
||||
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
|
||||
|
||||
var subscription = FlutterBluePlus.scanResults.listen((results) {
|
||||
scanDevices.clear();
|
||||
for (var scanResult in results) {
|
||||
// 判断名字为空的直接剔除
|
||||
// if (scanResult.device.advName.isEmpty) {
|
||||
// return;
|
||||
// }
|
||||
// Get.log("scanResult.device.advName:${scanResult.device.advName}"
|
||||
// " scanResult.advertisementData.serviceUuids:${scanResult.advertisementData.serviceUuids}"
|
||||
// " rssi:${scanResult.rssi}");
|
||||
if (((scanResult.advertisementData.serviceUuids.isNotEmpty
|
||||
? scanResult.advertisementData.serviceUuids[0]
|
||||
: "")
|
||||
.toString()
|
||||
.contains("758824")) &&
|
||||
(scanResult.rssi >= -100)) {
|
||||
// 查询id相同的元素
|
||||
final knownDeviceIndex = scanDevices
|
||||
.indexWhere((d) => d.advertisementData.advName == scanResult.advertisementData.advName);
|
||||
// 不存在的时候返回-1
|
||||
if (knownDeviceIndex >= 0) {
|
||||
scanDevices[knownDeviceIndex] = scanResult;
|
||||
} else {
|
||||
scanDevices.add(scanResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
scanDevicesCallBack(scanDevices);
|
||||
// EventBusManager().eventBusFir(scanDevices);
|
||||
// FlutterBluePlus.stopScan();
|
||||
}, onError: (e) {
|
||||
Get.log(
|
||||
"Scan Error:$e",
|
||||
);
|
||||
});
|
||||
|
||||
FlutterBluePlus.cancelWhenScanComplete(subscription);
|
||||
} catch (e) {
|
||||
Get.log("扫描失败");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
await FlutterBluePlus.turnOn();
|
||||
}
|
||||
} catch (e) {
|
||||
Get.log("Error Turning On:");
|
||||
}
|
||||
}
|
||||
;
|
||||
} else {
|
||||
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 调用发送数据
|
||||
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack,
|
||||
{bool isAddEquipment = false}) async {
|
||||
FlutterBluePlus.isSupported.then((isAvailable) async {
|
||||
if (isAvailable) {
|
||||
if (_adapterState == BluetoothAdapterState.on) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
if (bluetoothConnectionState != BluetoothConnectionState.connected) {
|
||||
_connect(deviceName, (state) {
|
||||
// if(bluetoothConnectionState != BluetoothConnectionState.connected){
|
||||
// stateCallBack(bluetoothConnectionState!);
|
||||
// }else{
|
||||
// stateCallBack(bluetoothConnectionState!);
|
||||
// }
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}, isAddEquipment: isAddEquipment);
|
||||
} else {
|
||||
stateCallBack(bluetoothConnectionState!);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
stateCallBack(BluetoothConnectionState.disconnected);
|
||||
openBlue();
|
||||
} catch (e) {
|
||||
Get.log("Error Turning On:");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Get.log("开始扫描 蓝牙不可用,不能进行蓝牙操作");
|
||||
}
|
||||
@ -252,21 +327,26 @@ class BlueManage {
|
||||
}
|
||||
|
||||
/// 连接
|
||||
Future<void> _connect(String deviceName, ConnectStateCallBack connectStateCallBack, {bool isAddEquipment = false}) async {
|
||||
Future<void> _connect(String deviceName, ConnectStateCallBack connectStateCallBack,
|
||||
{bool isAddEquipment = false}) async {
|
||||
connectDeviceName = deviceName;
|
||||
List<ScanResult> devicesList = scanDevices;
|
||||
if(isAddEquipment == false){
|
||||
startScan(10, (List<ScanResult> scanDevices){
|
||||
//判断列表里面有设备则不开启扫描
|
||||
bool isExistDevice = scanDevices.any((element) => element.device.platformName == connectDeviceName);
|
||||
if (isAddEquipment == false && isExistDevice == false) {
|
||||
startScanSingle(deviceName, 10, (List<ScanResult> scanDevices) {
|
||||
Get.log("扫描到的设备:$scanDevices");
|
||||
devicesList = scanDevices;
|
||||
_connectDevice(devicesList, deviceName, connectStateCallBack, isAddEquipment: isAddEquipment);
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
_connectDevice(devicesList, deviceName, connectStateCallBack, isAddEquipment: isAddEquipment);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _connectDevice( List<ScanResult> devicesList, String deviceName, ConnectStateCallBack connectStateCallBack, {bool isAddEquipment = false}) async {
|
||||
Future<void> _connectDevice(
|
||||
List<ScanResult> devicesList, String deviceName, ConnectStateCallBack connectStateCallBack,
|
||||
{bool isAddEquipment = false}) async {
|
||||
// 判断数组列表里面是否有这个设备
|
||||
Get.log("devicesList:$devicesList");
|
||||
final knownDeviceIndex = devicesList.indexWhere((d) => d.advertisementData.advName == deviceName);
|
||||
@ -292,7 +372,7 @@ class BlueManage {
|
||||
await stopScan();
|
||||
|
||||
if ((scanResult!.advertisementData.serviceUuids[0].toString()[31] == "0") && isAddEquipment == false) {
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected!);
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
EasyLoading.showToast("该锁已被重置", duration: 2000.milliseconds);
|
||||
return;
|
||||
}
|
||||
@ -315,7 +395,7 @@ class BlueManage {
|
||||
|
||||
if (attempt >= maxAttempts) {
|
||||
Get.log('Failed to connect after $maxAttempts attempts.');
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected!);
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
}
|
||||
|
||||
// await bluetoothConnectDevice!.connect();
|
||||
@ -323,20 +403,18 @@ class BlueManage {
|
||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||
try {
|
||||
bluetoothConnectDevice!.discoverServices().then((services) {
|
||||
Get.log("333333333");
|
||||
for (BluetoothService service in services) {
|
||||
// Get.log("11111service.remoteId:${service.remoteId}"
|
||||
// " service.uuid:${service.uuid}"
|
||||
// " service.characteristics:${service.characteristics}"
|
||||
// " service.includedServices:${service.includedServices}");
|
||||
if(service.uuid == _serviceIdConnect){
|
||||
if (service.uuid == _serviceIdConnect) {
|
||||
for (BluetoothCharacteristic characteristic in service.characteristics) {
|
||||
// Get.log("22222characteristic.remoteId:${characteristic.remoteId}"
|
||||
// " characteristic.uuid:${characteristic.uuid}"
|
||||
// " characteristic.secondaryServiceUuid:${characteristic.secondaryServiceUuid}"
|
||||
// " characteristic.characteristicUuid:${characteristic.characteristicUuid}");
|
||||
if (characteristic.characteristicUuid == _characteristicIdSubscription) {
|
||||
Get.log("44444444");
|
||||
_subScribeToCharacteristic(characteristic);
|
||||
Get.log('Discovering services finished');
|
||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||
@ -358,16 +436,18 @@ class BlueManage {
|
||||
|
||||
// 听上报来的数据,参数来自前面扫描到的结果
|
||||
var allData = <int>[];
|
||||
|
||||
// 保存上一次的数据,用来判断是否收到重复的数据
|
||||
var lastTimeData = <int>[];
|
||||
int? dataLen;
|
||||
|
||||
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
|
||||
final subscription = characteristic.onValueReceived.listen((data) {
|
||||
Get.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
|
||||
Get.log("订阅获取的数据:$data");
|
||||
if(data == lastTimeData || data.isEmpty){
|
||||
if (data == lastTimeData || data.isEmpty) {
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
lastTimeData = data;
|
||||
}
|
||||
// code to handle incoming data
|
||||
@ -463,8 +543,7 @@ class BlueManage {
|
||||
// " service.characteristics:${service.characteristics}\n\n"
|
||||
// " service.includedServices:${service.includedServices}");
|
||||
if (service.uuid == _serviceIdConnect) {
|
||||
for (BluetoothCharacteristic characteristic in service
|
||||
.characteristics) {
|
||||
for (BluetoothCharacteristic characteristic in service.characteristics) {
|
||||
// print("44444 characteristic.remoteId:${characteristic.remoteId}"
|
||||
// " characteristic.uuid:${characteristic.uuid}\n\n"
|
||||
// " characteristic.secondaryServiceUuid:${characteristic
|
||||
@ -475,8 +554,7 @@ class BlueManage {
|
||||
try {
|
||||
List<int> valueList = value;
|
||||
List subData = splitList(valueList, _mtuSize!);
|
||||
Get.log(
|
||||
'writeCharacteristicWithResponse 得到的分割数据:$subData');
|
||||
Get.log('writeCharacteristicWithResponse _mtuSize:$_mtuSize 得到的分割数据:$subData');
|
||||
|
||||
for (int i = 0; i < subData.length; i++) {
|
||||
await characteristic.write(subData[i]).then((value) async {
|
||||
@ -522,17 +600,17 @@ class BlueManage {
|
||||
|
||||
// 读取
|
||||
// Future<List<int>> _readCharacteristic(QualifiedCharacteristic characteristic) async {
|
||||
// try {
|
||||
// final result =
|
||||
// await _flutterReactiveBle!.readCharacteristic(characteristic);
|
||||
// print("readListresult$result");
|
||||
// return result;
|
||||
// } on Exception catch (e, s) {
|
||||
// print(
|
||||
// 'Error occurred when reading ${characteristic.characteristicId} : $e',
|
||||
// );
|
||||
// rethrow;
|
||||
// }
|
||||
// try {
|
||||
// final result =
|
||||
// await _flutterReactiveBle!.readCharacteristic(characteristic);
|
||||
// print("readListresult$result");
|
||||
// return result;
|
||||
// } on Exception catch (e, s) {
|
||||
// print(
|
||||
// 'Error occurred when reading ${characteristic.characteristicId} : $e',
|
||||
// );
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Future<void> writeCharacteristicWithoutResponse(
|
||||
@ -560,11 +638,11 @@ class BlueManage {
|
||||
Future<void> disconnect() async {
|
||||
try {
|
||||
// if(bluetoothConnectDevice != null && bluetoothConnectDevice!.connectionState == BluetoothConnectionState.connected){
|
||||
connectDeviceMacAddress = "";
|
||||
if(bluetoothConnectionState == BluetoothConnectionState.connected){
|
||||
await bluetoothConnectDevice!.disconnect();
|
||||
Get.log("断开连接成功");
|
||||
}
|
||||
connectDeviceMacAddress = "";
|
||||
if (bluetoothConnectionState == BluetoothConnectionState.connected) {
|
||||
await bluetoothConnectDevice!.disconnect();
|
||||
Get.log("断开连接成功");
|
||||
}
|
||||
// }
|
||||
} on Exception catch (e, _) {
|
||||
Get.log("Error disconnecting from a device: $e");
|
||||
@ -573,6 +651,15 @@ class BlueManage {
|
||||
}
|
||||
}
|
||||
|
||||
openBlue() async {
|
||||
if (Platform.isAndroid) {
|
||||
await FlutterBluePlus.turnOn();
|
||||
}
|
||||
if (Platform.isIOS) {
|
||||
EasyLoading.showToast("请开启蓝牙", duration: 2000.milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
disposed() {
|
||||
_sendStreamSubscription?.cancel();
|
||||
_mtuSubscription!.cancel();
|
||||
|
||||
@ -47,7 +47,7 @@ class _StarLockForgetPasswordPageState
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
||||
print("路由返回值: ${result}, countryCode:${state.countryName.value} ,state.countryName.value:${state.countryName.value}");
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 70.h,
|
||||
@ -185,7 +185,7 @@ class _StarLockForgetPasswordPageState
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.safetyVerificationPage,
|
||||
arguments: {
|
||||
"countryCode": "86",
|
||||
"countryCode": state.countryCode.value,
|
||||
"account": state.phoneStr.value
|
||||
});
|
||||
logic.state.xWidth.value =
|
||||
|
||||
@ -8,6 +8,7 @@ import 'package:star_lock/tools/xs_jPhush.dart';
|
||||
|
||||
import '../../mine/mine/starLockMine_logic.dart';
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/eventBusEventManage.dart';
|
||||
import '../../tools/storage.dart';
|
||||
import 'starLock_login_state.dart';
|
||||
|
||||
@ -20,6 +21,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
.login("1", state.pwd.value, "+86", state.emailOrPhone.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Storage.saveLoginData(entity.data);
|
||||
eventBus.fire(MineInfoChangeRefreshUI());
|
||||
// Get.back();
|
||||
// Get.toNamed(Routers.starLockMain);
|
||||
XSJPushProvider().initJPushService();
|
||||
|
||||
@ -285,7 +285,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
state.isSendSuccess.value = false;
|
||||
Navigator.pop(context, true);
|
||||
|
||||
@ -398,7 +398,7 @@ class _VolumeAuthorizationLockPageState
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
_isSendSuccess = false;
|
||||
Navigator.pop(context, true);
|
||||
|
||||
@ -31,11 +31,11 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
endTime = "0";
|
||||
|
||||
if (startDate.isEmpty) {
|
||||
showToast("请选择开始时间");
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间");
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -45,12 +45,12 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
// }
|
||||
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
} else if (state.selectType.value == "2") {
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期");
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
@ -61,7 +61,6 @@ class AddCardTypeLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
var isCoerced = state.isStressFingerprint.value == false ? "1" : "2"; // 1:非胁迫卡 2:胁迫卡
|
||||
print("addOtherType startDate:$startDate endDate:$endDate");
|
||||
Get.toNamed(Routers.addICCardPage, arguments: {
|
||||
"lockId": state.lockId.value,
|
||||
"endDate": endDate,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -70,7 +71,6 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
case 0:
|
||||
{
|
||||
// 永久
|
||||
// return sendElectronicKeySucceed();
|
||||
return Column(
|
||||
children: [
|
||||
perpetualKeyWidget(
|
||||
@ -214,7 +214,7 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
Obx(() => Visibility(
|
||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间",
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
@ -244,7 +244,7 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "是否是管理员",
|
||||
leftTitel: "是否是管理员".tr,
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
@ -266,90 +266,20 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
if (isDemoMode == false) {
|
||||
// print("state.selectType:${state.selectType.value}");
|
||||
if (state.nameController.text.isEmpty) {
|
||||
logic.showToast("请输入姓名");
|
||||
logic.showToast("请输入姓名".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
logic.checkCardNameDuplicated(state.nameController.text);
|
||||
} else {
|
||||
// Get.toNamed(Routers.selectLockTypePage);
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast("演示模式".tr);
|
||||
}
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 发送电子钥匙成功
|
||||
Widget sendElectronicKeySucceed() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 300.h,
|
||||
width: 1.sw,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Image.asset(
|
||||
'images/main/icon_main_addLock.png',
|
||||
width: 150.w,
|
||||
height: 150.w,
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text(
|
||||
"操作成功,密码为",
|
||||
style: TextStyle(
|
||||
fontSize: 32.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
"62689876",
|
||||
style: TextStyle(
|
||||
fontSize: 60.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
SubmitBtn(
|
||||
btnName: '分享',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
SubmitBtn(
|
||||
btnName: '标记为:已入住',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
String getAppBarTitle(int type) {
|
||||
String title;
|
||||
switch (type) {
|
||||
|
||||
@ -50,15 +50,13 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
//成功
|
||||
// state.cardNumber.value = reply.data.last.toString();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.ifConnectScuess.value = true;
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
//无权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -67,7 +65,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddFingerprintReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
@ -75,8 +72,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:1,
|
||||
useCountLimit:0xff,
|
||||
// startTime:0x11223344,
|
||||
// endTime:0x11223344,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
@ -86,32 +81,27 @@ class AddICCardLogic extends BaseGetXController{
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _replyAddICCardConfirmation(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintstatus:$status");
|
||||
Get.log("_replyAddFingerprintstatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// print("添加指纹确认成功,调用添加指纹接口");
|
||||
//成功
|
||||
if(state.cardNumber.value == (reply.data[6]).toString()){
|
||||
return;
|
||||
}else{
|
||||
@ -133,23 +123,22 @@ class AddICCardLogic extends BaseGetXController{
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -161,9 +150,8 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
// print("添加指纹确认成功,调用添加指纹接口");
|
||||
//成功
|
||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||
addICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
@ -179,7 +167,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
print("_replyAddICCardConfirmationReplyToken:$token");
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
IoSenderManage.senderAddStressICCardCommand(
|
||||
@ -188,8 +175,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
icCardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
cardType:1,
|
||||
useCountLimit:1,
|
||||
// startTime:0x11223344,
|
||||
// endTime:0x11223344,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
@ -200,19 +185,18 @@ class AddICCardLogic extends BaseGetXController{
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
//无权限
|
||||
Get.log("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
// 权限校验错误
|
||||
Get.log("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
//失败
|
||||
Get.log("${reply.commandType!.typeValue} 失败");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -220,7 +204,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
// 添加卡片
|
||||
Future<void> senderAddICCard() async {
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
print("没有任何响应");
|
||||
Get.close(1);
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
@ -234,14 +217,12 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
||||
useCountLimit:0xff,
|
||||
// startTime:0x11223344,
|
||||
// endTime:0x11223344,
|
||||
startTime:int.parse(state.startDate.value)~/1000,
|
||||
endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
@ -274,7 +255,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
IoSenderManage.senderAddStressICCardCommand(
|
||||
keyID:"1",
|
||||
@ -297,7 +277,6 @@ class AddICCardLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
void addICCardData() async {
|
||||
print("state.startDate.value:${state.startDate.value} state.effectiveDateTime.value:${state.effectiveDateTime.value} state.failureDateTime.value:${state.failureDateTime.value}");
|
||||
var entity = await ApiRepository.to.addICCardData(
|
||||
lockId: state.lockId.value.toString(),
|
||||
endDate: state.endDate.value,
|
||||
@ -308,8 +287,8 @@ class AddICCardLogic extends BaseGetXController{
|
||||
startDate: state.startDate.value,
|
||||
isCoerced: state.isCoerced.value.toString(),
|
||||
weekDay: state.weekDay.value,
|
||||
startTime: int.parse(state.effectiveDateTime.value),
|
||||
endTime: int.parse(state.failureDateTime.value),
|
||||
startTime: int.parse(state.effectiveDateTime.value),
|
||||
endTime: int.parse(state.failureDateTime.value),
|
||||
cardRight: state.isAdministrator.value == "2" ? 1 : 0,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -324,14 +303,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
cardUserNo: state.cardNumber.value,
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
// Toast.show(msg: "添加成功");
|
||||
// if(state.fromType.value == 2){
|
||||
// // 回调指纹号
|
||||
// eventBus.fire(ChickInAddStaffCardAndFingerprintBlockNumberEvent(cardId));
|
||||
// }else if(state.fromType.value == 1){
|
||||
// eventBus.fire(OtherTypeRefreshListEvent());
|
||||
// }
|
||||
// Get.close(2);
|
||||
|
||||
showToast("添加成功");
|
||||
if(state.fromType.value == 2){
|
||||
// 回调指纹号
|
||||
|
||||
@ -32,8 +32,6 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: ListView(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 200.h),
|
||||
Center(
|
||||
@ -63,8 +61,8 @@ class _AddICCardPageState extends State<AddICCardPage> with RouteAware {
|
||||
child: Center(
|
||||
child: Obx(() => Text(
|
||||
state.ifConnectScuess.value
|
||||
? "已连接到锁,请将卡靠近锁的读卡区"
|
||||
: "尝试连接设备...",
|
||||
? "已连接到锁,请将卡靠近锁的读卡区".tr
|
||||
: "尝试连接设备...".tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
|
||||
),
|
||||
],
|
||||
|
||||
@ -38,14 +38,6 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
|
||||
barTitle: "卡详情",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
// actionsList: [
|
||||
// TextButton(
|
||||
// child: Text(TranslationLoader.lanKeys!.share!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp),),
|
||||
// onPressed: () {
|
||||
//
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
|
||||
@ -20,7 +20,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
//修改钥匙名称请求
|
||||
Future<void> modifyKeyNameRequest() async {
|
||||
if (state.changeNameController.text.isEmpty) {
|
||||
showToast("请输入钥匙名称");
|
||||
showToast("请输入钥匙名称".tr);
|
||||
return;
|
||||
}
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
@ -30,7 +30,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
state.itemData.value.keyName = state.changeNameController.text;
|
||||
state.keyName.value = state.itemData.value.keyName!;
|
||||
Get.back();
|
||||
showToast("修改成功", something: () {
|
||||
showToast("修改成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
});
|
||||
@ -56,7 +56,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
// }else if(updateType == 2){
|
||||
// state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
|
||||
// }
|
||||
showToast("修改成功", something: () {
|
||||
showToast("修改成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
});
|
||||
@ -70,8 +70,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
showToast("删除成功", something: () {
|
||||
showToast("删除成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
@ -85,7 +84,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
keyId:state.itemData.value.keyId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功", something: () {
|
||||
showToast("设置成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
@ -99,7 +98,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
keyId:state.itemData.value.keyId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功", something: () {
|
||||
showToast("设置成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
@ -114,7 +113,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功", something: () {
|
||||
showToast("设置成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
@ -129,7 +128,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
includeUnderlings: includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("设置成功", something: () {
|
||||
showToast("设置成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back();
|
||||
@ -140,11 +139,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
String getKeyTypeShowDateTime(){
|
||||
String useDateStr = '';
|
||||
if(state.keyType.value == 1){
|
||||
useDateStr = "永久";
|
||||
useDateStr = "永久".tr;
|
||||
}else if(state.keyType.value == 2){
|
||||
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
|
||||
}else if(state.keyType.value == 3){
|
||||
useDateStr = "单次";
|
||||
useDateStr = "单次".tr;
|
||||
}else if(state.keyType.value == 4){
|
||||
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
|
||||
}
|
||||
@ -154,9 +153,9 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
Future openModalBottomSheet(BuildContext context) async {
|
||||
var textList = <String>[];
|
||||
if(state.keyType.value == 1 || state.keyType.value == 2){
|
||||
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结", state.itemData.value.keyRight == 1 ? '取消授权' : '授权'];
|
||||
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr];
|
||||
} else if(state.keyType.value == 4){
|
||||
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"];
|
||||
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr];
|
||||
}
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
@ -173,26 +172,22 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
// 取消冻结
|
||||
if(state.itemData.value.keyRight == 1){
|
||||
// 管理员
|
||||
print("管理员 调用取消冻结");
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙'.tr, (isAllData) {
|
||||
cancelFreeze(isAllData ? 1 : 0);
|
||||
});
|
||||
}else{
|
||||
print("普通用户 调用取消冻结");
|
||||
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效", (){
|
||||
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效".tr, (){
|
||||
cancelFreeze(0);
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if(state.itemData.value.keyRight == 1){
|
||||
// 管理员
|
||||
print("管理员 调用冻结");
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||
freezeKey(isAllData ? 1 : 0);
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时冻结其发送的钥匙'.tr, (isAllData) {
|
||||
freezeKey(isAllData ? 1 : 0);
|
||||
});
|
||||
}else{
|
||||
print("普通用户 调用冻结");
|
||||
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效", (){
|
||||
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效".tr, (){
|
||||
freezeKey(0);
|
||||
});
|
||||
}
|
||||
@ -201,13 +196,11 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
// 取消/授权管理员
|
||||
if(state.itemData.value.keyRight == 1){
|
||||
// 管理员
|
||||
print("管理员 调用取消授权管理员接口");
|
||||
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
|
||||
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, (){
|
||||
cancelAdministrator();
|
||||
});
|
||||
}else{
|
||||
print("普通用户 调用授权管理员接口");
|
||||
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码", (){
|
||||
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码".tr, (){
|
||||
setAdministrator();
|
||||
});
|
||||
}
|
||||
@ -217,82 +210,15 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
// showPopMenus(BuildContext context){
|
||||
// var textList = [];
|
||||
// // keyType // 永久:1;限时2,单次3,循环:4
|
||||
// // itemData.keyRight == 1 // 1:管理员 2:普通用户
|
||||
// // indexEntity.keyStatus! 110405:已冻结 110412:已过期 110408:已删除 110410:已重置
|
||||
// if(state.keyType.value == 1 || state.keyType.value == 2){
|
||||
// textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}, {'text': state.itemData.value.keyRight == 1 ? '取消授权' : '授权'}];
|
||||
// } else if(state.keyType.value == 4){
|
||||
// textList = [{'text': state.itemData.value.keyStatus == 110405 ? '取消冻结' : "冻结"}];
|
||||
// }
|
||||
// JhPopMenus.showLinePop(context, clickCallback: (index, selText) {
|
||||
// print('选中index: $index');
|
||||
// print('选中text: $selText');
|
||||
// Navigator.pop(context, true);
|
||||
// Future.delayed(const Duration(seconds: 1));
|
||||
//
|
||||
// if(index == 0){
|
||||
// if(state.itemData.value.keyStatus == 110405){
|
||||
// // 取消冻结
|
||||
// if(state.itemData.value.keyRight == 1){
|
||||
// // 管理员
|
||||
// print("管理员 调用取消冻结");
|
||||
// ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||
// cancelFreeze();
|
||||
// });
|
||||
// }else{
|
||||
// print("普通用户 调用取消冻结");
|
||||
// ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效", (){
|
||||
// cancelFreeze();
|
||||
// });
|
||||
// }
|
||||
// }else{
|
||||
// if(state.itemData.value.keyRight == 1){
|
||||
// // 管理员
|
||||
// print("管理员 调用冻结");
|
||||
// // ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||
// // freezeKey();
|
||||
// // });
|
||||
// // showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙', (isAllData) {
|
||||
// // freezeKey();
|
||||
// // });
|
||||
// showToast("fasdfasdfasdf");
|
||||
// }else{
|
||||
// print("普通用户 调用冻结");
|
||||
// ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效", (){
|
||||
// freezeKey();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// // 取消/授权管理员
|
||||
// if(state.itemData.value.keyRight == 1){
|
||||
// // 管理员
|
||||
// print("管理员 调用取消授权管理员接口");
|
||||
// ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效", (){
|
||||
// cancelAdministrator();
|
||||
// });
|
||||
// }else{
|
||||
// print("普通用户 调用授权管理员接口");
|
||||
// ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码", (){
|
||||
// setAdministrator();
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }, listData: textList);
|
||||
// }
|
||||
|
||||
deletKeyLogic(){
|
||||
if(state.itemData.value.keyRight == 1){
|
||||
// 授权管理员
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
|
||||
deleteKeyRequest(isAllData ? 1 : 0);
|
||||
});
|
||||
}else{
|
||||
// 普通用户
|
||||
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效",(){
|
||||
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
|
||||
deleteKeyRequest(0);
|
||||
});
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
Obx(() => Visibility(
|
||||
visible: state.keyType.value == 4 ? true : false,
|
||||
child: Obx(() => CommonItem(
|
||||
leftTitel: "有效时间",
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
@ -146,7 +146,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
})))),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: "接收者",
|
||||
leftTitel: "接收者".tr,
|
||||
rightTitle: state.itemData.value.username ?? ""),
|
||||
const SizedBox(height: 1),
|
||||
CommonItem(
|
||||
@ -161,7 +161,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
Visibility(
|
||||
visible: state.itemData.value.keyRight == 1 ? true:false,
|
||||
child: CommonItem(
|
||||
leftTitel: "仅管理自己创建的用户",
|
||||
leftTitel: "仅管理自己创建的用户".tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
@ -169,10 +169,10 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
width: 60.w,
|
||||
child: _onlyManageYouCreatesUserSwitch())),
|
||||
),
|
||||
Visibility(
|
||||
visible: (state.itemData.value.keyRight == 1 && state.keyInfo.value.lockSetting!.remoteUnlock == 1) ? false:true,
|
||||
Visibility(// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
|
||||
visible: state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true:false,
|
||||
child: CommonItem(
|
||||
leftTitel: "远程开锁",
|
||||
leftTitel: "远程开锁".tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: true,
|
||||
@ -217,149 +217,6 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//根据类型获取限时有效期样式
|
||||
// Widget getPeriodValidityWidget() {
|
||||
// int? dateType = state.keyType.value;
|
||||
// Get.log('dateType:$dateType');
|
||||
// if (dateType == XSConstantMacro.keyTypeLong) {
|
||||
// return getLongTypeDateWidget();
|
||||
// } else if (dateType == XSConstantMacro.keyTypeTime) {
|
||||
// return getTimeLimitTypeDateWidget();
|
||||
// } else if (dateType == XSConstantMacro.keyTypeOnce) {
|
||||
// return getOnceTypeDateWidget();
|
||||
// } else if (dateType == XSConstantMacro.keyTypeLoop) {
|
||||
// return getLoopTypeDateWidget();
|
||||
// }
|
||||
// return Container();
|
||||
// }
|
||||
//
|
||||
// //永久钥匙
|
||||
// Widget getLongTypeDateWidget() {
|
||||
// return CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
// rightTitle: '永久',
|
||||
// isHaveDirection: true,
|
||||
// action: () {
|
||||
// Navigator.pushNamed(context, Routers.electronicKeyDetailChangeDate,
|
||||
// arguments: {"itemData": state.itemData.value});
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// //限时钥匙
|
||||
// Widget getTimeLimitTypeDateWidget() {
|
||||
// return CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
// allHeight: 90.h,
|
||||
// rightTitle: '${state.beginTime.value}\n${state.endTime.value}',
|
||||
// isHaveDirection: true,
|
||||
// action: () async {
|
||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate,
|
||||
// arguments: {"itemData": state.itemData.value});
|
||||
// if (data != null) {
|
||||
//
|
||||
// // print("state.beginTime.value:${state.beginTime.value}"
|
||||
// // "state.endTime.value:${state.endTime.value}"
|
||||
// // "state.beginTimeTimestamp.value:${state.beginTimeTimestamp.value}"
|
||||
// // "state.endTimeTimestamp.value:${state.endTimeTimestamp.value}");
|
||||
// setState(() {
|
||||
// state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
|
||||
// state.endTimeTimestamp.value = data["endTimeTimestamp"];
|
||||
// state.beginTime.value = DateTool()
|
||||
// .dateToYMDHNString((state.beginTimeTimestamp.value*1000).toString());
|
||||
// state.endTime.value = DateTool()
|
||||
// .dateToYMDHNString((state.endTimeTimestamp.value*1000).toString());
|
||||
// state.keyType.value = 2;
|
||||
// Get.log("2222222222222");
|
||||
// });
|
||||
// Get.log("1111111111111");
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// //单次钥匙
|
||||
// Widget getOnceTypeDateWidget() {
|
||||
// return CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
// rightTitle: '单次',
|
||||
// isHaveDirection: false,
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// //循环钥匙
|
||||
// Widget getLoopTypeDateWidget() {
|
||||
// DateTime startDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
|
||||
// DateTime endDateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
|
||||
// String useDateStr =
|
||||
// '${startDateStr.toLocal().toString().substring(0, 16)} \n ${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
//
|
||||
// List getEffectiveDateList = [];
|
||||
// List weekDaysList = state.itemData.value.weekDays!;
|
||||
// if (weekDaysList.isNotEmpty) {
|
||||
// String effectiveDateStr = '';
|
||||
// for (int i = 0; i < weekDaysList.length; i++) {
|
||||
// if (weekDaysList[i] == 1) {
|
||||
// effectiveDateStr = '一';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 2) {
|
||||
// effectiveDateStr = '二';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 3) {
|
||||
// effectiveDateStr = '三';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 4) {
|
||||
// effectiveDateStr = '四';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 5) {
|
||||
// effectiveDateStr = '五';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 6) {
|
||||
// effectiveDateStr = '六';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// } else if (weekDaysList[i] == 7) {
|
||||
// effectiveDateStr = '日';
|
||||
// getEffectiveDateList.add(effectiveDateStr);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return Column(
|
||||
// children: [
|
||||
// CommonItem(
|
||||
// leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||
// allHeight: 90.h,
|
||||
// rightTitle: useDateStr,
|
||||
// isHaveDirection: true,
|
||||
// isHaveLine: true,
|
||||
// action: () {
|
||||
// Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
||||
// "itemData": state.itemData.value,
|
||||
// "keyType": 1
|
||||
// });
|
||||
// }),
|
||||
// CommonItem(
|
||||
// leftTitel: '有效日',
|
||||
// rightTitle: getEffectiveDateList.map((e) => e.toString()).join(','),
|
||||
// isHaveDirection: true,
|
||||
// isHaveLine: true,
|
||||
// action: () {
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.electronicKeyPeriodValidityPage);
|
||||
// }),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// //发送时间
|
||||
// String getSenderDate(ElectronicKeyListItem indexEntity) {
|
||||
// String senderDate = '';
|
||||
// DateTime dateStr =
|
||||
// DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
// senderDate = dateStr.toLocal().toString().substring(0, 16);
|
||||
// return senderDate;
|
||||
// }
|
||||
|
||||
CupertinoSwitch _switch(isOn) {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
|
||||
@ -17,12 +17,12 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
var beginTimeTimestamp = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
if (beginTimeTimestamp > endTimeTimestamp || beginTimeTimestamp == endTimeTimestamp) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
showToast("失效时间需大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (endTimeTimestamp < DateTime.now().millisecondsSinceEpoch) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
showToast("生效时间需大于当前时间".tr);
|
||||
return;
|
||||
}
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
@ -38,7 +38,7 @@ class ElectronicKeyDetailChangeDateLogic extends BaseGetXController {
|
||||
remoteEnable: state.remoteEnable!.value
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
showToast("修改成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back(result: {
|
||||
|
||||
@ -19,12 +19,12 @@ class ElectronicKeyPeriodValidityLogic extends BaseGetXController {
|
||||
var endTimeTimestamp = DateTool().dateToTimestamp(state.endTime.value, 0);
|
||||
|
||||
if (starDateTimestamp >= endDateTimestamp) {
|
||||
showToast("失效日期要大于生效日期");
|
||||
showToast("失效日期要大于生效日期".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (starTimeTimestamp >= endTimeTimestamp) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
|
||||
@ -39,7 +39,7 @@ class ElectronicKeyPeriodValidityLogic extends BaseGetXController {
|
||||
isOnlyManageSelf: state.isOnlyManageSelf.value!,
|
||||
remoteEnable: state.remoteEnable.value!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("修改成功", something: () {
|
||||
showToast("修改成功".tr, something: () {
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
eventBus.fire(AuthorizedAdminPageRefreshUI());
|
||||
Get.back(result: {
|
||||
|
||||
@ -29,7 +29,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "修改有效期",
|
||||
barTitle: "修改有效期".tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
@ -63,7 +63,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "生效日期",
|
||||
leftTitel: "生效日期".tr,
|
||||
rightTitle: state.starDate.value,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
@ -74,7 +74,7 @@ class _ElectronicKeyPeriodValidityPageState extends State<ElectronicKeyPeriodVal
|
||||
});
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "失效日期",
|
||||
leftTitel: "失效日期".tr,
|
||||
rightTitle: state.endDate.value,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
@ -201,7 +202,7 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
cardId:state.cardId.value,
|
||||
fingerprintId:state.fingerprintId.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("操作记录列表成功:${entity.data?.itemList}");
|
||||
// print("操作记录列表成功:${entity.data?.itemList}");
|
||||
state.dataList.value = entity.data!.itemList!;
|
||||
}
|
||||
}
|
||||
@ -231,7 +232,7 @@ class KeyOperationRecordLogic extends BaseGetXController {
|
||||
KeyOperationRecordEntity entity =
|
||||
await ApiRepository.to.clearOperationRecord('28');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("清除数据成功");
|
||||
showToast("清除数据成功".tr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class _KeyOperationRecordPageState extends State<KeyOperationRecordPage> {
|
||||
int? operateDate = dataItem.operateDate;
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(operateDate!);
|
||||
String operateDateStr =
|
||||
'${dateStr.toLocal().toString().substring(0, 16)} 开锁';
|
||||
'${dateStr.toLocal().toString().substring(0, 16)} ${"开锁".tr}';
|
||||
|
||||
return _electronicKeyItem(operateDateStr, () {});
|
||||
},
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
@ -42,8 +43,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||
.resetElectronicKey(state.keyInfo.value.lockId.toString(), '0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("重置电子钥匙成功啦啦啦啦啦");
|
||||
showToast("重置成功", something: (){
|
||||
showToast("重置成功".tr, something: (){
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
@ -58,8 +58,7 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
includeUnderlings:includeUnderlings
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("删除电子钥匙成功");
|
||||
showToast("删除成功",something: (){
|
||||
showToast("删除成功".tr,something: (){
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
});
|
||||
@ -69,12 +68,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
|
||||
if(electronicKeyListItem.keyRight == 1){
|
||||
// 授权管理员
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复', (isAllData) {
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
|
||||
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
|
||||
});
|
||||
}else{
|
||||
// 普通用户
|
||||
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效",(){
|
||||
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
|
||||
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
@ -14,6 +13,7 @@ import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/keySearchWidget.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
@ -64,9 +64,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
_showDialog();
|
||||
ShowTipView().showIosTipWithContentDialog("该锁的电子钥匙都将被删除".tr, (){
|
||||
logic.resetElectronicKeyListRequest();
|
||||
});
|
||||
} else {
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast("演示模式".tr);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -164,7 +166,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
label: '删除'.tr,
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
@ -215,14 +217,14 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
useDateStr = "单次";
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
useDateStr = "单次".tr;
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
useDateStr = '循环'.tr;
|
||||
}
|
||||
|
||||
return useDateStr;
|
||||
@ -314,31 +316,4 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//是否重置弹窗
|
||||
void _showDialog() {
|
||||
showCupertinoDialog(
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('该锁的电子钥匙都将被删除'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.reset!.tr),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
logic.resetElectronicKeyListRequest();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
@ -16,12 +17,12 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
||||
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
||||
}
|
||||
if(state.lockIdList.isEmpty){
|
||||
showToast("请选择锁");
|
||||
showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.receiverList.isEmpty){
|
||||
showToast("请选择接收者");
|
||||
showToast("请选择接收者".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.canSendKey(
|
||||
@ -56,11 +57,11 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
||||
endTime = "0";
|
||||
|
||||
if (startDate.isEmpty) {
|
||||
showToast("请选择开始时间");
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间");
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
||||
// }
|
||||
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -84,7 +85,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
||||
case 3:
|
||||
typeValue = XSConstantMacro.keyTypeLoop;
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期");
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
@ -113,21 +114,7 @@ class MassSendElectronicKeyLogic extends BaseGetXController{
|
||||
remoteUnlockSwitch: state.isRemoteUnlock.value ? 1 : 2,
|
||||
keyRight: 0
|
||||
);
|
||||
|
||||
// var entity = await ApiRepository.to.batchSendKey(
|
||||
// endDate:getFailureDateTime,
|
||||
// keyGroupIdList:[],
|
||||
// lockIdList:state.lockIdList,
|
||||
// createUser:state.isCreateUser.value == true ? '1' : '0',
|
||||
// isRemoteUnlock:state.isRemoteUnlock.value ? '1' : '2',
|
||||
// keyNameForAdmin:receiverUserID,
|
||||
// receiverUsername:receiverUserID,
|
||||
// startDate:getEffectiveDateTime,
|
||||
// countryCode:state.countryCode.value,
|
||||
// usernameType:'1',
|
||||
// weekDays:state.weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('群发电子钥匙成功');
|
||||
state.isSendSuccess.value = true;
|
||||
resetData();
|
||||
} else {
|
||||
|
||||
@ -124,7 +124,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"发送成功",
|
||||
"发送成功".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp,
|
||||
color: Colors.black,
|
||||
@ -139,7 +139,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
state.isSendSuccess.value = false;
|
||||
Get.back();
|
||||
@ -284,13 +284,13 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
state.endTime.value = result['endDate'];
|
||||
state.effectiveDateTime.value = result['starTime'];
|
||||
state.failureDateTime.value = result['endTime'];
|
||||
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
// Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
||||
}
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日",
|
||||
leftTitel: "有效日".tr,
|
||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
@ -315,7 +315,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
|
||||
Obx(() => Visibility(
|
||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间",
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
|
||||
@ -19,7 +19,7 @@ class MassSendElectronicKeyState{
|
||||
|
||||
var type = ''.obs;// 限时、永久、单次、循环
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.obs;
|
||||
var countryName = '中国'.tr.obs;
|
||||
var countryCode = '86'.obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColors.mainColor,
|
||||
title: Text(
|
||||
'选择用户',
|
||||
'选择用户'.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 28.sp,
|
||||
@ -78,7 +78,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'已选中:${selectUserIdList.length}',
|
||||
'${"已选中".tr}:${selectUserIdList.length}',
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
Expanded(
|
||||
@ -89,7 +89,7 @@ class _LockUserListPageState extends State<LockUserListPage> {
|
||||
width: 120.w,
|
||||
height: 60.h,
|
||||
child: SubmitBtn(
|
||||
btnName: '确定',
|
||||
btnName: '确定'.tr,
|
||||
onClick: () {
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['lockUserList'] = selectDataList;
|
||||
|
||||
@ -60,7 +60,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
Container(
|
||||
width: ScreenUtil().screenWidth,
|
||||
margin: EdgeInsets.only(left: 20.w),
|
||||
child: Text('请选择要发送的锁',
|
||||
child: Text('请选择要发送的锁'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 22.sp)),
|
||||
),
|
||||
@ -69,7 +69,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
),
|
||||
Expanded(child: _buildListView(context, lockGroupList)),
|
||||
SubmitBtn(
|
||||
btnName: '确定',
|
||||
btnName: '确定'.tr,
|
||||
onClick: () {
|
||||
// print('得到lockid为$selectLockIdList ');
|
||||
Map<String, dynamic> resultMap = {};
|
||||
@ -86,7 +86,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
|
||||
//分组列表请求
|
||||
Future<List<GroupListItem>> mockNetworkDataRequest() async {
|
||||
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('1');
|
||||
MassSendLockGroupListEntity entity = await ApiRepository.to.lockGroupList('2');
|
||||
List<GroupListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
@ -137,7 +137,6 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
print('选中了么0');
|
||||
},
|
||||
typeImgList: const [],
|
||||
groupItem: itemData,
|
||||
|
||||
@ -16,7 +16,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
//发送钥匙请求
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
if (state.emailOrPhoneController.text.isEmpty) {
|
||||
showToast("请输入接收者账号");
|
||||
showToast("请输入接收者账号".tr);
|
||||
return;
|
||||
}
|
||||
// 姓名变为非必填(同通通锁)
|
||||
@ -42,11 +42,11 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
endTime = "0";
|
||||
|
||||
if (startDate.isEmpty) {
|
||||
showToast("请选择开始时间");
|
||||
showToast("请选择开始时间".tr);
|
||||
return;
|
||||
}
|
||||
if (endDate.isEmpty) {
|
||||
showToast("请选择结束时间");
|
||||
showToast("请选择结束时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
// }
|
||||
|
||||
if (int.parse(startDate) >= int.parse(endDate)) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
case 3:
|
||||
typeValue = XSConstantMacro.keyTypeLoop;
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期");
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
@ -107,7 +107,6 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
endTime: int.parse(endTime),
|
||||
isOnlyManageSelf: 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = int.parse(state.type.value);
|
||||
resetData();
|
||||
@ -144,7 +143,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('接收者号码未注册,请重新发送'),
|
||||
title: Text('接收者号码未注册,请重新发送'.tr),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
@ -185,7 +184,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text('是否发送电子钥匙给未注册账号\n${state.emailOrPhoneController.text}'),
|
||||
title: Text('${"是否发送电子钥匙给未注册账号".tr}\n${state.emailOrPhoneController.text}'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -202,7 +203,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
rightTitle: "",
|
||||
isTipsImg: true,
|
||||
tipsImgAction: () {
|
||||
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。");
|
||||
ShowTipView().showSureAlertDialog("人脸实名认证指的是用户在使用手机APP开锁时,需要先进行本人人脸验证,验证通过才能开锁。".tr);
|
||||
},
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
@ -244,7 +245,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Obx(() => Visibility(
|
||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日",
|
||||
leftTitel: "有效日".tr,
|
||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
@ -269,7 +270,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Obx(() => Visibility(
|
||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间",
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
@ -321,7 +322,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
setState(() {});
|
||||
} else {
|
||||
//演示模式不获取接口
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast("演示模式".tr);
|
||||
}
|
||||
}),
|
||||
Container(
|
||||
@ -337,7 +338,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.massSendElectronicKeyManagePage);
|
||||
} else {
|
||||
logic.showToast("演示模式");
|
||||
logic.showToast("演示模式".tr);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
@ -377,7 +378,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"发送成功",
|
||||
"发送成功".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp,
|
||||
color: Colors.black,
|
||||
@ -392,7 +393,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
state.isSendSuccess.value = false;
|
||||
logic.resetData();
|
||||
@ -401,7 +402,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '分享',
|
||||
btnName: '分享'.tr,
|
||||
onClick: () {
|
||||
// Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
_openModalBottomSheet();
|
||||
@ -444,8 +445,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
roomStatus: 1,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("标记为已入住成功啦啦啦啦啦");
|
||||
logic.showToast("标记成功");
|
||||
logic.showToast("标记成功".tr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
overlayColor:
|
||||
MaterialStateProperty.all<Color>(Colors.white)),
|
||||
child: Text(
|
||||
'取消',
|
||||
'取消'.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
|
||||
),
|
||||
@ -621,10 +621,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = [];
|
||||
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
|
||||
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友'.tr, 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信'.tr, 1));
|
||||
widgetList.add(buildCenter3('images/icon_email.png', '邮件'.tr, 2));
|
||||
widgetList.add(buildCenter3('images/icon_more.png', '更多'.tr, 3));
|
||||
|
||||
return widgetList;
|
||||
}
|
||||
@ -666,14 +666,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
@ -686,7 +686,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功'.tr;
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -24,7 +24,7 @@ class SendElectronicKeyState {
|
||||
|
||||
var type = ''.obs;// 限时、永久、单次、循环
|
||||
var isSendSuccess = false.obs;
|
||||
var countryName = '中国'.obs;
|
||||
var countryName = '中国'.tr.obs;
|
||||
var countryCode = '86'.obs;
|
||||
var isCreateUser = false.obs; //用户未注册时传1 已注册传0
|
||||
|
||||
|
||||
@ -12,8 +12,7 @@ class SendEmailNotificationPage extends StatefulWidget {
|
||||
const SendEmailNotificationPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SendEmailNotificationPage> createState() =>
|
||||
_SendEmailNotificationPageState();
|
||||
State<SendEmailNotificationPage> createState() => _SendEmailNotificationPageState();
|
||||
}
|
||||
|
||||
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
@ -21,87 +20,80 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_emailController.text =
|
||||
"亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
||||
_emailController.text = "亲爱的用户 \n\n你收到电子钥匙,请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "邮件通知",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "786612630@qq.com",
|
||||
isHaveLine: true,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: "类型",
|
||||
rightTitle: "个人邮件",
|
||||
isHaveDirection: true,
|
||||
),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: "模板",
|
||||
rightTitle: "默认模板",
|
||||
appBar: TitleAppBar(barTitle: "邮件通知", haveBack: true, backgroundColor: AppColors.mainColor),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
rightTitle: "786612630@qq.com",
|
||||
isHaveLine: true,
|
||||
),
|
||||
CommonItem(
|
||||
leftTitel: "类型",
|
||||
rightTitle: "个人邮件",
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true),
|
||||
Container(
|
||||
height: 360.h,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||
child: TextField(
|
||||
maxLines: 8,
|
||||
maxLength: 1000,
|
||||
textAlign: TextAlign.start,
|
||||
controller: _emailController,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22.sp,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
|
||||
///设置边框的粗细
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
Container(height: 10.h),
|
||||
CommonItem(leftTitel: "模板", rightTitle: "默认模板", isHaveDirection: true, isHaveLine: true),
|
||||
Container(
|
||||
height: 360.h,
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||
child: TextField(
|
||||
maxLines: 8,
|
||||
maxLength: 1000,
|
||||
textAlign: TextAlign.start,
|
||||
controller: _emailController,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 22.sp,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
|
||||
///用来配置输入框获取焦点时的颜色
|
||||
focusedBorder: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
///设置边框的粗细
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
|
||||
///设置边框的粗细
|
||||
width: 1,
|
||||
///用来配置输入框获取焦点时的颜色
|
||||
focusedBorder: OutlineInputBorder(
|
||||
///设置边框四个角的弧度
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.h)),
|
||||
|
||||
///用来配置边框的样式
|
||||
borderSide: const BorderSide(
|
||||
///设置边框的颜色
|
||||
color: Color(0xffB2B2B2),
|
||||
|
||||
///设置边框的粗细
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(height: 40.h),
|
||||
SubmitBtn(
|
||||
btnName: '发送',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
],
|
||||
Container(height: 40.h),
|
||||
SubmitBtn(
|
||||
btnName: '发送',
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
|
||||
@ -49,7 +49,7 @@ class AddFingerprintTypeLogic extends BaseGetXController{
|
||||
}
|
||||
} else if (state.selectType.value == "2") {
|
||||
if (state.beginTime.value.isEmpty) {
|
||||
showToast("请选择有效期");
|
||||
showToast("请选择有效期".tr);
|
||||
return;
|
||||
}
|
||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
||||
|
||||
@ -325,7 +325,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
|
||||
@ -34,7 +34,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
void initReplySubscription() {
|
||||
state.replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
// Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
|
||||
Get.log("锁详情收到了蓝牙解析消息 reply:${reply.commandType}");
|
||||
// 开门
|
||||
if (reply is OpenDoorReply && state.ifCurrentScreen.value == true) {
|
||||
_replyOpenLock(reply);
|
||||
|
||||
@ -15,7 +15,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
state.itemData.value.keyboardPwdId.toString(),
|
||||
1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功", something: (){
|
||||
showToast("删除成功".tr, something: (){
|
||||
Get.back(result: "deletScuess");
|
||||
});
|
||||
}
|
||||
@ -37,7 +37,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
keyboardPwdType: state.itemData.value.keyboardPwdType!);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Get.back();
|
||||
showToast("修改成功", something: (){
|
||||
showToast("修改成功".tr, something: (){
|
||||
if(changType == 1){
|
||||
// 修改名字
|
||||
state.keyboardPwdName.value = state.inputNameController.text;
|
||||
@ -45,7 +45,6 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
||||
// 修改密码
|
||||
state.keyboardPwd.value = state.inputPwdController.text;
|
||||
}
|
||||
print("state.itemData.value.keyboardPwd:${state.itemData.value.keyboardPwd} state.itemData.value.keyboardPwdName:${state.itemData.value.keyboardPwdName}");
|
||||
eventBus.fire(GetPasswordListRefreshUI());
|
||||
});
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
||||
useDateStr = '${endDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
@ -97,7 +97,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
@ -137,7 +137,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周天".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
@ -11,7 +11,6 @@ import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/keySearchWidget.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/showTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
@ -125,10 +124,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String useDateStr = logic.getUseDateStr(passwordKeyListItem);// 使用期限
|
||||
|
||||
//使用期限
|
||||
useDateStr = logic.getUseDateStr(passwordKeyListItem);
|
||||
return Slidable(
|
||||
key:ValueKey(passwordKeyListItem.keyboardPwdId),
|
||||
endActionPane: ActionPane(
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
// ignore_for_file: slash_for_doc_comments
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
@ -22,20 +24,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
|
||||
/// 收到点击密码类型更新
|
||||
/**
|
||||
单次 1 只能在开始时间后6小时内使用一次
|
||||
永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
单次 1 只能在开始时间后6小时内使用一次
|
||||
永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
*/
|
||||
//获取密码请求
|
||||
Future<void> getKeyboardPwdRequest() async {
|
||||
@ -45,14 +47,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
String getKeyType = state.widgetType.value.toString();
|
||||
|
||||
if (state.nameController.text.isEmpty) {
|
||||
showToast("请输入姓名");
|
||||
showToast("请输入姓名".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
//循环密码
|
||||
if (state.widgetType.value == 4) {
|
||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
showToast("生效时间不能小于当前时间");
|
||||
showToast("生效时间不能小于当前时间".tr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -62,12 +64,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
} else if (state.widgetType.value == 1) {
|
||||
//限时
|
||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
showToast("生效时间不能小于当前时间");
|
||||
showToast("生效时间不能小于当前时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (startDate >= endDate) {
|
||||
showToast("失效时间要大于生效时间");
|
||||
showToast("失效时间要大于生效时间".tr);
|
||||
return;
|
||||
}
|
||||
getKeyType = '3';
|
||||
@ -80,7 +82,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
//循环
|
||||
//限时
|
||||
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
showToast("结束时间不能小于当前时间");
|
||||
showToast("结束时间不能小于当前时间".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,7 +121,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
endHours: state.loopEndHours.value,
|
||||
isCoerced: 1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('获取密码成功');
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
state.pwdNameStr = state.nameController.text;
|
||||
@ -155,7 +156,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
getFailureDateTime,
|
||||
'1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('获取密码成功');
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
state.pwdNameStr = state.nameController.text;
|
||||
@ -170,6 +170,26 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> checkKeyboardpwdNameRequest() async {
|
||||
if (state.nameController.text.isEmpty) {
|
||||
showToast("请输入姓名");
|
||||
return;
|
||||
}
|
||||
if (state.pwdController.text.isEmpty) {
|
||||
showToast("请输入密码");
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.checkKeyboardpwdName(
|
||||
lockId:state.keyInfo.value.lockId.toString(),
|
||||
keyboardPwdName:state.nameController.text,
|
||||
keyboardPwd:state.pwdController.text,);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
senderCustomPasswords();
|
||||
} else {
|
||||
showToast('${entity.errorMsg}');
|
||||
}
|
||||
}
|
||||
|
||||
// late DateTime getStartDateTime;
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
@ -220,17 +240,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
cancelBlueConnetctToastTimer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -243,16 +263,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
|
||||
// 设置自定义密码
|
||||
Future<void> senderCustomPasswords() async {
|
||||
|
||||
if (state.nameController.text.isEmpty) {
|
||||
showToast("请输入姓名");
|
||||
return;
|
||||
}
|
||||
if (state.pwdController.text.isEmpty) {
|
||||
showToast("请输入密码");
|
||||
return;
|
||||
}
|
||||
|
||||
var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
var endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
//非永久 须有时限
|
||||
|
||||
@ -363,7 +363,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
if (isDemoMode == false) {
|
||||
//自定义密码
|
||||
if (state.widgetType.value == 3) {
|
||||
logic.senderCustomPasswords();
|
||||
logic.checkKeyboardpwdNameRequest();
|
||||
} else {
|
||||
logic.getKeyboardPwdRequest();
|
||||
}
|
||||
@ -417,7 +417,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
state.isSendSuccess.value = false;
|
||||
state.nameController.text = "";
|
||||
@ -428,7 +428,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '分享',
|
||||
btnName: '分享'.tr,
|
||||
onClick: () {
|
||||
_openModalBottomSheet();
|
||||
},
|
||||
@ -547,7 +547,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
overlayColor:
|
||||
MaterialStateProperty.all<Color>(Colors.white)),
|
||||
child: Text(
|
||||
'取消',
|
||||
'取消'.tr,
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
|
||||
),
|
||||
@ -563,10 +563,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = [];
|
||||
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
|
||||
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友'.tr, 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信'.tr, 1));
|
||||
widgetList.add(buildCenter3('images/icon_email.png', '邮件'.tr, 2));
|
||||
widgetList.add(buildCenter3('images/icon_more.png', '更多'.tr, 3));
|
||||
|
||||
return widgetList;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
|
||||
@ -228,7 +228,7 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
|
||||
|
||||
@ -72,7 +72,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
}
|
||||
switch (status) {
|
||||
case PermissionStatus.denied:
|
||||
print("拒绝");
|
||||
// print("拒绝");
|
||||
break;
|
||||
case PermissionStatus.granted:
|
||||
if(Platform.isIOS){
|
||||
@ -84,16 +84,16 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
}
|
||||
break;
|
||||
case PermissionStatus.limited:
|
||||
print("限制");
|
||||
// print("限制");
|
||||
break;
|
||||
case PermissionStatus.permanentlyDenied:
|
||||
print("永久的否认");
|
||||
// print("永久的否认");
|
||||
break;
|
||||
case PermissionStatus.provisional:
|
||||
print("临时");
|
||||
// print("临时");
|
||||
break;
|
||||
default:
|
||||
print("其他状态");
|
||||
// print("其他状态");
|
||||
// requestLocation();
|
||||
break;
|
||||
}
|
||||
@ -101,7 +101,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
|
||||
Future<void> requestAndroidLocation() async {
|
||||
location.onLocationChanged().listen((event) {
|
||||
print("listenLocationChanged$event");
|
||||
// print("listenLocationChanged$event");
|
||||
// EasyLoading.dismiss();
|
||||
if (event.isNotEmpty) {
|
||||
setState(() {
|
||||
@ -116,7 +116,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
location = AMapFlutterLocation()
|
||||
..setLocationOption(AMapLocationOption())
|
||||
..onLocationChanged().listen((event) {
|
||||
print("listenLocationChanged$event");
|
||||
// print("listenLocationChanged$event");
|
||||
// EasyLoading.dismiss();
|
||||
if (event.isNotEmpty) {
|
||||
setState(() {
|
||||
@ -163,7 +163,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("地理位置", style: TextStyle(fontSize: 50.sp)),
|
||||
Text("地理位置".tr, style: TextStyle(fontSize: 50.sp)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -202,12 +202,11 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
),
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
height: 45.h,
|
||||
margin: EdgeInsets.only(left: 25.w, top: 20.h, right: 25.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("检查以确保以下地址是正确的", style: TextStyle(fontSize: 24.sp)),
|
||||
Flexible(child: Text("检查以确保以下地址是正确的".tr, style: TextStyle(fontSize: 24.sp))),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -233,7 +232,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
],
|
||||
) : SizedBox(
|
||||
height: 1.sw/5*4 + 65.h*2,
|
||||
child: const Center(child: Text('地图加载中,请稍候。。。')))
|
||||
child: Center(child: Text('地图加载中,请稍候。。。'.tr)))
|
||||
,
|
||||
),
|
||||
SizedBox(height:200.h),
|
||||
@ -242,7 +241,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
"跳过",
|
||||
"跳过".tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
@ -263,7 +262,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage> with RouteA
|
||||
),
|
||||
onPressed: () {
|
||||
if(addressInfo!.isEmpty){
|
||||
logic.showToast("还未获取到位置信息哦,请耐心等待一下!");
|
||||
logic.showToast("还未获取到位置信息哦,请耐心等待一下!".tr);
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
|
||||
@ -32,11 +32,17 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 80.h,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500),),
|
||||
],
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 50.w, right: 50.w),
|
||||
width: 1.sw,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500))
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 80.h,),
|
||||
Container(
|
||||
@ -54,7 +60,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
],
|
||||
// style:TextStyle(height: 1.1, fontSize: 36.sp, fontWeight: FontWeight.w400, color:AppColors.mainColor),
|
||||
decoration: InputDecoration(
|
||||
hintText: '请填写信息',
|
||||
hintText: '请填写信息'.tr,
|
||||
hintStyle: TextStyle(
|
||||
// height: 1.1,
|
||||
fontSize: 24.sp,
|
||||
|
||||
@ -33,6 +33,8 @@ class StarLockMineLogic extends BaseGetXController {
|
||||
state.userNickName.value = (await Storage.getNickname())!;
|
||||
state.userMobile.value = (await Storage.getMobile())! ?? '';
|
||||
state.userEmail.value = (await Storage.getEmail())!;
|
||||
state.userHeadUrl.value = (await Storage.getHeadUrl())!;
|
||||
|
||||
Get.log("userNickName:${state.userNickName.value} userMobile:${state.userMobile.value} userEmail:${state.userEmail.value}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:star_lock/flavors.dart';
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../baseWidget.dart';
|
||||
import '../../tools/customNetworkImage.dart';
|
||||
import '../../tools/submitBtn.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'starLockMine_logic.dart';
|
||||
@ -71,17 +72,21 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
child: Container(
|
||||
width: 105.w,
|
||||
height: 105.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(52.5.w)),
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius:
|
||||
// BorderRadius.all(Radius.circular(52.5.w)),
|
||||
// ),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(52.5.w),
|
||||
child: CustomNetworkImage(url:state.userHeadUrl.value??"", width:105.w, height:105.h),
|
||||
),
|
||||
child:
|
||||
// state.headUrl().isNotEmpty ?
|
||||
// Image(image: NetworkImage(state.loginData.value.data!.headUrl!)) :
|
||||
Image.asset(
|
||||
'images/mine/icon_mine_main_defaultAvatar.png',
|
||||
width: 60.w,
|
||||
height: 60.w)),
|
||||
// Image.asset(
|
||||
// 'images/mine/icon_mine_main_defaultAvatar.png',
|
||||
// width: 60.w,
|
||||
// height: 60.w)
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
|
||||
@ -6,6 +6,6 @@ class StarLockMineState {
|
||||
var userNickName = "".obs;
|
||||
var userMobile = "".obs;
|
||||
var userEmail = "".obs;
|
||||
|
||||
var userHeadUrl = "".obs;
|
||||
void onClose() {}
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@ class MinePersonInfoLogic extends GetConnect {
|
||||
Future<void> getUserInfoRequest() async {
|
||||
MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo("");
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('到了这里么');
|
||||
state.mineInfoData.value = entity.data!;
|
||||
}
|
||||
}
|
||||
@ -33,9 +32,7 @@ class MinePersonInfoLogic extends GetConnect {
|
||||
}
|
||||
|
||||
// 上传头像
|
||||
void uploadFile(
|
||||
MinePersonGetUploadFileInfoEntity
|
||||
minePersonGetUploadFileInfoEntity) async {
|
||||
void uploadFile(MinePersonGetUploadFileInfoEntity minePersonGetUploadFileInfoEntity) async {
|
||||
// String json = JsonDecoder(minePersonGetUploadFileInfoEntity.data!.formData!);
|
||||
|
||||
// var formData = FormData();
|
||||
@ -45,10 +42,8 @@ class MinePersonInfoLogic extends GetConnect {
|
||||
// MultipartFile(state.image!.path, filename: 'b'),
|
||||
// ));
|
||||
|
||||
Map<String, dynamic> user =
|
||||
minePersonGetUploadFileInfoEntity.data!.formData!;
|
||||
user[minePersonGetUploadFileInfoEntity.data!.fileField!] =
|
||||
state.image!.path;
|
||||
Map<String, dynamic> user = minePersonGetUploadFileInfoEntity.data!.formData!;
|
||||
user[minePersonGetUploadFileInfoEntity.data!.fileField!] = state.image!.path;
|
||||
final form = FormData(user);
|
||||
var entity = await ApiRepository.to.uploadFile(
|
||||
url: minePersonGetUploadFileInfoEntity.data!.uploadUrl!, body: form);
|
||||
@ -93,7 +88,6 @@ class MinePersonInfoLogic extends GetConnect {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
getUserInfoRequest();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -7,12 +7,14 @@ import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
import '../../../tools/customNetworkImage.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
|
||||
@ -24,23 +26,18 @@ class MinePersonInfoPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
with WidgetsBindingObserver {
|
||||
// with WidgetsBindingObserver
|
||||
{
|
||||
final logic = Get.put(MinePersonInfoLogic());
|
||||
final state = Get.find<MinePersonInfoLogic>().state;
|
||||
|
||||
@override
|
||||
initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this); // 添加观察者
|
||||
logic.getUserInfoRequest();
|
||||
_checkCameraPermission();
|
||||
_checkPhotoPermission();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this); // 移除观察者
|
||||
super.dispose();
|
||||
// WidgetsBinding.instance.addObserver(this); // 添加观察者
|
||||
// logic.getUserInfoRequest();
|
||||
// _checkCameraPermission();
|
||||
// _checkPhotoPermission();
|
||||
}
|
||||
|
||||
// // 当应用生命周期状态变化时调用
|
||||
@ -70,26 +67,33 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: ClipOval(
|
||||
child: state.image != null
|
||||
? Image.file(
|
||||
File(state.image!.path),
|
||||
width: 72.w,
|
||||
height: 72.w,
|
||||
fit: BoxFit.fill,
|
||||
)
|
||||
: Image.asset(
|
||||
'images/controls_user.png',
|
||||
width: 72.w,
|
||||
height: 72.w,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
rightWidget:
|
||||
Container(
|
||||
// color: Colors.orange,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(36.w),
|
||||
child: CustomNetworkImage(url:"https://ui-avatars.com/api/?name=%E6%98%B5&color=7F9CF5&background=EBF4FF", width:72.w, height:72.w),
|
||||
),
|
||||
),
|
||||
// ClipOval(
|
||||
// child: state.image != null
|
||||
// ? Image.file(
|
||||
// File(state.image!.path),
|
||||
// width: 72.w,
|
||||
// height: 72.w,
|
||||
// fit: BoxFit.fill,
|
||||
// )
|
||||
// : Image.asset(
|
||||
// 'images/controls_user.png',
|
||||
// width: 72.w,
|
||||
// height: 72.w,
|
||||
// fit: BoxFit.fill,
|
||||
// ),
|
||||
// ),
|
||||
action: () async {
|
||||
//安卓平台下首次进入应用需向用户告知获取权限用途弹窗
|
||||
if (Platform.isAndroid) {
|
||||
AppFirstEnterHandle()
|
||||
.getAppFirstEnter(context, isAgreeCamera);
|
||||
AppFirstEnterHandle().getAppFirstEnter(context, isAgreeCamera);
|
||||
var getFlag = await Storage.getString(isAgreeCamera);
|
||||
if (getFlag == isAgreeCamera) {
|
||||
_openModalBottomSheet();
|
||||
@ -101,16 +105,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
||||
rightTitle: state.mineInfoData.value.nickname != null
|
||||
? state.mineInfoData.value.nickname!
|
||||
: "",
|
||||
rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! : "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditNamePage, arguments: {
|
||||
'nickName': state.mineInfoData.value.nickname
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoEditNamePage,
|
||||
arguments: {'nickName': state.mineInfoData.value.nickname})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
||||
@ -122,16 +123,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
action: () {
|
||||
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
||||
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, arguments: {
|
||||
'mobile': state.mineInfoData.value.mobile!,
|
||||
'isFrom': '1'
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||
'mobile': state.mineInfoData.value.mobile!,
|
||||
'isFrom': '1'
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
|
||||
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -144,18 +142,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
action: () {
|
||||
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
||||
if (state.mineInfoData.value.email!.isNotEmpty) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.mineInfoData.value.email!
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.mineInfoData.value.email!
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
|
||||
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
@ -164,30 +157,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoResetPasswordPage);
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoResetPasswordPage);
|
||||
}),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||
rightTitle:
|
||||
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
|
||||
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoSetSafetyProblemPage)
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage)
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoViewSafetyProblemPage);
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage);
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: state.mineInfoData.value.countryName != null
|
||||
? state.mineInfoData.value.countryName!
|
||||
: "",
|
||||
rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! : "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: false)),
|
||||
],
|
||||
@ -221,7 +208,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
}
|
||||
|
||||
Future<void> _requestPhotoPermission() async {
|
||||
var status = await Permission.photos.request();
|
||||
//针对andriud33以下的设备兼容
|
||||
bool isAndroid33 = AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
|
||||
var status = isAndroid33 ? await Permission.photos.request() : await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
setState(() {
|
||||
state.hasPhotoPermission.value = true; // 如果权限被授予,更新状态变量
|
||||
@ -230,6 +219,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
// 如果权限被拒绝,你可以选择在这里处理相应逻辑,比如显示一个提示框
|
||||
showPermissionDeniedDialog();
|
||||
}
|
||||
|
||||
// 请求相册权限
|
||||
// PermissionStatus photosStatus = await Permission.photos.request();
|
||||
//
|
||||
// if (photosStatus.isGranted) {
|
||||
// // 相册权限已被授予
|
||||
// state.hasPhotoPermission.value = true;
|
||||
// } else {
|
||||
// // 如果权限被拒绝,你可以选择在这里处理相应逻辑,比如显示一个提示框
|
||||
// showPermissionDeniedDialog();
|
||||
// }
|
||||
}
|
||||
|
||||
// Future<void> requestPhotoPermission() async {
|
||||
@ -271,8 +271,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
Future _openModalBottomSheet() async {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.circular(10)),
|
||||
builder: (BuildContext context) {
|
||||
return AlertBottomWidget(
|
||||
topTitle: '',
|
||||
@ -281,13 +280,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
int getSelectIndex = value;
|
||||
if (getSelectIndex == 0) {
|
||||
//拍照选项
|
||||
state.hasCameraPermission.value == true
|
||||
? selectCamera()
|
||||
: _requestCameraPermission();
|
||||
state.hasCameraPermission.value == true ? selectCamera() : _requestCameraPermission();
|
||||
} else if (getSelectIndex == 1) {
|
||||
state.hasPhotoPermission.value == true
|
||||
? selectImage()
|
||||
: _requestPhotoPermission();
|
||||
state.hasPhotoPermission.value == true ? selectImage() : _requestPhotoPermission();
|
||||
}
|
||||
},
|
||||
);
|
||||
@ -296,8 +291,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
|
||||
///拍摄照片
|
||||
selectCamera() async {
|
||||
XFile? photo = await state.imagePicker.pickImage(
|
||||
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
||||
XFile? photo = await state.imagePicker.pickImage(source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
||||
if (photo != null) {
|
||||
state.image = photo;
|
||||
// logic.getUpTokenRequest();
|
||||
@ -349,4 +343,10 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// WidgetsBinding.instance.removeObserver(this); // 移除观察者
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,12 @@ class AppUnlockNeedMobileNetworkingLockLogic extends BaseGetXController{
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
dataList = entity.data!.list!;
|
||||
state.lockItemList.value = dataList;
|
||||
for (int i = 0; i < dataList.length; i++) {
|
||||
var itemData = dataList[i];
|
||||
if (itemData.appUnlockOnline == 1) {
|
||||
state.selectLockIdList.add(itemData.lockId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ class AddAuthorizedAdministratorLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
if(state.lockIdList.isEmpty){
|
||||
showToast("请选择锁");
|
||||
showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -399,7 +399,7 @@ class _AddAuthorizedAdministratorPageState extends State<AddAuthorizedAdministra
|
||||
height: 20.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: '完成',
|
||||
btnName: '完成'.tr,
|
||||
onClick: () {
|
||||
state.isSendSuccess.value = false;
|
||||
Navigator.pop(context, true);
|
||||
|
||||
@ -12,7 +12,7 @@ class GroupEditLockLogic extends BaseGetXController {
|
||||
//锁分组里面添加锁
|
||||
Future<void> lockGroupAddLock(List lockIds) async {
|
||||
if(lockIds.isEmpty){
|
||||
showToast("请选择锁");
|
||||
showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.lockGroupAddLock(
|
||||
@ -29,7 +29,7 @@ class GroupEditLockLogic extends BaseGetXController {
|
||||
//锁分组里面添加锁
|
||||
Future<void> lockGroupDeletLock(List lockIds) async {
|
||||
if(lockIds.isEmpty){
|
||||
showToast("请选择锁");
|
||||
showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
var entity = await ApiRepository.to.lockGroupDeletLock(lockIds: lockIds);
|
||||
|
||||
@ -12,7 +12,7 @@ class LockGroupListLogic extends BaseGetXController {
|
||||
|
||||
//分组列表请求
|
||||
void mockNetworkDataRequest() async {
|
||||
var entity = await ApiRepository.to.lockGroupList('1');
|
||||
var entity = await ApiRepository.to.lockGroupList('0');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (entity.data != null) {
|
||||
state.lockNum = 0;
|
||||
|
||||
@ -146,7 +146,7 @@ class _SelectGetewayListPageState extends State<SelectGetewayListPage> {
|
||||
}
|
||||
}
|
||||
if(isCanNext == false){
|
||||
logic.showToast("请选择锁");
|
||||
logic.showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {
|
||||
|
||||
@ -151,7 +151,7 @@ class _TransferSmartLockPageState extends State<TransferSmartLockPage> {
|
||||
}
|
||||
}
|
||||
if(isCanNext == false){
|
||||
logic.showToast("请选择锁");
|
||||
logic.showToast("请选择锁".tr);
|
||||
return;
|
||||
}
|
||||
var data = await Get.toNamed(Routers.recipientInformationPage, arguments: {
|
||||
|
||||
@ -45,6 +45,7 @@ abstract class Api {
|
||||
|
||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||
final String passwordKeyAddURL = '/keyboardPwd/add'; //自定义密码
|
||||
final String passwordKeyCheckKeyboardpwdNameURL = '/keyboardPwd/checkKeyboardpwdName'; //自定义密码校验密码跟名字是否重复
|
||||
final String updatePasswordKeyURL = '/keyboardPwd/update'; //修改密码详情
|
||||
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
||||
final String addlockGroupURL = '/keyGroup/add'; //创建锁分组
|
||||
|
||||
@ -451,6 +451,20 @@ class ApiProvider extends BaseProvider {
|
||||
'addType': addType,
|
||||
}));
|
||||
|
||||
// 自定义密码校验名字密码是否重复
|
||||
Future<Response> checkKeyboardpwdName(
|
||||
String lockId,
|
||||
String keyboardPwdName,
|
||||
String keyboardPwd
|
||||
) =>
|
||||
post(
|
||||
passwordKeyCheckKeyboardpwdNameURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'keyboardPwdName': keyboardPwdName,
|
||||
'keyboardPwd': keyboardPwd,
|
||||
}));
|
||||
|
||||
Future<Response> updateKeyboardPwd(
|
||||
int lockId,
|
||||
String keyboardPwdId,
|
||||
|
||||
@ -450,6 +450,18 @@ class ApiRepository {
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//自定义密码校验密码名称或密码是否已存在
|
||||
Future<PasswordKeyEntity> checkKeyboardpwdName(
|
||||
{
|
||||
required String lockId,
|
||||
required String keyboardPwdName,
|
||||
required String keyboardPwd
|
||||
}) async {
|
||||
final res = await apiProvider.checkKeyboardpwdName(lockId, keyboardPwdName,
|
||||
keyboardPwd);
|
||||
return PasswordKeyEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//修改密码
|
||||
Future<PasswordKeyEntity> updatePasswordKey(
|
||||
{required int lockId,
|
||||
|
||||
@ -175,6 +175,12 @@ class Storage {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
static Future<String?> getHeadUrl() async {
|
||||
LoginData? loginData = await getLoginData();
|
||||
String? headUrl = loginData!.headUrl;
|
||||
return headUrl;
|
||||
}
|
||||
|
||||
static Future<LoginData?> getLoginData() async {
|
||||
LoginData? loginData;
|
||||
final data = await Storage.getString(saveUserLoginData);
|
||||
|
||||
@ -27,8 +27,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.22+20240403:1、打包预发布环境给欧阳测试
|
||||
# 1.0.23+20240406:1、打包预发布环境给欧阳测试
|
||||
# 1.0.24+20240407:1、打包预发布环境给欧阳测试
|
||||
# 1.0.25+2024040702:1、打包预发布环境给欧阳测试
|
||||
# 1.0.26+20240408:打包预发布环境给欧阳测试
|
||||
|
||||
version: 1.0.24+20240407
|
||||
version: 1.0.26+20240408
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
@ -109,7 +111,7 @@ dependencies:
|
||||
#高德地图定位
|
||||
amap_flutter_location: ^3.0.0
|
||||
#权限使用
|
||||
permission_handler: ^10.4.3
|
||||
permission_handler: ^11.3.1
|
||||
#高德地图地图
|
||||
amap_flutter_map: ^3.0.0
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user