更新消息设置

This commit is contained in:
wyf
2025-12-05 17:37:01 +08:00
parent 1cc26aa46d
commit db51c42664
44 changed files with 7510 additions and 1059 deletions

View File

@@ -1,6 +1,5 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/WebViewWidget.dart';

View File

@@ -0,0 +1,657 @@
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.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/component/tool/NewTopSlideNotification.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.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/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
class UpdateUserEmailPage extends StatefulWidget {
const UpdateUserEmailPage({super.key});
@override
State<UpdateUserEmailPage> createState() => _UpdateUserEmailPageState();
}
class _UpdateUserEmailPageState extends State<UpdateUserEmailPage> {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find();
ThemeController themeController = Get.find();
LoginController loginController = Get.find();
@override
void initState() {
super.initState();
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
userInfoController.model.user!.tmpHead =
userInfoController.model.user!.avatar;
userInfoController.model.user!.tmpNickName =
userInfoController.model.user!.nick_name;
loginController.model.updatePhone = null;
}
@override
Widget build(BuildContext context) {
int login = userInfoController.model.login!;
return LayoutBuilder(
builder: (context, bodySize) => GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/bgNoImg.png'),
fit: BoxFit.fill,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
Text(
'更换邮箱'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
Positioned(
left: 0,
child: returnIconButtom,
),
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
if (loginController.model.updatePhone == null ||
loginController.model.updatePhone == '') {
NewTopSlideNotification.show(
text: "请输入邮箱号",
textColor: themeController.currentColor.sc9,
);
return;
}
ApiResponse apiResponse =
await userInfoController.updateData(
email: loginController.model.updatePhone);
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
if (apiResponse.code == HttpStatusCodes.ok) {
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
loginController.model.updatePhone = null;
await userInfoController.getUserInfo();
userInfoController.model.user!.tmpNickName = userInfoController.model.user!.nick_name;
userInfoController.model.user!.tmpHead = userInfoController.model.user!.avatar;
userInfoController.updateAll();
Get.back();
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0.rpx, 16.rpx, 0.rpx),
child: Text(
'修改资料页.保存'.tr,
style: TextStyle(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
),
),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 20.rpx, 0, 0),
child: Container(
alignment: Alignment.centerLeft,
width: double.infinity,
height: bodySize.maxHeight * 0.056,
constraints: BoxConstraints(
minHeight: 120.rpx,
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
60.rpx, 0, 35.rpx, 0),
child: Text(
"原邮箱号" + ":" + "${getHideEmail()}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
),
),
),
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
color: themeController.currentColor.sc17,
),
child: Column(
children: [
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0, 20.rpx),
child: Container(
width: double.infinity,
height: bodySize.maxHeight * 0.056,
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(
0,
),
),
constraints: BoxConstraints(
minHeight: 90.rpx,
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
35.rpx, 0, 35.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 26.rpx, 0, 0, 0),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// InkWell(
// onTap: () async {},
// child: Container(
// alignment: Alignment.center,
// // constraints: BoxConstraints(
// // minWidth: 150.rpx,
// // ),
// child: Text(
// "+86",
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: themeController
// .currentColor.sc4,
// fontSize: AppConstants()
// .middler_text_fontSize,
// letterSpacing: 0,
// ),
// ),
// ),
// ),
// SizedBox(
// height: 30.rpx,
// child: VerticalDivider(
// thickness: 2.rpx,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// ].divide(SizedBox(width: 10.rpx)),
// ),
// ),
Expanded(
child: Container(
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
loginController.model
.updatePhone = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '输入邮箱号码'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: false,
fillColor: Colors.white,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
cursorColor: themeController
.currentColor.sc3,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
],
),
),
),
),
),
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 0.rpx, 0, 0),
child: Container(
height: bodySize.maxHeight * 0.056,
width: double.infinity,
constraints: BoxConstraints(
minHeight: 90.rpx,
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
35.rpx, 0, 35.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
loginController
.model.updateCode = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '其他手机登录页.输入验证码'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: true,
fillColor: Colors.transparent,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
cursorColor: themeController
.currentColor.sc3,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(
26.rpx, 0, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 30.rpx,
child: VerticalDivider(
thickness: 2.rpx,
color: themeController
.currentColor.sc7,
),
),
Obx(() {
final CountdownController
countdownController =
Get.find<
CountdownController>();
return InkWell(
onTap: () async {
try {
DailyLogUtils.writeLog(
"点击获取验证码");
if (countdownController
.countdown
.value !=
0) {
return;
}
ApiResponse apiResponse =
await loginController
.getUpdateTelCode(
context);
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification
.show(
context,
text:
apiResponse.msg!,
textColor:
themeController
.currentColor
.sc9,
);
await DailyLogUtils
.writeLog(
"获取验证码成功,${apiResponse}");
return;
} else {
TopSlideNotification
.show(
context,
text:
apiResponse.msg!,
textColor:
themeController
.currentColor
.sc2,
);
await DailyLogUtils
.writeLog(
"获取验证码失败,${apiResponse}");
}
countdownController
.countdown
.value ==
0
? countdownController
.startCountdown(
AppConstants
.code_time)
: null;
} catch (e) {
await DailyLogUtils
.writeLog(
"获取验证码异常,${e}");
edm.EasyDartModule.logger
.info("获取验证码异常:${e}");
}
},
child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(
minWidth: 150.rpx,
),
child: Text(
countdownController
.countdown
.value ==
0
? '其他手机登录页.获取验证码'.tr
: '${countdownController.countdown.value}' +
"其他手机登录页.秒".tr,
style: TextStyle(
fontFamily:
'Readex Pro',
color: themeController
.currentColor.sc2,
fontSize: AppConstants()
.middler_text_fontSize,
letterSpacing: 0,
),
),
),
);
}),
].divide(SizedBox(width: 26.rpx)),
),
),
],
),
),
),
),
),
],
),
),
],
),
),
),
),
),
),
),
);
}
Widget getImageWidget(BuildContext context) {
try {
UserInfoController controller = Get.find();
var head = controller.model.user!.tmpHead;
return Container(
width: 200.rpx,
height: 200.rpx,
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: head == null || head.isEmpty
? Image.asset(
'assets/img/avatar.png',
fit: BoxFit.cover,
)
: Image.network(
head,
fit: BoxFit.cover,
),
),
);
} catch (e) {
print(e);
}
return Container();
}
String getTextByUserInfo(String type) {
UserInfoController userInfoController = Get.find();
UserModel userInfo = userInfoController.model.user!;
if (userInfo == null) {
return "";
}
if (type == "phone") {
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
return "更换".tr;
} else {
return "换绑".tr;
}
}
if (type == "email") {
if (userInfo.email == null || userInfo.email!.isEmpty) {
return "绑定".tr;
} else {
return "换绑".tr;
}
}
if (type == "wechat") {
if (userInfo.bindWx == null || userInfo.bindWx == false) {
return "绑定".tr;
} else {
return "解绑".tr;
}
}
return "";
}
getHideEmail() {
UserModel userModel = userInfoController.model.user!;
if (userModel.email == null || userModel.email == "") {
return "暂无".tr;
}
return userModel.email!
.replaceRange(3, userModel.email!.length - 3, "****");
}
}

