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