Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
# Conflicts: # star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_page.dart
This commit is contained in:
commit
cd3f405138
22
star_lock/lib/common/XSConstantMacro/XSConstantMacro.dart
Normal file
22
star_lock/lib/common/XSConstantMacro/XSConstantMacro.dart
Normal file
@ -0,0 +1,22 @@
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||
import 'package:star_lock/network/api.dart';
|
||||
|
||||
class XSConstantMacro {
|
||||
// 网页的宏定义网址
|
||||
static String baseWebURL = Api.baseAddress; //base地址
|
||||
static String introduceURL = '$baseWebURL/app/introduce'; //介绍页
|
||||
static String userAgreementURL = '$baseWebURL/app/userAgreement'; //用户协议
|
||||
static String privacyPolicyURL = '$baseWebURL/app/privacy'; //隐私政策
|
||||
static String collectionListURL =
|
||||
'$baseWebURL/app/personalInformationCollectionList'; //个人信息收集清单
|
||||
static String thirdPartyInfShareListURL =
|
||||
'$baseWebURL/app/thirdPartyInformationSharingList'; //第三方信息共享清单
|
||||
static String appPermissionDescURL =
|
||||
'$baseWebURL/app/applicationPermissionDescription'; //应用权限说明
|
||||
|
||||
// 钥匙类型 keyType 1-永久 2-限期 3-单次 4-循环
|
||||
static int keyTypeLong = 1;
|
||||
static int keyTypeTime = 2;
|
||||
static int keyTypeOnce = 3;
|
||||
static int keyTypeLoop = 4;
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.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';
|
||||
|
||||
class AuthorizedAdminListLogic extends BaseGetXController {
|
||||
final AuthorizedAdminListState state = AuthorizedAdminListState();
|
||||
|
||||
//请求电子钥匙列表
|
||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
'0',
|
||||
state.keyInfo.value.keyId.toString(),
|
||||
'',
|
||||
state.keyInfo.value.lockId.toString(),
|
||||
'',
|
||||
state.pageNum.toString(),
|
||||
state.pageSize.toString(),
|
||||
'0',
|
||||
'0',
|
||||
state.searchStr.value);
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
if (entity.data != null) {
|
||||
dataList = entity.data!.itemList;
|
||||
}
|
||||
}
|
||||
state.itemDataList.value = dataList;
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
@ -22,97 +22,62 @@ class AuthorizedAdminListPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
late KeyInfos keyInfo;
|
||||
late LockMainEntity lockMainEntity;
|
||||
final logic = Get.put(AuthorizedAdminListLogic());
|
||||
final state = Get.find<AuthorizedAdminListLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
mockRequest();
|
||||
}
|
||||
|
||||
Future<void> mockRequest() async {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["lockMainEntity"] != null)) {
|
||||
lockMainEntity = obj["lockMainEntity"];
|
||||
}
|
||||
if (obj != null && (obj["keyInfo"] != null)) {
|
||||
keyInfo = obj["keyInfo"];
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
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,
|
||||
arguments: {
|
||||
"lockMainEntity": lockMainEntity,
|
||||
"keyInfo": keyInfo
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//请求未结束 显示loading
|
||||
return Container();
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
//请求授权管理员列表 跟电子钥匙列表的接口一样,但必须在参数中加keyRight=1为授权管理员
|
||||
Future<List<ElectronicKeyListItem>> mockNetworkDataRequest() async {
|
||||
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
|
||||
'0',
|
||||
keyInfo.keyId.toString(),
|
||||
'',
|
||||
keyInfo.lockId.toString(),
|
||||
'',
|
||||
'1',
|
||||
'20',
|
||||
'0',
|
||||
'1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList;
|
||||
} else {
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Obx(() => state.itemDataList.value.isEmpty
|
||||
? const NoData()
|
||||
: _buildMainUI(state.itemDataList.value))),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.addAuthorizedAdmin!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.authorizedAdminManagePage,
|
||||
arguments: {
|
||||
"lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildMainUI(itemData) {
|
||||
@ -142,7 +107,12 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
return _electronicKeyItem('images/controls_user.png',
|
||||
indexEntity.keyName!, useDateStr, keyStatus, isAdminKey, () {
|
||||
Navigator.pushNamed(context, Routers.electronicKeyDetailPage,
|
||||
arguments: {'itemData': indexEntity});
|
||||
arguments: {'itemData': indexEntity}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -150,7 +120,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
//使用期限
|
||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
@ -158,15 +128,15 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
class AuthorizedAdminListState {
|
||||
final keyInfo = KeyInfos().obs;
|
||||
final lockMainEntity = LockMainEntity().obs;
|
||||
var pageNum = 1.obs; //请求页码
|
||||
final pageSize = 20.obs; //请求每页数据条数
|
||||
final itemDataList = <ElectronicKeyListItem>[].obs;
|
||||
final searchStr = ''.obs;
|
||||
|
||||
AuthorizedAdminListState() {
|
||||
Map map = Get.arguments;
|
||||
lockMainEntity.value = map["lockMainEntity"];
|
||||
keyInfo.value = map["keyInfo"];
|
||||
}
|
||||
}
|
||||
@ -2,12 +2,12 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.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/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/showCupertinoAlert.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
@ -141,7 +141,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
//使用期限
|
||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
@ -149,15 +149,15 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -18,16 +18,17 @@ class ElectronicKeyListLogic extends BaseGetXController {
|
||||
state.pageNum.toString(),
|
||||
state.pageSize.toString(),
|
||||
'0',
|
||||
'0');
|
||||
'0',
|
||||
state.searchController.text);
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("电子钥匙列表成功:${entity.data?.itemList}");
|
||||
if (entity.data != null) {
|
||||
dataList = entity.data!.itemList;
|
||||
}
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList;
|
||||
} else {
|
||||
List<ElectronicKeyListItem> dataList = [];
|
||||
return dataList;
|
||||
}
|
||||
state.itemDataList.value = dataList;
|
||||
return dataList;
|
||||
}
|
||||
|
||||
//电子钥匙重置请求
|
||||
|
||||
@ -3,9 +3,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
@ -23,104 +25,79 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
final logic = Get.put(ElectronicKeyListLogic());
|
||||
final state = Get.find<ElectronicKeyListLogic>().state;
|
||||
late RefreshController _refreshController;
|
||||
late List<ElectronicKeyListItem> itemDataList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refreshController = RefreshController(initialRefresh: true);
|
||||
|
||||
mockRequest();
|
||||
}
|
||||
|
||||
Future<void> mockRequest() async {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.electronicKey!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.reset!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.electronicKey!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.reset!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
_showDialog(context);
|
||||
},
|
||||
),
|
||||
onPressed: () {
|
||||
_showDialog(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: FutureBuilder<List<ElectronicKeyListItem>>(
|
||||
future: logic.mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<ElectronicKeyListItem>> snapshot) {
|
||||
//请求结束
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
//请求失败
|
||||
return const Text('请求失败');
|
||||
} else {
|
||||
//请求成功
|
||||
itemDataList = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(
|
||||
child: itemDataList.isEmpty
|
||||
? const NoData()
|
||||
: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
onRefresh: _refresh,
|
||||
onLoading: _loadMore,
|
||||
header: ClassicHeader(
|
||||
height: 45.h,
|
||||
releaseText: '松开手刷新',
|
||||
refreshingText: '刷新中',
|
||||
completeText: '刷新完成',
|
||||
failedText: '刷新失败',
|
||||
idleText: '下拉刷新',
|
||||
),
|
||||
child: _buildMainUI(itemDataList),
|
||||
)),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.sendElectronicKeyManagePage,
|
||||
arguments: {
|
||||
"lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//请求未结束 显示loading
|
||||
return Container();
|
||||
}
|
||||
}),
|
||||
);
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() => state.itemDataList.value.isEmpty
|
||||
? const NoData()
|
||||
: _buildMainUI(state.itemDataList.value))),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sendKey!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.sendElectronicKeyManagePage, arguments: {
|
||||
"lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
///加载更多函数
|
||||
Future<void> _loadMore() async {
|
||||
if (state.pageNum.value == 1) {
|
||||
if (itemDataList.length < 10) {
|
||||
if (state.itemDataList.value.length < 10) {
|
||||
_refreshController.loadComplete();
|
||||
} else {
|
||||
state.pageNum.value++;
|
||||
@ -152,7 +129,10 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
autofocus: false,
|
||||
|
||||
controller: state.searchController,
|
||||
onSubmitted: (value) {
|
||||
logic.mockNetworkDataRequest();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
@ -208,7 +188,6 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
;
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
@ -223,7 +202,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
//使用期限
|
||||
String getUseDateStr(ElectronicKeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
@ -231,15 +210,15 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
|
||||
|
||||
class ElectronicKeyListState {
|
||||
TextEditingController searchController = TextEditingController(); //邮箱/手机号输入框
|
||||
final keyInfo = KeyInfos().obs;
|
||||
final lockMainEntity = LockMainEntity().obs;
|
||||
var pageNum = 1.obs; //请求页码
|
||||
final pageSize = 20.obs; //请求每页数据条数
|
||||
final itemDataList = <ElectronicKeyListItem>[].obs;
|
||||
|
||||
ElectronicKeyListState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -13,22 +13,20 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
|
||||
//发送钥匙请求
|
||||
Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
|
||||
String getFailureDateTime = '0';
|
||||
String getEffectiveDateTime = '0';
|
||||
String lockID = state.keyInfo.value.lockId.toString();
|
||||
String getKeyType = (int.parse(state.type.value) + 1).toString();
|
||||
if (state.type.value == '0') {
|
||||
getFailureDateTime =
|
||||
state.failureDateTime.value.millisecondsSinceEpoch.toString();
|
||||
getEffectiveDateTime =
|
||||
state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
|
||||
state.failureTimestamp.value =
|
||||
state.failureDateTime.value.millisecondsSinceEpoch;
|
||||
state.effectiveTimestamp.value =
|
||||
state.effectiveDateTime.value.millisecondsSinceEpoch;
|
||||
}
|
||||
|
||||
var entity = await ApiRepository.to.sendElectronicKey(
|
||||
createUser: state.isCreateUser.value ? "1" : "0",
|
||||
countryCode: state.countryCode.value,
|
||||
usernameType: '1',
|
||||
endDate: getFailureDateTime,
|
||||
endDate: state.failureTimestamp.value.toString(),
|
||||
faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
|
||||
isCameraEnable: '2',
|
||||
isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
|
||||
@ -39,7 +37,7 @@ class SendElectronicKeyLogic extends BaseGetXController {
|
||||
operatorUid: '',
|
||||
receiverUsername: state.emailOrPhoneController.text,
|
||||
remarks: '',
|
||||
startDate: getEffectiveDateTime,
|
||||
startDate: state.effectiveTimestamp.value.toString(),
|
||||
weekDays: state.weekdaysList);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print('发送电子钥匙成功');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_pickers/pickers.dart';
|
||||
import 'package:flutter_pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -28,6 +29,7 @@ class SendElectronicKeyPage extends StatefulWidget {
|
||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
final logic = Get.put(SendElectronicKeyLogic());
|
||||
final state = Get.find<SendElectronicKeyLogic>().state;
|
||||
static const methodChannel = MethodChannel('flutter_native_ios');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -212,9 +214,13 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
Widget keyPeriodValidityWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: state.weekdaysList.isEmpty
|
||||
? ''
|
||||
: state.weekdaysList
|
||||
.reduce((value, element) => value + ',' + element)
|
||||
.toString(),
|
||||
isHaveDirection: true,
|
||||
action: () async {
|
||||
var result = await Navigator.pushNamed(
|
||||
@ -222,10 +228,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
state.weekdaysList.value = result['validityValue'];
|
||||
state.effectiveDateTime.value = result['starDate'];
|
||||
state.failureDateTime.value = result['endDate'];
|
||||
state.effectiveTimestamp.value =
|
||||
result['starDate'].millisecondsSinceEpoch;
|
||||
state.failureTimestamp.value =
|
||||
result['endDate'].millisecondsSinceEpoch;
|
||||
}
|
||||
}),
|
||||
})),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
)
|
||||
@ -345,21 +353,22 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '邮件通知',
|
||||
btnName: '分享',
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
// Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
_openModalBottomSheet();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '微信通知',
|
||||
onClick: () {},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
// OutLineBtn(
|
||||
// btnName: '微信通知',
|
||||
// onClick: () {},
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 10.h,
|
||||
// ),
|
||||
OutLineBtn(
|
||||
btnName: '标记为已入住',
|
||||
onClick: () {
|
||||
@ -484,4 +493,126 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
|
||||
Future _openModalBottomSheet() async {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||
constraints: BoxConstraints(maxHeight: 260.h),
|
||||
builder: (BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: ScreenUtil().screenWidth,
|
||||
height: 180.h,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal, //横向滚动
|
||||
children: initBottomSheetList()),
|
||||
),
|
||||
Container(
|
||||
height: 8.h,
|
||||
color: AppColors.greyBackgroundColor,
|
||||
),
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
overlayColor:
|
||||
MaterialStateProperty.all<Color>(Colors.white)),
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
List<Widget> initBottomSheetList() {
|
||||
List<Widget> widgetList = [];
|
||||
|
||||
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
|
||||
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
|
||||
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
|
||||
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
|
||||
|
||||
return widgetList;
|
||||
}
|
||||
|
||||
GestureDetector buildCenter3(
|
||||
String imageName, String titleStr, int itemIndex) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
width: 120.w,
|
||||
// height: 64.h,
|
||||
margin:
|
||||
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
imageName,
|
||||
width: 50.w,
|
||||
height: 50.h,
|
||||
),
|
||||
SizedBox(
|
||||
height: 16.w,
|
||||
),
|
||||
Text(
|
||||
titleStr,
|
||||
style: TextStyle(
|
||||
fontSize: ScreenUtil().setSp(20), color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onTap: () => _jumpSmartDeviceRoute(itemIndex),
|
||||
);
|
||||
}
|
||||
|
||||
_jumpSmartDeviceRoute(int itemIndex) {
|
||||
switch (itemIndex) {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
Navigator.pop(context);
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
tokNative('flutter_sharePassword_to_ios',
|
||||
arguments: {'pwdShareStr': pwdShareStr}).then((result) {
|
||||
print('$result');
|
||||
});
|
||||
print('与原生交互');
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{}
|
||||
break;
|
||||
case 2:
|
||||
//邮件
|
||||
{
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
//更多
|
||||
{}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
static Future<dynamic> tokNative(String method,
|
||||
{required Map arguments}) async {
|
||||
if (arguments == null) {
|
||||
return await methodChannel.invokeMethod(method);
|
||||
} else {
|
||||
return await methodChannel.invokeMethod(method, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,8 @@ class SendElectronicKeyState {
|
||||
DateTime dateTime = DateTime.now();
|
||||
final effectiveDateTime = DateTime.now().obs;
|
||||
final failureDateTime = DateTime.now().obs;
|
||||
final effectiveTimestamp = 0.obs;
|
||||
final failureTimestamp = 0.obs;
|
||||
|
||||
var selectEffectiveDate =
|
||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}'
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
@ -88,7 +89,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader
|
||||
.lanKeys!.periodValidity!.tr,
|
||||
rightTitle: getUseDateStr(itemData),
|
||||
rightTitle: getUseDateStr(_lockData),
|
||||
allHeight: 70.h,
|
||||
isHaveLine: false),
|
||||
SizedBox(
|
||||
@ -159,7 +160,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
//使用期限
|
||||
String getUseDateStr(LockData indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||
DateTime startDateStr =
|
||||
@ -171,13 +172,13 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
|
||||
} else {
|
||||
useDateStr = '限期';
|
||||
}
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
useDateStr = '永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
useDateStr = '单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -246,18 +246,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, child: _otherUnHaveDoneSwitch()))),
|
||||
// ),
|
||||
// Obx(() =>
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: CommonItem(
|
||||
leftTitel: '感应距离',
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
})),
|
||||
// ),
|
||||
|
||||
// Obx(() =>
|
||||
Visibility(
|
||||
visible: true,
|
||||
@ -292,6 +281,18 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
width: 60.w, child: _otherUnHaveDoneSwitch()))),
|
||||
// ),
|
||||
// Obx(() =>
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: CommonItem(
|
||||
leftTitel: '感应距离',
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Toast.show(msg: "功能暂未开放");
|
||||
})),
|
||||
// ),
|
||||
// Obx(() =>
|
||||
Visibility(
|
||||
visible: true,
|
||||
child: CommonItem(
|
||||
@ -515,29 +516,35 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
void showCupertinoAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "创建公司号,考勤功能才能使用",
|
||||
sureClick: () {
|
||||
//
|
||||
Navigator.pop(context);
|
||||
Get.toNamed(Routers.checkInCreatCompanyPage,
|
||||
arguments: state.getKeyInfosData.value);
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
//确认弹窗
|
||||
void showCupertinoAlertDialog(widgetContext) {
|
||||
showCupertinoDialog(
|
||||
context: widgetContext,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text('创建公司号,考勤功能才能使用'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Get.toNamed(Routers.checkInCreatCompanyPage,
|
||||
arguments: state.getKeyInfosData.value);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void showDeletAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
@ -559,9 +566,32 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
// void showCupertinoAlertDialog(
|
||||
// BuildContext context,
|
||||
// ) {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return ShowIosTipView(
|
||||
// title: "提示",
|
||||
// tipTitle: "创建公司号,考勤功能才能使用",
|
||||
// sureClick: () {
|
||||
// //
|
||||
// Navigator.pop(context);
|
||||
// Get.toNamed(Routers.checkInCreatCompanyPage,
|
||||
// arguments: state.getKeyInfosData.value);
|
||||
// },
|
||||
// cancelClick: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
void showDeletPasswordAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
BuildContext context,
|
||||
) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -193,7 +192,6 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
deletePwdRequest();
|
||||
Navigator.pop(context, true);
|
||||
}),
|
||||
],
|
||||
),
|
||||
@ -278,6 +276,9 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
itemData.lockId.toString(), itemData.keyboardPwdId.toString(), 1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: "删除成功");
|
||||
setState(() {
|
||||
Navigator.pop(context, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,6 +410,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
Navigator.pop(context);
|
||||
String pwdShareStr =
|
||||
'您好,您的密码是:${itemData.keyboardPwd}\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}';
|
||||
tokNative('flutter_sharePassword_to_ios',
|
||||
@ -425,6 +427,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
case 2:
|
||||
//邮件
|
||||
{
|
||||
Navigator.pop(context);
|
||||
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -8,21 +8,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
final PasswordKeyListState state = PasswordKeyListState();
|
||||
|
||||
//请求密码钥匙列表
|
||||
Future<List<PasswordKeyListItem>> mockNetworkDataRequest() async {
|
||||
void mockNetworkDataRequest() async {
|
||||
PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||
'0',
|
||||
state.keyInfo.value.lockId.toString(),
|
||||
'0',
|
||||
state.pageNum.toString(),
|
||||
state.pageSize.toString());
|
||||
state.pageSize.toString(),
|
||||
state.searchController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
print("密码钥匙列表成功:${entity.data?.itemList}");
|
||||
}
|
||||
if (entity.data != null) {
|
||||
return entity.data!.itemList!;
|
||||
} else {
|
||||
List<PasswordKeyListItem> dataList = [];
|
||||
return dataList;
|
||||
state.itemDataList.value = entity.data!.itemList!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import '../../../../appRouters.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
@ -22,7 +23,6 @@ class PasswordKeyListPage extends StatefulWidget {
|
||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
final logic = Get.put(PasswordKeyListLogic());
|
||||
final state = Get.find<PasswordKeyListLogic>().state;
|
||||
late List<PasswordKeyListItem> _itemDataList = [];
|
||||
|
||||
late RefreshController _refreshController;
|
||||
|
||||
@ -30,121 +30,93 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refreshController = RefreshController(initialRefresh: true);
|
||||
mockRequest();
|
||||
}
|
||||
|
||||
Future<void> mockRequest() async {
|
||||
// 获取是否是演示模式 演示模式不获取接口
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.password!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.reset!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.password!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.reset!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
_showDialog(context);
|
||||
},
|
||||
),
|
||||
onPressed: () {
|
||||
_showDialog(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: FutureBuilder<List<PasswordKeyListItem>>(
|
||||
future: logic.mockNetworkDataRequest(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<PasswordKeyListItem>> snapshot) {
|
||||
//请求结束
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
//请求失败
|
||||
return const Text('请求失败');
|
||||
} else {
|
||||
//请求成功
|
||||
_itemDataList = snapshot.data!;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(
|
||||
child: _itemDataList.isEmpty
|
||||
? const NoData()
|
||||
: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
onRefresh: _refresh,
|
||||
onLoading: _loadMore,
|
||||
enablePullUp: true,
|
||||
enablePullDown: true,
|
||||
header: ClassicHeader(
|
||||
height: 45.h,
|
||||
releaseText: '松开手刷新',
|
||||
refreshingText: '刷新中',
|
||||
completeText: '刷新完成',
|
||||
failedText: '刷新失败',
|
||||
idleText: '下拉刷新',
|
||||
),
|
||||
child: _buildMainUI(_itemDataList),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.passwordKeyManagePage,
|
||||
arguments: {
|
||||
"lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
}),
|
||||
SizedBox(
|
||||
height: 42.h,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//请求未结束 显示loading
|
||||
return Container();
|
||||
}
|
||||
}),
|
||||
);
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() => state.itemDataList.value.isEmpty
|
||||
? const NoData()
|
||||
: _buildMainUI(state.itemDataList.value))),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyManagePage,
|
||||
arguments: {
|
||||
"lockMainEntity": state.lockMainEntity.value,
|
||||
"keyInfo": state.keyInfo.value
|
||||
}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
}
|
||||
});
|
||||
}),
|
||||
SizedBox(
|
||||
height: 42.h,
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
///加载更多函数
|
||||
Future<void> _loadMore() async {
|
||||
if (state.pageNum.value == 1) {
|
||||
if (_itemDataList.length < 10) {
|
||||
_refreshController.loadComplete();
|
||||
} else {
|
||||
state.pageNum.value++;
|
||||
await logic.mockNetworkDataRequest();
|
||||
_refreshController.loadComplete();
|
||||
}
|
||||
} else {
|
||||
state.pageNum.value++;
|
||||
await logic.mockNetworkDataRequest();
|
||||
_refreshController.loadComplete();
|
||||
}
|
||||
}
|
||||
// ///加载更多函数
|
||||
// Future<void> _loadMore() async {
|
||||
// if (state.pageNum.value == 1) {
|
||||
// if (state.itemDataList.length < 10) {
|
||||
// _refreshController.loadComplete();
|
||||
// } else {
|
||||
// state.pageNum.value++;
|
||||
// await logic.mockNetworkDataRequest();
|
||||
// _refreshController.loadComplete();
|
||||
// }
|
||||
// } else {
|
||||
// state.pageNum.value++;
|
||||
// await logic.mockNetworkDataRequest();
|
||||
// _refreshController.loadComplete();
|
||||
// }
|
||||
// }
|
||||
|
||||
///刷新函数
|
||||
Future<void> _refresh() async {
|
||||
state.pageNum.value = 1;
|
||||
await logic.mockNetworkDataRequest();
|
||||
_refreshController.refreshCompleted();
|
||||
}
|
||||
// ///刷新函数
|
||||
// Future<void> _refresh() async {
|
||||
// state.pageNum.value = 1;
|
||||
// await logic.mockNetworkDataRequest();
|
||||
// _refreshController.refreshCompleted();
|
||||
// }
|
||||
|
||||
Widget _searchWidget() {
|
||||
return Container(
|
||||
@ -157,7 +129,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
autofocus: false,
|
||||
|
||||
controller: state.searchController,
|
||||
onSubmitted: (value) {
|
||||
logic.mockNetworkDataRequest();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
@ -195,7 +170,12 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
|
||||
return _electronicKeyItem('images/controls_user.png',
|
||||
indexEntity.keyboardPwdName!, useDateStr, () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: {"itemData": indexEntity});
|
||||
arguments: {"itemData": indexEntity}).then((val) {
|
||||
if (val != null) {
|
||||
logic.mockNetworkDataRequest();
|
||||
}
|
||||
});
|
||||
;
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
class PasswordKeyListState {
|
||||
@ -6,6 +8,8 @@ class PasswordKeyListState {
|
||||
final lockMainEntity = LockMainEntity().obs;
|
||||
var pageNum = 1.obs; //请求页码
|
||||
final pageSize = 20.obs; //请求每页数据条数
|
||||
final itemDataList = <PasswordKeyListItem>[].obs;
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
PasswordKeyListState() {
|
||||
Map map = Get.arguments;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -26,7 +25,6 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -34,25 +32,21 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "演示模式",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
topTip(),
|
||||
topWidget(),
|
||||
Expanded(child: bottomWidget())
|
||||
],
|
||||
),
|
||||
));
|
||||
barTitle: "演示模式",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh - ScreenUtil().statusBarHeight * 2,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [topTip(), topWidget(), Expanded(child: bottomWidget())],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget topTip(){
|
||||
Widget topTip() {
|
||||
return Container(
|
||||
// height: 120.h,
|
||||
width: 1.sw,
|
||||
@ -61,7 +55,10 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: Text("提示:当前界面为展示界面,添加设备后才能继续使用", style: TextStyle(fontSize: 24.sp, color: AppColors.mainColor))),
|
||||
Expanded(
|
||||
child: Text("提示:当前界面为展示界面,添加设备后才能继续使用",
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: AppColors.mainColor))),
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -82,7 +79,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
child: Text(
|
||||
"TMH_78f16712781a",
|
||||
style:
|
||||
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
||||
TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400),
|
||||
)),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
@ -112,12 +109,12 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
children: [
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
gotoLogin();
|
||||
},
|
||||
child: Image.asset('images/main/icon_main_openLockBtn.png',
|
||||
width: 268.w, height: 268.w),
|
||||
)),
|
||||
onTap: () {
|
||||
gotoLogin();
|
||||
},
|
||||
child: Image.asset('images/main/icon_main_openLockBtn.png',
|
||||
width: 268.w, height: 268.w),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -168,12 +165,13 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
Text(
|
||||
'超级管理员',
|
||||
style:
|
||||
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 80.w,
|
||||
),
|
||||
Image.asset('images/main/icon_main_remoteUnlocking_grey.png',
|
||||
Image.asset(
|
||||
'images/main/icon_main_remoteUnlocking_grey.png',
|
||||
// state.keyInfos.value.remoteEnable == 1
|
||||
// ? 'images/main/icon_main_remoteUnlocking.png'
|
||||
// : 'images/main/icon_main_remoteUnlocking_grey.png',
|
||||
@ -189,7 +187,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
Text(
|
||||
'网关设备',
|
||||
style:
|
||||
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -227,58 +225,57 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
|
||||
// 考勤
|
||||
// if (state.keyInfos.value.isAttendance == 1) {
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
|
||||
TranslationLoader.lanKeys!.checkingIn!.tr, () {
|
||||
// gotoLogin();
|
||||
Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos());
|
||||
}));
|
||||
showWidgetArr.add(bottomItem('images/main/icon_main_clockingIn.png',
|
||||
TranslationLoader.lanKeys!.checkingIn!.tr, () {
|
||||
// gotoLogin();
|
||||
Get.toNamed(Routers.checkingInListPage, arguments: KeyInfos());
|
||||
}));
|
||||
// }
|
||||
|
||||
var defaultWidgetArr = [
|
||||
// 电子钥匙
|
||||
bottomItem('images/main/icon_main_electronicKey.png',
|
||||
TranslationLoader.lanKeys!.electronicKey!.tr, () {
|
||||
gotoLogin();
|
||||
// gotoLogin();
|
||||
|
||||
// Get.toNamed(Routers.electronicKeyListPage, arguments: {
|
||||
// "lockMainEntity": widget.lockMainEntity,
|
||||
// "keyInfo": widget.keyInfo
|
||||
// });
|
||||
}),
|
||||
Get.toNamed(Routers.electronicKeyListPage, arguments: {
|
||||
"lockMainEntity": LockMainEntity(),
|
||||
"keyInfo": KeyInfos()
|
||||
});
|
||||
}),
|
||||
|
||||
// 密码
|
||||
bottomItem('images/main/icon_main_password.png',
|
||||
TranslationLoader.lanKeys!.password!.tr, () {
|
||||
gotoLogin();
|
||||
|
||||
// Get.toNamed(Routers.passwordKeyListPage, arguments: {
|
||||
// "lockMainEntity": widget.lockMainEntity,
|
||||
// "keyInfo": widget.keyInfo
|
||||
// });
|
||||
}),
|
||||
|
||||
// ic卡
|
||||
bottomItem('images/main/icon_main_icCard.png', TranslationLoader.lanKeys!.card!.tr, () {
|
||||
// gotoLogin();
|
||||
|
||||
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||
"lockId": 0,
|
||||
"fromType": 0
|
||||
Get.toNamed(Routers.passwordKeyListPage, arguments: {
|
||||
"lockMainEntity": LockMainEntity(),
|
||||
"keyInfo": KeyInfos()
|
||||
});
|
||||
}),
|
||||
|
||||
// ic卡
|
||||
bottomItem('images/main/icon_main_icCard.png',
|
||||
TranslationLoader.lanKeys!.card!.tr, () {
|
||||
// gotoLogin();
|
||||
|
||||
Get.toNamed(Routers.otherTypeKeyListPage,
|
||||
arguments: {"lockId": 0, "fromType": 0});
|
||||
}),
|
||||
|
||||
// 指纹
|
||||
bottomItem('images/main/icon_main_fingerprint.png', TranslationLoader.lanKeys!.fingerprint!.tr, () {
|
||||
bottomItem('images/main/icon_main_fingerprint.png',
|
||||
TranslationLoader.lanKeys!.fingerprint!.tr, () {
|
||||
// gotoLogin();
|
||||
|
||||
Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||
"lockId": 1,
|
||||
"fromType": 1
|
||||
});
|
||||
Get.toNamed(Routers.otherTypeKeyListPage,
|
||||
arguments: {"lockId": 1, "fromType": 1});
|
||||
}),
|
||||
|
||||
// 遥控
|
||||
bottomItem('images/main/icon_main_remoteControl.png', TranslationLoader.lanKeys!.remoteControl!.tr, () {
|
||||
bottomItem('images/main/icon_main_remoteControl.png',
|
||||
TranslationLoader.lanKeys!.remoteControl!.tr, () {
|
||||
gotoLogin();
|
||||
|
||||
// Get.toNamed(Routers.otherTypeKeyListPage, arguments: {
|
||||
@ -315,25 +312,26 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
// 授权管理员
|
||||
bottomItem('images/main/icon_main_authorizedAdmin.png',
|
||||
TranslationLoader.lanKeys!.authorizedAdmin!.tr, () {
|
||||
gotoLogin();
|
||||
// gotoLogin();
|
||||
|
||||
// Get.toNamed(Routers.authorizedAdminListPage, arguments: {
|
||||
// "keyInfo": KeyInfos()
|
||||
// });
|
||||
}),
|
||||
Get.toNamed(Routers.authorizedAdminListPage, arguments: {
|
||||
"lockMainEntity": LockMainEntity(),
|
||||
"keyInfo": KeyInfos()
|
||||
});
|
||||
}),
|
||||
// 操作记录
|
||||
bottomItem('images/main/icon_main_operatingRecord.png',
|
||||
TranslationLoader.lanKeys!.operatingRecord!.tr, () {
|
||||
// gotoLogin();
|
||||
Get.toNamed(Routers.lockOperatingRecordPage, arguments: {
|
||||
"keyInfo": KeyInfos()
|
||||
});
|
||||
}),
|
||||
// gotoLogin();
|
||||
Get.toNamed(Routers.lockOperatingRecordPage,
|
||||
arguments: {"keyInfo": KeyInfos()});
|
||||
}),
|
||||
// 设置
|
||||
bottomItem(
|
||||
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr, () {
|
||||
Get.toNamed(Routers.demoModeLockSetPage);
|
||||
}),
|
||||
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
|
||||
() {
|
||||
Get.toNamed(Routers.demoModeLockSetPage);
|
||||
}),
|
||||
];
|
||||
showWidgetArr.addAll(endWiddget);
|
||||
return showWidgetArr;
|
||||
@ -345,7 +343,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
return GestureDetector(
|
||||
onTap: onClick,
|
||||
child: Container(
|
||||
// height: 300.h,
|
||||
// height: 300.h,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@ -367,7 +365,7 @@ class _DemoModeLockDetailPageState extends State<DemoModeLockDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void gotoLogin(){
|
||||
void gotoLogin() {
|
||||
// Get.toNamed(Routers.seletLockTypePage);
|
||||
Toast.show(msg: "演示模式");
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -100,15 +99,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
|
||||
Widget unHaveData() {
|
||||
return Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
margin: EdgeInsets.only(top: 180.h),
|
||||
// height: 330.w,
|
||||
// margin: EdgeInsets.only(top: 180.h),
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(width: 4.w, color: AppColors.mainColor),
|
||||
// borderRadius: BorderRadius.circular(110.w),
|
||||
@ -118,8 +117,8 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_unHaveLockData.png',
|
||||
width: 150.w,
|
||||
height: 150.w,
|
||||
width: 260.w,
|
||||
height: 260.w,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
@ -136,7 +135,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10.h),
|
||||
padding: EdgeInsets.all(30.w),
|
||||
child: Text(
|
||||
TranslationLoader
|
||||
.lanKeys!.whenAddingLockThePhoneMustBeNextToTheLock!.tr,
|
||||
@ -146,11 +145,14 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
color: Colors.black),
|
||||
)),
|
||||
SizedBox(
|
||||
height: 200.h,
|
||||
height: 160.h,
|
||||
),
|
||||
SubmitBtn(btnName: '演示模式', onClick: (){
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},)
|
||||
SubmitBtn(
|
||||
btnName: '演示模式',
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/network/api.dart';
|
||||
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -9,19 +10,6 @@ import '../../tools/commonItem.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
|
||||
// 网页的宏定义网址
|
||||
class XSWebviewURLMacro {
|
||||
static String baseWebURL = Api.baseAddress; //base地址
|
||||
static String userAgreementURL = '$baseWebURL/app/userAgreement'; //用户协议
|
||||
static String privacyPolicyURL = '$baseWebURL/app/privacy'; //隐私政策
|
||||
static String collectionListURL =
|
||||
'$baseWebURL/app/personalInformationCollectionList'; //个人信息收集清单
|
||||
static String thirdPartyInfShareListURL =
|
||||
'$baseWebURL/app/thirdPartyInformationSharingList'; //第三方信息共享清单
|
||||
static String appPermissionDescURL =
|
||||
'$baseWebURL/app/applicationPermissionDescription'; //应用权限说明
|
||||
}
|
||||
|
||||
class AbountPage extends StatefulWidget {
|
||||
const AbountPage({Key? key}) : super(key: key);
|
||||
|
||||
@ -72,7 +60,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSWebviewURLMacro.userAgreementURL,
|
||||
"url": XSConstantMacro.introduceURL,
|
||||
"title": '介绍'
|
||||
});
|
||||
}),
|
||||
@ -90,7 +78,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSWebviewURLMacro.userAgreementURL,
|
||||
"url": XSConstantMacro.userAgreementURL,
|
||||
"title": '用户协议'
|
||||
});
|
||||
}),
|
||||
@ -108,7 +96,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSWebviewURLMacro.privacyPolicyURL,
|
||||
"url": XSConstantMacro.privacyPolicyURL,
|
||||
"title": '隐私政策'
|
||||
});
|
||||
}),
|
||||
@ -127,7 +115,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSWebviewURLMacro.collectionListURL,
|
||||
"url": XSConstantMacro.collectionListURL,
|
||||
"title": '个人信息收集清单'
|
||||
});
|
||||
}),
|
||||
@ -146,7 +134,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSWebviewURLMacro.appPermissionDescURL,
|
||||
"url": XSConstantMacro.appPermissionDescURL,
|
||||
"title": '应用权限说明'
|
||||
});
|
||||
}),
|
||||
@ -165,7 +153,7 @@ class _AbountPageState extends State<AbountPage> {
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSWebviewURLMacro.thirdPartyInfShareListURL,
|
||||
"url": XSConstantMacro.thirdPartyInfShareListURL,
|
||||
"title": '第三方信息共享清单'
|
||||
});
|
||||
}),
|
||||
|
||||
@ -82,7 +82,7 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
|
||||
Obx(() => Padding(
|
||||
padding: EdgeInsets.only(left: 60.w, right: 60.w),
|
||||
child: Text(
|
||||
'请点击获取验证码,验证码将发送到${state.loginData.value.mobile}',
|
||||
'请点击获取验证码,验证码将发送到${state.accountStr.value}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
|
||||
),
|
||||
|
||||
@ -19,6 +19,9 @@ class SafeVerifyState {
|
||||
var xWidth = ''.obs; // 滑动验证码滑动位置
|
||||
var canSub = false.obs;
|
||||
var date = currentTimeMillis().toString().obs;
|
||||
var accountStr = ''.obs;
|
||||
var toggleStr = ''.obs; //可切换字眼
|
||||
var isToggle = false.obs; //是否点击切换
|
||||
|
||||
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
||||
|
||||
@ -42,6 +45,23 @@ class SafeVerifyState {
|
||||
print("getLoginData:$data");
|
||||
if (data != null && data.isNotEmpty) {
|
||||
loginData.value = LoginData.fromJson(jsonDecode(data));
|
||||
|
||||
//有手机号无邮箱 优先显示手机号 不可切换
|
||||
if (loginData.value.mobile!.isNotEmpty &&
|
||||
loginData.value.email!.isEmpty) {
|
||||
accountStr.value = loginData.value.mobile!;
|
||||
isToggle.value = false;
|
||||
} else if (loginData.value.mobile!.isNotEmpty &&
|
||||
loginData.value.email!.isNotEmpty) {
|
||||
//有手机号有邮箱 优先显示手机号 可切换至邮箱
|
||||
accountStr.value = loginData.value.mobile!;
|
||||
isToggle.value = true;
|
||||
} else if (loginData.value.mobile!.isNotEmpty &&
|
||||
loginData.value.email!.isNotEmpty) {
|
||||
//无手机号有邮箱 优先显示邮箱 不可切换
|
||||
accountStr.value = loginData.value.email!;
|
||||
isToggle.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
@ -133,7 +134,7 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
//使用期限
|
||||
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
@ -141,15 +142,15 @@ class _AdministratorDetailsPageState extends State<AdministratorDetailsPage> {
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)}\n${endDateStr.toLocal().toString().substring(0, 16)}';
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} 单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -69,7 +70,7 @@ class _AuthorizedAdministratorListPageState
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
_searchWidget(),
|
||||
// _searchWidget(),
|
||||
Expanded(child: _buildMainUI(itemList)),
|
||||
],
|
||||
);
|
||||
@ -212,7 +213,7 @@ class _AuthorizedAdministratorListPageState
|
||||
//使用期限
|
||||
String getUseDateStr(AuthorizedAdminListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||
DateTime startDateStr =
|
||||
@ -224,13 +225,13 @@ class _AuthorizedAdministratorListPageState
|
||||
} else {
|
||||
useDateStr = '限期';
|
||||
}
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
useDateStr = '永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
useDateStr = '单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ class LockUserManageListPage extends StatefulWidget {
|
||||
|
||||
class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
List<LockUserData> dataList = [];
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -94,8 +95,11 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
// controller: _controller,
|
||||
controller: searchController,
|
||||
autofocus: false,
|
||||
onSubmitted: (value) {
|
||||
lockUserListRequest();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(
|
||||
@ -140,7 +144,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
|
||||
//请求锁用户列表
|
||||
Future<List<LockUserData>> lockUserListRequest() async {
|
||||
LockUserListEntity entity =
|
||||
await ApiRepository.to.lockUserList('1', '20', '');
|
||||
await ApiRepository.to.lockUserList('1', '20', searchController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {
|
||||
dataList = entity.data!;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get_utils/get_utils.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -100,7 +101,7 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
//使用期限
|
||||
String getUseDateStr(KeyListItem indexEntity) {
|
||||
String useDateStr = '';
|
||||
if (indexEntity.keyType == 1) {
|
||||
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
|
||||
//限期
|
||||
if (indexEntity.startDate != null && indexEntity.endDate != null) {
|
||||
DateTime startDateStr =
|
||||
@ -112,13 +113,13 @@ class _OwnedKeyListPageState extends State<OwnedKeyListPage> {
|
||||
} else {
|
||||
useDateStr = '限期';
|
||||
}
|
||||
} else if (indexEntity.keyType == 2) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
useDateStr = '永久';
|
||||
} else if (indexEntity.keyType == 3) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
useDateStr = '单次';
|
||||
} else if (indexEntity.keyType == 4) {
|
||||
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr = '循环';
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
logic.userLogoutRequest();
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w),
|
||||
padding: EdgeInsets.only(right: 30.w, top: 30.h),
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
||||
@ -102,7 +102,8 @@ class ApiProvider extends BaseProvider {
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String keyRight) =>
|
||||
String keyRight,
|
||||
String searchStr) =>
|
||||
post(
|
||||
electronicKeyListURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -114,7 +115,8 @@ class ApiProvider extends BaseProvider {
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize,
|
||||
'startDate': startDate,
|
||||
'keyRight': keyRight
|
||||
'keyRight': keyRight,
|
||||
'searchStr': searchStr
|
||||
}));
|
||||
|
||||
Future<Response> sendElectronicKey(
|
||||
@ -331,12 +333,12 @@ class ApiProvider extends BaseProvider {
|
||||
post(getWifiServiceIpURL.toUrl, jsonEncode({}));
|
||||
|
||||
Future<Response> passwordKeyList(
|
||||
String keyStatus,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
) =>
|
||||
String keyStatus,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String searchStr) =>
|
||||
post(
|
||||
passwordKeyListURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -344,7 +346,8 @@ class ApiProvider extends BaseProvider {
|
||||
'lockId': lockId,
|
||||
'operatorUid': operatorUid,
|
||||
'pageNo': pageNo,
|
||||
'pageSize': pageSize
|
||||
'pageSize': pageSize,
|
||||
'searchStr': searchStr
|
||||
}));
|
||||
|
||||
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
|
||||
@ -968,7 +971,7 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 更新ICCard序号
|
||||
Future<Response> updateIdCardUserNoLoadData(
|
||||
String lockId, String cardId, String cardUserNo) =>
|
||||
String lockId, String cardId, String cardUserNo) =>
|
||||
post(
|
||||
updateICCardUserNoURL.toUrl,
|
||||
jsonEncode(
|
||||
|
||||
@ -128,9 +128,10 @@ class ApiRepository {
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String startDate,
|
||||
String keyRight) async {
|
||||
String keyRight,
|
||||
String searchStr) async {
|
||||
final res = await apiProvider.electronicKeyList(endDate, keyId, keyStatus,
|
||||
lockId, operatorUid, pageNo, pageSize, startDate, keyRight);
|
||||
lockId, operatorUid, pageNo, pageSize, startDate, keyRight, searchStr);
|
||||
return ElectronicKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -301,14 +302,14 @@ class ApiRepository {
|
||||
|
||||
//密码列表
|
||||
Future<PasswordKeyListEntity> passwordKeyList(
|
||||
String keyStatus,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
) async {
|
||||
String keyStatus,
|
||||
String lockId,
|
||||
String operatorUid,
|
||||
String pageNo,
|
||||
String pageSize,
|
||||
String searchStr) async {
|
||||
final res = await apiProvider.passwordKeyList(
|
||||
keyStatus, lockId, operatorUid, pageNo, pageSize);
|
||||
keyStatus, lockId, operatorUid, pageNo, pageSize, searchStr);
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user