View File

@@ -3,9 +3,12 @@ import 'dart:io';
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:fluwx/fluwx.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
@@ -13,11 +16,14 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.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/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
import 'package:vbvs_app/pages/user/wx_unbind_dialog.dart';
class UpdateUserPage extends StatefulWidget {
const UpdateUserPage({super.key});
@@ -42,6 +48,53 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
userInfoController.model.user!.avatar;
userInfoController.model.user!.tmpNickName =
userInfoController.model.user!.nick_name;
Fluwx fluwx = userInfoController.fluwx;
userInfoController.fluwxCancelable = fluwx.addSubscriber((response) async {
if (response is WeChatAuthResponse) {
debugPrint('state :${response.state} \n code:${response.code}');
int errCode = response.errCode ?? -9999;
if (errCode == 0) {
// TODO 微信登录成功 传递code给后台 再操作逻辑
String code = response.code ?? "";
//把微信登录返回的code传给后台剩下的事就交给后台处理
//首次未注册的用户引导去手机号填写页面
//已注册的用户直接跳转首页
if (CommonVariables.isNetWorkOn == false) {
TopSlideNotification.show(context,
text: "网络未连接,请开启设备网络后重试".tr,
textColor: themeController.currentColor.sc9);
// showToast("网络未连接,请开启设备网络后重试");
return;
}
ApiResponse apiResponse =
await userInfoController.updateData(code: code);
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
// fluwxCancelable?.cancel();
} else if (errCode == -4) {
TopSlideNotification.show(context,
text: "用户拒绝授权".tr, textColor: themeController.currentColor.sc9);
// showToast("用户拒绝授权");
} else if (errCode == -2) {
TopSlideNotification.show(context,
text: "用户取消授权".tr, textColor: themeController.currentColor.sc9);
// showToast("用户取消授权");
}
}
});
}
@override
void dispose() {
userInfoController.fluwxCancelable?.cancel();
super.dispose();
}
@override
@@ -103,6 +156,10 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
await userInfoController.getUserInfo();
userInfoController.model.user!.tmpNickName =
userInfoController.model.user!.nick_name;
userInfoController.model.user!.tmpHead =
userInfoController.model.user!.avatar;
userInfoController.updateAll();
Get.back();
}
@@ -142,13 +199,13 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
60.rpx, 0.rpx, 60.rpx, 0.rpx),
0.rpx, 0.rpx, 0.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 76.rpx, 0.rpx, 0.rpx),
60.rpx, 76.rpx, 60.rpx, 0.rpx),
child: Container(
width: MediaQuery.sizeOf(context).width * 0.213,
height: MediaQuery.sizeOf(context).height * 0.098,
@@ -158,6 +215,9 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
),
decoration: BoxDecoration(),
child: Obx(() {
var aa =
userInfoController.model.user!.tmpNickName;
print(aa);
return getImageWidget(context);
})),
),
@@ -165,7 +225,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc16,
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 44.rpx, 0.rpx, 44.rpx),
60.rpx, 44.rpx, 60.rpx, 44.rpx),
borderRadius: 0,
onTap: () async {
edm.EasyDartModule.logger
@@ -196,7 +256,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 79.rpx, 0.rpx, 0.rpx),
60.rpx, 79.rpx, 60.rpx, 0.rpx),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
@@ -310,6 +370,258 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
),
),
),
SizedBox(
height: 100.rpx,
),
Padding(
padding: EdgeInsets.fromLTRB(40.rpx, 0, 40.rpx, 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
color: themeController.currentColor.sc17,
),
child: Column(
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
20.rpx, 20.rpx, 20.rpx, 0.rpx),
child: ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
onTap: () async {
Get.toNamed('/updateUserTelPage');
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
20.rpx, 30.rpx, 20.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
'手机号码'.tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 22.rpx)),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
getTextByUserInfo('phone'),
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),
color: themeController
.currentColor.sc2,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
SvgPicture.asset(
'assets/img/icon/arrow_right.svg',
width: 8.rpx,
height: 15
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: themeController
.currentColor.sc3,
),
].divide(SizedBox(width: 28.rpx)),
),
],
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 0.rpx),
child: ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
onTap: () async {
Get.toNamed('/updateUserEmailPage');
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
'邮箱'.tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 22.rpx)),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
getTextByUserInfo('email'),
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),
color: themeController
.currentColor.sc2,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
SvgPicture.asset(
'assets/img/icon/arrow_right.svg',
width: 8.rpx,
height: 15
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: themeController
.currentColor.sc3,
),
].divide(SizedBox(width: 28.rpx)),
),
],
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
40.rpx, 20.rpx, 40.rpx, 20.rpx),
child: ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor: themeController
.currentColor.sc21, // 点击时的背景色
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
onTap: () async {
if (userInfoController.model.user!.bindWx ==
null ||
userInfoController.model.user!.bindWx ==
false) {
//微信绑定
LoginController loginController =
Get.find();
await loginController.wxLoginSendAuth(
context,
login: false);
} else {
//取消微信绑定
// LoginController loginController =
// Get.find();
// await loginController.wxLoginSendAuth(
// context,
// login: false);
// TopSlideNotification.show(context,
// text: "暂不支持微信解绑授权".tr,
// textColor:
// themeController.currentColor.sc9);
// return;
showUnbindWxConfirmDialog(context);
}
},
child: Container(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 30.rpx, 0.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
'微信'.tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.title_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 22.rpx)),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Obx(() {
var aa = userInfoController
.model.user!.tmpNickName;
print(aa);
return Text(
getTextByUserInfo('wechat'),
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),
color: getTextByUserInfo(
'wechat') ==
"解绑".tr
? themeController
.currentColor.sc4
: themeController
.currentColor.sc2,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
);
}),
SvgPicture.asset(
'assets/img/icon/arrow_right.svg',
width: 8.rpx,
height: 15
.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
color: themeController
.currentColor.sc3,
),
].divide(SizedBox(width: 28.rpx)),
),
],
),
),
),
),
),
],
),
),
),
],
),
),
@@ -334,9 +646,8 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
shape: BoxShape.circle,
),
child: head == null || head.isEmpty
? Image.asset(
'assets/img/avatar.png',
fit: BoxFit.cover,
? SvgPicture.asset(
"assets/img/avatar.svg",
)
: Image.network(
head,
@@ -349,4 +660,34 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
}
return Container();
}
String getTextByUserInfo(String type) {
UserInfoController userInfoController = Get.find();
UserModel userInfo = userInfoController.model.user!;
if (userInfo == null) {
return "";
}
if (type == "phone") {
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
return "更换".tr;
} else {
return "换绑".tr;
}
}
if (type == "email") {
if (userInfo.email == null || userInfo.email!.isEmpty) {
return "绑定".tr;
} else {
return "换绑".tr;
}
}
if (type == "wechat") {
if (userInfo.bindWx == null || userInfo.bindWx == false) {
return "绑定".tr;
} else {
return "解绑".tr;
}
}
return "";
}
}

