1,增加点击“重置”确认弹窗

2,部分传参异常判断
3,本地头像上传及更新(接口未给)
This commit is contained in:
Daisy 2023-10-13 09:20:28 +08:00
parent 35d35c545d
commit e4e2f71ab1
12 changed files with 137 additions and 69 deletions

View File

@ -72,9 +72,9 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
</plist>

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -45,8 +46,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
logic.resetElectronicKeyListRequest();
setState(() {});
_showDialog(context);
},
),
],
@ -343,4 +343,31 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
),
);
}
//
void _showDialog(widgetContext) {
showCupertinoDialog(
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('该锁的电子钥匙都将被删除'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.reset!.tr),
onPressed: () {
logic.resetElectronicKeyListRequest();
setState(() {});
},
),
],
);
},
);
}
}

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -30,7 +31,9 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
TranslationLoader.lanKeys!.reset!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {},
onPressed: () {
_showDialog(context);
},
),
],
),
@ -127,4 +130,28 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
),
);
}
//
void _showDialog(widgetContext) {
showCupertinoDialog(
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('该锁的电子钥匙都将被删除'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.reset!.tr),
onPressed: () {},
),
],
);
},
);
}
}

View File

@ -47,7 +47,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
showCupertinoDialogStyle();
_showDialog(context);
},
),
],
@ -317,46 +317,30 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
);
}
void showCupertinoDialogStyle() async {
var result = await showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: const Text(''),
content: Text(
"该锁的密码钥匙都将被删除",
style: TextStyle(
color: Colors.black,
fontSize: 24.sp,
fontWeight: FontWeight.w700),
//
void _showDialog(widgetContext) {
showCupertinoDialog(
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('该锁的电子钥匙都将被删除'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () {
Navigator.of(context).pop();
},
),
actions: <Widget>[
CupertinoButton(
child: Text(
"取消",
style: TextStyle(
color: Colors.blue,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
),
onPressed: () {
Navigator.pop(context);
},
),
CupertinoButton(
child: Text(
"重置",
style: TextStyle(
color: Colors.blue,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
),
onPressed: () {
logic.resetPasswordKeyListRequest();
},
),
],
);
});
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.reset!.tr),
onPressed: () {
logic.resetPasswordKeyListRequest();
setState(() {});
},
),
],
);
},
);
}
}

View File

@ -137,10 +137,11 @@ class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
TranslationLoader.lanKeys!.message!.tr, () {
Navigator.pushNamed(context, Routers.messageListPage);
}),
mineItem('images/mine/icon_mine_main_supportStaff.png',
TranslationLoader.lanKeys!.supportStaff!.tr, () {
Navigator.pushNamed(context, Routers.supportStaffPage);
}),
//
// mineItem('images/mine/icon_mine_main_supportStaff.png',
// TranslationLoader.lanKeys!.supportStaff!.tr, () {
// Navigator.pushNamed(context, Routers.supportStaffPage);
// }),
mineItem('images/mine/icon_mine_main_set.png',
TranslationLoader.lanKeys!.set!.tr, () {
Navigator.pushNamed(context, Routers.mineSetPage);

View File

@ -32,7 +32,9 @@ class MineBindPhoneOrEmailState {
MineBindPhoneOrEmailState() {
Map map = Get.arguments;
unbindToken.value = map["unbindToken"];
if (map["unbindToken"] != null) {
unbindToken.value = map["unbindToken"];
}
channel.value = map["isFrom"];
// 1 2
// 123456

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart';
@ -17,4 +18,18 @@ class MinePersonInfoLogic extends BaseGetXController {
state.haveSafeAnswer.value = entity.data!.haveSafeAnswer!;
}
}
// upToken updateUserInfo
Future<void> getUpTokenRequest() async {
var entity = await ApiRepository.to.getUpToken(state.typeStr.value);
if (entity.errorCode!.codeIsSuccessful) {}
}
//-
Future<void> updateUserInfoRequest() async {
var entity = await ApiRepository.to.updateUserInfo(state.headUrl.value);
if (entity.errorCode!.codeIsSuccessful) {
Toast.show(msg: '操作成功');
}
}
}

View File

@ -47,12 +47,20 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
isHaveLine: true,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 75.w,
height: 75.h,
rightWidget: ClipOval(
child: state.image != null
? Image.file(state.image as File)
: Image.asset('images/controls_user.png'),
? Image.file(
File(state.image!.path),
width: 72.w,
height: 72.w,
fit: BoxFit.fill,
)
: Image.asset(
'images/controls_user.png',
width: 72.w,
height: 72.w,
fit: BoxFit.fill,
),
),
action: () {
_openModalBottomSheet();
@ -128,7 +136,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: "",
rightTitle: state.haveSafeAnswer.value == 0 ? "去设置" : "",
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -178,6 +186,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
if (photo != null) {
state.image = photo;
// logic.getUpTokenRequest();
setState(() {});
}
}

View File

@ -10,6 +10,8 @@ class MinePersonInfoState {
var emailStr = ''.obs; //
var countryStr = ''.obs; ///
var haveSafeAnswer = 0.obs; //
var typeStr = '2'.obs; //2:
var headUrl = ''.obs; //url
// ImagePicker获取内容后返回的对象是XFile
XFile? image;

View File

@ -33,15 +33,17 @@ class MineSetSafetyProblemState {
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"];
if (Get.arguments != null) {
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"];
}
}
}

View File

@ -4,7 +4,6 @@ abstract class Api {
// final String baseUrl = "http://wenlin.lock.star-lock.cn/api"; //
final String baseUrl = "http://192.168.56.101:8099/api"; //
// final String baseUrl = "http://192.168.1.14:8099/api"; //
final String baseWebURL = 'http://192.168.56.101:8099'; //
//
final String getVerificationCodeUrl = '/user/sendValidationCode';

View File

@ -1226,7 +1226,7 @@ class ApiProvider extends BaseProvider {
// upToken updateUserInfo
Future<Response> getUpToken(String type) =>
post(setSafeAnswerURL.toUrl, jsonEncode({"type": type}));
post(getUpTokenURL.toUrl, jsonEncode({"type": type}));
//Token
Future<Response> unbindPhoneToken(String verificationCode) => post(