Merge remote-tracking branch 'origin/develop_liyi' into develop_liyi

This commit is contained in:
liyi 2025-03-04 09:42:20 +08:00
commit 50c0d8dc7a
10 changed files with 184 additions and 129 deletions

View File

@ -333,6 +333,16 @@ class AuthorizedAdminLogic extends BaseGetXController {
}
}
@override
void onInit() {
super.onInit();
//
state.emailOrPhoneController.addListener(() {
state.emailOrPhone.value = state.emailOrPhoneController.text;
});
}
@override
void onReady() {
super.onReady();

View File

@ -10,6 +10,7 @@ import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/regularExpression.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/storage.dart';
@ -114,29 +115,32 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
// isHaveRightWidget: true,
// rightWidget: getTFWidget(true, '请输入手机号或者邮箱'.tr, 1)),
perpetualKeyWidget('接收者'.tr, '请输入手机号或者邮箱'.tr),
CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
final Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
setState(() {});
}
},
),
Obx(() => Visibility(
visible: RegularExpression()
.isPhoneNumber(logic.state.emailOrPhone.value),
child: CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
final Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
setState(() {});
}
},
))),
KeyNameItem(
leftTitel: '姓名'.tr,
rightTitle: '请输入'.tr,
@ -268,6 +272,10 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
)
],
),
),
Container(
color: AppColors.greyLineColor, //
height: 2.0.h, //
)
],
);
@ -571,6 +579,9 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
onChanged: (value) {
logic.update();
},
),
),
SizedBox(

View File

@ -6,6 +6,7 @@ import 'package:star_lock/tools/dateTool.dart';
class AuthorizedAdminState {
final TextEditingController emailOrPhoneController =
TextEditingController(); ///
RxString emailOrPhone = ''.obs; // logic的state中添加一个Rx变量
final TextEditingController keyNameController =
TextEditingController(); //
late TabController tabController;

View File

@ -1,4 +1,3 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/network/api_repository.dart';
@ -57,4 +56,13 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
}
}
@override
void onInit() {
super.onInit();
//
state.emailOrPhoneController.addListener(() {
state.emailOrPhone.value = state.emailOrPhoneController.text;
});
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -11,6 +10,7 @@ import 'package:star_lock/main/lockDetail/authorizedAdmin/volumeAuthorizationLoc
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/regularExpression.dart';
import 'package:star_lock/tools/showTipView.dart';
import '../../../../appRouters.dart';
@ -90,40 +90,38 @@ class _VolumeAuthorizationLockPageState
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
true,
'请输入手机号或者邮箱'.tr,
state.emailOrPhoneController)),
CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
final Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
// setState(() {});
}
},
),
true, '请输入手机号或者邮箱'.tr, state.emailOrPhoneController)),
Obx(() => Visibility(
visible: RegularExpression()
.isPhoneNumber(logic.state.emailOrPhone.value),
child: CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
final Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
// setState(() {});
}
},
))),
CommonItem(
leftTitel: '姓名'.tr,
rightTitle: '',
isHaveRightWidget: true,
rightWidget: getTFWidget(
false,
'请输入'.tr,
state.keyNameController)),
rightWidget: getTFWidget(false, '请输入'.tr, state.keyNameController)),
Container(height: 10.h),
],
);
@ -186,7 +184,8 @@ class _VolumeAuthorizationLockPageState
: state.lockIdList.length.toString(),
isHaveDirection: true,
action: () async {
final result = await Get.toNamed(Routers.massSendLockGroupListPage,
final result = await Get.toNamed(
Routers.massSendLockGroupListPage,
arguments: <String, Object>{
'keyLimits': '1',
'lockIdList': state.lockIdList.value

View File

@ -4,8 +4,11 @@ import 'package:get/get.dart';
class VolumeAuthorizationLockState {
final FlutterContactPicker contactPicker = FlutterContactPicker();
final TextEditingController emailOrPhoneController = TextEditingController(); ///
final TextEditingController keyNameController = TextEditingController(); //
final TextEditingController emailOrPhoneController =
TextEditingController(); ///
RxString emailOrPhone = ''.obs; // logic的state中添加一个Rx变量
final TextEditingController keyNameController =
TextEditingController(); //
late Contact contact;
RxList<int> lockIdList = <int>[].obs;
RxBool isSendSuccess = false.obs;

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -17,7 +16,8 @@ import 'massSendElectronicKey_logic.dart';
import 'massSendElectronicKey_state.dart';
class MassSendElectronicKeyPage extends StatefulWidget {
const MassSendElectronicKeyPage({required this.type, Key? key}) : super(key: key);
const MassSendElectronicKeyPage({required this.type, Key? key})
: super(key: key);
final String type;
@override
@ -26,8 +26,10 @@ class MassSendElectronicKeyPage extends StatefulWidget {
}
class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
final MassSendElectronicKeyLogic logic = Get.put(MassSendElectronicKeyLogic());
final MassSendElectronicKeyState state = Get.find<MassSendElectronicKeyLogic>().state;
final MassSendElectronicKeyLogic logic =
Get.put(MassSendElectronicKeyLogic());
final MassSendElectronicKeyState state =
Get.find<MassSendElectronicKeyLogic>().state;
@override
initState() {
@ -47,9 +49,7 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
state.type.value = widget.type;
return SingleChildScrollView(
child: state.isDemoMode
? indexChangeWidget()
: Obx(indexChangeWidget),
child: state.isDemoMode ? indexChangeWidget() : Obx(indexChangeWidget),
);
}
@ -153,25 +153,25 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
return Column(
children: <Widget>[
Obx(() => CommonItem(
leftTitel: '接收者'.tr,
rightTitle: state.receiverList.value.isEmpty
? '请添加'.tr
: state.receiverList.value.length.toString(),
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.massSendReceiverPage,
arguments: <String, List>{
'lockUserList': state.receiverList.value,
}).then((Object? value) {
if (value != null) {
value as Map<String, dynamic>;
state.receiverList.value = value['lockUserList'];
// setState(() {});
}
});
},
)),
leftTitel: '接收者'.tr,
rightTitle: state.receiverList.value.isEmpty
? '请添加'.tr
: state.receiverList.value.length.toString(),
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.massSendReceiverPage,
arguments: <String, List>{
'lockUserList': state.receiverList.value,
}).then((Object? value) {
if (value != null) {
value as Map<String, dynamic>;
state.receiverList.value = value['lockUserList'];
// setState(() {});
}
});
},
)),
CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
@ -202,7 +202,8 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
: state.lockIdList.length.toString(),
isHaveDirection: true,
action: () async {
final result = await Get.toNamed(Routers.massSendLockGroupListPage,
final result = await Get.toNamed(
Routers.massSendLockGroupListPage,
arguments: <String, Object>{
'keyLimits': '2',
'lockIdList': state.lockIdList
@ -235,7 +236,8 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.beginTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
selectDate: selectDate,
mode: DateMode.YMDHM, onConfirm: (PDuration p) {
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
@ -244,8 +246,11 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
rightTitle: state.endTime.value,
isHaveDirection: true,
action: () {
PDuration selectDate = PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context, selectDate: selectDate, mode: DateMode.YMDHM, onConfirm: (PDuration p) {
PDuration selectDate =
PDuration.parse(DateTime.tryParse(state.endTime.value));
Pickers.showDatePicker(context,
selectDate: selectDate,
mode: DateMode.YMDHM, onConfirm: (PDuration p) {
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
});
})),
@ -279,14 +284,14 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
isHaveDirection: true,
isHaveLine: true,
action: () async {
var result =
await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: <String, Object>{
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
arguments: <String, Object>{
'validityValue': state.weekdaysList.value,
'starDate': state.beginTime.value,
'endDate': state.endTime.value,
'starTime': state.effectiveDateTime.value,
'endTime': state.failureDateTime.value
});
if (result != null && result.isNotEmpty) {
state.weekdaysList.value = result['validityValue'];
state.beginTime.value = result['starDate'];
@ -376,5 +381,4 @@ class _MassSendElectronicKeyPageState extends State<MassSendElectronicKeyPage> {
},
);
}
}

View File

@ -39,6 +39,11 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
void onInit() {
super.onInit();
//
state.emailOrPhoneController.addListener(() {
state.emailOrPhone.value = state.emailOrPhoneController.text;
});
Storage.getBool(ifIsDemoModeOrNot)
.then((bool? value) => state.isDemoMode = value ?? false);
}
@ -186,10 +191,11 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
final String getMobile = (await Storage.getMobile())!;
if (entity.errorCode!.codeIsSuccessful) {
ApmHelper.instance.trackEvent('add_electronic_key', {
'lock_name':BlueManage().connectDeviceName,
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date':DateTool().getNowDateWithType(1),
'add_electronic_key_result':'成功',
'lock_name': BlueManage().connectDeviceName,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'add_electronic_key_result': '成功',
});
emailOrPhone = state.emailOrPhoneController.text;
@ -202,10 +208,11 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
eventBus.fire(ElectronicKeyListRefreshUI());
} else {
ApmHelper.instance.trackEvent('add_electronic_key', {
'lock_name':BlueManage().connectDeviceName,
'account':getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date':DateTool().getNowDateWithType(1),
'add_electronic_key_result':'${entity.errorCode}--${entity.errorMsg}',
'lock_name': BlueManage().connectDeviceName,
'account':
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
'date': DateTool().getNowDateWithType(1),
'add_electronic_key_result': '${entity.errorCode}--${entity.errorMsg}',
});
emailOrPhone = null;

View File

@ -17,6 +17,7 @@ import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/pickers/time_picker/model/pduration.dart';
import 'package:star_lock/tools/regularExpression.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/submitBtn.dart';
@ -114,29 +115,33 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
// 1,
// logic)),
perpetualKeyWidget(logic, '接收者'.tr, '请输入手机号或者邮箱'.tr),
CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${logic.state.countryName} +${logic.state.countryCode}',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
final Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
logic.state.countryCode = result['code'];
logic.state.countryName = result['countryName'];
logic.update();
}
},
),
Obx(() => Visibility(
visible: RegularExpression()
.isPhoneNumber(logic.state.emailOrPhone.value),
child: CommonItem(
leftTitel: '国家/地区'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${logic.state.countryName} +${logic.state.countryCode}',
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
final Object? result = await Navigator.pushNamed(
context, Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
logic.state.countryCode = result['code'];
logic.state.countryName = result['countryName'];
logic.update();
}
},
),
)),
CommonItem(
leftTitel: '姓名'.tr,
rightTitle: '',
@ -589,6 +594,9 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
),
style: TextStyle(
fontSize: 22.sp, textBaseline: TextBaseline.alphabetic),
onChanged: (String value) {
logic.update();
},
),
),
SizedBox(

View File

@ -4,8 +4,12 @@ import 'package:get/get.dart';
import 'package:star_lock/tools/dateTool.dart';
class SendElectronicKeyViewState {
//
TextEditingController emailOrPhoneController =
TextEditingController(); ///
//
RxString emailOrPhone = ''.obs; // logic的state中添加一个Rx变量
TextEditingController keyNameController = TextEditingController(); //
TextEditingController realNameController = TextEditingController(); //
TextEditingController idCardController = TextEditingController(); //
@ -37,5 +41,5 @@ class SendElectronicKeyViewState {
final String timeLimitTips = '接收者在有效期内可以不限次数使用'.tr; //
final String permanentTips = '接收者可以使用此App开关锁'.tr; //
final String onceLimitTips = '单次钥匙有效期为1小时只能使用一次'.tr; //
final String cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'.tr; //
final String cycleLimitTips = '接收者可以在有效期内的固定时间段里,不限次数使用'.tr;
}