更新消息设置

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

@@ -376,8 +376,8 @@
"入睡时间": "Sleep time",
"睡眠时长": "Sleep duration",
"起床时间": "Wake time",
"小时": "h",
"分钟": "m",
"小时": "hours",
"分钟": "minutes",
"消息提醒设置": "Message notification settings",
"APP消息": "APP messages",
"APP消息介绍": "Open APP to view device messages",
@@ -433,7 +433,7 @@
"年龄": "Age",
"设备ID": "Device",
"体重": "Weight",
"分": "",
"分": "m",
"位置权限说明": "Location Permission Description",
"获得位置信息,连接附近的蓝牙设备与推荐附近门店": "Obtain location information, connect to nearby Bluetooth devices, and recommend nearby stores",
"蓝牙权限说明": "Bluetooth Permission Description",
@@ -569,5 +569,43 @@
"选择城市": "Select City",
"请选择城市": "Please select a city",
"输入关键词": "Enter keywords",
"输入国家、省份或城市": "Enter country, province, or city"
"输入国家、省份或城市": "Enter country, province, or city",
"手机号码": "Phone number",
"邮箱": "email",
"微信": "WeChat",
"更换": "Change",
"换绑": "Rebind",
"绑定": "Bind",
"更换手机号码": "Change Phone Number",
"输入手机号码": "Enter Phone Number",
"请输验证码": "Please Enter Verification Code",
"请输入手机号": "Please Enter Phone Number",
"原手机号码": "Original Phone Number",
"更换邮箱": "Change Email",
"实时体征消息": "Real-time Vital Signs Messages",
"睡眠报告消息": "Sleep Report Messages",
"已开启": "Enabled",
"短信消息": "SMS Messages",
"短信消息介绍": "Customize this service to receive message alerts via SMS",
"电话语音提醒": "Voice Call Reminders",
"电话语音提醒介绍": "Customize this service to receive message alerts via phone calls",
"报警条件设置": "Alert Condition Settings",
"恢复默认": "Reset",
"心率小于": "Less Than",
"心率大于": "Greater Than",
"提醒类型": "type",
"全部通知": "All Notifications",
"离床时间大于": " Greater Than",
"未卧床时间大于": "Greater Than",
"未起床时间大于": "Greater Than",
"睡眠报告评分小于": "Less Than",
"呼吸小于": "Less Than",
"呼吸大于": "Greater Than",
"请先在设置里的消息通知打开APP消息配置": "Please enable APP message configuration in the Settings > Notifications first",
"间隔报警": "Interval Alert",
"分钟/次": "m/times",
"选择分数": "Select Score",
"离床时长": "Bed Exit Duration",
"已关闭": "Disabled",
"时": " h"
}

View File

@@ -377,7 +377,7 @@
"起床时间": "起床时间",
"小时": "小时",
"分钟": "分钟",
"消息提醒设置": "消息提醒设置",
"消息提醒设置": "消息设置",
"APP消息": "APP消息",
"APP消息介绍": "打开APP可以查看该设备的消息内容",
"通用APP消息介绍": "打开APP可以查看消息内容",
@@ -423,8 +423,8 @@
"退出": "退出",
"完成": "完成",
"时长": "时长:",
"继续": "继续",
"下次再说": "下次再说",
"继续": "继续流程",
"下次再说": "跳过",
"发现": "发现!",
"检测到": "检测到",
"绑定流程未走完是否继续": "绑定流程未走完是否继续?",
@@ -569,6 +569,43 @@
"选择城市": "选择城市",
"请选择城市": "请选择城市",
"输入关键词": "输入关键词",
"输入国家、省份或城市": "输入国家、省份或城市"
"输入国家、省份或城市": "输入国家、省份或城市",
"手机号码": "手机号码",
"邮箱": "邮箱",
"微信": "微信",
"更换": "更换",
"换绑": "换绑",
"绑定": "绑定",
"更换手机号码": "更换手机号码",
"输入手机号码": "输入手机号码",
"请输验证码": "请输验证码",
"请输入手机号": "请输入手机号",
"原手机号码": "原手机号码",
"更换邮箱": "更换邮箱",
"实时体征消息": "实时体征消息",
"睡眠报告消息": "睡眠报告消息",
"已开启": "已开启",
"短信消息": "短信消息",
"短信消息介绍": "定制该服务可通过手机短信接收消息提醒",
"电话语音提醒": "电话语音提醒",
"电话语音提醒介绍": "定制该服务可通过手机通话接收消息提醒",
"报警条件设置": "报警条件设置",
"恢复默认": "恢复默认",
"心率小于": "心率小于",
"心率大于": "心率大于",
"提醒类型": "提醒类型",
"全部通知": "全部通知",
"离床时间大于": "离床时间大于",
"未卧床时间大于": "未卧床时间大于",
"未起床时间大于": "未起床时间大于",
"睡眠报告评分小于": "睡眠报告评分小于",
"呼吸小于": "呼吸小于",
"呼吸大于": "呼吸大于",
"请先在设置里的消息通知打开APP消息配置": "请先设置“我的”中的消息通知",
"间隔报警": "间隔报警",
"分钟/次": "分钟/次",
"选择分数": "选择分数",
"离床时长": "离床时长",
"已关闭": "已关闭",
"时": "时"
}

View File

@@ -511,8 +511,8 @@
"发现": "發現!",
"检测到": "檢測到",
"绑定流程未走完是否继续": "綁定流程未走完是否繼續?",
"继续": "繼續",
"下次再说": "下次再說",
"继续": "繼續流程",
"下次再说": "跳過",
"请输入人员名称": "請輸入人員名稱",
"可用wifi": "可用wifi",
"一": "一",
@@ -565,5 +565,43 @@
"选择城市": "選擇城市",
"请选择城市": "請選擇城市",
"输入关键词": "輸入關鍵詞",
"输入国家、省份或城市": "輸入國家、省份或城市"
"输入国家、省份或城市": "輸入國家、省份或城市",
"手机号码": "手機號碼",
"邮箱": "郵箱",
"微信": "微信",
"更换": "更換",
"换绑": "換綁",
"绑定": "綁定",
"更换手机号码": "更護手機號碼",
"输入手机号码": "輸入手機號碼",
"请输验证码": "請輸入驗證碼",
"请输入手机号": "請輸入手機號碼",
"原手机号码": "原手機號碼",
"更换邮箱": "更護郵箱",
"实时体征消息": "即時體徵訊息",
"睡眠报告消息": "睡眠報告訊息",
"已开启": "已開啟",
"短信消息": "簡訊訊息",
"短信消息介绍": "定制此服務可透過手機簡訊接收訊息提醒",
"电话语音提醒": "電話語音提醒",
"电话语音提醒介绍": "定制此服務可透過手機通話接收訊息提醒",
"报警条件设置": "警報條件設定",
"恢复默认": "恢復預設值",
"心率小于": "心率小於",
"心率大于": "心率大於",
"提醒类型": "提醒類型",
"全部通知": "全部通知",
"离床时间大于": "離床時間大於",
"未卧床时间大于": "未臥床時間大於",
"未起床时间大于": "未起床時間大於",
"睡眠报告评分小于": "睡眠報告評分小於",
"呼吸小于": "呼吸小於",
"呼吸大于": "呼吸大於",
"请先在设置里的消息通知打开APP消息配置": "請先設定「我的」中的訊息通知",
"间隔报警": "間隔警報",
"分钟/次": "分鐘/次",
"选择分数": "選擇分數",
"离床时长": "離床時長",
"已关闭": "已關閉",
"时": "時"
}

View File

