1,新增删除账号页面及相应接口和逻辑

2,新增免滑动验证码的验证码请求接口
3,新增更新个人信息-昵称接口
4,新增修改账号接口及逻辑
5,新增绑定邮箱接口及逻辑
6,新增修改密码接口
This commit is contained in:
Daisy 2023-10-09 18:45:10 +08:00
parent 08e36eee3c
commit 809096a11b
33 changed files with 1076 additions and 255 deletions

View File

@ -319,6 +319,7 @@
"registerPasswordTip":"The password must be 8-20 characters, including at least 2 of the numbers/letters/symbols", "registerPasswordTip":"The password must be 8-20 characters, including at least 2 of the numbers/letters/symbols",
"iphone":"Iphone", "iphone":"Iphone",
"email":"Email", "email":"Email",
"mobileNumber":"Mobile phone number",
"countryAndRegion":"Country And Region", "countryAndRegion":"Country And Region",
"selet":"Selet", "selet":"Selet",
"getVerificationCode":"Get Verification Code", "getVerificationCode":"Get Verification Code",

View File

@ -319,6 +319,7 @@
"registerPasswordTip":"registerPasswordTip", "registerPasswordTip":"registerPasswordTip",
"iphone":"iphone", "iphone":"iphone",
"email":"email", "email":"email",
"mobileNumber":"mobileNumber",
"countryAndRegion":"countryAndRegion", "countryAndRegion":"countryAndRegion",
"selet":"selet", "selet":"selet",
"getVerificationCode":"getVerificationCode", "getVerificationCode":"getVerificationCode",

View File

@ -319,6 +319,7 @@
"registerPasswordTip":"密码必须是8-20位至少包括数字/字母/符号中的2种", "registerPasswordTip":"密码必须是8-20位至少包括数字/字母/符号中的2种",
"iphone":"手机", "iphone":"手机",
"email":"邮箱", "email":"邮箱",
"mobileNumber":"手机号",
"countryAndRegion":"国家/地区", "countryAndRegion":"国家/地区",
"selet":"选择", "selet":"选择",
"getVerificationCode":"获取验证码", "getVerificationCode":"获取验证码",

View File

@ -33,7 +33,7 @@ class SafeVerifyLogic extends BaseGetXController {
// //
void sendValidationCode() async { void sendValidationCode() async {
var entity = await ApiRepository.to.sendValidationCode( var entity = await ApiRepository.to.getValidationCodeAuth(
"+86", "+86",
state.loginData.value.mobile!, state.loginData.value.mobile!,
'1', '1',
@ -46,8 +46,9 @@ class SafeVerifyLogic extends BaseGetXController {
} }
// //
Future<void> userLogoutRequest() async { Future<void> deleteAccountRequest() async {
LoginEntity entity = await ApiRepository.to.userLogout(); LoginEntity entity = await ApiRepository.to
.deleteAccount("", "", state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '验证成功,账号已删除'); Toast.show(msg: '验证成功,账号已删除');
// //

View File

@ -17,7 +17,6 @@ class SafeVerifyPage extends StatefulWidget {
class _SafeVerifyPageState extends State<SafeVerifyPage> { class _SafeVerifyPageState extends State<SafeVerifyPage> {
final logic = Get.put(SafeVerifyLogic()); final logic = Get.put(SafeVerifyLogic());
final state = Get.find<SafeVerifyLogic>().state; final state = Get.find<SafeVerifyLogic>().state;
String mobilePhone = '';
@override @override
void initState() { void initState() {
@ -51,6 +50,9 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
// //
maxLines: 1, maxLines: 1,
controller: state.codeController, controller: state.codeController,
onChanged: (value) {
logic.checkNext(state.codeController);
},
autofocus: false, autofocus: false,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: contentPadding:
@ -65,15 +67,15 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
SizedBox( Obx(() => SizedBox(
width: 200.w, width: 200.w,
child: SubmitBtn( child: SubmitBtn(
btnName: TranslationLoader.lanKeys!.getVerificationCode!.tr, btnName: state.btnText.value,
onClick: () { onClick: () {
logic.sendValidationCode(); logic.sendValidationCode();
}, },
), ),
), )),
SizedBox( SizedBox(
height: 60.h, height: 60.h,
), ),
@ -92,7 +94,7 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
btnName: '验证', btnName: '验证',
isDisabled: state.canSub.value, isDisabled: state.canSub.value,
onClick: () { onClick: () {
logic.userLogoutRequest(); logic.deleteAccountRequest();
}, },
)) ))
], ],

View File

@ -14,7 +14,7 @@ class SafeVerifyState {
var countryCode = '+86'.obs; var countryCode = '+86'.obs;
var countryId = '9'.obs; var countryId = '9'.obs;
var codeType = '5'.obs; var codeType = '5'.obs; //5
var verificationCode = ''.obs; var verificationCode = ''.obs;
var xWidth = ''.obs; // var xWidth = ''.obs; //
var canSub = false.obs; var canSub = false.obs;

View File

@ -0,0 +1,77 @@
class MinePersonInfoEntity {
int? errorCode;
String? description;
String? errorMsg;
MinePersonInfoData? data;
MinePersonInfoEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
MinePersonInfoEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data =
json['data'] != null ? MinePersonInfoData.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class MinePersonInfoData {
String? mobile;
String? uid;
bool? isSecurityQuestionSetted;
String? nickname;
String? headUrl;
String? accountName;
int? countryId;
String? email;
String? countryName;
MinePersonInfoData(
{this.mobile,
this.uid,
this.isSecurityQuestionSetted,
this.nickname,
this.headUrl,
this.accountName,
this.countryId,
this.email,
this.countryName});
MinePersonInfoData.fromJson(Map<String, dynamic> json) {
mobile = json['mobile'];
uid = json['uid'];
isSecurityQuestionSetted = json['isSecurityQuestionSetted'];
nickname = json['nickname'];
headUrl = json['headUrl'];
accountName = json['accountName'];
countryId = json['countryId'];
email = json['email'];
countryName = json['countryName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['mobile'] = mobile;
data['uid'] = uid;
data['isSecurityQuestionSetted'] = isSecurityQuestionSetted;
data['nickname'] = nickname;
data['headUrl'] = headUrl;
data['accountName'] = accountName;
data['countryId'] = countryId;
data['email'] = email;
data['countryName'] = countryName;
return data;
}
}

View File

@ -0,0 +1,19 @@
import 'dart:async';
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_state.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart';
class MinePersonInfoLogic extends BaseGetXController {
final MinePersonInfoState state = MinePersonInfoState();
//
Future<void> getUserInfoRequest() async {
var entity = await ApiRepository.to.getUserInfo("");
if (entity.errorCode!.codeIsSuccessful) {
state.mineInfoData.value = entity.data!;
state.nickname.value = entity.data!.nickname!;
state.mobileStr.value = entity.data!.mobile!;
state.emailStr.value = entity.data!.email!;
state.countryStr.value = entity.data!.countryName!;
}
}
}

View File

@ -1,8 +1,8 @@
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:image_picker/image_picker.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_logic.dart';
import 'package:star_lock/tools/seletImgTool.dart'; import 'package:star_lock/tools/seletImgTool.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
@ -18,6 +18,16 @@ class MinePersonInfoPage extends StatefulWidget {
} }
class _MinePersonInfoPageState extends State<MinePersonInfoPage> { class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
final logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state;
@override
void initState() {
super.initState();
logic.getUserInfoRequest();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -47,33 +57,63 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
_openModalBottomSheet(); _openModalBottomSheet();
}, },
), ),
CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr, leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: "你好", rightTitle: state.nickname.value,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage); context, Routers.minePersonInfoEditNamePage,
}), arguments: {'nickName': state.nickname.value})
CommonItem( .then((value) => logic.getUserInfoRequest());
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr, })),
rightTitle: "786612630@qq.com", Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
rightTitle: state.mobileStr.value,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed( // isFrom1 2
context, Routers.minePersonInfoEditAccountPage); if (state.mobileStr.value.isNotEmpty) {
}), Navigator.pushNamed(
CommonItem( context, Routers.minePersonInfoEditAccountPage,
arguments: {
'mobile': state.mobileStr.value,
'isFrom': '1'
});
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoEditEmailPage,
arguments: {
'mobile': state.mobileStr.value,
'isFrom': '1'
});
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.email!.tr, leftTitel: TranslationLoader.lanKeys!.email!.tr,
rightTitle: "", rightTitle: state.emailStr.value,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed( // isFrom1 2
context, Routers.minePersonInfoEditEmailPage); if (state.emailStr.value.isNotEmpty) {
}), Navigator.pushNamed(
context, Routers.minePersonInfoEditAccountPage,
arguments: {
'isFrom': '2',
'email': state.emailStr.value
});
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoEditEmailPage,
arguments: {
'isFrom': '2',
'email': state.emailStr.value
});
}
})),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr, leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "", rightTitle: "",
@ -92,11 +132,11 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage); context, Routers.minePersonInfoSetSafetyProblemPage);
}), }),
CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr, leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: "中国", rightTitle: state.countryStr.value,
isHaveLine: false, isHaveLine: false,
isHaveDirection: false), isHaveDirection: false)),
], ],
)); ));
} }

