Merge branch 'release' of https://gitee.com/starlock-cn/app-starlock into release
This commit is contained in:
commit
b86fef2b55
@ -863,6 +863,7 @@
|
||||
"六": "Sat",
|
||||
"日": "Sun",
|
||||
"新建短信模版":"New SMS template",
|
||||
"新建邮件模版":"New email template",
|
||||
"自定义短信模版":"Custom SMS template",
|
||||
"自定义邮件模版":"Custom email template",
|
||||
"名称":"Name",
|
||||
|
||||
@ -895,6 +895,7 @@
|
||||
"六":"六",
|
||||
"日":"日",
|
||||
"新建短信模版":"新建短信模版",
|
||||
"新建邮件模版":"新建邮件模版",
|
||||
"自定义短信模版":"自定义短信模版",
|
||||
"自定义邮件模版":"自定义邮件模版",
|
||||
"名称":"名称",
|
||||
|
||||
@ -863,6 +863,7 @@
|
||||
"六": "六",
|
||||
"日": "日",
|
||||
"新建短信模版":"新建短信模版",
|
||||
"新建邮件模版":"新建邮件模版",
|
||||
"自定义短信模版":"自定义短信模版",
|
||||
"自定义邮件模版":"自定义邮件模版",
|
||||
"名称":"名称",
|
||||
|
||||
@ -522,5 +522,18 @@ class LockDetailLogic extends BaseGetXController {
|
||||
@override
|
||||
void 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,15 +29,14 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'lockDetail_logic.dart';
|
||||
|
||||
class LockDetailPage extends StatefulWidget {
|
||||
const LockDetailPage(
|
||||
{required this.isOnlyOneData,
|
||||
required this.lockListInfoItemEntity,
|
||||
Key? key})
|
||||
: super(key: key);
|
||||
final bool isOnlyOneData;
|
||||
final LockListInfoItemEntity lockListInfoItemEntity;
|
||||
|
||||
const LockDetailPage(
|
||||
{Key? key,
|
||||
required this.isOnlyOneData,
|
||||
required this.lockListInfoItemEntity})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||
}
|
||||
@ -50,7 +49,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
listeningAnimations();
|
||||
@ -1438,8 +1436,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
state.closedUnlockSuccessfulTimer?.cancel();
|
||||
_lockRefreshLockDetailInfoDataEvent?.cancel();
|
||||
state.replySubscription.cancel();
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!
|
||||
.cancel();
|
||||
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent
|
||||
?.cancel();
|
||||
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
|
||||
if (state.animationController != null) {
|
||||
state.animationController!.dispose();
|
||||
state.animationController = null;
|
||||
|
||||
@ -12,44 +12,45 @@ class LockDetailState {
|
||||
|
||||
late StreamSubscription<Reply> replySubscription;
|
||||
StreamSubscription? lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
StreamSubscription? LockSetChangeSetRefreshLockDetailWithTypeSubscription;
|
||||
|
||||
String lockNetToken = "0";
|
||||
String lockNetToken = '0';
|
||||
int differentialTime = 0;
|
||||
int lockUserNo = 0;
|
||||
var senderUserId = 0;
|
||||
var isOnlyOneData = false;
|
||||
int senderUserId = 0;
|
||||
bool isOnlyOneData = false;
|
||||
|
||||
var isAttendance = 0.obs; // 是否开启考勤
|
||||
var isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||
var electricQuantity = 0.obs; // 电量
|
||||
var electricQuantityStandby = 0.obs; // 备用电池电量
|
||||
var isOpenPassageMode = 0.obs; // 是否开启了常开模式
|
||||
var lockAlias = "".obs; // 锁名字
|
||||
RxInt isAttendance = 0.obs; // 是否开启考勤
|
||||
RxInt isOpenLockNeedOnline = 0.obs; // APP开锁时是否需联网
|
||||
RxInt electricQuantity = 0.obs; // 电量
|
||||
RxInt electricQuantityStandby = 0.obs; // 备用电池电量
|
||||
RxInt isOpenPassageMode = 0.obs; // 是否开启了常开模式
|
||||
RxString lockAlias = ''.obs; // 锁名字
|
||||
|
||||
// var currentDeviceUUid = "".obs; // 当前设备的uuid
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var iSClosedUnlockSuccessfulPopup = false.obs; // 是否关闭了开锁成功弹窗
|
||||
var iSOpenLock = true.obs; // 是开锁还是关锁
|
||||
RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
RxBool iSClosedUnlockSuccessfulPopup = false.obs; // 是否关闭了开锁成功弹窗
|
||||
RxBool iSOpenLock = true.obs; // 是开锁还是关锁
|
||||
Timer? closedUnlockSuccessfulTimer;
|
||||
|
||||
var bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用
|
||||
var openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用
|
||||
RxBool bottomBtnisEable = true.obs; // 是否不可用 用于限制底部按钮是否可用
|
||||
RxBool openDoorBtnisUneable = true.obs; // 当钥匙状态不能使用的情况下开锁按钮禁止使用,默认可用
|
||||
|
||||
var openDoorModel = 0;// 离线开门0, 在线开门2 离线关门32 在线关门34
|
||||
int openDoorModel = 0;// 离线开门0, 在线开门2 离线关门32 在线关门34
|
||||
|
||||
//过渡动画控制器
|
||||
AnimationController? animationController;
|
||||
// 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连接
|
||||
|
||||
final PageController pageController = PageController();
|
||||
var currentPage = 0.obs;
|
||||
RxInt currentPage = 0.obs;
|
||||
|
||||
var operateDate = 0; // 按日期查询消息记录的时间戳
|
||||
var logCountPage = 10; // 蓝牙记录一页多少个
|
||||
var nextAuthTime = 0.obs; // 下次认证时间
|
||||
int operateDate = 0; // 按日期查询消息记录的时间戳
|
||||
int logCountPage = 10; // 蓝牙记录一页多少个
|
||||
RxInt nextAuthTime = 0.obs; // 下次认证时间
|
||||
// LockDetailState() {
|
||||
// Map map = Get.arguments;
|
||||
// lockCount = map["lockCount"];
|
||||
|
||||
@ -20,6 +20,7 @@ class BasicInformationLogic extends BaseGetXController {
|
||||
|
||||
// 下级界面修改成功后传递数据
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
StreamSubscription? lockSetChangeSetRefreshLockDetailWithTypeSubscription;
|
||||
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
@ -29,6 +30,19 @@ class BasicInformationLogic extends BaseGetXController {
|
||||
state.lockSetInfoData.value = event.lockSetInfoData;
|
||||
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
|
||||
@ -43,5 +57,6 @@ class BasicInformationLogic extends BaseGetXController {
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
_passCurrentLockInformationEvent?.cancel();
|
||||
lockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,19 +23,22 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
final UploadElectricQuantityState state = UploadElectricQuantityState();
|
||||
|
||||
//电量更新请求
|
||||
Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async {
|
||||
final KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
|
||||
electricQuantity:electricQuantity,
|
||||
electricQuantityStandby: electricQuantityStandby,
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
isUnShowLoading: false
|
||||
);
|
||||
Future<void> uploadElectricQuantityRequest(
|
||||
String electricQuantity, String electricQuantityStandby) async {
|
||||
final KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.uploadElectricQuantity(
|
||||
electricQuantity: electricQuantity,
|
||||
electricQuantityStandby: electricQuantityStandby,
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
isUnShowLoading: false);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast('锁电量更新成功'.tr, something: () {
|
||||
eventBus
|
||||
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
|
||||
eventBus.fire(
|
||||
LockSetChangeSetRefreshLockDetailWithType(4, electricQuantity));
|
||||
eventBus.fire(LockSetChangeSetRefreshLockDetailWithType(4, <String,dynamic>{
|
||||
'electricQuantity': electricQuantity,
|
||||
'uploadElectricQuantityDate': state.uploadElectricQuantityDate.value,
|
||||
}));
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
@ -57,8 +60,10 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
dismissEasyLoading();
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
@ -67,7 +72,8 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
isBeforeAddUser: false,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
@ -80,6 +86,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||
@ -102,20 +109,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
|
||||
// 电池剩余电量
|
||||
final int battRemCap = reply.data[132];
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity =
|
||||
battRemCap;
|
||||
|
||||
// 备用电池剩余电量
|
||||
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.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate = DateTime.now().millisecondsSinceEpoch;
|
||||
uploadElectricQuantityRequest(battRemCap.toString(), battRemCapStandby.toString());
|
||||
state.uploadElectricQuantityDate.value =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityDate =
|
||||
DateTime.now().millisecondsSinceEpoch;
|
||||
uploadElectricQuantityRequest(
|
||||
battRemCap.toString(), battRemCapStandby.toString());
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
@ -125,7 +139,6 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
@ -134,22 +147,27 @@ class UploadElectricQuantityLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 从服务器获取锁的时间 开锁时传入
|
||||
Future<void> getServerDatetime() async{
|
||||
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
Future<void> getServerDatetime() async {
|
||||
final GetServerDatetimeEntity entity =
|
||||
await ApiRepository.to.getServerDatetimeData();
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
int getLocalTime(){
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||
int getLocalTime() {
|
||||
return DateTime.now().millisecondsSinceEpoch ~/ 1000 +
|
||||
state.differentialTime;
|
||||
}
|
||||
|
||||
int getUTCTime(){
|
||||
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
|
||||
int getUTCTime() {
|
||||
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);
|
||||
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
|
||||
return utcTimeValue ~/ 1000;
|
||||
|
||||
@ -50,9 +50,13 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
if (clearScanDevices) {
|
||||
BlueManage().scanDevices.clear();
|
||||
}
|
||||
if (mounted) {
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
// if (mounted) {
|
||||
// setSŒe(() {});
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -111,13 +111,9 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (type == 1) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.customSMSTemplateListPage);
|
||||
} else {
|
||||
Navigator.pushNamed(context,
|
||||
Routers.valueAddedServicesListEmailTemplatePage);
|
||||
}
|
||||
Navigator.pushNamed(
|
||||
context, Routers.customSMSTemplateListPage,
|
||||
arguments: <String, int>{'type': type});
|
||||
},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
|
||||
@ -46,6 +46,8 @@ class SMSTemplateData {
|
||||
String? tips = '';
|
||||
int? id;
|
||||
String? name;
|
||||
int? type;
|
||||
bool? isUpdate = false;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
|
||||
@ -14,12 +14,11 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
||||
|
||||
//获取默认模板-- 1:电子钥匙 2:密码
|
||||
Future<void> getDefaultTemplate() async {
|
||||
final NewSMSTemplateEntity entity =
|
||||
await ApiRepository.to.getDefaultTemplate(type: 1);
|
||||
final NewSMSTemplateEntity entity = await ApiRepository.to
|
||||
.getDefaultTemplate(type: state.currentTemplate.value.type ?? 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.templateList.value = entity.dataList ?? <SMSTemplateData>[];
|
||||
if (state.templateList.isNotEmpty) {
|
||||
// state.templateTypeText.value = state.templateList[0].name ?? '';
|
||||
state.currentTemplate.value = state.templateList.firstWhere(
|
||||
(SMSTemplateData element) =>
|
||||
element.name == state.templateList[0].name,
|
||||
@ -29,14 +28,14 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
//获取默认模板-- 1:电子钥匙 2:密码
|
||||
//新建模板-- 1:电子钥匙 2:密码
|
||||
Future<void> addSMSTemplate() async {
|
||||
if (state.templateNameTf.text.isEmpty) {
|
||||
showToast('请输入模板名称');
|
||||
return;
|
||||
}
|
||||
final LoginEntity entity = await ApiRepository.to.addSMSTemplate(
|
||||
type: 1,
|
||||
final LoginEntity entity = await ApiRepository.to.addTemplateService(
|
||||
type: state.templateType.value,
|
||||
name: state.templateNameTf.text,
|
||||
fixedKey: state.currentTemplate.value.fixedKey ?? '',
|
||||
contentType: state.currentTemplate.value.contentType ?? 0,
|
||||
@ -200,7 +199,7 @@ class NewSMSTemplateLogic extends BaseGetXController {
|
||||
Future<void> onReady() async {
|
||||
super.onReady();
|
||||
|
||||
if (state.isUpdate.value == false) {
|
||||
if (state.currentTemplate.value.isUpdate == false) {
|
||||
getDefaultTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '新建短信模版'.tr,
|
||||
barTitle: state.templateType.value == 1 ? '新建短信模版'.tr : '新建邮件模版'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
@ -46,7 +46,7 @@ class _NewSMSTemplatePageState extends State<NewSMSTemplatePage> {
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||
onClick: () {
|
||||
if (state.isUpdate.value == true) {
|
||||
if (state.currentTemplate.value.isUpdate == true) {
|
||||
logic.updateTemplateInfo();
|
||||
} else {
|
||||
logic.addSMSTemplate();
|
||||
|
||||
@ -9,10 +9,10 @@ class NewSMSTemplateState {
|
||||
final Map map = Get.arguments;
|
||||
currentTemplate.value = map['currentTemplate'];
|
||||
currentTemplate.refresh();
|
||||
isUpdate.value = true;
|
||||
templateNameTf.text = currentTemplate.value.name ?? '';
|
||||
templateOneTf.text = currentTemplate.value.regards ?? '';
|
||||
templateTwoTf.text = currentTemplate.value.tips ?? '';
|
||||
templateType.value = currentTemplate.value.type ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ class NewSMSTemplateState {
|
||||
final TextStyle highStyle =
|
||||
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
||||
|
||||
//默认样式
|
||||
//默认样式
|
||||
final TextStyle defaultStyle =
|
||||
TextStyle(color: Colors.black, fontSize: 20.sp);
|
||||
|
||||
@ -30,9 +30,7 @@ class NewSMSTemplateState {
|
||||
|
||||
RxBool isVip = false.obs;
|
||||
RxList<SMSTemplateData> templateList = <SMSTemplateData>[].obs;
|
||||
// RxString templateTypeText = '电子钥匙'.tr.obs;
|
||||
// RxString templateContentText = ''.obs; //模版内容
|
||||
Rx<SMSTemplateData> currentTemplate = SMSTemplateData().obs;
|
||||
RxBool isShowDate = false.obs;
|
||||
RxBool isUpdate = false.obs;
|
||||
RxInt templateType = 0.obs;
|
||||
}
|
||||
|
||||
@ -21,7 +21,9 @@ class CustomSMSTemplateListLogic extends BaseGetXController {
|
||||
}
|
||||
final CustomSMSTemplateListEntity entity = await ApiRepository.to
|
||||
.getSMSTemplateList(
|
||||
type: 1, pageNo: pageNo, pageSize: int.parse(pageSize));
|
||||
type: state.type.value,
|
||||
pageNo: pageNo,
|
||||
pageSize: int.parse(pageSize));
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.smsTemplateList.value =
|
||||
entity.data?.list ?? <CustomSMSTemplateItem>[];
|
||||
|
||||
@ -41,7 +41,7 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '自定义短信模版'.tr,
|
||||
barTitle: state.type.value == 1 ? '自定义短信模版'.tr : '自定义邮件模版'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: EasyRefreshTool(
|
||||
@ -65,7 +65,15 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
||||
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
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) {
|
||||
logic.getSMSTemplateListRequest(isRefresh: true);
|
||||
}
|
||||
@ -195,6 +203,8 @@ class _CustomSMSTemplateListPageState extends State<CustomSMSTemplateListPage> {
|
||||
templateData.template = itemData.template;
|
||||
templateData.contentType = itemData.contentType;
|
||||
templateData.typeName = templateData.contentType == 1 ? '电子钥匙' : '密码';
|
||||
templateData.type = itemData.type;
|
||||
templateData.isUpdate = true;
|
||||
final result = await Get.toNamed(Routers.newSMSTemplatePage,
|
||||
arguments: <String, SMSTemplateData>{
|
||||
'currentTemplate': templateData
|
||||
|
||||
@ -4,6 +4,11 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/customSMSTemplateList_entity.dart';
|
||||
|
||||
class CustomSMSTemplateListState {
|
||||
CustomSMSTemplateListState() {
|
||||
if (Get.arguments != null) {
|
||||
type.value = Get.arguments['type'];
|
||||
}
|
||||
}
|
||||
//高亮样式
|
||||
final TextStyle highStyle =
|
||||
TextStyle(color: const Color(0xFFEEDFA8), fontSize: 20.sp);
|
||||
@ -14,4 +19,5 @@ class CustomSMSTemplateListState {
|
||||
|
||||
RxBool isVip = false.obs;
|
||||
RxList<CustomSMSTemplateItem> smsTemplateList = <CustomSMSTemplateItem>[].obs;
|
||||
RxInt type = 0.obs;
|
||||
}
|
||||
|
||||
@ -243,12 +243,12 @@ abstract class Api {
|
||||
final String getNoticeTemplateURL = '/key/getNoticeTemplate'; //获取短信或者邮箱模板
|
||||
final String appGetAppInfoURL = '/app/getAppInfo'; //获取APP基本信息
|
||||
final String appGetFwVersionURL = '/app/getFwVersion'; //获取固件信息
|
||||
final String smsTemplateListURL = '/v2/service/listSmsTemplate'; //获取短信模板列表
|
||||
final String smsTemplateListURL = '/v2/service/listTemplate'; //获取短信模板列表
|
||||
final String emailTemplateListURL =
|
||||
'/v2/service/listEmailTemplate'; //获取邮件模板列表
|
||||
final String getDefaultTemplateURL =
|
||||
'/v2/service/getDefaultTemplate'; //获取默认模板
|
||||
final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //添加短信模板
|
||||
final String addTemplateServiceURL = '/v2/service/addTemplate'; //添加短信模板
|
||||
final String keydetail = ' /key/detail'; //获取钥匙详情
|
||||
final String updateTemplateInfoURL = '/v2/service/update'; //更新模板信息
|
||||
final String deleteTemplateURL = '/v2/service/delete'; //删除模板
|
||||
|
||||
@ -616,8 +616,13 @@ class ApiProvider extends BaseProvider {
|
||||
post(deleteElectronicKeyURL.toUrl,
|
||||
jsonEncode({'uid': uid, 'includeUnderlings': includeUnderlings}));
|
||||
|
||||
Future<Response> updateAdministrator(String uid, String keyName,
|
||||
String endDate, String startDate, int isOnlyManageSelf, int keyType) =>
|
||||
Future<Response> updateAdministrator(
|
||||
String uid,
|
||||
String keyName,
|
||||
String endDate,
|
||||
String startDate,
|
||||
int isOnlyManageSelf,
|
||||
int keyType) =>
|
||||
post(
|
||||
updateAdministratorURL.toUrl,
|
||||
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) =>
|
||||
post(
|
||||
addSMSTemplateURL.toUrl,
|
||||
addTemplateServiceURL.toUrl,
|
||||
jsonEncode(<String, dynamic>{
|
||||
'type': type,
|
||||
'name': name,
|
||||
|
||||
@ -644,14 +644,14 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
//更新授权管理员
|
||||
Future<AdministratorDetailEntity> updateAdministrator(
|
||||
{required String uid,
|
||||
required String keyName,
|
||||
required String endDate,
|
||||
required String startDate,
|
||||
required int isOnlyManageSelf,
|
||||
required int keyType,
|
||||
}) async {
|
||||
Future<AdministratorDetailEntity> updateAdministrator({
|
||||
required String uid,
|
||||
required String keyName,
|
||||
required String endDate,
|
||||
required String startDate,
|
||||
required int isOnlyManageSelf,
|
||||
required int keyType,
|
||||
}) async {
|
||||
final res = await apiProvider.updateAdministrator(
|
||||
uid, keyName, endDate, startDate, isOnlyManageSelf, keyType);
|
||||
return AdministratorDetailEntity.fromJson(res.body);
|
||||
@ -2209,14 +2209,14 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 添加短信模板
|
||||
Future<LoginEntity> addSMSTemplate(
|
||||
Future<LoginEntity> addTemplateService(
|
||||
{required int type,
|
||||
required String name,
|
||||
required int contentType,
|
||||
required String regards,
|
||||
required String tips,
|
||||
required String fixedKey}) async {
|
||||
final Response<dynamic> res = await apiProvider.addSMSTemplate(
|
||||
final Response<dynamic> res = await apiProvider.addTemplateService(
|
||||
type, name, contentType, regards, tips, fixedKey);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ class LockGroupEditGroupLockRefreshEvent {
|
||||
/// 锁设置里面开启关闭刷新锁详情
|
||||
class LockSetChangeSetRefreshLockDetailWithType {
|
||||
int type; // 0 考勤 1开锁时是否需联网 2常开模式 3修改了锁名字 4修改了电量 5远程开锁
|
||||
String setResult;
|
||||
dynamic setResult;
|
||||
|
||||
LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult);
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import 'package:star_lock/app.dart';
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// 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.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user