From e4e2f71ab17ae254d7701294a37920e1ab14d46f Mon Sep 17 00:00:00 2001 From: Daisy <> Date: Fri, 13 Oct 2023 09:20:28 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E2=80=9C=E9=87=8D=E7=BD=AE=E2=80=9D=E7=A1=AE=E8=AE=A4=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=202=EF=BC=8C=E9=83=A8=E5=88=86=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=88=A4=E6=96=AD=203=EF=BC=8C=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0=E5=8F=8A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=88=E6=8E=A5=E5=8F=A3=E6=9C=AA=E7=BB=99=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- star_lock/ios/Runner/Info.plist | 4 +- .../electronicKeyList_page.dart | 31 ++++++++- .../wirelessKeyboard_page.dart | 29 +++++++- .../passwordKeyList/passwordKeyList_page.dart | 66 +++++++------------ .../lib/mine/mine/starLockMine_page.dart | 9 +-- .../mineBindPhoneOrEmail_state.dart | 4 +- .../minePersonInfo_logic.dart | 15 +++++ .../minePersonInfo_page.dart | 21 ++++-- .../minePersonInfo_state.dart | 2 + .../minePersonInfoSetSafetyProblem_state.dart | 22 ++++--- star_lock/lib/network/api.dart | 1 - star_lock/lib/network/api_provider.dart | 2 +- 12 files changed, 137 insertions(+), 69 deletions(-) diff --git a/star_lock/ios/Runner/Info.plist b/star_lock/ios/Runner/Info.plist index a2ec65c5..d317c6fe 100644 --- a/star_lock/ios/Runner/Info.plist +++ b/star_lock/ios/Runner/Info.plist @@ -72,9 +72,9 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - io.flutter.embedded_views_preview - UIViewControllerBasedStatusBarAppearance + io.flutter.embedded_views_preview + diff --git a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart index 3cc76c8f..7013a21d 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_page.dart @@ -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 { style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () { - logic.resetElectronicKeyListRequest(); - setState(() {}); + _showDialog(context); }, ), ], @@ -343,4 +343,31 @@ class _ElectronicKeyListPageState extends State { ), ); } + +//是否重置弹窗 + 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(() {}); + }, + ), + ], + ); + }, + ); + } } diff --git a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart index 45e47c64..34eecdf6 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart @@ -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 { TranslationLoader.lanKeys!.reset!.tr, style: TextStyle(color: Colors.white, fontSize: 24.sp), ), - onPressed: () {}, + onPressed: () { + _showDialog(context); + }, ), ], ), @@ -127,4 +130,28 @@ class _WirelessKeyboardPageState extends State { ), ); } + + //是否重置弹窗 + 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: () {}, + ), + ], + ); + }, + ); + } } diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index c312808c..c74404c3 100644 --- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -47,7 +47,7 @@ class _PasswordKeyListPageState extends State { style: TextStyle(color: Colors.white, fontSize: 24.sp), ), onPressed: () { - showCupertinoDialogStyle(); + _showDialog(context); }, ), ], @@ -317,46 +317,30 @@ class _PasswordKeyListPageState extends State { ); } - 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: [ - 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(() {}); + }, + ), + ], + ); + }, + ); } } diff --git a/star_lock/lib/mine/mine/starLockMine_page.dart b/star_lock/lib/mine/mine/starLockMine_page.dart index 13fefaf0..8c501ec1 100644 --- a/star_lock/lib/mine/mine/starLockMine_page.dart +++ b/star_lock/lib/mine/mine/starLockMine_page.dart @@ -137,10 +137,11 @@ class _StarLockMinePageState extends State 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); diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart index ba522c32..4d3c4c97 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_state.dart @@ -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 邮箱 //短信类型 1注册,2找回密码,3绑定手机号,4解绑(换绑),5删除账号,6 绑定邮箱 diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart index e837241e..51cfaaa7 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart @@ -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 getUpTokenRequest() async { + var entity = await ApiRepository.to.getUpToken(state.typeStr.value); + if (entity.errorCode!.codeIsSuccessful) {} + } + + //更新个人信息-头像 + Future updateUserInfoRequest() async { + var entity = await ApiRepository.to.updateUserInfo(state.headUrl.value); + if (entity.errorCode!.codeIsSuccessful) { + Toast.show(msg: '操作成功'); + } + } } diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index f83cb65f..6ec5a44c 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -47,12 +47,20 @@ class _MinePersonInfoPageState extends State { 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 { }), 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 { source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear); if (photo != null) { state.image = photo; + // logic.getUpTokenRequest(); setState(() {}); } } diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart index 6d5661a2..55825f50 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart @@ -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; diff --git a/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart b/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart index 31c64336..6d6ee624 100644 --- a/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart +++ b/star_lock/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_state.dart @@ -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"]; + } } } diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart index f4901cd7..22ae9020 100644 --- a/star_lock/lib/network/api.dart +++ b/star_lock/lib/network/api.dart @@ -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'; diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 1c1f61e0..622f041d 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -1226,7 +1226,7 @@ class ApiProvider extends BaseProvider { //上传头像 先获取upToken 再调用updateUserInfo Future getUpToken(String type) => - post(setSafeAnswerURL.toUrl, jsonEncode({"type": type})); + post(getUpTokenURL.toUrl, jsonEncode({"type": type})); //获取解绑手机号Token Future unbindPhoneToken(String verificationCode) => post(