View File

@ -0,0 +1,11 @@
import 'package:get/get.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_entity.dart';
class MinePersonInfoState {
final mineInfoData = MinePersonInfoData().obs;
var nickname = ''.obs; //
var mobileStr = ''.obs; //
var emailStr = ''.obs; //
var countryStr = ''.obs; ///
}

View File

@ -0,0 +1,88 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/src/extension_navigation.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/minePersonInfoEditAccount_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
class MineInfoEditAccountLogic extends BaseGetXController {
final MineInfoEditAccountState state = MineInfoEditAccountState();
late Timer _timer;
void _startTimer() {
_timer = Timer.periodic(1.seconds, (timer) {
if (state.currentSecond > 1) {
state.currentSecond--;
} else {
_cancelTimer();
state.currentSecond = state.totalSeconds;
}
state.resetResend();
});
}
void _cancelTimer() {
_timer.cancel();
}
//
void sendValidationCode() async {
var entity = await ApiRepository.to.getValidationCodeAuth(
state.countryCode.value,
state.loginData.value.mobile!,
state.channel.value,
state.codeType.value,
state.uniqueid.value,
state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) {
_startTimer();
} else {}
}
//
Future<void> deleteAccountRequest() async {
LoginEntity entity = await ApiRepository.to
.deleteAccount("", "", state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '验证成功,账号已删除');
//
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if (controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub() {
state.canSub.value = state.codeIsOK;
}
@override
void onReady() {
super.onReady();
}
@override
void onInit() {
super.onInit();
state.initLoginData();
}
@override
void onClose() {
super.onClose();
}
}

View File

@ -1,6 +1,8 @@
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:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/minePersonInfoEditAccount_logic.dart';
import 'package:star_lock/tools/tf_input_haveBorder.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -18,7 +20,8 @@ class MinePersonInfoEditAccountPage extends StatefulWidget {
class _MinePersonInfoEditAccountPageState class _MinePersonInfoEditAccountPageState
extends State<MinePersonInfoEditAccountPage> { extends State<MinePersonInfoEditAccountPage> {
final TextEditingController _editAccountController = TextEditingController(); final logic = Get.put(MineInfoEditAccountLogic());
final state = Get.find<MineInfoEditAccountLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -38,96 +41,39 @@ class _MinePersonInfoEditAccountPageState
TranslationLoader.lanKeys!.modifyAccountTip!.tr, TranslationLoader.lanKeys!.modifyAccountTip!.tr,
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
Container( Obx(() => Container(
padding: EdgeInsets.all(20.h), padding: EdgeInsets.only(
height: 110.h, left: 30.w, right: 30.w, top: 20.h, bottom: 10.h),
child: TextField( child: TFInputHaveBorder(
// maxLines: 1, controller: state.codeController,
keyboardType: TextInputType.text, label:
// inputFormatters: inputFormatterstters??[], "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
controller: _editAccountController, rightSlot: GestureDetector(
autofocus: false, child: Container(
textAlign: TextAlign.start, width: 180.w,
style: TextStyle( height: 90.h,
height: 3.2, padding: EdgeInsets.all(5.h),
fontSize: 22.sp, margin: EdgeInsets.only(right: 10.w),
fontWeight: FontWeight.w400, child: Center(
color: const Color(0xFF333333)), child: Text(state.btnText.value,
decoration: InputDecoration( textAlign: TextAlign.center,
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr, style: TextStyle(
hintStyle: TextStyle( color: AppColors.mainColor,
// height: 3.0, fontSize: 26.sp,
fontSize: 22.sp, )),
color: const Color(0xFF999999)), ),
// labelText:"label", ),
labelStyle: const TextStyle(color: Color(0xFF999999)), onTap: () {
border: const OutlineInputBorder( logic.sendValidationCode();
/// },
borderRadius: BorderRadius.all(Radius.circular(10)), )))),
///
borderSide: BorderSide(
///
color: Color(0xffD3D3D3),
///
width: 1,
),
),
///
enabledBorder: const OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(10)),
///
borderSide: BorderSide(
///
color: Color(0xffD3D3D3),
///
width: 1,
),
),
disabledBorder: const OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(10)),
///
borderSide: BorderSide(
///
color: Color(0xffD3D3D3),
///
width: 1,
),
),
///
focusedBorder: const OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(10)),
///
borderSide: BorderSide(
///
color: Color(0xffD3D3D3),
///
width: 1,
),
),
),
obscureText: false,
onChanged: (String value) {},
),
),
SizedBox(height: 50.w), SizedBox(height: 50.w),
SubmitBtn( SubmitBtn(
btnName: TranslationLoader.lanKeys!.next!.tr, btnName: TranslationLoader.lanKeys!.next!.tr,
onClick: () { onClick: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.minePersonInfoEditAccountNextPage); context, Routers.minePersonInfoEditAccountNextPage,
arguments: {'isFrom': '1'});
}), }),
SizedBox(height: 50.w), SizedBox(height: 50.w),
Row( Row(

View File

@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginData.dart';
import 'package:star_lock/login/seletCountryRegion/common/index.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/translations/trans_lib.dart';
class MineInfoEditAccountState {
final TextEditingController codeController = TextEditingController();
static int currentTimeMillis() {
return DateTime.now().millisecondsSinceEpoch;
}
var countryCode = '+86'.obs;
var countryId = '9'.obs;
var codeType = '4'.obs; //123456
var channel = '1'.obs; // 1 2
var uniqueid = 'B748F838-94EE-4BDB-A0E6-7B2D16849792'.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs; //
var canSub = false.obs;
var date = currentTimeMillis().toString().obs;
bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs;
var btnText = ''.obs;
var totalSeconds = 120;
var currentSecond = 120;
final loginData = LoginData().obs;
///
void saveLoginData(LoginData? data) async {
print("saveLoginData:${data!.mobile}");
await Storage.setString('userLoginData', jsonEncode(data));
loginData.value = data;
}
///
void initLoginData() async {
final data = await Storage.getString('userLoginData');
print("getLoginData:$data");
if (data != null && data.isNotEmpty) {
loginData.value = LoginData.fromJson(jsonDecode(data));
}
}
MineInfoEditAccountState() {
Map map = Get.arguments;
channel.value = map["isFrom"];
resetResend();
}
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
}
void onClose() {}
}

View File

@ -0,0 +1,89 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:get/get_navigation/src/extension_navigation.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
class PersonInfoEditAccountLogic extends BaseGetXController {
final PersonInfoEditAccountState state = PersonInfoEditAccountState();
late Timer _timer;
void _startTimer() {
_timer = Timer.periodic(1.seconds, (timer) {
if (state.currentSecond > 1) {
state.currentSecond--;
} else {
_cancelTimer();
state.currentSecond = state.totalSeconds;
}
state.resetResend();
});
}
void _cancelTimer() {
_timer.cancel();
}
//
void sendValidationCode() async {
var entity = await ApiRepository.to.getValidationCodeAuth(
state.countryCode.value,
state.loginData.value.mobile!,
state.channel.value,
state.codeType.value,
state.uniqueid.value,
state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) {
_startTimer();
} else {}
}
//
Future<void> deleteAccountRequest() async {
LoginEntity entity = await ApiRepository.to
.deleteAccount("", "", state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '验证成功,账号已删除');
//
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if (controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub() {
state.canSub.value = state.codeIsOK;
}
@override
void onReady() {
super.onReady();
}
@override
void onInit() {
super.onInit();
state.initLoginData();
}
@override
void onClose() {
super.onClose();
}
}

View File

@ -1,10 +1,7 @@
import 'dart:async';
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:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/tf_input_haveBorder.dart'; import '../../../../tools/tf_input_haveBorder.dart';
@ -21,9 +18,8 @@ class MinePersonInfoEditAccountNextPage extends StatefulWidget {
class _MinePersonInfoEditAccountNextPageState class _MinePersonInfoEditAccountNextPageState
extends State<MinePersonInfoEditAccountNextPage> { extends State<MinePersonInfoEditAccountNextPage> {
final TextEditingController _editAccountController = TextEditingController(); final logic = Get.put(PersonInfoEditAccountLogic());
late Timer _timer; final state = Get.find<PersonInfoEditAccountLogic>().state;
int _seconds = 60;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -45,10 +41,11 @@ class _MinePersonInfoEditAccountNextPageState
TextStyle(fontWeight: FontWeight.w600, fontSize: 24.sp), TextStyle(fontWeight: FontWeight.w600, fontSize: 24.sp),
)), )),
Container( Container(
height: 100.h,
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 30.w, right: 30.w, top: 10.h, bottom: 10.h), left: 30.w, right: 30.w, top: 10.h, bottom: 10.h),
child: TFInputHaveBorder( child: TFInputHaveBorder(
controller: _editAccountController, controller: state.accountController,
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
), ),
), ),
@ -56,9 +53,9 @@ class _MinePersonInfoEditAccountNextPageState
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 30.w, right: 30.w, top: 20.h, bottom: 10.h), left: 30.w, right: 30.w, top: 20.h, bottom: 10.h),
child: TFInputHaveBorder( child: TFInputHaveBorder(
controller: _editAccountController, controller: state.codeController,
label: label:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr} ${TranslationLoader.lanKeys!.verificationCode!.tr}", "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
rightSlot: GestureDetector( rightSlot: GestureDetector(
child: Container( child: Container(
width: 180.w, width: 180.w,
@ -71,11 +68,7 @@ class _MinePersonInfoEditAccountNextPageState
// ), // ),
child: Center( child: Center(
child: Text( child: Text(
_seconds == 60 '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
? '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}'
: (_seconds < 10)
? '0$_seconds s'
: '$_seconds s',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.grey, color: Colors.grey,
@ -83,13 +76,7 @@ class _MinePersonInfoEditAccountNextPageState
)), )),
), ),
), ),
onTap: () { onTap: () {},
if (_seconds == 60) {
// _setVerify();
} else {
// Toast.show(msg: '正在获取验证码');
}
},
)), )),
), ),
SizedBox(height: 50.w), SizedBox(height: 50.w),

