This commit is contained in:
wyf
2025-08-04 18:19:53 +08:00
parent 4c4f324c56
commit 00215e99d2
13 changed files with 879 additions and 134 deletions

View File

@@ -1,9 +1,10 @@
class ServiceConstant {
static const String baseHost = "zhmht.swes.com.cn:27020"; //服务地址
// static const String baseHost = "vsbs-test.he-info.cn"; //服务地址
static const String baseHost = "zhmht.swes.com.cn:27021"; //服务地址 眠花糖测试地址
// static const String baseHost = "zhmht.swes.com.cn:27020"; //服务地址 眠花糖正式地址
// static const String baseHost = "vsbs-test.he-info.cn"; //服务地址 本地测试地址
// static const String baseHost = "vsbst-api.he-info.cn";//服务地址
// static const String service_address = "http://$baseHost";
static const String service_address = "https://$baseHost";
static const String service_address = "http://$baseHost";
// static const String service_address = "https://$baseHost";
static String server_service = "/vsbs_app_server"; //服务名称

View File

@@ -118,7 +118,11 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
return Future.error('位置服务未启用');
}
showPermissionInfoDialog(Get.context!, CommonVariables().permissionInfo);
try {
showPermissionInfoDialog(Get.context!, CommonVariables().permissionInfo);
} catch (e) {
ef.log("$e");
}
// permission = await Geolocator.checkPermission();
try {
// 2⃣ 检查权限(系统弹窗)—— 此时你的提示框仍然显示

View File

@@ -74,6 +74,7 @@ class AppLanguage extends Translations {
Get.clearTranslations(); // 清除之前加载的翻译,确保切换时不混乱
Get.addTranslations({languageCode: translations});
Get.updateLocale(Locale(languageCode)); // 切换语言
// Get.updateLocale(isChinese()? Locale('zh', 'CN') : Locale('en', 'US')); // 切换语言
_currentLanguageCode = languageCode; // 可选:记录当前语言码
} catch (e) {
@@ -107,8 +108,9 @@ class AppLanguage extends Translations {
}
Locale get currentLocale {
final parts = _currentLanguageCode.split('-');
return Locale(parts[0], parts.length > 1 ? parts[1] : null);
// final parts = _currentLanguageCode.split('-');
// return Locale(parts[0], parts.length > 1 ? parts[1] : null);
return isChinese()? Locale('zh', 'CN') : Locale('en', 'US');
}
bool isChinese() {

View File

@@ -75,6 +75,7 @@ import 'package:vbvs_app/pages/mh_page/MattressControl.dart';
import 'package:vbvs_app/pages/mh_page/device/component/mht_device_calibration_controller.dart';
import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart';
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/bind_tel_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/update_password_controller.dart';
@@ -244,7 +245,7 @@ void startMessagePolling(int ent_type) {
final result =
await showMessageConfirmDialog(title: '设备分享提醒'.tr);
if (result == 'confirm') {
Get.toNamed('/messageDetail', arguments:message);
Get.toNamed('/messageDetail', arguments: message);
}
}
}
@@ -484,6 +485,7 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => CalendarController()),
Get.lazyPut(() => UserPdfController()),
Get.lazyPut(() => PrivacyPdfController()),
Get.lazyPut(() => AuthBindTelController()),
]));
}

View File

