更新消息设置
This commit is contained in:
@@ -376,8 +376,8 @@
|
|||||||
"入睡时间": "Sleep time",
|
"入睡时间": "Sleep time",
|
||||||
"睡眠时长": "Sleep duration",
|
"睡眠时长": "Sleep duration",
|
||||||
"起床时间": "Wake time",
|
"起床时间": "Wake time",
|
||||||
"小时": "h",
|
"小时": "hours",
|
||||||
"分钟": "m",
|
"分钟": "minutes",
|
||||||
"消息提醒设置": "Message notification settings",
|
"消息提醒设置": "Message notification settings",
|
||||||
"APP消息": "APP messages",
|
"APP消息": "APP messages",
|
||||||
"APP消息介绍": "Open APP to view device messages",
|
"APP消息介绍": "Open APP to view device messages",
|
||||||
@@ -433,7 +433,7 @@
|
|||||||
"年龄": "Age",
|
"年龄": "Age",
|
||||||
"设备ID": "Device",
|
"设备ID": "Device",
|
||||||
"体重": "Weight",
|
"体重": "Weight",
|
||||||
"分": "",
|
"分": "m",
|
||||||
"位置权限说明": "Location Permission Description",
|
"位置权限说明": "Location Permission Description",
|
||||||
"获得位置信息,连接附近的蓝牙设备与推荐附近门店": "Obtain location information, connect to nearby Bluetooth devices, and recommend nearby stores",
|
"获得位置信息,连接附近的蓝牙设备与推荐附近门店": "Obtain location information, connect to nearby Bluetooth devices, and recommend nearby stores",
|
||||||
"蓝牙权限说明": "Bluetooth Permission Description",
|
"蓝牙权限说明": "Bluetooth Permission Description",
|
||||||
@@ -569,5 +569,43 @@
|
|||||||
"选择城市": "Select City",
|
"选择城市": "Select City",
|
||||||
"请选择城市": "Please select a city",
|
"请选择城市": "Please select a city",
|
||||||
"输入关键词": "Enter keywords",
|
"输入关键词": "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"
|
||||||
}
|
}
|
||||||
@@ -377,7 +377,7 @@
|
|||||||
"起床时间": "起床时间",
|
"起床时间": "起床时间",
|
||||||
"小时": "小时",
|
"小时": "小时",
|
||||||
"分钟": "分钟",
|
"分钟": "分钟",
|
||||||
"消息提醒设置": "消息提醒设置",
|
"消息提醒设置": "消息设置",
|
||||||
"APP消息": "APP消息",
|
"APP消息": "APP消息",
|
||||||
"APP消息介绍": "打开APP,可以查看该设备的消息内容",
|
"APP消息介绍": "打开APP,可以查看该设备的消息内容",
|
||||||
"通用APP消息介绍": "打开APP,可以查看消息内容",
|
"通用APP消息介绍": "打开APP,可以查看消息内容",
|
||||||
@@ -423,8 +423,8 @@
|
|||||||
"退出": "退出",
|
"退出": "退出",
|
||||||
"完成": "完成",
|
"完成": "完成",
|
||||||
"时长": "时长:",
|
"时长": "时长:",
|
||||||
"继续": "继续",
|
"继续": "继续流程",
|
||||||
"下次再说": "下次再说",
|
"下次再说": "跳过",
|
||||||
"发现": "发现!",
|
"发现": "发现!",
|
||||||
"检测到": "检测到",
|
"检测到": "检测到",
|
||||||
"绑定流程未走完是否继续": "绑定流程未走完是否继续?",
|
"绑定流程未走完是否继续": "绑定流程未走完是否继续?",
|
||||||
@@ -569,6 +569,43 @@
|
|||||||
"选择城市": "选择城市",
|
"选择城市": "选择城市",
|
||||||
"请选择城市": "请选择城市",
|
"请选择城市": "请选择城市",
|
||||||
"输入关键词": "输入关键词",
|
"输入关键词": "输入关键词",
|
||||||
"输入国家、省份或城市": "输入国家、省份或城市"
|
"输入国家、省份或城市": "输入国家、省份或城市",
|
||||||
|
"手机号码": "手机号码",
|
||||||
|
"邮箱": "邮箱",
|
||||||
|
"微信": "微信",
|
||||||
|
"更换": "更换",
|
||||||
|
"换绑": "换绑",
|
||||||
|
"绑定": "绑定",
|
||||||
|
"更换手机号码": "更换手机号码",
|
||||||
|
"输入手机号码": "输入手机号码",
|
||||||
|
"请输验证码": "请输验证码",
|
||||||
|
"请输入手机号": "请输入手机号",
|
||||||
|
"原手机号码": "原手机号码",
|
||||||
|
"更换邮箱": "更换邮箱",
|
||||||
|
"实时体征消息": "实时体征消息",
|
||||||
|
"睡眠报告消息": "睡眠报告消息",
|
||||||
|
"已开启": "已开启",
|
||||||
|
"短信消息": "短信消息",
|
||||||
|
"短信消息介绍": "定制该服务可通过手机短信接收消息提醒",
|
||||||
|
"电话语音提醒": "电话语音提醒",
|
||||||
|
"电话语音提醒介绍": "定制该服务可通过手机通话接收消息提醒",
|
||||||
|
"报警条件设置": "报警条件设置",
|
||||||
|
"恢复默认": "恢复默认",
|
||||||
|
"心率小于": "心率小于",
|
||||||
|
"心率大于": "心率大于",
|
||||||
|
"提醒类型": "提醒类型",
|
||||||
|
"全部通知": "全部通知",
|
||||||
|
"离床时间大于": "离床时间大于",
|
||||||
|
"未卧床时间大于": "未卧床时间大于",
|
||||||
|
"未起床时间大于": "未起床时间大于",
|
||||||
|
"睡眠报告评分小于": "睡眠报告评分小于",
|
||||||
|
"呼吸小于": "呼吸小于",
|
||||||
|
"呼吸大于": "呼吸大于",
|
||||||
|
"请先在设置里的消息通知打开APP消息配置": "请先设置“我的”中的消息通知",
|
||||||
|
"间隔报警": "间隔报警",
|
||||||
|
"分钟/次": "分钟/次",
|
||||||
|
"选择分数": "选择分数",
|
||||||
|
"离床时长": "离床时长",
|
||||||
|
"已关闭": "已关闭",
|
||||||
|
"时": "时"
|
||||||
}
|
}
|
||||||
@@ -511,8 +511,8 @@
|
|||||||
"发现": "發現!",
|
"发现": "發現!",
|
||||||
"检测到": "檢測到",
|
"检测到": "檢測到",
|
||||||
"绑定流程未走完是否继续": "綁定流程未走完是否繼續?",
|
"绑定流程未走完是否继续": "綁定流程未走完是否繼續?",
|
||||||
"继续": "繼續",
|
"继续": "繼續流程",
|
||||||
"下次再说": "下次再說",
|
"下次再说": "跳過",
|
||||||
"请输入人员名称": "請輸入人員名稱",
|
"请输入人员名称": "請輸入人員名稱",
|
||||||
"可用wifi": "可用wifi",
|
"可用wifi": "可用wifi",
|
||||||
"一": "一",
|
"一": "一",
|
||||||
@@ -565,5 +565,43 @@
|
|||||||
"选择城市": "選擇城市",
|
"选择城市": "選擇城市",
|
||||||
"请选择城市": "請選擇城市",
|
"请选择城市": "請選擇城市",
|
||||||
"输入关键词": "輸入關鍵詞",
|
"输入关键词": "輸入關鍵詞",
|
||||||
"输入国家、省份或城市": "輸入國家、省份或城市"
|
"输入国家、省份或城市": "輸入國家、省份或城市",
|
||||||
|
"手机号码": "手機號碼",
|
||||||
|
"邮箱": "郵箱",
|
||||||
|
"微信": "微信",
|
||||||
|
"更换": "更換",
|
||||||
|
"换绑": "換綁",
|
||||||
|
"绑定": "綁定",
|
||||||
|
"更换手机号码": "更護手機號碼",
|
||||||
|
"输入手机号码": "輸入手機號碼",
|
||||||
|
"请输验证码": "請輸入驗證碼",
|
||||||
|
"请输入手机号": "請輸入手機號碼",
|
||||||
|
"原手机号码": "原手機號碼",
|
||||||
|
"更换邮箱": "更護郵箱",
|
||||||
|
"实时体征消息": "即時體徵訊息",
|
||||||
|
"睡眠报告消息": "睡眠報告訊息",
|
||||||
|
"已开启": "已開啟",
|
||||||
|
"短信消息": "簡訊訊息",
|
||||||
|
"短信消息介绍": "定制此服務可透過手機簡訊接收訊息提醒",
|
||||||
|
"电话语音提醒": "電話語音提醒",
|
||||||
|
"电话语音提醒介绍": "定制此服務可透過手機通話接收訊息提醒",
|
||||||
|
"报警条件设置": "警報條件設定",
|
||||||
|
"恢复默认": "恢復預設值",
|
||||||
|
"心率小于": "心率小於",
|
||||||
|
"心率大于": "心率大於",
|
||||||
|
"提醒类型": "提醒類型",
|
||||||
|
"全部通知": "全部通知",
|
||||||
|
"离床时间大于": "離床時間大於",
|
||||||
|
"未卧床时间大于": "未臥床時間大於",
|
||||||
|
"未起床时间大于": "未起床時間大於",
|
||||||
|
"睡眠报告评分小于": "睡眠報告評分小於",
|
||||||
|
"呼吸小于": "呼吸小於",
|
||||||
|
"呼吸大于": "呼吸大於",
|
||||||
|
"请先在设置里的消息通知打开APP消息配置": "請先設定「我的」中的訊息通知",
|
||||||
|
"间隔报警": "間隔警報",
|
||||||
|
"分钟/次": "分鐘/次",
|
||||||
|
"选择分数": "選擇分數",
|
||||||
|
"离床时长": "離床時長",
|
||||||
|
"已关闭": "已關閉",
|
||||||
|
"时": "時"
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@ class AppConstants {
|
|||||||
double button_container_radius = 100.rpx; //按钮容器圆角
|
double button_container_radius = 100.rpx; //按钮容器圆角
|
||||||
|
|
||||||
double text_padding_up_dowm_p = 5.rpx; //段落文字上下间距
|
double text_padding_up_dowm_p = 5.rpx; //段落文字上下间距
|
||||||
|
double text_padding = 10.rpx; //段落文字上下间距
|
||||||
|
|
||||||
double smaller_text_fontSize = 18.rpx; //普通文字字号
|
double smaller_text_fontSize = 18.rpx; //普通文字字号
|
||||||
double small_text_fontSize = 20.rpx; //普通文字字号
|
double small_text_fontSize = 20.rpx; //普通文字字号
|
||||||
@@ -63,7 +64,7 @@ class AppConstants {
|
|||||||
int wifi2 = -60;
|
int wifi2 = -60;
|
||||||
int wifi3 = -75;
|
int wifi3 = -75;
|
||||||
|
|
||||||
static bool is_test_account = true; //是否测试账号
|
static bool is_test_account = false; //是否测试账号
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取协议地址
|
//获取协议地址
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ var closeIconWhite = GestureDetector(
|
|||||||
var returnIconButtom = returnIconButtomNew(
|
var returnIconButtom = returnIconButtomNew(
|
||||||
onBack: () {
|
onBack: () {
|
||||||
// ⚡这里写你需要在返回前执行的逻辑
|
// ⚡这里写你需要在返回前执行的逻辑
|
||||||
Get.back();
|
// Get.back();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ class _DynamicReportDetailWidgetState extends State<DynamicReportDetailWidget> {
|
|||||||
SizedBox(height: 33.rpx),
|
SizedBox(height: 33.rpx),
|
||||||
_buildSleepDateWidgets(),
|
_buildSleepDateWidgets(),
|
||||||
SizedBox(height: 20.rpx),
|
SizedBox(height: 20.rpx),
|
||||||
if (!AppConstants.is_test_account) _buildSleepDataModuleWidgets(),
|
if (!AppConstants.is_test_account)
|
||||||
|
Obx(() {
|
||||||
|
return _buildSleepDataModuleWidgets();
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -118,14 +118,82 @@ class BodyDeviceController extends GetControllerEx<BodyDeviceModel> {
|
|||||||
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
|
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 {
|
try {
|
||||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
||||||
String serviceAddress = ServiceConstant.service_address;
|
String serviceAddress = ServiceConstant.service_address;
|
||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
String serviceApi = ServiceConstant.device_list;
|
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 = "";
|
String? language = "";
|
||||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||||
if (mhLanguageController.selectLanguage != null) {
|
if (mhLanguageController.selectLanguage != null) {
|
||||||
@@ -136,13 +204,18 @@ class BodyDeviceController extends GetControllerEx<BodyDeviceModel> {
|
|||||||
language = languageController.selectLanguage.value!.language_code;
|
language = languageController.selectLanguage.value!.language_code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (language != null && language.isNotEmpty) {
|
if (language != null && language.isNotEmpty) {
|
||||||
if (queryUrl.contains("?")) {
|
if (queryParams.isNotEmpty) {
|
||||||
queryUrl += "&lang=$language";
|
queryParams += "&lang=$language";
|
||||||
} else {
|
} else {
|
||||||
queryUrl += "?lang=$language";
|
queryParams = "?lang=$language";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 拼接完整URL
|
||||||
|
String queryUrl = baseUrl + queryParams;
|
||||||
|
|
||||||
var response = await EasyDartModule.dio.get(queryUrl);
|
var response = await EasyDartModule.dio.get(queryUrl);
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
var responseData =
|
var responseData =
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ class LoginModel {
|
|||||||
|
|
||||||
bool? register_agree = false; //是否同意协议
|
bool? register_agree = false; //是否同意协议
|
||||||
|
|
||||||
|
String? updatePhone; //更新绑定手机号
|
||||||
|
String? updateCode; //更新绑定验证码
|
||||||
|
|
||||||
LoginModel();
|
LoginModel();
|
||||||
|
|
||||||
static LoginModel fromJson(Map<String, dynamic> json) =>
|
static LoginModel fromJson(Map<String, dynamic> json) =>
|
||||||
@@ -61,8 +64,6 @@ class LoginController extends GetControllerEx<LoginModel> {
|
|||||||
attr = GetModel(LoginModel()).obs;
|
attr = GetModel(LoginModel()).obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//登录
|
//登录
|
||||||
Future<ApiResponse> login(BuildContext context) async {
|
Future<ApiResponse> login(BuildContext context) async {
|
||||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.登录失败".tr);
|
ApiResponse apiResponse = ApiResponse(code: -1, msg: "其他手机登录页.登录失败".tr);
|
||||||
@@ -197,8 +198,78 @@ class LoginController extends GetControllerEx<LoginModel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//微信登录
|
Future<ApiResponse> getUpdateTelCode(BuildContext context) async {
|
||||||
Future<void> wxLoginSendAuth(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、目前移动应用上微信登录只提供原生的登录方式,需要用户安装微信客户端才能配合使用。
|
1、目前移动应用上微信登录只提供原生的登录方式,需要用户安装微信客户端才能配合使用。
|
||||||
2、对于Android应用,建议总是显示微信登录按钮,当用户手机没有安装微信客户端时,请引导用户下载安装微信客户端。
|
2、对于Android应用,建议总是显示微信登录按钮,当用户手机没有安装微信客户端时,请引导用户下载安装微信客户端。
|
||||||
@@ -218,13 +289,14 @@ class LoginController extends GetControllerEx<LoginModel> {
|
|||||||
.authBy(
|
.authBy(
|
||||||
which: NormalAuth(
|
which: NormalAuth(
|
||||||
scope: 'snsapi_userinfo',
|
scope: 'snsapi_userinfo',
|
||||||
state: 'wechat_sdk_theh_wxlogin',
|
state: 'wechat_sdk_theh_wxlogin' +
|
||||||
|
'${DateTime.now().millisecondsSinceEpoch}',
|
||||||
))
|
))
|
||||||
.then((data) async {
|
.then((data) async {
|
||||||
//返回true表示成功或者false表示失败,这边没有意义从login_controller页面构造函数监听中去处理
|
//返回true表示成功或者false表示失败,这边没有意义从login_controller页面构造函数监听中去处理
|
||||||
debugPrint('msg:$data');
|
debugPrint('msg:$data');
|
||||||
EasyDartModule.logger.error('msg:$data');
|
EasyDartModule.logger.error('msg:$data');
|
||||||
if (data) {
|
if (data && login) {
|
||||||
//登陆成功
|
//登陆成功
|
||||||
await dealBindProcess();
|
await dealBindProcess();
|
||||||
}
|
}
|
||||||
@@ -253,18 +325,29 @@ class LoginController extends GetControllerEx<LoginModel> {
|
|||||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||||
UserInfoController userInfoController = Get.find();
|
UserInfoController userInfoController = Get.find();
|
||||||
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
|
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
|
||||||
if (userInfoController.model.user!.phone == null ||
|
if (apiResponse.data['test'] != null &&
|
||||||
userInfoController.model.user!.phone!.isEmpty) {
|
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 = {
|
Map data = {
|
||||||
'img': "assets/img/bgNoImg.png",
|
'img': "assets/img/bgNoImg.png",
|
||||||
};
|
};
|
||||||
await Get.toNamed("/auth_bind_tel", arguments: data);
|
await Get.toNamed("/auth_bind_tel", arguments: data);
|
||||||
}
|
}
|
||||||
if (userInfoController.model.user!.phone == null ||
|
if ((userInfoController.model.user!.phone == null ||
|
||||||
userInfoController.model.user!.phone!.isEmpty) {
|
userInfoController.model.user!.phone!.isEmpty) &&
|
||||||
|
(userInfoController.model.user!.email == null ||
|
||||||
|
userInfoController.model.user!.email!.isEmpty)) {
|
||||||
userInfoController.model.login = 0;
|
userInfoController.model.login = 0;
|
||||||
|
} else {
|
||||||
|
userInfoController.model.login = 1;
|
||||||
}
|
}
|
||||||
userInfoController.model.login = 1;
|
|
||||||
|
|
||||||
String token = apiResponse.rawResponse.headers['token']!.first;
|
String token = apiResponse.rawResponse.headers['token']!.first;
|
||||||
EasyDartModule.dio.token = token;
|
EasyDartModule.dio.token = token;
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ LoginModel _$LoginModelFromJson(Map<String, dynamic> json) => LoginModel()
|
|||||||
..forceLogin = (json['forceLogin'] as num?)?.toInt()
|
..forceLogin = (json['forceLogin'] as num?)?.toInt()
|
||||||
..isIos = json['isIos'] as bool?
|
..isIos = json['isIos'] as bool?
|
||||||
..isWeChatNotInstalled = json['isWeChatNotInstalled'] 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) =>
|
Map<String, dynamic> _$LoginModelToJson(LoginModel instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
@@ -32,4 +34,6 @@ Map<String, dynamic> _$LoginModelToJson(LoginModel instance) =>
|
|||||||
'isIos': instance.isIos,
|
'isIos': instance.isIos,
|
||||||
'isWeChatNotInstalled': instance.isWeChatNotInstalled,
|
'isWeChatNotInstalled': instance.isWeChatNotInstalled,
|
||||||
'register_agree': instance.register_agree,
|
'register_agree': instance.register_agree,
|
||||||
|
'updatePhone': instance.updatePhone,
|
||||||
|
'updateCode': instance.updateCode,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ class CommonMessageSettingModel {
|
|||||||
int? setting = 0; //总设置 0 关闭 1 开启
|
int? setting = 0; //总设置 0 关闭 1 开启
|
||||||
int? appSetting = 0; //app消息设置
|
int? appSetting = 0; //app消息设置
|
||||||
int? serviceSetting = 0; //服务号消息
|
int? serviceSetting = 0; //服务号消息
|
||||||
|
int? telSetting = 0;//电话语音提醒
|
||||||
|
int? smsSetting = 0;//短信提醒
|
||||||
int? tipSetting = 0; //设备放置说明
|
int? tipSetting = 0; //设备放置说明
|
||||||
int? deviceUpgradeSetting = 0; //设备升级提示
|
int? deviceUpgradeSetting = 0; //设备升级提示
|
||||||
int? deviceIssueSetting = 0; //设备故障提示
|
int? deviceIssueSetting = 0; //设备故障提示
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ CommonMessageSettingModel _$CommonMessageSettingModelFromJson(
|
|||||||
..setting = (json['setting'] as num?)?.toInt()
|
..setting = (json['setting'] as num?)?.toInt()
|
||||||
..appSetting = (json['appSetting'] as num?)?.toInt()
|
..appSetting = (json['appSetting'] as num?)?.toInt()
|
||||||
..serviceSetting = (json['serviceSetting'] 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()
|
..tipSetting = (json['tipSetting'] as num?)?.toInt()
|
||||||
..deviceUpgradeSetting = (json['deviceUpgradeSetting'] as num?)?.toInt()
|
..deviceUpgradeSetting = (json['deviceUpgradeSetting'] as num?)?.toInt()
|
||||||
..deviceIssueSetting = (json['deviceIssueSetting'] as num?)?.toInt()
|
..deviceIssueSetting = (json['deviceIssueSetting'] as num?)?.toInt()
|
||||||
@@ -23,6 +25,8 @@ Map<String, dynamic> _$CommonMessageSettingModelToJson(
|
|||||||
'setting': instance.setting,
|
'setting': instance.setting,
|
||||||
'appSetting': instance.appSetting,
|
'appSetting': instance.appSetting,
|
||||||
'serviceSetting': instance.serviceSetting,
|
'serviceSetting': instance.serviceSetting,
|
||||||
|
'telSetting': instance.telSetting,
|
||||||
|
'smsSetting': instance.smsSetting,
|
||||||
'tipSetting': instance.tipSetting,
|
'tipSetting': instance.tipSetting,
|
||||||
'deviceUpgradeSetting': instance.deviceUpgradeSetting,
|
'deviceUpgradeSetting': instance.deviceUpgradeSetting,
|
||||||
'deviceIssueSetting': instance.deviceIssueSetting,
|
'deviceIssueSetting': instance.deviceIssueSetting,
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ part 'message_setting_controller.g.dart'; // 由json_serializable自动生成的
|
|||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class MessageSettingModel {
|
class MessageSettingModel {
|
||||||
int? setting = 0;//总设置 0 关闭 1 开启
|
int? setting = 0; //总设置 0 关闭 1 开启
|
||||||
int? appSetting = 0;//app消息设置
|
int? appSetting = 0; //app消息设置
|
||||||
int? serviceSetting = 0;//服务号消息
|
int? serviceSetting = 0; //服务号消息
|
||||||
|
List device_type_setting = [];
|
||||||
|
|
||||||
MessageSettingModel();
|
MessageSettingModel();
|
||||||
|
|
||||||
@@ -31,4 +32,9 @@ class MessageSettingController extends GetControllerEx<MessageSettingModel> {
|
|||||||
attr = GetModel(MessageSettingModel()).obs;
|
attr = GetModel(MessageSettingModel()).obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RxMap<String, dynamic> messageType = RxMap<String, dynamic>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'package:EasyDartModule/EasyDartModule.dart';
|
import 'package:EasyDartModule/EasyDartModule.dart';
|
||||||
import 'package:dio/dio.dart' as dio;
|
import 'package:dio/dio.dart' as dio;
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||||
|
import 'package:fluwx/fluwx.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
import 'package:img_picker/img_picker.dart';
|
import 'package:img_picker/img_picker.dart';
|
||||||
import 'package:json_annotation/json_annotation.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/color/app_uri_status.dart';
|
||||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.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/device/body_device_controller.dart';
|
||||||
import 'package:vbvs_app/controller/home/home_controller.dart';
|
import 'package:vbvs_app/controller/home/home_controller.dart';
|
||||||
import 'package:vbvs_app/controller/login/login_controller.dart';
|
import 'package:vbvs_app/controller/login/login_controller.dart';
|
||||||
@@ -67,6 +71,8 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
|
|||||||
List device_bind_status = [];
|
List device_bind_status = [];
|
||||||
int device_bind_flag = 0; //0。未初始化 1.已初始化
|
int device_bind_flag = 0; //0。未初始化 1.已初始化
|
||||||
int initLocationpermission = 0; //未初始化
|
int initLocationpermission = 0; //未初始化
|
||||||
|
FluwxCancelable? fluwxCancelable;
|
||||||
|
final Fluwx fluwx = Fluwx();
|
||||||
|
|
||||||
Future<ApiResponse> uploadImg() async {
|
Future<ApiResponse> uploadImg() async {
|
||||||
EasyDartModule.logger.info("请求上传图片");
|
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("更新用户资料");
|
EasyDartModule.logger.info("更新用户资料");
|
||||||
DailyLogUtils.writeLog("更新用户资料");
|
DailyLogUtils.writeLog("更新用户资料");
|
||||||
try {
|
try {
|
||||||
|
LoginController loginController = Get.find();
|
||||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr);
|
ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr);
|
||||||
UserModel user = model.user!;
|
UserModel user = model.user!;
|
||||||
if (user.tmpNickName == null || user.tmpNickName!.isEmpty) {
|
if (user.tmpNickName == null || user.tmpNickName!.isEmpty) {
|
||||||
apiResponse.msg = "昵称为空".tr;
|
apiResponse.msg = "昵称为空".tr;
|
||||||
return apiResponse;
|
return apiResponse;
|
||||||
}
|
}
|
||||||
// if (user.tmpNickName!.length >= 9) {
|
if ((phone != null && phone.isNotEmpty) ||
|
||||||
// apiResponse.msg = "最长字符为8个字".tr;
|
(email != null && email.isNotEmpty)) {
|
||||||
// return apiResponse;
|
if (loginController.model.updateCode == null ||
|
||||||
// }
|
loginController.model.updateCode!.isEmpty) {
|
||||||
|
apiResponse.msg = "请输验证码".tr;
|
||||||
|
return apiResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
String serviceAddress = ServiceConstant.service_address;
|
String serviceAddress = ServiceConstant.service_address;
|
||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
String serviceApi = ServiceConstant.user_info;
|
String serviceApi = ServiceConstant.user_info;
|
||||||
@@ -168,8 +183,15 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
|
|||||||
"nickName": user.tmpNickName,
|
"nickName": user.tmpNickName,
|
||||||
if (user.tmpHead != null && user.tmpHead!.isNotEmpty)
|
if (user.tmpHead != null && user.tmpHead!.isNotEmpty)
|
||||||
"avatar": user.tmpHead,
|
"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 =
|
var response =
|
||||||
await EasyDartModule.dio.put(queryUrl, data: jsonEncode(data));
|
await EasyDartModule.dio.put(queryUrl, data: jsonEncode(data));
|
||||||
if (apiResponse != null) {
|
if (apiResponse != null) {
|
||||||
@@ -178,6 +200,10 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
|
|||||||
ApiResponse res =
|
ApiResponse res =
|
||||||
ApiResponse.fromJson(responseData, (object) => object);
|
ApiResponse.fromJson(responseData, (object) => object);
|
||||||
MyUtils.formatResponse(res, "保存成功".tr, "保存失败".tr);
|
MyUtils.formatResponse(res, "保存成功".tr, "保存失败".tr);
|
||||||
|
await getUserInfo();
|
||||||
|
model.user!.tmpNickName = model.user!.nick_name;
|
||||||
|
model.user!.tmpHead = model.user!.avatar;
|
||||||
|
updateAll();
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
return ApiResponse(code: -1, msg: "服务器失败".tr);
|
return ApiResponse(code: -1, msg: "服务器失败".tr);
|
||||||
@@ -304,4 +330,40 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
|
|||||||
|
|
||||||
return apiResponse;
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,8 @@ void initServiceAddress() {
|
|||||||
ServiceConstant.baseHost = "zhmht.swes.com.cn:27020";
|
ServiceConstant.baseHost = "zhmht.swes.com.cn:27020";
|
||||||
} else if (AppConstants().ent_type == APPPackageType.TH.code) {
|
} 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 {
|
} else {
|
||||||
//默认
|
//默认
|
||||||
ServiceConstant.baseHost = "vsbst-api.he-info.com";
|
ServiceConstant.baseHost = "vsbst-api.he-info.com";
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ class UserModel {
|
|||||||
int? created_at;
|
int? created_at;
|
||||||
String? email;
|
String? email;
|
||||||
bool? test;
|
bool? test;
|
||||||
bool? fac;//是否测试,可以全部升级
|
bool? fac; //是否测试,可以全部升级
|
||||||
|
bool? bindWx = false;
|
||||||
|
|
||||||
UserModel();
|
UserModel();
|
||||||
static UserModel fromJson(Map<String, dynamic> json) =>
|
static UserModel fromJson(Map<String, dynamic> json) =>
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ UserModel _$UserModelFromJson(Map<String, dynamic> json) => UserModel()
|
|||||||
..created_at = (json['created_at'] as num?)?.toInt()
|
..created_at = (json['created_at'] as num?)?.toInt()
|
||||||
..email = json['email'] as String?
|
..email = json['email'] as String?
|
||||||
..test = json['test'] as bool?
|
..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>{
|
Map<String, dynamic> _$UserModelToJson(UserModel instance) => <String, dynamic>{
|
||||||
'uid': instance.uid,
|
'uid': instance.uid,
|
||||||
@@ -37,4 +38,5 @@ Map<String, dynamic> _$UserModelToJson(UserModel instance) => <String, dynamic>{
|
|||||||
'email': instance.email,
|
'email': instance.email,
|
||||||
'test': instance.test,
|
'test': instance.test,
|
||||||
'fac': instance.fac,
|
'fac': instance.fac,
|
||||||
|
'bindWx': instance.bindWx,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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(
|
Widget getOnePickers(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
List arr,
|
List arr,
|
||||||
@@ -65,6 +125,9 @@ Widget getOnePickers(
|
|||||||
void Function(int)? onChanged,
|
void Function(int)? onChanged,
|
||||||
bool isMonthName = false,
|
bool isMonthName = false,
|
||||||
Key? pickerKey,
|
Key? pickerKey,
|
||||||
|
|
||||||
|
/// ⭐ 新增:可选的自定义显示,但不影响旧用法
|
||||||
|
String Function(dynamic value)? customDisplay,
|
||||||
}) {
|
}) {
|
||||||
ThemeController themeController = Get.find();
|
ThemeController themeController = Get.find();
|
||||||
final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
|
final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
|
||||||
@@ -89,13 +152,26 @@ Widget getOnePickers(
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
bool isSelected = index == selectedIndex.value;
|
bool isSelected = index == selectedIndex.value;
|
||||||
|
|
||||||
// 处理显示文本
|
String value = arr[index].toString();
|
||||||
String displayText;
|
String displayText = "";
|
||||||
if (isMonthName && isEn && arr[index] is int) {
|
|
||||||
displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
|
// ⭐ 1. 优先使用自定义展示
|
||||||
} else {
|
if (customDisplay != null) {
|
||||||
// displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位
|
String? custom = customDisplay(arr[index]);
|
||||||
displayText = "${arr[index]}$unit"; // 中文附带单位
|
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(
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -188,10 +188,9 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
|||||||
final targetPosition = index * (itemHeight + spacing);
|
final targetPosition = index * (itemHeight + spacing);
|
||||||
|
|
||||||
// 根据当前类型选择对应的ScrollController
|
// 根据当前类型选择对应的ScrollController
|
||||||
final currentScrollController =
|
final currentScrollController = bodyDeviceController.model.type == 1
|
||||||
bodyDeviceController.model.type == 1
|
? _myDeviceScrollController
|
||||||
? _myDeviceScrollController
|
: _cloudDeviceScrollController;
|
||||||
: _cloudDeviceScrollController;
|
|
||||||
|
|
||||||
if (currentScrollController.hasClients) {
|
if (currentScrollController.hasClients) {
|
||||||
currentScrollController.animateTo(
|
currentScrollController.animateTo(
|
||||||
@@ -619,8 +618,11 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
|||||||
children: [
|
children: [
|
||||||
// 我的e护页面
|
// 我的e护页面
|
||||||
Obx(() {
|
Obx(() {
|
||||||
final myDeviceList = bodyDeviceController.deviceList.value
|
final myDeviceList = bodyDeviceController
|
||||||
.where((device) => device['type'] == 1 || device['bind_type'] == 1)
|
.deviceList.value
|
||||||
|
.where((device) =>
|
||||||
|
device['type'] == 1 ||
|
||||||
|
device['bind_type'] == 1)
|
||||||
.toList();
|
.toList();
|
||||||
return myDeviceList.isEmpty
|
return myDeviceList.isEmpty
|
||||||
? NullDataWidget()
|
? NullDataWidget()
|
||||||
@@ -643,8 +645,11 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
|||||||
}),
|
}),
|
||||||
// 云关爱页面
|
// 云关爱页面
|
||||||
Obx(() {
|
Obx(() {
|
||||||
final cloudDeviceList = bodyDeviceController.deviceList.value
|
final cloudDeviceList = bodyDeviceController
|
||||||
.where((device) => device['type'] == 2 || device['bind_type'] == 2)
|
.deviceList.value
|
||||||
|
.where((device) =>
|
||||||
|
device['type'] == 2 ||
|
||||||
|
device['bind_type'] == 2)
|
||||||
.toList();
|
.toList();
|
||||||
return cloudDeviceList.isEmpty
|
return cloudDeviceList.isEmpty
|
||||||
? NullDataWidget()
|
? NullDataWidget()
|
||||||
@@ -652,7 +657,8 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
|||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
30.rpx, 26.rpx, 30.rpx, 0),
|
30.rpx, 26.rpx, 30.rpx, 0),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
controller: _cloudDeviceScrollController,
|
controller:
|
||||||
|
_cloudDeviceScrollController,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: cloudDeviceList
|
children: cloudDeviceList
|
||||||
@@ -724,4 +730,4 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
256
lib/pages/device/component/MessageTypeComponent.dart
Normal file
256
lib/pages/device/component/MessageTypeComponent.dart
Normal 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 '未知';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1251
lib/pages/device/component/SingleMessageSetting.dart
Normal file
1251
lib/pages/device/component/SingleMessageSetting.dart
Normal file
File diff suppressed because it is too large
Load Diff
1413
lib/pages/device/component/messageTool.dart
Normal file
1413
lib/pages/device/component/messageTool.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1145,4 +1145,5 @@ class _AfterWifiPagePersonState extends State<AfterWifiPagePerson> {
|
|||||||
onFailure: (res) {},
|
onFailure: (res) {},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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(
|
Future<void> showUnBindTipDialog(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Widget widget, {
|
Widget widget, {
|
||||||
Color? backgroundColor,
|
Color? backgroundColor,
|
||||||
VoidCallback? onConfirm, // “继续”按钮回调
|
VoidCallback? onConfirm, // “继续”按钮回调
|
||||||
VoidCallback? onCancel, // “下次再说”按钮回调
|
VoidCallback? onCancel, // “下次再说”按钮回调
|
||||||
|
bool initialNoTipValue = false, // 初始的"不再提示"值,从外部传入
|
||||||
|
ValueChanged<bool>? onNoTipChanged, // "不再提示"值变化时的回调
|
||||||
}) {
|
}) {
|
||||||
ThemeController themeController = Get.find();
|
ThemeController themeController = Get.find();
|
||||||
BlueteethBindController blueteethBindController = Get.find();
|
// 移除原来的控制器依赖,使用传入的初始值
|
||||||
|
// BlueteethBindController blueteethBindController = Get.find();
|
||||||
|
|
||||||
|
// 使用局部状态管理不再提示的值
|
||||||
|
bool noTipValue = initialNoTipValue;
|
||||||
|
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
barrierColor: Colors.black.withOpacity(0.5),
|
barrierColor: Colors.black.withOpacity(0.5),
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return FrostedDialog(
|
// 使用StatefulBuilder来管理局部状态
|
||||||
blurSigma: 3.0,
|
return StatefulBuilder(
|
||||||
child: Container(
|
builder: (context, setState) {
|
||||||
decoration: BoxDecoration(
|
return FrostedDialog(
|
||||||
color: backgroundColor ?? themeController.currentColor.sc17,
|
blurSigma: 3.0,
|
||||||
borderRadius: BorderRadius.circular(20.0),
|
child: Container(
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
|
color: backgroundColor ?? themeController.currentColor.sc17,
|
||||||
child: Container(
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
width: double.infinity,
|
),
|
||||||
constraints: BoxConstraints(
|
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
|
||||||
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
child: Container(
|
||||||
),
|
width: double.infinity,
|
||||||
child: Column(
|
constraints: BoxConstraints(
|
||||||
mainAxisSize: MainAxisSize.min,
|
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: AlignmentDirectional(0, 0),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
|
||||||
0.rpx, 93.rpx, 0, 30.rpx),
|
|
||||||
child: widget,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Padding(
|
child: Column(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: CustomCard(
|
children: [
|
||||||
borderRadius: AppConstants().button_container_radius,
|
Align(
|
||||||
onTap: () {
|
alignment: AlignmentDirectional(0, 0),
|
||||||
Get.back(); // 关闭对话框
|
child: Padding(
|
||||||
if (onConfirm != null) {
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
onConfirm(); // 调用确认回调
|
0.rpx, 93.rpx, 0, 30.rpx),
|
||||||
}
|
child: widget,
|
||||||
},
|
|
||||||
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:
|
||||||
Padding(
|
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
|
child: CustomCard(
|
||||||
child: CustomCard(
|
borderRadius: AppConstants().button_container_radius,
|
||||||
borderRadius: AppConstants().button_container_radius,
|
onTap: () {
|
||||||
onTap: () {
|
Get.back(); // 关闭对话框
|
||||||
Get.back(); // 关闭对话框
|
if (onConfirm != null) {
|
||||||
if (onCancel != null) {
|
onConfirm(); // 调用确认回调
|
||||||
onCancel(); // 调用取消回调
|
}
|
||||||
}
|
},
|
||||||
},
|
colors: [
|
||||||
colors: [Colors.transparent],
|
themeController.currentColor.sc1,
|
||||||
child: Container(
|
themeController.currentColor.sc2,
|
||||||
width: MediaQuery.sizeOf(context).width,
|
],
|
||||||
height: MediaQuery.sizeOf(context).height * 0.055,
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
width: MediaQuery.sizeOf(context).width,
|
||||||
border: Border.all(
|
height: MediaQuery.sizeOf(context).height * 0.055,
|
||||||
color: Colors.white,
|
constraints: BoxConstraints(
|
||||||
width: 0.5.rpx,
|
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)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
_tapRecognizer2.dispose();
|
_tapRecognizer2.dispose();
|
||||||
_tapRecognizer4.dispose();
|
_tapRecognizer4.dispose();
|
||||||
|
loginController.fluwxCancelable?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +105,9 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|||||||
loginController.fluwxCancelable?.cancel();
|
loginController.fluwxCancelable?.cancel();
|
||||||
// 登录成功移出网络检查监听
|
// 登录成功移出网络检查监听
|
||||||
Checknetwork.subscription?.cancel();
|
Checknetwork.subscription?.cancel();
|
||||||
Get.offAndToNamed("/mianPageBottomChange");
|
if (Get.currentRoute != '/mianPageBottomChange') {
|
||||||
|
Get.offAndToNamed("/mianPageBottomChange");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
||||||
// fluwxCancelable?.cancel();
|
// fluwxCancelable?.cancel();
|
||||||
@@ -119,6 +122,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -625,6 +629,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0),
|
EdgeInsetsDirectional.fromSTEB(0, 26.rpx, 0, 0),
|
||||||
|
|||||||
@@ -64,6 +64,20 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
|
|||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0.rpx,
|
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(),
|
child: returnIconButtomNew(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -163,6 +177,43 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
|
|||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
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(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment:
|
alignment:
|
||||||
|
|||||||
@@ -135,12 +135,14 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
|||||||
Widget _buildLoggedInContent() {
|
Widget _buildLoggedInContent() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (finalUri.isEmpty) {
|
if (finalUri.isEmpty) {
|
||||||
return Center(child: CircularProgressIndicator(
|
return Center(
|
||||||
strokeWidth: 2,
|
child: CircularProgressIndicator(
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
strokeWidth: 2,
|
||||||
themeController.currentColor.sc1,
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
),
|
themeController.currentColor.sc1,
|
||||||
),);
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果设备列表为空
|
// 如果设备列表为空
|
||||||
@@ -166,7 +168,9 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
|||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
InAppWebView(
|
InAppWebView(
|
||||||
initialUrlRequest: URLRequest(url: WebUri(finalUri.value+"?t=${DateTime.now().millisecondsSinceEpoch}")),
|
initialUrlRequest: URLRequest(
|
||||||
|
url: WebUri(finalUri.value +
|
||||||
|
"?t=${DateTime.now().millisecondsSinceEpoch}")),
|
||||||
onLoadStart: (controller, url) {
|
onLoadStart: (controller, url) {
|
||||||
isPageLoading.value = true;
|
isPageLoading.value = true;
|
||||||
},
|
},
|
||||||
@@ -178,12 +182,14 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
|||||||
valueListenable: isPageLoading,
|
valueListenable: isPageLoading,
|
||||||
builder: (context, isLoading, child) {
|
builder: (context, isLoading, child) {
|
||||||
return isLoading
|
return isLoading
|
||||||
? Center(child:CircularProgressIndicator(
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
themeController.currentColor.sc1,
|
themeController.currentColor.sc1,
|
||||||
),
|
),
|
||||||
),)
|
),
|
||||||
|
)
|
||||||
: SizedBox.shrink();
|
: SizedBox.shrink();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -212,55 +218,127 @@ class _EPageState extends State<EPage> with AutomaticKeepAliveClientMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getDeviceList() async {
|
Future<void> getDeviceList() async {
|
||||||
BodyDeviceController bodyDeviceController = Get.find();
|
try {
|
||||||
ApiResponse apiResponse = await bodyDeviceController.getDeviceList();
|
BodyDeviceController bodyDeviceController = Get.find();
|
||||||
|
ApiResponse apiResponse =
|
||||||
|
await bodyDeviceController.getDeviceList(isAllDevice: true);
|
||||||
|
|
||||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||||
List<dynamic> rawList = apiResponse.data;
|
List<dynamic> rawList = apiResponse.data;
|
||||||
|
|
||||||
// 提取 mac 和 person.name
|
// 提取 mac 和 person.name
|
||||||
List<Map<String, dynamic>> newList = rawList.map((item) {
|
List<Map<String, dynamic>> newList = rawList.map((item) {
|
||||||
String mac = item['mac'] ?? '';
|
String mac = item['mac'] ?? '';
|
||||||
String name = (item['person'] != null &&
|
String name = (item['person'] != null &&
|
||||||
item['person']['name'] != null &&
|
item['person']['name'] != null &&
|
||||||
item['person']['name'].toString().trim().isNotEmpty)
|
item['person']['name'].toString().trim().isNotEmpty)
|
||||||
? item['person']['name'] + "_${mac}"
|
? item['person']['name'] + "_${mac}"
|
||||||
: '未命名'.tr + "_${mac}";
|
: '未命名'.tr + "_${mac}";
|
||||||
return {
|
return {
|
||||||
'mac': mac,
|
'mac': mac,
|
||||||
'name': name,
|
'name': name,
|
||||||
};
|
};
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
deviceList.value = newList;
|
deviceList.value = newList;
|
||||||
|
|
||||||
// 拼接参数 person
|
// 拼接参数 person
|
||||||
if (deviceList.isNotEmpty) {
|
if (deviceList.isNotEmpty) {
|
||||||
// JSON 编码整个 deviceList 对象数组
|
// JSON 编码整个 deviceList 对象数组
|
||||||
String personParam = Uri.encodeComponent(jsonEncode(deviceList));
|
String personParam = Uri.encodeComponent(jsonEncode(deviceList));
|
||||||
finalUri.value = "${widget.sleepUri}?person=$personParam";
|
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 {
|
} 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 (language != null && language.isNotEmpty) {
|
||||||
if (finalUri.value.contains("?")) {
|
if (finalUri.value.contains("?")) {
|
||||||
finalUri.value += "&lang=$language";
|
finalUri.value += "&lang=$language";
|
||||||
} else {
|
} else {
|
||||||
finalUri.value += "?lang=$language";
|
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());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1106,7 +1106,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
if (currentIndex >= device_bind_process.length) return;
|
if (currentIndex >= device_bind_process.length) return;
|
||||||
|
|
||||||
String code = device_bind_process[currentIndex]['mac'];
|
String code = device_bind_process[currentIndex]['mac'];
|
||||||
|
|
||||||
showUnBindTipDialog(
|
showUnBindTipDialog(
|
||||||
context,
|
context,
|
||||||
Column(
|
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);
|
device_bind_process.removeAt(currentIndex);
|
||||||
showNextDialog();
|
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 celibration = res.data['celibration'];
|
||||||
bool person_info = res.data['person_info'];
|
bool person_info = res.data['person_info'];
|
||||||
bool wifi = res.data['wifi'];
|
bool wifi = res.data['wifi'];
|
||||||
if (!celibration || !person_info || !wifi) {
|
if (res.data['noTip'] == null || res.data['noTip'] == false) {
|
||||||
res.data['device_info'] = element;
|
if (!celibration || !person_info || !wifi) {
|
||||||
userInfoController.device_bind_status.add(res.data);
|
res.data['device_info'] = element;
|
||||||
|
userInfoController.device_bind_status.add(res.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1267,4 +1275,43 @@ class _HomePageState extends State<HomePage> {
|
|||||||
print("查询设备绑定列表失败: $e");
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class _MessagePageState extends State<MessagePage> {
|
|||||||
|
|
||||||
// 监听切换语言
|
// 监听切换语言
|
||||||
subscription = EventBus().on<SwitchLanguageEvent>().listen((event) {
|
subscription = EventBus().on<SwitchLanguageEvent>().listen((event) {
|
||||||
ef.log("切换语言事件通知:${event.language}");
|
ef.log("切换语言事件通知:${event.language}");
|
||||||
_fetchMessageData();
|
_fetchMessageData();
|
||||||
});
|
});
|
||||||
_fetchMessageData();
|
_fetchMessageData();
|
||||||
@@ -255,7 +255,7 @@ class _MessagePageState extends State<MessagePage> {
|
|||||||
10.rpx, // 动态设置左侧位置
|
10.rpx, // 动态设置左侧位置
|
||||||
child: Container(
|
child: Container(
|
||||||
width: lineWidth,
|
width: lineWidth,
|
||||||
height: 4.rpx,
|
height: 5.rpx,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: themeController.currentColor.sc2,
|
color: themeController.currentColor.sc2,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
|
|||||||
@@ -208,17 +208,17 @@ class _MinePageState extends State<MinePage> {
|
|||||||
final user =
|
final user =
|
||||||
userInfoController
|
userInfoController
|
||||||
.model.user!;
|
.model.user!;
|
||||||
if (user.email != null &&
|
if (user.phone != null &&
|
||||||
user.email!
|
|
||||||
.isNotEmpty) {
|
|
||||||
return user.email!;
|
|
||||||
} else if (user.phone !=
|
|
||||||
null &&
|
|
||||||
user.phone!
|
user.phone!
|
||||||
.isNotEmpty) {
|
.isNotEmpty) {
|
||||||
return MyUtils
|
return MyUtils
|
||||||
.hidePhoneNumber(
|
.hidePhoneNumber(
|
||||||
user.phone!);
|
user.phone!);
|
||||||
|
} else if (user.email !=
|
||||||
|
null &&
|
||||||
|
user.email!
|
||||||
|
.isNotEmpty) {
|
||||||
|
return user.email!;
|
||||||
} else {
|
} else {
|
||||||
return "微信用户".tr;
|
return "微信用户".tr;
|
||||||
}
|
}
|
||||||
@@ -690,7 +690,7 @@ class _MinePageState extends State<MinePage> {
|
|||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'V1.0.2511.21',
|
'V1.0.2512.03',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Inter',
|
fontFamily: 'Inter',
|
||||||
// color: Color(0xFFD9E3EB),
|
// color: Color(0xFFD9E3EB),
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class _CommonMessageSettingPageState
|
|||||||
String type = "user_message_setting";
|
String type = "user_message_setting";
|
||||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||||
requestWithLog(
|
requestWithLog(
|
||||||
logTitle: "查询用户消息配置",
|
logTitle: "查询用户消息配置11",
|
||||||
method: MyHttpMethod.get,
|
method: MyHttpMethod.get,
|
||||||
queryUrl: queryUrl,
|
queryUrl: queryUrl,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
@@ -62,7 +62,7 @@ class _CommonMessageSettingPageState
|
|||||||
data: data,
|
data: data,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
requestWithLog(
|
requestWithLog(
|
||||||
logTitle: "查询用户消息配置",
|
logTitle: "查询用户消息配置12",
|
||||||
method: MyHttpMethod.get,
|
method: MyHttpMethod.get,
|
||||||
queryUrl: queryUrl,
|
queryUrl: queryUrl,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
|||||||
() {
|
() {
|
||||||
showHeightPickerDialog(
|
showHeightPickerDialog(
|
||||||
context,
|
context,
|
||||||
title: "选择身高".tr,
|
title: "选择分数".tr,
|
||||||
initialHeight: int.tryParse(
|
initialHeight: int.tryParse(
|
||||||
peopleList[index]['height'] ??
|
peopleList[index]['height'] ??
|
||||||
'170') ??
|
'170') ??
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ class AuthBindTelController extends GetControllerEx<AuthBindTelModel> {
|
|||||||
final data = {
|
final data = {
|
||||||
'phone': model.phone,
|
'phone': model.phone,
|
||||||
'verify': model.code,
|
'verify': model.code,
|
||||||
|
'merge': true,
|
||||||
};
|
};
|
||||||
|
|
||||||
var response =
|
var response =
|
||||||
|
|||||||
@@ -442,6 +442,8 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
|||||||
userInfoController.model.user!.tmpHead = null;
|
userInfoController.model.user!.tmpHead = null;
|
||||||
userInfoController.model.user!.tmpNickName = null;
|
userInfoController.model.user!.tmpNickName = null;
|
||||||
await userInfoController.getUserInfo();
|
await userInfoController.getUserInfo();
|
||||||
|
userInfoController.model.user!.tmpNickName = userInfoController.model.user!.nick_name;
|
||||||
|
userInfoController.model.user!.tmpHead = userInfoController.model.user!.avatar;
|
||||||
userInfoController.updateAll();
|
userInfoController.updateAll();
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -447,7 +447,6 @@ class _EPageState extends State<PersonPage> {
|
|||||||
currentHeight.toString()) ??
|
currentHeight.toString()) ??
|
||||||
170
|
170
|
||||||
: 170;
|
: 170;
|
||||||
|
|
||||||
FocusScope.of(context)
|
FocusScope.of(context)
|
||||||
.requestFocus(FocusNode());
|
.requestFocus(FocusNode());
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
|
|||||||
@@ -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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
|
|||||||
String type = "user_message_setting";
|
String type = "user_message_setting";
|
||||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
|
||||||
requestWithLog(
|
requestWithLog(
|
||||||
logTitle: "查询用户消息配置",
|
logTitle: "查询用户消息配置13",
|
||||||
method: MyHttpMethod.get,
|
method: MyHttpMethod.get,
|
||||||
queryUrl: queryUrl,
|
queryUrl: queryUrl,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
@@ -59,7 +59,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
|
|||||||
data: data,
|
data: data,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
requestWithLog(
|
requestWithLog(
|
||||||
logTitle: "查询用户消息配置",
|
logTitle: "查询用户消息配置14",
|
||||||
method: MyHttpMethod.get,
|
method: MyHttpMethod.get,
|
||||||
queryUrl: queryUrl,
|
queryUrl: queryUrl,
|
||||||
onSuccess: (res) {
|
onSuccess: (res) {
|
||||||
@@ -188,7 +188,7 @@ class _CommonMessageSettingPageState extends State<CommonMessageSettingPage> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
"全部消息".tr,
|
"全部通知".tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color:
|
||||||
themeController.currentColor.sc3,
|
themeController.currentColor.sc3,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
|
||||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
|
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
|
||||||
|
|||||||
657
lib/pages/user/update_user_email.dart
Normal file
657
lib/pages/user/update_user_email.dart
Normal 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, "****");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,9 +3,12 @@ import 'dart:io';
|
|||||||
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:flutterflow_ui/flutterflow_ui.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/appConstants.dart';
|
||||||
import 'package:vbvs_app/common/color/app_uri_status.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/DailyLogUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
@@ -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/CustomCard.dart';
|
||||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.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/main_bottom/global_controller.dart';
|
||||||
import 'package:vbvs_app/controller/person/person_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/theme_controller/ThemeController.dart';
|
||||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||||
import 'package:vbvs_app/model/api_response.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 {
|
class UpdateUserPage extends StatefulWidget {
|
||||||
const UpdateUserPage({super.key});
|
const UpdateUserPage({super.key});
|
||||||
@@ -42,6 +48,53 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
userInfoController.model.user!.avatar;
|
userInfoController.model.user!.avatar;
|
||||||
userInfoController.model.user!.tmpNickName =
|
userInfoController.model.user!.tmpNickName =
|
||||||
userInfoController.model.user!.nick_name;
|
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
|
@override
|
||||||
@@ -103,6 +156,10 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
userInfoController.model.user!.tmpHead = null;
|
userInfoController.model.user!.tmpHead = null;
|
||||||
userInfoController.model.user!.tmpNickName = null;
|
userInfoController.model.user!.tmpNickName = null;
|
||||||
await userInfoController.getUserInfo();
|
await userInfoController.getUserInfo();
|
||||||
|
userInfoController.model.user!.tmpNickName =
|
||||||
|
userInfoController.model.user!.nick_name;
|
||||||
|
userInfoController.model.user!.tmpHead =
|
||||||
|
userInfoController.model.user!.avatar;
|
||||||
userInfoController.updateAll();
|
userInfoController.updateAll();
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
@@ -142,13 +199,13 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
decoration: BoxDecoration(),
|
decoration: BoxDecoration(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
60.rpx, 0.rpx, 60.rpx, 0.rpx),
|
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
60.rpx, 76.rpx, 60.rpx, 0.rpx),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: MediaQuery.sizeOf(context).width * 0.213,
|
width: MediaQuery.sizeOf(context).width * 0.213,
|
||||||
height: MediaQuery.sizeOf(context).height * 0.098,
|
height: MediaQuery.sizeOf(context).height * 0.098,
|
||||||
@@ -158,6 +215,9 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
),
|
),
|
||||||
decoration: BoxDecoration(),
|
decoration: BoxDecoration(),
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
|
var aa =
|
||||||
|
userInfoController.model.user!.tmpNickName;
|
||||||
|
print(aa);
|
||||||
return getImageWidget(context);
|
return getImageWidget(context);
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
@@ -165,7 +225,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
highlightColor: themeController.currentColor.sc16,
|
highlightColor: themeController.currentColor.sc16,
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
0.rpx, 44.rpx, 0.rpx, 44.rpx),
|
60.rpx, 44.rpx, 60.rpx, 44.rpx),
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
edm.EasyDartModule.logger
|
edm.EasyDartModule.logger
|
||||||
@@ -196,7 +256,7 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(
|
padding: EdgeInsetsDirectional.fromSTEB(
|
||||||
0.rpx, 79.rpx, 0.rpx, 0.rpx),
|
60.rpx, 79.rpx, 60.rpx, 0.rpx),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
decoration: BoxDecoration(
|
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,
|
shape: BoxShape.circle,
|
||||||
),
|
),
|
||||||
child: head == null || head.isEmpty
|
child: head == null || head.isEmpty
|
||||||
? Image.asset(
|
? SvgPicture.asset(
|
||||||
'assets/img/avatar.png',
|
"assets/img/avatar.svg",
|
||||||
fit: BoxFit.cover,
|
|
||||||
)
|
)
|
||||||
: Image.network(
|
: Image.network(
|
||||||
head,
|
head,
|
||||||
@@ -349,4 +660,34 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
|||||||
}
|
}
|
||||||
return Container();
|
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 "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
659
lib/pages/user/update_user_tel.dart
Normal file
659
lib/pages/user/update_user_tel.dart
Normal 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)}";
|
||||||
|
}
|
||||||
|
}
|
||||||
29
lib/pages/user/wx_unbind_dialog.dart
Normal file
29
lib/pages/user/wx_unbind_dialog.dart
Normal 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: () {},
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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/controller/user_info_controller.dart';
|
||||||
import 'package:vbvs_app/pages/device/BodyDeviceWidget.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/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/device_detail.dart';
|
||||||
import 'package:vbvs_app/pages/device/instant_body_page.dart';
|
import 'package:vbvs_app/pages/device/instant_body_page.dart';
|
||||||
import 'package:vbvs_app/pages/device/message_review_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/about_us_page.dart';
|
||||||
import 'package:vbvs_app/pages/user/privacy_scheme_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/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_page.dart';
|
||||||
|
import 'package:vbvs_app/pages/user/update_user_tel.dart';
|
||||||
import 'package:vbvs_app/pages/user/user_scheme_page.dart';
|
import 'package:vbvs_app/pages/user/user_scheme_page.dart';
|
||||||
|
|
||||||
var routes = {
|
var routes = {
|
||||||
@@ -94,7 +97,9 @@ var routes = {
|
|||||||
"/applyRepairPage": (contxt) => ApplyRepairPage(),
|
"/applyRepairPage": (contxt) => ApplyRepairPage(),
|
||||||
"/languageSetting": (contxt) => LanguageSetting(),
|
"/languageSetting": (contxt) => LanguageSetting(),
|
||||||
"/themeSetting": (contxt) => ThemeSetting(),
|
"/themeSetting": (contxt) => ThemeSetting(),
|
||||||
"/helpPage": (contxt, {arguments}) => HelpPage( url: arguments,),
|
"/helpPage": (contxt, {arguments}) => HelpPage(
|
||||||
|
url: arguments,
|
||||||
|
),
|
||||||
"/followPage": (contxt) => FollowPage(),
|
"/followPage": (contxt) => FollowPage(),
|
||||||
"/repairListPage": (contxt) => RepairListPage(),
|
"/repairListPage": (contxt) => RepairListPage(),
|
||||||
"/newSleepReportPage": (contxt, {arguments}) =>
|
"/newSleepReportPage": (contxt, {arguments}) =>
|
||||||
@@ -122,6 +127,11 @@ var routes = {
|
|||||||
UserPrivacyNewPage(sleepUri: arguments),
|
UserPrivacyNewPage(sleepUri: arguments),
|
||||||
"/privacyPolicyPageNew": (contxt, {arguments}) =>
|
"/privacyPolicyPageNew": (contxt, {arguments}) =>
|
||||||
PrivacyPolicyNewPage(sleepUri: arguments),
|
PrivacyPolicyNewPage(sleepUri: arguments),
|
||||||
|
"/updateUserTelPage": (contxt) => UpdateUserTelPage(),
|
||||||
|
"/updateUserEmailPage": (contxt) => UpdateUserEmailPage(),
|
||||||
|
"/singleMessageSetting": (context, {arguments}) =>
|
||||||
|
SingleMessageSetting(
|
||||||
|
data: arguments),
|
||||||
};
|
};
|
||||||
|
|
||||||
var onGenerateRoute = (RouteSettings settings) {
|
var onGenerateRoute = (RouteSettings settings) {
|
||||||
@@ -141,9 +151,8 @@ var onGenerateRoute = (RouteSettings settings) {
|
|||||||
settings.name != "/userSchemePage" &&
|
settings.name != "/userSchemePage" &&
|
||||||
settings.name != "/privacyPage" &&
|
settings.name != "/privacyPage" &&
|
||||||
settings.name != "/userPolicyPageNew" &&
|
settings.name != "/userPolicyPageNew" &&
|
||||||
settings.name != "/privacyPolicyPageNew"&&
|
settings.name != "/privacyPolicyPageNew" &&
|
||||||
settings.name != "/auth_bind_tel"
|
settings.name != "/auth_bind_tel") {
|
||||||
) {
|
|
||||||
TopSlideNotification.show(
|
TopSlideNotification.show(
|
||||||
Get.context!,
|
Get.context!,
|
||||||
text: "必须登录提示".tr,
|
text: "必须登录提示".tr,
|
||||||
|
|||||||
Reference in New Issue
Block a user