修复邮箱注册、邮箱登录bug
This commit is contained in:
parent
a6251cbc2d
commit
3bdd58d620
@ -18,4 +18,40 @@ class XSConstantMacro {
|
||||
static int keyTypeTime = 2;
|
||||
static int keyTypeOnce = 3;
|
||||
static int keyTypeLoop = 4;
|
||||
|
||||
// "110401" 正常使用
|
||||
// "110402" 待接收
|
||||
// "110403" 待生效
|
||||
// "110405" 已冻结
|
||||
// "110412" 已过期
|
||||
// "110408" 已删除
|
||||
// "110410" 已重置
|
||||
static int keyStatusNormalUse = 110401; // 正常使用
|
||||
static int keyStatusWaitReceive = 110402; // 待接收
|
||||
static int keyStatusWaitIneffective = 110403; // 待生效
|
||||
static int keyStatusFrozen = 110405; // 已冻结
|
||||
static int keyStatusExpired = 110412; // 已过期
|
||||
static int keyStatusDeleted = 110408; // 已删除
|
||||
static int keyStatusReset = 110410; // 已重置
|
||||
|
||||
static String getKeyStatusStr(int keyStatus){
|
||||
switch(keyStatus){
|
||||
case 110401:
|
||||
return "正常使用";
|
||||
case 110402:
|
||||
return "待接收";
|
||||
case 110403:
|
||||
return "未生效";
|
||||
case 110405:
|
||||
return "已冻结";
|
||||
case 110408:
|
||||
return "已删除";
|
||||
// case 110410:
|
||||
// return "已重置";
|
||||
case 110412:
|
||||
return "已过期";
|
||||
default:
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
|
||||
sliderMoveFinish = false;
|
||||
checkResultAfterDrag = false;
|
||||
});
|
||||
print("countryCode:${state.getData["countryCode"]} getAccount:${state.getData["getAccount"]}");
|
||||
// print("countryCode:${state.getData["countryCode"]} getAccount:${state.getData["getAccount"]}");
|
||||
|
||||
var entity = await ApiRepository.to.getSliderVerifyImg(state.getData["countryCode"].toString(), state.getData["account"].toString());
|
||||
if(entity.errorCode! == 0){
|
||||
@ -338,23 +338,23 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
|
||||
onPanStart: (startDetails) {
|
||||
///开始
|
||||
_checkMilliseconds = DateTime.now().millisecondsSinceEpoch;
|
||||
print(startDetails.localPosition);
|
||||
// print(startDetails.localPosition);
|
||||
sliderStartX = startDetails.localPosition.dx;
|
||||
},
|
||||
onPanUpdate: (updateDetails) {
|
||||
///更新
|
||||
print(updateDetails.localPosition);
|
||||
// print(updateDetails.localPosition);
|
||||
double offset = updateDetails.localPosition.dx - sliderStartX;
|
||||
if(offset < 0){
|
||||
offset = 0;
|
||||
}
|
||||
print("offset ------ $offset");
|
||||
// print("offset ------ $offset");
|
||||
setState(() {
|
||||
state.sliderXMoved.value = offset;
|
||||
});
|
||||
},
|
||||
onPanEnd: (endDetails) { //结束
|
||||
print("endDetails sliderXMoved:${state.sliderXMoved.value}");
|
||||
// print("endDetails sliderXMoved:${state.sliderXMoved.value}");
|
||||
checkCaptcha(state.sliderXMoved.value);
|
||||
int nowTime = DateTime.now().millisecondsSinceEpoch;
|
||||
_checkMilliseconds = nowTime - _checkMilliseconds;
|
||||
|
||||
@ -47,13 +47,11 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
void sendValidationCode() async {
|
||||
var entity = await ApiRepository.to.sendValidationCode(
|
||||
// state.countryCode.value,
|
||||
"+86",
|
||||
state.phoneStr.value,
|
||||
// state.isIphoneType.value ? "1" : "2",
|
||||
'1',
|
||||
state.codeType.value,
|
||||
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
|
||||
state.xWidth.value.toString());
|
||||
countryCode:"+86",
|
||||
account:state.phoneStr.value,
|
||||
channel:state.codeType.value,
|
||||
codeType:'2',
|
||||
xWidth:state.xWidth.value.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
_startTimer();
|
||||
} else {}
|
||||
@ -66,6 +64,11 @@ class StarLockForgetPasswordLogic extends BaseGetXController {
|
||||
void changeInput(TextEditingController controller) {
|
||||
if (controller == state.phoneController) {
|
||||
state.phoneStr.value = controller.text;
|
||||
if(state.phoneStr.value.contains("@")){
|
||||
state.codeType.value = "2";
|
||||
}else{
|
||||
state.codeType.value = "1";
|
||||
}
|
||||
state.phoneStrIsOK.value = state.phoneStr.value.isNotEmpty;
|
||||
}
|
||||
if (controller == state.pwdController) {
|
||||
|
||||
@ -39,27 +39,72 @@ class _StarLockForgetPasswordPageState
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var 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'];
|
||||
}
|
||||
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 70.h,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 5.w),
|
||||
Expanded(
|
||||
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: AppColors.blackColor))),
|
||||
SizedBox(width: 20.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Obx(() => Text(
|
||||
'${state.countryName} +${state.countryCode}',
|
||||
// state.isIphoneType.value
|
||||
// ? '${state.countryName} +${state.countryCode}'
|
||||
// : "${state.countryName}",
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: AppColors.blackColor),
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
Image.asset(
|
||||
'images/icon_right.png',
|
||||
width: 50.w,
|
||||
height: 50.w,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 0.5.h,
|
||||
color: Colors.grey,
|
||||
),
|
||||
LoginInput(
|
||||
controller: state.phoneController,
|
||||
onchangeAction: (v) {
|
||||
print("3333333:${v}");
|
||||
logic.checkNext(state.phoneController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
'images/icon_login_account.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
),
|
||||
hintText:
|
||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
hintText:TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
SizedBox(height: 10.h),
|
||||
LoginInput(
|
||||
|
||||
@ -14,9 +14,9 @@ class StarLockForgetPasswordState {
|
||||
return DateTime.now().millisecondsSinceEpoch;
|
||||
}
|
||||
|
||||
var countryCode = '+86'.obs;
|
||||
var countryId = '9'.obs;
|
||||
var codeType = '2'.obs;
|
||||
var countryCode = "86".obs;
|
||||
var countryName = '中国'.obs;
|
||||
var codeType = '2'.obs; // 1:邮箱 2:手机
|
||||
var pwd = ''.obs;
|
||||
var surePwd = ''.obs;
|
||||
var verificationCode = ''.obs;
|
||||
@ -26,7 +26,7 @@ class StarLockForgetPasswordState {
|
||||
var phoneStrIsOK = false.obs;
|
||||
var date = currentTimeMillis().toString().obs;
|
||||
|
||||
bool get isIphone => RegexUtil.isMobileSimple(phoneStr.value);
|
||||
// bool get isIphone => RegexUtil.isMobileSimple(phoneStr.value);
|
||||
bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value);
|
||||
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
||||
|
||||
|
||||
@ -30,12 +30,11 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
|
||||
void register() async {
|
||||
var entity = await ApiRepository.to.register(
|
||||
state.countryCode.value,
|
||||
state.countryId.value,
|
||||
state.phoneOrEmailStr.value,
|
||||
state.pwd.value,
|
||||
"477E6814-289D-402A-9F49-F89A8BD05D63",
|
||||
state.verificationCode.value);
|
||||
receiverType:state.isIphoneType.value == true ? 1 : 2,
|
||||
countryCode:state.countryCode.value,
|
||||
account:state.phoneOrEmailStr.value,
|
||||
password:state.pwd.value,
|
||||
verificationCode:state.verificationCode.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// await loginSuccess(loginEntity: entity);
|
||||
// Toast.show(msg: "注册成功");
|
||||
@ -47,12 +46,11 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
void sendValidationCode() async {
|
||||
var entity = await ApiRepository.to.sendValidationCode(
|
||||
// state.countryCode.value,
|
||||
"+86",
|
||||
state.phoneOrEmailStr.value,
|
||||
state.isIphoneType.value ? "1" : "2",
|
||||
'1',
|
||||
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
|
||||
state.xWidth.value.toString());
|
||||
countryCode:state.countryCode.value.toString(),
|
||||
account:state.phoneOrEmailStr.value,
|
||||
channel:state.isIphoneType.value ? "1" : "2",
|
||||
codeType:'1',
|
||||
xWidth:state.xWidth.value.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
_startTimer();
|
||||
} else {
|
||||
@ -85,6 +83,5 @@ class StarLockRegisterLogic extends BaseGetXController {
|
||||
state.canSub.value = state.pwdIsOK &&
|
||||
state.codeIsOK &&
|
||||
(state.isIphoneType.value ? state.isIphone : state.isEmail);
|
||||
print("22222:${state.canSub.value}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import 'dart:async';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -145,12 +143,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
context, Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
logic.state.countryCode.value = result['code'];
|
||||
logic.state.countryId.value = result["countryId"];
|
||||
logic.state.countryName.value = result['countryName'];
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
print(
|
||||
"路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
||||
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 70.h,
|
||||
@ -167,8 +163,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
children: [
|
||||
Obx(() => Text(
|
||||
state.isIphoneType.value
|
||||
? '${logic.state.countryName} +${logic.state.countryCode}'
|
||||
: "${logic.state.countryName}",
|
||||
? '${state.countryName} +${state.countryCode}'
|
||||
: "${state.countryName}",
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: AppColors.blackColor),
|
||||
@ -199,7 +195,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
LoginInput(
|
||||
controller: state.phoneOrEmailController,
|
||||
onchangeAction: (v) {
|
||||
print("3333333:${v}");
|
||||
logic.checkNext(state.phoneOrEmailController);
|
||||
},
|
||||
leftWidget:
|
||||
@ -299,8 +294,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
"countryCode": state.countryCode,
|
||||
"account": state.phoneOrEmailStr.value
|
||||
});
|
||||
logic.state.xWidth.value =
|
||||
(result as Map<String, dynamic>)['xWidth'];
|
||||
state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
|
||||
logic.sendValidationCode();
|
||||
}
|
||||
: null,
|
||||
@ -309,9 +303,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
height: 60.h,
|
||||
padding: EdgeInsets.all(5.h),
|
||||
decoration: BoxDecoration(
|
||||
color: state.phoneOrEmailStrIsOK.value
|
||||
? AppColors.mainColor
|
||||
: Colors.grey,
|
||||
color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor : Colors.grey,
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
child: Center(
|
||||
child: Text(state.btnText.value,
|
||||
|
||||
@ -10,9 +10,9 @@ class StarLockRegisterState {
|
||||
final TextEditingController sureController = TextEditingController();
|
||||
final TextEditingController codeController = TextEditingController();
|
||||
|
||||
var countryCode = '86'.obs;
|
||||
var countryId = '1'.obs;
|
||||
var countryCode = 86.obs;
|
||||
var countryName = '中国'.obs;
|
||||
|
||||
var phoneOrEmailStr = ''.obs;
|
||||
var phoneOrEmailStrIsOK = false.obs;
|
||||
var pwd = ''.obs;
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import 'package:azlistview/azlistview.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../tools/keySearchWidget.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'common/index.dart';
|
||||
@ -20,6 +22,7 @@ class SelectCountryRegionPage extends StatefulWidget {
|
||||
|
||||
class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
List<CountryRegionModel> countriesList = [];
|
||||
TextEditingController searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -60,9 +63,11 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
// A-Z sort.
|
||||
SuspensionUtil.sortListBySuspensionTag(list);
|
||||
// show sus tag.
|
||||
SuspensionUtil.setShowSuspensionStatus(countriesList);
|
||||
SuspensionUtil.setShowSuspensionStatus(list);
|
||||
|
||||
setState(() {});
|
||||
setState(() {
|
||||
Get.log('list.length:${list.length}');
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@ -76,26 +81,49 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: AzListView(
|
||||
data: countriesList,
|
||||
itemCount: countriesList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
CountryRegionModel model = countriesList[index];
|
||||
return Utils.getListItem(context, model, () {
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['code'] = model.code;
|
||||
resultMap['countryId'] = model.countryId.toString();
|
||||
resultMap['countryName'] = model.name;
|
||||
Navigator.pop(context, resultMap);
|
||||
});
|
||||
},
|
||||
padding: EdgeInsets.zero,
|
||||
susItemBuilder: (BuildContext context, int index) {
|
||||
CountryRegionModel model = countriesList[index];
|
||||
String tag = model.getSuspensionTag();
|
||||
return Utils.getSusItem(context, tag);
|
||||
},
|
||||
indexBarData: const ['★', ...kIndexBarData],
|
||||
body: Column(
|
||||
children: [
|
||||
KeySearchWidget(
|
||||
editingController: searchController,
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
onSubmittedAction: () {
|
||||
var searchList = <CountryRegionModel>[];
|
||||
for (int i = 0, length = countriesList.length; i < length; i++) {
|
||||
CountryRegionModel countryModel = countriesList[i];
|
||||
if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){
|
||||
searchList.add(countryModel);
|
||||
Get.log('countryModel.name:${countryModel.name} countryModel.code:${countryModel.code}');
|
||||
}
|
||||
}
|
||||
Get.log('searchList.length:${searchList.length}');
|
||||
_handleList(searchList);
|
||||
},
|
||||
),
|
||||
SizedBox(height:20.h),
|
||||
Expanded(
|
||||
child: AzListView(
|
||||
data: countriesList,
|
||||
itemCount: countriesList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
CountryRegionModel model = countriesList[index];
|
||||
return Utils.getListItem(context, model, () {
|
||||
Map<String, dynamic> resultMap = {};
|
||||
resultMap['code'] = model.code;
|
||||
resultMap['countryId'] = model.countryId.toString();
|
||||
resultMap['countryName'] = model.name;
|
||||
Navigator.pop(context, resultMap);
|
||||
});
|
||||
},
|
||||
padding: EdgeInsets.zero,
|
||||
susItemBuilder: (BuildContext context, int index) {
|
||||
CountryRegionModel model = countriesList[index];
|
||||
String tag = model.getSuspensionTag();
|
||||
return Utils.getSusItem(context, tag);
|
||||
},
|
||||
indexBarData: const ['★', ...kIndexBarData],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -37,6 +37,13 @@ class _AuthorizedAdminManageTabbarState
|
||||
vsync: this,
|
||||
length: _itemTabs.length,
|
||||
initialIndex: widget.initialIndex);
|
||||
|
||||
_tabController.addListener(() {
|
||||
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
||||
if (_tabController.animation!.value==_tabController.index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@ -54,6 +61,9 @@ class _AuthorizedAdminManageTabbarState
|
||||
return TabBar(
|
||||
controller: _tabController,
|
||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||
onTap: (index){
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
isScrollable: true,
|
||||
indicatorColor: Colors.red,
|
||||
unselectedLabelColor: Colors.black,
|
||||
|
||||
@ -7,27 +7,29 @@ class AuthorizedAdminListLogic extends BaseGetXController {
|
||||
final AuthorizedAdminListState state = AuthorizedAdminListState();
|
||||
|
||||
//请求电子钥匙列表
|
||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
endDate: '0',
|
||||
keyId: state.keyInfo.value.keyId.toString(),
|
||||
keyStatus: '',
|
||||
keyRight: '1',
|
||||
lockId: state.keyInfo.value.lockId.toString(),
|
||||
operatorUid: '',
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
keyRight: '0',
|
||||
searchStr:state.searchStr.value);
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
if (entity.data != null) {
|
||||
dataList = entity.data!.itemList;
|
||||
if (pageNo == 1) {
|
||||
state.itemDataList.value = entity.data!.itemList!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.itemList!.isNotEmpty) {
|
||||
state.itemDataList.value.addAll(entity.data!.itemList!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
}
|
||||
state.itemDataList.value = dataList;
|
||||
return dataList;
|
||||
return entity;
|
||||
}
|
||||
|
||||
//删除电子钥匙名称请求
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart';
|
||||
@ -9,6 +10,7 @@ import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/EasyRefreshTool.dart';
|
||||
import '../../../../tools/left_slide_actions.dart';
|
||||
import '../../../../tools/showIosTipView.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
@ -38,7 +40,9 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest();
|
||||
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value){
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,122 +55,137 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child:_buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminManagePage,
|
||||
arguments: {
|
||||
// "lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
mockRequest();
|
||||
},
|
||||
onLoad: (){
|
||||
mockRequest();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child:_buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminManagePage,
|
||||
arguments: {
|
||||
// "lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 44.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return state.itemDataList.value.isEmpty
|
||||
return Obx(() => state.itemDataList.value.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - 90)
|
||||
: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
ElectronicKeyListItem indexEntity = state.itemDataList.value[index];
|
||||
String useDateStr = ''; //使用期限
|
||||
String keyStatus = ''; //钥匙状态
|
||||
|
||||
//使用期限
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
//使用期限
|
||||
useDateStr = getUseDateStr(indexEntity);
|
||||
|
||||
//钥匙状态
|
||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
||||
//钥匙状态
|
||||
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
||||
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
if (indexEntity.keyRight == 1) {
|
||||
isAdminKey = true;
|
||||
} else {
|
||||
isAdminKey = false;
|
||||
}
|
||||
//是否为管理钥匙
|
||||
bool isAdminKey = false;
|
||||
if (indexEntity.keyRight == 1) {
|
||||
isAdminKey = true;
|
||||
} else {
|
||||
isAdminKey = false;
|
||||
}
|
||||
|
||||
if (index < state.itemDataList.value.length) {
|
||||
return LeftSlideActions(
|
||||
// key: Key(indexEntity.lockId!.toString()),
|
||||
actionsWidth: 60,
|
||||
actions: [
|
||||
_buildDeleteBtn(indexEntity),
|
||||
],
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
),
|
||||
child: _electronicKeyItem(
|
||||
'images/controls_user.png',
|
||||
indexEntity.keyName!,
|
||||
useDateStr,
|
||||
keyStatus,
|
||||
isAdminKey, () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.electronicKeyDetailPage,
|
||||
arguments: {'itemData': indexEntity}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
return Slidable(
|
||||
key:ValueKey(indexEntity.keyId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
showIosTipViewDialog(context, indexEntity.keyId!.toString());
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除',
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem('images/controls_user.png', indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
||||
arguments: {"itemData": indexEntity}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeleteBtn(ElectronicKeyListItem passwordKeyListItem) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// 省略: 弹出是否删除的确认对话框。
|
||||
showIosTipViewDialog(context, passwordKeyListItem);
|
||||
},
|
||||
child: Container(
|
||||
width: 60,
|
||||
color: const Color(0xFFF20101),
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
'删除',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
// if (index < state.itemDataList.value.length) {
|
||||
// return LeftSlideActions(
|
||||
// // key: Key(indexEntity.lockId!.toString()),
|
||||
// actionsWidth: 60,
|
||||
// actions: [
|
||||
// _buildDeleteBtn(indexEntity),
|
||||
// ],
|
||||
// decoration: const BoxDecoration(
|
||||
// borderRadius: BorderRadius.all(Radius.circular(1)),
|
||||
// ),
|
||||
// child: _electronicKeyItem(
|
||||
// 'images/controls_user.png',
|
||||
// indexEntity.keyName!,
|
||||
// useDateStr,
|
||||
// keyStatus,
|
||||
// isAdminKey, () {
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.electronicKeyDetailPage,
|
||||
// arguments: {'itemData': indexEntity}).then((val) {
|
||||
// if (val != null) {
|
||||
// logic.mockNetworkDataRequest();
|
||||
// setState(() {});
|
||||
// }
|
||||
// });
|
||||
// }),
|
||||
// );
|
||||
// }
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
void showIosTipViewDialog(
|
||||
BuildContext context, ElectronicKeyListItem passwordKeyListItem) {
|
||||
BuildContext context, String keyId) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@ -175,7 +194,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
tipTitle: "确定要删除吗?",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
logic.deleteKeyRequest(passwordKeyListItem.keyId.toString());
|
||||
logic.deleteKeyRequest(keyId);
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
@ -281,10 +300,10 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
child: SizedBox(
|
||||
width: 20.w,
|
||||
)),
|
||||
// Text(
|
||||
// keyStatus,
|
||||
// style: TextStyle(fontSize: 18.sp, color: Colors.red),
|
||||
// ),
|
||||
Text(
|
||||
keyStatus,
|
||||
style: TextStyle(fontSize: 18.sp, color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
|
||||
@ -6,8 +6,7 @@ import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||
class AuthorizedAdminListState {
|
||||
final keyInfo = LockListInfoItemEntity().obs;
|
||||
// final lockMainEntity = LockMainEntity().obs;
|
||||
var pageNum = 1.obs; //请求页码
|
||||
final pageSize = 20.obs; //请求每页数据条数
|
||||
|
||||
final itemDataList = <ElectronicKeyListItem>[].obs;
|
||||
final searchStr = ''.obs;
|
||||
|
||||
|
||||
@ -12,14 +12,19 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
|
||||
//修改钥匙名称请求
|
||||
Future<void> modifyKeyNameRequest() async {
|
||||
if (state.changeNameController.text.isEmpty) {
|
||||
showToast("请输入钥匙名称");
|
||||
return;
|
||||
}
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||
.modifyKeyNameForAdmin(state.itemData.value.keyId.toString(),
|
||||
state.changeNameController.text, '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("修改要是名称成功啦啦啦啦啦");
|
||||
state.itemData.value.keyName = state.changeNameController.text;
|
||||
state.keyName.value = state.itemData.value.keyName!;
|
||||
Get.back();
|
||||
showToast("修改成功", something: (){
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,17 +58,15 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
rightTitle: state.changeNameController.text.isNotEmpty
|
||||
? state.changeNameController.text
|
||||
: state.itemData.value.keyName,
|
||||
rightTitle: state.keyName.value,
|
||||
isHaveDirection: true,
|
||||
isHaveLine: true,
|
||||
action: () {
|
||||
showCupertinoAlertDialog(context);
|
||||
}),
|
||||
getPeriodValidityWidget(),
|
||||
})),
|
||||
Obx(() => getPeriodValidityWidget()),
|
||||
Container(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
|
||||
|
||||
@ -4,10 +4,13 @@ import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity
|
||||
|
||||
class ElectronicKeyDetailState {
|
||||
final itemData = ElectronicKeyListItem().obs;
|
||||
final keyName = "".obs;
|
||||
final TextEditingController changeNameController = TextEditingController();
|
||||
|
||||
ElectronicKeyDetailState() {
|
||||
Map map = Get.arguments;
|
||||
itemData.value = map["itemData"];
|
||||
changeNameController.text = itemData.value.keyName!;
|
||||
keyName.value = itemData.value.keyName!;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,12 +16,11 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
endDate: '0',
|
||||
keyId: state.keyInfo.value.keyId.toString(),
|
||||
keyStatus: '',
|
||||
keyRight: '0',
|
||||
lockId: state.keyInfo.value.lockId.toString(),
|
||||
operatorUid: '',
|
||||
pageNo: pageNo.toString(),
|
||||
pageSize: pageSize.toString(),
|
||||
startDate: '0',
|
||||
keyRight: '0',
|
||||
searchStr: state.searchController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (pageNo == 1) {
|
||||
|
||||
@ -94,6 +94,9 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
),
|
||||
Expanded(
|
||||
child: _buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
onClick: () {
|
||||
@ -111,7 +114,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
height: 44.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -307,8 +310,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
children: [
|
||||
Text(
|
||||
receiveUser,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.blackColor),
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
isAdminKey
|
||||
|
||||
@ -13,17 +13,40 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
final SendElectronicKeyState state = SendElectronicKeyState();
|
||||
|
||||
//发送钥匙请求
|
||||
Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
|
||||
Future<void> sendElectronicKeyRequest() async {
|
||||
if(state.emailOrPhoneController.text.isEmpty){
|
||||
showToast("请输入接收者账号");
|
||||
return;
|
||||
}
|
||||
if(state.keyNameController.text.isEmpty){
|
||||
showToast("请输入接收者姓名");
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime startDateTime = DateTime(state.effectiveDateTime.value.year, state.effectiveDateTime.value.month, state.effectiveDateTime.value.day, state.effectiveDateTime.value.hour, state.effectiveDateTime.value.minute);
|
||||
DateTime endDateTime = DateTime(state.failureDateTime.value.year, state.failureDateTime.value.month, state.failureDateTime.value.day, state.failureDateTime.value.hour, state.failureDateTime.value.minute);
|
||||
|
||||
//发送钥匙请求
|
||||
if (state.type.value == "0" || state.type.value == "3") {
|
||||
if (!startDateTime.isBefore(endDateTime) || startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
showToast("失效时间需大于生效时间");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!startDateTime.isBefore(DateTime.now()) || startDateTime.isAtSameMomentAs(DateTime.now())) {
|
||||
showToast("生效时间需大于当前时间");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
int typeValue = int.parse(state.type.value);
|
||||
switch (typeValue) {
|
||||
case 0:
|
||||
{
|
||||
typeValue = XSConstantMacro.keyTypeTime;
|
||||
state.failureTimestamp.value =
|
||||
state.failureDateTime.value.millisecondsSinceEpoch;
|
||||
state.effectiveTimestamp.value =
|
||||
state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||
state.failureTimestamp.value = state.failureDateTime.value.millisecondsSinceEpoch;
|
||||
state.effectiveTimestamp.value = state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@ -70,9 +93,9 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
if (isPhoneNumber(state.emailOrPhoneController.text) == true) {
|
||||
_showPhoneDialog(widgetContext, '${entity.errorMsg}');
|
||||
_showPhoneDialog(Get.context, '${entity.errorMsg}');
|
||||
} else {
|
||||
_showEmailDialog(widgetContext);
|
||||
_showEmailDialog(Get.context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,7 +181,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
state.isCreateUser.value = true;
|
||||
Navigator.of(context).pop();
|
||||
|
||||
sendElectronicKeyRequest(widgetContext);
|
||||
sendElectronicKeyRequest();
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@ -268,33 +268,34 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||
onClick: () {
|
||||
if (isDemoMode == false) {
|
||||
DateTime startDateTime = DateTime(
|
||||
state.effectiveDateTime.value.year,
|
||||
state.effectiveDateTime.value.month,
|
||||
state.effectiveDateTime.value.day,
|
||||
state.effectiveDateTime.value.hour,
|
||||
state.effectiveDateTime.value.minute);
|
||||
DateTime endDateTime = DateTime(
|
||||
state.failureDateTime.value.year,
|
||||
state.failureDateTime.value.month,
|
||||
state.failureDateTime.value.day,
|
||||
state.failureDateTime.value.hour,
|
||||
state.failureDateTime.value.minute);
|
||||
//发送钥匙请求
|
||||
if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.text.isNotEmpty) {
|
||||
if (int.parse(widget.type) == 0) {
|
||||
if (!startDateTime.isBefore(endDateTime) ||
|
||||
startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
logic.showToast("失效时间需大于生效时间");
|
||||
} else {
|
||||
logic.sendElectronicKeyRequest(context);
|
||||
}
|
||||
} else {
|
||||
logic.sendElectronicKeyRequest(context);
|
||||
}
|
||||
} else {
|
||||
logic.showToast("请完善信息");
|
||||
}
|
||||
// DateTime startDateTime = DateTime(
|
||||
// state.effectiveDateTime.value.year,
|
||||
// state.effectiveDateTime.value.month,
|
||||
// state.effectiveDateTime.value.day,
|
||||
// state.effectiveDateTime.value.hour,
|
||||
// state.effectiveDateTime.value.minute);
|
||||
// DateTime endDateTime = DateTime(
|
||||
// state.failureDateTime.value.year,
|
||||
// state.failureDateTime.value.month,
|
||||
// state.failureDateTime.value.day,
|
||||
// state.failureDateTime.value.hour,
|
||||
// state.failureDateTime.value.minute);
|
||||
// //发送钥匙请求
|
||||
// if (state.emailOrPhoneController.text.isNotEmpty && state.keyNameController.text.isNotEmpty) {
|
||||
// if (int.parse(widget.type) == 0) {
|
||||
// if (!startDateTime.isBefore(endDateTime) ||
|
||||
// startDateTime.isAtSameMomentAs(endDateTime)) {
|
||||
// logic.showToast("失效时间需大于生效时间");
|
||||
// } else {
|
||||
// logic.sendElectronicKeyRequest();
|
||||
// }
|
||||
// } else {
|
||||
// logic.sendElectronicKeyRequest();
|
||||
// }
|
||||
// } else {
|
||||
// logic.showToast("请完善信息");
|
||||
// }
|
||||
logic.sendElectronicKeyRequest();
|
||||
} else {
|
||||
//演示模式不获取接口
|
||||
logic.showToast("演示模式");
|
||||
@ -495,6 +496,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
.phoneNumbers![0]
|
||||
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
|
||||
}
|
||||
if (currentContact.fullName!.isNotEmpty) {
|
||||
state.keyNameController.text = currentContact.fullName!;
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
@ -157,6 +157,9 @@ class LockDetailLogic extends BaseGetXController {
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
// 厂商名称
|
||||
var vendor = reply.data.sublist(3, 23);
|
||||
// print("vendor:$vendor");
|
||||
@ -192,7 +195,7 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// 电池剩余电量
|
||||
var battRemCap = reply.data[132];
|
||||
// print("battRemCap:$battRemCap");
|
||||
|
||||
uploadElectricQuantityRequest(battRemCap.toString());
|
||||
// 重置次数
|
||||
var restoreCounter = reply.data.sublist(133, 135);
|
||||
// print("restoreCounter:$restoreCounter");
|
||||
@ -531,6 +534,32 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// }, isShowLoading: false);
|
||||
// }
|
||||
|
||||
// 获取锁状态 更新电量
|
||||
Future<void> getStarLockStatus() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
dismissEasyLoading();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == DeviceConnectionState.connected) {
|
||||
dismissEasyLoading();
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
IoSenderManage.senderGetStarLockStatuInfo(
|
||||
lockID: BlueManage().connectDeviceName,
|
||||
userID: await Storage.getUid(),
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (deviceConnectionState == DeviceConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 查询事件记录(时间查询)
|
||||
Future<void> senderReferEventRecordTime(int time) async {
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName,
|
||||
@ -685,22 +714,15 @@ class LockDetailLogic extends BaseGetXController {
|
||||
}
|
||||
}
|
||||
|
||||
// connectBlueAndAnimationController(){
|
||||
// state.lockState.value = 1;
|
||||
// state.animationController.forward();
|
||||
// BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState deviceConnectionState) async {
|
||||
// if (deviceConnectionState == DeviceConnectionState.connected){
|
||||
// state.lockState.value = 2;
|
||||
// }else if (deviceConnectionState == DeviceConnectionState.disconnected){
|
||||
// showBlueConnetctToast();
|
||||
//
|
||||
// state.lockState.value = 4;
|
||||
// state.animationController.reset();
|
||||
// state.animationController.forward();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
//电量更新请求
|
||||
Future<void> uploadElectricQuantityRequest(String electricQuantity) async {
|
||||
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(electricQuantity, state.keyInfos.value.lockId.toString());
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("电量更新成功", something: (){
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
}
|
||||
/// 锁设置里面开启关闭考勤刷新锁详情
|
||||
StreamSubscription?
|
||||
_lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent;
|
||||
|
||||
@ -9,6 +9,7 @@ import '../../../app_settings/app_colors.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../tools/appRouteObserver.dart';
|
||||
import '../../../tools/jh_pop_menus.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
@ -129,21 +130,32 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
)))
|
||||
),
|
||||
Positioned(
|
||||
child: Obx(() => Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text("${state.electricQuantity.value}%",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 30.w),
|
||||
],
|
||||
)))
|
||||
child: Obx(() => GestureDetector(
|
||||
onTap: (){
|
||||
logic.getStarLockStatus();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text("${state.electricQuantity.value}%",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
Icon(
|
||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||
size: 25.w, // 设置图标大小为 30
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
)))
|
||||
],
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
|
||||
@ -36,7 +36,7 @@ class LockDetailState {
|
||||
var iSOpenLock = true.obs; // 是开锁还是关锁
|
||||
Timer? closedUnlockSuccessfulTimer;
|
||||
|
||||
var bottomBtnisUneable = false.obs; // 是否不可用
|
||||
var bottomBtnisUneable = false.obs; // 是否不可用 用于限制底部按钮是否可用
|
||||
|
||||
//过渡动画控制器
|
||||
late AnimationController animationController;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
@ -105,7 +105,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
});
|
||||
}),
|
||||
SizedBox(
|
||||
height: 42.h,
|
||||
height: 44.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -214,7 +214,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
// width: 20.w,
|
||||
// )),
|
||||
SizedBox(width: 10.w),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已失效', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期', style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(),
|
||||
SizedBox(width: 15.w)
|
||||
],
|
||||
),
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import '../entity/lockListInfo_entity.dart';
|
||||
import 'lockList_state.dart';
|
||||
|
||||
class LockListLogic extends BaseGetXController{
|
||||
@ -20,6 +22,19 @@ class LockListLogic extends BaseGetXController{
|
||||
return 'images/main/icon_lockElectricLevel_5.png';
|
||||
}
|
||||
|
||||
String getKeyEffective(LockListInfoItemEntity keyInfo){
|
||||
// 当是限时、循环的时候
|
||||
if(keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop){
|
||||
// 当是正常使用跟待接收状态的时候
|
||||
if(keyInfo.keyStatus == XSConstantMacro.keyStatusNormalUse || keyInfo.keyStatus == XSConstantMacro.keyStatusWaitReceive) {
|
||||
return "余${compareTimeGetDaysFromNow(keyInfo.endDate!)}天";
|
||||
} else {
|
||||
return XSConstantMacro.getKeyStatusStr(keyInfo.keyStatus!);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// 获取是否超过现在的时间
|
||||
bool compareTimeIsOvertime(int endTiem){
|
||||
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(endTiem); // 将时间戳转换为 DateTime
|
||||
|
||||
@ -149,17 +149,17 @@ class _LockListPageState extends State<LockListPage> {
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
Text(
|
||||
"${keyInfo.electricQuantity!}%",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
Image.asset(
|
||||
logic.showElectricIcon(keyInfo.electricQuantity!),
|
||||
width: 30.w,
|
||||
height: 24.w,
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
Text(
|
||||
"${keyInfo.electricQuantity!}%",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(width: 30.w),
|
||||
],
|
||||
),
|
||||
@ -191,11 +191,9 @@ class _LockListPageState extends State<LockListPage> {
|
||||
),
|
||||
],
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
Visibility(
|
||||
visible: keyInfo.keyType == XSConstantMacro.keyTypeTime ? true : false,
|
||||
visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) ? true : false,
|
||||
// visible: true,
|
||||
child:Row(
|
||||
children: [
|
||||
@ -206,8 +204,8 @@ class _LockListPageState extends State<LockListPage> {
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: logic.compareTimeIsOvertime(keyInfo.endDate!) ? AppColors.listTimeYellowColor : AppColors.mainColor,
|
||||
),
|
||||
child: Text(
|
||||
logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||
child: Text(logic.getKeyEffective(keyInfo), style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -223,9 +221,7 @@ class _LockListPageState extends State<LockListPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LockListState{
|
||||
|
||||
var itemStatusIsEable = false.obs; // 列表里面item是否能点击
|
||||
|
||||
}
|
||||
@ -39,7 +39,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
Text(
|
||||
"${F.title} 1.0.0.09(preRelease-20240126-1)",
|
||||
"${F.title} 1.0.0.10(preRelease-20240201)",
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||
),
|
||||
SizedBox(height: 20.h),
|
||||
|
||||
@ -11,12 +11,10 @@ abstract class Api {
|
||||
final String sendElectronicKeyURL = '/key/send'; //发送电子钥匙
|
||||
final String resetElectronicKeyURL = '/key/reset'; //重置电子钥匙
|
||||
final String keyOperationRecordURL = '/lockRecords/list'; //操作记录
|
||||
final String uploadElectricQuantityURL =
|
||||
'/room/uploadElectricQuantity'; //锁电量更新
|
||||
final String uploadElectricQuantityURL = '/room/uploadElectricQuantity'; //锁电量更新
|
||||
|
||||
final String lockRecordUploadURL = '/lockRecords/fromLock'; //操作上传
|
||||
final String getLockRecordLastUploadDataTimeURL =
|
||||
'/lockRecords/getLastRecordTime'; //查询锁记录最后时间
|
||||
final String getLockRecordLastUploadDataTimeURL = '/lockRecords/getLastRecordTime'; //查询锁记录最后时间
|
||||
|
||||
final String getLockNetTokenURL = '/lock/getLockNetToken'; //获取手机联网token
|
||||
final String updateLockUserNoURL = '/key/updateLockUserNo'; //更新锁用户NO
|
||||
|
||||
@ -5,7 +5,7 @@ import 'api_provider_base.dart';
|
||||
|
||||
class ApiProvider extends BaseProvider {
|
||||
Future<Response> getVerificationCode(String countryCode, String account,
|
||||
String channel, String codeType, String uniqueid, String xWidth) =>
|
||||
String channel, String codeType, String xWidth) =>
|
||||
post(
|
||||
getVerificationCodeUrl.toUrl,
|
||||
jsonEncode({
|
||||
@ -13,21 +13,24 @@ class ApiProvider extends BaseProvider {
|
||||
'account': account,
|
||||
"channel": channel,
|
||||
'codeType': codeType,
|
||||
"uniqueid": uniqueid,
|
||||
'xWidth': xWidth,
|
||||
}));
|
||||
|
||||
Future<Response> register(String countryCode, String countryId, String mobile,
|
||||
String password, String uniqueid, String verificationCode) =>
|
||||
post(registerUrl.toUrl, null, query: {
|
||||
Future<Response> register(
|
||||
int receiverType,
|
||||
int countryCode,
|
||||
String account,
|
||||
String password,
|
||||
String verificationCode,
|
||||
) =>
|
||||
post(registerUrl.toUrl, jsonEncode({
|
||||
'receiverType': receiverType,
|
||||
'countryCode': countryCode,
|
||||
'countryId': countryId,
|
||||
"mobile": mobile,
|
||||
"account": account,
|
||||
'password': password,
|
||||
'platId': "2",
|
||||
"uniqueid": uniqueid,
|
||||
'verificationCode': verificationCode,
|
||||
});
|
||||
'platId': "2",
|
||||
}));
|
||||
|
||||
// post(
|
||||
// registerUrl.toUrl,
|
||||
@ -97,13 +100,13 @@ class ApiProvider extends BaseProvider {
|
||||
String endDate,
|
||||
String keyId,
|
||||
String keyStatus,
|
||||
String keyRight,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String keyRight,
|
||||
String searchStr) =>
|
||||
String searchStr,
|
||||
) =>
|
||||
post(
|
||||
electronicKeyListURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -111,7 +114,6 @@ class ApiProvider extends BaseProvider {
|
||||
'keyId': keyId,
|
||||
"keyStatus": keyStatus,
|
||||
'lockId': lockId,
|
||||
"operatorUid": operatorUid,
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
'startDate': startDate,
|
||||
|
||||
@ -57,27 +57,29 @@ class ApiRepository {
|
||||
|
||||
// 发送验证码 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号
|
||||
Future<SendValidationCodeEntity> sendValidationCode(
|
||||
String countryCode,
|
||||
String account,
|
||||
String channel,
|
||||
String codeType,
|
||||
String uniqueid,
|
||||
String xWidth) async {
|
||||
{
|
||||
required String countryCode,
|
||||
required String account,
|
||||
required String channel,
|
||||
required String codeType,
|
||||
required String xWidth
|
||||
}) async {
|
||||
final res = await apiProvider.getVerificationCode(
|
||||
countryCode, account, channel, codeType, uniqueid, xWidth);
|
||||
countryCode, account, channel, codeType, xWidth);
|
||||
return SendValidationCodeEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 注册
|
||||
Future<LoginEntity> register(
|
||||
String countryCode,
|
||||
String countryId,
|
||||
String mobile,
|
||||
String password,
|
||||
String uniqueid,
|
||||
String verificationCode) async {
|
||||
{
|
||||
required int receiverType,
|
||||
required int countryCode,
|
||||
required String account,
|
||||
required String password,
|
||||
required String verificationCode
|
||||
}) async {
|
||||
final res = await apiProvider.register(
|
||||
countryCode, countryId, mobile, password, uniqueid, verificationCode);
|
||||
receiverType, countryCode, account, password, verificationCode);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -129,16 +131,15 @@ class ApiRepository {
|
||||
required String endDate,
|
||||
required String keyId,
|
||||
required String keyStatus,
|
||||
required String keyRight,
|
||||
required String lockId,
|
||||
required String operatorUid,
|
||||
required String pageNo,
|
||||
required String pageSize,
|
||||
required String startDate,
|
||||
required String keyRight,
|
||||
required String searchStr
|
||||
required String searchStr,
|
||||
}) async {
|
||||
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
|
||||
lockId, operatorUid, pageNo, pageSize, startDate, keyRight, searchStr);
|
||||
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus, keyRight,
|
||||
lockId, pageNo, pageSize, startDate, searchStr);
|
||||
return ElectronicKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
@ -11,21 +11,23 @@ import '../translations/trans_lib.dart';
|
||||
class KeySearchWidget extends StatelessWidget {
|
||||
TextEditingController editingController;
|
||||
Function() onSubmittedAction;
|
||||
Color? backgroundColor;
|
||||
|
||||
KeySearchWidget(
|
||||
{Key? key,
|
||||
required this.editingController,
|
||||
required this.onSubmittedAction})
|
||||
required this.onSubmittedAction,
|
||||
this.backgroundColor})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 60.h,
|
||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
|
||||
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 20.w),
|
||||
padding: EdgeInsets.only(top: 5.h,right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
color: backgroundColor ?? Colors.white, borderRadius: BorderRadius.circular(5)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+9
|
||||
version: 1.0.0+10
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user