更新用户模块

This commit is contained in:
wyf
2025-06-09 19:11:25 +08:00
parent 8dfc522a69
commit 501d133bad
19 changed files with 1470 additions and 307 deletions

View File

@@ -176,7 +176,6 @@
"注销账号":"注销账号", "注销账号":"注销账号",
"退出成功":"退出成功", "退出成功":"退出成功",
"退出失败":"退出失败" "退出失败":"退出失败"
}, },
"关于我们":{ "关于我们":{
"标题":"关于我们" "标题":"关于我们"

View File

@@ -12,7 +12,7 @@
"详情": "详情", "详情": "详情",
"人员资料": "人员资料" "人员资料": "人员资料"
}, },
"请输入手机号":"输入手机号", "请输入手机号":"输入手机号",
"请输入正确的手机号":"请输入正确的手机号", "请输入正确的手机号":"请输入正确的手机号",
"请输入密码":"请输入密码", "请输入密码":"请输入密码",
"密码格式提示":"1.密码长度必须至少8位\n2.密码需要字母加数字\n3.特殊字符和大写字母至少包含一个", "密码格式提示":"1.密码长度必须至少8位\n2.密码需要字母加数字\n3.特殊字符和大写字母至少包含一个",
@@ -44,7 +44,7 @@
"提交":"提交", "提交":"提交",
"发送验证码成功":"发送验证码成功", "发送验证码成功":"发送验证码成功",
"注册成功":"注册成功", "注册成功":"注册成功",
"再按一次退出程序":"再按一次退出程序成功", "再按一次退出程序":"再按一次退出程序成功",
"用户拒绝授权":"用户拒绝授权", "用户拒绝授权":"用户拒绝授权",
"用户取消授权":"用户取消授权", "用户取消授权":"用户取消授权",
"未命名":"未命名", "未命名":"未命名",
@@ -53,8 +53,16 @@
"点击更换头像":"点击更换头像", "点击更换头像":"点击更换头像",
"保存失败":"保存失败", "保存失败":"保存失败",
"昵称为空":"昵称为空", "昵称为空":"昵称为空",
"保存成功":"保存成功" "保存成功":"保存成功",
"请先登录":"请先登录",
"密码修改成功":"密码修改成功",
"未知数据":"-",
"必须登录提示":"请先登录!",
"输入验证码":"输入验证码",
"输入新密码":"输入新密码",
"确认验证码":"确认验证码",
"输入手机号码":"输入手机号码",
"操作成功":"操作成功"

View File

