1,修改手机号、邮箱逻辑完善及请求处理
2,新增修改绑定手机号/邮箱 3,新增获取安全信息列表接口 4,新增获取已设置的安全信息接口 5,新增设置安全信息接口 6,新增获取解绑手机号Token 7,新增获取解绑邮箱Token
This commit is contained in:
parent
4f598ac5a3
commit
12ecefa5d8
@ -247,7 +247,7 @@
|
||||
"modifyAccount":"修改账号",
|
||||
"resetPasswords":"重置密码",
|
||||
"safetyProblem":"安全问题",
|
||||
"modifyAccountTip":"为了你的账号安全,修改账号前请先使用账号密码验证",
|
||||
"modifyAccountTip":"为了你的账号安全,修改账号前请先使用验证码验证",
|
||||
"pleaseEnterAccountNumber":"请输入账号",
|
||||
"pleaseEnterNewAccountNumber":"请输入新账号",
|
||||
"changeIphoneTip":"找回密码和登录新设备时,可通过绑定的手机验证",
|
||||
|
||||
@ -12,6 +12,8 @@ PODS:
|
||||
- AMapFoundation (1.8.2)
|
||||
- AMapLocation (2.10.0):
|
||||
- AMapFoundation (>= 1.8.0)
|
||||
- camera_avfoundation (0.0.1):
|
||||
- Flutter
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
@ -62,6 +64,7 @@ DEPENDENCIES:
|
||||
- aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`)
|
||||
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/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`)
|
||||
- Flutter (from `Flutter`)
|
||||
- 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"
|
||||
amap_flutter_map:
|
||||
:path: ".symlinks/plugins/amap_flutter_map/ios"
|
||||
camera_avfoundation:
|
||||
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
||||
device_info_plus:
|
||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
Flutter:
|
||||
@ -131,6 +136,7 @@ SPEC CHECKSUMS:
|
||||
amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
|
||||
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
|
||||
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
|
||||
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<key>NSBluetoothPeripheralUsageDescription</key>
|
||||
<string>The app uses bluetooth to find, connect and transfer data between different devices</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>这是你的自拍照</string>
|
||||
<string>照片</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>Reason we need access to the contact list</string>
|
||||
<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/lockDetail/lockDetail_main_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/administratorDetails/adminDetailChangeDate_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/mine/starLockMine_page.dart';
|
||||
import 'mine/mineMultiLanguage/mineMultiLanguage_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfo/minePersonInfo_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/minePersonInfoEditAccount_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoEditIphone/minePersonInfoEditIphone_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart';
|
||||
@ -237,8 +238,8 @@ abstract class Routers {
|
||||
static const minePersonInfoPage = '/MinePersonInfoPage'; // 我的信息
|
||||
static const minePersonInfoEditNamePage =
|
||||
'/MinePersonInfoEditNamePage'; // 我的信息编辑昵称
|
||||
static const minePersonInfoEditAccountPage =
|
||||
'/MinePersonInfoEditAccountPage'; // 我的信息修改账号
|
||||
static const mineUnbindPhoneOrEmailPage =
|
||||
'/MineUnbindPhoneOrEmailPage'; // 我的信息修改账号-解绑
|
||||
static const minePersonInfoEditAccountNextPage =
|
||||
'/MinePersonInfoEditAccountNextPage'; // 我的信息修改账号下一页
|
||||
static const minePersonInfoEditIphonePage =
|
||||
@ -247,8 +248,9 @@ abstract class Routers {
|
||||
'/MinePersonInfoResetPasswordPage'; // 我的信息重置密码
|
||||
static const minePersonInfoSetSafetyProblemPage =
|
||||
'/MinePersonInfoSetSafetyProblemPage'; // 我的信息设置安全问题
|
||||
static const minePersonInfoEditEmailPage =
|
||||
'/MinePersonInfoEditEmailPage'; //我的信息-邮箱
|
||||
static const minePersonInfoViewSafetyProblemPage =
|
||||
'/MinePersonInfoViewSafetyProblemPage'; // 查看我的安全问题
|
||||
static const mineBindPhoneOrEmailPage = '/MineBindPhoneOrEmailPage'; //我的信息-邮箱
|
||||
|
||||
static const gatewayListPage = '/GatewayListPage'; // 我的-网关
|
||||
static const gatewayDetailPage = '/GatewayDetailPage'; // 我的-网关详情
|
||||
@ -616,8 +618,8 @@ abstract class AppRouters {
|
||||
page: () => const MinePersonInfoEditNamePage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.minePersonInfoEditAccountPage,
|
||||
page: () => const MinePersonInfoEditAccountPage(),
|
||||
name: Routers.mineUnbindPhoneOrEmailPage,
|
||||
page: () => const MineUnbindPhoneOrEmailPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.minePersonInfoEditIphonePage,
|
||||
@ -749,8 +751,8 @@ abstract class AppRouters {
|
||||
name: Routers.selectGetewayListPage,
|
||||
page: () => const SelectGetewayListPage()),
|
||||
GetPage(
|
||||
name: Routers.minePersonInfoEditEmailPage,
|
||||
page: () => const MinePersonInfoEditEmailPage()),
|
||||
name: Routers.mineBindPhoneOrEmailPage,
|
||||
page: () => const MineBindPhoneOrEmailPage()),
|
||||
GetPage(
|
||||
name: Routers.addAuthorizedAdministratorPage,
|
||||
page: () => const AddAuthorizedAdministratorPage()),
|
||||
@ -815,6 +817,9 @@ abstract class AppRouters {
|
||||
GetPage(
|
||||
name: Routers.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())
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_entity.dart';
|
||||
|
||||
class MinePersonInfoState {
|
||||
final mineInfoData = MinePersonInfoData().obs;
|
||||
|
||||
var nickname = ''.obs; //昵称
|
||||
var mobileStr = ''.obs; //手机号
|
||||
var emailStr = ''.obs; //邮箱
|
||||
var countryStr = ''.obs; //国家/地区
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -4,14 +4,13 @@ import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:get/get_navigation/src/extension_navigation.dart';
|
||||
import 'package:get/get_utils/get_utils.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/minePersonInfoEditAccount_state.dart';
|
||||
import 'package:star_lock/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';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
class MineInfoEditAccountLogic extends BaseGetXController {
|
||||
final MineInfoEditAccountState state = MineInfoEditAccountState();
|
||||
class MineUnbindPhoneOrEmailLogic extends BaseGetXController {
|
||||
final MineUnbindPhoneOrEmailState state = MineUnbindPhoneOrEmailState();
|
||||
|
||||
late Timer _timer;
|
||||
void _startTimer() {
|
||||
@ -33,8 +32,8 @@ class MineInfoEditAccountLogic extends BaseGetXController {
|
||||
//获取验证码请求
|
||||
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,
|
||||
@ -44,14 +43,29 @@ class MineInfoEditAccountLogic extends BaseGetXController {
|
||||
} else {}
|
||||
}
|
||||
|
||||
//删除账号请求
|
||||
Future<void> deleteAccountRequest() async {
|
||||
LoginEntity entity = await ApiRepository.to
|
||||
.deleteAccount("", "", state.verificationCode.value);
|
||||
//获取解绑手机号Token
|
||||
Future<void> unbindPhoneTokenRequest() async {
|
||||
MineUnbindPhoneOrEmailEntity entity =
|
||||
await ApiRepository.to.unbindPhoneToken(state.verificationCode.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: '验证成功,账号已删除');
|
||||
//删除账号成功,
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +92,6 @@ class MineInfoEditAccountLogic extends BaseGetXController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
state.initLoginData();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1,7 +1,7 @@
|
||||
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/minePersonInfoEditAccount_logic.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_logic.dart';
|
||||
import 'package:star_lock/tools/tf_input_haveBorder.dart';
|
||||
|
||||
import '../../../../appRouters.dart';
|
||||
@ -10,18 +10,17 @@ import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
|
||||
class MinePersonInfoEditAccountPage extends StatefulWidget {
|
||||
const MinePersonInfoEditAccountPage({Key? key}) : super(key: key);
|
||||
class MineUnbindPhoneOrEmailPage extends StatefulWidget {
|
||||
const MineUnbindPhoneOrEmailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MinePersonInfoEditAccountPage> createState() =>
|
||||
_MinePersonInfoEditAccountPageState();
|
||||
State<MineUnbindPhoneOrEmailPage> createState() =>
|
||||
_MineUnbindPhoneOrEmailState();
|
||||
}
|
||||
|
||||
class _MinePersonInfoEditAccountPageState
|
||||
extends State<MinePersonInfoEditAccountPage> {
|
||||
final logic = Get.put(MineInfoEditAccountLogic());
|
||||
final state = Get.find<MineInfoEditAccountLogic>().state;
|
||||
class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
||||
final logic = Get.put(MineUnbindPhoneOrEmailLogic());
|
||||
final state = Get.find<MineUnbindPhoneOrEmailLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -46,6 +45,9 @@ class _MinePersonInfoEditAccountPageState
|
||||
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(
|
||||
@ -68,13 +70,16 @@ class _MinePersonInfoEditAccountPageState
|
||||
},
|
||||
)))),
|
||||
SizedBox(height: 50.w),
|
||||
SubmitBtn(
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.next!.tr,
|
||||
isDisabled: state.canSub.value,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditAccountNextPage,
|
||||
arguments: {'isFrom': '1'});
|
||||
}),
|
||||
if (state.channel.value == '1') {
|
||||
logic.unbindPhoneTokenRequest();
|
||||
} else {
|
||||
logic.unbindEmailTokenRequest();
|
||||
}
|
||||
})),
|
||||
SizedBox(height: 50.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
@ -1,22 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginData.dart';
|
||||
import 'package:star_lock/login/seletCountryRegion/common/index.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
class MineInfoEditAccountState {
|
||||
class MineUnbindPhoneOrEmailState {
|
||||
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 绑定邮箱
|
||||
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;
|
||||
@ -29,27 +27,16 @@ class MineInfoEditAccountState {
|
||||
var totalSeconds = 120;
|
||||
var currentSecond = 120;
|
||||
|
||||
final loginData = LoginData().obs;
|
||||
|
||||
///本地存储 登录信息
|
||||
void saveLoginData(LoginData? data) async {
|
||||
print("saveLoginData:${data!.mobile}");
|
||||
await Storage.setString('userLoginData', jsonEncode(data));
|
||||
loginData.value = data;
|
||||
}
|
||||
|
||||
///初始化本地数据
|
||||
void initLoginData() async {
|
||||
final data = await Storage.getString('userLoginData');
|
||||
print("getLoginData:$data");
|
||||
if (data != null && data.isNotEmpty) {
|
||||
loginData.value = LoginData.fromJson(jsonDecode(data));
|
||||
}
|
||||
}
|
||||
|
||||
MineInfoEditAccountState() {
|
||||
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();
|
||||
}
|
||||
@ -15,7 +15,7 @@ class PersonInfoEditAccountState {
|
||||
|
||||
var countryCode = '+86'.obs;
|
||||
var countryId = '9'.obs;
|
||||
var codeType = '3'.obs; //1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱
|
||||
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;
|
||||
@ -53,6 +53,11 @@ class PersonInfoEditAccountState {
|
||||
PersonInfoEditAccountState() {
|
||||
Map map = Get.arguments;
|
||||
channel.value = map["isFrom"];
|
||||
if (channel.value == "1") {
|
||||
codeType.value = '3';
|
||||
} else {
|
||||
codeType.value = '6';
|
||||
}
|
||||
|
||||
resetResend();
|
||||
}
|
||||
|
||||
@ -2,14 +2,16 @@ 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/minePersonInfoEmail_state.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 MinePersonInfoEmailLogic extends BaseGetXController {
|
||||
final MinePersonInfoEmailState state = MinePersonInfoEmailState();
|
||||
class MineBindPhoneOrEmailLogic extends BaseGetXController {
|
||||
final MineBindPhoneOrEmailState state = MineBindPhoneOrEmailState();
|
||||
|
||||
late Timer _timer;
|
||||
void _startTimer() {
|
||||
@ -31,7 +33,7 @@ class MinePersonInfoEmailLogic extends BaseGetXController {
|
||||
//获取验证码请求
|
||||
void sendValidationCode() async {
|
||||
var entity = await ApiRepository.to.getValidationCodeAuth(
|
||||
state.countryCode.value,
|
||||
state.channel.value == '1' ? state.countryCode.value : '',
|
||||
state.inputAccount.value,
|
||||
state.channel.value,
|
||||
state.codeType.value,
|
||||
@ -45,23 +47,25 @@ class MinePersonInfoEmailLogic extends BaseGetXController {
|
||||
//绑定邮箱请求
|
||||
Future<void> bindEmailRequest() async {
|
||||
PasswordKeyListEntity entity = await ApiRepository.to.bindEmail(
|
||||
state.inputAccount.value, '', state.verificationCode.value, '');
|
||||
state.inputAccount.value,
|
||||
state.verificationCode.value,
|
||||
state.unbindToken.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: '邮箱绑定成功');
|
||||
Get.back();
|
||||
Get.until((route) => route.settings.name == Routers.minePersonInfoPage);
|
||||
}
|
||||
}
|
||||
|
||||
//绑定手机请求
|
||||
Future<void> bindMobileRequest() async {
|
||||
PasswordKeyListEntity entity = await ApiRepository.to.changeAccount(
|
||||
PasswordKeyListEntity entity = await ApiRepository.to.bindPhone(
|
||||
state.countryCode.value,
|
||||
state.inputAccount.value,
|
||||
state.uniqueid.value,
|
||||
state.verificationCode.value);
|
||||
state.verificationCode.value,
|
||||
state.unbindToken.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
Toast.show(msg: '手机绑定成功');
|
||||
Get.back();
|
||||
Get.until((route) => route.settings.name == Routers.minePersonInfoPage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ 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/minePersonInfoEmail_logic.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/submitBtn.dart';
|
||||
@ -10,25 +10,26 @@ 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);
|
||||
class MineBindPhoneOrEmailPage extends StatefulWidget {
|
||||
const MineBindPhoneOrEmailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MinePersonInfoEditEmailPage> createState() =>
|
||||
_MinePersonInfoEditEmailPageState();
|
||||
State<MineBindPhoneOrEmailPage> createState() =>
|
||||
_MineBindPhoneOrEmailPageState();
|
||||
}
|
||||
|
||||
class _MinePersonInfoEditEmailPageState
|
||||
extends State<MinePersonInfoEditEmailPage> {
|
||||
final logic = Get.put(MinePersonInfoEmailLogic());
|
||||
final state = Get.find<MinePersonInfoEmailLogic>().state;
|
||||
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: TranslationLoader.lanKeys!.email!.tr,
|
||||
barTitle: state.channel.value == "1"
|
||||
? TranslationLoader.lanKeys!.mobileNumber!.tr
|
||||
: TranslationLoader.lanKeys!.email!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Container(
|
||||
@ -39,7 +40,9 @@ class _MinePersonInfoEditEmailPageState
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.only(top: 5.h, bottom: 5.h),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.changeEmailTip!.tr,
|
||||
state.channel.value == '1'
|
||||
? TranslationLoader.lanKeys!.changeIphoneTip!.tr
|
||||
: TranslationLoader.lanKeys!.changeEmailTip!.tr,
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
)),
|
||||
LoginInput(
|
||||
@ -49,8 +52,9 @@ class _MinePersonInfoEditEmailPageState
|
||||
logic.checkNext(state.accountController);
|
||||
},
|
||||
leftWidget: const SizedBox(),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}",
|
||||
hintText: state.channel.value == '1'
|
||||
? "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.mobileNumber!.tr}"
|
||||
: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.email!.tr}",
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
class MinePersonInfoEmailState {
|
||||
class MineBindPhoneOrEmailState {
|
||||
final TextEditingController accountController = TextEditingController();
|
||||
final TextEditingController codeController = TextEditingController();
|
||||
|
||||
@ -12,7 +12,7 @@ class MinePersonInfoEmailState {
|
||||
|
||||
var countryCode = '+86'.obs;
|
||||
var countryId = '9'.obs;
|
||||
var codeType = '4'.obs; //1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱
|
||||
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;
|
||||
@ -20,6 +20,7 @@ class MinePersonInfoEmailState {
|
||||
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;
|
||||
@ -29,8 +30,9 @@ class MinePersonInfoEmailState {
|
||||
var totalSeconds = 120;
|
||||
var currentSecond = 120;
|
||||
|
||||
MinePersonInfoEmailState() {
|
||||
MineBindPhoneOrEmailState() {
|
||||
Map map = Get.arguments;
|
||||
unbindToken.value = map["unbindToken"];
|
||||
channel.value = map["isFrom"];
|
||||
//短信通道 1 短信,2 邮箱
|
||||
//短信类型 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱
|
||||
@ -30,7 +30,7 @@ class MinePersonInfoEntity {
|
||||
class MinePersonInfoData {
|
||||
String? mobile;
|
||||
String? uid;
|
||||
bool? isSecurityQuestionSetted;
|
||||
int? haveSafeAnswer;
|
||||
String? nickname;
|
||||
String? headUrl;
|
||||
String? accountName;
|
||||
@ -41,7 +41,7 @@ class MinePersonInfoData {
|
||||
MinePersonInfoData(
|
||||
{this.mobile,
|
||||
this.uid,
|
||||
this.isSecurityQuestionSetted,
|
||||
this.haveSafeAnswer,
|
||||
this.nickname,
|
||||
this.headUrl,
|
||||
this.accountName,
|
||||
@ -52,7 +52,7 @@ class MinePersonInfoData {
|
||||
MinePersonInfoData.fromJson(Map<String, dynamic> json) {
|
||||
mobile = json['mobile'];
|
||||
uid = json['uid'];
|
||||
isSecurityQuestionSetted = json['isSecurityQuestionSetted'];
|
||||
haveSafeAnswer = json['haveSafeAnswer'];
|
||||
nickname = json['nickname'];
|
||||
headUrl = json['headUrl'];
|
||||
accountName = json['accountName'];
|
||||
@ -65,7 +65,7 @@ class MinePersonInfoData {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['mobile'] = mobile;
|
||||
data['uid'] = uid;
|
||||
data['isSecurityQuestionSetted'] = isSecurityQuestionSetted;
|
||||
data['haveSafeAnswer'] = haveSafeAnswer;
|
||||
data['nickname'] = nickname;
|
||||
data['headUrl'] = headUrl;
|
||||
data['accountName'] = accountName;
|
||||
@ -1,5 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_state.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
|
||||
@ -14,6 +14,7 @@ class MinePersonInfoLogic extends BaseGetXController {
|
||||
state.mobileStr.value = entity.data!.mobile!;
|
||||
state.emailStr.value = entity.data!.email!;
|
||||
state.countryStr.value = entity.data!.countryName!;
|
||||
state.haveSafeAnswer.value = entity.data!.haveSafeAnswer!;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,12 @@
|
||||
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/minePersonInfo/minePersonInfo_logic.dart';
|
||||
import 'package:star_lock/tools/seletImgTool.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';
|
||||
@ -45,14 +47,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
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')),
|
||||
*/
|
||||
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();
|
||||
},
|
||||
@ -79,18 +80,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
//有手机号 则去修改手机号 否则去绑定新的手机号 isFrom:1 短信,2 邮箱
|
||||
if (state.mobileStr.value.isNotEmpty) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditAccountPage,
|
||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
'mobile': state.mobileStr.value,
|
||||
'isFrom': '1'
|
||||
});
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditEmailPage,
|
||||
arguments: {
|
||||
'mobile': state.mobileStr.value,
|
||||
'isFrom': '1'
|
||||
});
|
||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||
'mobile': state.mobileStr.value,
|
||||
'isFrom': '1'
|
||||
});
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -104,18 +104,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
//有邮箱 则去修改邮箱 否则去绑定新的邮箱 isFrom:1 短信,2 邮箱
|
||||
if (state.emailStr.value.isNotEmpty) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditAccountPage,
|
||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.emailStr.value
|
||||
});
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditEmailPage,
|
||||
arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.emailStr.value
|
||||
});
|
||||
context, Routers.mineBindPhoneOrEmailPage, arguments: {
|
||||
'isFrom': '2',
|
||||
'email': state.emailStr.value
|
||||
});
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
@ -133,8 +132,14 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoSetSafetyProblemPage);
|
||||
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,
|
||||
@ -146,38 +151,45 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
}
|
||||
|
||||
Future _openModalBottomSheet() async {
|
||||
final option = await showModalBottomSheet(
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||
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, '取消');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
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();
|
||||
}
|
||||
@ -41,6 +41,5 @@ class MinePersonInfoResetPasswordLogic extends BaseGetXController {
|
||||
|
||||
void _resetCanSub() {
|
||||
state.canSub.value = state.oldPwdIsOK && state.newPwdIsOK;
|
||||
print("22222:${state.canSub.value}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,9 @@ class _MinePersonInfoResetPasswordPageState
|
||||
children: [
|
||||
LoginInput(
|
||||
controller: state.oldPwdController,
|
||||
onchangeAction: (textStr) {
|
||||
logic.changeInput(state.oldPwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
leftWidget: Text(
|
||||
"${TranslationLoader.lanKeys!.originalPassword!.tr} ",
|
||||
@ -49,6 +52,9 @@ class _MinePersonInfoResetPasswordPageState
|
||||
]),
|
||||
LoginInput(
|
||||
controller: state.newPwdController,
|
||||
onchangeAction: (textStr) {
|
||||
logic.changeInput(state.newPwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
leftWidget: Text(
|
||||
"${TranslationLoader.lanKeys!.newPassword!.tr} ",
|
||||
@ -60,6 +66,9 @@ class _MinePersonInfoResetPasswordPageState
|
||||
]),
|
||||
LoginInput(
|
||||
controller: state.surePwdController,
|
||||
onchangeAction: (textStr) {
|
||||
logic.changeInput(state.surePwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
// isHaveLeftWidget: false,
|
||||
leftWidget: Text(
|
||||
@ -82,8 +91,11 @@ class _MinePersonInfoResetPasswordPageState
|
||||
btnName: TranslationLoader.lanKeys!.save!.tr,
|
||||
fontSize: 30.sp,
|
||||
borderRadius: 20.w,
|
||||
isDisabled: state.canSub.value,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {})),
|
||||
onClick: () {
|
||||
logic.changePasswordRequest();
|
||||
})),
|
||||
SizedBox(height: 40.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
||||
@ -20,7 +20,5 @@ class MinePersonInfoResetPasswordState {
|
||||
bool get newPwdIsOK =>
|
||||
newPwd.value.isNotEmpty && (newPwd.value == surePwd.value);
|
||||
|
||||
var canResend = false.obs;
|
||||
|
||||
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,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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 '../../../tools/commonItem.dart';
|
||||
@ -18,9 +21,15 @@ class MinePersonInfoSetSafetyProblemPage extends StatefulWidget {
|
||||
|
||||
class _MinePersonInfoSetSafetyProblemPageState
|
||||
extends State<MinePersonInfoSetSafetyProblemPage> {
|
||||
final _fristEditingController = TextEditingController();
|
||||
final _secondEditingController = TextEditingController();
|
||||
final _thirdEditingController = TextEditingController();
|
||||
final logic = Get.put(MineSetSafetyProblemLogic());
|
||||
final state = Get.find<MineSetSafetyProblemLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
logic.getQuestionListRequest();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -40,33 +49,61 @@ class _MinePersonInfoSetSafetyProblemPageState
|
||||
TranslationLoader.lanKeys!.safetyProblemTip!.tr,
|
||||
style: TextStyle(fontSize: 18.sp),
|
||||
)),
|
||||
_safityProblemItem(TranslationLoader.lanKeys!.problemOne!.tr, "",
|
||||
_fristEditingController, () {
|
||||
_seletProblemBottomSheet();
|
||||
}),
|
||||
Obx(() => _safityProblemItem(
|
||||
state.firstProblemStr.value,
|
||||
state.firstAnswerStr.value,
|
||||
state.fristAnswerController, () {
|
||||
_selectProblemBottomSheet(state.firstProblemList, 1);
|
||||
})),
|
||||
SizedBox(height: 10.h),
|
||||
_safityProblemItem(TranslationLoader.lanKeys!.problemTwo!.tr, "",
|
||||
_secondEditingController, () {
|
||||
_seletProblemBottomSheet();
|
||||
}),
|
||||
Obx(() => _safityProblemItem(
|
||||
state.secondProblemStr.value,
|
||||
state.secondAnswerStr.value,
|
||||
state.secondAnswerController, () {
|
||||
_selectProblemBottomSheet(state.secondProblemList, 2);
|
||||
})),
|
||||
SizedBox(height: 10.h),
|
||||
_safityProblemItem(TranslationLoader.lanKeys!.problemThree!.tr, "",
|
||||
_thirdEditingController, () {
|
||||
_seletProblemBottomSheet();
|
||||
}),
|
||||
Obx(() => _safityProblemItem(
|
||||
state.thirdProblemStr.value,
|
||||
state.thirdAnswerStr.value,
|
||||
state.thirdAnswerController, () {
|
||||
_selectProblemBottomSheet(state.thirdProblemList, 3);
|
||||
})),
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
// borderRadius: 20.w,
|
||||
// fontSize: 32.sp,
|
||||
// margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w),
|
||||
// padding: EdgeInsets.only(top: 20.w, bottom: 20.w),
|
||||
onClick: () {}),
|
||||
),
|
||||
Obx(() => Container(
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.sure!.tr,
|
||||
isDisabled: state.canSub.value,
|
||||
onClick: () {
|
||||
//state.questionAndAnswerList
|
||||
for (int i = 0; i < 3; i++) {
|
||||
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();
|
||||
}),
|
||||
)),
|
||||
],
|
||||
));
|
||||
}
|
||||
@ -88,6 +125,9 @@ class _MinePersonInfoSetSafetyProblemPageState
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller: controller,
|
||||
onChanged: (value) {
|
||||
logic.checkNext(controller);
|
||||
},
|
||||
autofocus: false,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
@ -104,58 +144,38 @@ class _MinePersonInfoSetSafetyProblemPageState
|
||||
);
|
||||
}
|
||||
|
||||
Future _seletProblemBottomSheet() async {
|
||||
final option = await showModalBottomSheet(
|
||||
Future _selectProblemBottomSheet(List dataList, int problemIndex) async {
|
||||
List<String> getProblemList = [];
|
||||
for (int i = 0; i < dataList.length; i++) {
|
||||
SafetyProblemData data = dataList[i];
|
||||
getProblemList.add(data.question!);
|
||||
}
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadiusDirectional.circular(10)),
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
height: 400.0.h,
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
title: Text(
|
||||
'你第一次乘坐飞机取得是哪个城市?',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
color: AppColors.greyLineColor,
|
||||
height: 1,
|
||||
),
|
||||
ListTile(
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
return AlertBottomWidget(
|
||||
topTitle: '选择问题',
|
||||
items: getProblemList,
|
||||
chooseCallback: (value) {
|
||||
int getSelectIndex = value;
|
||||
String getSelectProblem = getProblemList[getSelectIndex];
|
||||
SafetyProblemData data = dataList[getSelectIndex];
|
||||
if (problemIndex == 1) {
|
||||
// SafetyProblemData data = dataList[getSelectIndex];
|
||||
state.firstProblemStr.value = getSelectProblem;
|
||||
state.firstQuestionId.value = data.questionId!;
|
||||
} else if (problemIndex == 2) {
|
||||
// SafetyProblemData data = dataList[getSelectIndex];
|
||||
state.secondProblemStr.value = getSelectProblem;
|
||||
state.secondQuestionId.value = data.questionId!;
|
||||
} else if (problemIndex == 3) {
|
||||
// SafetyProblemData data = dataList[getSelectIndex];
|
||||
state.thirdProblemStr.value = getSelectProblem;
|
||||
state.thirdQuestionId.value = data.questionId!;
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -126,7 +126,16 @@ abstract class Api {
|
||||
final String getValidationCodeAuthURL =
|
||||
'/user/sendValidationCodeAuth'; //登录后使用,免图片滑动验证
|
||||
final String updateUserInfoURL = '/user/updateUserInfo'; //更新个人信息-昵称/头像
|
||||
final String changeAccountURL = '/user/changeAccount'; //修改账号
|
||||
final String bindEmailURL = '/user/bindEmail'; //绑定邮箱
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -1171,28 +1171,27 @@ class ApiProvider extends BaseProvider {
|
||||
Future<Response> updateUserInfo(String nickname) =>
|
||||
post(updateUserInfoURL.toUrl, jsonEncode({'nickname': nickname}));
|
||||
|
||||
//修改账号
|
||||
Future<Response> changeAccount(String countryCode, String newAccount,
|
||||
String uniqueid, String verificationCode) =>
|
||||
//修改绑定手机号
|
||||
Future<Response> bindPhone(String countryCode, String account,
|
||||
String verificationCode, String unbindToken) =>
|
||||
post(
|
||||
changeAccountURL.toUrl,
|
||||
bindPhoneURL.toUrl,
|
||||
jsonEncode({
|
||||
'countryCode': countryCode,
|
||||
'newAccount': newAccount,
|
||||
'uniqueid': uniqueid,
|
||||
'verificationCode': verificationCode
|
||||
'account': account,
|
||||
'verificationCode': verificationCode,
|
||||
'unbindToken': unbindToken
|
||||
}));
|
||||
|
||||
//绑定邮箱
|
||||
Future<Response> bindEmail(String email, String uniqueid,
|
||||
String verificationCode, String operatorUid) =>
|
||||
//修改绑定邮箱
|
||||
Future<Response> bindEmail(
|
||||
String email, String verificationCode, String unbindToken) =>
|
||||
post(
|
||||
bindEmailURL.toUrl,
|
||||
jsonEncode({
|
||||
'email': email,
|
||||
'uniqueid': uniqueid,
|
||||
'verificationCode': verificationCode,
|
||||
'operatorUid': operatorUid
|
||||
'unbindToken': unbindToken
|
||||
}));
|
||||
|
||||
//修改密码
|
||||
@ -1206,6 +1205,38 @@ class ApiProvider extends BaseProvider {
|
||||
"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 {
|
||||
|
||||
@ -71,7 +71,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
break;
|
||||
case 421:
|
||||
case 422:
|
||||
case 430:
|
||||
case 430: //与葛工约定弹出ErrorMsg
|
||||
Toast.show(msg: T["errorMsg"]);
|
||||
break;
|
||||
case 425:
|
||||
|
||||
@ -7,7 +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/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyEntity.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfo/minePersonInfo_entity.dart';
|
||||
import 'package:star_lock/mine/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/authorizedAdministrator/administratorDetails/administratorDetailEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/authorizedAdminListEntity.dart';
|
||||
@ -1165,19 +1168,19 @@ class ApiRepository {
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//修改账号
|
||||
Future<PasswordKeyListEntity> changeAccount(String countryCode,
|
||||
String newAccount, String uniqueid, String verificationCode) async {
|
||||
final res = await apiProvider.changeAccount(
|
||||
countryCode, newAccount, uniqueid, verificationCode);
|
||||
//修改绑定手机号
|
||||
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 uniqueid,
|
||||
String verificationCode, String operatorUid) async {
|
||||
final res = await apiProvider.bindEmail(
|
||||
email, uniqueid, verificationCode, operatorUid);
|
||||
//修改绑定邮箱
|
||||
Future<PasswordKeyListEntity> bindEmail(
|
||||
String email, String verificationCode, String unbindToken) async {
|
||||
final res =
|
||||
await apiProvider.bindEmail(email, verificationCode, unbindToken);
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1188,4 +1191,43 @@ class ApiRepository {
|
||||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ class TFInputHaveBorder extends StatelessWidget {
|
||||
String? label;
|
||||
bool? isPwd;
|
||||
Widget? rightSlot;
|
||||
Function()? onChangeAction;
|
||||
TFInputHaveBorder(
|
||||
{Key? key,
|
||||
required this.controller,
|
||||
@ -27,6 +28,7 @@ class TFInputHaveBorder extends StatelessWidget {
|
||||
this.keyboardType,
|
||||
this.background,
|
||||
this.hintText,
|
||||
this.onChangeAction,
|
||||
this.leftImg})
|
||||
: super(key: key);
|
||||
|
||||
@ -114,7 +116,11 @@ class TFInputHaveBorder extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
obscureText: false,
|
||||
onChanged: (String value) {},
|
||||
onChanged: (String value) {
|
||||
if (onChangeAction != null) {
|
||||
onChangeAction!();
|
||||
}
|
||||
},
|
||||
),
|
||||
rightSlot ?? const SizedBox(width: 0, height: 0)
|
||||
],
|
||||
|
||||
@ -67,8 +67,11 @@ dependencies:
|
||||
flutter_pickers: ^2.1.9
|
||||
#万年历
|
||||
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
|
||||
#蓝牙
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user