@@ -23,6 +23,7 @@ class AppConstants {
double button_container_radius = 100.rpx; //按钮容器圆角
double text_padding_up_dowm_p = 5.rpx; //段落文字上下间距
double text_padding = 10.rpx; //段落文字上下间距
double smaller_text_fontSize = 18.rpx; //普通文字字号
double small_text_fontSize = 20.rpx; //普通文字字号
@@ -63,7 +64,7 @@ class AppConstants {
int wifi2 = -60;
int wifi3 = -75;
static bool is_test_account = true; //是否测试账号
static bool is_test_account = false; //是否测试账号
}
//获取协议地址

View File

@@ -385,7 +385,7 @@ var closeIconWhite = GestureDetector(
var returnIconButtom = returnIconButtomNew(
onBack: () {
// ⚡这里写你需要在返回前执行的逻辑
Get.back();
// Get.back();
},
);

View File

@@ -77,7 +77,10 @@ class _DynamicReportDetailWidgetState extends State<DynamicReportDetailWidget> {
SizedBox(height: 33.rpx),
_buildSleepDateWidgets(),
SizedBox(height: 20.rpx),
if (!AppConstants.is_test_account) _buildSleepDataModuleWidgets(),
if (!AppConstants.is_test_account)
Obx(() {
return _buildSleepDataModuleWidgets();
}),
],
),
),

View File