@@ -37,6 +37,8 @@ class ServiceConstant {
static const String user_register = "/api/user/register";//用户注册 static const String user_register = "/api/user/register";//用户注册
static const String user_forgot = "/api/user/forgot";//找回密码
static const String user_changePassword = "/api/user/changePassword";//修改密码

View File

@@ -1,93 +1,3 @@
// import 'package:flutter/material.dart';
// import 'package:vbvs_app/common/util/FitTool.dart';
// class CustomCard extends StatefulWidget {
// final double borderRadius; // 圆角
// final VoidCallback onTap; // 点击回调
// final List<Color> colors; // 背景颜色列表
// final Widget child; // 子组件
// final bool enableAnimation; // 是否启用动画效果
// final bool enableGradient; // 是否启用渐变
// const CustomCard({
// Key? key,
// required this.borderRadius,
// required this.onTap,
// required this.colors,
// required this.child,
// this.enableAnimation = true, // 默认启用动画效果
// this.enableGradient = true, // 默认启用渐变效果
// }) : super(key: key);
// @override
// State<CustomCard> createState() => _CustomCardState();
// }
// class _CustomCardState extends State<CustomCard>
// with SingleTickerProviderStateMixin {
// double _scale = 1.0;
// final Duration _animationDuration = const Duration(milliseconds: 50);
// Future<void> _handleTap() async {
// if (widget.enableAnimation) {
// setState(() {
// _scale = 0.95;
// });
// await Future.delayed(_animationDuration);
// setState(() {
// _scale = 1.0;
// });
// }
// widget.onTap();
// }
// @override
// Widget build(BuildContext context) {
// final bool isGradient = widget.enableGradient && widget.colors.length > 1;
// final Color baseColor = widget.colors.first;
// return Material(
// color: Colors.transparent,
// borderRadius: BorderRadius.circular(widget.borderRadius),
// child: InkWell(
// onTap: _handleTap,
// borderRadius: BorderRadius.circular(widget.borderRadius),
// splashColor: widget.colors.first.withOpacity(0.2),
// child: widget.enableAnimation
// ? AnimatedScale(
// scale: _scale,
// duration: _animationDuration,
// curve: Curves.easeInOut,
// child: _buildContent(isGradient, baseColor),
// )
// : _buildContent(isGradient, baseColor),
// ),
// );
// }
// Widget _buildContent(bool isGradient, Color baseColor) {
// return Container(
// decoration: BoxDecoration(
// color: isGradient ? null : baseColor,
// gradient: isGradient
// ? LinearGradient(
// colors: widget.colors,
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// )
// : null,
// borderRadius: BorderRadius.circular(widget.borderRadius),
// ),
// child: Padding(
// padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 5.rpx),
// child: widget.child,
// ),
// );
// }
// }
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';

View File

@@ -1,12 +1,9 @@
import 'dart:convert';
import 'package:EasyDartModule/EasyDartModule.dart'; import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get_storage/get_storage.dart'; import 'package:get_storage/get_storage.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart';
@@ -16,9 +13,9 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
part 'login_controller.g.dart'; part 'login_controller.g.dart';
@JsonSerializable() @JsonSerializable()
@@ -26,7 +23,7 @@ class LoginModel {
//版本id //版本id
int? loginStyle = 1; //1.密码登录 2.短信登录 int? loginStyle = 1; //1.密码登录 2.短信登录
String? account = '17649984946'; //账户 String? account = '17649984946'; //账户
String? password = 'wyf123,.'; //密码 String? password = '123wyf..'; //密码
String? phone; //手机号/邮箱 String? phone; //手机号/邮箱
String? code; //验证码 String? code; //验证码

View File

@@ -1,6 +1,10 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/framework.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
part 'find_password_controller.g.dart'; part 'find_password_controller.g.dart';
@@ -28,122 +32,135 @@ class FindPasswordController extends GetControllerEx<FindPasswordModel> {
attr = GetModel(FindPasswordModel()).obs; attr = GetModel(FindPasswordModel()).obs;
} }
// Future<String> getCode(BuildContext context) async { Future<String> getCode(BuildContext context) async {
// String message = ""; String message = "";
// final MyDialogController myDialogController = if (model.phone == null || model.phone!.isEmpty) {
// Get.find<MyDialogController>(); message = "请输入手机号".tr;
// if (model.phone == null || model.phone!.isEmpty) { TopSlideNotification.show(context,
// message = "请输入手机号"; text: message, textColor: themeController.currentColor.sc9);
// showToast(message); return message;
// return message; }
// } if (!MyUtils.isValidPhoneNumber(model.phone!)) {
// if (!MyUtils.isValidPhoneNumber(model.phone!)) { message = '请输入正确的手机号';
// message = '请输入正确的手机号'; TopSlideNotification.show(context,
// showToast(message); text: message, textColor: themeController.currentColor.sc9);
// return message; return message;
// } }
// message = await repository.sendResetCode(model.phone!); String serviceAddress = ServiceConstant.service_address;
// if (message.isNotEmpty) { String serviceName = ServiceConstant.server_service;
// showToast("发送验证码失败或已到限制数量,请稍候或一小时/一天后再试!"); String serviceApi = ServiceConstant.send_code;
// return message; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
// } else { var data = {"userName": model.phone, "type": 2};
// showToast("发送验证码成功!", color: color_success); await requestWithLog(
// } logTitle: "忘记密码请求验证码",
// return ''; method: MyHttpMethod.post,
// } queryUrl: queryUrl,
data: data,
onSuccess: (res) {
TopSlideNotification.show(
context,
text: '发送验证码成功'.tr,
);
},
onFailure: (res) {
message = res.msg!;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
},
);
return message;
}
// //确认验证码 //确认验证码
// Future<String> confirmCode(BuildContext context) async { Future<String> confirmCode(BuildContext context) async {
// String message = ""; String message = "";
// final MyDialogController myDialogController = if (model.phone == null || model.phone!.isEmpty) {
// Get.find<MyDialogController>(); message = "请输入手机号".tr;
// if (model.phone == null || model.phone!.isEmpty) { TopSlideNotification.show(context,
// message = "请输入手机号"; text: message, textColor: themeController.currentColor.sc9);
// showToast(message); return message;
// return message; }
// } if (!MyUtils.isValidPhoneNumber(model.phone!)) {
// if (!MyUtils.isValidPhoneNumber(model.phone!)) { message = '请输入正确的手机号'.tr;
// message = '请输入正确的手机号'; TopSlideNotification.show(context,
// showToast(message); text: message, textColor: themeController.currentColor.sc9);
// return message; return message;
// } }
// if (model.code == null || model.code!.isEmpty) { if (model.code == null || model.code!.isEmpty) {
// message = "请输入验证码"; message = "请输入验证码".tr;
// showToast(message); TopSlideNotification.show(context,
// return message; text: message, textColor: themeController.currentColor.sc9);
// } return message;
// if (model.pd == null || model.pd!.isEmpty) { }
// message = "请输入密码"; if (model.pd == null || model.pd!.isEmpty) {
// showToast(message); message = "请输入密码".tr;
// return message; TopSlideNotification.show(context,
// } text: message, textColor: themeController.currentColor.sc9);
// // if (model.pd!.length < 8) { return message;
// // message = "密码长度必须至少8位"; }
// // showToast(message); String passwordMsg = "密码格式提示".tr;
// // return message; bool hasUppercase = model.pd!.contains(RegExp(r'[A-Z]'));
// // } bool hasDigit = model.pd!.contains(RegExp(r'[0-9]'));
// // bool hasUppercase = model.pd!.contains(RegExp(r'[A-Z]')); bool hasSpecialCharacters =
// // bool hasLowercase = model.pd!.contains(RegExp(r'[a-z]')); model.pd!.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
// // bool hasSpecialCharacters = bool hasLetter = model.pd!.contains(RegExp(r'[a-zA-Z]'));
// // model.pd!.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
// // if (!hasUppercase) {
// // message = "密码必须包含至少一个大写字母";
// // showToast(message);
// // return message;
// // }
// // if (!hasLowercase) { if (model.pd!.length < 8) {
// // message = "密码必须包含至少一个小写字母"; message = passwordMsg;
// // showToast(message); TopSlideNotification.show(context,
// // return message; text: message, textColor: themeController.currentColor.sc9);
// // } return message;
}
// // if (!hasSpecialCharacters) { if (!hasLetter || !hasDigit) {
// // message = "密码必须包含至少一个特殊字符"; message = passwordMsg;
// // showToast(message); TopSlideNotification.show(context,
// // return message; text: message, textColor: themeController.currentColor.sc9);
// // } return message;
// String passwordMsg = "1.密码长度必须至少8位\n2.密码需要字母加数字\n3.特殊字符或大写字母至少包含一个"; }
// bool hasUppercase = model.pd!.contains(RegExp(r'[A-Z]'));
// bool hasDigit = model.pd!.contains(RegExp(r'[0-9]'));
// bool hasSpecialCharacters =
// model.pd!.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
// bool hasLetter = model.pd!.contains(RegExp(r'[a-zA-Z]'));
// if (model.pd!.length < 8) { if (!(hasSpecialCharacters || hasUppercase)) {
// message = passwordMsg; message = passwordMsg;
// showToast(message, closeTime: 5); TopSlideNotification.show(context,
// return message; text: message, textColor: themeController.currentColor.sc9);
// } return message;
}
// if (!hasLetter || !hasDigit) { if (model.confirm == null || model.confirm!.isEmpty) {
// message = passwordMsg; message = "请输入确认密码".tr;
// showToast(message); TopSlideNotification.show(context,
// return message; text: message, textColor: themeController.currentColor.sc9);
// } return message;
}
// if (!(hasSpecialCharacters || hasUppercase)) { if (model.pd != model.confirm) {
// message = passwordMsg; message = "两次密码不一致".tr;
// showToast(message); TopSlideNotification.show(context,
// return message; text: message, textColor: themeController.currentColor.sc9);
// } return message;
}
// if (model.confirm == null || model.confirm!.isEmpty) { var data = {
// message = "请输入确认密码"; "userName": model.phone,
// showToast(message); "password": model.pd,
// return message; "verify": model.code
// } };
// if (model.pd != model.confirm) { String serviceAddress = ServiceConstant.service_address;
// message = "两次密码不一致"; String serviceName = ServiceConstant.server_service;
// showToast(message); String serviceApi = ServiceConstant.user_forgot;
// return message; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
// } await requestWithLog(
// message = logTitle: "找回密码",
// await repository.confirmCode(model.phone!, model.code!, model.pd!); method: MyHttpMethod.post,
// if (message.isNotEmpty) { queryUrl: queryUrl,
// showToast("更新失败,请稍后再试"); data: data,
// return message; onSuccess: (res) {
// } TopSlideNotification.show(context, text: "密码修改成功".tr);
// return ''; },
// } onFailure: (res) {
message = res.msg!;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
},
);
return message;
}
} }

