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

This commit is contained in:
Daisy 2024-05-31 14:11:35 +08:00
commit 457999f15d
15 changed files with 133 additions and 138 deletions

View File

@ -611,8 +611,8 @@
"请输入小于或等于60的数字": "Please enter a number less than 60", "请输入小于或等于60的数字": "Please enter a number less than 60",
"操作成功": "Operation success", "操作成功": "Operation success",
"管理员密码相同,无需修改": "The administrator password is the same and does not need to be modified", "管理员密码相同,无需修改": "The administrator password is the same and does not need to be modified",
"修改密码": "Modify password", "请输入6-9位数字": "Please enter 6-9 digits",
"请输入6位管理员密码": "Please enter a 6-digit administrator password", "请输入6-9位管理员密码": "Please enter a 6-9 digit administrator password",
"请输入新的管理员密码": "Please enter a new administrator password", "请输入新的管理员密码": "Please enter a new administrator password",
"未分组": "Not grouped", "未分组": "Not grouped",
"请输入分组名称": "Please enter the group name", "请输入分组名称": "Please enter the group name",

View File

@ -636,8 +636,8 @@
"请输入小于或等于60的数字": "请输入小于或等于60的数字", "请输入小于或等于60的数字": "请输入小于或等于60的数字",
"操作成功": "操作成功", "操作成功": "操作成功",
"管理员密码相同,无需修改": "管理员密码相同,无需修改", "管理员密码相同,无需修改": "管理员密码相同,无需修改",
"修改密码": "修改密码", "请输入6-9位数字": "请输入6-9位数字",
"请输入6位管理员密码": "请输入6位管理员密码", "请输入6-9位管理员密码": "请输入6-9位管理员密码",
"请输入新的管理员密码": "请输入新的管理员密码", "请输入新的管理员密码": "请输入新的管理员密码",
"未分组": "未分组", "未分组": "未分组",
"请输入分组名称": "请输入分组名称", "请输入分组名称": "请输入分组名称",

View File

