Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
5dec697b3d
@ -305,6 +305,7 @@
|
||||
"email":"Email",
|
||||
"countryAndRegion":"Country And Region",
|
||||
"selet":"Selet",
|
||||
"getVerificationCode":"Get Verification Code",
|
||||
|
||||
"businessCooperation":"Business Cooperation",
|
||||
"officialWebsite":"Official Website",
|
||||
|
||||
@ -305,6 +305,7 @@
|
||||
"email":"email",
|
||||
"countryAndRegion":"countryAndRegion",
|
||||
"selet":"selet",
|
||||
"getVerificationCode":"getVerificationCode",
|
||||
|
||||
"businessCooperation":"businessCooperation",
|
||||
"officialWebsite":"officialWebsite",
|
||||
|
||||
@ -305,6 +305,7 @@
|
||||
"email":"邮箱",
|
||||
"countryAndRegion":"国家/地区",
|
||||
"selet":"选择",
|
||||
"getVerificationCode":"获取验证码",
|
||||
|
||||
"businessCooperation":"商务合作",
|
||||
"officialWebsite":"官网",
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord_page.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
||||
@ -11,7 +11,7 @@ import 'package:star_lock/mine/mineSet/transferSmartLock/recipientInformation_pa
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/selectBranch_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/transferSmartLock/transferSmartLock_page.dart';
|
||||
|
||||
import 'common/safetyVerification_page.dart';
|
||||
import 'common/safetyVerification/safetyVerification_page.dart';
|
||||
import 'login/forgetPassword/starLock_forgetPassword_page.dart';
|
||||
import 'login/login/starLock_login_page.dart';
|
||||
import 'login/register/starLock_register_page.dart';
|
||||
@ -25,6 +25,7 @@ import 'main/lockDetail/checkingIn/checkingInSetHolidays/checkingInSetHolidays_p
|
||||
import 'main/lockDetail/checkingIn/checkingInSetStaffManage/checkingInStaffManage_page.dart';
|
||||
import 'main/lockDetail/checkingIn/checkingInSetWorkTime/checkingInSetWorkTime_page.dart';
|
||||
import 'main/lockDetail/checkingIn/checkingInSetWorkdaySet/checkingInSetWorkdaySet_page.dart';
|
||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord_page.dart';
|
||||
import 'main/lockDetail/lcokSet/automaticBlocking/automaticBlocking_page.dart';
|
||||
import 'main/lockDetail/lcokSet/basicInformation/adminOpenLockPassword/adminOpenLockPassword_page.dart';
|
||||
import 'main/lockDetail/lcokSet/basicInformation/basicInformation/basicInformation_page.dart';
|
||||
@ -125,7 +126,6 @@ abstract class Routers {
|
||||
static const lockDetailPage = '/LockDetailPage'; // 锁详情
|
||||
static const electronicKeyListPage = '/ElectronicKeyListPage'; // 电子钥匙列表
|
||||
static const electronicKeyDetailPage = '/ElectronicKeyDetailPage'; // 电子钥匙详情
|
||||
static const keyOperationRecordPage = '/keyOperationRecordPage'; //钥匙详情-操作记录
|
||||
static const electronicKeyDetailChangeDate =
|
||||
'/ElectronicKeyDetailChangeDate'; // 修改有效期
|
||||
static const sendElectronicKeyManagePage =
|
||||
@ -243,34 +243,30 @@ abstract class Routers {
|
||||
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
||||
static const valueAddedServicesAddEmailTemplatePage =
|
||||
'/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版
|
||||
static const valueAddedServicesBuyAndUseRecordManagePage =
|
||||
'/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
||||
static const valueAddedServicesBuyAndUseRecordManagePage = '/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
||||
|
||||
static const lockScreenPage = '/LockScreenPage'; // 我的设置-锁屏
|
||||
static const aPPUnlockNeedMobileNetworkingLockPage =
|
||||
'/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁
|
||||
static const hideInvalidUnlockPermissionsPage =
|
||||
'/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限
|
||||
static const aPPUnlockNeedMobileNetworkingLockPage = '/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁
|
||||
static const hideInvalidUnlockPermissionsPage = '/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限
|
||||
|
||||
static const lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理
|
||||
static const authorizedAdministratorListPage =
|
||||
'/AuthorizedAdministratorListPage'; //我的设置-授权管理员
|
||||
static const authorizedAdministratorListPage = '/AuthorizedAdministratorListPage'; //我的设置-授权管理员
|
||||
static const lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组
|
||||
static const lockItemListPage = '/LockItemListPage'; //锁分组-锁列表
|
||||
static const transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁
|
||||
static const recipientInformationPage = '/recipientInformationPage'; //接受人信息
|
||||
static const selectBranchPage = '/SelectBranchPage'; //选择分店
|
||||
static const selectGetewayListPage = '/selectGetewayListPage'; //选择网关
|
||||
static const addAuthorizedAdministratorPage =
|
||||
'/addAuthorizedAdministratorPage'; //添加授权管理员
|
||||
static const addAuthorizedAdministratorPage = '/addAuthorizedAdministratorPage'; //添加授权管理员
|
||||
static const ownedKeyListPage = '/ownedKeyListPage'; //拥有的钥匙
|
||||
|
||||
static const starLockLoginPage = '/StarLockLoginPage'; // 登录
|
||||
static const starLockRegisterPage = '/StarLockRegisterPage'; // 注册
|
||||
static const starLockForgetPasswordPage =
|
||||
'/StarLockForgetPasswordPage'; // 忘记密码
|
||||
static const starLockForgetPasswordPage = '/StarLockForgetPasswordPage'; // 忘记密码
|
||||
static const seletCountryRegionPage = '/SeletCountryRegionPage'; // 选择国家和地区
|
||||
static const safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证
|
||||
|
||||
static const keyOperationRecordPage = '/keyOperationRecordPage'; //钥匙详情-操作记录
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -392,9 +388,9 @@ abstract class AppRouters {
|
||||
page: () => const StarLockLoginPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.starLockRegisterPage,
|
||||
page: () => const StarLockRegisterPage(),
|
||||
binding: StarLockRegisterBinding()),
|
||||
name: Routers.starLockRegisterPage,
|
||||
page: () => const StarLockRegisterPage(), binding:StarLockRegisterBinding()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.starLockForgetPasswordPage,
|
||||
page: () => const StarLockForgetPasswordPage(),
|
||||
@ -669,36 +665,49 @@ abstract class AppRouters {
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.authorizedAdministratorListPage,
|
||||
page: () => const AuthorizedAdministratorListPage()),
|
||||
page: () => const AuthorizedAdministratorListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockUserManageLisPage,
|
||||
page: () => const LockUserManageListListPage()),
|
||||
page: () => const LockUserManageListListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()),
|
||||
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockItemListPage, page: () => const LockItemListPage()),
|
||||
name: Routers.lockItemListPage, page: () => const LockItemListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.transferSmartLockPage,
|
||||
page: () => const TransferSmartLockPage()),
|
||||
page: () => const TransferSmartLockPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.recipientInformationPage,
|
||||
page: () => const RecipientInformationPage()),
|
||||
page: () => const RecipientInformationPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.selectBranchPage, page: () => const SelectBranchPage()),
|
||||
name: Routers.selectBranchPage, page: () => const SelectBranchPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.selectGetewayListPage,
|
||||
page: () => const SelectGetewayListPage()),
|
||||
page: () => const SelectGetewayListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.minePersonInfoEditEmailPage,
|
||||
page: () => const MinePersonInfoEditEmailPage()),
|
||||
page: () => const MinePersonInfoEditEmailPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.addAuthorizedAdministratorPage,
|
||||
page: () => const AddAuthorizedAdministratorPage()),
|
||||
page: () => const AddAuthorizedAdministratorPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.safetyVerificationPage,
|
||||
page: () => const SafetyVerificationPage()),
|
||||
page: () => const SafetyVerificationPage(),
|
||||
binding: SafetyVerificationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()),
|
||||
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.keyOperationRecordPage,
|
||||
page: () => const KeyOperationRecordPage())
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
import 'Data.dart';
|
||||
|
||||
class CheckSafetyVerificationEntity {
|
||||
CheckSafetyVerificationEntity({
|
||||
this.description,
|
||||
this.errorCode,
|
||||
this.errorMsg,});
|
||||
|
||||
CheckSafetyVerificationEntity.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;
|
||||
}
|
||||
|
||||
}
|
||||
25
star_lock/lib/common/safetyVerification/entity/Data.dart
Normal file
25
star_lock/lib/common/safetyVerification/entity/Data.dart
Normal file
@ -0,0 +1,25 @@
|
||||
class Data {
|
||||
Data({
|
||||
this.bigImg,
|
||||
this.smallImg,
|
||||
this.yHeight,});
|
||||
|
||||
Data.fromJson(dynamic json) {
|
||||
bigImg = json['bigImg'];
|
||||
smallImg = json['smallImg'];
|
||||
yHeight = json['yHeight'];
|
||||
|
||||
}
|
||||
String? bigImg;
|
||||
String? smallImg;
|
||||
int? yHeight;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['bigImg'] = bigImg;
|
||||
map['smallImg'] = smallImg;
|
||||
map['yHeight'] = yHeight;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
import 'Data.dart';
|
||||
|
||||
class SafetyVerificationEntity {
|
||||
SafetyVerificationEntity({
|
||||
this.description,
|
||||
this.errorCode,
|
||||
this.data,
|
||||
this.errorMsg,});
|
||||
|
||||
SafetyVerificationEntity.fromJson(dynamic json) {
|
||||
description = json['description'];
|
||||
errorCode = json['errorCode'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
errorMsg = json['errorMsg'];
|
||||
}
|
||||
String? description;
|
||||
int? errorCode;
|
||||
Data? data;
|
||||
String? errorMsg;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['description'] = description;
|
||||
map['errorCode'] = errorCode;
|
||||
if (data != null) {
|
||||
map['data'] = data!.toJson();
|
||||
}
|
||||
map['errorMsg'] = errorMsg;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'safetyVerification_logic.dart';
|
||||
|
||||
class SafetyVerificationBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => SafetyVerificationLogic());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
import 'package:star_lock/common/safetyVerification/safetyVerification_state.dart';
|
||||
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/baseGetXController.dart';
|
||||
import 'entity/SafetyVerificationEntity.dart';
|
||||
|
||||
class SafetyVerificationLogic extends BaseGetXController{
|
||||
final SafetyVerificationState state = SafetyVerificationState();
|
||||
|
||||
}
|
||||
@ -0,0 +1,409 @@
|
||||
import 'package:flustars/flustars.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/safetyVerification/safetyVerification_logic.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'entity/SafetyVerificationEntity.dart';
|
||||
|
||||
class SafetyVerificationPage extends StatefulWidget {
|
||||
const SafetyVerificationPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SafetyVerificationPage> createState() => _SafetyVerificationPageState();
|
||||
}
|
||||
|
||||
class _SafetyVerificationPageState extends State<SafetyVerificationPage> with TickerProviderStateMixin {
|
||||
|
||||
final logic = Get.find<SafetyVerificationLogic>();
|
||||
final state = Get.find<SafetyVerificationLogic>().state;
|
||||
|
||||
String baseImageBase64 = "";
|
||||
String slideImageBase64 = "";
|
||||
|
||||
Size baseSize = Size.zero; //底部基类图片
|
||||
Size slideSize = Size.zero; //滑块图片
|
||||
|
||||
double sliderStartX = 0; //滑块未拖前的X坐标
|
||||
bool sliderMoveFinish = false; //滑块拖动结束
|
||||
bool checkResultAfterDrag = false; //拖动后的校验结果
|
||||
|
||||
//-------------动画------------
|
||||
int _checkMilliseconds = 0; //滑动时间
|
||||
bool _showTimeLine = false; //是否显示动画部件
|
||||
bool _checkSuccess = false; //校验是否成功
|
||||
AnimationController? controller;
|
||||
|
||||
//高度动画
|
||||
Animation<double>? offsetAnimation;
|
||||
final double _bottomSliderSize = 60;
|
||||
|
||||
//加载验证码
|
||||
Future<void> loadCaptcha() async {
|
||||
setState(() {
|
||||
_showTimeLine = false;
|
||||
sliderMoveFinish = false;
|
||||
checkResultAfterDrag = false;
|
||||
});
|
||||
print("countryCode:${state.getData["countryCode"]} getAccount:${state.getData["getAccount"]}");
|
||||
|
||||
var entity = await ApiRepository.to.getSliderVerifyImg(state.getData["countryCode"], state.getData["account"]);
|
||||
if(entity.errorCode! == 0){
|
||||
state.sliderXMoved.value = 0;
|
||||
sliderStartX = 0;
|
||||
checkResultAfterDrag = false;
|
||||
|
||||
baseImageBase64 = entity.data!.bigImg!;
|
||||
slideImageBase64 = entity.data!.smallImg!;
|
||||
|
||||
var baseR = await WidgetUtil.getImageWH(
|
||||
image: Image.memory(const Base64Decoder().convert(baseImageBase64)));
|
||||
baseSize = baseR.size;
|
||||
|
||||
var silderR = await WidgetUtil.getImageWH(
|
||||
image: Image.memory(const Base64Decoder().convert(slideImageBase64)));
|
||||
slideSize = silderR.size;
|
||||
|
||||
setState(() {});
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//校验验证码
|
||||
Future<void> checkCaptcha(sliderMovedX, {BuildContext? myContext}) async {
|
||||
setState(() {
|
||||
sliderMoveFinish = true;
|
||||
});
|
||||
|
||||
var entity = await ApiRepository.to.checkSliderVerifyImg(state.getData["countryCode"], state.getData["account"], sliderMovedX.toString());
|
||||
if(entity.errorCode! == 0){
|
||||
checkSuccess("captchaVerification");
|
||||
}else{
|
||||
state.sliderXMoved.value = 0;
|
||||
sliderStartX = 0;
|
||||
checkResultAfterDrag = false;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
initAnimation();
|
||||
loadCaptcha();
|
||||
}
|
||||
|
||||
// 初始化动画
|
||||
void initAnimation() {
|
||||
controller =
|
||||
AnimationController(duration: const Duration(milliseconds: 500), vsync: this);
|
||||
|
||||
offsetAnimation = Tween<double>(begin: 0.5, end: 0)
|
||||
.animate(CurvedAnimation(parent: controller!, curve: Curves.ease))
|
||||
..addListener(() {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(SafetyVerificationPage oldWidget) {
|
||||
// TODO: implement didUpdateWidget
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return MaxScaleTextWidget(
|
||||
child: buildContent(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildContent(BuildContext context) {
|
||||
var mediaQuery = MediaQuery.of(context);
|
||||
var dialogWidth = 0.9 * mediaQuery.size.width;
|
||||
if (dialogWidth < 330) {
|
||||
dialogWidth = mediaQuery.size.width;
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.about!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Container(
|
||||
// key: _containerKey,
|
||||
width: 1.sw,
|
||||
// height: 340,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
_topContainer(),
|
||||
_middleContainer(),
|
||||
_bottomContainer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//校验通过
|
||||
void checkSuccess(String content) {
|
||||
setState(() {
|
||||
checkResultAfterDrag = true;
|
||||
_checkSuccess = true;
|
||||
_showTimeLine = true;
|
||||
});
|
||||
_forwardAnimation();
|
||||
|
||||
//刷新验证码
|
||||
Future.delayed(const Duration(milliseconds: 1000)).then((v) {
|
||||
_reverseAnimation().then((v) {
|
||||
setState(() {
|
||||
_showTimeLine = false;
|
||||
});
|
||||
//关闭验证码
|
||||
Navigator.pop(context);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//校验失败
|
||||
void checkFail() {
|
||||
setState(() {
|
||||
_showTimeLine = true;
|
||||
_checkSuccess = false;
|
||||
checkResultAfterDrag = false;
|
||||
});
|
||||
_forwardAnimation();
|
||||
|
||||
//刷新验证码
|
||||
Future.delayed(Duration(milliseconds: 1000)).then((v) {
|
||||
_reverseAnimation().then((v) {
|
||||
setState(() {
|
||||
_showTimeLine = false;
|
||||
});
|
||||
loadCaptcha();
|
||||
//回调
|
||||
// if (widget.onFail != null) {
|
||||
// widget.onFail!();
|
||||
// }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 反向执行动画
|
||||
_reverseAnimation() async {
|
||||
await controller!.reverse();
|
||||
}
|
||||
|
||||
// 正向执行动画
|
||||
_forwardAnimation() async {
|
||||
await controller!.forward();
|
||||
}
|
||||
|
||||
///顶部,提示+关闭
|
||||
_topContainer() {
|
||||
return Container(
|
||||
height: 70.h,
|
||||
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(bottom: BorderSide(width: 1, color: Color(0xffe5e5e5))),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text('拖动下方滑块完成拼图', style: TextStyle(fontSize: 26.sp),),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
iconSize: 30,
|
||||
color: Colors.black54,
|
||||
onPressed: () {
|
||||
//刷新
|
||||
loadCaptcha();
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_middleContainer() {
|
||||
////显示验证码
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
///底图 310*155
|
||||
baseImageBase64.isNotEmpty ?
|
||||
Image.memory(
|
||||
const Base64Decoder().convert(baseImageBase64),
|
||||
fit: BoxFit.fitWidth,
|
||||
// key: _baseImageKey,
|
||||
gaplessPlayback: true,
|
||||
):
|
||||
Container(
|
||||
width: 310,
|
||||
height: 155,
|
||||
alignment: Alignment.center,
|
||||
child: const CircularProgressIndicator(),
|
||||
),
|
||||
|
||||
///滑块图
|
||||
slideImageBase64.isNotEmpty ?
|
||||
Obx(() => Container(
|
||||
margin: EdgeInsets.fromLTRB(state.sliderXMoved.value, 0, 0, 0),
|
||||
child: Image.memory(const Base64Decoder().convert(slideImageBase64),
|
||||
fit: BoxFit.fitHeight,
|
||||
// key: _slideImageKey,
|
||||
gaplessPlayback: true,
|
||||
),
|
||||
)) : Container(),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: -10,
|
||||
right: -10,
|
||||
child: Offstage(
|
||||
offstage: !_showTimeLine,
|
||||
child: FractionalTranslation(
|
||||
translation: Offset(0, offsetAnimation!.value),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(left: 10, right: 10),
|
||||
height: 40,
|
||||
color: _checkSuccess ? const Color(0x7F66BB6A) : const Color.fromRGBO(200, 100, 100, 0.4),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
_checkSuccess
|
||||
? "${(_checkMilliseconds / (60.0 * 12)).toStringAsFixed(2)}s验证成功"
|
||||
: "验证失败",
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
Positioned(
|
||||
bottom: -20,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Offstage(
|
||||
offstage: !_showTimeLine,
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(left: 10, right: 10),
|
||||
height: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
///底部,滑动区域
|
||||
_bottomContainer() {
|
||||
return baseSize.width >0 ?
|
||||
Container(
|
||||
height: 70,
|
||||
width: baseSize.width,
|
||||
child: Stack(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: _bottomSliderSize,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 1,
|
||||
color: const Color(0xffe5e5e5),
|
||||
),
|
||||
color: const Color(0xfff8f9fb),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text('向右拖动滑块填充拼图', style: TextStyle(fontSize: 16),),
|
||||
),
|
||||
Obx(() => Container(
|
||||
width: state.sliderXMoved.value,
|
||||
height: _bottomSliderSize-2,
|
||||
color: const Color(0xfff3fef1),
|
||||
)),
|
||||
GestureDetector(
|
||||
onPanStart: (startDetails) {
|
||||
///开始
|
||||
_checkMilliseconds = DateTime.now().millisecondsSinceEpoch;
|
||||
print(startDetails.localPosition);
|
||||
sliderStartX = startDetails.localPosition.dx;
|
||||
},
|
||||
onPanUpdate: (updateDetails) {
|
||||
///更新
|
||||
print(updateDetails.localPosition);
|
||||
double offset = updateDetails.localPosition.dx - sliderStartX;
|
||||
if(offset < 0){
|
||||
offset = 0;
|
||||
}
|
||||
print("offset ------ $offset");
|
||||
setState(() {
|
||||
state.sliderXMoved.value = offset;
|
||||
});
|
||||
},
|
||||
onPanEnd: (endDetails) { //结束
|
||||
print("endDetails sliderXMoved:${state.sliderXMoved.value}");
|
||||
checkCaptcha(state.sliderXMoved.value);
|
||||
int nowTime = DateTime.now().millisecondsSinceEpoch;
|
||||
_checkMilliseconds = nowTime - _checkMilliseconds;
|
||||
},
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
width: _bottomSliderSize,
|
||||
height: _bottomSliderSize,
|
||||
margin: EdgeInsets.only(left: state.sliderXMoved.value > 0 ? state.sliderXMoved.value : 1),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(width: 1, color: Color(0xffe5e5e5)),
|
||||
right: BorderSide(width: 1, color: Color(0xffe5e5e5)),
|
||||
bottom: BorderSide(width: 1, color: Color(0xffe5e5e5)),
|
||||
),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_forward),
|
||||
iconSize: 30,
|
||||
color: Colors.black54, onPressed: () {},
|
||||
),
|
||||
);
|
||||
}),
|
||||
)
|
||||
],
|
||||
))
|
||||
: Container();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller!.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MaxScaleTextWidget extends StatelessWidget {
|
||||
final double max;
|
||||
final Widget child;
|
||||
|
||||
const MaxScaleTextWidget({Key? key, this.max = 1.0, required this.child}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var data = MediaQuery.of(context);
|
||||
var textScaleFactor = min(max, data.textScaleFactor);
|
||||
return MediaQuery(data: data.copyWith(textScaleFactor: textScaleFactor), child: child);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'entity/SafetyVerificationEntity.dart';
|
||||
|
||||
class SafetyVerificationState{
|
||||
|
||||
// Rx<SafetyVerificationEntity> safetyVerificationEntity = SafetyVerificationEntity().obs;
|
||||
var sliderXMoved = 0.0.obs;
|
||||
var getData = {}.obs;
|
||||
|
||||
SafetyVerificationState() {
|
||||
getData.value = Get.arguments as Map;
|
||||
}
|
||||
|
||||
void onClose() {
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -2,30 +2,30 @@ import 'Data.dart';
|
||||
|
||||
class LoginEntity {
|
||||
LoginEntity({
|
||||
this.msg,
|
||||
this.msgCode,
|
||||
this.data,
|
||||
this.code,});
|
||||
this.description,
|
||||
this.errorCode,
|
||||
this.content,
|
||||
this.errorMsg,});
|
||||
|
||||
LoginEntity.fromJson(dynamic json) {
|
||||
msg = json['msg'];
|
||||
msgCode = json['msgCode'];
|
||||
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
||||
code = json['code'];
|
||||
description = json['description'];
|
||||
errorCode = json['errorCode'];
|
||||
content = json['content'] != null ? Data.fromJson(json['content']) : null;
|
||||
errorMsg = json['errorMsg'];
|
||||
}
|
||||
String? msg;
|
||||
int? msgCode;
|
||||
Data? data;
|
||||
int? code;
|
||||
String? description;
|
||||
int? errorCode;
|
||||
Data? content;
|
||||
int? errorMsg;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['msg'] = msg;
|
||||
map['msgCode'] = msgCode;
|
||||
if (data != null) {
|
||||
map['data'] = data!.toJson();
|
||||
map['description'] = description;
|
||||
map['errorCode'] = errorCode;
|
||||
if (content != null) {
|
||||
map['data'] = content!.toJson();
|
||||
}
|
||||
map['code'] = code;
|
||||
map['errorMsg'] = errorMsg;
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@ -11,13 +11,13 @@ class StarLockRegisterLogic extends BaseGetXController{
|
||||
void register() async{
|
||||
var entity = await ApiRepository.to.register(
|
||||
state.countryCode.value,
|
||||
state.countryCode.value,
|
||||
state.countryId.value,
|
||||
state.phoneOrEmailStr.value,
|
||||
state.pwd.value,
|
||||
"gdasdfasdfasdf",
|
||||
state.verificationCode.value
|
||||
);
|
||||
if(entity.code!.codeIsSuccessful){
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
await loginSuccess(loginEntity: entity);
|
||||
|
||||
} else {
|
||||
|
||||
@ -203,14 +203,11 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
print("3333333:${v}");
|
||||
logic.checkNext(state.phoneOrEmailController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
'images/icon_login_account.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
leftWidget:
|
||||
// Image.asset('images/icon_login_account.png', width: 30.w, height: 30.w,),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
child: Image.asset('images/icon_login_account.png', width: 30.w, height: 30.w,),
|
||||
),
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
@ -226,13 +223,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
},
|
||||
isPwd: true,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
'images/icon_login_password.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
child: Image.asset('images/icon_login_password.png', width: 30.w, height: 30.w,),
|
||||
),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
@ -253,13 +245,8 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
},
|
||||
isPwd: true,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
'images/icon_login_password.png',
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
child: Image.asset('images/icon_login_password.png', width: 30.w, height: 30.w,),
|
||||
),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
@ -277,11 +264,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
logic.checkNext(state.codeController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
||||
child: SizedBox(
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
// Image.asset(
|
||||
// 'images/main/icon_main_search.png',
|
||||
@ -289,8 +275,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
// height: 40.w,
|
||||
// ),
|
||||
),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||
hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
@ -309,7 +294,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
child: Center(
|
||||
child: Text(
|
||||
_seconds == 60
|
||||
? '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}'
|
||||
? TranslationLoader.lanKeys!.getVerificationCode!.tr
|
||||
: (_seconds < 10)
|
||||
? '0$_seconds s'
|
||||
: '$_seconds s',
|
||||
@ -321,7 +306,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.safetyVerificationPage);
|
||||
Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":"15080825640"});
|
||||
if (_seconds == 60) {
|
||||
// _setVerify();
|
||||
} else {
|
||||
|
||||
@ -78,7 +78,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
|
||||
rightTitle: "",
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(context, Routers.keyOperationRecordPage);
|
||||
Navigator.pushNamed(context, Routers.keyOperationRecordPage, arguments: {});
|
||||
}),
|
||||
Container(height: 40.h),
|
||||
SubmitBtn(
|
||||
|
||||
@ -6,6 +6,8 @@ abstract class Api {
|
||||
|
||||
final String getVerificationCodeUrl = '/api/v1/vcode/email';
|
||||
final String registerUrl = '/user/register';
|
||||
final String getSliderVerifyImgUrl = '/user/getSliderVerifyImg';
|
||||
final String checkImgUrl = '/user/isSliderValid';
|
||||
final String loginUrl = '/api/v1/vcode/email';
|
||||
|
||||
}
|
||||
|
||||
@ -18,6 +18,17 @@ class ApiProvider extends BaseProvider {
|
||||
'verificationCode':verificationCode,
|
||||
});
|
||||
|
||||
Future<Response> getSliderVerifyImg(String countryCode, String account) => post(getSliderVerifyImgUrl.toUrl, null,query: {
|
||||
'countryCode':countryCode,
|
||||
'account':account,
|
||||
});
|
||||
|
||||
Future<Response> checkSliderVerifyImg(String countryCode, String account, String xWidth) => post(checkImgUrl.toUrl, null,query: {
|
||||
'countryCode':countryCode,
|
||||
'account':account,
|
||||
'xWidth':xWidth,
|
||||
});
|
||||
|
||||
Future<Response> login(String email,String password) => post(loginUrl.toUrl, null,query: {'email':email,'password':password});
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
import 'api_provider.dart';
|
||||
|
||||
@ -20,6 +22,16 @@ class ApiRepository {
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
Future<SafetyVerificationEntity> getSliderVerifyImg(String countryCode, String account) async {
|
||||
final res = await apiProvider.getSliderVerifyImg(countryCode, account);
|
||||
return SafetyVerificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
Future<CheckSafetyVerificationEntity> checkSliderVerifyImg(String countryCode, String account, String xWidth) async {
|
||||
final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth);
|
||||
return CheckSafetyVerificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// Future<LoginEntity> login({String? email,String? password}) async {
|
||||
// final res = await apiProvider.login(email,SecrecyUtils.md5EncodeUpperCase(input: password));
|
||||
// return LoginEntity.fromJson(res.body);
|
||||
|
||||
@ -89,6 +89,6 @@ class BaseGetXController extends GetxController{
|
||||
|
||||
///Extension_Int
|
||||
extension Extension_Int on int {
|
||||
bool get codeIsSuccessful => this == 1;
|
||||
bool get codeIsSuccessful => this == 0;
|
||||
bool get msgCodeIsSuccessful => this == 1;
|
||||
}
|
||||
@ -37,8 +37,8 @@ class StoreService<T> extends GetxService {
|
||||
Future saveLogInInfo(LoginEntity entity) async {
|
||||
_loginEntity = LoginEntity.fromJson(entity.toJson());
|
||||
save(_loginUserInfoKey, entity.toJson());
|
||||
if(_loginEntity != null && _loginEntity!.data != null && _loginEntity!.data!.email != null && _loginEntity!.data!.email!.isNotEmpty) {
|
||||
save(_userAccount, _loginEntity?.data?.email);
|
||||
if(_loginEntity != null && _loginEntity!.content != null && _loginEntity!.content!.email != null && _loginEntity!.content!.email!.isNotEmpty) {
|
||||
save(_userAccount, _loginEntity?.content?.email);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ class StoreService<T> extends GetxService {
|
||||
// String getLanguageCode() => hasData(_languageCode) ? read(_languageCode): "";
|
||||
Future saveLanguageCode(String code) => save(_languageCode, code);
|
||||
|
||||
bool get hadToken => _loginEntity !=null && _loginEntity!.data!.token!.isNotEmpty;
|
||||
String? get userToken => hadToken ? _loginEntity!.data!.token : "";
|
||||
bool get hadToken => _loginEntity !=null && _loginEntity!.content!.token!.isNotEmpty;
|
||||
String? get userToken => hadToken ? _loginEntity!.content!.token : "";
|
||||
|
||||
// String getLastUserAccount() => hasData(_userAccount) ? read(_userAccount): "";
|
||||
void removeLastUserAccount() => remove(_userAccount);
|
||||
|
||||
@ -367,6 +367,7 @@ class LanKeyEntity {
|
||||
this.hideInvalidUnlockPermissionsTip,
|
||||
this.appUnlockRequiresMobilePhoneAccessToTheLockTip,
|
||||
this.checkAll,
|
||||
this.getVerificationCode
|
||||
});
|
||||
|
||||
LanKeyEntity.fromJson(dynamic json) {
|
||||
@ -764,6 +765,7 @@ class LanKeyEntity {
|
||||
appUnlockRequiresMobilePhoneAccessToTheLockTip =
|
||||
json['appUnlockRequiresMobilePhoneAccessToTheLockTip'];
|
||||
checkAll = json['checkAll'];
|
||||
getVerificationCode = json['getVerificationCode'];
|
||||
}
|
||||
String? starLock;
|
||||
String? clickUnlockAndHoldDownClose;
|
||||
@ -1148,6 +1150,7 @@ class LanKeyEntity {
|
||||
String? hideInvalidUnlockPermissionsTip;
|
||||
String? appUnlockRequiresMobilePhoneAccessToTheLockTip;
|
||||
String? checkAll;
|
||||
String? getVerificationCode;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
@ -1543,7 +1546,7 @@ class LanKeyEntity {
|
||||
map['appUnlockRequiresMobilePhoneAccessToTheLockTip'] =
|
||||
appUnlockRequiresMobilePhoneAccessToTheLockTip;
|
||||
map['checkAll'] = checkAll;
|
||||
|
||||
map['getVerificationCode'] = getVerificationCode;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user