View File

@@ -58,6 +58,7 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
attr = GetModel(UserInfoModel()).obs; attr = GetModel(UserInfoModel()).obs;
} }
RxDouble textHalfWidth = 0.0.obs;
List device_bind_status = []; List device_bind_status = [];
int device_bind_flag = 0;//0。未初始化 1.已初始化 int device_bind_flag = 0;//0。未初始化 1.已初始化

View File

@@ -64,6 +64,7 @@ import 'package:vbvs_app/model/user_data.dart';
import 'package:vbvs_app/pages/mh_page/MattressControl.dart'; import 'package:vbvs_app/pages/mh_page/MattressControl.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart'; import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart'; import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/update_password_controller.dart';
import 'package:vbvs_app/routers/mh_routers.dart'; import 'package:vbvs_app/routers/mh_routers.dart';
import 'controller/mh_controller/apply_repair_controller.dart'; import 'controller/mh_controller/apply_repair_controller.dart';
@@ -272,20 +273,21 @@ Future<void> dealBindProcess() async {
} }
} }
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
MyApp({super.key}); MyApp({super.key});
final ThemeController themeController = Get.put(ThemeController()); final ThemeController themeController = Get.put(ThemeController());
Widget buildmht(BuildContext context, BoxConstraints cons) { Widget buildmht(BuildContext context, BoxConstraints cons) {
return GetMaterialApp( return GetMaterialApp(
navigatorKey: AppGlobal.navigatorKey, // ✅ 注入 navigatorKey navigatorKey: navigatorKey, // ✅ 注入 navigatorKey
translations: AppLanguage(), translations: AppLanguage(),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: '', title: '',
theme: themeController.currentTheme, theme: themeController.currentTheme,
// home: MainPageBBottomChange(), // home: MainPageBBottomChange(),
initialRoute: "/loginPage", // initialRoute: "/loginPage",
// initialRoute: "/mianPageBottomChange", initialRoute: "/mianPageBottomChange",
onGenerateRoute: mhonGenerateRoute, onGenerateRoute: mhonGenerateRoute,
initialBinding: BindingsBuilder(() => [ initialBinding: BindingsBuilder(() => [
// Get.lazyPut(() => UserInfoController()), // Get.lazyPut(() => UserInfoController()),
@@ -326,6 +328,7 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => MHTRegisterController()), Get.lazyPut(() => MHTRegisterController()),
Get.lazyPut(() => WeatherModelController()), Get.lazyPut(() => WeatherModelController()),
Get.lazyPut(() => RegisterController()), Get.lazyPut(() => RegisterController()),
Get.lazyPut(() => UpdatePasswordController()),
])); ]));
} }