@@ -494,132 +494,132 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
}
//获取智能床/床垫mac
// Future<String> getBindTHMAC(
// BuildContext context, BlueToothDataModel device, Map deviceType) async {
// const int maxRetries = 2;
// const Duration timeout = Duration(seconds: 5);
// String? macAddress;
// try {
// // 连接设备
// THapp bledevice = THapp(device: device.scanResult.device);
// await bledevice.connect();
// var res2 = bledevice.isConnected;
// if (!res2) {
// edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
// DailyLogUtils.printLog("蓝牙连接失败".tr);
// TopSlideNotification.show(
// context,
// text: "蓝牙连接失败".tr,
// textColor: themeController.currentColor.sc9,
// );
// throw Exception("蓝牙连接失败".tr);
// }
// blueteethBindController.blueConnectFlag.value = 2;
// blueteethBindController.currentDevice = bledevice;
// await Future.delayed(Duration(seconds: 2));
// if (deviceType['type'] == 3) {
// //智能床垫
// macAddress = await getMacFromType3(bledevice, timeout);
// } else if (deviceType['type'] == 2) {
// //智能床
// macAddress = await getMacFromType2(bledevice, timeout);
// } else {
// throw Exception("不支持的设备类型".tr);
// }
// if (macAddress == null) {
// throw Exception("未能获取到MAC地址".tr);
// }
// // device.macA = macAddress;
// print('MAC地址: $macAddress');
// return macAddress;
// } catch (e) {
// blueteethBindController.currentDeviceMac.value = "";
// edm.EasyDartModule.logger.error("蓝牙获取MAC失败$e");
// DailyLogUtils.printLog("蓝牙获取MAC失败$e");
// TopSlideNotification.show(
// context,
// // text: e.message ?? "设备连接失败,请重试".tr,
// text: "获取不到传感器mac,请重试".tr,
// textColor: themeController.currentColor.sc9,
// );
// rethrow;
// }
// }
Future<String> getBindTHMAC(
BuildContext context, BlueToothDataModel device, Map deviceType) async {
const int maxRetries = 2; // 重试2次
const int maxRetries = 2;
const Duration timeout = Duration(seconds: 5);
String? macAddress;
for (int attempt = 1; attempt <= maxRetries; attempt++) {
try {
// 连接设备
THapp bledevice = THapp(device: device.scanResult.device);
await bledevice.connect();
var res2 = bledevice.isConnected;
if (!res2) {
edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
DailyLogUtils.printLog("蓝牙连接失败".tr);
TopSlideNotification.show(
context,
text: "蓝牙连接失败".tr,
textColor: themeController.currentColor.sc9,
);
throw Exception("蓝牙连接失败".tr);
}
blueteethBindController.blueConnectFlag.value = 2;
blueteethBindController.currentDevice = bledevice;
await Future.delayed(Duration(seconds: 2));
// 根据设备类型获取 MAC
if (deviceType['type'] == 3) {
macAddress = await getMacFromType3(bledevice, timeout);
} else if (deviceType['type'] == 2) {
macAddress = await getMacFromType2(bledevice, timeout);
} else {
throw Exception("不支持的设备类型".tr);
}
if (macAddress != null) {
print('MAC地址: $macAddress');
return macAddress; // 成功获取直接返回
}
// 当前尝试失败,准备重试
DailyLogUtils.printLog("$attempt次尝试未获取到MAC地址");
if (attempt < maxRetries) {
await Future.delayed(Duration(seconds: 1)); // 等待后重试
}
} catch (e) {
DailyLogUtils.printLog("$attempt次蓝牙获取MAC失败: $e");
edm.EasyDartModule.logger.error("$attempt次蓝牙获取MAC失败: $e");
// 最后一次尝试失败后才提示
if (attempt == maxRetries) {
blueteethBindController.currentDeviceMac.value = "";
TopSlideNotification.show(
context,
text: "获取不到传感器mac,请重试".tr,
textColor: themeController.currentColor.sc9,
);
rethrow; // 抛出最后的异常
}
// 否则继续尝试
try {
// 连接设备
THapp bledevice = THapp(device: device.scanResult.device);
await bledevice.connect();
var res2 = bledevice.isConnected;
if (!res2) {
edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
DailyLogUtils.printLog("蓝牙连接失败".tr);
TopSlideNotification.show(
context,
text: "蓝牙连接失败".tr,
textColor: themeController.currentColor.sc9,
);
throw Exception("蓝牙连接失败".tr);
}
}
blueteethBindController.blueConnectFlag.value = 2;
blueteethBindController.currentDevice = bledevice;
await Future.delayed(Duration(seconds: 2));
// 正常不会到这里
throw Exception("未知错误");
if (deviceType['type'] == 3) {
//智能床垫
macAddress = await getMacFromType3(bledevice, timeout);
} else if (deviceType['type'] == 2) {
//智能床
macAddress = await getMacFromType2(bledevice, timeout);
} else {
throw Exception("不支持的设备类型".tr);
}
if (macAddress == null) {
throw Exception("未能获取到MAC地址".tr);
}
// device.macA = macAddress;
print('MAC地址: $macAddress');
return macAddress;
} catch (e) {
blueteethBindController.currentDeviceMac.value = "";
edm.EasyDartModule.logger.error("蓝牙获取MAC失败$e");
DailyLogUtils.printLog("蓝牙获取MAC失败$e");
TopSlideNotification.show(
context,
// text: e.message ?? "设备连接失败,请重试".tr,
text: "获取不到传感器mac,请重试".tr,
textColor: themeController.currentColor.sc9,
);
rethrow;
}
}
// Future<String> getBindTHMAC(
// BuildContext context, BlueToothDataModel device, Map deviceType) async {
// const int maxRetries = 2; // 重试2次
// const Duration timeout = Duration(seconds: 5);
// String? macAddress;
// for (int attempt = 1; attempt <= maxRetries; attempt++) {
// try {
// // 连接设备
// THapp bledevice = THapp(device: device.scanResult.device);
// await bledevice.connect();
// var res2 = bledevice.isConnected;
// if (!res2) {
// edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
// DailyLogUtils.printLog("蓝牙连接失败".tr);
// TopSlideNotification.show(
// context,
// text: "蓝牙连接失败".tr,
// textColor: themeController.currentColor.sc9,
// );
// throw Exception("蓝牙连接失败".tr);
// }
// blueteethBindController.blueConnectFlag.value = 2;
// blueteethBindController.currentDevice = bledevice;
// await Future.delayed(Duration(seconds: 2));
// // 根据设备类型获取 MAC
// if (deviceType['type'] == 3) {
// macAddress = await getMacFromType3(bledevice, timeout);
// } else if (deviceType['type'] == 2) {
// macAddress = await getMacFromType2(bledevice, timeout);
// } else {
// throw Exception("不支持的设备类型".tr);
// }
// if (macAddress != null) {
// print('MAC地址: $macAddress');
// return macAddress; // 成功获取直接返回
// }
// // 当前尝试失败,准备重试
// DailyLogUtils.printLog("第$attempt次尝试未获取到MAC地址");
// if (attempt < maxRetries) {
// await Future.delayed(Duration(seconds: 1)); // 等待后重试
// }
// } catch (e) {
// DailyLogUtils.printLog("第$attempt次蓝牙获取MAC失败: $e");
// edm.EasyDartModule.logger.error("第$attempt次蓝牙获取MAC失败: $e");
// // 最后一次尝试失败后才提示
// if (attempt == maxRetries) {
// blueteethBindController.currentDeviceMac.value = "";
// TopSlideNotification.show(
// context,
// text: "获取不到传感器mac,请重试".tr,
// textColor: themeController.currentColor.sc9,
// );
// rethrow; // 抛出最后的异常
// }
// // 否则继续尝试
// }
// }
// // 正常不会到这里
// throw Exception("未知错误");
// }
fillTHMac(
String mac, BlueToothDataModel bleDevice, BuildContext context) async {
bool flag = false;

View File

@@ -566,10 +566,9 @@ class _SettingPageState extends State<SettingPage> {
),
Text(
AppConstants().ent_type == 1
? 'Copyright © 202-2025 嘉兴太和信息技术有限责任公司 版权所有'
? 'Copyright © 2022-2025 嘉兴太和信息技术有限责任公司 版权所有'
.tr
: "Copyright © 202-2025 合肥眠花糖家具有限责任公司 版权所有"
.tr,
: "Copyright © 2022-2025 合肥眠花糖家具有限责任公司 版权所有".tr,
style: TextStyle(
color: themeController.currentColor.sc4,
fontFamily: 'Inter',

View File

@@ -0,0 +1,183 @@
import 'dart:convert';
import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:ef/ef.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:get_storage/get_storage.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.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/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
part 'bind_tel_controller.g.dart';
@JsonSerializable()
class AuthBindTelModel {
String? authUserInfo; //授权用户信息
String? phone; //电话
String? code; //验证码
AuthBindTelModel();
static AuthBindTelModel fromJson(Map<String, dynamic> json) =>
_$AuthBindTelModelFromJson(json);
Map<String, dynamic> toJson() => _$AuthBindTelModelToJson(this);
}
class AuthBindTelController extends GetControllerEx<AuthBindTelModel> {
AuthBindTelController() {
attr = GetModel(AuthBindTelModel()).obs;
}
bindTel() async {
String message = "";
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(Get.context!, text: message);
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(Get.context!, text: message);
return message;
}
if (model.code == null || model.code!.isEmpty) {
message = "请输入验证码".tr;
TopSlideNotification.show(Get.context!, text: message);
return message;
}
final Map<String, dynamic> requestBody = {
"tel": model.phone,
"wxInfo": model.authUserInfo,
"verifyCode": model.code,
};
// var response = await ApiService.request
// .post("/api/auth/account/info/wxLoginBindTel", data: requestBody);
// if (response.data != null) {
// try {
// ApiResponse<UserModel> apiResponse = ApiResponse.fromJson(response.data,
// (json) => UserModel.fromJson(json as Map<String, dynamic>));
// if (apiResponse.code == HttpStatusCodes.ok) {
// final UserInfoController userInfoController = Get.find();
// userInfoController.model.user = apiResponse.data;
// userInfoController.model.token = response.headers['token']!.first;
// String efPd = await getValueBySysConfigKey(CommonVariables.efKey);
// if (efPd != null && efPd.isNotEmpty) {
// await initDataEf(key: efPd);
// } else {
// print("efPD为空初始化失败");
// return '登录失败';
// }
// final box = GetStorage();
// box.write('user', userInfoController.model.user!.toJson()); // 存储用户信息
// box.write('token', userInfoController.model.token); // 存储 token
// final AuthResponse res = await ef.client.auth.signInWithPassword(
// phone: userInfoController.model.user!.tel,
// password: userInfoController.model.user!.exp1!,
// );
// userInfoController.model.superbase_session = res.session;
// userInfoController.model.superbase_user = res.user;
// userInfoController.updateAll();
// return '';
// }
// return apiResponse.msg ?? '登录失败';
// } catch (e) {
// print(e);
// return '登录失败';
// }
// }
}
getCode(BuildContext context) async {
String message = "";
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
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': 5,
};
data['code'] = "mht";
await requestWithLog(
logTitle: "获取验证码".tr,
method: MyHttpMethod.post,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {
TopSlideNotification.show(context, text: '发送验证码成功'.tr);
},
onFailure: (res) {
message = res.msg!;
TopSlideNotification.show(
context,
text: message.tr,
textColor: themeController.currentColor.sc9,
);
},
);
return message;
}
Future<ApiResponse> updateUserPhone() async {
EasyDartModule.logger.info("更新用户资料");
DailyLogUtils.writeLog("更新用户资料");
try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr);
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_info;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) {
queryUrl += "&lang=$language";
} else {
queryUrl += "?lang=$language";
}
}
final data = {
'phone': model.phone,
'verify': model.code,
};
var response =
await EasyDartModule.dio.put(queryUrl, data: jsonEncode(data));
if (apiResponse != null) {
var responseData =
response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res =
ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(res, "保存成功".tr, "保存失败".tr);
return res;
} else {
return ApiResponse(code: -1, msg: "服务器失败".tr);
}
} catch (e) {
EasyDartModule.logger.info("更新用户资料失败->$e");
DailyLogUtils.writeLog("更新用户资料失败->$e");
return ApiResponse(code: -1, msg: "服务器失败".tr);
}
}
}

