Merge branch 'master_hyx'

This commit is contained in:
ante 2024-04-16 09:58:30 +08:00
commit 3d491ffaf2
8 changed files with 183 additions and 115 deletions

View File

@ -687,6 +687,7 @@
"虹膜":"虹膜",
"手掌":"手掌",
"商城":"商城",
"我的":"我的"
}

View File

@ -0,0 +1,25 @@
class FaceAuthenticationEntity {
FaceAuthenticationEntity({
this.description,
this.errorCode,
this.errorMsg,
});
FaceAuthenticationEntity.fromJson(dynamic json) {
description = json['description'];
errorCode = json['errorCode'];
errorMsg = json['errorMsg'];
}
String? description;
int? errorCode;
String? errorMsg;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['description'] = description;
map['errorCode'] = errorCode;
map['errorMsg'] = errorMsg;
return map;
}
}

View File

@ -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/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/commonItem.dart';
import '../../../tools/titleAppBar.dart';
@ -18,29 +19,33 @@ class _ValueAddedServicesRealNamePageState
extends State<ValueAddedServicesRealNamePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
Container(
width: 1.sw,
// color: Colors.grey.shade300,
padding: EdgeInsets.only(
left: 25.h, right: 25.h, top: 25.h, bottom: 10.h),
child: Text(
TranslationLoader.lanKeys!.buyRealNameTip!.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 20.sp),
)),
middleWidget(),
bottomWidget()
],
),
);
return GetBuilder<ValueAddedServicesRealNameLogic>(
init: ValueAddedServicesRealNameLogic(),
builder: (ValueAddedServicesRealNameLogic logic) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: TranslationLoader.lanKeys!.realNameAuthentication!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
Container(
width: 1.sw,
// color: Colors.grey.shade300,
padding: EdgeInsets.only(
left: 25.h, right: 25.h, top: 25.h, bottom: 10.h),
child: Text(
TranslationLoader.lanKeys!.buyRealNameTip!.tr,
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 20.sp),
)),
middleWidget(),
bottomWidget()
],
),
);
});
}
Widget middleWidget() {
@ -112,98 +117,65 @@ class _ValueAddedServicesRealNamePageState
}
Widget bottomWidget() {
return Container(
width: 1.sw,
color: Colors.white,
margin: EdgeInsets.all(20.h),
child: Column(
children: [
Column(
return GetBuilder<ValueAddedServicesRealNameLogic>(
builder: (ValueAddedServicesRealNameLogic logic) {
return Container(
width: 1.sw,
color: Colors.white,
margin: EdgeInsets.all(20.h),
child: Column(
children: [
Column(
children: [
Container(
padding:
EdgeInsets.only(top: 20.h, bottom: 20.h, left: 30.w),
child: Text(
TranslationLoader
.lanKeys!.buyRealNameSelectYouWantBuyTip!.tr,
style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600),
)),
],
),
checkCommonItem(
logic, TranslationLoader.lanKeys!.forTheFirstTime!.tr, 0),
checkCommonItem(logic, TranslationLoader.lanKeys!.onceDay!.tr, 1),
checkCommonItem(logic, TranslationLoader.lanKeys!.weekOnce!.tr, 2),
checkCommonItem(logic, TranslationLoader.lanKeys!.monthOnce!.tr, 3,
isHaveLine: false, isHaveRightWidget: true),
],
),
);
});
}
//
Widget checkCommonItem(
ValueAddedServicesRealNameLogic logic, String text, int index,
{bool isHaveLine = true, bool isHaveRightWidget = true}) {
bool check = logic.state.index == index;
return CommonItem(
leftTitel: text,
rightTitle: "",
allHeight: 60.h,
isHaveLine: isHaveLine,
isHaveRightWidget: isHaveRightWidget,
rightWidget: GestureDetector(
onTap: () {
logic.check(index);
},
child: Row(
children: [
Container(
padding: EdgeInsets.only(top: 20.h, bottom: 20.h, left: 30.w),
child: Text(
TranslationLoader
.lanKeys!.buyRealNameSelectYouWantBuyTip!.tr,
style:
TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w600),
)),
Image.asset(
check
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
],
),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.forTheFirstTime!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
],
),
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.onceDay!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
],
),
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.weekOnce!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
],
),
)),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.monthOnce!.tr,
rightTitle: "",
allHeight: 60.h,
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: GestureDetector(
onTap: () {},
child: Row(
children: [
Image.asset(
'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
],
),
)),
],
),
);
));
}
}