View File

@@ -43,7 +43,7 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
requestWithLog( requestWithLog(
logTitle: "查询用户消息配置", logTitle: "查询用户消息配置",
method: MyHttpMethod.get, method: MyHttpMethod.get,
queryUrl: queryUrl, queryUrl: queryUrl,
onSuccess: (res) { onSuccess: (res) {
if (res.data == null || res.data.isEmpty) { if (res.data == null || res.data.isEmpty) {
var data = { var data = {

View File

@@ -5,6 +5,8 @@ import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart'; import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
@@ -646,42 +648,58 @@ class _NewHomePageState extends State<NewHomePage> {
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 0, 0, 80.rpx), 0, 0, 0, 80.rpx),
child: Container( child: ClickableContainer(
width: MediaQuery.sizeOf(context).width, backgroundColor: Colors.transparent,
height: 302.rpx, highlightColor: Colors.transparent,
padding: EdgeInsets.only( padding: EdgeInsets.all(0),
top: 90.rpx, bottom: 80.rpx), onTap: () {
decoration: BoxDecoration( if (userInfoController.model.login ==
// color: Colors.white, null ||
borderRadius: userInfoController.model.login == 0) {
BorderRadius.circular(borderRadius), TopSlideNotification.show(context,
border: Border.all( text: "请先登录".tr,
color: stringToColor("#85F5FF"), // 边框颜色 textColor:
width: 1.rpx, // 边框宽度 themeController.currentColor.sc9);
Get.toNamed("/loginPage");
}
},
child: Container(
width: MediaQuery.sizeOf(context).width,
height: 302.rpx,
padding: EdgeInsets.only(
top: 90.rpx, bottom: 80.rpx),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(borderRadius),
border: Border.all(
color: stringToColor("#85F5FF"), // 边框颜色
width: 1.rpx, // 边框宽度
),
), ),
), child: Column(
child: Column( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
'assets/images/icon/add.svg', 'assets/images/icon/add.svg',
width: 42.rpx, width: 42.rpx,
height: 42.rpx, height: 42.rpx,
),
SizedBox(
height: 32.rpx,
),
Text(
'添加一台新设备'.tr,
style: TextStyle(
color: stringToColor("#85F5FF"),
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
), ),
), SizedBox(
], height: 32.rpx,
),
Text(
'添加一台新设备'.tr,
style: TextStyle(
color: stringToColor("#85F5FF"),
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
],
),
), ),
), ),
), ),

View File

@@ -7,6 +7,7 @@ import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
@@ -40,7 +41,7 @@ class _MinePageState extends State<NewMinePage> {
text = (nickname != null && nickname.isNotEmpty) ? nickname : '未命名'.tr; text = (nickname != null && nickname.isNotEmpty) ? nickname : '未命名'.tr;
} }
// _calculateTextHalfWidth(text); _calculateTextHalfWidth(text);
} }
void _calculateTextHalfWidth(String text) { void _calculateTextHalfWidth(String text) {
@@ -60,6 +61,7 @@ class _MinePageState extends State<NewMinePage> {
_textHalfWidth = textPainter.width / 2; _textHalfWidth = textPainter.width / 2;
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
@@ -185,6 +187,18 @@ class _MinePageState extends State<NewMinePage> {
highlightColor: const Color(0xFF055466), highlightColor: const Color(0xFF055466),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onTap: () async { onTap: () async {
if (userInfoController.model.login ==
null ||
userInfoController.model.login == 0) {
TopSlideNotification.show(
context,
text: "必须登录提示".tr,
textColor:
themeController.currentColor.sc9,
);
Get.toNamed("/loginPage");
return;
}
await Get.toNamed("/editUserInfoPage"); await Get.toNamed("/editUserInfoPage");
await userInfoController.getUserInfo(); await userInfoController.getUserInfo();
userInfoController.updateAll(); userInfoController.updateAll();
@@ -216,7 +230,6 @@ class _MinePageState extends State<NewMinePage> {
), ),
)), )),
), ),
], ],
), ),
), ),
@@ -385,13 +398,7 @@ class _MinePageState extends State<NewMinePage> {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/expand.svg', 'assets/img/icon/expand.svg',
color: Colors.white, color: Colors.white,
) ))),
// Icon(
// Icons.arrow_forward_ios,
// color: Colors.white,
// // size: 14.rpx,
// ),
)),
], ],
), ),
), ),

View File