View File

@@ -0,0 +1,20 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'bind_tel_controller.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
AuthBindTelModel _$AuthBindTelModelFromJson(Map<String, dynamic> json) =>
AuthBindTelModel()
..authUserInfo = json['authUserInfo'] as String?
..phone = json['phone'] as String?
..code = json['code'] as String?;
Map<String, dynamic> _$AuthBindTelModelToJson(AuthBindTelModel instance) =>
<String, dynamic>{
'authUserInfo': instance.authUserInfo,
'phone': instance.phone,
'code': instance.code,
};

View File

@@ -271,14 +271,30 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
queryUrl: queryUrl,
data: data);
if (apiResponse.code == HttpStatusCodes.ok) {
// UserInfoController userInfoController = Get.find();
// if (userInfoController.model.user!.phone == null ||
// userInfoController.model.user!.phone!.isEmpty) {
// Get.toNamed("/auth_bind_tel");
// return;
// }
UserInfoController userInfoController = Get.find();
userInfoController.model.login = 1;
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
userInfoController.model.login = 1;
String token = apiResponse.rawResponse.headers['token']!.first;
EasyDartModule.dio.token = token;
final box = GetStorage();
box.write('token', token); // 存储 token
box.write('user', userInfoController.model.user!.toJson()); // 存储用户信息
if (userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) {
await Get.toNamed("/auth_bind_tel");
}
if (userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) {
userInfoController.model.login = 0;
}
} else {
EasyDartModule.logger.error("[微信登录]:失败-》${apiResponse}");
}
return apiResponse.code!;
}

