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

This commit is contained in:
魏少阳 2024-06-05 18:40:40 +08:00
commit b86fef2b55
22 changed files with 173 additions and 102 deletions

View File

@ -863,6 +863,7 @@
"六": "Sat", "六": "Sat",
"日": "Sun", "日": "Sun",
"新建短信模版":"New SMS template", "新建短信模版":"New SMS template",
"新建邮件模版":"New email template",
"自定义短信模版":"Custom SMS template", "自定义短信模版":"Custom SMS template",
"自定义邮件模版":"Custom email template", "自定义邮件模版":"Custom email template",
"名称":"Name", "名称":"Name",

View File

@ -895,6 +895,7 @@
"六":"六", "六":"六",
"日":"日", "日":"日",
"新建短信模版":"新建短信模版", "新建短信模版":"新建短信模版",
"新建邮件模版":"新建邮件模版",
"自定义短信模版":"自定义短信模版", "自定义短信模版":"自定义短信模版",
"自定义邮件模版":"自定义邮件模版", "自定义邮件模版":"自定义邮件模版",
"名称":"名称", "名称":"名称",

View File

@ -863,6 +863,7 @@
"六": "六", "六": "六",
"日": "日", "日": "日",
"新建短信模版":"新建短信模版", "新建短信模版":"新建短信模版",
"新建邮件模版":"新建邮件模版",
"自定义短信模版":"自定义短信模版", "自定义短信模版":"自定义短信模版",
"自定义邮件模版":"自定义邮件模版", "自定义邮件模版":"自定义邮件模版",
"名称":"名称", "名称":"名称",

View File

@ -522,5 +522,18 @@ class LockDetailLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription = eventBus
.on<LockSetChangeSetRefreshLockDetailWithType>()
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
if (event.type == 4) {
final int electricQuantity =
int.tryParse(event.setResult['electricQuantity']) ?? 0;
state.electricQuantity.value = electricQuantity;
state.keyInfos.value.electricQuantity = electricQuantity;
state.keyInfos.value.electricQuantityDate =
event.setResult['uploadElectricQuantityDate'] ?? 0;
state.keyInfos.refresh();
}
});
} }
} }

View File