View File

@@ -0,0 +1,659 @@
import 'dart:io';
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/NewTopSlideNotification.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.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/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
class UpdateUserTelPage extends StatefulWidget {
const UpdateUserTelPage({super.key});
@override
State<UpdateUserTelPage> createState() => _UpdateUserTelPageState();
}
class _UpdateUserTelPageState extends State<UpdateUserTelPage> {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find();
ThemeController themeController = Get.find();
LoginController loginController = Get.find();
@override
void initState() {
super.initState();
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
userInfoController.model.user!.tmpHead =
userInfoController.model.user!.avatar;
userInfoController.model.user!.tmpNickName =
userInfoController.model.user!.nick_name;
loginController.model.updatePhone = null;
}
@override
Widget build(BuildContext context) {
int login = userInfoController.model.login!;
return LayoutBuilder(
builder: (context, bodySize) => GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/bgNoImg.png'),
fit: BoxFit.fill,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
Text(
'更换手机号码'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
Positioned(
left: 0,
child: returnIconButtom,
),
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
if (loginController.model.updatePhone == null ||
loginController.model.updatePhone == '') {
NewTopSlideNotification.show(
text: "请输入手机号",
textColor: themeController.currentColor.sc9,
);
return;
}
ApiResponse apiResponse =
await userInfoController.updateData(
phone: loginController.model.updatePhone);
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
if (apiResponse.code == HttpStatusCodes.ok) {
userInfoController.model.user!.tmpHead = null;
userInfoController.model.user!.tmpNickName = null;
loginController.model.updatePhone = null;
await userInfoController.getUserInfo();
userInfoController.model.user!.tmpNickName =
userInfoController.model.user!.nick_name;
userInfoController.model.user!.tmpHead =
userInfoController.model.user!.avatar;
userInfoController.updateAll();
Get.back();
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 100.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0.rpx, 16.rpx, 0.rpx),
child: Text(
'修改资料页.保存'.tr,
style: TextStyle(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
),
),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
child: Container(
alignment: Alignment.centerLeft,
width: double.infinity,
height: bodySize.maxHeight * 0.056,
constraints: BoxConstraints(
minHeight: 120.rpx,
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
60.rpx, 0, 35.rpx, 0),
child: Text(
"原手机号码" + ":" + "${getHidePhone()}",
style: TextStyle(
color: themeController.currentColor.sc3,
fontSize: AppConstants().normal_text_fontSize,
),
),
),
),
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
AppConstants().normal_container_radius),
color: themeController.currentColor.sc17,
),
child: Column(
children: [
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 20.rpx, 0, 0),
child: Container(
width: double.infinity,
height: bodySize.maxHeight * 0.056,
decoration: BoxDecoration(
color: Colors.transparent,
),
constraints: BoxConstraints(
minHeight: 90.rpx,
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
35.rpx, 0, 35.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(
26.rpx, 0, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
InkWell(
onTap: () async {},
child: Container(
alignment: Alignment.center,
// constraints: BoxConstraints(
// minWidth: 150.rpx,
// ),
child: Text(
"+86",
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.middler_text_fontSize,
letterSpacing: 0,
),
),
),
),
SizedBox(
height: 30.rpx,
child: VerticalDivider(
thickness: 2.rpx,
color: themeController
.currentColor.sc4,
),
),
].divide(SizedBox(width: 10.rpx)),
),
),
Expanded(
child: Container(
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
loginController.model
.updatePhone = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '输入手机号码'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: false,
fillColor: Colors.white,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
cursorColor: themeController
.currentColor.sc3,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
],
),
),
),
),
),
Align(
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 26.rpx, 0, 20.rpx),
child: Container(
height: bodySize.maxHeight * 0.056,
width: double.infinity,
constraints: BoxConstraints(
minHeight: 90.rpx,
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
35.rpx, 0, 35.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
loginController
.model.updateCode = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintText: '其他手机登录页.输入验证码'.tr,
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
filled: true,
fillColor: Colors.transparent,
),
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
cursorColor: themeController
.currentColor.sc3,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(
26.rpx, 0, 0, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 30.rpx,
child: VerticalDivider(
thickness: 2.rpx,
color: themeController
.currentColor.sc7,
),
),
Obx(() {
final CountdownController
countdownController =
Get.find<
CountdownController>();
return InkWell(
onTap: () async {
try {
DailyLogUtils.writeLog(
"点击获取验证码");
if (countdownController
.countdown
.value !=
0) {
return;
}
ApiResponse apiResponse =
await loginController
.getUpdateTelCode(
context);
if (apiResponse.code !=
HttpStatusCodes.ok) {
TopSlideNotification
.show(
context,
text:
apiResponse.msg!,
textColor:
themeController
.currentColor
.sc9,
);
await DailyLogUtils
.writeLog(
"获取验证码成功,${apiResponse}");
return;
} else {
TopSlideNotification
.show(
context,
text:
apiResponse.msg!,
textColor:
themeController
.currentColor
.sc2,
);
await DailyLogUtils
.writeLog(
"获取验证码失败,${apiResponse}");
}
countdownController
.countdown
.value ==
0
? countdownController
.startCountdown(
AppConstants
.code_time)
: null;
} catch (e) {
await DailyLogUtils
.writeLog(
"获取验证码异常,${e}");
edm.EasyDartModule.logger
.info("获取验证码异常:${e}");
}
},
child: Container(
alignment: Alignment.center,
constraints: BoxConstraints(
minWidth: 150.rpx,
),
child: Text(
countdownController
.countdown
.value ==
0
? '其他手机登录页.获取验证码'.tr
: '${countdownController.countdown.value}' +
"其他手机登录页.秒".tr,
style: TextStyle(
fontFamily:
'Readex Pro',
color: themeController
.currentColor.sc2,
fontSize: AppConstants()
.middler_text_fontSize,
letterSpacing: 0,
),
),
),
);
}),
].divide(SizedBox(width: 26.rpx)),
),
),
],
),
),
),
),
),
],
),
),
],
),
),
),
),
),
),
),
);
}
Widget getImageWidget(BuildContext context) {
try {
UserInfoController controller = Get.find();
var head = controller.model.user!.tmpHead;
return Container(
width: 200.rpx,
height: 200.rpx,
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: head == null || head.isEmpty
? Image.asset(
'assets/img/avatar.png',
fit: BoxFit.cover,
)
: Image.network(
head,
fit: BoxFit.cover,
),
),
);
} catch (e) {
print(e);
}
return Container();
}
String getTextByUserInfo(String type) {
UserInfoController userInfoController = Get.find();
UserModel userInfo = userInfoController.model.user!;
if (userInfo == null) {
return "";
}
if (type == "phone") {
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
return "更换".tr;
} else {
return "换绑".tr;
}
}
if (type == "email") {
if (userInfo.email == null || userInfo.email!.isEmpty) {
return "绑定".tr;
} else {
return "换绑".tr;
}
}
if (type == "wechat") {
if (userInfo.bindWx == null || userInfo.bindWx == false) {
return "绑定".tr;
} else {
return "解绑".tr;
}
}
return "";
}
getHidePhone() {
UserModel userModel = userInfoController.model.user!;
if (userModel.phone == null || userModel.phone == "") {
return "暂无".tr;
}
return "${userModel.phone!.substring(0, 3)}****${userModel.phone!.substring(7, 11)}";
}
}

View File

@@ -0,0 +1,29 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
void showUnbindWxConfirmDialog(BuildContext context) {
showConfirmDialog(
context,
Container(),
"是否确认解绑".tr,
onConfirm: () async {
UserInfoController userInfoController = Get.find();
ApiResponse apiResponse =
await userInfoController.updateData(code: "unBind");
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: apiResponse.code == HttpStatusCodes.ok
? themeController.currentColor.sc2
: themeController.currentColor.sc9,
);
},
onCancel: () {},
);
}