View File

@ -0,0 +1,46 @@
import 'dart:async';
import 'package:get/utils.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/face_authentication_entity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import '../../../network/api_repository.dart';
import '../../../tools/eventBusEventManage.dart';
class ValueAddedServicesRealNameLogic extends BaseGetXController {
final ValueAddedServicesRealNameState state =
ValueAddedServicesRealNameState();
//
Future<bool> setFaceAuthentication(int faceAuthFrequence) async {
FaceAuthenticationEntity entity =
await ApiRepository.to.setFaceAuthentication(
faceAuthFrequence: faceAuthFrequence,
);
return entity.errorCode!.codeIsSuccessful;
}
Future<void> check(int index) async {
bool isSuccessful = await setFaceAuthentication(state.index + 1);
if (isSuccessful) {
showToast('修改成功'.tr);
state.index = index;
}
update();
}
@override
void onReady() {
super.onReady();
}
@override
void onInit() {
super.onInit();
}
@override
void onClose() {
super.onClose();
}
}

View File

@ -0,0 +1,3 @@
class ValueAddedServicesRealNameState {
int index = 0;
}

View File

@ -45,7 +45,8 @@ abstract class Api {
final String passwordKeyGetURL = '/keyboardPwd/get'; //
final String passwordKeyAddURL = '/keyboardPwd/add'; //
final String passwordKeyCheckKeyboardpwdNameURL = '/keyboardPwd/checkKeyboardpwdName'; //
final String passwordKeyCheckKeyboardpwdNameURL =
'/keyboardPwd/checkKeyboardpwdName'; //
final String updatePasswordKeyURL = '/keyboardPwd/update'; //
final String clearOperationRecordURL = '/lockRecords/clear'; //
final String addlockGroupURL = '/keyGroup/add'; //
@ -175,7 +176,8 @@ abstract class Api {
'/safeAnswer/getOwnQuestionList'; //
final String updateSafeAnswerURL = '/safeAnswer/update'; //
final String setSafeAnswerURL = '/safeAnswer/set'; //
final String getUpTokenURL = '/file/getUploadParams'; // upToken updateUserInfo
final String getUpTokenURL =
'/file/getUploadParams'; // upToken updateUserInfo
final String unbindPhoneTokenURL = '/user/unbindPhoneToken'; //Token
final String unbindEmailTokenURL = '/user/unbindEmailToken'; //Token
final String pushBindAppIdURL = '/user/bindAppId'; //APP设备
@ -193,4 +195,7 @@ abstract class Api {
final String getLockNoticeSettingURL =
'/lockSetting/getLockNoticeSetting'; //
final String setFaceAuthenticationURL =
'/v2/service/setFaceAuthentication'; //
}

View File

@ -1779,6 +1779,13 @@ class ApiProvider extends BaseProvider {
jsonEncode({
'lockId': lockId,
}));
//
Future<Response> setFaceAuthentication(int faceAuthFrequence) => post(
setFaceAuthenticationURL.toUrl,
jsonEncode({
'face_auth_frequence': faceAuthFrequence,
}));
}
extension ExtensionString on String {

View File

@ -21,6 +21,7 @@ import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElect
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireFingerprint/expireFingerprint_entity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/keyListByUserEntity.dart';
import 'package:star_lock/mine/mineSet/mineSet/userSettingInfoEntity.dart';
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/face_authentication_entity.dart';
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
import '../login/login/entity/LoginEntity.dart';
@ -1813,4 +1814,12 @@ class ApiRepository {
final res = await apiProvider.getLockNoticeSetting(lockId);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<FaceAuthenticationEntity> setFaceAuthentication(
{required int faceAuthFrequence}) async {
final res = await apiProvider.setFaceAuthentication(faceAuthFrequence);
return FaceAuthenticationEntity.fromJson(res.body);
}
}