@ -29,15 +29,14 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart'; import 'lockDetail_logic.dart';
class LockDetailPage extends StatefulWidget { class LockDetailPage extends StatefulWidget {
const LockDetailPage(
{required this.isOnlyOneData,
required this.lockListInfoItemEntity,
Key? key})
: super(key: key);
final bool isOnlyOneData; final bool isOnlyOneData;
final LockListInfoItemEntity lockListInfoItemEntity; final LockListInfoItemEntity lockListInfoItemEntity;
const LockDetailPage(
{Key? key,
required this.isOnlyOneData,
required this.lockListInfoItemEntity})
: super(key: key);
@override @override
State<LockDetailPage> createState() => _LockDetailPageState(); State<LockDetailPage> createState() => _LockDetailPageState();
} }
@ -50,7 +49,6 @@ class _LockDetailPageState extends State<LockDetailPage>
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
listeningAnimations(); listeningAnimations();
@ -1438,8 +1436,9 @@ class _LockDetailPageState extends State<LockDetailPage>
state.closedUnlockSuccessfulTimer?.cancel(); state.closedUnlockSuccessfulTimer?.cancel();
_lockRefreshLockDetailInfoDataEvent?.cancel(); _lockRefreshLockDetailInfoDataEvent?.cancel();
state.replySubscription.cancel(); state.replySubscription.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent! state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent
.cancel(); ?.cancel();
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
if (state.animationController != null) { if (state.animationController != null) {
state.animationController!.dispose(); state.animationController!.dispose();
state.animationController = null; state.animationController = null;

View File

@ -12,44 +12,45 @@ class LockDetailState {
late StreamSubscription<Reply> replySubscription; late StreamSubscription<Reply> replySubscription;
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent; StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
StreamSubscription? LockSetChangeSetRefreshLockDetailWithTypeSubscription;
String lockNetToken = "0"; String lockNetToken = '0';
int differentialTime = 0; int differentialTime = 0;
int lockUserNo = 0; int lockUserNo = 0;
var senderUserId = 0; int senderUserId = 0;
var isOnlyOneData = false; bool isOnlyOneData = false;
var isAttendance = 0.obs; // RxInt isAttendance = 0.obs; //
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网 RxInt isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
var electricQuantity = 0.obs; // RxInt electricQuantity = 0.obs; //
var electricQuantityStandby = 0.obs; // RxInt electricQuantityStandby = 0.obs; //
var isOpenPassageMode = 0.obs; // RxInt isOpenPassageMode = 0.obs; //
var lockAlias = "".obs; // RxString lockAlias = ''.obs; //
// var currentDeviceUUid = "".obs; // uuid // var currentDeviceUUid = "".obs; // uuid
var ifCurrentScreen = true.obs; // , RxBool ifCurrentScreen = true.obs; // ,
var iSClosedUnlockSuccessfulPopup = false.obs; // RxBool iSClosedUnlockSuccessfulPopup = false.obs; //
var iSOpenLock = true.obs; // RxBool iSOpenLock = true.obs; //
Timer? closedUnlockSuccessfulTimer; Timer? closedUnlockSuccessfulTimer;
var bottomBtnisEable = true.obs; // RxBool bottomBtnisEable = true.obs; //
var openDoorBtnisUneable = true.obs; // 使使, RxBool openDoorBtnisUneable = true.obs; // 使使,
var openDoorModel = 0;// 线0, 线2 线32 线34 int openDoorModel = 0;// 线0, 线2 线32 线34
// //
AnimationController? animationController; AnimationController? animationController;
// var lockState = 0.obs;// 0 1() 2 3 4 5 // var lockState = 0.obs;// 0 1() 2 3 4 5
var openLockBtnState = 0.obs; // 0() 1() RxInt openLockBtnState = 0.obs; // 0() 1()
// var connectState = 0.obs;// 0 1 // var connectState = 0.obs;// 0 1
final PageController pageController = PageController(); final PageController pageController = PageController();
var currentPage = 0.obs; RxInt currentPage = 0.obs;
var operateDate = 0; // int operateDate = 0; //
var logCountPage = 10; // int logCountPage = 10; //
var nextAuthTime = 0.obs; // RxInt nextAuthTime = 0.obs; //
// LockDetailState() { // LockDetailState() {
// Map map = Get.arguments; // Map map = Get.arguments;
// lockCount = map["lockCount"]; // lockCount = map["lockCount"];

View File

@ -20,6 +20,7 @@ class BasicInformationLogic extends BaseGetXController {
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
StreamSubscription? lockSetChangeSetRefreshLockDetailWithTypeSubscription;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
@ -29,6 +30,19 @@ class BasicInformationLogic extends BaseGetXController {
state.lockSetInfoData.value = event.lockSetInfoData; state.lockSetInfoData.value = event.lockSetInfoData;
blockSetStateCallback(); blockSetStateCallback();
}); });
lockSetChangeSetRefreshLockDetailWithTypeSubscription = eventBus
.on<LockSetChangeSetRefreshLockDetailWithType>()
.listen((LockSetChangeSetRefreshLockDetailWithType event) {
if (event.type == 4) {
final int electricQuantity =
int.tryParse(event.setResult['electricQuantity']) ?? 0;
state.lockBasicInfo.value.electricQuantity = electricQuantity;
state.lockBasicInfo.value.electricQuantityDate =
event.setResult['uploadElectricQuantityDate'];
state.lockBasicInfo.refresh();
}
});
} }
@override @override
@ -43,5 +57,6 @@ class BasicInformationLogic extends BaseGetXController {
void onClose() { void onClose() {
super.onClose(); super.onClose();
_passCurrentLockInformationEvent?.cancel(); _passCurrentLockInformationEvent?.cancel();
lockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
} }
} }

View File