View File

@@ -0,0 +1,515 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/appFontsize.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/CheckNetwork.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/TopSlideNotification.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/pages/mh_page/user/controller/bind_tel_controller.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart';
class BindTelWidget extends GetView<AuthBindTelController> {
BoxConstraints? bodysize;
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, cc) {
bodysize = cc;
return Container(
// onTap: () => FocusScope.of(context).unfocus(),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'),
fit: BoxFit.fill,
),
),
child: Scaffold(
resizeToAvoidBottomInset: false,
key: scaffoldKey,
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
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.rpx,
child: returnIconButtomNew(),
),
],
),
),
actions: [],
centerTitle: false,
),
body: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(49.rpx, 0, 49.rpx, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.886,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 92, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.05,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'绑定手机号码'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: stringToColor("#84F5FF"),
fontSize: 24,
letterSpacing: 0.0,
),
),
),
),
),
Flexible(
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'为了您的账号安全,验证手机号码后,可直接使用此手机号登录。'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: Colors.white,
letterSpacing: 0.0,
),
),
// Text(
// '',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// letterSpacing: 0.0,
// ),
// ),
],
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 16, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius: BorderRadius.circular(12),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: TextFormField(
onChanged: (value) {
controller.model.phone = value;
},
obscureText: false,
decoration: InputDecoration(
labelStyle: TextStyle(
fontFamily: 'Readex Pro',
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0.0,
),
hintText: '请输入手机号'.tr,
hintStyle: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFD2D2D2),
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0.0,
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
contentPadding:
EdgeInsetsDirectional.fromSTEB(
10, 0, 0, 5),
),
style: TextStyle(
fontFamily: 'Readex Pro',
fontSize: 13,
letterSpacing: 0.0,
),
),
),
),
),
),
Obx(() {
controller.model.code;
return Visibility(
visible: true,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 17, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(),
child: Stack(
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Container(
width: MediaQuery.sizeOf(context)
.width,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(12),
),
child: Align(
alignment:
AlignmentDirectional(0, 0),
child: TextFormField(
// focusNode: _focusNode4,
onChanged: (value) {
controller.model.code = value;
},
obscureText: false,
decoration: InputDecoration(
labelStyle: TextStyle(
fontFamily: 'Readex Pro',
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
hintText: '请输入验证码',
hintStyle: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFD2D2D2),
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
10, 0, 0, 5),
),
style: TextStyle(
fontFamily: 'Readex Pro',
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
),
),
),
Align(
alignment:
AlignmentDirectional(0.2, 0.1),
child: Container(
width: 3,
height: 30,
decoration: BoxDecoration(
color: Color(0xFFD3D3D3),
),
),
),
Align(
alignment:
AlignmentDirectional(0.9, 0),
child: Container(
width: MediaQuery.sizeOf(context)
.width *
0.157,
height: MediaQuery.sizeOf(context)
.height *
0.014,
constraints: BoxConstraints(
minWidth: 118,
minHeight: 30,
),
decoration: BoxDecoration(),
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;
}
countdownController
.countdown
.value ==
0
? countdownController
.startCountdown(
AppConstants
.code_time)
: null;
},
child: Text(
countdownController
.countdown
.value ==
0
? '获取验证码'
: '${countdownController.countdown.value}',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize: AppFontsize
.normal_text_size,
letterSpacing: 0,
),
),
);
}),
),
),
),
],
),
),
),
);
}),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 19, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.022,
constraints: BoxConstraints(
minWidth: 466,
minHeight: 30,
),
decoration: BoxDecoration(),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 29, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.056,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.056,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
),
// child: FFButtonWidget(
// onPressed: () async {
// //todo 提交绑定请求
// String msg = await controller.bindTel();
// if (msg == null || msg.isEmpty) {
// MHTLoginController loginController =
// Get.find();
// //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
// loginController.fluwxCancelable
// ?.cancel();
// // 登录成功移出网络检查监听
// Checknetwork.subscription?.cancel();
// final box = GetStorage();
// box.remove('countdown');
// CountdownController
// countdownController = Get.find();
// countdownController.countdown = 0.obs;
// Get.offAndToNamed(
// "/mianPageBottomChange");
// } else {
// showToast(msg);
// }
// },
// text: '确定',
// options: FFButtonOptions(
// height: 40,
// padding: EdgeInsetsDirectional.fromSTEB(
// 24, 0, 24, 0),
// iconPadding:
// EdgeInsetsDirectional.fromSTEB(
// 0, 0, 0, 0),
// color: stringToColor("#84F5FF"),
// textStyle: TextStyle(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 13,
// letterSpacing: 0.0,
// ),
// elevation: 3,
// borderSide: BorderSide(
// color: Colors.transparent,
// width: 1,
// ),
// borderRadius:
// BorderRadius.circular(20.rpx),
// ),
// ),
child: CustomCard(
borderRadius: 16.rpx,
gradientDirection:
GradientDirection.vertical,
onTap: () async {
// String msg = await controller.bindTel();
// if (msg == null || msg.isEmpty) {
// MHTLoginController loginController =
// Get.find();
// //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
// loginController.fluwxCancelable
// ?.cancel();
// // 登录成功移出网络检查监听
// Checknetwork.subscription?.cancel();
// final box = GetStorage();
// box.remove('countdown');
// CountdownController
// countdownController = Get.find();
// countdownController.countdown = 0.obs;
// Get.offAndToNamed(
// "/mianPageBottomChange");
// } else {
// showToast(msg);
// }
ApiResponse apiResponse =
await controller.updateUserPhone();
if (apiResponse.code ==
HttpStatusCodes.ok) {
UserInfoController userInfoController =
Get.find();
await userInfoController.getUserInfo();
MHTLoginController loginController =
Get.find();
//TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
loginController.fluwxCancelable
?.cancel();
// 登录成功移出网络检查监听
Checknetwork.subscription?.cancel();
final box = GetStorage();
box.remove('countdown');
CountdownController
countdownController = Get.find();
countdownController.countdown = 0.obs;
Get.offAndToNamed(
"/mianPageBottomChange");
} else {
TopSlideNotification.show(context,
textColor: themeController
.currentColor.sc9,
text: apiResponse.msg ?? '失败'.tr);
}
},
colors: const [
Color(0xFFFCFCFC),
Color(0xFFF8FAF9),
Color(0XFFECF6F3),
Color(0XFFD9F0E9),
Color(0xFFCEECE3)
],
child: Container(
width: double.infinity,
height: 90.rpx,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(16.rpx),
),
child: Text(
"提交".tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0XFF003058),
letterSpacing: 0,
fontSize: 26.rpx,
),
),
),
),
),
),
),
],
),
),
),
),
),
],
),
),
),
);
});
}
}

