更多设置提示音接口对接
触摸开锁接口对接逻辑未完善
This commit is contained in:
parent
015a19a944
commit
ec5e454cdd
@ -30,17 +30,17 @@ class UserSettingInfoEntity {
|
||||
|
||||
class UserSettingInfoData {
|
||||
UserSettings? userSettings;
|
||||
Null? hasXmeyeLock;
|
||||
Null? hasMoreService;
|
||||
Null? isReply;
|
||||
Null? paidUserStatus;
|
||||
Null? hasAdvert;
|
||||
Null? hasAlexa;
|
||||
Null? isUserSettingCompleted;
|
||||
Null? hasPaidFeature;
|
||||
Null? hasCameraLock;
|
||||
Null? hasGoogleHome;
|
||||
Null? alertMode;
|
||||
int? hasXmeyeLock;
|
||||
int? hasMoreService;
|
||||
int? isReply;
|
||||
int? paidUserStatus;
|
||||
int? hasAdvert;
|
||||
int? hasAlexa;
|
||||
int? isUserSettingCompleted;
|
||||
int? hasPaidFeature;
|
||||
int? hasCameraLock;
|
||||
int? hasGoogleHome;
|
||||
int? alertMode;
|
||||
|
||||
UserSettingInfoData(
|
||||
{this.userSettings,
|
||||
@ -94,19 +94,19 @@ class UserSettingInfoData {
|
||||
}
|
||||
|
||||
class UserSettings {
|
||||
Null? touchUnlockFlag;
|
||||
Null? modifyManagePwdFlag;
|
||||
Null? gesturePassword;
|
||||
Null? resetFlag;
|
||||
Null? delManagerFlag;
|
||||
Null? hideExpiredAccessFlag;
|
||||
Null? sendKeyFlag;
|
||||
Null? viberateFlag;
|
||||
Null? lockScreen;
|
||||
Null? authorizeFlag;
|
||||
Null? sendPwdFlag;
|
||||
Null? alertToneFlag;
|
||||
Null? status;
|
||||
int? touchUnlockFlag;
|
||||
int? modifyManagePwdFlag;
|
||||
String? gesturePassword;
|
||||
int? resetFlag;
|
||||
int? delManagerFlag;
|
||||
int? hideExpiredAccessFlag;
|
||||
int? sendKeyFlag;
|
||||
int? viberateFlag;
|
||||
int? lockScreen;
|
||||
int? authorizeFlag;
|
||||
int? sendPwdFlag;
|
||||
int? alertToneFlag;
|
||||
int? status;
|
||||
|
||||
UserSettings(
|
||||
{this.touchUnlockFlag,
|
||||
@ -1,6 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/submitBtn.dart';
|
||||
@ -15,8 +19,30 @@ class LockScreenPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LockScreenPageState extends State<LockScreenPage> {
|
||||
bool _isOn = true;
|
||||
bool _isFirst = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_isFirst = true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_isFirst) {
|
||||
dynamic obj = ModalRoute.of(context)?.settings.arguments;
|
||||
if (obj != null && (obj["isOn"] != null)) {
|
||||
int getValue = obj["isOn"];
|
||||
if (getValue == 1) {
|
||||
_isOn = true;
|
||||
} else {
|
||||
_isOn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
@ -46,7 +72,7 @@ class _LockScreenPageState extends State<LockScreenPage> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${TranslationLoader.lanKeys!.currentMode!.tr} : ${TranslationLoader.lanKeys!.opened!.tr}",
|
||||
"${TranslationLoader.lanKeys!.currentMode!.tr} : ${_isOn == true ? TranslationLoader.lanKeys!.opened!.tr : TranslationLoader.lanKeys!.closed!.tr}",
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.w600, fontSize: 22.sp),
|
||||
)),
|
||||
@ -56,10 +82,27 @@ class _LockScreenPageState extends State<LockScreenPage> {
|
||||
height: 40.h,
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.closed!.tr,
|
||||
onClick: () {}),
|
||||
btnName: _isOn == true
|
||||
? TranslationLoader.lanKeys!.open!.tr
|
||||
: TranslationLoader.lanKeys!.closed!.tr,
|
||||
onClick: () {
|
||||
_isFirst = false;
|
||||
setState(() {
|
||||
_isOn = !_isOn;
|
||||
});
|
||||
changeSettingsRequest();
|
||||
}),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
//锁屏/隐藏无效开锁权限 1:锁屏 2:隐藏无效开锁权限
|
||||
Future<void> changeSettingsRequest() async {
|
||||
ExpireLockListEntity entity =
|
||||
await ApiRepository.to.changeSettings(_isOn == true ? '1' : '2', '1');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: '操作成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
@ -24,11 +25,13 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
late bool _isPrompTone = false; //提示音
|
||||
late bool _isTouchUnlock = false; //触摸开锁
|
||||
late bool _isPushNotification = false; //消息推送
|
||||
late UserSettingInfoData _userInfoData;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_userInfoData = UserSettingInfoData();
|
||||
userSettingsInfoRequest();
|
||||
}
|
||||
|
||||
@ -143,7 +146,12 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.lockScreenPage);
|
||||
Navigator.pushNamed(context, Routers.lockScreenPage,
|
||||
arguments: {
|
||||
'isOn': _userInfoData.userSettings!.lockScreen
|
||||
}).then((value) {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader
|
||||
@ -244,10 +252,25 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
);
|
||||
}
|
||||
|
||||
//用户信息
|
||||
Future<void> userSettingsInfoRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to.userSettingsInfo();
|
||||
UserSettingInfoEntity entity = await ApiRepository.to.userSettingsInfo();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {});
|
||||
setState(() {
|
||||
_userInfoData = entity.data!;
|
||||
//提示音
|
||||
if (_userInfoData.alertMode == 1) {
|
||||
_isPrompTone = true;
|
||||
} else {
|
||||
_isPrompTone = false;
|
||||
}
|
||||
//触摸开锁
|
||||
if (_userInfoData.userSettings!.touchUnlockFlag! == 1) {
|
||||
_isTouchUnlock = true;
|
||||
} else {
|
||||
_isTouchUnlock = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +279,20 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setAlertMode('1', _isPrompTone == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {});
|
||||
setState(() {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//更新触摸开锁
|
||||
Future<void> updateTouchUnlockRequest() async {
|
||||
ExpireLockListEntity entity = await ApiRepository.to
|
||||
.setTouchUnlockFlag(_isTouchUnlock == true ? '1' : '2');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
setState(() {
|
||||
userSettingsInfoRequest();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,8 +314,10 @@ class _MineSetPageState extends State<MineSetPage> {
|
||||
setState(() {
|
||||
if (switchIndex == 0) {
|
||||
_isPrompTone = !_isPrompTone;
|
||||
updatePrompToneRequest();
|
||||
} else if (switchIndex == 1) {
|
||||
_isTouchUnlock = !_isTouchUnlock;
|
||||
updateTouchUnlockRequest();
|
||||
} else if (switchIndex == 2) {
|
||||
_isPushNotification = !_isPushNotification;
|
||||
}
|
||||
|
||||
@ -99,6 +99,8 @@ abstract class Api {
|
||||
final String updateAdministratorURL =
|
||||
'/authorizedAdmin/update'; //管理员姓名/有效期/远程开锁修改
|
||||
final String expireLockListURL = '/keyUser/listExpireUser'; //即将到期的锁列表
|
||||
final String setAlertModeURL = '/user/setAlertMode'; //提示音
|
||||
final String userSettingsInfoURL = '/user/userSettingsInfo'; //个人设置信息
|
||||
final String setAlertModeURL = '/user/setAlertMode'; //提示音
|
||||
final String setTouchUnlockFlagURL = '/user/setTouchUnlockFlag'; //触摸开锁
|
||||
final String changeSettingsURL = '/user/changeSettings'; //锁屏/隐藏无效开锁权限
|
||||
}
|
||||
|
||||
@ -955,6 +955,12 @@ class ApiProvider extends BaseProvider {
|
||||
setAlertModeURL.toUrl,
|
||||
jsonEncode({'alertMode': alertMode, 'isOn': isOn}));
|
||||
|
||||
Future<Response> changeSettings(String isOn, String type) =>
|
||||
post(changeSettingsURL.toUrl, jsonEncode({'isOn': isOn, 'type': type}));
|
||||
|
||||
Future<Response> setTouchUnlockFlag(String isOn) =>
|
||||
post(setTouchUnlockFlagURL.toUrl, jsonEncode({'isOn': isOn}));
|
||||
|
||||
Future<Response> userSettingsInfo() =>
|
||||
post(userSettingsInfoURL.toUrl, jsonEncode({}));
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/lockSeletGrou
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/entity/userSettingInfoEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/keyListByUserEntity.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
@ -656,12 +657,24 @@ class ApiRepository {
|
||||
return ExpireLockListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//个人设置信息
|
||||
Future<ExpireLockListEntity> userSettingsInfo() async {
|
||||
final res = await apiProvider.userSettingsInfo();
|
||||
//触摸开锁
|
||||
Future<ExpireLockListEntity> setTouchUnlockFlag(String isOn) async {
|
||||
final res = await apiProvider.setTouchUnlockFlag(isOn);
|
||||
return ExpireLockListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//触摸开锁
|
||||
Future<ExpireLockListEntity> changeSettings(String isOn, String type) async {
|
||||
final res = await apiProvider.changeSettings(isOn, type);
|
||||
return ExpireLockListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//个人设置信息
|
||||
Future<UserSettingInfoEntity> userSettingsInfo() async {
|
||||
final res = await apiProvider.userSettingsInfo();
|
||||
return UserSettingInfoEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 开启考勤 获取考勤信息
|
||||
Future<CheckingInInfoDataEntity> openCheckingInData(
|
||||
{required String lockId}) async {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user