View File

@ -0,0 +1,68 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginData.dart';
import 'package:star_lock/login/seletCountryRegion/common/index.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/translations/trans_lib.dart';
class PersonInfoEditAccountState {
final TextEditingController accountController = TextEditingController();
final TextEditingController codeController = TextEditingController();
static int currentTimeMillis() {
return DateTime.now().millisecondsSinceEpoch;
}
var countryCode = '+86'.obs;
var countryId = '9'.obs;
var codeType = '3'.obs; //123456
var channel = '1'.obs; // 1 2
var uniqueid = 'B748F838-94EE-4BDB-A0E6-7B2D16849792'.obs;
var newAccountStr = ''.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs; //
var canSub = false.obs;
var date = currentTimeMillis().toString().obs;
bool get accountIsOK => newAccountStr.value.isNotEmpty;
bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs;
var btnText = ''.obs;
var totalSeconds = 120;
var currentSecond = 120;
final loginData = LoginData().obs;
///
void saveLoginData(LoginData? data) async {
print("saveLoginData:${data!.mobile}");
await Storage.setString('userLoginData', jsonEncode(data));
loginData.value = data;
}
///
void initLoginData() async {
final data = await Storage.getString('userLoginData');
print("getLoginData:$data");
if (data != null && data.isNotEmpty) {
loginData.value = LoginData.fromJson(jsonDecode(data));
}
}
PersonInfoEditAccountState() {
Map map = Get.arguments;
channel.value = map["isFrom"];
resetResend();
}
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
}
void onClose() {}
}

