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>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict> </dict>
</plist> </plist>

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
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';
@ -45,8 +46,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: () {
logic.resetElectronicKeyListRequest(); _showDialog(context);
setState(() {});
}, },
), ),
], ],
@ -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/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';
@ -30,7 +31,9 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
TranslationLoader.lanKeys!.reset!.tr, TranslationLoader.lanKeys!.reset!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), 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), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () { onPressed: () {
showCupertinoDialogStyle(); _showDialog(context);
}, },
), ),
], ],
@ -317,46 +317,30 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> {
); );
} }
void showCupertinoDialogStyle() async { //
var result = await showCupertinoDialog( void _showDialog(widgetContext) {
context: context, showCupertinoDialog(
builder: (context) { context: widgetContext,
return CupertinoAlertDialog( builder: (context) {
title: const Text(''), return CupertinoAlertDialog(
content: Text( title: const Text('该锁的电子钥匙都将被删除'),
"该锁的密码钥匙都将被删除", actions: [
style: TextStyle( CupertinoDialogAction(
color: Colors.black, child: Text(TranslationLoader.lanKeys!.cancel!.tr),
fontSize: 24.sp, onPressed: () {
fontWeight: FontWeight.w700), Navigator.of(context).pop();
},
), ),
actions: <Widget>[ CupertinoDialogAction(
CupertinoButton( child: Text(TranslationLoader.lanKeys!.reset!.tr),
child: Text( onPressed: () {
"取消", logic.resetPasswordKeyListRequest();
style: TextStyle( setState(() {});
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();
},
),
],
);
});
} }
} }

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart'; import '../../../../tools/baseGetXController.dart';
@ -17,4 +18,18 @@ class MinePersonInfoLogic extends BaseGetXController {
state.haveSafeAnswer.value = entity.data!.haveSafeAnswer!; 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, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox( rightWidget: ClipOval(
width: 75.w,
height: 75.h,
child: state.image != null child: state.image != null
? Image.file(state.image as File) ? Image.file(
: Image.asset('images/controls_user.png'), 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: () { action: () {
_openModalBottomSheet(); _openModalBottomSheet();
@ -128,7 +136,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: "", rightTitle: state.haveSafeAnswer.value == 0 ? "去设置" : "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -178,6 +186,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear); source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
if (photo != null) { if (photo != null) {
state.image = photo; state.image = photo;
// logic.getUpTokenRequest();
setState(() {}); setState(() {});
} }
} }

View File

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

View File

@ -33,15 +33,17 @@ class MineSetSafetyProblemState {
var canSub = false.obs; var canSub = false.obs;
MineSetSafetyProblemState() { MineSetSafetyProblemState() {
Map map = Get.arguments; if (Get.arguments != null) {
firstProblemStr.value = map["firstProblemStr"]; Map map = Get.arguments;
secondProblemStr.value = map["secondProblemStr"]; firstProblemStr.value = map["firstProblemStr"];
thirdProblemStr.value = map["thirdProblemStr"]; secondProblemStr.value = map["secondProblemStr"];
firstAnswerStr.value = map["firstAnswerStr"]; thirdProblemStr.value = map["thirdProblemStr"];
secondAnswerStr.value = map["secondAnswerStr"]; firstAnswerStr.value = map["firstAnswerStr"];
thirdAnswerStr.value = map["thirdAnswerStr"]; secondAnswerStr.value = map["secondAnswerStr"];
firstQuestionId.value = map["firstQuestionId"]; thirdAnswerStr.value = map["thirdAnswerStr"];
secondQuestionId.value = map["secondQuestionId"]; firstQuestionId.value = map["firstQuestionId"];
thirdQuestionId.value = map["thirdQuestionId"]; 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://wenlin.lock.star-lock.cn/api"; //
final String baseUrl = "http://192.168.56.101:8099/api"; // final String baseUrl = "http://192.168.56.101:8099/api"; //
// final String baseUrl = "http://192.168.1.14: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'; final String getVerificationCodeUrl = '/user/sendValidationCode';

View File

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