@ -611,8 +611,8 @@
"请输入小于或等于60的数字": "请输入小于或等于60的数字", "请输入小于或等于60的数字": "请输入小于或等于60的数字",
"操作成功": "操作成功", "操作成功": "操作成功",
"管理员密码相同,无需修改": "管理员密码相同,无需修改", "管理员密码相同,无需修改": "管理员密码相同,无需修改",
"修改密码": "修改密码", "请输入6-9位数字": "请输入6-9位数字",
"请输入6位管理员密码": "请输入6位管理员密码", "请输入6-9位管理员密码": "请输入6-9位管理员密码",
"请输入新的管理员密码": "请输入新的管理员密码", "请输入新的管理员密码": "请输入新的管理员密码",
"未分组": "未分组", "未分组": "未分组",
"请输入分组名称": "请输入分组名称", "请输入分组名称": "请输入分组名称",

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -59,7 +60,7 @@ class _AddCardPageState extends State<AddCardPage>
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: barTitle:
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}", '${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}',
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
@ -233,8 +234,7 @@ class _AddCardPageState extends State<AddCardPage>
visible: state.effectiveDateTime.value.isNotEmpty, visible: state.effectiveDateTime.value.isNotEmpty,
child: CommonItem( child: CommonItem(
leftTitel: '有效时间'.tr, leftTitel: '有效时间'.tr,
rightTitle: rightTitle: '${state.effectiveDateTime.value}-${state.failureDateTime.value}',
'${state.effectiveDateTime.value}-${state.failureDateTime.value}',
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
final result = await Get.toNamed(Routers.seletKeyCyclicDatePage, final result = await Get.toNamed(Routers.seletKeyCyclicDatePage,

View File

@ -9,7 +9,7 @@ class AddCardTypeState{
Map map = Get.arguments; Map map = Get.arguments;
lockId.value = map['lockId']; lockId.value = map['lockId'];
fromType.value = map['fromType']; fromType.value = map['fromType'];
// 1 2 // 1 2
if(fromType.value == 2){ if(fromType.value == 2){
fromTypeTwoStaffName.value = map['fromTypeTwoStaffName']; // fromTypeTwoStaffName.value = map['fromTypeTwoStaffName']; //
} }

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/blue_manage.dart';
import '../../../../../blue/io_protocol/io_changeAdministratorPassword.dart'; import '../../../../../blue/io_protocol/io_changeAdministratorPassword.dart';
@ -23,7 +24,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { 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) { if (reply is ChangeAdministratorPasswordReply && state.ifCurrentScreen.value == true) {
_replyChangeAdministratorPassword(reply); _replyChangeAdministratorPassword(reply);
} }
@ -36,7 +37,7 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
// //
Future<void> _replyChangeAdministratorPassword(Reply reply) async { Future<void> _replyChangeAdministratorPassword(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
@ -48,14 +49,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
break; break;
case 0x06: case 0x06:
// //
var signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = reply.data.sublist(5, 9); final List<int> token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token); final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.changeAdministratorPasswordCommand( IoSenderManage.changeAdministratorPasswordCommand(
@ -190,14 +191,14 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.changeAdministratorPasswordCommand( IoSenderManage.changeAdministratorPasswordCommand(
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
@ -224,19 +225,19 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
} }
// //
void addLockAdminPassword(bool isChange) async { Future<void> addLockAdminPassword(bool isChange) async {
var entity = await ApiRepository.to.setAdminPasswordData( final GetServerDatetimeEntity entity = await ApiRepository.to.setAdminPasswordData(
lockId: state.lockSetInfoData.value.lockBasicInfo!.lockId!, lockId: state.lockSetInfoData.value.lockBasicInfo!.lockId!,
adminPwd: state.adminPwd.value, adminPwd: state.adminPwd.value,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if(isChange == true){ if(isChange == true){
showToast("修改成功".tr, something: (){ showToast('修改成功'.tr, something: (){
state.lockBasicInfo.value.adminPwd = state.adminPwd.value; state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
}); });
}else{ }else{
showToast("上传成功".tr, something: (){ showToast('上传成功'.tr, something: (){
state.lockBasicInfo.value.adminPwd = state.adminPwd.value; state.lockBasicInfo.value.adminPwd = state.adminPwd.value;
eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
}); });
@ -246,22 +247,13 @@ class AdminOpenLockPasswordLogic extends BaseGetXController{
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -2,8 +2,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 'package:star_lock/tools/showTFView.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
@ -21,8 +21,8 @@ class AdminOpenLockPasswordPage extends StatefulWidget {
} }
class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> with RouteAware { class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> with RouteAware {
final logic = Get.put(AdminOpenLockPasswordLogic()); final AdminOpenLockPasswordLogic logic = Get.put(AdminOpenLockPasswordLogic());
final state = Get.find<AdminOpenLockPasswordLogic>().state; final AdminOpenLockPasswordState state = Get.find<AdminOpenLockPasswordLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,7 +33,7 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.password!.tr, leftTitel: TranslationLoader.lanKeys!.password!.tr,
rightTitle: state.adminPwd.value, rightTitle: state.adminPwd.value,
@ -88,22 +88,22 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: "修改密码".tr, title: '请输入6-9位数字'.tr,
tipTitle: "请输入".tr, tipTitle: '请输入'.tr,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: [ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp('[0-9]')), FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(6), LengthLimitingTextInputFormatter(9),
], ],
controller: state.changePwdController, controller: state.changePwdController,
sureClick: () { sureClick: () {
if(state.changePwdController.text.length < 6){ if(state.changePwdController.text.length < 6){
logic.showToast("请输入6位管理员密码".tr); logic.showToast('请输入6-9位管理员密码'.tr);
return; return;
} }
if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){ if(state.changePwdController.text == state.lockBasicInfo.value.adminPwd!){
logic.showToast("请输入新的管理员密码".tr); logic.showToast('请输入新的管理员密码'.tr);
return; return;
} }
Get.back(); Get.back();
@ -119,7 +119,6 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -128,7 +127,6 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();
@ -148,7 +146,9 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
super.didPop(); super.didPop();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }
@ -166,9 +166,10 @@ class _AdminOpenLockPasswordPageState extends State<AdminOpenLockPasswordPage> w
void didPushNext() { void didPushNext() {
super.didPushNext(); super.didPushNext();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }
} }

View File

@ -5,20 +5,19 @@ import 'package:get/get.dart';
import '../../lockSet/lockSetInfo_entity.dart'; import '../../lockSet/lockSetInfo_entity.dart';
class AdminOpenLockPasswordState { 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() { AdminOpenLockPasswordState() {
var map = Get.arguments; var map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
changePwdController.text = lockBasicInfo.value.adminPwd!; changePwdController.text = lockBasicInfo.value.adminPwd!;
adminPwd.value = 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
} }

View File

@ -15,7 +15,7 @@ class BasicInformationLogic extends BaseGetXController{
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) { _passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((PassCurrentLockInformationEvent event) {
state.lockSetInfoData.value = event.lockSetInfoData; state.lockSetInfoData.value = event.lockSetInfoData;
blockSetStateCallback(); blockSetStateCallback();
}); });
@ -23,22 +23,13 @@ class BasicInformationLogic extends BaseGetXController{
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
AppLog.log("厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}"); AppLog.log('厂商 vendor:${state.lockBasicInfo.value.vendor} 型号 model:${state.lockBasicInfo.value.model}');
}
@override
void onInit() {
// TODO: implement onInit
super.onInit();
} }
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_passCurrentLockInformationEvent?.cancel(); _passCurrentLockInformationEvent?.cancel();
} }

View File

@ -2,6 +2,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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 'package:star_lock/tools/dateTool.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
@ -19,12 +21,11 @@ class BasicInformationPage extends StatefulWidget {
} }
class _BasicInformationPageState extends State<BasicInformationPage> { class _BasicInformationPageState extends State<BasicInformationPage> {
final logic = Get.put(BasicInformationLogic()); final BasicInformationLogic logic = Get.put(BasicInformationLogic());
final state = Get.find<BasicInformationLogic>().state; final BasicInformationState state = Get.find<BasicInformationLogic>().state;
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
logic.initLoadDataAction(() { logic.initLoadDataAction(() {
@ -41,14 +42,14 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: ListView( body: ListView(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr, leftTitel: TranslationLoader.lanKeys!.lockNumber!.tr,
rightTitle: state.lockBasicInfo.value.lockName ?? "", rightTitle: state.lockBasicInfo.value.lockName ?? '',
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true)), isHaveLine: true)),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "MAC/ID", leftTitel: 'MAC/ID',
rightTitle: rightTitle:
"${state.lockBasicInfo.value.mac??""}/${state.lockBasicInfo.value.lockId??""}", "${state.lockBasicInfo.value.mac??""}/${state.lockBasicInfo.value.lockId??""}",
allHeight: 70.h, allHeight: 70.h,
@ -68,11 +69,11 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
), ),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.electricQuantity!.tr, leftTitel: TranslationLoader.lanKeys!.electricQuantity!.tr,
rightTitle: "${state.lockBasicInfo.value.electricQuantity??0}%", rightTitle: '${state.lockBasicInfo.value.electricQuantity??0}%',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.uploadElectricQuantityPage, arguments: { Get.toNamed(Routers.uploadElectricQuantityPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
})), })),
@ -85,49 +86,46 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true)), isHaveLine: true)),
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false, visible: (state.lockBasicInfo.value.keyType ?? 0) == 4,
child: CommonItem( child: CommonItem(
leftTitel: "有效日".tr, leftTitel: '有效日'.tr,
rightTitle: (state.lockBasicInfo.value.weekDays ?? []).join(",").toString(), rightTitle: (state.lockBasicInfo.value.weekDays ?? []).join(',').toString(),
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true), isHaveLine: true),
)), )),
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.lockBasicInfo.value.keyType ?? 0) == 4 ? true : false, visible: (state.lockBasicInfo.value.keyType ?? 0) == 4,
child: CommonItem( child: CommonItem(
leftTitel: "有效时间".tr, leftTitel: '有效时间'.tr,
rightTitle: "${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}", rightTitle: '${DateTool().dateToHNString((state.lockBasicInfo.value.startDate ?? 0).toString())}-${DateTool().dateToHNString((state.lockBasicInfo.value.endDate ?? 0).toString())}',
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true), isHaveLine: true),
)), )),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 || visible: state.lockBasicInfo.value.isLockOwner == 1 || state.lockBasicInfo.value.keyRight == 1,
state.lockBasicInfo.value.keyRight == 1)
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockName!.tr, leftTitel: TranslationLoader.lanKeys!.lockName!.tr,
rightTitle: state.lockBasicInfo.value.lockAlias, rightTitle: state.lockBasicInfo.value.lockAlias,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var data = await Get.toNamed(Routers.editLockNamePage, arguments: { var data = await Get.toNamed(Routers.editLockNamePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.lockBasicInfo.value = data["lockBasicInfo"]; state.lockBasicInfo.value = data['lockBasicInfo'];
}); });
} }
}))), }))),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr, leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
rightTitle: state.lockBasicInfo.value.groupName!.tr ?? "", rightTitle: state.lockBasicInfo.value.groupName!.tr ?? '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
Get.toNamed(Routers.lockSelectGroupingPage, arguments: { Get.toNamed(Routers.lockSelectGroupingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
})!.then((val) { })!.then((val) {
if (val != null) { if (val != null) {
@ -137,9 +135,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
}); });
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 visible: state.lockBasicInfo.value.isLockOwner == 1,
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.adminOpenLockPassword!.tr, TranslationLoader.lanKeys!.adminOpenLockPassword!.tr,
@ -148,28 +144,28 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.adminOpenLockPasswordPage, arguments: { Get.toNamed(Routers.adminOpenLockPasswordPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}), }),
)), )),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockBasicInfo.value.lockName!.contains("T9A"), visible: state.lockBasicInfo.value.lockName!.contains('T9A'),
child: CommonItem( child: CommonItem(
leftTitel: "当前网络".tr, leftTitel: '当前网络'.tr,
rightTitle: state.lockBasicInfo.value.network ?? "-", rightTitle: state.lockBasicInfo.value.network ?? '-',
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true), isHaveLine: true),
)), )),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "位置信息".tr, leftTitel: '位置信息'.tr,
// rightTitle: state.lockBasicInfo.value.address ?? "-", // rightTitle: state.lockBasicInfo.value.address ?? "-",
allHeight: 80.h, allHeight: 80.h,
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox( rightWidget: SizedBox(
width: 300.w, width: 300.w,
child: Text(state.lockBasicInfo.value.address ?? "".tr, child: Text(state.lockBasicInfo.value.address ?? ''.tr,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end, textAlign: TextAlign.end,

View File

@ -4,18 +4,18 @@ import 'package:get/get.dart';
import '../../lockSet/lockSetInfo_entity.dart'; import '../../lockSet/lockSetInfo_entity.dart';
class BasicInformationState { class BasicInformationState {
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var groupName = "未分组".tr.obs;
BasicInformationState() { BasicInformationState() {
var map = Get.arguments; var map = Get.arguments;
if(map["lockSetInfoData"] != null){ if(map['lockSetInfoData'] != null){
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
if(lockSetInfoData.value.lockBasicInfo!=null){ if(lockSetInfoData.value.lockBasicInfo!=null){
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
} }
} }
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
RxString groupName = '未分组'.tr.obs;
} }

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/blue_manage.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 '../../../app_settings/app_colors.dart';
import '../../../tools/appRouteObserver.dart'; import '../../../tools/appRouteObserver.dart';
@ -19,8 +20,8 @@ class SaveLockPage extends StatefulWidget {
} }
class _SaveLockPageState extends State<SaveLockPage> with RouteAware { class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
final logic = Get.put(SaveLockLogic()); final SaveLockLogic logic = Get.put(SaveLockLogic());
final state = Get.find<SaveLockLogic>().state; final SaveLockState state = Get.find<SaveLockLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,7 +34,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
body: Column( body: Column(
// mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: <Widget>[
SizedBox( SizedBox(
height: 80.h, height: 80.h,
), ),
@ -42,7 +43,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
width: 1.sw, width: 1.sw,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Flexible( Flexible(
child: Text( child: Text(
TranslationLoader TranslationLoader
@ -60,14 +61,15 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
// color: Colors.red, // color: Colors.red,
padding: EdgeInsets.only(left: 50.w, right: 50.w), padding: EdgeInsets.only(left: 50.w, right: 50.w),
child: TextField( child: TextField(
maxLines: 1,
focusNode: state.focusNode, focusNode: state.focusNode,
autofocus: true, autofocus: true,
controller: state.aliNameController, controller: state.aliNameController,
onChanged: (v) { onChanged: (String v) {
state.aliName.value = v; state.aliName.value = v;
}, },
textAlign: TextAlign.center, textAlign: TextAlign.center,
inputFormatters: [ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(32), LengthLimitingTextInputFormatter(32),
], ],
// style:TextStyle(height: 1.1, fontSize: 36.sp, fontWeight: FontWeight.w400, color:AppColors.mainColor), // 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( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(50.h)), borderRadius: BorderRadius.all(Radius.circular(50.h)),
borderSide: BorderSide( borderSide: BorderSide(color: AppColors.mainColor, width: 1,),
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( SizedBox(
height: 120.h, height: 120.h,
@ -116,7 +132,6 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -125,7 +140,6 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
state.focusNode.unfocus(); state.focusNode.unfocus();
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);

View File

@ -20,8 +20,7 @@ class AdministratorDetailsLogic extends BaseGetXController {
.authorizedAdminDetail(state.itemData.value.uid ?? 0); .authorizedAdminDetail(state.itemData.value.uid ?? 0);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockItemList.value = entity.data!.lockList!; state.lockItemList.value = entity.data!.lockList!;
state.onlyManageYouCreatesUser.value = state.onlyManageYouCreatesUser.value = entity.data!.isOnlyManageSelf == 1;
entity.data!.isOnlyManageSelf == 1 ? true : false;
} }
} }
@ -46,9 +45,12 @@ class AdministratorDetailsLogic extends BaseGetXController {
if (!isChangeName) { if (!isChangeName) {
state.onlyManageYouCreatesUser.value = state.onlyManageYouCreatesUser.value =
!state.onlyManageYouCreatesUser.value; !state.onlyManageYouCreatesUser.value;
}else{
state.nameStr.value = state.changeNameController.text;
} }
showToast('修改成功'.tr); showToast('修改成功'.tr, something: () {
administratorDetailRequest(); administratorDetailRequest();
});
} }
} }

View File

@ -49,16 +49,14 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
width: 10.w, width: 10.w,
), ),
onPressed: logic.openModalBottomSheet, onPressed: logic.openModalBottomSheet,
), )
], ],
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Obx(() => Column( body: Obx(() => Column(
children: <Widget>[ children: <Widget>[
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.name!.tr, leftTitel: TranslationLoader.lanKeys!.name!.tr,
rightTitle: state.changeNameController.text.isNotEmpty rightTitle: state.nameStr.value,
? state.changeNameController.text
: state.itemData.value.name,
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () { action: () {
@ -135,7 +133,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.onlyManageYouCreatesUser.value, value: state.onlyManageYouCreatesUser.value,
onChanged: (value) { onChanged: (bool value) {
logic.updateAdministratorRequest(isChangeName: false); logic.updateAdministratorRequest(isChangeName: false);
}, },
); );
@ -212,18 +210,18 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: title: '${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}',
'${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}',
tipTitle: '请输入'.tr, tipTitle: '请输入'.tr,
controller: state.changeNameController, controller: state.changeNameController,
sureClick: () { sureClick: () {
// //
if (state.changeNameController.text.isNotEmpty) { if (state.changeNameController.text.isNotEmpty) {
Get.back();
logic.updateAdministratorRequest(isChangeName: true); logic.updateAdministratorRequest(isChangeName: true);
} }
}, },
cancelClick: () { cancelClick: () {
Navigator.pop(context); Get.back();
}, },
); );
}, },

View File

@ -9,12 +9,14 @@ class AdministratorDetailsState {
final Map map = Get.arguments; final Map map = Get.arguments;
if (map['itemData'] != null) { if (map['itemData'] != null) {
itemData.value = map['itemData']; itemData.value = map['itemData'];
onlyManageYouCreatesUser.value = onlyManageYouCreatesUser.value = itemData.value.onlyManageYouCreatesUser == 1;
itemData.value.onlyManageYouCreatesUser == 1 ? true : false; nameStr.value = itemData.value.name ?? '';
changeNameController.text = nameStr.value;
} }
} }
final TextEditingController changeNameController = TextEditingController(); final TextEditingController changeNameController = TextEditingController();
final Rx<AuthorizedAdminListItem> itemData = AuthorizedAdminListItem().obs; final Rx<AuthorizedAdminListItem> itemData = AuthorizedAdminListItem().obs;
RxBool onlyManageYouCreatesUser = false.obs; RxBool onlyManageYouCreatesUser = false.obs;
RxString nameStr = ''.obs;
RxList<LockListItem> lockItemList = <LockListItem>[].obs; RxList<LockListItem> lockItemList = <LockListItem>[].obs;
} }