@ -23,19 +23,22 @@ class UploadElectricQuantityLogic extends BaseGetXController {
final UploadElectricQuantityState state = UploadElectricQuantityState(); final UploadElectricQuantityState state = UploadElectricQuantityState();
// //
Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async { Future<void> uploadElectricQuantityRequest(
final KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity( String electricQuantity, String electricQuantityStandby) async {
electricQuantity:electricQuantity, final KeyOperationRecordEntity entity = await ApiRepository.to
electricQuantityStandby: electricQuantityStandby, .uploadElectricQuantity(
lockId: state.lockSetInfoData.value.lockId.toString(), electricQuantity: electricQuantity,
isUnShowLoading: false electricQuantityStandby: electricQuantityStandby,
); lockId: state.lockSetInfoData.value.lockId.toString(),
isUnShowLoading: false);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('锁电量更新成功'.tr, something: () { showToast('锁电量更新成功'.tr, something: () {
eventBus eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); .fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire( eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(4, <String,dynamic>{
LockSetChangeSetRefreshLockDetailWithType(4, electricQuantity)); 'electricQuantity': electricQuantity,
'uploadElectricQuantityDate': state.uploadElectricQuantityDate.value,
}));
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
} }
@ -57,8 +60,10 @@ class UploadElectricQuantityLogic extends BaseGetXController {
(BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
dismissEasyLoading(); dismissEasyLoading();
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
@ -67,7 +72,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
isBeforeAddUser: false, isBeforeAddUser: false,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { } else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
@ -80,6 +86,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -102,20 +109,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// //
final int battRemCap = reply.data[132]; final int battRemCap = reply.data[132];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap; state.lockSetInfoData.value.lockBasicInfo!.electricQuantity =
battRemCap;
// //
final int battRemCapStandby = reply.data[133]; final int battRemCapStandby = reply.data[133];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby = battRemCapStandby; state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby =
battRemCapStandby;
state.uploadElectricQuantityDate.value = DateTime.now().millisecondsSinceEpoch; state.uploadElectricQuantityDate.value =
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate = DateTime.now().millisecondsSinceEpoch; DateTime.now().millisecondsSinceEpoch;
uploadElectricQuantityRequest(battRemCap.toString(), battRemCapStandby.toString()); state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate =
DateTime.now().millisecondsSinceEpoch;
uploadElectricQuantityRequest(
battRemCap.toString(), battRemCapStandby.toString());
break; break;
case 0x06: case 0x06:
// //
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
@ -125,7 +139,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
break; break;
default: default:
// //
@ -134,22 +147,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
} }
// //
Future<void> getServerDatetime() async{ Future<void> getServerDatetime() async {
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(); final GetServerDatetimeEntity entity =
if(entity.errorCode!.codeIsSuccessful){ await ApiRepository.to.getServerDatetimeData();
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; if (entity.errorCode!.codeIsSuccessful) {
state.differentialTime = entity.data!.date! ~/ 1000 -
DateTime.now().millisecondsSinceEpoch ~/ 1000;
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}"); // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
} }
} }
int getLocalTime(){ int getLocalTime() {
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
state.differentialTime;
} }
int getUTCTime(){ int getUTCTime() {
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true); final DateTime utcTime =
DateTime.fromMillisecondsSinceEpoch(getLocalTime() * 1000, isUtc: true);
final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1); final String appointmentDate =
DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1); final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue'); AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
return utcTimeValue ~/ 1000; return utcTimeValue ~/ 1000;

View File

@ -50,9 +50,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
if (clearScanDevices) { if (clearScanDevices) {
BlueManage().scanDevices.clear(); BlueManage().scanDevices.clear();
} }
if (mounted) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
setState(() {}); setState(() {});
} });
// if (mounted) {
// setSŒe(() {});
// }
} }
@override @override

View File

