修改TAPDbug
This commit is contained in:
parent
a04f3523df
commit
a4ccb32cf2
@ -611,8 +611,8 @@
|
||||
"请输入小于或等于60的数字": "Please enter a number less than 60",
|
||||
"操作成功": "Operation success",
|
||||
"管理员密码相同,无需修改": "The administrator password is the same and does not need to be modified",
|
||||
"修改密码": "Modify password",
|
||||
"请输入6位管理员密码": "Please enter a 6-digit administrator password",
|
||||
"请输入6-9位数字": "Please enter 6-9 digits",
|
||||
"请输入6-9位管理员密码": "Please enter a 6-9 digit administrator password",
|
||||
"请输入新的管理员密码": "Please enter a new administrator password",
|
||||
"未分组": "Not grouped",
|
||||
"请输入分组名称": "Please enter the group name",
|
||||
|
||||
@ -636,8 +636,8 @@
|
||||
"请输入小于或等于60的数字": "请输入小于或等于60的数字",
|
||||
"操作成功": "操作成功",
|
||||
"管理员密码相同,无需修改": "管理员密码相同,无需修改",
|
||||
"修改密码": "修改密码",
|
||||
"请输入6位管理员密码": "请输入6位管理员密码",
|
||||
"请输入6-9位数字": "请输入6-9位数字",
|
||||
"请输入6-9位管理员密码": "请输入6-9位管理员密码",
|
||||
"请输入新的管理员密码": "请输入新的管理员密码",
|
||||
"未分组": "未分组",
|
||||
"请输入分组名称": "请输入分组名称",
|
||||
|
||||
@ -611,8 +611,8 @@
|
||||
"请输入小于或等于60的数字": "请输入小于或等于60的数字",
|
||||
"操作成功": "操作成功",
|
||||
"管理员密码相同,无需修改": "管理员密码相同,无需修改",
|
||||
"修改密码": "修改密码",
|
||||
"请输入6位管理员密码": "请输入6位管理员密码",
|
||||
"请输入6-9位数字": "请输入6-9位数字",
|
||||
"请输入6-9位管理员密码": "请输入6-9位管理员密码",
|
||||
"请输入新的管理员密码": "请输入新的管理员密码",
|
||||
"未分组": "未分组",
|
||||
"请输入分组名称": "请输入分组名称",
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -59,7 +60,7 @@ class _AddCardPageState extends State<AddCardPage>
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}",
|
||||
'${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}',
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
@ -233,8 +234,7 @@ class _AddCardPageState extends State<AddCardPage>
|
||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||
child: CommonItem(
|
||||
leftTitel: '有效时间'.tr,
|
||||
rightTitle:
|
||||
'${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
||||
rightTitle: '${state.effectiveDateTime.value}-${state.failureDateTime.value}',
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||
|
||||
@ -9,7 +9,7 @@ class AddCardTypeState{
|
||||
Map map = Get.arguments;
|
||||
lockId.value = map['lockId'];
|
||||
fromType.value = map['fromType'];
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||
if(fromType.value == 2){
|
||||
fromTypeTwoStaffName.value = map['fromTypeTwoStaffName']; // 从添加员工进入 传入员工名字
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
import '../../../../../blue/io_protocol/io_changeAdministratorPassword.dart';
|
||||
@ -23,7 +24,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||
if (reply is ChangeAdministratorPasswordReply && state.ifCurrentScreen.value == true) {
|
||||
_replyChangeAdministratorPassword(reply);
|
||||
}
|
||||
@ -36,7 +37,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
|
||||
// 修改管理员密码
|
||||
Future<void> _replyChangeAdministratorPassword(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
final int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
@ -48,14 +49,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = reply.data.sublist(5, 9);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
final List<int> token = reply.data.sublist(5, 9);
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
IoSenderManage.changeAdministratorPasswordCommand(
|
||||
@ -190,14 +191,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.changeAdministratorPasswordCommand(
|
||||
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
||||
@ -224,19 +225,19 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
}
|
||||
|
||||
// 更新管理员密码
|
||||
void addLockAdminPassword(bool isChange) async {
|
||||
var entity = await ApiRepository.to.setAdminPasswordData(
|
||||
Future<void> addLockAdminPassword(bool isChange) async {
|
||||
final GetServerDatetimeEntity entity = await ApiRepository.to.setAdminPasswordData(
|
||||
lockId: state.lockSetInfoData.value.lockBasicInfo!.lockId!,
|
||||
adminPwd: state.adminPwd.value,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if(isChange == true){
|
||||
showToast("修改成功".tr, something: (){
|
||||
showToast('修改成功'.tr, something: (){
|
||||
state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
});
|
||||
}else{
|
||||
showToast("上传成功".tr, something: (){
|
||||
showToast('上传成功'.tr, something: (){
|
||||
state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
|
||||
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
});
|
||||
@ -246,22 +247,13 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
_initReplySubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_state.dart';
|
||||
import 'package:star_lock/tools/showTFView.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
@ -21,8 +21,8 @@ class AdminOpenLockPasswordPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> with RouteAware {
|
||||
final logic = Get.put(AdminOpenLockPasswordLogic());
|
||||
final state = Get.find<AdminOpenLockPasswordLogic>().state;
|
||||
final AdminOpenLockPasswordLogic logic = Get.put(AdminOpenLockPasswordLogic());
|
||||
final AdminOpenLockPasswordState state = Get.find<AdminOpenLockPasswordLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,7 +33,7 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||
rightTitle: state.adminPwd.value,
|
||||
@ -88,22 +88,22 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title: "修改密码".tr,
|
||||
tipTitle: "请输入".tr,
|
||||
title: '请输入6-9位数字'.tr,
|
||||
tipTitle: '请输入'.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(6),
|
||||
LengthLimitingTextInputFormatter(9),
|
||||
],
|
||||
controller: state.changePwdController,
|
||||
sureClick: () {
|
||||
if(state.changePwdController.text.length < 6){
|
||||
logic.showToast("请输入6位管理员密码".tr);
|
||||
logic.showToast('请输入6-9位管理员密码'.tr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){
|
||||
logic.showToast("请输入新的管理员密码".tr);
|
||||
logic.showToast('请输入新的管理员密码'.tr);
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
@ -119,7 +119,6 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
// TODO: implement didChangeDependencies
|
||||
super.didChangeDependencies();
|
||||
|
||||
/// 路由订阅
|
||||
@ -128,7 +127,6 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
/// 取消路由订阅
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
super.dispose();
|
||||
@ -148,7 +146,9 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
|
||||
super.didPop();
|
||||
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
if (EasyLoading.isShow) {
|
||||
EasyLoading.dismiss(animation: true);
|
||||
}
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
@ -166,9 +166,10 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
|
||||
void didPushNext() {
|
||||
super.didPushNext();
|
||||
logic.cancelBlueConnetctToastTimer();
|
||||
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
|
||||
if (EasyLoading.isShow) {
|
||||
EasyLoading.dismiss(animation: true);
|
||||
}
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,20 +5,19 @@ import 'package:get/get.dart';
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class AdminOpenLockPasswordState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
final TextEditingController changePwdController = TextEditingController();
|
||||
var adminPwd = "".obs;// 0普通状态可用 1不可用
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态可用 1不可用
|
||||
|
||||
AdminOpenLockPasswordState() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
lockSetInfoData.value = map['lockSetInfoData'];
|
||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||
changePwdController.text = lockBasicInfo.value.adminPwd!;
|
||||
adminPwd.value = lockBasicInfo.value.adminPwd!;
|
||||
}
|
||||
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
||||
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
final TextEditingController changePwdController = TextEditingController();
|
||||
RxString adminPwd = ''.obs;
|
||||
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
RxInt sureBtnState = 0.obs; // 0普通状态可用 1不可用
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ class BasicInformationLogic extends BaseGetXController{
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((PassCurrentLockInformationEvent event) {
|
||||
state.lockSetInfoData.value = event.lockSetInfoData;
|
||||
blockSetStateCallback();
|
||||
});
|
||||
@ -23,22 +23,13 @@ class BasicInformationLogic extends BaseGetXController{
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
AppLog.log("厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}");
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
AppLog.log('厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}');
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
_passCurrentLockInformationEvent?.cancel();
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/basicInformation_state.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
import 'package:star_lock/tools/dateTool.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
@ -19,12 +21,11 @@ class BasicInformationPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
final logic = Get.put(BasicInformationLogic());
|
||||
final state = Get.find<BasicInformationLogic>().state;
|
||||
final BasicInformationLogic logic = Get.put(BasicInformationLogic());
|
||||
final BasicInformationState state = Get.find<BasicInformationLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
logic.initLoadDataAction(() {
|
||||
@ -41,14 +42,14 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.lockName ?? "",
|
||||
rightTitle: state.lockBasicInfo.value.lockName ?? '',
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "MAC/ID",
|
||||
leftTitel: 'MAC/ID',
|
||||
rightTitle:
|
||||
"${state.lockBasicInfo.value.mac??""}/${state.lockBasicInfo.value.lockId??""}",
|
||||
allHeight: 70.h,
|
||||
@ -68,11 +69,11 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.electricQuantity!.tr,
|
||||
rightTitle: "${state.lockBasicInfo.value.electricQuantity??0}%",
|
||||
rightTitle: '${state.lockBasicInfo.value.electricQuantity??0}%',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.uploadElectricQuantityPage, arguments: {
|
||||
Get.toNamed(Routers.uploadElectricQuantityPage, arguments: <String, LockSetInfoData>{
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
})),
|
||||
@ -85,49 +86,46 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true)),
|
||||
Obx(() => Visibility(
|
||||
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false,
|
||||
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效日".tr,
|
||||
rightTitle: (state.lockBasicInfo.value.weekDays ?? []).join(",").toString(),
|
||||
leftTitel: '有效日'.tr,
|
||||
rightTitle: (state.lockBasicInfo.value.weekDays ?? []).join(',').toString(),
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true),
|
||||
)),
|
||||
Obx(() => Visibility(
|
||||
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false,
|
||||
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4,
|
||||
child: CommonItem(
|
||||
leftTitel: "有效时间".tr,
|
||||
rightTitle: "${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}",
|
||||
leftTitel: '有效时间'.tr,
|
||||
rightTitle: '${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}',
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true),
|
||||
)),
|
||||
SizedBox(height: 10.h),
|
||||
Obx(() => Visibility(
|
||||
visible: (state.lockBasicInfo.value.isLockOwner == 1 ||
|
||||
state.lockBasicInfo.value.keyRight == 1)
|
||||
? true
|
||||
: false,
|
||||
visible: state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1,
|
||||
child: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.lockAlias,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var data = await Get.toNamed(Routers.editLockNamePage, arguments: {
|
||||
var data = await Get.toNamed(Routers.editLockNamePage, arguments: <String, LockSetInfoData>{
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
if (data != null) {
|
||||
setState(() {
|
||||
state.lockBasicInfo.value = data["lockBasicInfo"];
|
||||
state.lockBasicInfo.value = data['lockBasicInfo'];
|
||||
});
|
||||
}
|
||||
}))),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
|
||||
rightTitle: state.lockBasicInfo.value.groupName!.tr ?? "",
|
||||
rightTitle: state.lockBasicInfo.value.groupName!.tr ?? '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
Get.toNamed(Routers.lockSelectGroupingPage, arguments: {
|
||||
Get.toNamed(Routers.lockSelectGroupingPage, arguments: <String, LockSetInfoData>{
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
})!.then((val) {
|
||||
if (val != null) {
|
||||
@ -137,9 +135,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
});
|
||||
})),
|
||||
Obx(() => Visibility(
|
||||
visible: state.lockBasicInfo.value.isLockOwner == 1
|
||||
? true
|
||||
: false,
|
||||
visible: state.lockBasicInfo.value.isLockOwner == 1,
|
||||
child: CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
|
||||
@ -148,28 +144,28 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.adminOpenLockPasswordPage, arguments: {
|
||||
Get.toNamed(Routers.adminOpenLockPasswordPage, arguments: <String, LockSetInfoData>{
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
}),
|
||||
)),
|
||||
Obx(() => Visibility(
|
||||
visible: state.lockBasicInfo.value.lockName!.contains("T9A"),
|
||||
visible: state.lockBasicInfo.value.lockName!.contains('T9A'),
|
||||
child: CommonItem(
|
||||
leftTitel: "当前网络".tr,
|
||||
rightTitle: state.lockBasicInfo.value.network ?? "-",
|
||||
leftTitel: '当前网络'.tr,
|
||||
rightTitle: state.lockBasicInfo.value.network ?? '-',
|
||||
allHeight: 70.h,
|
||||
isHaveLine: true),
|
||||
)),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: "位置信息".tr,
|
||||
leftTitel: '位置信息'.tr,
|
||||
// rightTitle: state.lockBasicInfo.value.address ?? "-",
|
||||
allHeight: 80.h,
|
||||
isHaveLine: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 300.w,
|
||||
child: Text(state.lockBasicInfo.value.address ?? "无".tr,
|
||||
child: Text(state.lockBasicInfo.value.address ?? '无'.tr,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.end,
|
||||
|
||||
@ -4,18 +4,18 @@ import 'package:get/get.dart';
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class BasicInformationState {
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
var groupName = "未分组".tr.obs;
|
||||
|
||||
BasicInformationState() {
|
||||
var map = Get.arguments;
|
||||
if(map["lockSetInfoData"] != null){
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
if(map['lockSetInfoData'] != null){
|
||||
lockSetInfoData.value = map['lockSetInfoData'];
|
||||
if(lockSetInfoData.value.lockBasicInfo!=null){
|
||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
||||
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
RxString groupName = '未分组'.tr.obs;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:star_lock/mine/addLock/saveLock/saveLock_state.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/appRouteObserver.dart';
|
||||
@ -19,8 +20,8 @@ class SaveLockPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
final logic = Get.put(SaveLockLogic());
|
||||
final state = Get.find<SaveLockLogic>().state;
|
||||
final SaveLockLogic logic = Get.put(SaveLockLogic());
|
||||
final SaveLockState state = Get.find<SaveLockLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,7 +34,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
body: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 80.h,
|
||||
),
|
||||
@ -42,7 +43,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
width: 1.sw,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Text(
|
||||
TranslationLoader
|
||||
@ -60,14 +61,15 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
// color: Colors.red,
|
||||
padding: EdgeInsets.only(left: 50.w, right: 50.w),
|
||||
child: TextField(
|
||||
maxLines: 1,
|
||||
focusNode: state.focusNode,
|
||||
autofocus: true,
|
||||
controller: state.aliNameController,
|
||||
onChanged: (v) {
|
||||
onChanged: (String v) {
|
||||
state.aliName.value = v;
|
||||
},
|
||||
textAlign: TextAlign.center,
|
||||
inputFormatters: [
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(32),
|
||||
],
|
||||
// style:TextStyle(height: 1.1, fontSize: 36.sp, fontWeight: FontWeight.w400, color:AppColors.mainColor),
|
||||
@ -87,12 +89,26 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.h)),
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.mainColor,
|
||||
width: 1,
|
||||
),
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 1,),
|
||||
),
|
||||
)),
|
||||
|
||||
// focusedBorder: const OutlineInputBorder(
|
||||
// borderSide:
|
||||
// BorderSide(width: 0, color: Colors.transparent)),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.h)),
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 1,),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(50.h)),
|
||||
borderSide: BorderSide(color: AppColors.mainColor, width: 1)
|
||||
),
|
||||
// border: const OutlineInputBorder(
|
||||
// borderSide:
|
||||
// BorderSide(width: 0, color: Colors.transparent)),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0),
|
||||
)
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
@ -116,7 +132,6 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
// TODO: implement didChangeDependencies
|
||||
super.didChangeDependencies();
|
||||
|
||||
/// 路由订阅
|
||||
@ -125,7 +140,6 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
/// 取消路由订阅
|
||||
state.focusNode.unfocus();
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
|
||||
@ -20,8 +20,7 @@ class AdministratorDetailsLogic extends BaseGetXController {
|
||||
.authorizedAdminDetail(state.itemData.value.uid ?? 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.lockItemList.value = entity.data!.lockList!;
|
||||
state.onlyManageYouCreatesUser.value =
|
||||
entity.data!.isOnlyManageSelf == 1 ? true : false;
|
||||
state.onlyManageYouCreatesUser.value = entity.data!.isOnlyManageSelf == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,9 +45,12 @@ class AdministratorDetailsLogic extends BaseGetXController {
|
||||
if (!isChangeName) {
|
||||
state.onlyManageYouCreatesUser.value =
|
||||
!state.onlyManageYouCreatesUser.value;
|
||||
}else{
|
||||
state.nameStr.value = state.changeNameController.text;
|
||||
}
|
||||
showToast('修改成功'.tr);
|
||||
administratorDetailRequest();
|
||||
showToast('修改成功'.tr, something: () {
|
||||
administratorDetailRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,16 +49,14 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
width: 10.w,
|
||||
),
|
||||
onPressed: logic.openModalBottomSheet,
|
||||
),
|
||||
)
|
||||
],
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Obx(() => Column(
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
rightTitle: state.changeNameController.text.isNotEmpty
|
||||
? state.changeNameController.text
|
||||
: state.itemData.value.name,
|
||||
rightTitle: state.nameStr.value,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
@ -135,7 +133,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.onlyManageYouCreatesUser.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
logic.updateAdministratorRequest(isChangeName: false);
|
||||
},
|
||||
);
|
||||
@ -212,18 +210,18 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowTFView(
|
||||
title:
|
||||
'${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}',
|
||||
title: '${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}',
|
||||
tipTitle: '请输入'.tr,
|
||||
controller: state.changeNameController,
|
||||
sureClick: () {
|
||||
//发送编辑钥匙名称请求
|
||||
if (state.changeNameController.text.isNotEmpty) {
|
||||
Get.back();
|
||||
logic.updateAdministratorRequest(isChangeName: true);
|
||||
}
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@ -9,12 +9,14 @@ class AdministratorDetailsState {
|
||||
final Map map = Get.arguments;
|
||||
if (map['itemData'] != null) {
|
||||
itemData.value = map['itemData'];
|
||||
onlyManageYouCreatesUser.value =
|
||||
itemData.value.onlyManageYouCreatesUser == 1 ? true : false;
|
||||
onlyManageYouCreatesUser.value = itemData.value.onlyManageYouCreatesUser == 1;
|
||||
nameStr.value = itemData.value.name ?? '';
|
||||
changeNameController.text = nameStr.value;
|
||||
}
|
||||
}
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
final Rx<AuthorizedAdminListItem> itemData = AuthorizedAdminListItem().obs;
|
||||
RxBool onlyManageYouCreatesUser = false.obs;
|
||||
RxString nameStr = ''.obs;
|
||||
RxList<LockListItem> lockItemList = <LockListItem>[].obs;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user