@@ -118,14 +118,82 @@ class BodyDeviceController extends GetControllerEx<BodyDeviceModel> {
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
}
Future<ApiResponse> getDeviceList({String? key}) async {
// Future<ApiResponse> getDeviceList({String? key}) async {
// try {
// ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
// String serviceAddress = ServiceConstant.service_address;
// String serviceName = ServiceConstant.server_service;
// String serviceApi = ServiceConstant.device_list;
// String queryUrl =
// "${serviceAddress}${serviceName}${serviceApi}?bindType=${model.type}${key != null ? '&key=$key' : ''}";
// String? language = "";
// if (AppConstants().ent_type == APPPackageType.MHT.code) {
// if (mhLanguageController.selectLanguage != null) {
// language = mhLanguageController.selectLanguage.value!.language_code;
// }
// } else {
// 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";
// }
// }
// var response = await EasyDartModule.dio.get(queryUrl);
// if (response != null) {
// var responseData =
// response.data is String ? jsonDecode(response.data) : response.data;
// ApiResponse res =
// ApiResponse.fromJson(responseData, (object) => object);
// MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr);
// if (res.code == HttpStatusCodes.ok) {
// // bindDeviceNum.value = res.total!;
// deviceList.value = res.data!;
// updateAll();
// return res;
// }
// } else {
// return ApiResponse(code: -1, msg: "失败".tr);
// }
// return apiResponse;
// } catch (e) {
// EasyDartModule.logger.info("设备请求列表: $e");
// DailyLogUtils.writeLog("设备请求列表: $e");
// }
// return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
// }
Future<ApiResponse> getDeviceList(
{String? key, bool isAllDevice = false}) async {
try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list;
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?bindType=${model.type}${key != null ? '&key=$key' : ''}";
// 构建基础URL
String baseUrl = "${serviceAddress}${serviceName}${serviceApi}";
// 根据 isAllDevice 参数决定是否添加 bindType 参数
String queryParams = "";
if (!isAllDevice) {
queryParams = "?bindType=${model.type}";
}
// 添加 key 参数
if (key != null) {
if (queryParams.isNotEmpty) {
queryParams += "&key=$key";
} else {
queryParams = "?key=$key";
}
}
// 添加语言参数
String? language = "";
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
@@ -136,13 +204,18 @@ class BodyDeviceController extends GetControllerEx<BodyDeviceModel> {
language = languageController.selectLanguage.value!.language_code;
}
}
if (language != null && language.isNotEmpty) {
if (queryUrl.contains("?")) {
queryUrl += "&lang=$language";
if (queryParams.isNotEmpty) {
queryParams += "&lang=$language";
} else {
queryUrl += "?lang=$language";
queryParams = "?lang=$language";
}
}
// 拼接完整URL
String queryUrl = baseUrl + queryParams;
var response = await EasyDartModule.dio.get(queryUrl);
if (response != null) {
var responseData =

View File

@@ -43,6 +43,9 @@ class LoginModel {
bool? register_agree = false; //是否同意协议
String? updatePhone; //更新绑定手机号
String? updateCode; //更新绑定验证码
LoginModel();
static LoginModel fromJson(Map<String, dynamic> json) =>
@@ -61,8 +64,6 @@ class LoginController extends GetControllerEx<LoginModel> {
attr = GetModel(LoginModel()).obs;
}
//登录
Future<ApiResponse> login(BuildContext context) async {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.登录失败".tr);
@@ -197,8 +198,78 @@ class LoginController extends GetControllerEx<LoginModel> {
}
}
//微信登录
Future<void> wxLoginSendAuth(BuildContext context) async {
Future<ApiResponse> getUpdateTelCode(BuildContext context) async {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.发送失败".tr);
try {
if (model.updatePhone == null || model.updatePhone!.isEmpty) {
apiResponse.msg = "其他手机登录页.请输入手机号".tr;
return apiResponse;
}
model.updatePhone = model.updatePhone!.trim();
if (!MyUtils.isValidPhoneNumber(model.updatePhone!) &&
!MyUtils.isValidEmail(model.updatePhone!)) {
apiResponse.msg = '其他手机登录页.不正确手机号'.tr;
return apiResponse;
}
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.send_code;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
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";
}
}
var data = {
"userName": model.updatePhone,
"type": 5,
};
if (AppConstants().ent_type == APPPackageType.HUANSHUI.code) {
data['code'] = "hzhskj";
}
var response =
await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data));
if (response != null) {
var responseData =
response.data is String ? jsonDecode(response.data) : response.data;
ApiResponse res =
ApiResponse.fromJson(responseData, (object) => object);
if (res.code != HttpStatusCodes.ok) {
if (res.msg == null || res.msg!.isEmpty) {
res.msg = apiResponse.msg;
}
} else {
if (res.msg == null || res.msg!.isEmpty) {
res.msg = "其他手机登录页.发送成功".tr;
}
}
EasyDartModule.logger.info('msg:发送验证码成功');
return res;
} else {
EasyDartModule.logger.error('msg:发送验证码失败:${response}');
return ApiResponse(code: -1, msg: "失败".tr);
}
} catch (e) {
EasyDartModule.logger.error('msg:发送验证码失败:${e}');
return ApiResponse(code: -1, msg: "失败".tr);
}
}
//微信登录 auth 是否登录
Future<void> wxLoginSendAuth(BuildContext context,
{bool login = true}) async {
/*
1、目前移动应用上微信登录只提供原生的登录方式需要用户安装微信客户端才能配合使用。
2、对于Android应用建议总是显示微信登录按钮当用户手机没有安装微信客户端时请引导用户下载安装微信客户端。
@@ -218,13 +289,14 @@ class LoginController extends GetControllerEx<LoginModel> {
.authBy(
which: NormalAuth(
scope: 'snsapi_userinfo',
state: 'wechat_sdk_theh_wxlogin',
state: 'wechat_sdk_theh_wxlogin' +
'${DateTime.now().millisecondsSinceEpoch}',
))
.then((data) async {
//返回true表示成功或者false表示失败这边没有意义从login_controller页面构造函数监听中去处理
debugPrint('msg:$data');
EasyDartModule.logger.error('msg:$data');
if (data) {
if (data && login) {
//登陆成功
await dealBindProcess();
}
@@ -253,18 +325,29 @@ class LoginController extends GetControllerEx<LoginModel> {
if (apiResponse.code == HttpStatusCodes.ok) {
UserInfoController userInfoController = Get.find();
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
if (userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) {
if (apiResponse.data['test'] != null &&
apiResponse.data['test'] == true) {
AppConstants.is_test_account = true;
} else {
AppConstants.is_test_account = false;
}
if ((userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) &&
(userInfoController.model.user!.email == null ||
userInfoController.model.user!.email!.isEmpty)) {
Map data = {
'img': "assets/img/bgNoImg.png",
};
await Get.toNamed("/auth_bind_tel", arguments: data);
}
if (userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) {
if ((userInfoController.model.user!.phone == null ||
userInfoController.model.user!.phone!.isEmpty) &&
(userInfoController.model.user!.email == null ||
userInfoController.model.user!.email!.isEmpty)) {
userInfoController.model.login = 0;
} else {
userInfoController.model.login = 1;
}
userInfoController.model.login = 1;
String token = apiResponse.rawResponse.headers['token']!.first;
EasyDartModule.dio.token = token;

View File

@@ -17,7 +17,9 @@ LoginModel _$LoginModelFromJson(Map<String, dynamic> json) => LoginModel()
..forceLogin = (json['forceLogin'] as num?)?.toInt()
..isIos = json['isIos'] as bool?
..isWeChatNotInstalled = json['isWeChatNotInstalled'] as bool?
..register_agree = json['register_agree'] as bool?;
..register_agree = json['register_agree'] as bool?
..updatePhone = json['updatePhone'] as String?
..updateCode = json['updateCode'] as String?;
Map<String, dynamic> _$LoginModelToJson(LoginModel instance) =>
<String, dynamic>{
@@ -32,4 +34,6 @@ Map<String, dynamic> _$LoginModelToJson(LoginModel instance) =>
'isIos': instance.isIos,
'isWeChatNotInstalled': instance.isWeChatNotInstalled,
'register_agree': instance.register_agree,
'updatePhone': instance.updatePhone,
'updateCode': instance.updateCode,
};

View File

@@ -10,6 +10,8 @@ class CommonMessageSettingModel {
int? setting = 0; //总设置 0 关闭 1 开启
int? appSetting = 0; //app消息设置
int? serviceSetting = 0; //服务号消息
int? telSetting = 0;//电话语音提醒
int? smsSetting = 0;//短信提醒
int? tipSetting = 0; //设备放置说明
int? deviceUpgradeSetting = 0; //设备升级提示
int? deviceIssueSetting = 0; //设备故障提示

View File

@@ -12,6 +12,8 @@ CommonMessageSettingModel _$CommonMessageSettingModelFromJson(
..setting = (json['setting'] as num?)?.toInt()
..appSetting = (json['appSetting'] as num?)?.toInt()
..serviceSetting = (json['serviceSetting'] as num?)?.toInt()
..telSetting = (json['telSetting'] as num?)?.toInt()
..smsSetting = (json['smsSetting'] as num?)?.toInt()
..tipSetting = (json['tipSetting'] as num?)?.toInt()
..deviceUpgradeSetting = (json['deviceUpgradeSetting'] as num?)?.toInt()
..deviceIssueSetting = (json['deviceIssueSetting'] as num?)?.toInt()
@@ -23,6 +25,8 @@ Map<String, dynamic> _$CommonMessageSettingModelToJson(
'setting': instance.setting,
'appSetting': instance.appSetting,
'serviceSetting': instance.serviceSetting,
'telSetting': instance.telSetting,
'smsSetting': instance.smsSetting,
'tipSetting': instance.tipSetting,
'deviceUpgradeSetting': instance.deviceUpgradeSetting,
'deviceIssueSetting': instance.deviceIssueSetting,

View File

@@ -5,9 +5,10 @@ part 'message_setting_controller.g.dart'; // 由json_serializable自动生成的
@JsonSerializable()
class MessageSettingModel {
int? setting = 0;//总设置 0 关闭 1 开启
int? appSetting = 0;//app消息设置
int? serviceSetting = 0;//服务号消息
int? setting = 0; //总设置 0 关闭 1 开启
int? appSetting = 0; //app消息设置
int? serviceSetting = 0; //服务号消息
List device_type_setting = [];
MessageSettingModel();
@@ -31,4 +32,9 @@ class MessageSettingController extends GetControllerEx<MessageSettingModel> {
attr = GetModel(MessageSettingModel()).obs;
}
RxMap<String, dynamic> messageType = RxMap<String, dynamic>();
}

View File

@@ -1,7 +1,9 @@
import 'package:EasyDartModule/EasyDartModule.dart';
import 'package:dio/dio.dart' as dio;
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get_storage/get_storage.dart';
import 'package:img_picker/img_picker.dart';
import 'package:json_annotation/json_annotation.dart';
@@ -10,6 +12,8 @@ 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/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/home/home_controller.dart';
import 'package:vbvs_app/controller/login/login_controller.dart';
@@ -67,6 +71,8 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
List device_bind_status = [];
int device_bind_flag = 0; //0。未初始化 1.已初始化
int initLocationpermission = 0; //未初始化
FluwxCancelable? fluwxCancelable;
final Fluwx fluwx = Fluwx();
Future<ApiResponse> uploadImg() async {
EasyDartModule.logger.info("请求上传图片");
@@ -129,20 +135,29 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
}
//更新用户信息
Future<ApiResponse> updateData() async {
Future<ApiResponse> updateData({
String? phone,
String? email,
String? code,
}) async {
EasyDartModule.logger.info("更新用户资料");
DailyLogUtils.writeLog("更新用户资料");
try {
LoginController loginController = Get.find();
ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr);
UserModel user = model.user!;
if (user.tmpNickName == null || user.tmpNickName!.isEmpty) {
apiResponse.msg = "昵称为空".tr;
return apiResponse;
}
// if (user.tmpNickName!.length >= 9) {
// apiResponse.msg = "最长字符为8个字".tr;
// return apiResponse;
// }
if ((phone != null && phone.isNotEmpty) ||
(email != null && email.isNotEmpty)) {
if (loginController.model.updateCode == null ||
loginController.model.updateCode!.isEmpty) {
apiResponse.msg = "请输验证码".tr;
return apiResponse;
}
}
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_info;
@@ -168,8 +183,15 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
"nickName": user.tmpNickName,
if (user.tmpHead != null && user.tmpHead!.isNotEmpty)
"avatar": user.tmpHead,
if (phone != null && phone.isNotEmpty) "phone": phone,
if (email != null && email.isNotEmpty) "email": email,
if (loginController.model.updateCode != null &&
loginController.model.updateCode!.isNotEmpty)
"verify": loginController.model.updateCode,
if (code != null && code.isNotEmpty) "wxCode": code,
if (code != null && code.isNotEmpty) "khCode": "theh",
"merge": true,
};
var response =
await EasyDartModule.dio.put(queryUrl, data: jsonEncode(data));
if (apiResponse != null) {
@@ -178,6 +200,10 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
ApiResponse res =
ApiResponse.fromJson(responseData, (object) => object);
MyUtils.formatResponse(res, "保存成功".tr, "保存失败".tr);
await getUserInfo();
model.user!.tmpNickName = model.user!.nick_name;
model.user!.tmpHead = model.user!.avatar;
updateAll();
return res;
} else {
return ApiResponse(code: -1, msg: "服务器失败".tr);
@@ -304,4 +330,40 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
return apiResponse;
}
//解除微信绑定
unBindWx(BuildContext context) async {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_info;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
try {
final data = {
"wxCode": "",
"khCode": "",
"merge": true,
};
final res = await requestWithLog(
logTitle: "解除微信绑定",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {
TopSlideNotification.show(
context,
text: res.msg!,
);
},
onFailure: (res) {
TopSlideNotification.show(
context,
text: res.msg!,
textColor: themeController.currentColor.sc9,
);
},
);
} catch (e) {
ef.log("微信解绑失败-》$e");
}
}
}

View File

@@ -143,7 +143,8 @@ void initServiceAddress() {
ServiceConstant.baseHost = "zhmht.swes.com.cn:27020";
} else if (AppConstants().ent_type == APPPackageType.TH.code) {
// 太和
ServiceConstant.baseHost = "vsbst-api.he-info.com";
// ServiceConstant.baseHost = "vsbst-api.he-info.com";
ServiceConstant.baseHost = "vsbs-test.he-info.cn";
} else {
//默认
ServiceConstant.baseHost = "vsbst-api.he-info.com";

View File

@@ -17,7 +17,8 @@ class UserModel {
int? created_at;
String? email;
bool? test;
bool? fac;//是否测试,可以全部升级
bool? fac; //是否测试,可以全部升级
bool? bindWx = false;
UserModel();
static UserModel fromJson(Map<String, dynamic> json) =>

View File

@@ -20,7 +20,8 @@ UserModel _$UserModelFromJson(Map<String, dynamic> json) => UserModel()
..created_at = (json['created_at'] as num?)?.toInt()
..email = json['email'] as String?
..test = json['test'] as bool?
..fac = json['fac'] as bool?;
..fac = json['fac'] as bool?
..bindWx = json['bindWx'] as bool?;
Map<String, dynamic> _$UserModelToJson(UserModel instance) => <String, dynamic>{
'uid': instance.uid,
@@ -37,4 +38,5 @@ Map<String, dynamic> _$UserModelToJson(UserModel instance) => <String, dynamic>{
'email': instance.email,
'test': instance.test,
'fac': instance.fac,
'bindWx': instance.bindWx,
};

View File

@@ -56,6 +56,66 @@ getOnePicker(BuildContext context, List arr, int checkIndex,
);
}
// Widget getOnePickers(
// BuildContext context,
// List arr,
// RxInt selectedIndex, {
// String unit = '',
// bool looping = false,
// void Function(int)? onChanged,
// bool isMonthName = false,
// Key? pickerKey,
// }) {
// ThemeController themeController = Get.find();
// final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
// return Obx(() {
// final dynamicKey = ValueKey('picker_${arr.length}_${selectedIndex.value}');
// return CupertinoPicker.builder(
// key: pickerKey ?? dynamicKey,
// itemExtent: 90.rpx,
// useMagnifier: false,
// magnification: 1,
// diameterRatio: 1.3,
// squeeze: 1,
// scrollController:
// FixedExtentScrollController(initialItem: selectedIndex.value),
// selectionOverlay: Container(),
// onSelectedItemChanged: (int index) {
// selectedIndex.value = index;
// if (onChanged != null) onChanged(index);
// },
// childCount: arr.length,
// itemBuilder: (context, index) {
// bool isSelected = index == selectedIndex.value;
// // 处理显示文本
// String displayText;
// if (isMonthName && isEn && arr[index] is int) {
// displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
// } else {
// // displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位
// displayText = "${arr[index]}$unit"; // 中文附带单位
// }
// return Center(
// child: Text(
// displayText,
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: isSelected
// ? themeController.currentColor.sc3
// : const Color(0xFF9AA0B3),
// fontSize: 30.rpx,
// fontWeight: FontWeight.normal,
// ),
// ),
// );
// },
// );
// });
// }
Widget getOnePickers(
BuildContext context,
List arr,
@@ -65,6 +125,9 @@ Widget getOnePickers(
void Function(int)? onChanged,
bool isMonthName = false,
Key? pickerKey,
/// ⭐ 新增:可选的自定义显示,但不影响旧用法
String Function(dynamic value)? customDisplay,
}) {
ThemeController themeController = Get.find();
final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
@@ -89,13 +152,26 @@ Widget getOnePickers(
itemBuilder: (context, index) {
bool isSelected = index == selectedIndex.value;
// 处理显示文本
String displayText;
if (isMonthName && isEn && arr[index] is int) {
displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
} else {
// displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位
displayText = "${arr[index]}$unit"; // 中文附带单位
String value = arr[index].toString();
String displayText = "";
// ⭐ 1. 优先使用自定义展示
if (customDisplay != null) {
String? custom = customDisplay(arr[index]);
if (custom != null && custom.isNotEmpty) {
displayText = custom;
}
}
// ⭐ 2. 若自定义没给或返回空,则使用你原本的逻辑
if (displayText.isEmpty) {
if (isMonthName && isEn && arr[index] is int) {
// 英文月份
displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
} else {
// 中文 + 单位(你原来的逻辑)
displayText = "$value$unit";
}
}
return Center(
@@ -1839,3 +1915,165 @@ DialogColorScheme _getDialogColors(int entType) {
);
}
}
Future showTHDayTimeSelectionDialog(
BuildContext context, {
required List<int> dayTimeArr,
Function(List<int>)? checkChange,
String title = "选择时间",
}) {
ThemeController themeController = Get.find();
final List<int> hours = List.generate(24, (i) => i);
final List<int> minutes = List.generate(60, (i) => i);
final RxInt hoursIndex = hours.indexOf(dayTimeArr[0]).obs;
final RxInt minutesIndex = minutes.indexOf(dayTimeArr[1]).obs;
return showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Stack(
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Material(
color: Colors.transparent,
child: Dialog(
backgroundColor: themeController.currentColor.sc17, // 修改:使用主题颜色
insetPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
child: Container(
width: double.infinity,
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// 顶部栏:取消 - 标题 - 确定
Container(
padding:
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
color: themeController.currentColor.sc5, // 修改:使用主题颜色
height: 80.rpx,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.zero,
onTap: () => Navigator.of(context).pop(),
child: Container(
width: 110.rpx,
height: 60.rpx,
alignment: Alignment.center,
child: Text(
"取消".tr,
style: TextStyle(
fontSize: 30.rpx,
color: Colors.white, // 保持不变
),
),
),
),
Text(
title.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController
.currentColor.sc3, // 修改:使用主题颜色
fontSize: 30.rpx,
),
),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.zero,
onTap: () {
checkChange?.call([
hours[hoursIndex.value],
minutes[minutesIndex.value],
]);
Get.back();
},
child: Container(
width: 110.rpx,
height: 60.rpx,
alignment: Alignment.center,
child: Text(
"确定".tr,
style: TextStyle(
fontSize: 30.rpx,
color: themeController
.currentColor.sc2, // 修改:使用主题颜色
),
),
),
),
],
),
),
SizedBox(height: 20.rpx),
Stack(
children: [
Positioned.fill(
child: IgnorePointer(
child: Center(
child: Container(
height: 90.rpx,
margin:
EdgeInsets.symmetric(horizontal: 95.rpx),
decoration: BoxDecoration(
color: themeController
.currentColor.sc2, // 修改:使用主题颜色
borderRadius: BorderRadius.circular(16.rpx),
),
),
),
),
),
SizedBox(
height: 240.rpx,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 95.rpx),
child: Row(
children: [
Expanded(
child: getOnePickers(
context,
hours,
hoursIndex,
unit: "".tr,
),
),
Expanded(
child: getOnePickers(
context,
minutes,
minutesIndex,
unit: "".tr,
),
),
],
),
),
),
],
),
],
),
),
),
),
),
],
);
},
);
}

View File

@@ -188,10 +188,9 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
final targetPosition = index * (itemHeight + spacing);
// 根据当前类型选择对应的ScrollController
final currentScrollController =
bodyDeviceController.model.type == 1
? _myDeviceScrollController
: _cloudDeviceScrollController;
final currentScrollController = bodyDeviceController.model.type == 1
? _myDeviceScrollController
: _cloudDeviceScrollController;
if (currentScrollController.hasClients) {
currentScrollController.animateTo(
@@ -619,8 +618,11 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
children: [
// 我的e护页面
Obx(() {
final myDeviceList = bodyDeviceController.deviceList.value
.where((device) => device['type'] == 1 || device['bind_type'] == 1)
final myDeviceList = bodyDeviceController
.deviceList.value
.where((device) =>
device['type'] == 1 ||
device['bind_type'] == 1)
.toList();
return myDeviceList.isEmpty
? NullDataWidget()
@@ -643,8 +645,11 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
}),
// 云关爱页面
Obx(() {
final cloudDeviceList = bodyDeviceController.deviceList.value
.where((device) => device['type'] == 2 || device['bind_type'] == 2)
final cloudDeviceList = bodyDeviceController
.deviceList.value
.where((device) =>
device['type'] == 2 ||
device['bind_type'] == 2)
.toList();
return cloudDeviceList.isEmpty
? NullDataWidget()
@@ -652,7 +657,8 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 26.rpx, 30.rpx, 0),
child: SingleChildScrollView(
controller: _cloudDeviceScrollController,
controller:
_cloudDeviceScrollController,
child: Column(
mainAxisSize: MainAxisSize.max,
children: cloudDeviceList

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,256 @@
import 'package:flutter/material.dart';
import 'dart:convert';
class MessageTypeComponent extends StatelessWidget {
final Map<String, dynamic> config;
const MessageTypeComponent({Key? key, required this.config}) : super(key: key);
@override
Widget build(BuildContext context) {
final String name = config['name'] ?? '未命名';
final String type = config['type'] ?? 'unknown';
final List<dynamic> dataList = config['data'] ?? [];
return Container(
margin: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12.0),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
blurRadius: 8.0,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 标题栏
_buildHeader(name, type),
// 分隔线
const Divider(height: 1, color: Color(0xFFEEEEEE)),
// 数据列表
_buildDataList(dataList),
],
),
);
}
// 构建标题栏
Widget _buildHeader(String name, String type) {
return Container(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
name,
style: const TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: Color(0xFF333333),
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0),
decoration: BoxDecoration(
color: _getTypeColor(type),
borderRadius: BorderRadius.circular(20.0),
),
child: Text(
_getTypeText(type),
style: const TextStyle(
fontSize: 12.0,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
),
],
),
);
}
// 构建数据列表
Widget _buildDataList(List<dynamic> dataList) {
if (dataList.isEmpty) {
return const Padding(
padding: EdgeInsets.all(16.0),
child: Text(
'暂无数据',
style: TextStyle(color: Colors.grey),
),
);
}
return ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.symmetric(vertical: 8.0),
itemCount: dataList.length,
separatorBuilder: (context, index) => const Divider(
height: 1,
indent: 16.0,
endIndent: 16.0,
color: Color(0xFFF5F5F5),
),
itemBuilder: (context, index) {
final Map<String, dynamic> item = dataList[index];
return _buildDataItem(item);
},
);
}
// 构建单个数据项
Widget _buildDataItem(Map<String, dynamic> item) {
final String itemName = item['name']?.toString() ?? '未知';
final int? id = item['id'];
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// ID 标签
if (id != null)
Container(
width: 24.0,
height: 24.0,
alignment: Alignment.center,
margin: const EdgeInsets.only(right: 12.0),
decoration: BoxDecoration(
color: const Color(0xFFE8F4FF),
borderRadius: BorderRadius.circular(12.0),
),
child: Text(
id.toString().substring(id.toString().length - 2),
style: const TextStyle(
fontSize: 12.0,
color: Color(0xFF1890FF),
fontWeight: FontWeight.w500,
),
),
),
// 数据内容
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
itemName,
style: const TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w500,
color: Color(0xFF333333),
),
),
const SizedBox(height: 4.0),
// 动态显示其他字段
..._buildExtraFields(item),
],
),
),
],
),
);
}
// 构建额外字段显示
List<Widget> _buildExtraFields(Map<String, dynamic> item) {
final List<Widget> fields = [];
// 遍历所有字段,排除已经显示的 id 和 name
item.forEach((key, value) {
if (key != 'id' && key != 'name' && value != null) {
final String displayKey = _getDisplayKey(key);
final String displayValue = _formatValue(value);
fields.add(
Padding(
padding: const EdgeInsets.only(top: 2.0),
child: Text.rich(
TextSpan(
children: [
TextSpan(
text: '$displayKey',
style: const TextStyle(
fontSize: 14.0,
color: Color(0xFF666666),
),
),
TextSpan(
text: displayValue,
style: const TextStyle(
fontSize: 14.0,
color: Color(0xFF1890FF),
fontWeight: FontWeight.w500,
),
),
],
),
),
),
);
}
});
return fields;
}
// 获取显示用的键名
String _getDisplayKey(String key) {
final Map<String, String> keyMap = {
'min': '最小值',
'max': '最大值',
'interval': '间隔(秒)',
'duration': '持续时间(秒)',
'time': '时间',
};
return keyMap[key] ?? key;
}
// 格式化值显示
String _formatValue(dynamic value) {
if (value is int) {
// 如果是时间相关的秒数,转换为分钟显示
if (value >= 60) {
return '${value ~/ 60}分钟${value % 60 != 0 ? '${value % 60}' : ''}';
}
return value.toString();
}
return value.toString();
}
// 根据类型获取颜色
Color _getTypeColor(String type) {
switch (type) {
case 'instant':
return const Color(0xFF52C41A);
case 'sleep':
return const Color(0xFF1890FF);
default:
return Colors.grey;
}
}
// 根据类型获取显示文本
String _getTypeText(String type) {
switch (type) {
case 'instant':
return '实时';
case 'sleep':
return '睡眠';
default:
return '未知';
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1145,4 +1145,5 @@ class _AfterWifiPagePersonState extends State<AfterWifiPagePerson> {
onFailure: (res) {},
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1001,132 +1001,400 @@ Future<void> showTipDialog(
);
}
// Future<void> showUnBindTipDialog(
// BuildContext context,
// Widget widget, {
// Color? backgroundColor,
// VoidCallback? onConfirm, // “继续”按钮回调
// VoidCallback? onCancel, // “下次再说”按钮回调
// VoidCallback? onNoTip, // “下次再说”按钮回调
// }) {
// ThemeController themeController = Get.find();
// BlueteethBindController blueteethBindController = Get.find();
// return showDialog(
// context: context,
// barrierDismissible: true,
// barrierColor: Colors.black.withOpacity(0.5),
// builder: (BuildContext context) {
// return FrostedDialog(
// blurSigma: 3.0,
// child: Container(
// decoration: BoxDecoration(
// color: backgroundColor ?? themeController.currentColor.sc17,
// borderRadius: BorderRadius.circular(20.0),
// ),
// padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
// child: Container(
// width: double.infinity,
// constraints: BoxConstraints(
// maxHeight: MediaQuery.sizeOf(context).height * 0.656,
// ),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Align(
// alignment: AlignmentDirectional(0, 0),
// child: Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 0.rpx, 93.rpx, 0, 30.rpx),
// child: widget,
// ),
// ),
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
// child: CustomCard(
// borderRadius: AppConstants().button_container_radius,
// onTap: () {
// Get.back(); // 关闭对话框
// if (onConfirm != null) {
// onConfirm(); // 调用确认回调
// }
// },
// colors: [
// themeController.currentColor.sc1,
// themeController.currentColor.sc2,
// ],
// child: Container(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height * 0.055,
// constraints: BoxConstraints(
// minWidth: 500.rpx,
// minHeight: 90.rpx,
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// '继续'.tr,
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontFamily: 'Inter',
// fontSize: AppConstants().normal_text_fontSize,
// letterSpacing: 0.0,
// ),
// ),
// ].divide(SizedBox(width: 17.rpx)),
// ),
// ),
// ),
// ),
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
// child: CustomCard(
// borderRadius: AppConstants().button_container_radius,
// onTap: () {
// Get.back(); // 关闭对话框
// if (onCancel != null) {
// onCancel(); // 调用取消回调
// }
// },
// colors: [Colors.transparent],
// child: Container(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height * 0.055,
// decoration: BoxDecoration(
// border: Border.all(
// color: Colors.white,
// width: 0.5.rpx,
// ),
// borderRadius: BorderRadius.circular(
// AppConstants().button_container_radius),
// ),
// constraints: BoxConstraints(
// minWidth: 500.rpx,
// minHeight: 90.rpx,
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// '下次再说'.tr,
// style: TextStyle(
// color: themeController.currentColor.sc3,
// fontFamily: 'Inter',
// fontSize: AppConstants().normal_text_fontSize,
// letterSpacing: 0.0,
// ),
// ),
// ].divide(SizedBox(width: 17.rpx)),
// ),
// ),
// ),
// ),
// Padding(
// padding: EdgeInsets.fromLTRB(0, 0, 0, 30.rpx),
// child: Container(
// width: double.infinity,
// child: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// Container(
// width: double.infinity,
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Theme(
// data: ThemeData(
// checkboxTheme: CheckboxThemeData(
// visualDensity: VisualDensity.compact,
// materialTapTargetSize:
// MaterialTapTargetSize.shrinkWrap,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(64),
// ),
// ),
// unselectedWidgetColor: Color(0xFFD3D3D3),
// ),
// child: Obx(
// () => Checkbox(
// value:
// blueteethBindController.model.read ==
// 1
// ? false
// : true,
// onChanged: (newValue) async {
// blueteethBindController.model.read =
// newValue == true ? 0 : 1;
// blueteethBindController.updateAll();
// },
// side: BorderSide(
// width: 1.5,
// color: Colors.white,
// ),
// activeColor: stringToColor("#16C89F"),
// ),
// )),
// Text(
// '绑定引导.不再提示'.tr,
// style: TextStyle(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController.currentColor.sc3,
// ),
// ),
// ].divide(SizedBox(width: 22.rpx)),
// ),
// ),
// ].divide(SizedBox(height: 42.rpx)),
// ),
// ),
// )
// ],
// ),
// ),
// ),
// );
// },
// );
// }
Future<void> showUnBindTipDialog(
BuildContext context,
Widget widget, {
Color? backgroundColor,
VoidCallback? onConfirm, // “继续”按钮回调
VoidCallback? onCancel, // “下次再说”按钮回调
bool initialNoTipValue = false, // 初始的"不再提示"值,从外部传入
ValueChanged<bool>? onNoTipChanged, // "不再提示"值变化时的回调
}) {
ThemeController themeController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
// 移除原来的控制器依赖,使用传入的初始值
// BlueteethBindController blueteethBindController = Get.find();
// 使用局部状态管理不再提示的值
bool noTipValue = initialNoTipValue;
return showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5),
builder: (BuildContext context) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
decoration: BoxDecoration(
color: backgroundColor ?? themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 93.rpx, 0, 30.rpx),
child: widget,
),
// 使用StatefulBuilder来管理局部状态
return StatefulBuilder(
builder: (context, setState) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
decoration: BoxDecoration(
color: backgroundColor ?? themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onConfirm != null) {
onConfirm(); // 调用确认回调
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'继续'.tr,
style: TextStyle(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 93.rpx, 0, 30.rpx),
child: widget,
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onCancel != null) {
onCancel(); // 调用取消回调
}
},
colors: [Colors.transparent],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 0.5.rpx,
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onConfirm != null) {
onConfirm(); // 调用确认回调
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'继续'.tr,
style: TextStyle(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius),
),
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'下次再说'.tr,
style: TextStyle(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onCancel != null) {
onCancel(); // 调用取消回调
}
},
colors: [Colors.transparent],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 0.5.rpx,
),
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius),
),
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'下次再说'.tr,
style: TextStyle(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 0, 30.rpx),
child: Container(
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: double.infinity,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Theme(
data: ThemeData(
checkboxTheme: CheckboxThemeData(
visualDensity: VisualDensity.compact,
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(64),
),
),
unselectedWidgetColor: Color(0xFFD3D3D3),
),
child: Checkbox(
value: noTipValue,
onChanged: (newValue) {
if (newValue != null) {
setState(() {
noTipValue = newValue;
});
// 回调新的值给外部
if (onNoTipChanged != null) {
onNoTipChanged(noTipValue);
}
}
},
side: BorderSide(
width: 1.5,
color: Colors.white,
),
activeColor: stringToColor("#16C89F"),
),
),
Text(
'绑定引导.不再提示'.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 22.rpx)),
),
),
].divide(SizedBox(height: 42.rpx)),
),
),
)
],
),
],
),
),
),
),
);
},
);
},
);

View File

@@ -43,6 +43,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
void dispose() {
_tapRecognizer2.dispose();
_tapRecognizer4.dispose();
loginController.fluwxCancelable?.cancel();
super.dispose();
}
@@ -104,7 +105,9 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
loginController.fluwxCancelable?.cancel();
// 登录成功移出网络检查监听
Checknetwork.subscription?.cancel();
Get.offAndToNamed("/mianPageBottomChange");
if (Get.currentRoute != '/mianPageBottomChange') {
Get.offAndToNamed("/mianPageBottomChange");
}
}
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
// fluwxCancelable?.cancel();
@@ -119,6 +122,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
}
}
});
}
@override
@@ -625,6 +629,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
),
),
),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0),

View File

@@ -64,6 +64,20 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
),
Positioned(
left: 0.rpx,
// child: returnIconButtomNew(onBack: () {
// UserInfoController userInfoController = Get.find();
// ApiResponse apiResponse = userInfoController.logOut();
// TopSlideNotification.show(
// context,
// text: apiResponse.msg!,
// textColor: apiResponse.code == HttpStatusCodes.ok
// ? themeController.currentColor.sc2
// : themeController.currentColor.sc9,
// );
// if (apiResponse.code == HttpStatusCodes.ok) {
// Get.offAllNamed("/mianPageBottomChange");
// }
// }),
child: returnIconButtomNew(),
),
],
@@ -163,6 +177,43 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.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: Align(
alignment:

View File

@@ -135,12 +135,14 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
Widget _buildLoggedInContent() {
return Obx(() {
if (finalUri.isEmpty) {
return Center(child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),);
return Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
);
}
// 如果设备列表为空
@@ -166,7 +168,9 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
return Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(url: WebUri(finalUri.value+"?t=${DateTime.now().millisecondsSinceEpoch}")),
initialUrlRequest: URLRequest(
url: WebUri(finalUri.value +
"?t=${DateTime.now().millisecondsSinceEpoch}")),
onLoadStart: (controller, url) {
isPageLoading.value = true;
},
@@ -178,12 +182,14 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
valueListenable: isPageLoading,
builder: (context, isLoading, child) {
return isLoading
? Center(child:CircularProgressIndicator(
? Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),)
),
)
: SizedBox.shrink();
},
),
@@ -212,55 +218,127 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
}
Future<void> getDeviceList() async {
BodyDeviceController bodyDeviceController = Get.find();
ApiResponse apiResponse = await bodyDeviceController.getDeviceList();
try {
BodyDeviceController bodyDeviceController = Get.find();
ApiResponse apiResponse =
await bodyDeviceController.getDeviceList(isAllDevice: true);
if (apiResponse.code == HttpStatusCodes.ok) {
List<dynamic> rawList = apiResponse.data;
if (apiResponse.code == HttpStatusCodes.ok) {
List<dynamic> rawList = apiResponse.data;
// 提取 mac 和 person.name
List<Map<String, dynamic>> newList = rawList.map((item) {
String mac = item['mac'] ?? '';
String name = (item['person'] != null &&
item['person']['name'] != null &&
item['person']['name'].toString().trim().isNotEmpty)
? item['person']['name'] + "_${mac}"
: '未命名'.tr + "_${mac}";
return {
'mac': mac,
'name': name,
};
}).toList();
// 提取 mac 和 person.name
List<Map<String, dynamic>> newList = rawList.map((item) {
String mac = item['mac'] ?? '';
String name = (item['person'] != null &&
item['person']['name'] != null &&
item['person']['name'].toString().trim().isNotEmpty)
? item['person']['name'] + "_${mac}"
: '未命名'.tr + "_${mac}";
return {
'mac': mac,
'name': name,
};
}).toList();
deviceList.value = newList;
deviceList.value = newList;
// 拼接参数 person
if (deviceList.isNotEmpty) {
// JSON 编码整个 deviceList 对象数组
String personParam = Uri.encodeComponent(jsonEncode(deviceList));
finalUri.value = "${widget.sleepUri}?person=$personParam";
// 拼接参数 person
if (deviceList.isNotEmpty) {
// JSON 编码整个 deviceList 对象数组
String personParam = Uri.encodeComponent(jsonEncode(deviceList));
finalUri.value = "${widget.sleepUri}?person=$personParam";
} else {
finalUri.value = widget.sleepUri;
}
}
String? language = "";
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
finalUri.value = widget.sleepUri;
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
}
}
String? language = "";
if (AppConstants().ent_type == APPPackageType.MHT.code) {
if (mhLanguageController.selectLanguage != null) {
language = mhLanguageController.selectLanguage.value!.language_code;
}
} else {
if (languageController.selectLanguage != null) {
language = languageController.selectLanguage.value!.language_code;
}
}
if (language != null && language.isNotEmpty) {
if (finalUri.value.contains("?")) {
finalUri.value += "&lang=$language";
} else {
finalUri.value += "?lang=$language";
if (language != null && language.isNotEmpty) {
if (finalUri.value.contains("?")) {
finalUri.value += "&lang=$language";
} else {
finalUri.value += "?lang=$language";
}
}
ef.log("msg");
} catch (e) {
ef.log(e.toString());
}
ef.log("msg");
}
// Future<void> getDeviceList() async {
// try {
// BodyDeviceController bodyDeviceController = Get.find();
// ApiResponse apiResponse =
// await bodyDeviceController.getDeviceList(isAllDevice: true);
// // 调试:打印返回的数据结构
// print('API响应数据: $apiResponse');
// print('API响应数据类型: ${apiResponse.data.runtimeType}');
// print('API响应数据内容: ${apiResponse.data}');
// if (apiResponse.code == HttpStatusCodes.ok) {
// List<dynamic> rawList = apiResponse.data;
// // 调试:检查 rawList 的类型和内容
// print('rawList 类型: ${rawList.runtimeType}');
// print('rawList 长度: ${rawList.length}');
// if (rawList.isNotEmpty) {
// print('rawList[0] 类型: ${rawList[0].runtimeType}');
// print('rawList[0] 内容: ${rawList[0]}');
// }
// // 安全处理:确保每个元素都是 Map
// List<Map<String, dynamic>> newList =
// rawList.whereType<Map>().map((item) {
// // 调试每个 item
// print('处理 item: $item');
// print('item 类型: ${item.runtimeType}');
// String mac = (item['mac'] ?? '').toString();
// String name = '未命名'.tr + "_${mac}";
// if (item['person'] != null && item['person'] is Map) {
// var person = item['person'] as Map;
// if (person['name'] != null &&
// person['name'].toString().trim().isNotEmpty) {
// name = '${person['name']}_${mac}';
// }
// }
// return {
// 'mac': mac,
// 'name': name,
// };
// }).toList();
// deviceList.value = newList;
// // 拼接参数 person
// if (deviceList.isNotEmpty) {
// // JSON 编码整个 deviceList 对象数组
// String personParam = Uri.encodeComponent(jsonEncode(deviceList));
// finalUri.value = "${widget.sleepUri}?person=$personParam";
// } else {
// finalUri.value = widget.sleepUri;
// }
// }
// // ... 后续语言处理代码不变
// } catch (e) {
// print('getDeviceList 错误详情: $e');
// print('错误堆栈: ${e}');
// ef.log(e.toString());
// }
// }
}

View File

@@ -1106,7 +1106,6 @@ class _HomePageState extends State<HomePage> {
if (currentIndex >= device_bind_process.length) return;
String code = device_bind_process[currentIndex]['mac'];
showUnBindTipDialog(
context,
Column(
@@ -1145,6 +1144,7 @@ class _HomePageState extends State<HomePage> {
),
],
),
textAlign: TextAlign.center, // 添加这一行
),
],
),
@@ -1208,6 +1208,12 @@ class _HomePageState extends State<HomePage> {
device_bind_process.removeAt(currentIndex);
showNextDialog();
},
onNoTipChanged: (value) {
updateDeviceTipStatus(
code, device_bind_process[currentIndex], value);
// device_bind_process.removeAt(currentIndex);
// showNextDialog();
},
);
}
@@ -1252,9 +1258,11 @@ class _HomePageState extends State<HomePage> {
bool celibration = res.data['celibration'];
bool person_info = res.data['person_info'];
bool wifi = res.data['wifi'];
if (!celibration || !person_info || !wifi) {
res.data['device_info'] = element;
userInfoController.device_bind_status.add(res.data);
if (res.data['noTip'] == null || res.data['noTip'] == false) {
if (!celibration || !person_info || !wifi) {
res.data['device_info'] = element;
userInfoController.device_bind_status.add(res.data);
}
}
}
} catch (e) {
@@ -1267,4 +1275,43 @@ class _HomePageState extends State<HomePage> {
print("查询设备绑定列表失败: $e");
}
}
void updateDeviceTipStatus(String mac, Map config, bool noTip) {
try {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": res.data['person_info'],
"noTip": noTip,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
} catch (e) {
ef.log("$e");
}
}
}

View File

@@ -255,7 +255,7 @@ class _MessagePageState extends State<MessagePage> {
10.rpx, // 动态设置左侧位置
child: Container(
width: lineWidth,
height: 4.rpx,
height: 5.rpx,
decoration: BoxDecoration(
color: themeController.currentColor.sc2,
borderRadius:

View File

@@ -208,17 +208,17 @@ class _MinePageState extends State<MinePage> {
final user =
userInfoController
.model.user!;
if (user.email != null &&
user.email!
.isNotEmpty) {
return user.email!;
} else if (user.phone !=
null &&
if (user.phone != null &&
user.phone!
.isNotEmpty) {
return MyUtils
.hidePhoneNumber(
user.phone!);
} else if (user.email !=
null &&
user.email!
.isNotEmpty) {
return user.email!;
} else {
return "微信用户".tr;
}
@@ -690,7 +690,7 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
'V1.0.2511.21',
'V1.0.2512.03',
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),

View File

@@ -41,7 +41,7 @@ class _CommonMessageSettingPageState
String type = "user_message_setting";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
requestWithLog(
logTitle: "查询用户消息配置",
logTitle: "查询用户消息配置11",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
@@ -62,7 +62,7 @@ class _CommonMessageSettingPageState
data: data,
onSuccess: (res) {
requestWithLog(
logTitle: "查询用户消息配置",
logTitle: "查询用户消息配置12",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {

View File

@@ -400,7 +400,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
() {
showHeightPickerDialog(
context,
title: "选择身高".tr,
title: "选择分数".tr,
initialHeight: int.tryParse(
peopleList[index]['height'] ??
'170') ??

View File

@@ -164,6 +164,7 @@ class AuthBindTelController extends GetControllerEx<AuthBindTelModel> {
final data = {
'phone': model.phone,
'verify': model.code,
'merge': true,
};
var response =

View File

@@ -442,6 +442,8 @@ class _UpdateUserPageState extends State<EditUserPage> {
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();
}

View File

@@ -447,7 +447,6 @@ class _EPageState extends State<PersonPage> {
currentHeight.toString()) ??
170
: 170;
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(

View File

@@ -821,3 +821,338 @@ Future<void> showWeightPickerDialog(
);
}
Future<void> showScorePickerDialog(
BuildContext context, {
required int initialHeight,
required Function(int selectedHeight) onConfirm,
String title = "选择分数",
String unit = "", // 单位(可选)
int min = 0, // ✅ 新增:最小值
int max = 100, // ✅ 新增:最大值
}) async {
/// 生成范围min ~ max
List<int> heights = List.generate(max - min + 1, (index) => min + index);
/// 确保初始值在范围内
if (initialHeight < min) initialHeight = min;
if (initialHeight > max) initialHeight = max;
int selectedIndex = heights.indexOf(initialHeight);
final RxInt tempIndex = RxInt(selectedIndex);
ThemeController themeController = Get.find();
await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Stack(
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Material(
color: Colors.transparent,
child: Dialog(
backgroundColor: themeController.currentColor.sc17,
insetPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
child: Container(
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// ------- 顶部标题区域 -------
Container(
padding:
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
color: themeController.currentColor.sc5,
height: 80.rpx,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.only(top: 0),
onTap: () {
Get.back();
},
child: Container(
alignment: Alignment.center,
width: 110.rpx,
height: 60.rpx,
child: Text(
"取消".tr,
style: TextStyle(
fontSize: 30.rpx,
color: Colors.white,
),
),
),
),
Text(
title,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
),
),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.only(top: 0),
onTap: () {
onConfirm(heights[tempIndex.value]);
Get.back();
},
child: Container(
alignment: Alignment.center,
width: 110.rpx,
height: 60.rpx,
child: Text(
"确定".tr,
style: TextStyle(
fontSize: 30.rpx,
color: themeController.currentColor.sc2,
),
),
),
),
],
),
),
SizedBox(height: 20.rpx),
// -------- 中间选择器 --------
Stack(
children: [
Positioned.fill(
child: IgnorePointer(
child: Center(
child: Container(
height: 90.rpx,
margin:
EdgeInsets.symmetric(horizontal: 95.rpx),
decoration: BoxDecoration(
color: themeController.currentColor.sc2,
borderRadius: BorderRadius.circular(16.rpx),
),
),
),
),
),
SizedBox(
height: 240.rpx,
child: getOnePickers(
context,
heights,
tempIndex,
unit: unit, // 使用传入的单位
),
),
],
),
],
),
),
),
),
),
],
);
},
);
}
Future<void> showIntervalPickerDialog(
BuildContext context, {
required int initialValue,
required Function(int selectedValue) onConfirm,
List<int> options = const [], // ✅ 可选值数组(优先级最高)
int min = 0, // 若没有 options则使用 min/max
int max = 100,
int type = 2, // 1=秒2=分钟默认3=小时
String unit = "分钟/次",
String title = "选择间隔",
}) async {
ThemeController themeController = Get.find();
/// ------------------------------------------
/// 计算实际数据源:优先使用 options
/// ------------------------------------------
List<int> values;
if (options.isNotEmpty) {
values = [...options];
} else {
values = List.generate(max - min + 1, (index) => min + index);
}
/// ------------------------------------------
/// 显示转换函数
/// ------------------------------------------
String formatValue(int raw) {
double result;
switch (type) {
case 1: // 秒
result = raw.toDouble();
return "${result.toInt()}秒/次";
case 2: // 分钟
result = raw / 60.0;
break;
case 3: // 小时
result = raw / 3600.0;
break;
default:
result = raw.toDouble();
}
/// 去掉多余的小数,例如 1.0 → 1
String text =
result % 1 == 0 ? result.toInt().toString() : result.toStringAsFixed(1);
return "$text$unit";
}
/// ------------------------------------------
/// 初始 index
/// ------------------------------------------
int initialIndex = values.indexOf(initialValue);
if (initialIndex < 0) initialIndex = 0;
final RxInt tempIndex = RxInt(initialIndex);
await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Stack(
children: [
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Material(
color: Colors.transparent,
child: Dialog(
backgroundColor: themeController.currentColor.sc17,
insetPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0),
),
child: Container(
padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 90.rpx),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
/// ---------------- 顶部标题 ----------------
Container(
padding:
EdgeInsets.fromLTRB(30.rpx, 0.rpx, 30.rpx, 0.rpx),
color: themeController.currentColor.sc5,
height: 80.rpx,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () => Get.back(),
padding: EdgeInsets.all(0),
child: Container(
alignment: Alignment.center,
width: 110.rpx,
height: 60.rpx,
child: Text(
"取消".tr,
style: TextStyle(
fontSize: 30.rpx,
color: Colors.white,
),
),
),
),
Text(
title,
style: TextStyle(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
),
),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () {
onConfirm(values[tempIndex.value]); // 返回原始秒数
Get.back();
},
padding: EdgeInsets.all(0),
child: Container(
alignment: Alignment.center,
width: 110.rpx,
height: 60.rpx,
child: Text(
"确定".tr,
style: TextStyle(
fontSize: 30.rpx,
color: themeController.currentColor.sc2,
),
),
),
),
],
),
),
SizedBox(height: 20.rpx),
/// ---------------- 中间选择器 ----------------
Stack(
children: [
Positioned.fill(
child: IgnorePointer(
child: Center(
child: Container(
height: 90.rpx,
margin:
EdgeInsets.symmetric(horizontal: 95.rpx),
decoration: BoxDecoration(
color: themeController.currentColor.sc2,
borderRadius: BorderRadius.circular(16.rpx),
),
),
),
),
),
SizedBox(
height: 240.rpx,
child: getOnePickers(
context,
values,
tempIndex,
/// → 替换显示文本(核心)
customDisplay: (val) => formatValue(val),
),
),
],
),
],
),
),
),
),
),
],
);
},
);
}

View File

@@ -38,7 +38,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
String type = "user_message_setting";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
requestWithLog(
logTitle: "查询用户消息配置",
logTitle: "查询用户消息配置13",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
@@ -59,7 +59,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
data: data,
onSuccess: (res) {
requestWithLog(
logTitle: "查询用户消息配置",
logTitle: "查询用户消息配置14",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
@@ -188,7 +188,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
children: [
Expanded(
child: Text(
"全部消息".tr,
"全部通知".tr,
style: TextStyle(
color:
themeController.currentColor.sc3,

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: () {},
);
}

View File

@@ -5,6 +5,7 @@ import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/pages/device/BodyDeviceWidget.dart';
import 'package:vbvs_app/pages/device/component/MessageSetting.dart';
import 'package:vbvs_app/pages/device/component/SingleMessageSetting.dart';
import 'package:vbvs_app/pages/device/device_detail.dart';
import 'package:vbvs_app/pages/device/instant_body_page.dart';
import 'package:vbvs_app/pages/device/message_review_page.dart';
@@ -50,7 +51,9 @@ import 'package:vbvs_app/pages/sleep_report/sleep_report_page.dart';
import 'package:vbvs_app/pages/user/about_us_page.dart';
import 'package:vbvs_app/pages/user/privacy_scheme_page.dart';
import 'package:vbvs_app/pages/user/setting_page.dart';
import 'package:vbvs_app/pages/user/update_user_email.dart';
import 'package:vbvs_app/pages/user/update_user_page.dart';
import 'package:vbvs_app/pages/user/update_user_tel.dart';
import 'package:vbvs_app/pages/user/user_scheme_page.dart';
var routes = {
@@ -94,7 +97,9 @@ var routes = {
"/applyRepairPage": (contxt) => ApplyRepairPage(),
"/languageSetting": (contxt) => LanguageSetting(),
"/themeSetting": (contxt) => ThemeSetting(),
"/helpPage": (contxt, {arguments}) => HelpPage( url: arguments,),
"/helpPage": (contxt, {arguments}) => HelpPage(
url: arguments,
),
"/followPage": (contxt) => FollowPage(),
"/repairListPage": (contxt) => RepairListPage(),
"/newSleepReportPage": (contxt, {arguments}) =>
@@ -122,6 +127,11 @@ var routes = {
UserPrivacyNewPage(sleepUri: arguments),
"/privacyPolicyPageNew": (contxt, {arguments}) =>
PrivacyPolicyNewPage(sleepUri: arguments),
"/updateUserTelPage": (contxt) => UpdateUserTelPage(),
"/updateUserEmailPage": (contxt) => UpdateUserEmailPage(),
"/singleMessageSetting": (context, {arguments}) =>
SingleMessageSetting(
data: arguments),
};
var onGenerateRoute = (RouteSettings settings) {
@@ -141,9 +151,8 @@ var onGenerateRoute = (RouteSettings settings) {
settings.name != "/userSchemePage" &&
settings.name != "/privacyPage" &&
settings.name != "/userPolicyPageNew" &&
settings.name != "/privacyPolicyPageNew"&&
settings.name != "/auth_bind_tel"
) {
settings.name != "/privacyPolicyPageNew" &&
settings.name != "/auth_bind_tel") {
TopSlideNotification.show(
Get.context!,
text: "必须登录提示".tr,