View File

@ -0,0 +1,15 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
class MinePersonInfoEditNamePageState {
final TextEditingController nickNameController = TextEditingController();
final inputNickName = ''.obs;
var canSub = false.obs;
bool get nickNameIsOK => inputNickName.value.isNotEmpty;
MinePersonInfoEditNamePageState() {
Map map = Get.arguments;
inputNickName.value = map["nickName"];
}
}

View File

@ -0,0 +1,43 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditName/MinePersonInfoEditNamePage_state.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart';
class MinePersonInfoEditNameLogic extends BaseGetXController {
final MinePersonInfoEditNamePageState state =
MinePersonInfoEditNamePageState();
//-
Future<void> updateUserInfoRequest() async {
var entity =
await ApiRepository.to.updateUserInfo(state.inputNickName.value);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '操作成功');
Get.back();
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if (controller == state.nickNameController) {
state.inputNickName.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub() {
state.canSub.value = state.nickNameIsOK;
}
@override
void onInit() {
super.onInit();
state.nickNameController.text = state.inputNickName.value;
}
}

View File

@ -1,6 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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:star_lock/mine/minePersonInfo/minePersonInfoEditName/MinePersonInfoEditName_logic.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/tf_loginInput.dart'; import '../../../tools/tf_loginInput.dart';
@ -17,8 +20,8 @@ class MinePersonInfoEditNamePage extends StatefulWidget {
class _MinePersonInfoEditNamePageState class _MinePersonInfoEditNamePageState
extends State<MinePersonInfoEditNamePage> { extends State<MinePersonInfoEditNamePage> {
final TextEditingController _changeNickNameController = final logic = Get.put(MinePersonInfoEditNameLogic());
TextEditingController(); final state = Get.find<MinePersonInfoEditNameLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -34,7 +37,13 @@ class _MinePersonInfoEditNamePageState
TranslationLoader.lanKeys!.save!.tr, TranslationLoader.lanKeys!.save!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () {}, onPressed: () {
if (state.nickNameIsOK == false) {
Toast.show(msg: '请输入昵称');
} else {
logic.updateUserInfoRequest();
}
},
), ),
], ],
), ),
@ -43,13 +52,16 @@ class _MinePersonInfoEditNamePageState
child: Column( child: Column(
children: [ children: [
LoginInput( LoginInput(
controller: _changeNickNameController, controller: state.nickNameController,
isPwd: true, onchangeAction: (textStr) {
logic.checkNext(state.nickNameController);
},
isPwd: false,
leftWidget: SizedBox(width: 15.w), leftWidget: SizedBox(width: 15.w),
hintText: hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.accountNumber!.tr}", "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.nickName!.tr}",
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
], ],
), ),

View File