@@ -103,8 +103,7 @@ class _SettingPageState extends State<SettingPage> {
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 0.rpx, 40.rpx, 0.rpx), 40.rpx, 0.rpx, 40.rpx, 0.rpx),
onTap: () { onTap: () {
TopSlideNotification.show(context, Get.toNamed("/updatePasswordPage");
text: "待开发功能".tr);
}, },
child: Container( child: Container(
child: Padding( child: Padding(

View File

@@ -23,7 +23,7 @@ class LoginModel {
String? account = '17649984946'; //账户 String? account = '17649984946'; //账户
// String? account = '13953240733'; //账户 // String? account = '13953240733'; //账户
String? password = 'wyf123..'; //密码 String? password = '123wyf..'; //密码
// String? account = '15255134931'; //账户 // String? account = '15255134931'; //账户
// String? password = 'mht123,.'; //密码 // String? password = 'mht123,.'; //密码

View File

@@ -0,0 +1,163 @@
import 'package:ef/ef.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
part 'update_password_controller.g.dart';
@JsonSerializable()
class UpdatePasswordModel {
String? phone; //手机号
String? code; //验证码
String? pd; //密码
String? confirm; //验证密码
bool? pdshow = true; //是否显示密码
bool? cpdshow = true; //是否显示密码
UpdatePasswordModel();
static UpdatePasswordModel fromJson(Map<String, dynamic> json) =>
_$UpdatePasswordModelFromJson(json);
Map<String, dynamic> toJson() => _$UpdatePasswordModelToJson(this);
}
class UpdatePasswordController extends GetControllerEx<UpdatePasswordModel> {
UpdatePasswordController() {
attr = GetModel(UpdatePasswordModel()).obs;
}
UserInfoController userInfoController = Get.find();
//确认验证码
Future<String> resetPassword(BuildContext context) async {
String message = "";
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (model.code == null || model.code!.isEmpty) {
message = "请输入验证码".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (model.pd == null || model.pd!.isEmpty) {
message = "请输入密码".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
String passwordMsg = "密码格式提示".tr;
bool hasUppercase = model.pd!.contains(RegExp(r'[A-Z]'));
bool hasDigit = model.pd!.contains(RegExp(r'[0-9]'));
bool hasSpecialCharacters =
model.pd!.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
bool hasLetter = model.pd!.contains(RegExp(r'[a-zA-Z]'));
if (model.pd!.length < 8) {
message = passwordMsg;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!hasLetter || !hasDigit) {
message = passwordMsg;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!(hasSpecialCharacters || hasUppercase)) {
message = passwordMsg;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (model.confirm == null || model.confirm!.isEmpty) {
message = "请输入确认密码".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (model.pd != model.confirm) {
message = "两次密码不一致".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_changePassword;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
final user = userInfoController.model.user!;
var data = {
"userName": user.email ?? user.phone,
"password": model.pd,
"verify": model.code
};
await requestWithLog(
logTitle: "修改密码",
method: MyHttpMethod.post,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {
TopSlideNotification.show(context, text: "操作成功".tr);
},
onFailure: (res) {
message = res.msg!;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
},
);
return message;
}
//获取验证码
Future<String> getCode(BuildContext context) async {
String message = "";
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
return message;
}
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.send_code;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
var data = {"userName": model.phone, "type": 3};
await requestWithLog(
data: data,
logTitle: "发送验证码",
method: MyHttpMethod.post,
queryUrl: queryUrl,
onSuccess: (res) {
TopSlideNotification.show(context, text: "发送验证码成功".tr);
},
onFailure: (res) {
message = res.msg!;
TopSlideNotification.show(context,
text: message, textColor: themeController.currentColor.sc9);
},
);
return message;
}
}

View File

@@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'update_password_controller.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
UpdatePasswordModel _$UpdatePasswordModelFromJson(Map<String, dynamic> json) =>
UpdatePasswordModel()
..phone = json['phone'] as String?
..code = json['code'] as String?
..pd = json['pd'] as String?
..confirm = json['confirm'] as String?
..pdshow = json['pdshow'] as bool?
..cpdshow = json['cpdshow'] as bool?;
Map<String, dynamic> _$UpdatePasswordModelToJson(
UpdatePasswordModel instance) =>
<String, dynamic>{
'phone': instance.phone,
'code': instance.code,
'pd': instance.pd,
'confirm': instance.confirm,
'pdshow': instance.pdshow,
'cpdshow': instance.cpdshow,
};

View File

@@ -1,8 +1,11 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/mh_controller/find_password_controller.dart'; import 'package:vbvs_app/controller/mh_controller/find_password_controller.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart';
@@ -290,40 +293,49 @@ class FindPasswordPage extends GetView<FindPasswordController> {
CountdownController>(); CountdownController>();
return InkWell( return InkWell(
onTap: () async { onTap: () async {
// if (countdownController if (countdownController
// .countdown.value != .countdown
// 0) { .value !=
// return; 0) {
// } return;
// if (CommonVariables }
// .isNetWorkOn == if (CommonVariables
// false) { .isNetWorkOn ==
// showToast( false) {
// "网络未连接,请开启设备网络后重试"); TopSlideNotification.show(
// return; context,
// } text:
// String msg = "网络未连接,请开启设备网络后重试"
// await controller .tr,
// .getCode(context); textColor:
// if (msg.isNotEmpty) { themeController
// return; .currentColor
// } .sc9);
// countdownController return;
// .countdown }
// .value == String msg =
// 0 await controller
// ? countdownController .getCode(
// .startCountdown( context);
// AppConstants if (msg.isNotEmpty) {
// .code_time) return;
// : null; }
countdownController
.countdown
.value ==
0
? countdownController
.startCountdown(
AppConstants
.code_time)
: null;
}, },
child: Text( child: Text(
countdownController countdownController
.countdown .countdown
.value == .value ==
0 0
? '获取验证码' ? '获取验证码'.tr
: '${countdownController.countdown.value}' + : '${countdownController.countdown.value}' +
''.tr, ''.tr,
style: TextStyle( style: TextStyle(
@@ -566,19 +578,21 @@ class FindPasswordPage extends GetView<FindPasswordController> {
borderRadius: 16.rpx, borderRadius: 16.rpx,
gradientDirection: gradientDirection:
GradientDirection.vertical, GradientDirection.vertical,
onTap: () { onTap: () async {
// if (CommonVariables.isNetWorkOn == if (CommonVariables.isNetWorkOn ==
// false) { false) {
// showToast("网络未连接,请开启设备网络后重试"); TopSlideNotification.show(
// return; context,
// } text: "网络未连接,请开启设备网络后重试".tr,
// String msg = await controller textColor: themeController
// .confirmCode(context); .currentColor.sc9);
// if (msg.isEmpty) { return;
// // Get.toNamed("/userInfoPage"); }
// // Get.toNamed("/resetPasswordPage"); String msg = await controller
// Get.toNamed("/loginPage"); .confirmCode(context);
// } if (msg.isEmpty) {
Get.toNamed("/loginPage");
}
}, },
colors: const [ colors: const [
Color(0xFFFCFCFC), Color(0xFFFCFCFC),

View File

@@ -1308,7 +1308,10 @@ class MHTLoginPage extends GetView<MHTLoginController> {
null; null;
loginController.model.phone = null; loginController.model.phone = null;
loginController.model.code = null; loginController.model.code = null;
MHTRegisterController
registerController = Get.find();
registerController
.model.register_agree = false;
Get.offAndToNamed( Get.offAndToNamed(
"/mianPageBottomChange"); "/mianPageBottomChange");
} }

View File

@@ -0,0 +1,973 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:get_storage/get_storage.dart';
import 'package:vbvs_app/common/color/appColors.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/appFontsize.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/login/login_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/mh_controller/register_controller.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/update_password_controller.dart';
class UpdatePasswordPage extends GetView<UpdatePasswordController> {
BoxConstraints? bodysize;
final scaffoldKey = GlobalKey<ScaffoldState>();
UpdatePasswordPage() {
controller.model.pdshow = true;
controller.model.cpdshow = true;
// 获取登录用户手机号,设置到 model 中
UserInfoController userInfoController = Get.find();
controller.model.phone = userInfoController.model.user!.phone;
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, cc) {
bodysize = cc;
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
// key: scaffoldKey,
appBar: AppBar(
backgroundColor: Colors.transparent,
// backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme:
IconThemeData(color: themeController.currentColor.sc3),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'修改密码'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
/// 左边返回按钮
Positioned(
left: 0,
child: returnIconButtom,
),
],
),
),
actions: [],
centerTitle: false,
),
backgroundColor: Colors.transparent,
body: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
15, 13, 15, 0),
child: Container(
width: bodysize!.maxWidth,
constraints: BoxConstraints(
minWidth: 346,
minHeight: 162,
),
decoration: BoxDecoration(
color: stringToColor("#003058"),
borderRadius: BorderRadius.circular(16),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
22, 20, 17, 21),
child: Container(
width: bodysize!.maxWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
// height: 31, // 设置高度为 31
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
constraints: BoxConstraints(
minWidth: 158
.rpx, // 设置最小宽度为 100
),
child: Align(
alignment:
AlignmentDirectional(
-1, 0),
child: Text(
'输入手机号码'.tr,
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color:
Colors.white,
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Container(
width: MediaQuery.sizeOf(
context)
.width,
height:
40, // 这个高度可以移除,或调整为 31
decoration: BoxDecoration(
color:
Color(0xFFF3F5F6),
borderRadius:
BorderRadius
.circular(8),
),
child: TextFormField(
readOnly: true, // 设置为只读
initialValue: controller
.model
.phone!, // 设置初始值
onChanged: (value) {
controller.model
.phone = value;
},
obscureText: false,
decoration:
InputDecoration(
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize:
AppFontsize
.normal_text_size,
letterSpacing:
0,
),
hintStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
letterSpacing:
0,
),
enabledBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
errorBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: FlutterFlowTheme
.of(context)
.error,
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: FlutterFlowTheme
.of(context)
.error,
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
contentPadding:
EdgeInsetsDirectional
.fromSTEB(8,
0, 0, 8),
),
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: themeController
.currentColor
.sc4,
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
),
),
].divide(SizedBox(width: 13)),
),
),
Container(
// height: 31, // 设置高度为 31
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
constraints: BoxConstraints(
minWidth: 158
.rpx, // 设置最小宽度为 100
),
child: Align(
alignment:
AlignmentDirectional(
-1, 0),
child: Text(
'输入验证码',
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color:
Colors.white,
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Container(
width: MediaQuery.sizeOf(
context)
.width,
height:
40, // 这里也设置为31保持一致
decoration: BoxDecoration(
color:
Color(0xFFF3F5F6),
borderRadius:
BorderRadius
.circular(8),
),
child: Stack(
children: [
Align(
alignment:
AlignmentDirectional(
0, 0),
child: Container(
width: MediaQuery
.sizeOf(
context)
.width,
height:
31, // 这里的高度也设置为31
decoration:
BoxDecoration(
color: Color(
0xFFF3F5F6),
borderRadius:
BorderRadius
.circular(
12),
),
child: Align(
alignment:
AlignmentDirectional(
0, 0),
child:
TextFormField(
onChanged:
(value) {
controller
.model
.code =
value;
},
obscureText:
false,
decoration:
InputDecoration(
labelStyle: FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize:
AppFontsize.normal_text_size,
letterSpacing:
0,
),
hintText:
'请输验证码',
hintStyle: FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color: themeController
.currentColor
.sc4,
fontSize:
AppFontsize.normal_text_size,
letterSpacing:
0,
),
enabledBorder:
InputBorder
.none,
focusedBorder:
InputBorder
.none,
errorBorder:
InputBorder
.none,
focusedErrorBorder:
InputBorder
.none,
contentPadding:
EdgeInsetsDirectional.fromSTEB(
8,
0,
0,
12),
),
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize:
AppFontsize.normal_text_size,
letterSpacing:
0,
),
),
),
),
),
Align(
alignment:
AlignmentDirectional(
0.25, 0),
child: Container(
width: 1.rpx,
height: 15,
decoration:
BoxDecoration(
color: Color(
0xFFD3D3D3),
),
),
),
Align(
alignment:
AlignmentDirectional(
1, 0),
child: Padding(
padding:
EdgeInsetsDirectional
.fromSTEB(
0,
0,
5,
0),
child: Container(
width: MediaQuery.sizeOf(
context)
.width *
0.157,
height:
31, // 这里的高度也设置为31
constraints:
BoxConstraints(
minWidth: 80,
minHeight: 30,
),
child: Align(
alignment:
AlignmentDirectional(
0, 0),
child:
Obx(() {
final CountdownController
countdownController =
Get.find<
CountdownController>();
return InkWell(
onTap:
() async {
if (countdownController.countdown.value !=
0) {
return;
}
String
msg =
await controller.getCode(context);
if (msg
.isNotEmpty) {
return;
}
if (countdownController.countdown.value ==
0) {
countdownController
.startCountdown(AppConstants.code_time);
}
},
child:
Text(
countdownController.countdown.value ==
0
? '获取验证码'
: '${countdownController.countdown.value}',
style:
TextStyle(
fontFamily:
'Readex Pro',
color:
Color(0xFF333333),
fontSize:
AppFontsize.normal_text_size,
letterSpacing:
0,
),
),
);
}),
),
),
),
),
],
),
),
),
].divide(SizedBox(width: 13)),
),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
constraints: BoxConstraints(
minWidth:
158.rpx, // 设置最小宽度为 100
),
child: Align(
alignment:
AlignmentDirectional(
-1, 0),
child: Text(
'输入新密码',
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: Colors.white,
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Container(
width: MediaQuery.sizeOf(
context)
.width,
height: 40, // 设置高度为31
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(
8),
),
child: Obx(() {
return TextFormField(
onChanged: (value) {
controller.model.pd =
value;
},
obscureText: controller
.model
.pdshow!, // 根据 pdshow 控制是否隐藏密码
decoration:
InputDecoration(
hintText: "请输入新密码".tr,
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize:
AppFontsize
.normal_text_size,
letterSpacing:
0,
),
hintStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color: themeController
.currentColor
.sc4,
fontSize:
AppFontsize
.normal_text_size,
letterSpacing:
0,
),
enabledBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
errorBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: FlutterFlowTheme
.of(context)
.error,
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: FlutterFlowTheme
.of(context)
.error,
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
8,
8,
0,
0), // 调整底部填充
suffixIcon:
IconButton(
icon: Icon(
controller.model
.pdshow!
? Icons
.visibility_off
: Icons
.visibility,
color: Color(
0xFF333333),
size: 16,
),
onPressed: () {
controller.model
.pdshow =
!controller
.model
.pdshow!;
controller
.updateAll();
},
),
),
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: Color(
0xFF333333),
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
);
}),
),
),
].divide(SizedBox(width: 13)),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
constraints: BoxConstraints(
minWidth:
158.rpx, // 设置最小宽度为 100
),
child: Align(
alignment:
AlignmentDirectional(
-1, 0),
child: Text(
'确认新密码',
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: Colors.white,
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Container(
width: MediaQuery.sizeOf(
context)
.width,
height: 40, // 设置高度为31
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(
8),
),
child: Obx(() {
return TextFormField(
onChanged: (value) {
controller.model
.confirm = value;
},
obscureText: controller
.model
.cpdshow!, // 根据 cpdshow 控制是否隐藏密码
decoration:
InputDecoration(
hintText:
"请输入确认密码".tr,
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize:
AppFontsize
.normal_text_size,
letterSpacing:
0,
),
hintStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color: themeController
.currentColor
.sc4,
fontSize:
AppFontsize
.normal_text_size,
letterSpacing:
0,
),
enabledBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
errorBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: FlutterFlowTheme
.of(context)
.error,
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide:
BorderSide(
color: FlutterFlowTheme
.of(context)
.error,
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
8,
6,
0,
0), // 调整底部填充以适应新的高度
suffixIcon:
IconButton(
icon: Icon(
controller.model
.cpdshow!
? Icons
.visibility_off
: Icons
.visibility,
color: Color(
0xFF333333),
size: 16,
),
onPressed: () {
// 切换 cpdshow 状态
controller.model
.cpdshow =
!controller
.model
.cpdshow!;
controller
.updateAll();
},
),
),
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: Color(
0xFF333333),
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
);
}),
),
),
].divide(SizedBox(width: 13)),
),
].divide(SizedBox(height: 14)),
),
),
),
),
),
),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
15, 0, 15, AppConstants.page_button_bottom_padding),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.056,
child: CustomCard(
gradientDirection: GradientDirection.vertical,
borderRadius: 8,
onTap: () async {
String msg =
await controller.resetPassword(context);
if (msg.isEmpty) {
// 清空登录状态
RegisterController registerController =
Get.find();
registerController.model.register_agree = false;
LoginController loginController = Get.find();
UserInfoController userInfoController =
Get.find<UserInfoController>();
final box = GetStorage();
box.remove('user');
box.remove('token');
userInfoController.model.token = null;
userInfoController.model.user = null;
userInfoController.model.login = 0;
userInfoController.model.message = 0;
loginController.model.account = null;
loginController.model.password = null;
loginController.model.phone = null;
loginController.model.code = null;
GlobalController globalController =
Get.find<GlobalController>();
globalController.resetParmAll();
Get.offAllNamed("/loginPage");
}
},
colors: [
stringToColor("FCFCFC"),
stringToColor("CEECE3")
], // 单色背景
child: Center(
child: Text(
'确定'.tr,
style: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Readex Pro',
color: stringToColor("#003058"),
fontSize: AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
),
),
),
)
],
),
),
)),
);
});
}
}

