1,编辑电子钥匙名字接口调试
2,密码钥匙列表接口调试 3,密码钥匙重置接口调试 4,国家地区接口调试及注册选择国家逻辑处理
This commit is contained in:
parent
9a39442f21
commit
0de13dd926
File diff suppressed because it is too large
Load Diff
@ -77,7 +77,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
border:
|
||||||
|
Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
@ -87,16 +88,22 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: Obx(() => Container(
|
child: Obx(() => Container(
|
||||||
width: 170.w,
|
width: 170.w,
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
decoration: state.isIphoneType.value ? BoxDecoration(
|
decoration: state.isIphoneType.value
|
||||||
color: AppColors.mainColor,
|
? BoxDecoration(
|
||||||
borderRadius:
|
color: AppColors.mainColor,
|
||||||
BorderRadius.all(Radius.circular(30.h)),
|
borderRadius:
|
||||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)):null,
|
BorderRadius.all(Radius.circular(30.h)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0, color: AppColors.greyLineColor))
|
||||||
|
: null,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
TranslationLoader.lanKeys!.iphone!.tr,
|
TranslationLoader.lanKeys!.iphone!.tr,
|
||||||
style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
|
style: TextStyle(
|
||||||
)))),
|
color: state.isIphoneType.value
|
||||||
|
? Colors.white
|
||||||
|
: Colors.black),
|
||||||
|
)))),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -106,13 +113,23 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: Obx(() => Container(
|
child: Obx(() => Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
decoration: state.isIphoneType.value ? null : BoxDecoration(
|
decoration: state.isIphoneType.value
|
||||||
color: AppColors.mainColor,
|
? null
|
||||||
borderRadius:
|
: BoxDecoration(
|
||||||
BorderRadius.all(Radius.circular(30.h)),
|
color: AppColors.mainColor,
|
||||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(30.h)),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1.0,
|
||||||
|
color: AppColors.greyLineColor)),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(TranslationLoader.lanKeys!.email!.tr, style: TextStyle(color: state.isIphoneType.value ? Colors.black : Colors.white),)))),
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.email!.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: state.isIphoneType.value
|
||||||
|
? Colors.black
|
||||||
|
: Colors.white),
|
||||||
|
)))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -124,30 +141,43 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// Navigator.pushNamed(context, Routers.seletCountryRegionPage);
|
// Navigator.pushNamed(context, Routers.seletCountryRegionPage);
|
||||||
var result = await Navigator.pushNamed(context, Routers.seletCountryRegionPage);
|
var result = await Navigator.pushNamed(
|
||||||
// logic.state.countryCode.value = (result as Map<String, dynamic>)['code'];
|
context, Routers.seletCountryRegionPage);
|
||||||
// logic.state.countryId.value = result["countryId"];
|
result as Map<String, dynamic>;
|
||||||
logic.state.countryCode.value = "+86";
|
logic.state.countryCode.value = result['code'];
|
||||||
logic.state.countryId.value = "9";
|
logic.state.countryId.value = result["countryId"];
|
||||||
|
logic.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: Container(
|
child: SizedBox(
|
||||||
height: 70.h,
|
height: 70.h,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))),
|
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.sp, color: AppColors.blackColor))),
|
||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Obx(() => Text(state.isIphoneType.value ? "中国+86" : "中国", textAlign: TextAlign.end, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor),))
|
Obx(() => Text(
|
||||||
|
state.isIphoneType.value
|
||||||
|
? '${logic.state.countryName} +${logic.state.countryCode}'
|
||||||
|
: "${logic.state.countryName}",
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.sp, color: AppColors.blackColor),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(width: 5.w),
|
SizedBox(width: 5.w),
|
||||||
Image.asset('images/icon_right.png', width: 50.w, height: 50.w,
|
Image.asset(
|
||||||
|
'images/icon_right.png',
|
||||||
|
width: 50.w,
|
||||||
|
height: 50.w,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -171,10 +201,14 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
logic.checkNext(state.phoneOrEmailController);
|
logic.checkNext(state.phoneOrEmailController);
|
||||||
},
|
},
|
||||||
leftWidget:
|
leftWidget:
|
||||||
// Image.asset('images/icon_login_account.png', width: 30.w, height: 30.w,),
|
// Image.asset('images/icon_login_account.png', width: 30.w, height: 30.w,),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||||
child: Image.asset('images/icon_login_account.png', width: 30.w, height: 30.w,),
|
child: Image.asset(
|
||||||
|
'images/icon_login_account.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
@ -191,7 +225,11 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Padding(
|
leftWidget: Padding(
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||||
child: Image.asset('images/icon_login_password.png', width: 30.w, height: 30.w,),
|
child: Image.asset(
|
||||||
|
'images/icon_login_password.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
@ -213,7 +251,11 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Padding(
|
leftWidget: Padding(
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||||
child: Image.asset('images/icon_login_password.png', width: 30.w, height: 30.w,),
|
child: Image.asset(
|
||||||
|
'images/icon_login_password.png',
|
||||||
|
width: 30.w,
|
||||||
|
height: 30.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
@ -236,7 +278,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
height: 30.w,
|
height: 30.w,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
hintText:
|
||||||
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
@ -245,27 +288,39 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: state.phoneOrEmailStrIsOK.value ? () async {
|
onTap: state.phoneOrEmailStrIsOK.value
|
||||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
? () async {
|
||||||
var result = await Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||||
logic.state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
|
var result = await Navigator.pushNamed(
|
||||||
logic.sendValidationCode();
|
context, Routers.safetyVerificationPage,
|
||||||
}:null,
|
arguments: {
|
||||||
child: Container(
|
"countryCode": state.countryCode,
|
||||||
width: 180.w,
|
"account": state.phoneOrEmailStr.value
|
||||||
height: 60.h,
|
});
|
||||||
padding: EdgeInsets.all(5.h),
|
logic.state.xWidth.value =
|
||||||
decoration: BoxDecoration(
|
(result as Map<String, dynamic>)['xWidth'];
|
||||||
color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor : Colors.grey,
|
logic.sendValidationCode();
|
||||||
borderRadius: BorderRadius.circular(5)),
|
}
|
||||||
child: Center(
|
: null,
|
||||||
child: Text(
|
child: Container(
|
||||||
state.btnText.value,
|
width: 180.w,
|
||||||
textAlign: TextAlign.center,
|
height: 60.h,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 26.sp,)),
|
padding: EdgeInsets.all(5.h),
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
),
|
color: state.phoneOrEmailStrIsOK.value
|
||||||
))
|
? AppColors.mainColor
|
||||||
|
: Colors.grey,
|
||||||
|
borderRadius: BorderRadius.circular(5)),
|
||||||
|
child: Center(
|
||||||
|
child: Text(state.btnText.value,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 26.sp,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
|
|||||||
@ -11,7 +11,8 @@ class StarLockRegisterState {
|
|||||||
final TextEditingController codeController = TextEditingController();
|
final TextEditingController codeController = TextEditingController();
|
||||||
|
|
||||||
var countryCode = '+86'.obs;
|
var countryCode = '+86'.obs;
|
||||||
var countryId = '9'.obs;
|
var countryId = '1'.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,54 +0,0 @@
|
|||||||
import 'package:azlistview/azlistview.dart';
|
|
||||||
|
|
||||||
import 'index.dart';
|
|
||||||
|
|
||||||
class CountriesModel extends ISuspensionBean {
|
|
||||||
String? short;
|
|
||||||
late String name;
|
|
||||||
String? en;
|
|
||||||
late String tel;
|
|
||||||
String? pinyin;
|
|
||||||
String? tagIndex;
|
|
||||||
|
|
||||||
CountriesModel(
|
|
||||||
{this.short,
|
|
||||||
required this.name,
|
|
||||||
this.en,
|
|
||||||
required this.tel,
|
|
||||||
this.pinyin,
|
|
||||||
this.tagIndex});
|
|
||||||
|
|
||||||
CountriesModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
if (json["short"] is String) {
|
|
||||||
short = json["short"];
|
|
||||||
}
|
|
||||||
if (json["name"] is String) {
|
|
||||||
name = json["name"];
|
|
||||||
}
|
|
||||||
if (json["en"] is String) {
|
|
||||||
en = json["en"];
|
|
||||||
}
|
|
||||||
if (json["tel"] is String) {
|
|
||||||
tel = json["tel"];
|
|
||||||
}
|
|
||||||
if (json["pinyin"] is String) {
|
|
||||||
pinyin = json["pinyin"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
|
||||||
data["short"] = short;
|
|
||||||
data["name"] = name;
|
|
||||||
data["en"] = en;
|
|
||||||
data["tel"] = tel;
|
|
||||||
data["pinyin"] = pinyin;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String getSuspensionTag() => tagIndex!;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(this);
|
|
||||||
}
|
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:azlistview/azlistview.dart';
|
||||||
|
|
||||||
|
class CountryRegionEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<CountryRegionModel>? dataList;
|
||||||
|
|
||||||
|
CountryRegionEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.dataList});
|
||||||
|
|
||||||
|
CountryRegionEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
if (json['data'] != null) {
|
||||||
|
dataList = <CountryRegionModel>[];
|
||||||
|
json['data'].forEach((v) {
|
||||||
|
dataList!.add(CountryRegionModel.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (dataList != null) {
|
||||||
|
data['data'] = dataList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CountryRegionModel extends ISuspensionBean {
|
||||||
|
int? countryId;
|
||||||
|
String? name;
|
||||||
|
String? code;
|
||||||
|
String? flag;
|
||||||
|
String? abbreviation;
|
||||||
|
String? group;
|
||||||
|
String? tagIndex;
|
||||||
|
|
||||||
|
CountryRegionModel(
|
||||||
|
{this.countryId,
|
||||||
|
this.name,
|
||||||
|
this.code,
|
||||||
|
this.flag,
|
||||||
|
this.abbreviation,
|
||||||
|
this.group,
|
||||||
|
this.tagIndex});
|
||||||
|
|
||||||
|
CountryRegionModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
countryId = json['countryId'];
|
||||||
|
name = json['name'];
|
||||||
|
code = json['code'];
|
||||||
|
flag = json['flag'];
|
||||||
|
abbreviation = json['abbreviation'];
|
||||||
|
group = json['group'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['countryId'] = countryId;
|
||||||
|
data['name'] = name;
|
||||||
|
data['code'] = code;
|
||||||
|
data['flag'] = flag;
|
||||||
|
data['abbreviation'] = abbreviation;
|
||||||
|
data['group'] = group;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String getSuspensionTag() => tagIndex!;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => json.encode(this);
|
||||||
|
}
|
||||||
@ -1,108 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:azlistview/azlistview.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class CityModel extends ISuspensionBean {
|
|
||||||
String name;
|
|
||||||
String? tagIndex;
|
|
||||||
String? namePinyin;
|
|
||||||
|
|
||||||
CityModel({
|
|
||||||
required this.name,
|
|
||||||
this.tagIndex,
|
|
||||||
this.namePinyin,
|
|
||||||
});
|
|
||||||
|
|
||||||
CityModel.fromJson(Map<String, dynamic> json) : name = json['name'];
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
'name': name,
|
|
||||||
// 'tagIndex': tagIndex,
|
|
||||||
// 'namePinyin': namePinyin,
|
|
||||||
// 'isShowSuspension': isShowSuspension
|
|
||||||
};
|
|
||||||
|
|
||||||
@override
|
|
||||||
String getSuspensionTag() => tagIndex!;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ContactInfo extends ISuspensionBean {
|
|
||||||
String name;
|
|
||||||
String? tagIndex;
|
|
||||||
String? namePinyin;
|
|
||||||
|
|
||||||
Color? bgColor;
|
|
||||||
IconData? iconData;
|
|
||||||
|
|
||||||
String? img;
|
|
||||||
String? id;
|
|
||||||
String? firstletter;
|
|
||||||
|
|
||||||
ContactInfo({
|
|
||||||
required this.name,
|
|
||||||
this.tagIndex,
|
|
||||||
this.namePinyin,
|
|
||||||
this.bgColor,
|
|
||||||
this.iconData,
|
|
||||||
this.img,
|
|
||||||
this.id,
|
|
||||||
this.firstletter,
|
|
||||||
});
|
|
||||||
|
|
||||||
ContactInfo.fromJson(Map<String, dynamic> json)
|
|
||||||
: name = json['name'],
|
|
||||||
img = json['img'],
|
|
||||||
id = json['id']?.toString(),
|
|
||||||
firstletter = json['firstletter'];
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
// 'id': id,
|
|
||||||
'name': name,
|
|
||||||
'img': img,
|
|
||||||
// 'firstletter': firstletter,
|
|
||||||
// 'tagIndex': tagIndex,
|
|
||||||
// 'namePinyin': namePinyin,
|
|
||||||
// 'isShowSuspension': isShowSuspension
|
|
||||||
};
|
|
||||||
|
|
||||||
@override
|
|
||||||
String getSuspensionTag() => tagIndex!;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => json.encode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// class Languages extends GithubLanguage with ISuspensionBean {
|
|
||||||
// String? tagIndex;
|
|
||||||
// String? pinyin;
|
|
||||||
// String? shortPinyin;
|
|
||||||
|
|
||||||
// Languages.fromJson(Map<String, dynamic> json) : super.fromJson(json);
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Map<String, dynamic> toJson() {
|
|
||||||
// final Map<String, dynamic> map = super.toJson();
|
|
||||||
// void addIfNonNull(String fieldName, dynamic value) {
|
|
||||||
// if (value != null) {
|
|
||||||
// map[fieldName] = value;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // addIfNonNull('tagIndex', tagIndex);
|
|
||||||
// return map;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// String getSuspensionTag() {
|
|
||||||
// return tagIndex!;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// String toString() {
|
|
||||||
// return json.encode(this);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@ -1,13 +1,10 @@
|
|||||||
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:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/login/seletCountryRegion/common/countries_model.dart';
|
import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.dart';
|
||||||
import 'package:star_lock/login/seletCountryRegion/common/models.dart';
|
|
||||||
|
|
||||||
import 'index.dart';
|
|
||||||
|
|
||||||
class Utils {
|
class Utils {
|
||||||
static String getImgPath(String name, {String format: 'png'}) {
|
static String getImgPath(String name, {String format = 'png'}) {
|
||||||
return 'assets/images/$name.$format';
|
return 'assets/images/$name.$format';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +12,7 @@ class Utils {
|
|||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(msg),
|
content: Text(msg),
|
||||||
duration: Duration(seconds: 2),
|
duration: const Duration(seconds: 2),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -42,7 +39,8 @@ class Utils {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget getListItem(BuildContext context, CountriesModel model,
|
static Widget getListItem(
|
||||||
|
BuildContext context, CountryRegionModel model, Function() onClick,
|
||||||
{double susHeight = 40}) {
|
{double susHeight = 40}) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
@ -54,7 +52,7 @@ class Utils {
|
|||||||
width: 20.w,
|
width: 20.w,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
model.name,
|
model.name!,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
|
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
@ -63,7 +61,7 @@ class Utils {
|
|||||||
width: 30.w,
|
width: 30.w,
|
||||||
)),
|
)),
|
||||||
Text(
|
Text(
|
||||||
'+${model.tel}',
|
'+${model.code}',
|
||||||
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
|
style: TextStyle(color: AppColors.blackColor, fontSize: 22.sp),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -71,99 +69,11 @@ class Utils {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Divider(
|
|
||||||
// height: 1,
|
|
||||||
// color: AppColors.greyLineColor,
|
|
||||||
// endIndent: 0,
|
|
||||||
// indent: 20.w,
|
|
||||||
// )
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
LogUtil.e("onItemClick : $model");
|
onClick();
|
||||||
Utils.showSnackBar(context, 'onItemClick : ${model.name}');
|
// LogUtil.e("onItemClick : $model");
|
||||||
},
|
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
|
||||||
);
|
|
||||||
|
|
||||||
// return ListTile(
|
|
||||||
// title: Text('${model.name} +${model.tel}'),
|
|
||||||
// onTap: () {
|
|
||||||
// LogUtil.e("onItemClick : $model");
|
|
||||||
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// return Column(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: <Widget>[
|
|
||||||
// Offstage(
|
|
||||||
// offstage: !(model.isShowSuspension == true),
|
|
||||||
// child: getSusItem(context, model.getSuspensionTag(),
|
|
||||||
// susHeight: susHeight),
|
|
||||||
// ),
|
|
||||||
// ListTile(
|
|
||||||
// title: Text(model.name),
|
|
||||||
// onTap: () {
|
|
||||||
// LogUtil.e("onItemClick : $model");
|
|
||||||
// Utils.showSnackBar(context, 'onItemClick : ${model.name}');
|
|
||||||
// },
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
static Widget getWeChatListItem(
|
|
||||||
BuildContext context,
|
|
||||||
ContactInfo model, {
|
|
||||||
double susHeight = 40,
|
|
||||||
Color? defHeaderBgColor,
|
|
||||||
}) {
|
|
||||||
return getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor);
|
|
||||||
// return Column(
|
|
||||||
// mainAxisSize: MainAxisSize.min,
|
|
||||||
// children: <Widget>[
|
|
||||||
// Offstage(
|
|
||||||
// offstage: !(model.isShowSuspension == true),
|
|
||||||
// child: getSusItem(context, model.getSuspensionTag(),
|
|
||||||
// susHeight: susHeight),
|
|
||||||
// ),
|
|
||||||
// getWeChatItem(context, model, defHeaderBgColor: defHeaderBgColor),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
static Widget getWeChatItem(
|
|
||||||
BuildContext context,
|
|
||||||
ContactInfo model, {
|
|
||||||
Color? defHeaderBgColor,
|
|
||||||
}) {
|
|
||||||
DecorationImage? image;
|
|
||||||
// if (model.img != null && model.img.isNotEmpty) {
|
|
||||||
// image = DecorationImage(
|
|
||||||
// image: CachedNetworkImageProvider(model.img),
|
|
||||||
// fit: BoxFit.contain,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
return ListTile(
|
|
||||||
leading: Container(
|
|
||||||
width: 36,
|
|
||||||
height: 36,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
borderRadius: BorderRadius.circular(4.0),
|
|
||||||
color: model.bgColor ?? defHeaderBgColor,
|
|
||||||
image: image,
|
|
||||||
),
|
|
||||||
child: model.iconData == null
|
|
||||||
? null
|
|
||||||
: Icon(
|
|
||||||
model.iconData,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(model.name),
|
|
||||||
onTap: () {
|
|
||||||
LogUtil.e("onItemClick : $model");
|
|
||||||
Utils.showSnackBar(context, 'onItemClick : ${model.name}');
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,13 @@ 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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/seletCountryRegion/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 '../../app_settings/app_colors.dart';
|
||||||
import '../../tools/titleAppBar.dart';
|
import '../../tools/titleAppBar.dart';
|
||||||
import '../../translations/trans_lib.dart';
|
import '../../translations/trans_lib.dart';
|
||||||
import 'common/countries_model.dart';
|
|
||||||
import 'common/index.dart';
|
import 'common/index.dart';
|
||||||
|
|
||||||
class SeletCountryRegionPage extends StatefulWidget {
|
class SeletCountryRegionPage extends StatefulWidget {
|
||||||
@ -17,7 +19,7 @@ class SeletCountryRegionPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
|
class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
|
||||||
List<CountriesModel> countriesList = [];
|
List<CountryRegionModel> countriesList = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -26,33 +28,31 @@ class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
|
|||||||
SuspensionUtil.setShowSuspensionStatus(
|
SuspensionUtil.setShowSuspensionStatus(
|
||||||
countriesList.cast<ISuspensionBean>());
|
countriesList.cast<ISuspensionBean>());
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
loadData();
|
getCountriesListRequest();
|
||||||
|
// loadData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//请求国家/地区json文件
|
||||||
|
Future<void> getCountriesListRequest() async {
|
||||||
|
CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1');
|
||||||
|
countriesList.clear();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("国家/地区json文件成功啦啦啦啦啦");
|
||||||
|
countriesList.addAll(entity.dataList!);
|
||||||
|
_handleList(countriesList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> loadJsonFromAssets(String assetsPath) async {
|
Future<String> loadJsonFromAssets(String assetsPath) async {
|
||||||
return await rootBundle.loadString(assetsPath);
|
return await rootBundle.loadString(assetsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadData() async {
|
void _handleList(List<CountryRegionModel> list) {
|
||||||
//加载国家列表
|
|
||||||
String jsonData = await loadJsonFromAssets('assets/countries.json');
|
|
||||||
countriesList.clear();
|
|
||||||
List list = json.decode(jsonData);
|
|
||||||
for (var v in list) {
|
|
||||||
countriesList.add(CountriesModel.fromJson(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
_handleList(countriesList);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _handleList(List<CountriesModel> list) {
|
|
||||||
if (list.isEmpty) return;
|
if (list.isEmpty) return;
|
||||||
for (int i = 0, length = list.length; i < length; i++) {
|
for (int i = 0, length = list.length; i < length; i++) {
|
||||||
CountriesModel countryModel = list[i];
|
CountryRegionModel countryModel = list[i];
|
||||||
// String pinyin = PinyinHelper.getPinyinE(list[i].name);
|
String tag = countryModel.group!;
|
||||||
String tag = countryModel.pinyin!.substring(0, 1).toUpperCase();
|
|
||||||
// list[i].pinyin = pinyin;
|
|
||||||
if (RegExp('[A-Z]').hasMatch(tag)) {
|
if (RegExp('[A-Z]').hasMatch(tag)) {
|
||||||
list[i].tagIndex = tag;
|
list[i].tagIndex = tag;
|
||||||
} else {
|
} else {
|
||||||
@ -82,16 +82,22 @@ class _SeletCountryRegionPageState extends State<SeletCountryRegionPage> {
|
|||||||
data: countriesList,
|
data: countriesList,
|
||||||
itemCount: countriesList.length,
|
itemCount: countriesList.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
CountriesModel model = countriesList[index];
|
CountryRegionModel model = countriesList[index];
|
||||||
return Utils.getListItem(context, model);
|
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,
|
padding: EdgeInsets.zero,
|
||||||
susItemBuilder: (BuildContext context, int index) {
|
susItemBuilder: (BuildContext context, int index) {
|
||||||
CountriesModel model = countriesList[index];
|
CountryRegionModel model = countriesList[index];
|
||||||
String tag = model.getSuspensionTag();
|
String tag = model.getSuspensionTag();
|
||||||
return Utils.getSusItem(context, tag);
|
return Utils.getSusItem(context, tag);
|
||||||
},
|
},
|
||||||
indexBarData: ['★', ...kIndexBarData],
|
indexBarData: const ['★', ...kIndexBarData],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
|
import 'package:flutter_pickers/pickers.dart';
|
||||||
|
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -22,15 +26,31 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
final FlutterContactPicker _contactPicker = FlutterContactPicker();
|
||||||
late Contact _contact;
|
late Contact _contact;
|
||||||
|
|
||||||
@override
|
// bool _isRemoteUnlock = false; //是否允许远程开锁
|
||||||
Widget build(BuildContext context) {
|
bool _isAuthentication = false; //是否可以实名认证
|
||||||
return indexChangeWidget();
|
var _selectEffectiveDate = ''; //生效时间
|
||||||
}
|
var _selectFailureDate = ''; //失效时间
|
||||||
|
final TextEditingController _emailOrPhoneController =
|
||||||
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
|
final TextEditingController _keyNameController =
|
||||||
|
TextEditingController(); //钥匙名输入框
|
||||||
|
late bool _isSendSuccess;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
DateTime dateTime = DateTime.now();
|
||||||
|
_selectEffectiveDate =
|
||||||
|
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||||
|
_selectFailureDate =
|
||||||
|
'${dateTime.year}-${dateTime.month}-${dateTime.day} ${dateTime.hour}:${dateTime.minute}'; //默认为当前时间
|
||||||
|
_isSendSuccess = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return indexChangeWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
@ -70,14 +90,14 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget: getTFWidget(
|
rightWidget: getTFWidget(true,
|
||||||
true, TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr)),
|
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, 1)),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "",
|
rightTitle: "",
|
||||||
isHaveRightWidget: true,
|
isHaveRightWidget: true,
|
||||||
rightWidget:
|
rightWidget: getTFWidget(
|
||||||
getTFWidget(false, TranslationLoader.lanKeys!.pleaseEnter!.tr)),
|
false, TranslationLoader.lanKeys!.pleaseEnter!.tr, 2)),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -89,18 +109,30 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: "2020.06.20 11:49",
|
rightTitle: _selectEffectiveDate,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
// _showDatePicker();
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectEffectiveDate =
|
||||||
|
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
||||||
|
});
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: "2020.06.20 11:49",
|
rightTitle: _selectFailureDate,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
// _showDatePicker();
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
|
onConfirm: (p) {
|
||||||
|
setState(() {
|
||||||
|
_selectFailureDate =
|
||||||
|
'${p.year}-${p.month}-${p.day} ${p.hour}:${p.minute}';
|
||||||
|
});
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
@ -143,7 +175,15 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
SubmitBtn(btnName: TranslationLoader.lanKeys!.send!.tr, onClick: () {}),
|
SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.send!.tr,
|
||||||
|
onClick: () {
|
||||||
|
//发送钥匙请求
|
||||||
|
if (_emailOrPhoneController.text.isNotEmpty &&
|
||||||
|
_keyNameController.text.isNotEmpty) {
|
||||||
|
sendElectronicKeyRequest();
|
||||||
|
}
|
||||||
|
}),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(right: 30.w),
|
padding: EdgeInsets.only(right: 30.w),
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
@ -241,8 +281,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 接受者信息输入框
|
// 接受者信息输入框
|
||||||
Widget getTFWidget(bool isHaveBtn, String tfStr) {
|
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) {
|
||||||
return Container(
|
return SizedBox(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
width: 300.w,
|
width: 300.w,
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -251,7 +291,8 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
// controller: _controller,
|
controller:
|
||||||
|
lineIndex == 1 ? _emailOrPhoneController : _keyNameController,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@ -295,27 +336,52 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CupertinoSwitch _switch() {
|
//发送钥匙请求
|
||||||
/*
|
Future<void> sendElectronicKeyRequest() async {
|
||||||
return Switch(
|
String getFailureDateTime = '0';
|
||||||
value: false,
|
String getEffectiveDateTime = '0';
|
||||||
onChanged: (value){
|
String deviceID = '28';
|
||||||
// switchValue = !switchValue;
|
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||||
setState(() {
|
if (widget.type == '0') {
|
||||||
|
getFailureDateTime =
|
||||||
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
|
.millisecondsSinceEpoch
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
|
'0',
|
||||||
|
'0',
|
||||||
|
'1',
|
||||||
|
getFailureDateTime,
|
||||||
|
_isAuthentication == true ? '1' : '2',
|
||||||
|
'2',
|
||||||
|
'2',
|
||||||
|
_keyNameController.text,
|
||||||
|
'1',
|
||||||
|
getKeyType,
|
||||||
|
deviceID,
|
||||||
|
'小吴副号',
|
||||||
|
_emailOrPhoneController.text,
|
||||||
|
'0',
|
||||||
|
getEffectiveDateTime, []);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print('发送电子钥匙成功');
|
||||||
|
_isSendSuccess = true;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
//实名认证
|
||||||
}
|
CupertinoSwitch _switch() {
|
||||||
);
|
|
||||||
*/
|
|
||||||
bool _isOn = false;
|
|
||||||
return CupertinoSwitch(
|
return CupertinoSwitch(
|
||||||
activeColor: CupertinoColors.activeBlue,
|
activeColor: CupertinoColors.activeBlue,
|
||||||
trackColor: CupertinoColors.systemGrey5,
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
thumbColor: CupertinoColors.white,
|
thumbColor: CupertinoColors.white,
|
||||||
value: _isOn,
|
value: _isAuthentication,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isOn = value;
|
_isAuthentication = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -28,40 +28,52 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor,
|
backgroundColor: AppColors.mainColor,
|
||||||
// actionsList: [
|
|
||||||
// TextButton(
|
|
||||||
// child: Text(
|
|
||||||
// TranslationLoader.lanKeys!.reset!.tr,
|
|
||||||
// style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
|
||||||
// ),
|
|
||||||
// onPressed: () {},
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(child: _buildMainUI()),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
AddBottomWhiteBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
|
||||||
onClick: () {
|
|
||||||
Navigator.pushNamed(context, Routers.authorizedAdminManagePage);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 64.h,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
body: FutureBuilder<List<ElectronicKeyListItem>>(
|
||||||
|
future: mockNetworkDataRequest(),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<List<ElectronicKeyListItem>> snapshot) {
|
||||||
|
//请求结束
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
//请求失败
|
||||||
|
return const Text('请求失败');
|
||||||
|
} else {
|
||||||
|
//请求成功
|
||||||
|
final List<ElectronicKeyListItem> itemData = snapshot.data!;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Expanded(child: _buildMainUI(itemData)),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
AddBottomWhiteBtn(
|
||||||
|
btnName:
|
||||||
|
TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||||
|
onClick: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.authorizedAdminManagePage);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 64.h,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//请求未结束 显示loading
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//请求电子钥匙列表
|
//请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员
|
||||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0');
|
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '1');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
}
|
}
|
||||||
@ -73,20 +85,89 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI(itemData) {
|
||||||
|
List<ElectronicKeyListItem> getItemData = itemData;
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: 5,
|
itemCount: getItemData.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
return _electronicKeyItem('images/controls_user.png', "张三",
|
ElectronicKeyListItem indexEntity = getItemData[index];
|
||||||
"2023.6.21 11.15", "2023.6.21 11.15", () {
|
String useDateStr = ''; //使用期限
|
||||||
|
String keyStatus = ''; //钥匙状态
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
useDateStr = getUseDateStr(indexEntity);
|
||||||
|
|
||||||
|
//钥匙状态
|
||||||
|
keyStatus = getKeyStatus(indexEntity.keyStatus);
|
||||||
|
|
||||||
|
//是否为管理钥匙
|
||||||
|
bool isAdminKey = false;
|
||||||
|
if (indexEntity.keyRight == 1) {
|
||||||
|
isAdminKey = true;
|
||||||
|
} else {
|
||||||
|
isAdminKey = false;
|
||||||
|
}
|
||||||
|
return _electronicKeyItem('images/controls_user.png',
|
||||||
|
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||||
// Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
|
// Navigator.pushNamed(context, Routers.authorizedAdminDetailPage);
|
||||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
|
Navigator.pushNamed(context, Routers.electronicKeyDetailPage);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
//使用期限
|
||||||
String beginTime, String endTime, Function() action) {
|
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (indexEntity.keyType == 1) {
|
||||||
|
//限期
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
} else if (indexEntity.keyType == 2) {
|
||||||
|
//永久
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||||
|
} else if (indexEntity.keyType == 3) {
|
||||||
|
//单次
|
||||||
|
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||||
|
} else if (indexEntity.keyType == 4) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
|
}
|
||||||
|
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//钥匙状态
|
||||||
|
String getKeyStatus(int? keyStatusFlag) {
|
||||||
|
String keyStatus = '';
|
||||||
|
|
||||||
|
if (keyStatusFlag == 110401) {
|
||||||
|
//正常使用
|
||||||
|
keyStatus = '';
|
||||||
|
} else if (keyStatusFlag == 110402) {
|
||||||
|
//待接收
|
||||||
|
keyStatus = '待接收';
|
||||||
|
} else if (keyStatusFlag == 110405) {
|
||||||
|
//已冻结
|
||||||
|
keyStatus = '已冻结';
|
||||||
|
} else if (keyStatusFlag == 110408) {
|
||||||
|
//已删除
|
||||||
|
keyStatus = '已删除';
|
||||||
|
} else if (keyStatusFlag == 110410) {
|
||||||
|
//已重置
|
||||||
|
keyStatus = '已重置';
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _electronicKeyItem(String avatarURL, String receiveUser,
|
||||||
|
String useDate, String keyStatus, bool isAdminKey, Function() action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -102,7 +183,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
width: 30.w,
|
width: 30.w,
|
||||||
),
|
),
|
||||||
Image.asset(
|
Image.asset(
|
||||||
lockTypeIcon,
|
avatarURL,
|
||||||
width: 60.w,
|
width: 60.w,
|
||||||
height: 60.w,
|
height: 60.w,
|
||||||
),
|
),
|
||||||
@ -117,7 +198,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
lockTypeTitle,
|
receiveUser,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 24.sp, color: AppColors.blackColor),
|
fontSize: 24.sp, color: AppColors.blackColor),
|
||||||
),
|
),
|
||||||
@ -132,7 +213,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'待接收',
|
keyStatus,
|
||||||
style: TextStyle(color: Colors.red, fontSize: 16.sp),
|
style: TextStyle(color: Colors.red, fontSize: 16.sp),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -143,7 +224,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"2023.6.21 11.15 永久",
|
useDate,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
color: AppColors.placeholderTextColor),
|
color: AppColors.placeholderTextColor),
|
||||||
|
|||||||
@ -2,8 +2,12 @@ import 'package:flutter/cupertino.dart';
|
|||||||
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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/jh_pop_menus.dart';
|
import 'package:star_lock/tools/jh_pop_menus.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
import '../../../../../app_settings/app_colors.dart';
|
||||||
@ -23,11 +27,10 @@ class ElectronicKeyDetailPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||||
final TextEditingController _changeNameController = TextEditingController();
|
final TextEditingController _changeNameController = TextEditingController();
|
||||||
|
ElectronicKeyListItem itemData = ElectronicKeyListItem();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ElectronicKeyListItem itemData = ElectronicKeyListItem();
|
|
||||||
|
|
||||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
if (obj != null && (obj["itemData"] != null)) {
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
itemData = obj["itemData"];
|
itemData = obj["itemData"];
|
||||||
@ -63,7 +66,9 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: itemData.keyName,
|
rightTitle: _changeNameController.text.isNotEmpty
|
||||||
|
? _changeNameController.text
|
||||||
|
: itemData.keyName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -230,15 +235,42 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showCupertinoAlertDialog(BuildContext context) {
|
//修改钥匙名称请求
|
||||||
|
Future<void> modifyKeyNameRequest() async {
|
||||||
|
KeyOperationRecordEntity entity = await ApiRepository.to
|
||||||
|
.modifyKeyNameForAdmin(
|
||||||
|
itemData.keyId.toString(), _changeNameController.text, '0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("修改要是名称成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "修改成功");
|
||||||
|
setState(() {
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCupertinoAlertDialog(
|
||||||
|
BuildContext context,
|
||||||
|
) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
return ShowTFView(
|
||||||
title:
|
title:
|
||||||
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
"${TranslationLoader.lanKeys!.amend!.tr} ${TranslationLoader.lanKeys!.name!.tr}",
|
||||||
tipTitle: "请输入",
|
tipTitle: "请输入",
|
||||||
controller: _changeNameController);
|
controller: _changeNameController,
|
||||||
});
|
sureClick: () {
|
||||||
|
//发送编辑钥匙名称请求
|
||||||
|
if (_changeNameController.text.isNotEmpty) {
|
||||||
|
modifyKeyNameRequest();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelClick: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class ElectronicKeyListLogic {
|
|||||||
late ElectronicKeyListEntity dataEntity = ElectronicKeyListEntity();
|
late ElectronicKeyListEntity dataEntity = ElectronicKeyListEntity();
|
||||||
void electronicKeyList() async {
|
void electronicKeyList() async {
|
||||||
var entity = await ApiRepository.to
|
var entity = await ApiRepository.to
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0');
|
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
dataEntity = entity;
|
dataEntity = entity;
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
|||||||
//请求电子钥匙列表
|
//请求电子钥匙列表
|
||||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||||
ElectronicKeyListEntity entity = await ApiRepository.to
|
ElectronicKeyListEntity entity = await ApiRepository.to
|
||||||
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0');
|
.electronicKeyList('0', '63', '0', '28', '1', '1', '20', '0', '0');
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_pickers/pickers.dart';
|
import 'package:flutter_pickers/pickers.dart';
|
||||||
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.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 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../../appRouters.dart';
|
import '../../../../../appRouters.dart';
|
||||||
import '../../../../../tools/commonItem.dart';
|
import '../../../../../tools/commonItem.dart';
|
||||||
@ -34,8 +33,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
|
|
||||||
bool _isRemoteUnlock = false; //是否允许远程开锁
|
bool _isRemoteUnlock = false; //是否允许远程开锁
|
||||||
bool _isAuthentication = false; //是否可以实名认证
|
bool _isAuthentication = false; //是否可以实名认证
|
||||||
var _selectEffectiveDate = ''; //生效时间
|
String _selectEffectiveDate = ''; //生效时间
|
||||||
var _selectFailureDate = ''; //失效时间
|
String _selectFailureDate = ''; //失效时间
|
||||||
TextEditingController emailOrPhoneController =
|
TextEditingController emailOrPhoneController =
|
||||||
TextEditingController(); //邮箱/手机号输入框
|
TextEditingController(); //邮箱/手机号输入框
|
||||||
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
TextEditingController keyNameController = TextEditingController(); //钥匙名输入框
|
||||||
@ -277,13 +276,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
String getKeyType = (int.parse(widget.type) + 1).toString();
|
String getKeyType = (int.parse(widget.type) + 1).toString();
|
||||||
if (widget.type == '0') {
|
if (widget.type == '0') {
|
||||||
getFailureDateTime =
|
getFailureDateTime =
|
||||||
DateTime.fromMillisecondsSinceEpoch(int.parse(_selectFailureDate))
|
DateTime.parse(_selectFailureDate).millisecondsSinceEpoch.toString();
|
||||||
.toString()
|
getEffectiveDateTime = DateTime.parse(_selectEffectiveDate)
|
||||||
.substring(0, 19);
|
.millisecondsSinceEpoch
|
||||||
getEffectiveDateTime =
|
.toString();
|
||||||
DateTime.fromMillisecondsSinceEpoch(int.parse(_selectEffectiveDate))
|
|
||||||
.toString()
|
|
||||||
.substring(0, 19);
|
|
||||||
}
|
}
|
||||||
var entity = await ApiRepository.to.sendElectronicKey(
|
var entity = await ApiRepository.to.sendElectronicKey(
|
||||||
'0',
|
'0',
|
||||||
@ -305,9 +301,21 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
print('发送电子钥匙成功');
|
print('发送电子钥匙成功');
|
||||||
_isSendSuccess = true;
|
_isSendSuccess = true;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
Toast.show(msg: '${entity.errorMsg}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///日期转时间戳
|
||||||
|
static int dateToTimestamp(String date, {isMicroseconds = false}) {
|
||||||
|
DateTime dateTime = DateTime.parse(date);
|
||||||
|
int timestamp = dateTime.millisecondsSinceEpoch;
|
||||||
|
if (isMicroseconds) {
|
||||||
|
timestamp = dateTime.microsecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
// 发送电子钥匙成功
|
// 发送电子钥匙成功
|
||||||
Widget sendElectronicKeySucceed() {
|
Widget sendElectronicKeySucceed() {
|
||||||
return Column(
|
return Column(
|
||||||
@ -471,4 +479,8 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String intToStr(int v) {
|
||||||
|
return (v < 10) ? "0$v" : "$v";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/tools/shareModule/sharePopup.dart';
|
import 'package:star_lock/tools/shareModule/sharePopup.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
@ -19,8 +20,15 @@ class PasswordKeyDetailPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||||
|
PasswordKeyListItem itemData = PasswordKeyListItem();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||||
|
if (obj != null && (obj["itemData"] != null)) {
|
||||||
|
itemData = obj["itemData"];
|
||||||
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -51,7 +59,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
children: [
|
children: [
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
leftTitel: TranslationLoader.lanKeys!.password!.tr,
|
||||||
rightTitle: "98765432",
|
rightTitle: itemData.keyboardPwd,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -59,7 +67,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
}),
|
}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||||
rightTitle: "你好",
|
rightTitle: itemData.keyboardPwdName,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () {
|
action: () {
|
||||||
@ -76,11 +84,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
|||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
leftTitel: TranslationLoader.lanKeys!.sender!.tr,
|
||||||
rightTitle: "15080825640",
|
rightTitle: itemData.senderUsername,
|
||||||
action: () {}),
|
action: () {}),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.senderTime!.tr,
|
||||||
rightTitle: "2020.06.21 11:49",
|
rightTitle: itemData.sendDate.toString(),
|
||||||
action: () {}),
|
action: () {}),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
CommonItem(
|
CommonItem(
|
||||||
|
|||||||
@ -0,0 +1,134 @@
|
|||||||
|
class PasswordKeyListEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
PasswordKeyListData? data;
|
||||||
|
|
||||||
|
PasswordKeyListEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
PasswordKeyListEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null
|
||||||
|
? PasswordKeyListData.fromJson(json['data'])
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PasswordKeyListData {
|
||||||
|
List<PasswordKeyListItem>? itemList;
|
||||||
|
int? pageNo;
|
||||||
|
int? pageSize;
|
||||||
|
int? pages;
|
||||||
|
int? total;
|
||||||
|
|
||||||
|
PasswordKeyListData(
|
||||||
|
{this.itemList, this.pageNo, this.pageSize, this.pages, this.total});
|
||||||
|
|
||||||
|
PasswordKeyListData.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['list'] != null) {
|
||||||
|
itemList = <PasswordKeyListItem>[];
|
||||||
|
json['list'].forEach((v) {
|
||||||
|
itemList!.add(PasswordKeyListItem.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pages = json['pages'];
|
||||||
|
total = json['total'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (itemList != null) {
|
||||||
|
data['list'] = itemList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['pageNo'] = pageNo;
|
||||||
|
data['pageSize'] = pageSize;
|
||||||
|
data['pages'] = pages;
|
||||||
|
data['total'] = total;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PasswordKeyListItem {
|
||||||
|
int? apiUserId;
|
||||||
|
int? lockId;
|
||||||
|
String? keyboardPwd;
|
||||||
|
String? keyboardPwdName;
|
||||||
|
int? keyboardPwdStatus;
|
||||||
|
int? keyboardPwdType;
|
||||||
|
int? startDate;
|
||||||
|
int? endDate;
|
||||||
|
int? isCustom;
|
||||||
|
String? createdAt;
|
||||||
|
String? senderUsername;
|
||||||
|
int? keyboardPwdId;
|
||||||
|
int? sendDate;
|
||||||
|
String? validTimeStr;
|
||||||
|
|
||||||
|
PasswordKeyListItem(
|
||||||
|
{this.apiUserId,
|
||||||
|
this.lockId,
|
||||||
|
this.keyboardPwd,
|
||||||
|
this.keyboardPwdName,
|
||||||
|
this.keyboardPwdStatus,
|
||||||
|
this.keyboardPwdType,
|
||||||
|
this.startDate,
|
||||||
|
this.endDate,
|
||||||
|
this.isCustom,
|
||||||
|
this.createdAt,
|
||||||
|
this.senderUsername,
|
||||||
|
this.keyboardPwdId,
|
||||||
|
this.sendDate,
|
||||||
|
this.validTimeStr});
|
||||||
|
|
||||||
|
PasswordKeyListItem.fromJson(Map<String, dynamic> json) {
|
||||||
|
apiUserId = json['apiUserId'];
|
||||||
|
lockId = json['lockId'];
|
||||||
|
keyboardPwd = json['keyboardPwd'];
|
||||||
|
keyboardPwdName = json['keyboardPwdName'];
|
||||||
|
keyboardPwdStatus = json['keyboardPwdStatus'];
|
||||||
|
keyboardPwdType = json['keyboardPwdType'];
|
||||||
|
startDate = json['startDate'];
|
||||||
|
endDate = json['endDate'];
|
||||||
|
isCustom = json['isCustom'];
|
||||||
|
createdAt = json['created_at'];
|
||||||
|
senderUsername = json['senderUsername'];
|
||||||
|
keyboardPwdId = json['keyboardPwdId'];
|
||||||
|
sendDate = json['sendDate'];
|
||||||
|
validTimeStr = json['validTimeStr'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['apiUserId'] = apiUserId;
|
||||||
|
data['lockId'] = lockId;
|
||||||
|
data['keyboardPwd'] = keyboardPwd;
|
||||||
|
data['keyboardPwdName'] = keyboardPwdName;
|
||||||
|
data['keyboardPwdStatus'] = keyboardPwdStatus;
|
||||||
|
data['keyboardPwdType'] = keyboardPwdType;
|
||||||
|
data['startDate'] = startDate;
|
||||||
|
data['endDate'] = endDate;
|
||||||
|
data['isCustom'] = isCustom;
|
||||||
|
data['created_at'] = createdAt;
|
||||||
|
data['senderUsername'] = senderUsername;
|
||||||
|
data['keyboardPwdId'] = keyboardPwdId;
|
||||||
|
data['sendDate'] = sendDate;
|
||||||
|
data['validTimeStr'] = validTimeStr;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,10 @@
|
|||||||
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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
@ -30,34 +34,83 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
TranslationLoader.lanKeys!.reset!.tr,
|
TranslationLoader.lanKeys!.reset!.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
),
|
resetPasswordKeyListRequest();
|
||||||
],
|
|
||||||
),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
_searchWidget(),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
Expanded(child: _buildMainUI()),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
|
||||||
AddBottomWhiteBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
|
||||||
onClick: () {
|
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyManagePage);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
|
||||||
height: 42.h,
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
body: FutureBuilder<List<PasswordKeyListItem>>(
|
||||||
|
future: mockNetworkDataRequest(),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<List<PasswordKeyListItem>> snapshot) {
|
||||||
|
//请求结束
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
//请求失败
|
||||||
|
return const Text('请求失败');
|
||||||
|
} else {
|
||||||
|
//请求成功
|
||||||
|
final List<PasswordKeyListItem> itemData = snapshot.data!;
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
_searchWidget(),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Expanded(child: _buildMainUI(itemData)),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
AddBottomWhiteBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
|
onClick: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.passwordKeyManagePage);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 42.h,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//请求未结束 显示loading
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//请求密码钥匙列表
|
||||||
|
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
|
||||||
|
PasswordKeyListEntity entity =
|
||||||
|
await ApiRepository.to.passwordKeyList('0', '28', '0', '1', '20');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("密码钥匙列表成功:${entity.data?.itemList}");
|
||||||
|
}
|
||||||
|
if (entity.data != null) {
|
||||||
|
return entity.data!.itemList!;
|
||||||
|
} else {
|
||||||
|
List<PasswordKeyListItem> dataList = [];
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//密码钥匙重置请求
|
||||||
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
|
PasswordKeyListEntity entity =
|
||||||
|
await ApiRepository.to.resetPasswordKey('28', '0');
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
print("重置电子钥匙成功啦啦啦啦啦");
|
||||||
|
Toast.show(msg: "重置成功");
|
||||||
|
mockNetworkDataRequest();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget _searchWidget() {
|
Widget _searchWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
@ -93,13 +146,21 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI(itemData) {
|
||||||
|
List<PasswordKeyListItem> getItemData = itemData;
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
itemCount: 5,
|
itemCount: getItemData.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
return _electronicKeyItem('images/icon_password.png', "张三",
|
PasswordKeyListItem indexEntity = getItemData[index];
|
||||||
"2023.6.21 11.15", "2023.6.21 11.15", () {
|
String useDateStr = ''; //使用期限
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage);
|
|
||||||
|
//使用期限
|
||||||
|
useDateStr = getUseDateStr(indexEntity);
|
||||||
|
|
||||||
|
return _electronicKeyItem('images/controls_user.png',
|
||||||
|
indexEntity.keyboardPwdName!, useDateStr, () {
|
||||||
|
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||||
|
arguments: {"itemData": indexEntity});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
@ -111,8 +172,53 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//使用期限
|
||||||
|
/**
|
||||||
|
单次 1 只能在开始时间后6小时内使用一次
|
||||||
|
永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
|
删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
|
周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
|
每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
|
工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
|
周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
|
周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
|
周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
|
周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
|
周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
|
周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
|
周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
|
*/
|
||||||
|
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||||
|
String useDateStr = '';
|
||||||
|
if (indexEntity.keyboardPwdType == 3) {
|
||||||
|
//限期
|
||||||
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||||
|
} else if (indexEntity.keyboardPwdType == 2) {
|
||||||
|
//永久
|
||||||
|
DateTime dateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||||
|
} else if (indexEntity.keyboardPwdType == 1) {
|
||||||
|
//单次
|
||||||
|
DateTime dateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
|
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||||
|
} else if (indexEntity.keyboardPwdType == 4) {
|
||||||
|
//循环
|
||||||
|
useDateStr = '循环';
|
||||||
|
}
|
||||||
|
|
||||||
|
return useDateStr;
|
||||||
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
Widget _electronicKeyItem(String lockTypeIcon, String lockTypeTitle,
|
||||||
String beginTime, String endTime, Function()? action) {
|
String useDateStr, Function()? action) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -147,18 +253,16 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5.h),
|
SizedBox(height: 5.h),
|
||||||
Container(
|
Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
children: [
|
||||||
children: [
|
Text(
|
||||||
Text(
|
useDateStr,
|
||||||
"2023.6.21 18:00 清空码",
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 18.sp,
|
||||||
fontSize: 18.sp,
|
color: AppColors.placeholderTextColor),
|
||||||
color: AppColors.placeholderTextColor),
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 20.h),
|
SizedBox(width: 20.h),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -18,4 +18,8 @@ abstract class Api {
|
|||||||
final String uploadElectricQuantityURL =
|
final String uploadElectricQuantityURL =
|
||||||
'/room/uploadElectricQuantity'; //锁电量更新
|
'/room/uploadElectricQuantity'; //锁电量更新
|
||||||
final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称
|
final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称
|
||||||
|
final String modifyKeyNameForAdminURL =
|
||||||
|
'/key/modifyKeyNameForAdmin'; //编辑电子钥匙名字
|
||||||
|
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //密码钥匙列表
|
||||||
|
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,8 @@ class ApiProvider extends BaseProvider {
|
|||||||
String operatorUid,
|
String operatorUid,
|
||||||
String pageNo,
|
String pageNo,
|
||||||
String pageSize,
|
String pageSize,
|
||||||
String startDate) =>
|
String startDate,
|
||||||
|
String keyRight) =>
|
||||||
post(
|
post(
|
||||||
electronicKeyListURL.toUrl,
|
electronicKeyListURL.toUrl,
|
||||||
jsonEncode({
|
jsonEncode({
|
||||||
@ -113,6 +114,7 @@ class ApiProvider extends BaseProvider {
|
|||||||
'pageNo': pageNo,
|
'pageNo': pageNo,
|
||||||
'pageSize': pageSize,
|
'pageSize': pageSize,
|
||||||
'startDate': startDate,
|
'startDate': startDate,
|
||||||
|
'keyRight': keyRight
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Future<Response> sendElectronicKey(
|
Future<Response> sendElectronicKey(
|
||||||
@ -179,6 +181,19 @@ class ApiProvider extends BaseProvider {
|
|||||||
'operatorUid': operatorUid,
|
'operatorUid': operatorUid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Future<Response> modifyKeyNameForAdmin(
|
||||||
|
String keyId,
|
||||||
|
String keyNameForAdmin,
|
||||||
|
String operatorUid,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
modifyKeyNameForAdminURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyId': keyId,
|
||||||
|
'keyNameForAdmin': keyNameForAdmin,
|
||||||
|
'operatorUid': operatorUid,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
|
||||||
post(resetElectronicKeyURL.toUrl,
|
post(resetElectronicKeyURL.toUrl,
|
||||||
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
@ -210,8 +225,29 @@ class ApiProvider extends BaseProvider {
|
|||||||
'searchStr': searchStr,
|
'searchStr': searchStr,
|
||||||
'timezoneRawOffSet': timezoneRawOffSet
|
'timezoneRawOffSet': timezoneRawOffSet
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Future<Response> passwordKeyList(
|
||||||
|
String keyStatus,
|
||||||
|
String lockId,
|
||||||
|
String operatorUid,
|
||||||
|
String pageNo,
|
||||||
|
String pageSize,
|
||||||
|
) =>
|
||||||
|
post(
|
||||||
|
passwordKeyListURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'keyStatus': keyStatus,
|
||||||
|
'lockId': lockId,
|
||||||
|
'operatorUid': operatorUid,
|
||||||
|
'pageNo': pageNo,
|
||||||
|
'pageSize': pageSize
|
||||||
|
}));
|
||||||
|
|
||||||
|
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
|
||||||
|
resetElectronicKeyURL.toUrl,
|
||||||
|
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
String get toUrl => '$this';
|
String get toUrl => this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/login/seletCountryRegion/common/countryRegionEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecordEntity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||||
import '../login/login/entity/LoginEntity.dart';
|
import '../login/login/entity/LoginEntity.dart';
|
||||||
@ -76,9 +78,9 @@ class ApiRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取国家或地区 json文件
|
//获取国家或地区 json文件
|
||||||
Future<LoginEntity> getCountryRegion(String type) async {
|
Future<CountryRegionEntity> getCountryRegion(String type) async {
|
||||||
final res = await apiProvider.getCountryRegion(type);
|
final res = await apiProvider.getCountryRegion(type);
|
||||||
return LoginEntity.fromJson(res.body);
|
return CountryRegionEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
//电子钥匙列表
|
//电子钥匙列表
|
||||||
@ -90,9 +92,10 @@ class ApiRepository {
|
|||||||
String operatorUid,
|
String operatorUid,
|
||||||
String pageNo,
|
String pageNo,
|
||||||
String pageSize,
|
String pageSize,
|
||||||
String startDate) async {
|
String startDate,
|
||||||
|
String keyRight) async {
|
||||||
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
|
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
|
||||||
lockId, operatorUid, pageNo, pageSize, startDate);
|
lockId, operatorUid, pageNo, pageSize, startDate, keyRight);
|
||||||
return ElectronicKeyListEntity.fromJson(res.body);
|
return ElectronicKeyListEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,4 +191,35 @@ class ApiRepository {
|
|||||||
await apiProvider.modifyKeyName(keyId, lockId, keyName, operatorUid);
|
await apiProvider.modifyKeyName(keyId, lockId, keyName, operatorUid);
|
||||||
return KeyOperationRecordEntity.fromJson(res.body);
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//编辑电子钥匙名字
|
||||||
|
Future<KeyOperationRecordEntity> modifyKeyNameForAdmin(
|
||||||
|
String keyId,
|
||||||
|
String keyNameForAdmin,
|
||||||
|
String operatorUid,
|
||||||
|
) async {
|
||||||
|
final res = await apiProvider.modifyKeyNameForAdmin(
|
||||||
|
keyId, keyNameForAdmin, operatorUid);
|
||||||
|
return KeyOperationRecordEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑电子钥匙名字
|
||||||
|
Future<PasswordKeyListEntity> passwordKeyList(
|
||||||
|
String keyStatus,
|
||||||
|
String lockId,
|
||||||
|
String operatorUid,
|
||||||
|
String pageNo,
|
||||||
|
String pageSize,
|
||||||
|
) async {
|
||||||
|
final res = await apiProvider.passwordKeyList(
|
||||||
|
keyStatus, lockId, operatorUid, pageNo, pageSize);
|
||||||
|
return PasswordKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//重置密码钥匙
|
||||||
|
Future<PasswordKeyListEntity> resetPasswordKey(
|
||||||
|
String lockId, String operatorUid) async {
|
||||||
|
final res = await apiProvider.resetPasswordKey(lockId, operatorUid);
|
||||||
|
return PasswordKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,8 +9,17 @@ class ShowTFView extends StatelessWidget {
|
|||||||
String? title;
|
String? title;
|
||||||
String? tipTitle;
|
String? tipTitle;
|
||||||
TextEditingController? controller;
|
TextEditingController? controller;
|
||||||
|
Function()? sureClick;
|
||||||
|
Function()? cancelClick;
|
||||||
|
|
||||||
ShowTFView({Key? key, this.title, this.tipTitle, this.controller}) : super(key: key);
|
ShowTFView(
|
||||||
|
{Key? key,
|
||||||
|
this.title,
|
||||||
|
this.tipTitle,
|
||||||
|
this.controller,
|
||||||
|
this.sureClick,
|
||||||
|
this.cancelClick})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -20,15 +29,16 @@ class ShowTFView extends StatelessWidget {
|
|||||||
title: Text(title!),
|
title: Text(title!),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 10,),
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
// color: Colors.white,
|
// color: Colors.white,
|
||||||
// padding: EdgeInsets.only(left:20.w, right: 110.w),
|
// padding: EdgeInsets.only(left:20.w, right: 110.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(15.w)
|
borderRadius: BorderRadius.circular(15.w)),
|
||||||
),
|
|
||||||
child: TextField(
|
child: TextField(
|
||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
@ -36,9 +46,10 @@ class ShowTFView extends StatelessWidget {
|
|||||||
autofocus: false,
|
autofocus: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
contentPadding: EdgeInsets.only(top: 20.h, left: 15.0, bottom: 13.h),
|
contentPadding:
|
||||||
|
EdgeInsets.only(top: 20.h, left: 15.0, bottom: 13.h),
|
||||||
hintText: tipTitle,
|
hintText: tipTitle,
|
||||||
hintStyle:TextStyle(fontSize: 28.sp),
|
hintStyle: TextStyle(fontSize: 28.sp),
|
||||||
//不需要输入框下划线
|
//不需要输入框下划线
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
//左边图标设置
|
//左边图标设置
|
||||||
@ -66,16 +77,26 @@ class ShowTFView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr, style: const TextStyle(color: Colors.black),),
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.cancel!.tr,
|
||||||
|
style: const TextStyle(color: Colors.black),
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
// print("取消");
|
// print("取消");
|
||||||
|
if (cancelClick != null) {
|
||||||
|
cancelClick!();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: Text(TranslationLoader.lanKeys!.sure!.tr, style: const TextStyle(color: Colors.black)),
|
child: Text(TranslationLoader.lanKeys!.sure!.tr,
|
||||||
|
style: const TextStyle(color: Colors.black)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
if (sureClick != null) {
|
||||||
|
sureClick!();
|
||||||
|
}
|
||||||
|
// Navigator.pop(context);
|
||||||
// print("确定");
|
// print("确定");
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -118,7 +118,6 @@ flutter:
|
|||||||
- images/lan/
|
- images/lan/
|
||||||
- images/mine/
|
- images/mine/
|
||||||
- images/lockType/
|
- images/lockType/
|
||||||
- assets/
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user