@ -0,0 +1,102 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
class MinePersonInfoEmailLogic extends BaseGetXController {
final MinePersonInfoEmailState state = MinePersonInfoEmailState();
late Timer _timer;
void _startTimer() {
_timer = Timer.periodic(1.seconds, (timer) {
if (state.currentSecond > 1) {
state.currentSecond--;
} else {
_cancelTimer();
state.currentSecond = state.totalSeconds;
}
state.resetResend();
});
}
void _cancelTimer() {
_timer.cancel();
}
//
void sendValidationCode() async {
var entity = await ApiRepository.to.getValidationCodeAuth(
state.countryCode.value,
state.inputAccount.value,
state.channel.value,
state.codeType.value,
state.uniqueid.value,
state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) {
_startTimer();
}
}
//
Future<void> bindEmailRequest() async {
PasswordKeyListEntity entity = await ApiRepository.to.bindEmail(
state.inputAccount.value, '', state.verificationCode.value, '');
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '邮箱绑定成功');
Get.back();
}
}
//
Future<void> bindMobileRequest() async {
PasswordKeyListEntity entity = await ApiRepository.to.changeAccount(
state.countryCode.value,
state.inputAccount.value,
state.uniqueid.value,
state.verificationCode.value);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '手机绑定成功');
Get.back();
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if (controller == state.accountController) {
state.inputAccount.value = controller.text;
state.accountIsOK.value = state.inputAccount.value.isNotEmpty;
}
if (controller == state.codeController) {
state.verificationCode.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub() {
state.canSub.value = state.codeIsOK;
}
@override
void onReady() {
super.onReady();
}
@override
void onInit() {
super.onInit();
}
@override
void onClose() {
super.onClose();
}
}

View File

@ -1,10 +1,9 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_logic.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/submitBtn.dart'; import '../../../tools/submitBtn.dart';
import '../../../tools/tf_loginInput.dart'; import '../../../tools/tf_loginInput.dart';
@ -21,10 +20,8 @@ class MinePersonInfoEditEmailPage extends StatefulWidget {
class _MinePersonInfoEditEmailPageState class _MinePersonInfoEditEmailPageState
extends State<MinePersonInfoEditEmailPage> { extends State<MinePersonInfoEditEmailPage> {
final TextEditingController _phoneController = TextEditingController(); final logic = Get.put(MinePersonInfoEmailLogic());
final TextEditingController _codeController = TextEditingController(); final state = Get.find<MinePersonInfoEmailLogic>().state;
late Timer _timer;
int _seconds = 60;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -46,70 +43,84 @@ class _MinePersonInfoEditEmailPageState
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
LoginInput( LoginInput(
controller: _phoneController, controller: state.accountController,
isPwd: true, isPwd: false,
onchangeAction: (textStr) {
logic.checkNext(state.accountController);
},
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
hintText: hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}", "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}",
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
SizedBox(height: 10.w), SizedBox(height: 10.w),
Row( Row(
children: [ children: [
Expanded( Expanded(
child: LoginInput( child: LoginInput(
controller: _codeController, controller: state.codeController,
isPwd: true, isPwd: false,
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
onchangeAction: (textStr) {
logic.checkNext(state.codeController);
},
hintText: hintText:
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}", "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
), ),
SizedBox( SizedBox(
width: 20.w, width: 20.w,
), ),
GestureDetector( Obx(() => GestureDetector(
child: Container( child: Container(
width: 140.w, width: 180.w,
// height: 60.h, height: 60.h,
padding: EdgeInsets.all(8.h), padding: EdgeInsets.all(5.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: AppColors.mainColor, color: state.accountIsOK.value
borderRadius: BorderRadius.circular(5)), ? AppColors.mainColor
child: Center( : AppColors.btnDisableColor,
child: Text( borderRadius: BorderRadius.circular(5)),
_seconds == 60 child: Center(
? '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}' child: Text(state.btnText.value,
: (_seconds < 10) textAlign: TextAlign.center,
? '0$_seconds s' style: TextStyle(
: '$_seconds s', color: Colors.white,
textAlign: TextAlign.center, fontSize: 24.sp,
style: TextStyle( )),
color: Colors.white, ),
fontSize: 22.sp, ),
)), onTap: () {
), if (state.accountIsOK.value) {
), logic.sendValidationCode();
onTap: () { }
if (_seconds == 60) { },
// _setVerify(); ))
} else {
// Toast.show(msg: '正在获取验证码');
}
},
)
], ],
), ),
SizedBox(height: 50.w), SizedBox(height: 50.w),
SubmitBtn( Obx(() {
btnName: TranslationLoader.lanKeys!.sure!.tr, return SubmitBtn(
fontSize: 28.sp, btnName: TranslationLoader.lanKeys!.sure!.tr,
borderRadius: 20.w, fontSize: 30.sp,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), borderRadius: 20.w,
onClick: () {}), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
if (state.accountIsOK.value && state.codeIsOK) {
if (state.channel.value == "1") {
logic.bindMobileRequest();
} else {
logic.bindEmailRequest();
}
}
}
: null);
}),
], ],
), ),
)); ));

View File

@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/translations/trans_lib.dart';
class MinePersonInfoEmailState {
final TextEditingController accountController = TextEditingController();
final TextEditingController codeController = TextEditingController();
static int currentTimeMillis() {
return DateTime.now().millisecondsSinceEpoch;
}
var countryCode = '+86'.obs;
var countryId = '9'.obs;
var codeType = '4'.obs; //123456
var channel = '1'.obs; // 1 2
var uniqueid = 'B748F838-94EE-4BDB-A0E6-7B2D16849792'.obs;
var verificationCode = ''.obs;
var xWidth = ''.obs; //
var canSub = false.obs;
var date = currentTimeMillis().toString().obs;
var inputAccount = ''.obs; //
var accountIsOK = false.obs;
bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs;
var btnText = ''.obs;
var totalSeconds = 120;
var currentSecond = 120;
MinePersonInfoEmailState() {
Map map = Get.arguments;
channel.value = map["isFrom"];
// 1 2
// 123456
if (channel.value == "1") {
codeType.value = "3";
} else {
codeType.value = "6";
}
resetResend();
}
void resetResend() {
canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value
? '$currentSecond s'
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
}
void onClose() {}
}