@ -111,13 +111,9 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
children: <Widget>[ children: <Widget>[
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (type == 1) { Navigator.pushNamed(
Navigator.pushNamed( context, Routers.customSMSTemplateListPage,
context, Routers.customSMSTemplateListPage); arguments: <String, int>{'type': type});
} else {
Navigator.pushNamed(context,
Routers.valueAddedServicesListEmailTemplatePage);
}
}, },
child: Row( child: Row(
children: <Widget>[ children: <Widget>[

View File

@ -46,6 +46,8 @@ class SMSTemplateData {
String? tips = ''; String? tips = '';
int? id; int? id;
String? name; String? name;
int? type;
bool? isUpdate = false;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -14,12 +14,11 @@ class NewSMSTemplateLogic extends BaseGetXController {
//-- 1: 2: //-- 1: 2:
Future<void> getDefaultTemplate() async { Future<void> getDefaultTemplate() async {
final NewSMSTemplateEntity entity = final NewSMSTemplateEntity entity = await ApiRepository.to
await ApiRepository.to.getDefaultTemplate(type: 1); .getDefaultTemplate(type: state.currentTemplate.value.type ?? 0);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.templateList.value = entity.dataList ?? <SMSTemplateData>[]; state.templateList.value = entity.dataList ?? <SMSTemplateData>[];
if (state.templateList.isNotEmpty) { if (state.templateList.isNotEmpty) {
// state.templateTypeText.value = state.templateList[0].name ?? '';
state.currentTemplate.value = state.templateList.firstWhere( state.currentTemplate.value = state.templateList.firstWhere(
(SMSTemplateData element) => (SMSTemplateData element) =>
element.name == state.templateList[0].name, element.name == state.templateList[0].name,
@ -29,14 +28,14 @@ class NewSMSTemplateLogic extends BaseGetXController {
} }
} }
//-- 1: 2: //-- 1: 2:
Future<void> addSMSTemplate() async { Future<void> addSMSTemplate() async {
if (state.templateNameTf.text.isEmpty) { if (state.templateNameTf.text.isEmpty) {
showToast('请输入模板名称'); showToast('请输入模板名称');
return; return;
} }
final LoginEntity entity = await ApiRepository.to.addSMSTemplate( final LoginEntity entity = await ApiRepository.to.addTemplateService(
type: 1, type: state.templateType.value,
name: state.templateNameTf.text, name: state.templateNameTf.text,
fixedKey: state.currentTemplate.value.fixedKey ?? '', fixedKey: state.currentTemplate.value.fixedKey ?? '',
contentType: state.currentTemplate.value.contentType ?? 0, contentType: state.currentTemplate.value.contentType ?? 0,
@ -200,7 +199,7 @@ class NewSMSTemplateLogic extends BaseGetXController {
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();
if (state.isUpdate.value == false) { if (state.currentTemplate.value.isUpdate == false) {
getDefaultTemplate(); getDefaultTemplate();
} }
} }

View File

@ -28,7 +28,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '新建短信模版'.tr, barTitle: state.templateType.value == 1 ? '新建短信模版'.tr : '新建邮件模版'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
@ -46,7 +46,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
child: SubmitBtn( child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr, btnName: TranslationLoader.lanKeys!.save!.tr,
onClick: () { onClick: () {
if (state.isUpdate.value == true) { if (state.currentTemplate.value.isUpdate == true) {
logic.updateTemplateInfo(); logic.updateTemplateInfo();
} else { } else {
logic.addSMSTemplate(); logic.addSMSTemplate();

View File

@ -9,10 +9,10 @@ class NewSMSTemplateState {
final Map map = Get.arguments; final Map map = Get.arguments;
currentTemplate.value = map['currentTemplate']; currentTemplate.value = map['currentTemplate'];
currentTemplate.refresh(); currentTemplate.refresh();
isUpdate.value = true;
templateNameTf.text = currentTemplate.value.name ?? ''; templateNameTf.text = currentTemplate.value.name ?? '';
templateOneTf.text = currentTemplate.value.regards ?? ''; templateOneTf.text = currentTemplate.value.regards ?? '';
templateTwoTf.text = currentTemplate.value.tips ?? ''; templateTwoTf.text = currentTemplate.value.tips ?? '';
templateType.value = currentTemplate.value.type ?? 0;
} }
} }
@ -20,7 +20,7 @@ class NewSMSTemplateState {
final TextStyle highStyle = final TextStyle highStyle =
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
// //
final TextStyle defaultStyle = final TextStyle defaultStyle =
TextStyle(color: Colors.black, fontSize: 20.sp); TextStyle(color: Colors.black, fontSize: 20.sp);
@ -30,9 +30,7 @@ class NewSMSTemplateState {
RxBool isVip = false.obs; RxBool isVip = false.obs;
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs; RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
// RxString templateTypeText = '电子钥匙'.tr.obs;
// RxString templateContentText = ''.obs; //
Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs; Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs;
RxBool isShowDate = false.obs; RxBool isShowDate = false.obs;
RxBool isUpdate = false.obs; RxInt templateType = 0.obs;
} }

View File

@ -21,7 +21,9 @@ class CustomSMSTemplateListLogic extends BaseGetXController {
} }
final CustomSMSTemplateListEntity entity = await ApiRepository.to final CustomSMSTemplateListEntity entity = await ApiRepository.to
.getSMSTemplateList( .getSMSTemplateList(
type: 1, pageNo: pageNo, pageSize: int.parse(pageSize)); type: state.type.value,
pageNo: pageNo,
pageSize: int.parse(pageSize));
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.smsTemplateList.value = state.smsTemplateList.value =
entity.data?.list ?? <CustomSMSTemplateItem>[]; entity.data?.list ?? <CustomSMSTemplateItem>[];

View File

@ -41,7 +41,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: '自定义短信模版'.tr, barTitle: state.type.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: EasyRefreshTool( body: EasyRefreshTool(
@ -65,7 +65,15 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () async { onClick: () async {
final result = await Get.toNamed(Routers.newSMSTemplatePage); final SMSTemplateData templateData = SMSTemplateData();
templateData.type = state.type.value;
templateData.isUpdate = false;
templateData.typeName =
templateData.contentType == 1 ? '电子钥匙' : '密码';
final result = await Get.toNamed(Routers.newSMSTemplatePage,
arguments: <String, SMSTemplateData>{
'currentTemplate': templateData
});
if (result != null) { if (result != null) {
logic.getSMSTemplateListRequest(isRefresh: true); logic.getSMSTemplateListRequest(isRefresh: true);
} }
@ -195,6 +203,8 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
templateData.template = itemData.template; templateData.template = itemData.template;
templateData.contentType = itemData.contentType; templateData.contentType = itemData.contentType;
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码'; templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
templateData.type = itemData.type;
templateData.isUpdate = true;
final result = await Get.toNamed(Routers.newSMSTemplatePage, final result = await Get.toNamed(Routers.newSMSTemplatePage,
arguments: <String, SMSTemplateData>{ arguments: <String, SMSTemplateData>{
'currentTemplate': templateData 'currentTemplate': templateData

View File

@ -4,6 +4,11 @@ import 'package:get/get.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart'; import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
class CustomSMSTemplateListState { class CustomSMSTemplateListState {
CustomSMSTemplateListState() {
if (Get.arguments != null) {
type.value = Get.arguments['type'];
}
}
// //
final TextStyle highStyle = final TextStyle highStyle =
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp); TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
@ -14,4 +19,5 @@ class CustomSMSTemplateListState {
RxBool isVip = false.obs; RxBool isVip = false.obs;
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs; RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
RxInt type = 0.obs;
} }

View File

@ -243,12 +243,12 @@ abstract class Api {
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; // final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //
final String appGetAppInfoURL = '/app/getAppInfo'; //APP基本信息 final String appGetAppInfoURL = '/app/getAppInfo'; //APP基本信息
final String appGetFwVersionURL = '/app/getFwVersion'; // final String appGetFwVersionURL = '/app/getFwVersion'; //
final String smsTemplateListURL = '/v2/service/listSmsTemplate'; // final String smsTemplateListURL = '/v2/service/listTemplate'; //
final String emailTemplateListURL = final String emailTemplateListURL =
'/v2/service/listEmailTemplate'; // '/v2/service/listEmailTemplate'; //
final String getDefaultTemplateURL = final String getDefaultTemplateURL =
'/v2/service/getDefaultTemplate'; // '/v2/service/getDefaultTemplate'; //
final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; // final String addTemplateServiceURL = '/v2/service/addTemplate'; //
final String keydetail = ' /key/detail'; // final String keydetail = ' /key/detail'; //
final String updateTemplateInfoURL = '/v2/service/update'; // final String updateTemplateInfoURL = '/v2/service/update'; //
final String deleteTemplateURL = '/v2/service/delete'; // final String deleteTemplateURL = '/v2/service/delete'; //

View File

@ -616,8 +616,13 @@ class ApiProvider extends BaseProvider {
post(deleteElectronicKeyURL.toUrl, post(deleteElectronicKeyURL.toUrl,
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings})); jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
Future<Response> updateAdministrator(String uid, String keyName, Future<Response> updateAdministrator(
String endDate, String startDate, int isOnlyManageSelf, int keyType) => String uid,
String keyName,
String endDate,
String startDate,
int isOnlyManageSelf,
int keyType) =>
post( post(
updateAdministratorURL.toUrl, updateAdministratorURL.toUrl,
jsonEncode({ jsonEncode({
@ -2187,10 +2192,10 @@ class ApiProvider extends BaseProvider {
); );
// //
Future<Response<dynamic>> addSMSTemplate(int type, String name, Future<Response<dynamic>> addTemplateService(int type, String name,
int contentType, String regards, String tips, String fixedKey) => int contentType, String regards, String tips, String fixedKey) =>
post( post(
addSMSTemplateURL.toUrl, addTemplateServiceURL.toUrl,
jsonEncode(<String, dynamic>{ jsonEncode(<String, dynamic>{
'type': type, 'type': type,
'name': name, 'name': name,

View File

@ -644,14 +644,14 @@ class ApiRepository {
} }
// //
Future<AdministratorDetailEntity> updateAdministrator( Future<AdministratorDetailEntity> updateAdministrator({
{required String uid, required String uid,
required String keyName, required String keyName,
required String endDate, required String endDate,
required String startDate, required String startDate,
required int isOnlyManageSelf, required int isOnlyManageSelf,
required int keyType, required int keyType,
}) async { }) async {
final res = await apiProvider.updateAdministrator( final res = await apiProvider.updateAdministrator(
uid, keyName, endDate, startDate, isOnlyManageSelf, keyType); uid, keyName, endDate, startDate, isOnlyManageSelf, keyType);
return AdministratorDetailEntity.fromJson(res.body); return AdministratorDetailEntity.fromJson(res.body);
@ -2209,14 +2209,14 @@ class ApiRepository {
} }
// //
Future<LoginEntity> addSMSTemplate( Future<LoginEntity> addTemplateService(
{required int type, {required int type,
required String name, required String name,
required int contentType, required int contentType,
required String regards, required String regards,
required String tips, required String tips,
required String fixedKey}) async { required String fixedKey}) async {
final Response<dynamic> res = await apiProvider.addSMSTemplate( final Response<dynamic> res = await apiProvider.addTemplateService(
type, name, contentType, regards, tips, fixedKey); type, name, contentType, regards, tips, fixedKey);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }

View File

@ -77,7 +77,7 @@ class LockGroupEditGroupLockRefreshEvent {
/// ///
class LockSetChangeSetRefreshLockDetailWithType { class LockSetChangeSetRefreshLockDetailWithType {
int type; // 0 1 2 3 4 5 int type; // 0 1 2 3 4 5
String setResult; dynamic setResult;
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult); LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
} }

View File

@ -13,7 +13,7 @@ import 'package:star_lock/app.dart';
void main() { void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame. // Build our app and trigger a frame.
await tester.pumpWidget(const MyApp()); await tester.pumpWidget(MyApp(isLogin: false));
// Verify that our counter starts at 0. // Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget); expect(find.text('0'), findsOneWidget);