View File

@@ -34,6 +34,7 @@ import 'package:vbvs_app/pages/mh_page/help/article.dart';
import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page_return.dart';
import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart';
import 'package:vbvs_app/pages/mh_page/privacy_policy.dart';
import 'package:vbvs_app/pages/mh_page/user/page/bind_tel_page.dart';
import 'package:vbvs_app/pages/mh_page/user/page/edit_userinfo_page.dart';
import 'package:vbvs_app/pages/mh_page/experience_store_page.dart';
import 'package:vbvs_app/pages/mh_page/issue_list_page.dart';
@@ -128,6 +129,7 @@ var mhroutes = {
"/mhtWifiAfterPage": (contxt, {arguments}) =>
MHTWifiAfterPage(deviceInfo: arguments),
"/deleteAccount": (context, {arguments}) => DeletedAccountPage(),
"/auth_bind_tel": (context) => BindTelWidget(),
};
var mhonGenerateRoute = (RouteSettings settings) {
final String? name = settings.name; // 获取路由名称,如 /news 或 /search
@@ -146,7 +148,8 @@ var mhonGenerateRoute = (RouteSettings settings) {
settings.name != "/registerPage" &&
settings.name != "/findPasswordPage" &&
settings.name != "/userAgreementPage" &&
settings.name != "/privacyPolicyPage") {
settings.name != "/privacyPolicyPage" &&
settings.name != "/auth_bind_tel") {
// TopSlideNotification.show(
// navigatorKey.currentContext!,
// text: "必须登录提示".tr,