View File

@ -0,0 +1,46 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
class MinePersonInfoResetPasswordLogic extends BaseGetXController {
final MinePersonInfoResetPasswordState state =
MinePersonInfoResetPasswordState();
void changePasswordRequest() async {
var entity = await ApiRepository.to.changePassword(
state.date.value, state.surePwd.value, state.oldPwd.value, "");
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '重置成功');
Get.back();
} else {
print('Error');
}
}
void checkNext(TextEditingController controller) {
changeInput(controller);
}
void changeInput(TextEditingController controller) {
if (controller == state.oldPwdController) {
state.oldPwd.value = controller.text;
}
if (controller == state.newPwdController) {
state.newPwd.value = controller.text;
}
if (controller == state.surePwdController) {
state.surePwd.value = controller.text;
}
_resetCanSub();
}
void _resetCanSub() {
state.canSub.value = state.oldPwdIsOK && state.newPwdIsOK;
print("22222:${state.canSub.value}");
}
}

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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:star_lock/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_logic.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
@ -19,9 +21,8 @@ class MinePersonInfoResetPasswordPage extends StatefulWidget {
class _MinePersonInfoResetPasswordPageState class _MinePersonInfoResetPasswordPageState
extends State<MinePersonInfoResetPasswordPage> { extends State<MinePersonInfoResetPasswordPage> {
final TextEditingController _oldPwdController = TextEditingController(); final logic = Get.put(MinePersonInfoResetPasswordLogic());
final TextEditingController _newPwdController = TextEditingController(); final state = Get.find<MinePersonInfoResetPasswordLogic>().state;
final TextEditingController _surePwdController = TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,7 +37,7 @@ class _MinePersonInfoResetPasswordPageState
child: Column( child: Column(
children: [ children: [
LoginInput( LoginInput(
controller: _oldPwdController, controller: state.oldPwdController,
isPwd: true, isPwd: true,
leftWidget: Text( leftWidget: Text(
"${TranslationLoader.lanKeys!.originalPassword!.tr} ", "${TranslationLoader.lanKeys!.originalPassword!.tr} ",
@ -44,10 +45,10 @@ class _MinePersonInfoResetPasswordPageState
), ),
hintText: "", hintText: "",
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
LoginInput( LoginInput(
controller: _newPwdController, controller: state.newPwdController,
isPwd: true, isPwd: true,
leftWidget: Text( leftWidget: Text(
"${TranslationLoader.lanKeys!.newPassword!.tr} ", "${TranslationLoader.lanKeys!.newPassword!.tr} ",
@ -55,10 +56,10 @@ class _MinePersonInfoResetPasswordPageState
), ),
hintText: "", hintText: "",
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
LoginInput( LoginInput(
controller: _surePwdController, controller: state.surePwdController,
isPwd: true, isPwd: true,
// isHaveLeftWidget: false, // isHaveLeftWidget: false,
leftWidget: Text( leftWidget: Text(
@ -67,7 +68,7 @@ class _MinePersonInfoResetPasswordPageState
), ),
hintText: "", hintText: "",
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
Container( Container(
width: 1.sw, width: 1.sw,
@ -77,12 +78,12 @@ class _MinePersonInfoResetPasswordPageState
style: TextStyle( style: TextStyle(
fontSize: 18.w, color: AppColors.darkGrayTextColor))), fontSize: 18.w, color: AppColors.darkGrayTextColor))),
SizedBox(height: 50.w), SizedBox(height: 50.w),
SubmitBtn( Obx(() => SubmitBtn(
btnName: TranslationLoader.lanKeys!.save!.tr, btnName: TranslationLoader.lanKeys!.save!.tr,
fontSize: 30.sp, fontSize: 30.sp,
borderRadius: 20.w, borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}), onClick: () {})),
SizedBox(height: 40.w), SizedBox(height: 40.w),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

View File

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MinePersonInfoResetPasswordState {
final TextEditingController oldPwdController = TextEditingController();
final TextEditingController newPwdController = TextEditingController();
final TextEditingController surePwdController = TextEditingController();
static int currentTimeMillis() {
return DateTime.now().millisecondsSinceEpoch;
}
var oldPwd = ''.obs;
var newPwd = ''.obs;
var surePwd = ''.obs;
var canSub = false.obs;
var date = currentTimeMillis().toString().obs;
bool get oldPwdIsOK => oldPwd.value.isNotEmpty;
bool get newPwdIsOK =>
newPwd.value.isNotEmpty && (newPwd.value == surePwd.value);
var canResend = false.obs;
void onClose() {}
}

View File

@ -5,7 +5,6 @@ import 'package:get/get.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/commonItem.dart'; import '../../../tools/commonItem.dart';
import '../../../tools/submitBtn.dart'; import '../../../tools/submitBtn.dart';
import '../../../tools/tf_loginInput.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';

View File

@ -123,4 +123,10 @@ abstract class Api {
final String userLogoutURL = '/user/logout'; //退 final String userLogoutURL = '/user/logout'; //退
final String deleteAccountURL = '/user/delete'; // final String deleteAccountURL = '/user/delete'; //
final String getUserInfoURL = '/user/getUserInfo'; // final String getUserInfoURL = '/user/getUserInfo'; //
final String getValidationCodeAuthURL =
'/user/sendValidationCodeAuth'; //使
final String updateUserInfoURL = '/user/updateUserInfo'; //-/
final String changeAccountURL = '/user/changeAccount'; //
final String bindEmailURL = '/user/bindEmail'; //
final String changePasswordURL = '/user/changePassword'; //
} }

View File

@ -255,24 +255,19 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> lockRecordUploadData( Future<Response> lockRecordUploadData(String lockId, List records) => post(
String lockId, lockRecordUploadURL.toUrl,
List records) => jsonEncode({
post( 'lockId': lockId,
lockRecordUploadURL.toUrl, 'records': records,
jsonEncode({ }));
'lockId': lockId,
'records': records,
}));
// //
Future<Response> getLockRecordLastUploadDataTime( Future<Response> getLockRecordLastUploadDataTime(String lockId) => post(
String lockId) => getLockRecordLastUploadDataTimeURL.toUrl,
post( jsonEncode({
getLockRecordLastUploadDataTimeURL.toUrl, 'lockId': lockId,
jsonEncode({ }));
'lockId': lockId,
}));
// //
Future<Response> bindingBlueAdmin( Future<Response> bindingBlueAdmin(
@ -1157,6 +1152,60 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> keyboardPwdReset(String lockId) => Future<Response> keyboardPwdReset(String lockId) =>
post(keyboardPwdResetURL.toUrl, jsonEncode({'lockId': lockId})); post(keyboardPwdResetURL.toUrl, jsonEncode({'lockId': lockId}));
//使
Future<Response> getValidationCodeAuth(String countryCode, String account,
String channel, String codeType, String uniqueid, String xWidth) =>
post(
getValidationCodeAuthURL.toUrl,
jsonEncode({
'countryCode': countryCode,
'account': account,
"channel": channel,
'codeType': codeType,
"uniqueid": uniqueid,
'xWidth': xWidth,
}));
//-/
Future<Response> updateUserInfo(String nickname) =>
post(updateUserInfoURL.toUrl, jsonEncode({'nickname': nickname}));
//
Future<Response> changeAccount(String countryCode, String newAccount,
String uniqueid, String verificationCode) =>
post(
changeAccountURL.toUrl,
jsonEncode({
'countryCode': countryCode,
'newAccount': newAccount,
'uniqueid': uniqueid,
'verificationCode': verificationCode
}));
//
Future<Response> bindEmail(String email, String uniqueid,
String verificationCode, String operatorUid) =>
post(
bindEmailURL.toUrl,
jsonEncode({
'email': email,
'uniqueid': uniqueid,
'verificationCode': verificationCode,
'operatorUid': operatorUid
}));
//
Future<Response> changePassword(String date, String newPassword,
String oldPassword, String operatorUid) =>
post(
changePasswordURL.toUrl,
jsonEncode({
"date": date,
'newPassword': newPassword,
"oldPassword": oldPassword,
'operatorUid': operatorUid
}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -7,6 +7,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/main/lockDetail/lcokSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; 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/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_entity.dart';
import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart'; import 'package:star_lock/mine/mineSet/appUnlockNeedMobileNetworkingLock/selectLockListEntity.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart'; import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
@ -211,23 +212,15 @@ class ApiRepository {
// //
Future<KeyOperationRecordEntity> lockRecordUploadData( Future<KeyOperationRecordEntity> lockRecordUploadData(
{ {required String lockId, required List records}) async {
required String lockId, final res = await apiProvider.lockRecordUploadData(lockId, records);
required List records
}) async {
final res = await apiProvider.lockRecordUploadData(
lockId,
records);
return KeyOperationRecordEntity.fromJson(res.body); return KeyOperationRecordEntity.fromJson(res.body);
} }
// //
Future<LockOperatingRecordGetLastRecordTimeEntity> getLockRecordLastUploadDataTime( Future<LockOperatingRecordGetLastRecordTimeEntity>
{ getLockRecordLastUploadDataTime({required String lockId}) async {
required String lockId final res = await apiProvider.getLockRecordLastUploadDataTime(lockId);
}) async {
final res = await apiProvider.getLockRecordLastUploadDataTime(
lockId);
return LockOperatingRecordGetLastRecordTimeEntity.fromJson(res.body); return LockOperatingRecordGetLastRecordTimeEntity.fromJson(res.body);
} }
@ -1134,17 +1127,17 @@ class ApiRepository {
} }
// //
Future<AuthorizedAdminListEntity> deleteAccount( Future<LoginEntity> deleteAccount(
String operatorUid, String uniqueid, String verificationCode) async { String operatorUid, String uniqueid, String verificationCode) async {
final res = await apiProvider.deleteAccount( final res = await apiProvider.deleteAccount(
operatorUid, uniqueid, verificationCode); operatorUid, uniqueid, verificationCode);
return AuthorizedAdminListEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
// //
Future<AuthorizedAdminListEntity> getUserInfo(String operatorUid) async { Future<MinePersonInfoEntity> getUserInfo(String operatorUid) async {
final res = await apiProvider.getUserInfo(operatorUid); final res = await apiProvider.getUserInfo(operatorUid);
return AuthorizedAdminListEntity.fromJson(res.body); return MinePersonInfoEntity.fromJson(res.body);
} }
// //
@ -1152,4 +1145,47 @@ class ApiRepository {
final res = await apiProvider.keyboardPwdReset(lockId); final res = await apiProvider.keyboardPwdReset(lockId);
return PasswordKeyListEntity.fromJson(res.body); return PasswordKeyListEntity.fromJson(res.body);
} }
// 2使 sendValidationCodeAuth 5
Future<SendValidationCodeEntity> getValidationCodeAuth(
String countryCode,
String account,
String channel,
String codeType,
String uniqueid,
String xWidth) async {
final res = await apiProvider.getValidationCodeAuth(
countryCode, account, channel, codeType, uniqueid, xWidth);
return SendValidationCodeEntity.fromJson(res.body);
}
//-/
Future<PasswordKeyListEntity> updateUserInfo(String nickname) async {
final res = await apiProvider.updateUserInfo(nickname);
return PasswordKeyListEntity.fromJson(res.body);
}
//
Future<PasswordKeyListEntity> changeAccount(String countryCode,
String newAccount, String uniqueid, String verificationCode) async {
final res = await apiProvider.changeAccount(
countryCode, newAccount, uniqueid, verificationCode);
return PasswordKeyListEntity.fromJson(res.body);
}
//
Future<PasswordKeyListEntity> bindEmail(String email, String uniqueid,
String verificationCode, String operatorUid) async {
final res = await apiProvider.bindEmail(
email, uniqueid, verificationCode, operatorUid);
return PasswordKeyListEntity.fromJson(res.body);
}
//
Future<LoginEntity> changePassword(String date, String newPassword,
String oldPassword, String operatorUid) async {
final res = await apiProvider.changePassword(
date, newPassword, oldPassword, operatorUid);
return LoginEntity.fromJson(res.body);
}
} }

View File

@ -8,7 +8,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
* */ * */
class TFInputHaveBorder extends StatelessWidget { class TFInputHaveBorder extends StatelessWidget {
TextEditingController? controller; TextEditingController? controller;
List<TextInputFormatter>? inputFormatters; List<TextInputFormatter>? inputFormatters;
TextInputType? keyboardType; TextInputType? keyboardType;
@ -18,7 +17,18 @@ class TFInputHaveBorder extends StatelessWidget {
String? label; String? label;
bool? isPwd; bool? isPwd;
Widget? rightSlot; Widget? rightSlot;
TFInputHaveBorder({Key? key, required this.controller,this.rightSlot,this.label,this.isPwd,this.inputFormatters,this.keyboardType,this.background,this.hintText, this.leftImg}) : super(key: key); TFInputHaveBorder(
{Key? key,
required this.controller,
this.rightSlot,
this.label,
this.isPwd,
this.inputFormatters,
this.keyboardType,
this.background,
this.hintText,
this.leftImg})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -29,39 +39,47 @@ class TFInputHaveBorder extends StatelessWidget {
maxLines: 1, maxLines: 1,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
// inputFormatters: inputFormatterstters??[], // inputFormatters: inputFormatterstters??[],
controller:controller, controller: controller,
autofocus: false, autofocus: false,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style:TextStyle(height: 1.1, fontSize: 30.sp, fontWeight: FontWeight.w400, color: const Color(0xFF333333)), style: TextStyle(
height: 1.1,
fontSize: 24.sp,
fontWeight: FontWeight.w400,
color: const Color(0xFF333333)),
decoration: InputDecoration( decoration: InputDecoration(
hintText: label, hintText: label,
hintStyle: TextStyle( hintStyle: TextStyle(
height: 1.1, height: 1.1,
fontSize: 30.sp, fontSize: 24.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: const Color(0xFF999999) color: const Color(0xFF999999)),
),
// labelText:"label", // labelText:"label",
labelStyle: const TextStyle(color: Color(0xFF999999)), labelStyle: const TextStyle(color: Color(0xFF999999)),
border: const OutlineInputBorder( border: const OutlineInputBorder(
/// ///
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
/// ///
borderSide: BorderSide( borderSide: BorderSide(
/// ///
color: Color(0xffD3D3D3), color: Color(0xffD3D3D3),
/// ///
width: 1, width: 1,
), ),
), ),
/// ///
enabledBorder: const OutlineInputBorder( enabledBorder: const OutlineInputBorder(
/// ///
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
/// ///
borderSide: BorderSide( borderSide: BorderSide(
/// ///
color: Color(0xffD3D3D3), color: Color(0xffD3D3D3),
/// ///
width: 1, width: 1,
), ),
@ -69,33 +87,36 @@ class TFInputHaveBorder extends StatelessWidget {
disabledBorder: const OutlineInputBorder( disabledBorder: const OutlineInputBorder(
/// ///
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
/// ///
borderSide: BorderSide( borderSide: BorderSide(
/// ///
color: Color(0xffD3D3D3), color: Color(0xffD3D3D3),
/// ///
width: 1, width: 1,
), ),
), ),
/// ///
focusedBorder: const OutlineInputBorder( focusedBorder: const OutlineInputBorder(
/// ///
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
/// ///
borderSide: BorderSide( borderSide: BorderSide(
/// ///
color: Color(0xffD3D3D3), color: Color(0xffD3D3D3),
/// ///
width: 1, width: 1,
), ),
), ),
), ),
obscureText:false, obscureText: false,
onChanged: (String value){ onChanged: (String value) {},
},
), ),
rightSlot??const SizedBox(width: 0,height: 0) rightSlot ?? const SizedBox(width: 0, height: 0)
], ],
); );
} }

View File

@ -311,6 +311,7 @@ class LanKeyEntity {
this.registerPasswordTip, this.registerPasswordTip,
this.iphone, this.iphone,
this.email, this.email,
this.mobileNumber,
this.countryAndRegion, this.countryAndRegion,
this.selet, this.selet,
this.businessCooperation, this.businessCooperation,
@ -734,6 +735,7 @@ class LanKeyEntity {
registerPasswordTip = json['registerPasswordTip']; registerPasswordTip = json['registerPasswordTip'];
iphone = json['iphone']; iphone = json['iphone'];
email = json['email']; email = json['email'];
mobileNumber = json['mobileNumber'];
countryAndRegion = json['countryAndRegion']; countryAndRegion = json['countryAndRegion'];
selet = json['selet']; selet = json['selet'];
@ -1158,6 +1160,7 @@ class LanKeyEntity {
String? registerPasswordTip; String? registerPasswordTip;
String? iphone; String? iphone;
String? email; String? email;
String? mobileNumber;
String? countryAndRegion; String? countryAndRegion;
String? selet; String? selet;
@ -1587,6 +1590,7 @@ class LanKeyEntity {
map['registerPasswordTip'] = registerPasswordTip; map['registerPasswordTip'] = registerPasswordTip;
map['iphone'] = iphone; map['iphone'] = iphone;
map['email'] = email; map['email'] = email;
map['mobileNumber'] = mobileNumber;
map['countryAndRegion'] = countryAndRegion; map['countryAndRegion'] = countryAndRegion;
map['selet'] = selet; map['selet'] = selet;