View File

@@ -1,7 +1,9 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart'; import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'package:vbvs_app/pages/mh_page/HomeDeviceType.dart'; import 'package:vbvs_app/pages/mh_page/HomeDeviceType.dart';
import 'package:vbvs_app/pages/mh_page/LanguagePage.dart'; import 'package:vbvs_app/pages/mh_page/LanguagePage.dart';
@@ -24,6 +26,7 @@ import 'package:vbvs_app/pages/mh_page/sleep_habit.dart';
import 'package:vbvs_app/pages/mh_page/smys.dart'; import 'package:vbvs_app/pages/mh_page/smys.dart';
import 'package:vbvs_app/pages/mh_page/user/page/find_password_page.dart'; import 'package:vbvs_app/pages/mh_page/user/page/find_password_page.dart';
import 'package:vbvs_app/pages/mh_page/user/page/mht_login_page.dart'; import 'package:vbvs_app/pages/mh_page/user/page/mht_login_page.dart';
import 'package:vbvs_app/pages/mh_page/user/page/update_password_page.dart';
import '../pages/mh_page/bluetooth.dart'; import '../pages/mh_page/bluetooth.dart';
import '../pages/mh_page/edit_address_page.dart'; import '../pages/mh_page/edit_address_page.dart';
@@ -58,8 +61,9 @@ var mhroutes = {
BookSuccessPage(data: arguments["data"]), BookSuccessPage(data: arguments["data"]),
"/myExperiencePage": (context) => MyExperiencePage(), "/myExperiencePage": (context) => MyExperiencePage(),
"/registerPage": (context) => RegisterPage(), "/registerPage": (context) => RegisterPage(),
"/findPasswordPage": (context) => FindPasswordPage(), "/findPasswordPage": (context) => FindPasswordPage(),
"/loginPage": (context) => MHTLoginPage(), "/loginPage": (context) => MHTLoginPage(),
"/updatePasswordPage": (context) => UpdatePasswordPage(),
}; };
var mhonGenerateRoute = (RouteSettings settings) { var mhonGenerateRoute = (RouteSettings settings) {
final String? name = settings.name; // 获取路由名称,如 /news 或 /search final String? name = settings.name; // 获取路由名称,如 /news 或 /search
@@ -94,6 +98,24 @@ var mhonGenerateRoute = (RouteSettings settings) {
// ); // );
// } // }
// } // }
if (loginStatus != 1) {
if (settings.name != "/loginPage" &&
settings.name != "/otherLoginPage" &&
settings.name != "/mianPageBottomChange") {
TopSlideNotification.show(
navigatorKey.currentContext!,
text: "必须登录提示".tr,
textColor: themeController.currentColor.sc9,
);
return CupertinoPageRoute(
settings: RouteSettings(
name: "/loginPage",
arguments: settings.arguments,
),
builder: (context) => mhroutes["/loginPage"]!(context),
);
}
}
// 如果有路由参数,传递参数 // 如果有路由参数,传递参数
if (settings.arguments != null) { if (settings.arguments != null) {