Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
55ea66a535
@ -255,6 +255,7 @@
|
|||||||
"pleaseEnterNewAccountNumber":"Please enter your new account number",
|
"pleaseEnterNewAccountNumber":"Please enter your new account number",
|
||||||
"changeIphoneTip":"When you retrieve your password and log in to a new device, you can verify it with the attached phone",
|
"changeIphoneTip":"When you retrieve your password and log in to a new device, you can verify it with the attached phone",
|
||||||
"changeEmailTip":"When you retrieve your password and log in to a new device, you can verify it with the attached Email",
|
"changeEmailTip":"When you retrieve your password and log in to a new device, you can verify it with the attached Email",
|
||||||
|
"goBind":"Go Bind",
|
||||||
"originalPassword":"Original Password",
|
"originalPassword":"Original Password",
|
||||||
"newPassword":"New Password",
|
"newPassword":"New Password",
|
||||||
"surePassword":"Sure Password",
|
"surePassword":"Sure Password",
|
||||||
@ -319,6 +320,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",
|
||||||
|
|||||||
@ -252,6 +252,7 @@
|
|||||||
"pleaseEnterNewAccountNumber":"pleaseEnterNewAccountNumber",
|
"pleaseEnterNewAccountNumber":"pleaseEnterNewAccountNumber",
|
||||||
"changeIphoneTip":"changeIphoneTip",
|
"changeIphoneTip":"changeIphoneTip",
|
||||||
"changeEmailTip":"changeEmailTip",
|
"changeEmailTip":"changeEmailTip",
|
||||||
|
"goBind":"goBind",
|
||||||
"originalPassword":"originalPassword",
|
"originalPassword":"originalPassword",
|
||||||
"newPassword":"newPassword",
|
"newPassword":"newPassword",
|
||||||
"surePassword":"surePassword",
|
"surePassword":"surePassword",
|
||||||
@ -319,6 +320,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",
|
||||||
|
|||||||
@ -247,11 +247,12 @@
|
|||||||
"modifyAccount":"修改账号",
|
"modifyAccount":"修改账号",
|
||||||
"resetPasswords":"重置密码",
|
"resetPasswords":"重置密码",
|
||||||
"safetyProblem":"安全问题",
|
"safetyProblem":"安全问题",
|
||||||
"modifyAccountTip":"为了你的账号安全,修改账号前请先使用账号密码验证",
|
"modifyAccountTip":"为了你的账号安全,修改账号前请先使用验证码验证",
|
||||||
"pleaseEnterAccountNumber":"请输入账号",
|
"pleaseEnterAccountNumber":"请输入账号",
|
||||||
"pleaseEnterNewAccountNumber":"请输入新账号",
|
"pleaseEnterNewAccountNumber":"请输入新账号",
|
||||||
"changeIphoneTip":"找回密码和登录新设备时,可通过绑定的手机验证",
|
"changeIphoneTip":"找回密码和登录新设备时,可通过绑定的手机验证",
|
||||||
"changeEmailTip":"找回密码和登录新设备时,可通过绑定的邮箱验证",
|
"changeEmailTip":"找回密码和登录新设备时,可通过绑定的邮箱验证",
|
||||||
|
"goBind":"去绑定",
|
||||||
"originalPassword":"原密码",
|
"originalPassword":"原密码",
|
||||||
"newPassword":"新密码",
|
"newPassword":"新密码",
|
||||||
"surePassword":"确认密码",
|
"surePassword":"确认密码",
|
||||||
@ -319,6 +320,7 @@
|
|||||||
"registerPasswordTip":"密码必须是8-20位,至少包括数字/字母/符号中的2种",
|
"registerPasswordTip":"密码必须是8-20位,至少包括数字/字母/符号中的2种",
|
||||||
"iphone":"手机",
|
"iphone":"手机",
|
||||||
"email":"邮箱",
|
"email":"邮箱",
|
||||||
|
"mobileNumber":"手机号",
|
||||||
"countryAndRegion":"国家/地区",
|
"countryAndRegion":"国家/地区",
|
||||||
"selet":"选择",
|
"selet":"选择",
|
||||||
"getVerificationCode":"获取验证码",
|
"getVerificationCode":"获取验证码",
|
||||||
|
|||||||
@ -12,6 +12,8 @@ PODS:
|
|||||||
- AMapFoundation (1.8.2)
|
- AMapFoundation (1.8.2)
|
||||||
- AMapLocation (2.10.0):
|
- AMapLocation (2.10.0):
|
||||||
- AMapFoundation (>= 1.8.0)
|
- AMapFoundation (>= 1.8.0)
|
||||||
|
- camera_avfoundation (0.0.1):
|
||||||
|
- Flutter
|
||||||
- device_info_plus (0.0.1):
|
- device_info_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
@ -62,6 +64,7 @@ DEPENDENCIES:
|
|||||||
- aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`)
|
- aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`)
|
||||||
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
|
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
|
||||||
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
|
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
|
||||||
|
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||||
@ -95,6 +98,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/amap_flutter_location/ios"
|
:path: ".symlinks/plugins/amap_flutter_location/ios"
|
||||||
amap_flutter_map:
|
amap_flutter_map:
|
||||||
:path: ".symlinks/plugins/amap_flutter_map/ios"
|
:path: ".symlinks/plugins/amap_flutter_map/ios"
|
||||||
|
camera_avfoundation:
|
||||||
|
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
@ -131,6 +136,7 @@ SPEC CHECKSUMS:
|
|||||||
amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
|
amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
|
||||||
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
||||||
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
|
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
|
||||||
|
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
<key>NSBluetoothPeripheralUsageDescription</key>
|
<key>NSBluetoothPeripheralUsageDescription</key>
|
||||||
<string>The app uses bluetooth to find, connect and transfer data between different devices</string>
|
<string>The app uses bluetooth to find, connect and transfer data between different devices</string>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>这是你的自拍照</string>
|
<string>照片</string>
|
||||||
<key>NSContactsUsageDescription</key>
|
<key>NSContactsUsageDescription</key>
|
||||||
<string>Reason we need access to the contact list</string>
|
<string>Reason we need access to the contact list</string>
|
||||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||||
|
|||||||
@ -9,7 +9,8 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
|
|||||||
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
|
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_page.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_main_page.dart';
|
||||||
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/adminDetailChangeDate_page.dart';
|
||||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
||||||
@ -109,8 +110,8 @@ import 'mine/gateway/gatewayList/gatewayList_page.dart';
|
|||||||
import 'mine/message/messageList_page.dart';
|
import 'mine/message/messageList_page.dart';
|
||||||
import 'mine/mine/starLockMine_page.dart';
|
import 'mine/mine/starLockMine_page.dart';
|
||||||
import 'mine/mineMultiLanguage/mineMultiLanguage_page.dart';
|
import 'mine/mineMultiLanguage/mineMultiLanguage_page.dart';
|
||||||
import 'mine/minePersonInfo/minePersonInfo/minePersonInfo_page.dart';
|
import 'mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
||||||
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/minePersonInfoEditAccount_page.dart';
|
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart';
|
||||||
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart';
|
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart';
|
||||||
import 'mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart';
|
import 'mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart';
|
||||||
import 'mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart';
|
import 'mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart';
|
||||||
@ -237,8 +238,8 @@ abstract class Routers {
|
|||||||
static const minePersonInfoPage = '/MinePersonInfoPage'; // 我的信息
|
static const minePersonInfoPage = '/MinePersonInfoPage'; // 我的信息
|
||||||
static const minePersonInfoEditNamePage =
|
static const minePersonInfoEditNamePage =
|
||||||
'/MinePersonInfoEditNamePage'; // 我的信息编辑昵称
|
'/MinePersonInfoEditNamePage'; // 我的信息编辑昵称
|
||||||
static const minePersonInfoEditAccountPage =
|
static const mineUnbindPhoneOrEmailPage =
|
||||||
'/MinePersonInfoEditAccountPage'; // 我的信息修改账号
|
'/MineUnbindPhoneOrEmailPage'; // 我的信息修改账号-解绑
|
||||||
static const minePersonInfoEditAccountNextPage =
|
static const minePersonInfoEditAccountNextPage =
|
||||||
'/MinePersonInfoEditAccountNextPage'; // 我的信息修改账号下一页
|
'/MinePersonInfoEditAccountNextPage'; // 我的信息修改账号下一页
|
||||||
static const minePersonInfoEditIphonePage =
|
static const minePersonInfoEditIphonePage =
|
||||||
@ -247,8 +248,9 @@ abstract class Routers {
|
|||||||
'/MinePersonInfoResetPasswordPage'; // 我的信息重置密码
|
'/MinePersonInfoResetPasswordPage'; // 我的信息重置密码
|
||||||
static const minePersonInfoSetSafetyProblemPage =
|
static const minePersonInfoSetSafetyProblemPage =
|
||||||
'/MinePersonInfoSetSafetyProblemPage'; // 我的信息设置安全问题
|
'/MinePersonInfoSetSafetyProblemPage'; // 我的信息设置安全问题
|
||||||
static const minePersonInfoEditEmailPage =
|
static const minePersonInfoViewSafetyProblemPage =
|
||||||
'/MinePersonInfoEditEmailPage'; //我的信息-邮箱
|
'/MinePersonInfoViewSafetyProblemPage'; // 查看我的安全问题
|
||||||
|
static const mineBindPhoneOrEmailPage = '/MineBindPhoneOrEmailPage'; //我的信息-邮箱
|
||||||
|
|
||||||
static const gatewayListPage = '/GatewayListPage'; // 我的-网关
|
static const gatewayListPage = '/GatewayListPage'; // 我的-网关
|
||||||
static const gatewayDetailPage = '/GatewayDetailPage'; // 我的-网关详情
|
static const gatewayDetailPage = '/GatewayDetailPage'; // 我的-网关详情
|
||||||
@ -616,8 +618,8 @@ abstract class AppRouters {
|
|||||||
page: () => const MinePersonInfoEditNamePage(),
|
page: () => const MinePersonInfoEditNamePage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.minePersonInfoEditAccountPage,
|
name: Routers.mineUnbindPhoneOrEmailPage,
|
||||||
page: () => const MinePersonInfoEditAccountPage(),
|
page: () => const MineUnbindPhoneOrEmailPage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.minePersonInfoEditIphonePage,
|
name: Routers.minePersonInfoEditIphonePage,
|
||||||
@ -749,8 +751,8 @@ abstract class AppRouters {
|
|||||||
name: Routers.selectGetewayListPage,
|
name: Routers.selectGetewayListPage,
|
||||||
page: () => const SelectGetewayListPage()),
|
page: () => const SelectGetewayListPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.minePersonInfoEditEmailPage,
|
name: Routers.mineBindPhoneOrEmailPage,
|
||||||
page: () => const MinePersonInfoEditEmailPage()),
|
page: () => const MineBindPhoneOrEmailPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addAuthorizedAdministratorPage,
|
name: Routers.addAuthorizedAdministratorPage,
|
||||||
page: () => const AddAuthorizedAdministratorPage()),
|
page: () => const AddAuthorizedAdministratorPage()),
|
||||||
@ -815,6 +817,9 @@ abstract class AppRouters {
|
|||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.expireLockChangeDatePage,
|
name: Routers.expireLockChangeDatePage,
|
||||||
page: () => const ExpireLockChangeDatePage()),
|
page: () => const ExpireLockChangeDatePage()),
|
||||||
GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage())
|
GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()),
|
||||||
|
GetPage(
|
||||||
|
name: Routers.minePersonInfoViewSafetyProblemPage,
|
||||||
|
page: () => const MinePersonInfoViewSafetyProblemPage())
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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: '验证成功,账号已删除');
|
||||||
//删除账号成功,
|
//删除账号成功,
|
||||||
|
|||||||
@ -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();
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -1,139 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.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/tools/seletImgTool.dart';
|
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
|
||||||
import '../../../tools/commonItem.dart';
|
|
||||||
import '../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class MinePersonInfoPage extends StatefulWidget {
|
|
||||||
const MinePersonInfoPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
allHeight: 100.h,
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
isHaveRightWidget: true,
|
|
||||||
rightWidget: Container(),
|
|
||||||
/*
|
|
||||||
Container(
|
|
||||||
width: 75.w,
|
|
||||||
height: 75.h,
|
|
||||||
child: Image.asset(
|
|
||||||
'images/mine/icon_mine_main_defaultAvatar.png')),
|
|
||||||
*/
|
|
||||||
action: () {
|
|
||||||
_openModalBottomSheet();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
|
||||||
rightTitle: "你好",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.minePersonInfoEditNamePage);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.accountNumber!.tr,
|
|
||||||
rightTitle: "786612630@qq.com",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.minePersonInfoEditAccountPage);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.email!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.minePersonInfoEditEmailPage);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.minePersonInfoResetPasswordPage);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
|
||||||
rightTitle: "",
|
|
||||||
isHaveLine: true,
|
|
||||||
isHaveDirection: true,
|
|
||||||
action: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.minePersonInfoSetSafetyProblemPage);
|
|
||||||
}),
|
|
||||||
CommonItem(
|
|
||||||
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
|
||||||
rightTitle: "中国",
|
|
||||||
isHaveLine: false,
|
|
||||||
isHaveDirection: false),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
Future _openModalBottomSheet() async {
|
|
||||||
final option = await showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
height: 200.0,
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
ListTile(
|
|
||||||
title: Text('拍照', textAlign: TextAlign.center),
|
|
||||||
onTap: () {
|
|
||||||
SeletImageTool().getCameraImage((imgStr) {
|
|
||||||
print("111111$imgStr");
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: Text('从相册选择', textAlign: TextAlign.center),
|
|
||||||
onTap: () {
|
|
||||||
SeletImageTool().getImage((imgStr) {
|
|
||||||
print("111111$imgStr");
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: Text('取消', textAlign: TextAlign.center),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context, '取消');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
|
||||||
@ -1,159 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../appRouters.dart';
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../tools/submitBtn.dart';
|
|
||||||
import '../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class MinePersonInfoEditAccountPage extends StatefulWidget {
|
|
||||||
const MinePersonInfoEditAccountPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MinePersonInfoEditAccountPage> createState() =>
|
|
||||||
_MinePersonInfoEditAccountPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MinePersonInfoEditAccountPageState
|
|
||||||
extends State<MinePersonInfoEditAccountPage> {
|
|
||||||
final TextEditingController _editAccountController = TextEditingController();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 1.sw,
|
|
||||||
color: AppColors.greyBackgroundColor,
|
|
||||||
padding: EdgeInsets.only(left: 15.w, top: 10.h, bottom: 10.h),
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.modifyAccountTip!.tr,
|
|
||||||
style: TextStyle(fontSize: 20.sp),
|
|
||||||
)),
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(20.h),
|
|
||||||
height: 110.h,
|
|
||||||
child: TextField(
|
|
||||||
// maxLines: 1,
|
|
||||||
keyboardType: TextInputType.text,
|
|
||||||
// inputFormatters: inputFormatterstters??[],
|
|
||||||
controller: _editAccountController,
|
|
||||||
autofocus: false,
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: TextStyle(
|
|
||||||
height: 3.2,
|
|
||||||
fontSize: 22.sp,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
color: const Color(0xFF333333)),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
// height: 3.0,
|
|
||||||
fontSize: 22.sp,
|
|
||||||
color: const Color(0xFF999999)),
|
|
||||||
// labelText:"label",
|
|
||||||
labelStyle: const TextStyle(color: Color(0xFF999999)),
|
|
||||||
border: const OutlineInputBorder(
|
|
||||||
///设置边框四个角的弧度
|
|
||||||
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),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
|
||||||
onClick: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.minePersonInfoEditAccountNextPage);
|
|
||||||
}),
|
|
||||||
SizedBox(height: 50.w),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
GestureDetector(
|
|
||||||
child: SizedBox(
|
|
||||||
// width: 150.w,
|
|
||||||
height: 50.h,
|
|
||||||
// color: Colors.red,
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp, color: AppColors.mainColor)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pushNamed(
|
|
||||||
context, Routers.starLockForgetPasswordPage);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(width: 30.w),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
class MineUnbindPhoneOrEmailEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
|
MineUnbindPhoneOrEmailEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
MineUnbindPhoneOrEmailEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? Data.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 Data {
|
||||||
|
String? token;
|
||||||
|
|
||||||
|
Data({this.token});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
token = json['token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['token'] = token;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
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/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_state.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class MineUnbindPhoneOrEmailLogic extends BaseGetXController {
|
||||||
|
final MineUnbindPhoneOrEmailState state = MineUnbindPhoneOrEmailState();
|
||||||
|
|
||||||
|
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.channel.value,
|
||||||
|
state.codeType.value,
|
||||||
|
state.uniqueid.value,
|
||||||
|
state.xWidth.value.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
_startTimer();
|
||||||
|
} else {}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取解绑手机号Token
|
||||||
|
Future<void> unbindPhoneTokenRequest() async {
|
||||||
|
MineUnbindPhoneOrEmailEntity entity =
|
||||||
|
await ApiRepository.to.unbindPhoneToken(state.verificationCode.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.unbindToken.value = entity.data!.token!;
|
||||||
|
Get.toNamed(Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||||
|
"isFrom": state.channel.value,
|
||||||
|
"unbindToken": state.unbindToken.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取解绑邮箱Token
|
||||||
|
Future<void> unbindEmailTokenRequest() async {
|
||||||
|
MineUnbindPhoneOrEmailEntity entity =
|
||||||
|
await ApiRepository.to.unbindEmailToken(state.verificationCode.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.unbindToken.value = entity.data!.token!;
|
||||||
|
Get.toNamed(Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||||
|
"isFrom": state.channel.value,
|
||||||
|
"unbindToken": state.unbindToken.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_logic.dart';
|
||||||
|
import 'package:star_lock/tools/tf_input_haveBorder.dart';
|
||||||
|
|
||||||
|
import '../../../../appRouters.dart';
|
||||||
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MineUnbindPhoneOrEmailPage extends StatefulWidget {
|
||||||
|
const MineUnbindPhoneOrEmailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MineUnbindPhoneOrEmailPage> createState() =>
|
||||||
|
_MineUnbindPhoneOrEmailState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
||||||
|
final logic = Get.put(MineUnbindPhoneOrEmailLogic());
|
||||||
|
final state = Get.find<MineUnbindPhoneOrEmailLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 1.sw,
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
|
padding: EdgeInsets.only(left: 15.w, top: 10.h, bottom: 10.h),
|
||||||
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.modifyAccountTip!.tr,
|
||||||
|
style: TextStyle(fontSize: 20.sp),
|
||||||
|
)),
|
||||||
|
Obx(() => Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 30.w, right: 30.w, top: 20.h, bottom: 10.h),
|
||||||
|
child: TFInputHaveBorder(
|
||||||
|
controller: state.codeController,
|
||||||
|
onChangeAction: () {
|
||||||
|
logic.checkNext(state.codeController);
|
||||||
|
},
|
||||||
|
label:
|
||||||
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
|
rightSlot: GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
width: 180.w,
|
||||||
|
height: 90.h,
|
||||||
|
padding: EdgeInsets.all(5.h),
|
||||||
|
margin: EdgeInsets.only(right: 10.w),
|
||||||
|
child: Center(
|
||||||
|
child: Text(state.btnText.value,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 26.sp,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
logic.sendValidationCode();
|
||||||
|
},
|
||||||
|
)))),
|
||||||
|
SizedBox(height: 50.w),
|
||||||
|
Obx(() => SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||||
|
isDisabled: state.canSub.value,
|
||||||
|
onClick: () {
|
||||||
|
if (state.channel.value == '1') {
|
||||||
|
logic.unbindPhoneTokenRequest();
|
||||||
|
} else {
|
||||||
|
logic.unbindEmailTokenRequest();
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
SizedBox(height: 50.w),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
child: SizedBox(
|
||||||
|
// width: 150.w,
|
||||||
|
height: 50.h,
|
||||||
|
// color: Colors.red,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp, color: AppColors.mainColor)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.starLockForgetPasswordPage);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(width: 30.w),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MineUnbindPhoneOrEmailState {
|
||||||
|
final TextEditingController codeController = TextEditingController();
|
||||||
|
|
||||||
|
static int currentTimeMillis() {
|
||||||
|
return DateTime.now().millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
|
||||||
|
var countryCode = ''.obs;
|
||||||
|
var codeType = '4'.obs; //1注册,2找回密码,3绑定手机号,4解绑手机(换绑),5删除账号,6 绑定邮箱,7解绑邮箱(换绑)
|
||||||
|
var channel = '1'.obs; //短信通道 1 短信,2 邮箱
|
||||||
|
var unbindToken = ''.obs; //解绑Token
|
||||||
|
var uniqueid = 'B748F838-94EE-4BDB-A0E6-7B2D16849792'.obs;
|
||||||
|
var mobileOrEmailStr = ''.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;
|
||||||
|
|
||||||
|
MineUnbindPhoneOrEmailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
channel.value = map["isFrom"];
|
||||||
|
if (channel.value == "1") {
|
||||||
|
mobileOrEmailStr.value = map['mobile'];
|
||||||
|
codeType.value = '4';
|
||||||
|
} else {
|
||||||
|
mobileOrEmailStr.value = map['email'];
|
||||||
|
codeType.value = '7';
|
||||||
|
}
|
||||||
|
|
||||||
|
resetResend();
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetResend() {
|
||||||
|
canResend.value = totalSeconds == currentSecond;
|
||||||
|
btnText.value = !canResend.value
|
||||||
|
? '$currentSecond s'
|
||||||
|
: btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onClose() {}
|
||||||
|
}
|
||||||
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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),
|
||||||
|
|||||||
@ -0,0 +1,73 @@
|
|||||||
|
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; ////1注册,2找回密码,3绑定手机号,4解绑手机(换绑),5删除账号,6 绑定邮箱,7解绑邮箱(换绑)
|
||||||
|
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"];
|
||||||
|
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() {}
|
||||||
|
}
|
||||||
@ -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"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -0,0 +1,106 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
|
||||||
|
class MineBindPhoneOrEmailLogic extends BaseGetXController {
|
||||||
|
final MineBindPhoneOrEmailState state = MineBindPhoneOrEmailState();
|
||||||
|
|
||||||
|
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.channel.value == '1' ? 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,
|
||||||
|
state.unbindToken.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: '邮箱绑定成功');
|
||||||
|
Get.until((route) => route.settings.name == Routers.minePersonInfoPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//绑定手机请求
|
||||||
|
Future<void> bindMobileRequest() async {
|
||||||
|
PasswordKeyListEntity entity = await ApiRepository.to.bindPhone(
|
||||||
|
state.countryCode.value,
|
||||||
|
state.inputAccount.value,
|
||||||
|
state.verificationCode.value,
|
||||||
|
state.unbindToken.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: '手机绑定成功');
|
||||||
|
Get.until((route) => route.settings.name == Routers.minePersonInfoPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart';
|
||||||
|
|
||||||
|
import '../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../tools/submitBtn.dart';
|
||||||
|
import '../../../tools/tf_loginInput.dart';
|
||||||
|
import '../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MineBindPhoneOrEmailPage extends StatefulWidget {
|
||||||
|
const MineBindPhoneOrEmailPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MineBindPhoneOrEmailPage> createState() =>
|
||||||
|
_MineBindPhoneOrEmailPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
||||||
|
final logic = Get.put(MineBindPhoneOrEmailLogic());
|
||||||
|
final state = Get.find<MineBindPhoneOrEmailLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: state.channel.value == "1"
|
||||||
|
? TranslationLoader.lanKeys!.mobileNumber!.tr
|
||||||
|
: TranslationLoader.lanKeys!.email!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Container(
|
||||||
|
padding: EdgeInsets.only(top: 10.h, left: 30.w, right: 30.w),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 1.sw,
|
||||||
|
padding: EdgeInsets.only(top: 5.h, bottom: 5.h),
|
||||||
|
child: Text(
|
||||||
|
state.channel.value == '1'
|
||||||
|
? TranslationLoader.lanKeys!.changeIphoneTip!.tr
|
||||||
|
: TranslationLoader.lanKeys!.changeEmailTip!.tr,
|
||||||
|
style: TextStyle(fontSize: 20.sp),
|
||||||
|
)),
|
||||||
|
LoginInput(
|
||||||
|
controller: state.accountController,
|
||||||
|
isPwd: false,
|
||||||
|
onchangeAction: (textStr) {
|
||||||
|
logic.checkNext(state.accountController);
|
||||||
|
},
|
||||||
|
leftWidget: const SizedBox(),
|
||||||
|
hintText: state.channel.value == '1'
|
||||||
|
? "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.mobileNumber!.tr}"
|
||||||
|
: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}",
|
||||||
|
inputFormatters: [
|
||||||
|
LengthLimitingTextInputFormatter(20),
|
||||||
|
]),
|
||||||
|
SizedBox(height: 10.w),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: LoginInput(
|
||||||
|
controller: state.codeController,
|
||||||
|
isPwd: false,
|
||||||
|
leftWidget: const SizedBox(),
|
||||||
|
onchangeAction: (textStr) {
|
||||||
|
logic.checkNext(state.codeController);
|
||||||
|
},
|
||||||
|
hintText:
|
||||||
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
|
inputFormatters: [
|
||||||
|
LengthLimitingTextInputFormatter(20),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Obx(() => GestureDetector(
|
||||||
|
child: Container(
|
||||||
|
width: 180.w,
|
||||||
|
height: 60.h,
|
||||||
|
padding: EdgeInsets.all(5.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: state.accountIsOK.value
|
||||||
|
? AppColors.mainColor
|
||||||
|
: AppColors.btnDisableColor,
|
||||||
|
borderRadius: BorderRadius.circular(5)),
|
||||||
|
child: Center(
|
||||||
|
child: Text(state.btnText.value,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
if (state.accountIsOK.value) {
|
||||||
|
logic.sendValidationCode();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 50.w),
|
||||||
|
Obx(() {
|
||||||
|
return SubmitBtn(
|
||||||
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
|
fontSize: 30.sp,
|
||||||
|
borderRadius: 20.w,
|
||||||
|
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);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MineBindPhoneOrEmailState {
|
||||||
|
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; //1注册,2找回密码,3绑定手机号,4解绑手机(换绑),5删除账号,6 绑定邮箱,7解绑邮箱(换绑)
|
||||||
|
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 unbindToken = ''.obs; //解绑的Token
|
||||||
|
|
||||||
|
var accountIsOK = false.obs;
|
||||||
|
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
||||||
|
|
||||||
|
var canResend = false.obs;
|
||||||
|
var btnText = ''.obs;
|
||||||
|
var totalSeconds = 120;
|
||||||
|
var currentSecond = 120;
|
||||||
|
|
||||||
|
MineBindPhoneOrEmailState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
unbindToken.value = map["unbindToken"];
|
||||||
|
channel.value = map["isFrom"];
|
||||||
|
//短信通道 1 短信,2 邮箱
|
||||||
|
//短信类型 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱
|
||||||
|
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() {}
|
||||||
|
}
|
||||||
@ -1,117 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../tools/submitBtn.dart';
|
|
||||||
import '../../../tools/tf_loginInput.dart';
|
|
||||||
import '../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../translations/trans_lib.dart';
|
|
||||||
|
|
||||||
class MinePersonInfoEditEmailPage extends StatefulWidget {
|
|
||||||
const MinePersonInfoEditEmailPage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<MinePersonInfoEditEmailPage> createState() =>
|
|
||||||
_MinePersonInfoEditEmailPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MinePersonInfoEditEmailPageState
|
|
||||||
extends State<MinePersonInfoEditEmailPage> {
|
|
||||||
final TextEditingController _phoneController = TextEditingController();
|
|
||||||
final TextEditingController _codeController = TextEditingController();
|
|
||||||
late Timer _timer;
|
|
||||||
int _seconds = 60;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle: TranslationLoader.lanKeys!.email!.tr,
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Container(
|
|
||||||
padding: EdgeInsets.only(top: 10.h, left: 30.w, right: 30.w),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 1.sw,
|
|
||||||
padding: EdgeInsets.only(top: 5.h, bottom: 5.h),
|
|
||||||
child: Text(
|
|
||||||
TranslationLoader.lanKeys!.changeEmailTip!.tr,
|
|
||||||
style: TextStyle(fontSize: 20.sp),
|
|
||||||
)),
|
|
||||||
LoginInput(
|
|
||||||
controller: _phoneController,
|
|
||||||
isPwd: true,
|
|
||||||
leftWidget: const SizedBox(),
|
|
||||||
hintText:
|
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}",
|
|
||||||
inputFormatters: [
|
|
||||||
// LengthLimitingTextInputFormatter(20),
|
|
||||||
]),
|
|
||||||
SizedBox(height: 10.w),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: LoginInput(
|
|
||||||
controller: _codeController,
|
|
||||||
isPwd: true,
|
|
||||||
leftWidget: const SizedBox(),
|
|
||||||
hintText:
|
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
|
||||||
inputFormatters: [
|
|
||||||
// LengthLimitingTextInputFormatter(20),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 20.w,
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
child: Container(
|
|
||||||
width: 140.w,
|
|
||||||
// height: 60.h,
|
|
||||||
padding: EdgeInsets.all(8.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
borderRadius: BorderRadius.circular(5)),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
_seconds == 60
|
|
||||||
? '${TranslationLoader.lanKeys!.getTip!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}'
|
|
||||||
: (_seconds < 10)
|
|
||||||
? '0$_seconds s'
|
|
||||||
: '$_seconds s',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 22.sp,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
if (_seconds == 60) {
|
|
||||||
// _setVerify();
|
|
||||||
} else {
|
|
||||||
// Toast.show(msg: '正在获取验证码');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: 50.w),
|
|
||||||
SubmitBtn(
|
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
|
||||||
fontSize: 28.sp,
|
|
||||||
borderRadius: 20.w,
|
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
|
||||||
onClick: () {}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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;
|
||||||
|
int? haveSafeAnswer;
|
||||||
|
String? nickname;
|
||||||
|
String? headUrl;
|
||||||
|
String? accountName;
|
||||||
|
int? countryId;
|
||||||
|
String? email;
|
||||||
|
String? countryName;
|
||||||
|
|
||||||
|
MinePersonInfoData(
|
||||||
|
{this.mobile,
|
||||||
|
this.uid,
|
||||||
|
this.haveSafeAnswer,
|
||||||
|
this.nickname,
|
||||||
|
this.headUrl,
|
||||||
|
this.accountName,
|
||||||
|
this.countryId,
|
||||||
|
this.email,
|
||||||
|
this.countryName});
|
||||||
|
|
||||||
|
MinePersonInfoData.fromJson(Map<String, dynamic> json) {
|
||||||
|
mobile = json['mobile'];
|
||||||
|
uid = json['uid'];
|
||||||
|
haveSafeAnswer = json['haveSafeAnswer'];
|
||||||
|
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['haveSafeAnswer'] = haveSafeAnswer;
|
||||||
|
data['nickname'] = nickname;
|
||||||
|
data['headUrl'] = headUrl;
|
||||||
|
data['accountName'] = accountName;
|
||||||
|
data['countryId'] = countryId;
|
||||||
|
data['email'] = email;
|
||||||
|
data['countryName'] = countryName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/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!;
|
||||||
|
state.haveSafeAnswer.value = entity.data!.haveSafeAnswer!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,195 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.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/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||||
|
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||||
|
import '../../../appRouters.dart';
|
||||||
|
import '../../../tools/commonItem.dart';
|
||||||
|
import '../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MinePersonInfoPage extends StatefulWidget {
|
||||||
|
const MinePersonInfoPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||||
|
final logic = Get.put(MinePersonInfoLogic());
|
||||||
|
final state = Get.find<MinePersonInfoLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
logic.getUserInfoRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
allHeight: 100.h,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 75.w,
|
||||||
|
height: 75.h,
|
||||||
|
child: state.image != null
|
||||||
|
? Image.file(state.image as File)
|
||||||
|
: Image.asset('images/controls_user.png'),
|
||||||
|
),
|
||||||
|
action: () {
|
||||||
|
_openModalBottomSheet();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
||||||
|
rightTitle: state.nickname.value,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.minePersonInfoEditNamePage,
|
||||||
|
arguments: {'nickName': state.nickname.value})
|
||||||
|
.then((value) => logic.getUserInfoRequest());
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
||||||
|
rightTitle: state.mobileStr.value.isNotEmpty
|
||||||
|
? state.mobileStr.value
|
||||||
|
: TranslationLoader.lanKeys!.goBind!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
||||||
|
if (state.mobileStr.value.isNotEmpty) {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||||
|
arguments: {
|
||||||
|
'mobile': state.mobileStr.value,
|
||||||
|
'isFrom': '1'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||||
|
'mobile': state.mobileStr.value,
|
||||||
|
'isFrom': '1'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.email!.tr,
|
||||||
|
rightTitle: state.emailStr.value.isNotEmpty
|
||||||
|
? state.emailStr.value
|
||||||
|
: TranslationLoader.lanKeys!.goBind!.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
||||||
|
if (state.emailStr.value.isNotEmpty) {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||||
|
arguments: {
|
||||||
|
'isFrom': '2',
|
||||||
|
'email': state.emailStr.value
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||||
|
'isFrom': '2',
|
||||||
|
'email': state.emailStr.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.minePersonInfoResetPasswordPage);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
if (state.haveSafeAnswer.value == 0) {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.minePersonInfoSetSafetyProblemPage)
|
||||||
|
.then((value) => logic.getUserInfoRequest());
|
||||||
|
} else {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.minePersonInfoViewSafetyProblemPage);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||||
|
rightTitle: state.countryStr.value,
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: false)),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _openModalBottomSheet() async {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertBottomWidget(
|
||||||
|
topTitle: '',
|
||||||
|
items: const ['拍照', '从相册选择'],
|
||||||
|
chooseCallback: (value) {
|
||||||
|
int getSelectIndex = value;
|
||||||
|
if (getSelectIndex == 0) {
|
||||||
|
//拍照选项
|
||||||
|
selectCamera();
|
||||||
|
} else if (getSelectIndex == 1) {
|
||||||
|
selectImage();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
///拍摄照片
|
||||||
|
selectCamera() async {
|
||||||
|
XFile? photo = await state.imagePicker.pickImage(
|
||||||
|
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
|
||||||
|
if (photo != null) {
|
||||||
|
state.image = photo;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///从相册选取
|
||||||
|
selectImage() async {
|
||||||
|
XFile? image = await state.imagePicker.pickImage(
|
||||||
|
source: ImageSource.gallery,
|
||||||
|
maxHeight: 250,
|
||||||
|
maxWidth: 250,
|
||||||
|
);
|
||||||
|
if (image != null) state.image = image;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||||
|
|
||||||
|
class MinePersonInfoState {
|
||||||
|
final mineInfoData = MinePersonInfoData().obs;
|
||||||
|
|
||||||
|
var nickname = ''.obs; //昵称
|
||||||
|
var mobileStr = ''.obs; //手机号
|
||||||
|
var emailStr = ''.obs; //邮箱
|
||||||
|
var countryStr = ''.obs; //国家/地区
|
||||||
|
var haveSafeAnswer = 0.obs; //是否已设置安全问题
|
||||||
|
|
||||||
|
// ImagePicker获取内容后返回的对象是XFile
|
||||||
|
XFile? image;
|
||||||
|
List<XFile>? imageList;
|
||||||
|
// 使用ImagePicker前必须先实例化
|
||||||
|
final ImagePicker imagePicker = ImagePicker();
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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,10 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
LoginInput(
|
LoginInput(
|
||||||
controller: _oldPwdController,
|
controller: state.oldPwdController,
|
||||||
|
onchangeAction: (textStr) {
|
||||||
|
logic.changeInput(state.oldPwdController);
|
||||||
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Text(
|
leftWidget: Text(
|
||||||
"${TranslationLoader.lanKeys!.originalPassword!.tr} ",
|
"${TranslationLoader.lanKeys!.originalPassword!.tr} ",
|
||||||
@ -44,10 +48,13 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText: "",
|
hintText: "",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
// LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
LoginInput(
|
LoginInput(
|
||||||
controller: _newPwdController,
|
controller: state.newPwdController,
|
||||||
|
onchangeAction: (textStr) {
|
||||||
|
logic.changeInput(state.newPwdController);
|
||||||
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Text(
|
leftWidget: Text(
|
||||||
"${TranslationLoader.lanKeys!.newPassword!.tr} ",
|
"${TranslationLoader.lanKeys!.newPassword!.tr} ",
|
||||||
@ -55,10 +62,13 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText: "",
|
hintText: "",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
// LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
LoginInput(
|
LoginInput(
|
||||||
controller: _surePwdController,
|
controller: state.surePwdController,
|
||||||
|
onchangeAction: (textStr) {
|
||||||
|
logic.changeInput(state.surePwdController);
|
||||||
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
// isHaveLeftWidget: false,
|
// isHaveLeftWidget: false,
|
||||||
leftWidget: Text(
|
leftWidget: Text(
|
||||||
@ -67,7 +77,7 @@ class _MinePersonInfoResetPasswordPageState
|
|||||||
),
|
),
|
||||||
hintText: "",
|
hintText: "",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
// LengthLimitingTextInputFormatter(20),
|
LengthLimitingTextInputFormatter(20),
|
||||||
]),
|
]),
|
||||||
Container(
|
Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
@ -77,12 +87,15 @@ 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,
|
||||||
|
isDisabled: state.canSub.value,
|
||||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||||
onClick: () {}),
|
onClick: () {
|
||||||
|
logic.changePasswordRequest();
|
||||||
|
})),
|
||||||
SizedBox(height: 40.w),
|
SizedBox(height: 40.w),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
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);
|
||||||
|
|
||||||
|
void onClose() {}
|
||||||
|
}
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
class MineSetSafetyProblemEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
Data? data;
|
||||||
|
|
||||||
|
MineSetSafetyProblemEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.data});
|
||||||
|
|
||||||
|
MineSetSafetyProblemEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
data = json['data'] != null ? Data.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 Data {
|
||||||
|
List<SafetyProblemData>? firstList;
|
||||||
|
List<SafetyProblemData>? secondList;
|
||||||
|
List<SafetyProblemData>? thirdList;
|
||||||
|
|
||||||
|
Data({this.firstList, this.secondList, this.thirdList});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['firstList'] != null) {
|
||||||
|
firstList = <SafetyProblemData>[];
|
||||||
|
json['firstList'].forEach((v) {
|
||||||
|
firstList!.add(SafetyProblemData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (json['secondList'] != null) {
|
||||||
|
secondList = <SafetyProblemData>[];
|
||||||
|
json['secondList'].forEach((v) {
|
||||||
|
secondList!.add(SafetyProblemData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (json['thirdList'] != null) {
|
||||||
|
thirdList = <SafetyProblemData>[];
|
||||||
|
json['thirdList'].forEach((v) {
|
||||||
|
thirdList!.add(SafetyProblemData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
if (firstList != null) {
|
||||||
|
data['firstList'] = firstList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
if (secondList != null) {
|
||||||
|
data['secondList'] = secondList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
if (thirdList != null) {
|
||||||
|
data['thirdList'] = thirdList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SafetyProblemData {
|
||||||
|
int? questionId;
|
||||||
|
String? question;
|
||||||
|
String? answer;
|
||||||
|
|
||||||
|
SafetyProblemData({this.questionId, this.question});
|
||||||
|
|
||||||
|
SafetyProblemData.fromJson(Map<String, dynamic> json) {
|
||||||
|
questionId = json['questionId'];
|
||||||
|
question = json['question'];
|
||||||
|
answer = json['answer'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['questionId'] = questionId;
|
||||||
|
data['question'] = question;
|
||||||
|
data['answer'] = answer;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SafetyProblemData2 {
|
||||||
|
int? questionId;
|
||||||
|
String? question;
|
||||||
|
String? answer;
|
||||||
|
|
||||||
|
SafetyProblemData2({this.questionId, this.question});
|
||||||
|
|
||||||
|
SafetyProblemData2.fromJson(Map<String, dynamic> json) {
|
||||||
|
questionId = json['questionId'];
|
||||||
|
question = json['question'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['questionId'] = questionId;
|
||||||
|
data['question'] = question;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SafetyProblemData3 {
|
||||||
|
int? questionId;
|
||||||
|
String? question;
|
||||||
|
String? answer;
|
||||||
|
|
||||||
|
SafetyProblemData3({this.questionId, this.question});
|
||||||
|
|
||||||
|
SafetyProblemData3.fromJson(Map<String, dynamic> json) {
|
||||||
|
questionId = json['questionId'];
|
||||||
|
question = json['question'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['questionId'] = questionId;
|
||||||
|
data['question'] = question;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart';
|
||||||
|
import 'package:star_lock/tools/toast.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class MineSetSafetyProblemLogic extends BaseGetXController {
|
||||||
|
final MineSetSafetyProblemState state = MineSetSafetyProblemState();
|
||||||
|
//用户信息
|
||||||
|
Future<void> getQuestionListRequest() async {
|
||||||
|
var entity =
|
||||||
|
await ApiRepository.to.getQuestionList("", state.countryCode.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.firstProblemList.value = entity.data!.firstList!;
|
||||||
|
state.secondProblemList.value = entity.data!.secondList!;
|
||||||
|
state.thirdProblemList.value = entity.data!.thirdList!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置安全信息
|
||||||
|
Future<void> setSafeAnswerRequest() async {
|
||||||
|
var entity =
|
||||||
|
await ApiRepository.to.setSafeAnswer(state.questionAndAnswerList);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
Toast.show(msg: '操作成功');
|
||||||
|
Get.until((route) => route.settings.name == Routers.minePersonInfoPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkNext(TextEditingController controller) {
|
||||||
|
changeInput(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
void changeInput(TextEditingController controller) {
|
||||||
|
if (controller == state.fristAnswerController) {
|
||||||
|
state.firstAnswerStr.value = controller.text;
|
||||||
|
}
|
||||||
|
if (controller == state.secondAnswerController) {
|
||||||
|
state.secondAnswerStr.value = controller.text;
|
||||||
|
}
|
||||||
|
if (controller == state.thirdAnswerController) {
|
||||||
|
state.thirdAnswerStr.value = controller.text;
|
||||||
|
}
|
||||||
|
_resetCanSub();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _resetCanSub() {
|
||||||
|
state.canSub.value = state.answerIsOK &&
|
||||||
|
state.firstProblemStr.value !=
|
||||||
|
TranslationLoader.lanKeys!.problemOne!.tr &&
|
||||||
|
state.secondProblemStr.value !=
|
||||||
|
TranslationLoader.lanKeys!.problemTwo!.tr &&
|
||||||
|
state.thirdProblemStr.value !=
|
||||||
|
TranslationLoader.lanKeys!.problemThree!.tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
state.fristAnswerController.text = state.firstAnswerStr.value;
|
||||||
|
state.secondAnswerController.text = state.secondAnswerStr.value;
|
||||||
|
state.thirdAnswerController.text = state.thirdAnswerStr.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_entity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_logic.dart';
|
||||||
|
import 'package:star_lock/tools/custom_bottom_sheet.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';
|
||||||
|
|
||||||
@ -19,9 +21,15 @@ class MinePersonInfoSetSafetyProblemPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _MinePersonInfoSetSafetyProblemPageState
|
class _MinePersonInfoSetSafetyProblemPageState
|
||||||
extends State<MinePersonInfoSetSafetyProblemPage> {
|
extends State<MinePersonInfoSetSafetyProblemPage> {
|
||||||
final _fristEditingController = TextEditingController();
|
final logic = Get.put(MineSetSafetyProblemLogic());
|
||||||
final _secondEditingController = TextEditingController();
|
final state = Get.find<MineSetSafetyProblemLogic>().state;
|
||||||
final _thirdEditingController = TextEditingController();
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
logic.getQuestionListRequest();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -41,33 +49,61 @@ class _MinePersonInfoSetSafetyProblemPageState
|
|||||||
TranslationLoader.lanKeys!.safetyProblemTip!.tr,
|
TranslationLoader.lanKeys!.safetyProblemTip!.tr,
|
||||||
style: TextStyle(fontSize: 18.sp),
|
style: TextStyle(fontSize: 18.sp),
|
||||||
)),
|
)),
|
||||||
_safityProblemItem(TranslationLoader.lanKeys!.problemOne!.tr, "",
|
Obx(() => _safityProblemItem(
|
||||||
_fristEditingController, () {
|
state.firstProblemStr.value,
|
||||||
_seletProblemBottomSheet();
|
state.firstAnswerStr.value,
|
||||||
}),
|
state.fristAnswerController, () {
|
||||||
|
_selectProblemBottomSheet(state.firstProblemList, 1);
|
||||||
|
})),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
_safityProblemItem(TranslationLoader.lanKeys!.problemTwo!.tr, "",
|
Obx(() => _safityProblemItem(
|
||||||
_secondEditingController, () {
|
state.secondProblemStr.value,
|
||||||
_seletProblemBottomSheet();
|
state.secondAnswerStr.value,
|
||||||
}),
|
state.secondAnswerController, () {
|
||||||
|
_selectProblemBottomSheet(state.secondProblemList, 2);
|
||||||
|
})),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
_safityProblemItem(TranslationLoader.lanKeys!.problemThree!.tr, "",
|
Obx(() => _safityProblemItem(
|
||||||
_thirdEditingController, () {
|
state.thirdProblemStr.value,
|
||||||
_seletProblemBottomSheet();
|
state.thirdAnswerStr.value,
|
||||||
}),
|
state.thirdAnswerController, () {
|
||||||
|
_selectProblemBottomSheet(state.thirdProblemList, 3);
|
||||||
|
})),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 50.h,
|
height: 50.h,
|
||||||
),
|
),
|
||||||
Container(
|
Obx(() => Container(
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
child: SubmitBtn(
|
child: SubmitBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||||
// borderRadius: 20.w,
|
isDisabled: state.canSub.value,
|
||||||
// fontSize: 32.sp,
|
onClick: () {
|
||||||
// margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
//state.questionAndAnswerList
|
||||||
// padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
for (int i = 0; i < 3; i++) {
|
||||||
onClick: () {}),
|
if (i == 0) {
|
||||||
),
|
SafetyProblemData data = SafetyProblemData();
|
||||||
|
data.question = state.firstProblemStr.value;
|
||||||
|
data.answer = state.firstAnswerStr.value;
|
||||||
|
data.questionId = state.firstQuestionId.value;
|
||||||
|
state.questionAndAnswerList.add(data);
|
||||||
|
} else if (i == 1) {
|
||||||
|
SafetyProblemData data = SafetyProblemData();
|
||||||
|
data.question = state.secondProblemStr.value;
|
||||||
|
data.answer = state.secondAnswerStr.value;
|
||||||
|
data.questionId = state.secondQuestionId.value;
|
||||||
|
state.questionAndAnswerList.add(data);
|
||||||
|
} else if (i == 2) {
|
||||||
|
SafetyProblemData data = SafetyProblemData();
|
||||||
|
data.question = state.thirdProblemStr.value;
|
||||||
|
data.answer = state.thirdAnswerStr.value;
|
||||||
|
data.questionId = state.thirdQuestionId.value;
|
||||||
|
state.questionAndAnswerList.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//设置安全信息接口
|
||||||
|
logic.setSafeAnswerRequest();
|
||||||
|
}),
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -89,6 +125,9 @@ class _MinePersonInfoSetSafetyProblemPageState
|
|||||||
//输入框一行
|
//输入框一行
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
onChanged: (value) {
|
||||||
|
logic.checkNext(controller);
|
||||||
|
},
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
//输入里面输入文字内边距设置
|
//输入里面输入文字内边距设置
|
||||||
@ -105,58 +144,38 @@ class _MinePersonInfoSetSafetyProblemPageState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _seletProblemBottomSheet() async {
|
Future _selectProblemBottomSheet(List dataList, int problemIndex) async {
|
||||||
final option = await showModalBottomSheet(
|
List<String> getProblemList = [];
|
||||||
|
for (int i = 0; i < dataList.length; i++) {
|
||||||
|
SafetyProblemData data = dataList[i];
|
||||||
|
getProblemList.add(data.question!);
|
||||||
|
}
|
||||||
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Container(
|
return AlertBottomWidget(
|
||||||
height: 400.0.h,
|
topTitle: '选择问题',
|
||||||
child: ListView(
|
items: getProblemList,
|
||||||
children: <Widget>[
|
chooseCallback: (value) {
|
||||||
ListTile(
|
int getSelectIndex = value;
|
||||||
title: Text(
|
String getSelectProblem = getProblemList[getSelectIndex];
|
||||||
'你第一次乘坐飞机取得是哪个城市?',
|
SafetyProblemData data = dataList[getSelectIndex];
|
||||||
textAlign: TextAlign.center,
|
if (problemIndex == 1) {
|
||||||
style: TextStyle(fontSize: 22.sp),
|
// SafetyProblemData data = dataList[getSelectIndex];
|
||||||
),
|
state.firstProblemStr.value = getSelectProblem;
|
||||||
onTap: () {
|
state.firstQuestionId.value = data.questionId!;
|
||||||
Navigator.of(context).pop(true);
|
} else if (problemIndex == 2) {
|
||||||
},
|
// SafetyProblemData data = dataList[getSelectIndex];
|
||||||
),
|
state.secondProblemStr.value = getSelectProblem;
|
||||||
const Divider(
|
state.secondQuestionId.value = data.questionId!;
|
||||||
color: AppColors.greyLineColor,
|
} else if (problemIndex == 3) {
|
||||||
height: 1,
|
// SafetyProblemData data = dataList[getSelectIndex];
|
||||||
),
|
state.thirdProblemStr.value = getSelectProblem;
|
||||||
ListTile(
|
state.thirdQuestionId.value = data.questionId!;
|
||||||
title: Text(
|
}
|
||||||
'你的QQ号码是多少',
|
},
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(fontSize: 22.sp),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop(true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const Divider(
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
height: 1,
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
title: Text(
|
|
||||||
'你的第一个宠物叫什么名字',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(fontSize: 22.sp),
|
|
||||||
),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop(true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const Divider(
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
height: 1,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MineSetSafetyProblemState {
|
||||||
|
final TextEditingController fristAnswerController = TextEditingController();
|
||||||
|
final TextEditingController secondAnswerController = TextEditingController();
|
||||||
|
final TextEditingController thirdAnswerController = TextEditingController();
|
||||||
|
|
||||||
|
var firstProblemList = [].obs;
|
||||||
|
var secondProblemList = [].obs;
|
||||||
|
var thirdProblemList = [].obs;
|
||||||
|
|
||||||
|
var firstProblemStr = TranslationLoader.lanKeys!.problemOne!.tr.obs;
|
||||||
|
var secondProblemStr = TranslationLoader.lanKeys!.problemTwo!.tr.obs;
|
||||||
|
var thirdProblemStr = TranslationLoader.lanKeys!.problemThree!.tr.obs;
|
||||||
|
|
||||||
|
var firstQuestionId = 0.obs;
|
||||||
|
var secondQuestionId = 0.obs;
|
||||||
|
var thirdQuestionId = 0.obs;
|
||||||
|
|
||||||
|
var firstAnswerStr = ''.obs;
|
||||||
|
var secondAnswerStr = ''.obs;
|
||||||
|
var thirdAnswerStr = ''.obs;
|
||||||
|
var countryCode = ''.obs;
|
||||||
|
|
||||||
|
var questionAndAnswerList = [].obs;
|
||||||
|
|
||||||
|
bool get answerIsOK =>
|
||||||
|
firstAnswerStr.value.isNotEmpty &&
|
||||||
|
secondAnswerStr.value.isNotEmpty &&
|
||||||
|
thirdAnswerStr.value.isNotEmpty;
|
||||||
|
var canSub = false.obs;
|
||||||
|
|
||||||
|
MineSetSafetyProblemState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
firstProblemStr.value = map["firstProblemStr"];
|
||||||
|
secondProblemStr.value = map["secondProblemStr"];
|
||||||
|
thirdProblemStr.value = map["thirdProblemStr"];
|
||||||
|
firstAnswerStr.value = map["firstAnswerStr"];
|
||||||
|
secondAnswerStr.value = map["secondAnswerStr"];
|
||||||
|
thirdAnswerStr.value = map["thirdAnswerStr"];
|
||||||
|
firstQuestionId.value = map["firstQuestionId"];
|
||||||
|
secondQuestionId.value = map["secondQuestionId"];
|
||||||
|
thirdQuestionId.value = map["thirdQuestionId"];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
class MineViewSafetyProblemEntity {
|
||||||
|
int? errorCode;
|
||||||
|
String? description;
|
||||||
|
String? errorMsg;
|
||||||
|
List<SafetyProblemData>? dataList;
|
||||||
|
|
||||||
|
MineViewSafetyProblemEntity(
|
||||||
|
{this.errorCode, this.description, this.errorMsg, this.dataList});
|
||||||
|
|
||||||
|
MineViewSafetyProblemEntity.fromJson(Map<String, dynamic> json) {
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
description = json['description'];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
if (json['data'] != null) {
|
||||||
|
dataList = <SafetyProblemData>[];
|
||||||
|
json['data'].forEach((v) {
|
||||||
|
dataList!.add(SafetyProblemData.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['errorCode'] = errorCode;
|
||||||
|
data['description'] = description;
|
||||||
|
data['errorMsg'] = errorMsg;
|
||||||
|
if (dataList != null) {
|
||||||
|
data['data'] = dataList!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SafetyProblemData {
|
||||||
|
int? questionId;
|
||||||
|
String? answer;
|
||||||
|
int? uid;
|
||||||
|
String? question;
|
||||||
|
|
||||||
|
SafetyProblemData({this.questionId, this.answer, this.uid, this.question});
|
||||||
|
|
||||||
|
SafetyProblemData.fromJson(Map<String, dynamic> json) {
|
||||||
|
questionId = json['questionId'];
|
||||||
|
answer = json['answer'];
|
||||||
|
uid = json['uid'];
|
||||||
|
question = json['question'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
|
data['questionId'] = questionId;
|
||||||
|
data['answer'] = answer;
|
||||||
|
data['uid'] = uid;
|
||||||
|
data['question'] = question;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_entity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_state.dart';
|
||||||
|
|
||||||
|
import '../../../../network/api_repository.dart';
|
||||||
|
import '../../../../tools/baseGetXController.dart';
|
||||||
|
|
||||||
|
class MineViewSafetyProblemLogic extends BaseGetXController {
|
||||||
|
final MineViewSafetyProblemState state = MineViewSafetyProblemState();
|
||||||
|
|
||||||
|
//获取已设置的安全信息
|
||||||
|
Future<void> getOwnQuestionListRequest() async {
|
||||||
|
MineViewSafetyProblemEntity entity =
|
||||||
|
await ApiRepository.to.getOwnQuestionList();
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
if (entity.dataList != null) {
|
||||||
|
SafetyProblemData safeData1 = entity.dataList![0];
|
||||||
|
state.firstProblemStr.value = safeData1.question!;
|
||||||
|
state.firstAnswerStr.value = safeData1.answer!;
|
||||||
|
state.firstQuestionId.value = safeData1.questionId!;
|
||||||
|
|
||||||
|
SafetyProblemData safeData2 = entity.dataList![1];
|
||||||
|
state.secondProblemStr.value = safeData2.question!;
|
||||||
|
state.secondAnswerStr.value = safeData2.answer!;
|
||||||
|
state.secondQuestionId.value = safeData2.questionId!;
|
||||||
|
|
||||||
|
SafetyProblemData safeData3 = entity.dataList![2];
|
||||||
|
state.thirdProblemStr.value = safeData3.question!;
|
||||||
|
state.thirdAnswerStr.value = safeData3.answer!;
|
||||||
|
state.thirdQuestionId.value = safeData3.questionId!;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,114 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/appRouters.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart';
|
||||||
|
|
||||||
|
import '../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../tools/commonItem.dart';
|
||||||
|
import '../../../tools/titleAppBar.dart';
|
||||||
|
import '../../../translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MinePersonInfoViewSafetyProblemPage extends StatefulWidget {
|
||||||
|
const MinePersonInfoViewSafetyProblemPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MinePersonInfoViewSafetyProblemPage> createState() =>
|
||||||
|
_MinePersonInfoViewSafetyProblemPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MinePersonInfoViewSafetyProblemPageState
|
||||||
|
extends State<MinePersonInfoViewSafetyProblemPage> {
|
||||||
|
final logic = Get.put(MineViewSafetyProblemLogic());
|
||||||
|
final state = Get.find<MineViewSafetyProblemLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
logic.getOwnQuestionListRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||||
|
haveBack: true,
|
||||||
|
actionsList: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.minePersonInfoSetSafetyProblemPage,
|
||||||
|
arguments: {
|
||||||
|
'firstProblemStr': state.firstProblemStr.value,
|
||||||
|
'secondProblemStr': state.secondProblemStr.value,
|
||||||
|
'thirdProblemStr': state.thirdProblemStr.value,
|
||||||
|
'firstAnswerStr': state.firstAnswerStr.value,
|
||||||
|
'secondAnswerStr': state.secondAnswerStr.value,
|
||||||
|
'thirdAnswerStr': state.thirdAnswerStr.value,
|
||||||
|
'firstQuestionId': state.firstQuestionId.value,
|
||||||
|
'secondQuestionId': state.secondQuestionId.value,
|
||||||
|
'thirdQuestionId': state.thirdQuestionId.value,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.amend!.tr,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 1.sw,
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
|
padding: EdgeInsets.all(20.h),
|
||||||
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.safetyProblemTip!.tr,
|
||||||
|
style: TextStyle(fontSize: 18.sp),
|
||||||
|
)),
|
||||||
|
Obx(() => _safityProblemItem(
|
||||||
|
state.firstProblemStr.value, state.firstAnswerStr.value)),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Obx(() => _safityProblemItem(
|
||||||
|
state.secondProblemStr.value, state.secondAnswerStr.value)),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Obx(() => _safityProblemItem(
|
||||||
|
state.thirdProblemStr.value, state.thirdAnswerStr.value))
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _safityProblemItem(String problemTitle, String answerTitle) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: problemTitle,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true),
|
||||||
|
Container(
|
||||||
|
color: Colors.white,
|
||||||
|
padding: EdgeInsets.only(left: 35.w),
|
||||||
|
child: TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
enabled: false,
|
||||||
|
autofocus: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
// contentPadding: const EdgeInsets.only(top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
|
||||||
|
// labelText: label,
|
||||||
|
hintText: answerTitle,
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp)),
|
||||||
|
obscureText: false,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
|
|
||||||
|
class MineViewSafetyProblemState {
|
||||||
|
var firstProblemStr = TranslationLoader.lanKeys!.problemOne!.tr.obs;
|
||||||
|
var secondProblemStr = TranslationLoader.lanKeys!.problemTwo!.tr.obs;
|
||||||
|
var thirdProblemStr = TranslationLoader.lanKeys!.problemThree!.tr.obs;
|
||||||
|
|
||||||
|
var firstAnswerStr = ''.obs;
|
||||||
|
var secondAnswerStr = ''.obs;
|
||||||
|
var thirdAnswerStr = ''.obs;
|
||||||
|
|
||||||
|
var firstQuestionId = 0.obs;
|
||||||
|
var secondQuestionId = 0.obs;
|
||||||
|
var thirdQuestionId = 0.obs;
|
||||||
|
}
|
||||||
@ -123,4 +123,19 @@ 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 bindPhoneURL = '/user/bindPhone'; //修改绑定手机号
|
||||||
|
final String changePasswordURL = '/user/changePassword'; //修改密码
|
||||||
|
final String getQuestionListURL = '/safeAnswer/getQuestionList'; //获取安全信息列表
|
||||||
|
final String getOwnQuestionListURL =
|
||||||
|
'/safeAnswer/getOwnQuestionList'; //获取已设置的安全信息
|
||||||
|
final String setSafeAnswerURL = '/safeAnswer/set'; //设置安全信息
|
||||||
|
final String getUpTokenURL =
|
||||||
|
'/user/getUpToken'; //上传头像 先获取upToken 再调用updateUserInfo
|
||||||
|
final String unbindPhoneTokenURL = '/user/unbindPhoneToken'; //获取解绑手机号Token
|
||||||
|
final String unbindEmailTokenURL = '/user/unbindEmailToken'; //获取解绑邮箱Token
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,91 @@ 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> bindPhone(String countryCode, String account,
|
||||||
|
String verificationCode, String unbindToken) =>
|
||||||
|
post(
|
||||||
|
bindPhoneURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'countryCode': countryCode,
|
||||||
|
'account': account,
|
||||||
|
'verificationCode': verificationCode,
|
||||||
|
'unbindToken': unbindToken
|
||||||
|
}));
|
||||||
|
|
||||||
|
//修改绑定邮箱
|
||||||
|
Future<Response> bindEmail(
|
||||||
|
String email, String verificationCode, String unbindToken) =>
|
||||||
|
post(
|
||||||
|
bindEmailURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
'email': email,
|
||||||
|
'verificationCode': verificationCode,
|
||||||
|
'unbindToken': unbindToken
|
||||||
|
}));
|
||||||
|
|
||||||
|
//修改密码
|
||||||
|
Future<Response> changePassword(String date, String newPassword,
|
||||||
|
String oldPassword, String operatorUid) =>
|
||||||
|
post(
|
||||||
|
changePasswordURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
"date": date,
|
||||||
|
'newPassword': newPassword,
|
||||||
|
"oldPassword": oldPassword,
|
||||||
|
'operatorUid': operatorUid
|
||||||
|
}));
|
||||||
|
|
||||||
|
//获取安全信息列表
|
||||||
|
Future<Response> getQuestionList(String operatorUid, String countryCode) =>
|
||||||
|
post(
|
||||||
|
getQuestionListURL.toUrl,
|
||||||
|
jsonEncode({
|
||||||
|
"operatorUid": operatorUid,
|
||||||
|
'countryCode': countryCode,
|
||||||
|
}));
|
||||||
|
|
||||||
|
//获取已设置的安全信息
|
||||||
|
Future<Response> getOwnQuestionList() =>
|
||||||
|
post(getOwnQuestionListURL.toUrl, jsonEncode({}));
|
||||||
|
|
||||||
|
//设置安全信息
|
||||||
|
Future<Response> setSafeAnswer(List questionAndAnswerList) => post(
|
||||||
|
setSafeAnswerURL.toUrl,
|
||||||
|
jsonEncode({"questionAndAnswerList": questionAndAnswerList}));
|
||||||
|
|
||||||
|
//上传头像 先获取upToken 再调用updateUserInfo
|
||||||
|
Future<Response> getUpToken(String type) =>
|
||||||
|
post(setSafeAnswerURL.toUrl, jsonEncode({"type": type}));
|
||||||
|
|
||||||
|
//获取解绑手机号Token
|
||||||
|
Future<Response> unbindPhoneToken(String verificationCode) => post(
|
||||||
|
unbindPhoneTokenURL.toUrl,
|
||||||
|
jsonEncode({"verificationCode": verificationCode}));
|
||||||
|
|
||||||
|
//获取解绑邮箱Token
|
||||||
|
Future<Response> unbindEmailToken(String verificationCode) => post(
|
||||||
|
unbindEmailTokenURL.toUrl,
|
||||||
|
jsonEncode({"verificationCode": verificationCode}));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ExtensionString on String {
|
extension ExtensionString on String {
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class BaseProvider extends GetConnect with Api {
|
|||||||
break;
|
break;
|
||||||
case 421:
|
case 421:
|
||||||
case 422:
|
case 422:
|
||||||
case 430:
|
case 430: //与葛工约定弹出ErrorMsg
|
||||||
Toast.show(msg: T["errorMsg"]);
|
Toast.show(msg: T["errorMsg"]);
|
||||||
break;
|
break;
|
||||||
case 425:
|
case 425:
|
||||||
|
|||||||
@ -7,6 +7,10 @@ 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/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_entity.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_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 +215,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 +1130,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 +1148,86 @@ 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> bindPhone(String countryCode, String account,
|
||||||
|
String verificationCode, String unbindToken) async {
|
||||||
|
final res = await apiProvider.bindPhone(
|
||||||
|
countryCode, account, verificationCode, unbindToken);
|
||||||
|
return PasswordKeyListEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改绑定邮箱
|
||||||
|
Future<PasswordKeyListEntity> bindEmail(
|
||||||
|
String email, String verificationCode, String unbindToken) async {
|
||||||
|
final res =
|
||||||
|
await apiProvider.bindEmail(email, verificationCode, unbindToken);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取安全信息列表
|
||||||
|
Future<MineSetSafetyProblemEntity> getQuestionList(
|
||||||
|
String operatorUid, String countryCode) async {
|
||||||
|
final res = await apiProvider.getQuestionList(operatorUid, countryCode);
|
||||||
|
return MineSetSafetyProblemEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取已设置的安全信息
|
||||||
|
Future<MineViewSafetyProblemEntity> getOwnQuestionList() async {
|
||||||
|
final res = await apiProvider.getOwnQuestionList();
|
||||||
|
return MineViewSafetyProblemEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置安全信息
|
||||||
|
Future<LoginEntity> setSafeAnswer(List questionAndAnswerList) async {
|
||||||
|
final res = await apiProvider.setSafeAnswer(questionAndAnswerList);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//上传头像 先获取upToken 再调用updateUserInfo
|
||||||
|
Future<LoginEntity> getUpToken(String type) async {
|
||||||
|
final res = await apiProvider.getUpToken(type);
|
||||||
|
return LoginEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取解绑手机号Token
|
||||||
|
Future<MineUnbindPhoneOrEmailEntity> unbindPhoneToken(
|
||||||
|
String verificationCode) async {
|
||||||
|
final res = await apiProvider.unbindPhoneToken(verificationCode);
|
||||||
|
return MineUnbindPhoneOrEmailEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取解绑邮箱Token
|
||||||
|
Future<MineUnbindPhoneOrEmailEntity> unbindEmailToken(
|
||||||
|
String verificationCode) async {
|
||||||
|
final res = await apiProvider.unbindEmailToken(verificationCode);
|
||||||
|
return MineUnbindPhoneOrEmailEntity.fromJson(res.body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
117
star_lock/lib/tools/custom_bottom_sheet.dart
Normal file
117
star_lock/lib/tools/custom_bottom_sheet.dart
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
|
||||||
|
class AlertBottomWidget extends StatelessWidget {
|
||||||
|
List<String> items;
|
||||||
|
ValueChanged<int> chooseCallback;
|
||||||
|
String topTitle;
|
||||||
|
|
||||||
|
AlertBottomWidget(
|
||||||
|
{Key? key,
|
||||||
|
required this.items,
|
||||||
|
required this.chooseCallback,
|
||||||
|
required this.topTitle})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
List<Widget> itemsWidget(context) {
|
||||||
|
List<Widget> list = [];
|
||||||
|
|
||||||
|
if (topTitle.isNotEmpty) {
|
||||||
|
list.add(Container(
|
||||||
|
padding: const EdgeInsets.only(top: 18, bottom: 18),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
topTitle,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: ScreenUtil().setSp(24)),
|
||||||
|
),
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 4,
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// subTitle,
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: AppColors.darkGrayTextColor,
|
||||||
|
// fontSize: ScreenUtil().setSp(24)),
|
||||||
|
// )
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
list.add(
|
||||||
|
Container(
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < items.length; i++) {
|
||||||
|
list.add(
|
||||||
|
SizedBox(
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
|
child: TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
overlayColor: MaterialStateProperty.all<Color>(Colors.white)),
|
||||||
|
child: Text(
|
||||||
|
items[i],
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black, fontSize: ScreenUtil().setSp(22)),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
chooseCallback(i);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
list.add(const Divider(
|
||||||
|
height: 1,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add(
|
||||||
|
Container(
|
||||||
|
color: AppColors.greyBackgroundColor,
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
list.add(SizedBox(
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
|
child: TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
overlayColor: MaterialStateProperty.all<Color>(Colors.white)),
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.black, fontSize: ScreenUtil().setSp(24)),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: itemsWidget(context),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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,20 @@ 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);
|
Function()? onChangeAction;
|
||||||
|
TFInputHaveBorder(
|
||||||
|
{Key? key,
|
||||||
|
required this.controller,
|
||||||
|
this.rightSlot,
|
||||||
|
this.label,
|
||||||
|
this.isPwd,
|
||||||
|
this.inputFormatters,
|
||||||
|
this.keyboardType,
|
||||||
|
this.background,
|
||||||
|
this.hintText,
|
||||||
|
this.onChangeAction,
|
||||||
|
this.leftImg})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -29,39 +41,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 +89,40 @@ 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) {
|
||||||
|
if (onChangeAction != null) {
|
||||||
|
onChangeAction!();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
rightSlot??const SizedBox(width: 0,height: 0)
|
rightSlot ?? const SizedBox(width: 0, height: 0)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -247,6 +247,7 @@ class LanKeyEntity {
|
|||||||
this.pleaseEnterNewAccountNumber,
|
this.pleaseEnterNewAccountNumber,
|
||||||
this.changeIphoneTip,
|
this.changeIphoneTip,
|
||||||
this.changeEmailTip,
|
this.changeEmailTip,
|
||||||
|
this.goBind,
|
||||||
this.originalPassword,
|
this.originalPassword,
|
||||||
this.newPassword,
|
this.newPassword,
|
||||||
this.surePassword,
|
this.surePassword,
|
||||||
@ -311,6 +312,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,
|
||||||
@ -663,6 +665,7 @@ class LanKeyEntity {
|
|||||||
pleaseEnterNewAccountNumber = json['pleaseEnterNewAccountNumber'];
|
pleaseEnterNewAccountNumber = json['pleaseEnterNewAccountNumber'];
|
||||||
changeIphoneTip = json['changeIphoneTip'];
|
changeIphoneTip = json['changeIphoneTip'];
|
||||||
changeEmailTip = json['changeEmailTip'];
|
changeEmailTip = json['changeEmailTip'];
|
||||||
|
goBind = json['goBind'];
|
||||||
originalPassword = json['originalPassword'];
|
originalPassword = json['originalPassword'];
|
||||||
newPassword = json['newPassword'];
|
newPassword = json['newPassword'];
|
||||||
surePassword = json['surePassword'];
|
surePassword = json['surePassword'];
|
||||||
@ -734,6 +737,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'];
|
||||||
|
|
||||||
@ -1091,6 +1095,7 @@ class LanKeyEntity {
|
|||||||
String? pleaseEnterNewAccountNumber;
|
String? pleaseEnterNewAccountNumber;
|
||||||
String? changeIphoneTip;
|
String? changeIphoneTip;
|
||||||
String? changeEmailTip;
|
String? changeEmailTip;
|
||||||
|
String? goBind;
|
||||||
String? originalPassword;
|
String? originalPassword;
|
||||||
String? newPassword;
|
String? newPassword;
|
||||||
String? surePassword;
|
String? surePassword;
|
||||||
@ -1158,6 +1163,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;
|
||||||
|
|
||||||
@ -1518,6 +1524,7 @@ class LanKeyEntity {
|
|||||||
map['pleaseEnterNewAccountNumber'] = pleaseEnterNewAccountNumber;
|
map['pleaseEnterNewAccountNumber'] = pleaseEnterNewAccountNumber;
|
||||||
map['changeIphoneTip'] = changeIphoneTip;
|
map['changeIphoneTip'] = changeIphoneTip;
|
||||||
map['changeEmailTip'] = changeEmailTip;
|
map['changeEmailTip'] = changeEmailTip;
|
||||||
|
map['goBind'] = goBind;
|
||||||
map['originalPassword'] = originalPassword;
|
map['originalPassword'] = originalPassword;
|
||||||
map['newPassword'] = newPassword;
|
map['newPassword'] = newPassword;
|
||||||
map['surePassword'] = surePassword;
|
map['surePassword'] = surePassword;
|
||||||
@ -1587,6 +1594,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;
|
||||||
|
|
||||||
|
|||||||
@ -67,8 +67,11 @@ dependencies:
|
|||||||
flutter_pickers: ^2.1.9
|
flutter_pickers: ^2.1.9
|
||||||
#万年历
|
#万年历
|
||||||
syncfusion_flutter_datepicker: ^22.1.38
|
syncfusion_flutter_datepicker: ^22.1.38
|
||||||
#图片选择
|
#使用相机及相册
|
||||||
image_picker: ^1.0.1
|
image_picker: ^1.0.4
|
||||||
|
crop_your_image: ^0.7.5
|
||||||
|
camera: ^0.10.5+5
|
||||||
|
path_provider: ^2.1.0
|
||||||
#跳转到外部
|
#跳转到外部
|
||||||
url_launcher: ^6.1.12
|
url_launcher: ^6.1.12
|
||||||
#蓝牙
|
#蓝牙
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user