添加删除锁接口与逻辑
This commit is contained in:
parent
62370f364a
commit
e91e45d71a
@ -1,9 +1,12 @@
|
|||||||
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:pull_to_refresh/pull_to_refresh.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
import 'tools/refreshHeadFoot.dart';
|
||||||
|
|
||||||
mixin BaseWidget {
|
mixin BaseWidget {
|
||||||
double fs(double value) => value.sp;
|
double fs(double value) => value.sp;
|
||||||
double w(double width) => width.w;
|
double w(double width) => width.w;
|
||||||
@ -44,4 +47,24 @@ mixin BaseWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SmartRefresher smartRefresher(RefreshController refreshController,{
|
||||||
|
Widget? child,
|
||||||
|
Function()? onRefresh,
|
||||||
|
Function()? onLoading,
|
||||||
|
bool enablePullDown = true,
|
||||||
|
bool enablePullUp = false,
|
||||||
|
bool enableTwoLevel = false,
|
||||||
|
}) => SmartRefresher(
|
||||||
|
controller: refreshController,
|
||||||
|
onRefresh: onRefresh,
|
||||||
|
onLoading: onLoading,
|
||||||
|
enablePullUp: enablePullUp,
|
||||||
|
enablePullDown: enablePullDown,
|
||||||
|
enableTwoLevel: enableTwoLevel,
|
||||||
|
header: const HeaderWidget(),
|
||||||
|
footer: const FooterWidget(),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,6 +62,14 @@ class DeletUserCommand extends SenderProtocol {
|
|||||||
data.addAll(utf8.encode(keyID!));
|
data.addAll(utf8.encode(keyID!));
|
||||||
data = getFixedLengthList(data, 40 - keyIDLength);
|
data = getFixedLengthList(data, 40 - keyIDLength);
|
||||||
|
|
||||||
|
//delUserID 20
|
||||||
|
int delUserIDLength = utf8.encode(delUserID!).length;
|
||||||
|
// print("${commandType!.typeValue}authUserIDLength:$authUserIDLength utf8.encode(authUserID!)${utf8.encode(authUserID!)}");
|
||||||
|
data.addAll(utf8.encode(delUserID!));
|
||||||
|
data = getFixedLengthList(data, 20 - delUserIDLength);
|
||||||
|
|
||||||
|
data.addAll(token!);
|
||||||
|
|
||||||
if(needAuthor == 0){
|
if(needAuthor == 0){
|
||||||
//AuthCodeLen 1
|
//AuthCodeLen 1
|
||||||
data.add(0);
|
data.add(0);
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class StarLockLoginLogic extends BaseGetXController{
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
// await StoreService.to.saveLogInInfo(entity);
|
// await StoreService.to.saveLogInInfo(entity);
|
||||||
stateMyLogic.saveLoginData(entity);
|
stateMyLogic.saveLoginData(entity.data);
|
||||||
// Get.back();
|
// Get.back();
|
||||||
Get.toNamed(Routers.starLockMain);
|
Get.toNamed(Routers.starLockMain);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_protocol/io_reply.dart';
|
import '../../../../blue/io_protocol/io_reply.dart';
|
||||||
import '../../../../blue/io_tool/io_manager.dart';
|
import '../../../../blue/io_tool/io_manager.dart';
|
||||||
import '../../../../blue/io_tool/io_tool.dart';
|
import '../../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../../blue/sender_manage.dart';
|
import '../../../../blue/sender_manage.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
import '../../../../tools/baseGetXController.dart';
|
import '../../../../tools/baseGetXController.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import 'lockSet_state.dart';
|
import 'lockSet_state.dart';
|
||||||
@ -18,6 +20,15 @@ import 'lockSet_state.dart';
|
|||||||
class LockSetLogic extends BaseGetXController{
|
class LockSetLogic extends BaseGetXController{
|
||||||
final LockSetState state = LockSetState();
|
final LockSetState state = LockSetState();
|
||||||
|
|
||||||
|
void deletLockInfoData() async{
|
||||||
|
var entity = await ApiRepository.to.deletLockData(
|
||||||
|
lockId:state.getKeyInfosData.value.lockId.toString(),
|
||||||
|
);
|
||||||
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
Get.offAllNamed(Routers.starLockMain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||||
@ -32,12 +43,28 @@ class LockSetLogic extends BaseGetXController{
|
|||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
print("${reply.commandType}解析成功");
|
print("${reply.commandType}解析成功");
|
||||||
|
deletLockInfoData();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
print("${reply.commandType}需要鉴权");
|
print("${reply.commandType}需要鉴权");
|
||||||
|
|
||||||
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
|
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||||
|
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||||
|
|
||||||
|
IoSenderManage.deletUser(
|
||||||
|
lockID:BlueManage().connectDeviceName,
|
||||||
|
authUserID:"100001",
|
||||||
|
keyID:"1",
|
||||||
|
delUserID:"100001",
|
||||||
|
needAuthor:1,
|
||||||
|
publicKey:publicKeyDataList,
|
||||||
|
privateKey:getPrivateKeyList,
|
||||||
|
token: tokenData
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||||
|
|
||||||
class LockSetState {
|
class LockSetState {
|
||||||
|
var getKeyInfosData = KeyInfos().obs;
|
||||||
|
|
||||||
|
LockSetState() {
|
||||||
|
getKeyInfosData.value = Get.arguments as KeyInfos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||||||
@ -14,6 +15,7 @@ import '../../../blue/io_tool/io_manager.dart';
|
|||||||
import '../../../blue/io_tool/io_tool.dart';
|
import '../../../blue/io_tool/io_tool.dart';
|
||||||
import '../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../blue/sender_manage.dart';
|
import '../../../blue/sender_manage.dart';
|
||||||
|
import '../../../login/login/entity/LoginData.dart';
|
||||||
import '../../../tools/baseGetXController.dart';
|
import '../../../tools/baseGetXController.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
import 'lockDetail_state.dart';
|
import 'lockDetail_state.dart';
|
||||||
@ -308,11 +310,18 @@ class LockDetailLogic extends BaseGetXController{
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
print("openDoorTokenPubToken:$getTokenList");
|
print("openDoorTokenPubToken:$getTokenList");
|
||||||
|
|
||||||
|
// var userId = "";
|
||||||
|
// final data = await Storage.getString('userLoginData');
|
||||||
|
// print("getLoginData:$data");
|
||||||
|
// if (data != null && data.isNotEmpty) {
|
||||||
|
// userId = LoginData.fromJson(jsonDecode(data)).userid as String;
|
||||||
|
// }
|
||||||
|
|
||||||
IoSenderManage.senderOpenLock(
|
IoSenderManage.senderOpenLock(
|
||||||
keyID: "1",
|
keyID: "1",
|
||||||
userID: "100001",
|
userID: "10001",
|
||||||
openMode: 1,
|
openMode: 1,
|
||||||
openTime: 0x11223344,
|
openTime: DateTime.now().millisecondsSinceEpoch,
|
||||||
token: getTokenList,
|
token: getTokenList,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
|
|||||||
@ -9,9 +9,11 @@ import '../../lockMian/entity/lockInfoEntity.dart';
|
|||||||
import 'lockDetail_logic.dart';
|
import 'lockDetail_logic.dart';
|
||||||
|
|
||||||
class LockDetailPage extends StatefulWidget {
|
class LockDetailPage extends StatefulWidget {
|
||||||
|
final isFrist;
|
||||||
|
final KeyInfos keyInfo;
|
||||||
final LockMainEntity lockMainEntity;
|
final LockMainEntity lockMainEntity;
|
||||||
|
|
||||||
const LockDetailPage({Key? key, required this.lockMainEntity})
|
const LockDetailPage({Key? key, required this.lockMainEntity, required this.isFrist, required this.keyInfo})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -26,10 +28,13 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh,
|
height: 1.sh - ScreenUtil().statusBarHeight*2,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [topWidget(), Expanded(child: bottomWidget())],
|
children: [
|
||||||
|
topWidget(),
|
||||||
|
Expanded(child: bottomWidget())
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -182,7 +187,7 @@ class _LockDetailPageState extends State<LockDetailPage> {
|
|||||||
}),
|
}),
|
||||||
bottomItem('images/main/icon_main_set.png',
|
bottomItem('images/main/icon_main_set.png',
|
||||||
TranslationLoader.lanKeys!.set!.tr, () {
|
TranslationLoader.lanKeys!.set!.tr, () {
|
||||||
Navigator.pushNamed(context, Routers.lockSetPage);
|
Navigator.pushNamed(context, Routers.lockSetPage, arguments: widget.keyInfo);
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
|
|
||||||
import '../../../blue/io_tool/manager_event_bus.dart';
|
import '../../../blue/io_tool/manager_event_bus.dart';
|
||||||
import '../../../network/api_repository.dart';
|
import '../../../network/api_repository.dart';
|
||||||
@ -9,12 +11,38 @@ import 'lockMain_state.dart';
|
|||||||
class LockMainLogic extends BaseGetXController {
|
class LockMainLogic extends BaseGetXController {
|
||||||
final LockMainState state = LockMainState();
|
final LockMainState state = LockMainState();
|
||||||
|
|
||||||
|
var page = 1;
|
||||||
|
// final RefreshController refreshController = RefreshController(
|
||||||
|
// initialRefresh: false
|
||||||
|
// );
|
||||||
|
|
||||||
|
/// 下拉刷新方法
|
||||||
|
// void onRefresh() {
|
||||||
|
// page = 1;
|
||||||
|
// getLockInfo();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// void onLoading() {
|
||||||
|
// getLockInfo();
|
||||||
|
// }
|
||||||
|
|
||||||
void getLockInfo() async{
|
void getLockInfo() async{
|
||||||
var entity = await ApiRepository.to.getLockInfo(
|
var entity = await ApiRepository.to.getLockInfo(
|
||||||
lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
|
lastUpdateDate:DateTime.now().millisecondsSinceEpoch.toString(),
|
||||||
pageNo:"1",
|
pageNo:page.toString(),
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
|
// if (page == 0) {
|
||||||
|
// refreshController.refreshCompleted();
|
||||||
|
// } else {
|
||||||
|
// if (entity.data!.keyInfos!.isEmpty) {
|
||||||
|
// refreshController.loadNoData();
|
||||||
|
// } else {
|
||||||
|
// refreshController.loadComplete();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// page++;
|
||||||
|
|
||||||
if(entity.data!.keyInfos!.isEmpty){
|
if(entity.data!.keyInfos!.isEmpty){
|
||||||
state.dataLength.value = 0;
|
state.dataLength.value = 0;
|
||||||
}else if(entity.data!.keyInfos!.length == 1){
|
}else if(entity.data!.keyInfos!.length == 1){
|
||||||
@ -23,7 +51,10 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
state.dataLength.value = 2;
|
state.dataLength.value = 2;
|
||||||
}
|
}
|
||||||
state.lockMainEntity.value = entity;
|
state.lockMainEntity.value = entity;
|
||||||
|
}else{
|
||||||
|
// refreshController.loadFailed();
|
||||||
}
|
}
|
||||||
|
// refreshController.refreshCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
@ -56,6 +87,8 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
|
// refreshController.dispose();
|
||||||
_addLockSubscription.cancel();
|
_addLockSubscription.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
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:pull_to_refresh/pull_to_refresh.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../baseWidget.dart';
|
import '../../../baseWidget.dart';
|
||||||
import '../../../mine/mine/starLockMine_page.dart';
|
import '../../../mine/mine/starLockMine_page.dart';
|
||||||
|
import '../../../tools/refreshHeadFoot.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
import '../../../translations/trans_lib.dart';
|
import '../../../translations/trans_lib.dart';
|
||||||
import '../../lockDetail/lockDetail/lockDetail_page.dart';
|
import '../../lockDetail/lockDetail/lockDetail_page.dart';
|
||||||
@ -62,7 +64,12 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
width: 1.sw / 3 * 2,
|
width: 1.sw / 3 * 2,
|
||||||
child: const StarLockMinePage(),
|
child: const StarLockMinePage(),
|
||||||
),
|
),
|
||||||
body: Obx(() => getDataReturnUI(state.dataLength.value, )),
|
body: Obx(() => getDataReturnUI(state.dataLength.value)),
|
||||||
|
// body:smartRefresher(
|
||||||
|
// logic.refreshController,
|
||||||
|
// onRefresh:logic.onRefresh,
|
||||||
|
// onLoading:logic.onLoading,
|
||||||
|
// child:Obx(() => getDataReturnUI(state.dataLength.value))),
|
||||||
// body: getLockList(),
|
// body: getLockList(),
|
||||||
// body: unHaveData(),
|
// body: unHaveData(),
|
||||||
);
|
);
|
||||||
@ -75,7 +82,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
returnWidget = unHaveData();
|
returnWidget = unHaveData();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
returnWidget = LockDetailPage(lockMainEntity: logic.state.lockMainEntity.value);
|
returnWidget = LockDetailPage(lockMainEntity: logic.state.lockMainEntity.value, isFrist: true, keyInfo:logic.state.lockMainEntity.value.data!.keyInfos![0]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
returnWidget = LockListPage(lockMainEntity:logic.state.lockMainEntity.value);
|
returnWidget = LockListPage(lockMainEntity:logic.state.lockMainEntity.value);
|
||||||
|
|||||||
@ -89,7 +89,7 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>{
|
|||||||
if (addressInfo?['latitude'] == null ||
|
if (addressInfo?['latitude'] == null ||
|
||||||
addressInfo?['longitude'] == null ||
|
addressInfo?['longitude'] == null ||
|
||||||
addressInfo?['errorCode'] == 0) {
|
addressInfo?['errorCode'] == 0) {
|
||||||
return const Text('Sorry');
|
return const Center(child: Text('地图加载中,请稍候。。。'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var latitude = 39.909187;
|
var latitude = 39.909187;
|
||||||
|
|||||||
@ -257,7 +257,7 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if(entity.errorCode!.codeIsSuccessful){
|
||||||
EventBusManager().eventBusFir(RefreshLockListInfoDataEvent);
|
EventBusManager().eventBusFir(RefreshLockListInfoDataEvent);
|
||||||
Get.toNamed(Routers.starLockMain);
|
Get.offAllNamed(Routers.starLockMain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,11 @@ import '../../login/login/entity/LoginEntity.dart';
|
|||||||
import '../../tools/storage.dart';
|
import '../../tools/storage.dart';
|
||||||
|
|
||||||
class StarLockMineState {
|
class StarLockMineState {
|
||||||
final loginData = LoginEntity().obs;
|
final loginData = LoginData().obs;
|
||||||
|
|
||||||
///本地存储 登录信息
|
///本地存储 登录信息
|
||||||
void saveLoginData(LoginEntity data) async {
|
void saveLoginData(LoginData? data) async {
|
||||||
print("saveLoginData:${data.data!.mobile}");
|
print("saveLoginData:${data!.mobile}");
|
||||||
await Storage.setString('userLoginData', jsonEncode(data));
|
await Storage.setString('userLoginData', jsonEncode(data));
|
||||||
loginData.value = data;
|
loginData.value = data;
|
||||||
}
|
}
|
||||||
@ -21,28 +21,28 @@ class StarLockMineState {
|
|||||||
final data = await Storage.getString('userLoginData');
|
final data = await Storage.getString('userLoginData');
|
||||||
print("getLoginData:$data");
|
print("getLoginData:$data");
|
||||||
if (data != null && data.isNotEmpty) {
|
if (data != null && data.isNotEmpty) {
|
||||||
loginData.value = LoginEntity.fromJson(jsonDecode(data));
|
loginData.value = LoginData.fromJson(jsonDecode(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///退出登录
|
///退出登录
|
||||||
void logOut() async {
|
void logOut() async {
|
||||||
await Storage.setString('userLoginData', '');
|
await Storage.setString('userLoginData', '');
|
||||||
loginData.value = LoginEntity();
|
loginData.value = LoginData();
|
||||||
}
|
}
|
||||||
|
|
||||||
///用户登录token
|
///用户登录token
|
||||||
String token() {
|
String token() {
|
||||||
return loginData.value.data?.accessToken ?? '';
|
return loginData.value.accessToken ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
String mobile() {
|
String mobile() {
|
||||||
return loginData.value.data?.mobile ?? '-';
|
return loginData.value.mobile ?? '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
///用户头像
|
///用户头像
|
||||||
String headUrl() {
|
String headUrl() {
|
||||||
return loginData.value.data!.headUrl ?? '';
|
return loginData.value.headUrl ?? '';
|
||||||
// return "https://img2.woyaogexing.com/2022/04/14/156cdbabd5bc496abee2cd0fca527434!400x400.jpeg";
|
// return "https://img2.woyaogexing.com/2022/04/14/156cdbabd5bc496abee2cd0fca527434!400x400.jpeg";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ abstract class Api {
|
|||||||
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
final String passwordKeyResetURL = '/keyboardPwd/reset'; //密码钥匙重置
|
||||||
|
|
||||||
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
final String getLockInfoURL = '/lock/syncDataPage'; // 获取锁信息
|
||||||
|
final String deletLockURL = '/lock/delete'; // 删除锁
|
||||||
|
|
||||||
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
final String passwordKeyGetURL = '/keyboardPwd/get'; //获取密码
|
||||||
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
final String clearOperationRecordURL = '/lockRecords/clear'; //清空操作记录
|
||||||
|
|||||||
@ -260,6 +260,15 @@ class ApiProvider extends BaseProvider {
|
|||||||
"pageNo": pageNo,
|
"pageNo": pageNo,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// 删除锁
|
||||||
|
Future<Response> deletLockInfo(
|
||||||
|
String lockId) =>
|
||||||
|
post(
|
||||||
|
deletLockURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'lockId': lockId,
|
||||||
|
}));
|
||||||
|
|
||||||
Future<Response> passwordKeyList(
|
Future<Response> passwordKeyList(
|
||||||
String keyStatus,
|
String keyStatus,
|
||||||
String lockId,
|
String lockId,
|
||||||
|
|||||||
@ -259,6 +259,13 @@ class ApiRepository {
|
|||||||
return LockMainEntity.fromJson(res.body);
|
return LockMainEntity.fromJson(res.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除锁
|
||||||
|
Future<LockMainEntity> deletLockData({
|
||||||
|
required String lockId}) async {
|
||||||
|
final res = await apiProvider.deletLockInfo(lockId);
|
||||||
|
return LockMainEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
//获取密码
|
//获取密码
|
||||||
Future<PasswordKeyEntity> getPasswordKey(
|
Future<PasswordKeyEntity> getPasswordKey(
|
||||||
String endDate,
|
String endDate,
|
||||||
|
|||||||
49
star_lock/lib/tools/refreshHeadFoot.dart
Normal file
49
star_lock/lib/tools/refreshHeadFoot.dart
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
|
|
||||||
|
//用于下拉刷新 头布局
|
||||||
|
class HeaderWidget extends StatelessWidget {
|
||||||
|
const HeaderWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const WaterDropHeader(
|
||||||
|
refresh: CupertinoActivityIndicator(),
|
||||||
|
complete: CupertinoActivityIndicator(),
|
||||||
|
idleIcon: CupertinoActivityIndicator(),
|
||||||
|
// waterDropColor: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//用于上拉加载 底部布局
|
||||||
|
class FooterWidget extends StatelessWidget {
|
||||||
|
const FooterWidget({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CustomFooter(
|
||||||
|
builder: (BuildContext context, LoadStatus? mode) {
|
||||||
|
Widget body;
|
||||||
|
if (mode == LoadStatus.idle) {
|
||||||
|
body = const Text("上拉加载");
|
||||||
|
} else if (mode == LoadStatus.loading) {
|
||||||
|
body = const CupertinoActivityIndicator();
|
||||||
|
} else if (mode == LoadStatus.failed) {
|
||||||
|
body = const Text("加载失败");
|
||||||
|
} else if (mode == LoadStatus.canLoading) {
|
||||||
|
body = const Text("加载更多");
|
||||||
|
} else if(mode == LoadStatus.noMore){
|
||||||
|
body = const Text("没有更多数据");
|
||||||
|
}else{
|
||||||
|
// body = Text("没有更多数据");
|
||||||
|
body = Text("");
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
height: 55.0,
|
||||||
|
child: Center(child: body),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -89,6 +89,9 @@ dependencies:
|
|||||||
crypto: ^3.0.3
|
crypto: ^3.0.3
|
||||||
date_format: ^2.0.7
|
date_format: ^2.0.7
|
||||||
|
|
||||||
|
# 下拉刷新
|
||||||
|
pull_to_refresh: ^2.0.0
|
||||||
|
|
||||||
#高德地图定位
|
#高德地图定位
|
||||||
amap_flutter_location: ^3.0.0
|
amap_flutter_location: ^3.0.0
|
||||||
#权限使用
|
#权限使用
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user