diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 28e5666..6960768 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -43,8 +43,8 @@ >>>>>> 13eb25e1c30dcd81c87aa85bcb5306ca0931ed21 flutter.buildMode=debug flutter.versionName=1.0.0 flutter.versionCode=1 diff --git a/assets/img/icon/expand_down.svg b/assets/img/icon/expand_down.svg new file mode 100644 index 0000000..62df4b9 --- /dev/null +++ b/assets/img/icon/expand_down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/img/icon/xiaoyi.svg b/assets/img/icon/xiaoyi.svg index 49bf9f9..66738d1 100644 --- a/assets/img/icon/xiaoyi.svg +++ b/assets/img/icon/xiaoyi.svg @@ -1 +1,5 @@ - \ No newline at end of file +<<<<<<< HEAD + +======= + +>>>>>>> 13eb25e1c30dcd81c87aa85bcb5306ca0931ed21 diff --git a/assets/mhlangs/zh_CN.json b/assets/mhlangs/zh_CN.json index a2bee32..e809a21 100644 --- a/assets/mhlangs/zh_CN.json +++ b/assets/mhlangs/zh_CN.json @@ -12,164 +12,199 @@ "详情": "详情", "人员资料": "人员资料" }, - "请输入手机号":"输入手机号码", - "请输入正确的手机号":"请输入正确的手机号", - "请输入密码":"请输入密码", - "密码格式提示":"1.密码长度必须至少8位\n2.密码需要字母加数字\n3.特殊字符和大写字母至少包含一个", - "请输入确认密码":"请输入确认密码", - "两次密码不一致":"两次密码不一致", - "请输入验证码":"请输入验证码", - "需要同意协议":"需要同意协议", - "请选择登录方式":"请选择登录方式", - "账户不能为空":"账户不能为空", - "密码不能为空":"密码不能为空", - "验证码不能为空":"验证码不能为空", - "密码登录":"密码登录", - "短信登录":"短信登录", - "获取验证码":"获取验证码", - "登录":"登录", - "找回密码":"找回密码", - "注册":"注册", - "我已阅读并同意":"我已阅读并同意", - "与":"与", - "《用户协议》":"《用户协议》", - "《隐私协议》":"《隐私协议》", - "注:首次登录会自动创建账号":"注:首次登录会自动创建账号", - "请输入新密码":"请输入新密码", - "确认新密码":"确认新密码", - "秒":"秒", - "添加一台新设备":"添加一台新设备", - "添加新设备":"添加新设备", - "网络未连接,请开启设备网络后重试":"网络未连接,请开启设备网络后重试", - "提交":"提交", - "发送验证码成功":"发送验证码成功", - "注册成功":"注册成功", - "再按一次退出程序":"再按一次退出程序成功", - "用户拒绝授权":"用户拒绝授权", - "用户取消授权":"用户取消授权", - "未命名":"未命名", - "编辑资料":"编辑资料", - "保存":"保存", - "点击更换头像":"点击更换头像", - "保存失败":"保存失败", - "昵称为空":"昵称为空", - "保存成功":"保存成功", - "请先登录":"请先登录", - "密码修改成功":"密码修改成功", - "未知数据":"-", - "必须登录提示":"请先登录!", - "输入验证码":"输入验证码", - "输入新密码":"输入新密码", - "确认验证码":"确认验证码", - "输入手机号码":"输入手机号码", - "操作成功":"操作成功", - "添加设备":"添加设备", - "扫描中":"扫描中...", - "检索设备":"检索设备", - "搜索":"搜索", - "匹配出的外围设备":"匹配出的外围设备", - "知道了":"知道了", - "蓝牙未开启":"蓝牙未开启", - "请先打开蓝牙在进行设备扫描":"请先打开蓝牙在进行设备扫描", - "等待扫描":"等待扫描", - "默认设备名称":"默认设备名称", - "连接异常":"连接异常", - "蓝牙绑定提示":"用手机进行设备添加时,请打开手机蓝牙搜索,靠近目标位置3米以内进行。", - "蓝牙连接成功":"蓝牙连接成功", - "蓝牙连接失败":"蓝牙连接失败,请重试", - "绑定失败请重试":"绑定失败请重试", - "无法绑定":"无法绑定!", - "无法绑定1":"检测到该设备", - "无法绑定2":"已被绑定", - "无法绑定3":",绑定前请先进行解绑,有疑问请联系客服", - "蓝牙绑定":{ - "标题":"蓝牙绑定", - "扫描":"扫描蓝牙设备中…", - "信号":"最小信号强度", - "搜索提示":"检索设备", - "搜索":"搜索", - "匹配":"匹配出的外围设备", - "信号强度":"信号强度", - "SN":"SN", - "蓝牙地址":"蓝牙地址", - "mac":"mac", - "网络":"网络", - "在线":"在线", - "离线":"离线", - "版本":"版本", - "默认设备名称":"未知设备", - "传感器":"传感器", - "可绑定":"可绑定", - "已被绑定":"已被绑定", - "双人版绑定标题":"该设备为双人版,请选择", - "绑定全部":"绑定全部", - "主设备":"主设备:", - "从设备":"从设备:", - "确定":"确定", - "取消":"取消", - "无法绑定":"无法绑定!", - "无法绑定1":"检测到该设备", - "无法绑定2":"已被绑定", - "无法绑定3":",绑定前请先进行解绑,有疑问请联系客服", - "知道了":"知道了", - "是":"是", - "否":"否", - "确定绑定提示":"确定绑定该设备吗?", - "连接成功":"蓝牙连接成功", - "连接异常":"蓝牙连接异常", - "连接":"连接", - "输入wifi密码":"请输入wifi密码", - "显示密码":"显示", - "不显示密码":"不显示" + "请输入手机号": "输入手机号码", + "请输入正确的手机号": "请输入正确的手机号", + "请输入密码": "请输入密码", + "密码格式提示": "1.密码长度必须至少8位\n2.密码需要字母加数字\n3.特殊字符和大写字母至少包含一个", + "请输入确认密码": "请输入确认密码", + "两次密码不一致": "两次密码不一致", + "请输入验证码": "请输入验证码", + "需要同意协议": "需要同意协议", + "请选择登录方式": "请选择登录方式", + "账户不能为空": "账户不能为空", + "密码不能为空": "密码不能为空", + "验证码不能为空": "验证码不能为空", + "密码登录": "密码登录", + "短信登录": "短信登录", + "获取验证码": "获取验证码", + "登录": "登录", + "找回密码": "找回密码", + "注册": "注册", + "我已阅读并同意": "我已阅读并同意", + "与": "与", + "《用户协议》": "《用户协议》", + "《隐私协议》": "《隐私协议》", + "注:首次登录会自动创建账号": "注:首次登录会自动创建账号", + "请输入新密码": "请输入新密码", + "确认新密码": "确认新密码", + "秒": "秒", + "添加一台新设备": "添加一台新设备", + "添加新设备": "添加新设备", + "网络未连接,请开启设备网络后重试": "网络未连接,请开启设备网络后重试", + "提交": "提交", + "发送验证码成功": "发送验证码成功", + "注册成功": "注册成功", + "再按一次退出程序": "再按一次退出程序成功", + "用户拒绝授权": "用户拒绝授权", + "用户取消授权": "用户取消授权", + "未命名": "未命名", + "编辑资料": "编辑资料", + "保存": "保存", + "点击更换头像": "点击更换头像", + "保存失败": "保存失败", + "昵称为空": "昵称为空", + "保存成功": "保存成功", + "请先登录": "请先登录", + "密码修改成功": "密码修改成功", + "未知数据": "-", + "必须登录提示": "请先登录!", + "输入验证码": "输入验证码", + "输入新密码": "输入新密码", + "确认验证码": "确认验证码", + "输入手机号码": "输入手机号码", + "操作成功": "操作成功", + "添加设备": "添加设备", + "扫描中": "扫描中...", + "检索设备": "检索设备", + "搜索": "搜索", + "匹配出的外围设备": "匹配出的外围设备", + "知道了": "知道了", + "蓝牙未开启": "蓝牙未开启", + "请先打开蓝牙在进行设备扫描": "请先打开蓝牙在进行设备扫描", + "等待扫描": "等待扫描", + "默认设备名称": "默认设备名称", + "连接异常": "连接异常", + "蓝牙绑定提示": "用手机进行设备添加时,请打开手机蓝牙搜索,靠近目标位置3米以内进行。", + "蓝牙连接成功": "蓝牙连接成功", + "蓝牙连接失败": "蓝牙连接失败,请重试", + "绑定失败请重试": "绑定失败请重试", + "无法绑定": "无法绑定!", + "无法绑定1": "检测到该设备", + "无法绑定2": "已被绑定", + "无法绑定3": ",绑定前请先进行解绑,有疑问请联系客服", + "蓝牙绑定": { + "标题": "蓝牙绑定", + "扫描": "扫描蓝牙设备中…", + "信号": "最小信号强度", + "搜索提示": "检索设备", + "搜索": "搜索", + "匹配": "匹配出的外围设备", + "信号强度": "信号强度", + "SN": "SN", + "蓝牙地址": "蓝牙地址", + "mac": "mac", + "网络": "网络", + "在线": "在线", + "离线": "离线", + "版本": "版本", + "默认设备名称": "未知设备", + "传感器": "传感器", + "可绑定": "可绑定", + "已被绑定": "已被绑定", + "双人版绑定标题": "该设备为双人版,请选择", + "绑定全部": "绑定全部", + "主设备": "主设备:", + "从设备": "从设备:", + "确定": "确定", + "取消": "取消", + "无法绑定": "无法绑定!", + "无法绑定1": "检测到该设备", + "无法绑定2": "已被绑定", + "无法绑定3": ",绑定前请先进行解绑,有疑问请联系客服", + "知道了": "知道了", + "是": "是", + "否": "否", + "确定绑定提示": "确定绑定该设备吗?", + "连接成功": "蓝牙连接成功", + "连接异常": "蓝牙连接异常", + "连接": "连接", + "输入wifi密码": "请输入wifi密码", + "显示密码": "显示", + "不显示密码": "不显示" }, - "wifi页":{ - "标题":"WIFI配置", - "跳过":"下一步", - "WLAN":"网络", - "未连接":"未连接", - "已连接":"已连接", - "可用WLAN":"可用WLAN", - "刷新":"刷新", - "密码为空":"密码不能为空", - "配网成功":"配网成功", - "配网失败":"配网失败", - "配网中":"配网中", - "需配网":"请给设备配置网络!" + "wifi页": { + "标题": "WIFI配置", + "跳过": "下一步", + "WLAN": "网络", + "未连接": "未连接", + "已连接": "已连接", + "可用WLAN": "可用WLAN", + "刷新": "刷新", + "密码为空": "密码不能为空", + "配网成功": "配网成功", + "配网失败": "配网失败", + "配网中": "配网中", + "需配网": "请给设备配置网络!" }, - "设备校准":"设备校准", - "离床校准":"离床校准", - "未完成":"未完成", - "已完成":"已完成", - "位置校准":"位置校准", - "床头":"床头", - "离床校准提示":"请校准人员暂时离开床铺且在校准期间保持周围安静", - "位置校准提示":"请校准人员到箭头指定一侧 平躺后点击开始,保持10秒", - "开始校准":"开始校准", - "校准完成":"校准完成!", - "绑定成功":{ - "标题":"绑定完成", - "绑定成功":"配置成功! ", - "分享标题":"是否进行分享?", - "分享内容":"设备绑定成功后,如需对朋友或家人共享我的睡眠情况,可以进行立即分享,分享成功后,对方即可享受查看该设备权限,可以收到该设备的睡眠报告。", - "立即分享":"立即分享", - "返回":"返回" + "设备校准": "设备校准", + "离床校准": "离床校准", + "未完成": "未完成", + "已完成": "已完成", + "位置校准": "位置校准", + "床头": "床头", + "离床校准提示": "请校准人员暂时离开床铺且在校准期间保持周围安静", + "位置校准提示": "请校准人员到箭头指定一侧 平躺后点击开始,保持10秒", + "开始校准": "开始校准", + "校准完成": "校准完成!", + "绑定成功": { + "标题": "绑定完成", + "绑定成功": "配置成功! ", + "分享标题": "是否进行分享?", + "分享内容": "设备绑定成功后,如需对朋友或家人共享我的睡眠情况,可以进行立即分享,分享成功后,对方即可享受查看该设备权限,可以收到该设备的睡眠报告。", + "立即分享": "立即分享", + "返回": "返回" }, - "设置页":{ - "标题":"设置", - "主题模式":"主题模式", - "选择语言":"选择语言", - "关于我们":"关于我们", - "用户协议":"用户协议", - "隐私协议":"隐私协议", - "退出登录":"退出登录", - "注销账号":"注销账号", - "退出成功":"退出成功", - "退出失败":"退出失败" + "设置页": { + "标题": "设置", + "主题模式": "主题模式", + "选择语言": "选择语言", + "关于我们": "关于我们", + "用户协议": "用户协议", + "隐私协议": "隐私协议", + "退出登录": "退出登录", + "注销账号": "注销账号", + "退出成功": "退出成功", + "退出失败": "退出失败" }, "操作成功": "操作成功", "关于我们": "关于我们", "用户协议": "用户协议", "隐私协议": "隐私协议", "退出登录": "退出登录", - "注销账号": "注销账号" + "注销账号": "注销账号", + "我的智能设备": "我的智能设备", + "解绑成功": "解绑成功", + "解绑失败": "解绑失败", + "睡眠隐私": "睡眠隐私", + "睡眠隐私功能": "睡眠隐私功能", + "开始时间": "开始时间", + "结束时间": "结束时间", + "取消": "取消", + "确认": "确认", + "时": "时", + "分": "分", + "选择性别": "选择性别", + "*注:开启睡眠隐私功能后,在设置的时间段内,将不会采集您的睡眠数据。": "*注:开启睡眠隐私功能后,在设置时间段内,将不会采集您的睡眠数据。", + "柔性唤醒": "柔性唤醒", + "睡眠银色": "睡眠隐私", + "睡眠习惯": "睡眠习惯", + "允许对方查看设备": "允许对方查看设备", + "允许对方控制设备": "允许对方控制设备", + "已分享用户": "已分享用户", + "发送邀请": "发送邀请", + "仅允许对方查看该设备": "仅允许对方查看该设备", + "允许对方控制该设备": "允许对方控制该设备", + "点击复制APP下载链接": "点击复制APP下载链接", + "评价": "评价", + "我要评价": "我要评价", + "更新成功": "更新成功", + "更新失败": "更新失败", + "完成": "完成", + "请输入正确的联系人电话": "请输入正确的联系人电话", + "请选择体重": "请输入体重", + "请选择身高": "请输入身高", + "人员资料": "人员资料", + "请输入姓名": "请输入姓名", + "解除分享":"解除分享" + } \ No newline at end of file diff --git a/lib/common/color/appConstants.dart b/lib/common/color/appConstants.dart index 60b737e..7ab9256 100644 --- a/lib/common/color/appConstants.dart +++ b/lib/common/color/appConstants.dart @@ -2,8 +2,9 @@ import 'dart:ui'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/enum/APPPackageType.dart'; -class AppConstants { +class AppConstants { // App-related constants static const int code_time = 60; //验证码倒计时 static const int limit = 10; //分页数量 @@ -46,5 +47,6 @@ class AppConstants { ]; //系统参数 - int ent_type = 1;//1.默认太和 2.欢睡 + //运行打包APP模式 + int ent_type = APPPackageType.TH.code;//1.默认太和 2.欢睡 3.眠花糖 } diff --git a/lib/common/util/DailyLogUtils.dart b/lib/common/util/DailyLogUtils.dart index ecb0276..f1560d9 100644 --- a/lib/common/util/DailyLogUtils.dart +++ b/lib/common/util/DailyLogUtils.dart @@ -26,31 +26,35 @@ class DailyLogUtils { // 写入 info 日志(原 writeLog 保留) static Future writeLog(String content) async { + print("[dailylog-->info] $content]"); await _writeLogWithLevel('INFO', content); } // 写入 warning 日志 static Future writeWarning(String content) async { + print("[dailylog-->waring] $content]"); await _writeLogWithLevel('WARNING', content); } // 写入 error 日志 static Future writeError(String content) async { + print("[dailylog-->error] $content]"); await _writeLogWithLevel('ERROR', content); } // 写入 debug 日志 static Future writeDebug(String content) async { + print("[dailylog-->debug] $content]"); await _writeLogWithLevel('DEBUG', content); } static Future printLog(String content) async { - print("logger--->"+content); + print("logger--->" + content); // await writeLog(content); } // 读取当天日志 - static Future readTodayLog() async { + static Future readTodayLog() async { final file = await _getLogFile(); return await file.readAsString(); } diff --git a/lib/common/util/MyUtils.dart b/lib/common/util/MyUtils.dart index 9cb224e..c73cf20 100644 --- a/lib/common/util/MyUtils.dart +++ b/lib/common/util/MyUtils.dart @@ -382,7 +382,7 @@ var returnIconButtom = IconButton( var returnIconButtomNew = ClickableContainer( backgroundColor: Colors.transparent, highlightColor: Colors.transparent, - padding: EdgeInsets.only(right: 0), + padding: EdgeInsets.fromLTRB(20.rpx, 20.rpx, 20.rpx, 20.rpx), onTap: () => Get.back(), child: Container( // height: 42.rpx, diff --git a/lib/component/base/SleepdateWidget.dart b/lib/component/base/SleepdateWidget.dart index 2aea2a5..2f604b3 100644 --- a/lib/component/base/SleepdateWidget.dart +++ b/lib/component/base/SleepdateWidget.dart @@ -31,10 +31,11 @@ class SleepdateWidget extends StatelessWidget { color: isSelected ? highlightColor : Colors.transparent, // 使用传入的颜色 ), child: Padding( - padding: EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx), + padding: + EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx), child: Container( decoration: BoxDecoration( - color: Color(0xFFDC1C1C), + color: Color(0xFF757575), shape: BoxShape.circle, ), alignment: Alignment.center, diff --git a/lib/controller/device/device_share_controller.dart b/lib/controller/device/device_share_controller.dart index 7e09f47..08854a9 100644 --- a/lib/controller/device/device_share_controller.dart +++ b/lib/controller/device/device_share_controller.dart @@ -52,16 +52,16 @@ class DeviceShareController extends GetControllerEx { String serviceApi = ServiceConstant.device_type; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String? language = ""; - if (languageController.selectLanguage != null) { - language = languageController.selectLanguage.value!.language_code; - } - if (language != null && language.isNotEmpty) { - if (queryUrl.contains("?")) { - queryUrl += "&lang=$language"; - } else { - queryUrl += "?lang=$language"; - } - } + 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 = @@ -100,16 +100,16 @@ class DeviceShareController extends GetControllerEx { String serviceApi = ServiceConstant.device_share; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String? language = ""; - if (languageController.selectLanguage != null) { - language = languageController.selectLanguage.value!.language_code; - } - if (language != null && language.isNotEmpty) { - if (queryUrl.contains("?")) { - queryUrl += "&lang=$language"; - } else { - queryUrl += "?lang=$language"; - } + 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 = {"type": 1, "userName": account.value, "mac": mac}; var response = await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data)); @@ -158,16 +158,16 @@ class DeviceShareController extends GetControllerEx { String serviceApi = ServiceConstant.device_share; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String? language = ""; - if (languageController.selectLanguage != null) { - language = languageController.selectLanguage.value!.language_code; - } - if (language != null && language.isNotEmpty) { - if (queryUrl.contains("?")) { - queryUrl += "&lang=$language"; - } else { - queryUrl += "?lang=$language"; - } + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + if (language != null && language.isNotEmpty) { + if (queryUrl.contains("?")) { + queryUrl += "&lang=$language"; + } else { + queryUrl += "?lang=$language"; } + } final data = { "code": shareCode, }; diff --git a/lib/controller/mh_controller/address_controller.dart b/lib/controller/mh_controller/address_controller.dart index f675ffe..cf48d39 100644 --- a/lib/controller/mh_controller/address_controller.dart +++ b/lib/controller/mh_controller/address_controller.dart @@ -3,13 +3,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_city_picker/model/address.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:lpinyin/lpinyin.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/model/user_data.dart'; -import 'package:lpinyin/lpinyin.dart'; +// import 'package:lpinyin/lpinyin.dart'; part 'address_controller.g.dart'; @JsonSerializable() @@ -209,6 +210,7 @@ class AddressController extends GetControllerEx { // 工具:中文首字母转大写英文(你也可以用更专业的拼音库) String _getLetter(String name) { + // return name; if (name.isEmpty) return "#"; String pinyin = PinyinHelper.getPinyinE(name, separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE); diff --git a/lib/controller/mh_controller/device_list_controller.dart b/lib/controller/mh_controller/device_list_controller.dart index 17e523a..d9ada96 100644 --- a/lib/controller/mh_controller/device_list_controller.dart +++ b/lib/controller/mh_controller/device_list_controller.dart @@ -8,6 +8,7 @@ import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/controller/mh_controller/device.dart'; import 'package:vbvs_app/model/api_response.dart'; @@ -19,7 +20,6 @@ class DeviceListModel { //设备列表 List deviceList = []; - @JsonKey(ignore: true) String? keyword; @JsonKey(ignore: true) @@ -39,8 +39,8 @@ class DeviceListController extends GetControllerEx { getDeviceList() async { try { String search = (model.keyword != null && model.keyword!.isNotEmpty) - ? "?key=${model.keyword}" - : ""; + ? "?key=${model.keyword}&ncs=1" + : "?ncs=1"; ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); String serviceAddress = ServiceConstant.service_address; String serviceName = ServiceConstant.server_service; @@ -70,4 +70,35 @@ class DeviceListController extends GetControllerEx { } return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement } + +//主动解绑设备 + Future unbindDevice(Map device) async { + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.device_bind; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + String msg = ''; + int type = device['bind_type']; + await requestWithLog( + logTitle: '解绑设备', + method: MyHttpMethod.delete, + queryUrl: queryUrl, + data: {"mac": device['mac']}, + onSuccess: (res) { + if (type == 1) { + msg = '解绑成功'.tr; + } else { + msg = '删除成功'.tr; + } + }, + onFailure: (res) { + if (type == 1) { + msg = '解绑失败'.tr; + } else { + msg = '删除失败'.tr; + } + }, + ); + return msg; + } } diff --git a/lib/controller/mh_controller/mhdevice_share_controller.dart b/lib/controller/mh_controller/mhdevice_share_controller.dart index 0dd2c41..b3d24b8 100644 --- a/lib/controller/mh_controller/mhdevice_share_controller.dart +++ b/lib/controller/mh_controller/mhdevice_share_controller.dart @@ -1,19 +1,28 @@ +import 'dart:convert'; + +import 'package:EasyDartModule/EasyDartModule.dart'; import 'package:dio/dio.dart'; import 'package:dio/src/form_data.dart' as formdata; import 'package:ef/ef.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:vbvs_app/common/color/ServiceConstant.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/MyUtils.dart'; +import 'package:vbvs_app/common/util/requestWithLog.dart'; +import 'package:vbvs_app/model/api_response.dart'; part 'mhdevice_share_controller.g.dart'; @JsonSerializable() class MHDeviceShareModel { - String? phone; + String? account; int? type = 1; String? msg; int? show = 0; - + int? code = 0; int limit = AppConstants.limit; int offset = 0; bool isLoading = false; @@ -37,86 +46,142 @@ class MHDeviceShareController extends GetControllerEx { attr = GetModel(MHDeviceShareModel()).obs; } + // RxString account = "".obs; + // RxString msg = "".obs; + // RxInt code = 0.obs; @override - void onInit() { + Future onInit() async { super.onInit(); - model.shareUser = [ - { - 'userName': '张三', - 'opType': 1, // 允许控制 - }, - { - 'userName': '李四', - 'opType': 2, // 仅查看 - }, - { - 'userName': '王五', - 'opType': 1, - }, - ]; - update(); // 刷新UI + await shareDeviceList(Get.arguments["mac"]); } - // Future sendInvite(String? phone, String mac) async { - // if (phone == null || phone.isEmpty) { - // return "手机号不能为空"; - // } - // if (!MyUtils.isValidPhoneNumber(phone)) { - // return "手机号格式不正确"; - // } - // var type = model.type; - // try { - // var aa = await ApiService.requestNoInfo.post("/api/device/info/share", - // data: formdata.FormData.fromMap( - // {"mac": mac, "tel": phone, "type": type})); - // return ""; - // } catch (e) { - // if (e is DioError) { - // // 返回 DioError 的 message 属性 - // return e.message!; - // } else { - // // 处理其他类型的错误 - // return e.toString(); - // } - // } - // } + Future shareDevice(String mac) async { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr); + EasyDartModule.logger.info("分享设备"); + DailyLogUtils.writeLog("分享设备"); + try { + model.account = model.account!.trim(); + if (model.account == null || model.account!.isEmpty) { + apiResponse.msg = "请输入手机号".tr; + return apiResponse; + } + if (!MyUtils.isValidPhoneNumber(model.account!) && + !MyUtils.isValidEmail(model.account!)) { + apiResponse.msg = '请输入正确的手机号/邮箱号'.tr; + return apiResponse; + } + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.device_share; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + String? language = ""; + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + if (language != null && language.isNotEmpty) { + if (queryUrl.contains("?")) { + queryUrl += "&lang=$language"; + } else { + queryUrl += "?lang=$language"; + } + } + var data = {"type": model.type, "userName": model.account, "mac": mac}; + 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; + } + } + if (res.code != HttpStatusCodes.ok) { + model.msg = res.msg!; + } + model.code = res.code!; + updateAll(); + return res; + } else { + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } + } catch (e) { + EasyDartModule.logger.info("分享设备失败:${e.toString()}"); + DailyLogUtils.writeLog("分享设备失败:${e.toString()}"); + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } + } - // Future initData() async { - // //todo 请求分享列表 - // var deviceController = Get.find(); - // var query = { - // "mac": deviceController.model.deviceMain['mac'], - // }; - // var data = await ApiService.request - // .get("/api/device/info/share", data: formdata.FormData.fromMap(query)); + shareDeviceList(String mac) async { + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.device_share; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?mac=$mac"; + await requestWithLog( + logTitle: '分享用户列表', + method: MyHttpMethod.get, + queryUrl: queryUrl, + onSuccess: (res) => { + model.shareUser = res.data, + updateAll(), + }, + ); + } - // if (data.data["data"] != null) { - // try { - // List tmp = data.data["data"] as List; - // model.shareUser = tmp; - // } catch (e) { - // print(e); - // } - // } else { - // model.shareUser = []; - // } - // updateAll(); - // } - - // //保存 - // saveShareDevice(Map shareInfo, RxInt type) async { - // return await ApiService.request.put("/api/device/info/share", - // data: formdata.FormData.fromMap({ - // "mac": shareInfo['mac'], - // "tel": shareInfo['tel'], - // "type": type.value - // })); - // } - - // //删除 - // deleteShare(Map shareInfo) async { - // return await ApiService.request.delete("/api/device/info/share", - // data: formdata.FormData.fromMap( - // {"mac": shareInfo['mac'], "tel": shareInfo['tel']})); - // } + Future confirmShare(String shareCode) async { + EasyDartModule.logger.info("确认消息分享"); + DailyLogUtils.writeLog("确认消息分享"); + try { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr); + if (shareCode == null || shareCode.isEmpty) { + apiResponse.msg = "请求失败".tr; + return apiResponse; + } + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.device_share; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + String? language = ""; + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + if (language != null && language.isNotEmpty) { + if (queryUrl.contains("?")) { + queryUrl += "&lang=$language"; + } else { + queryUrl += "?lang=$language"; + } + } + final data = { + "code": shareCode, + }; + var response = + await EasyDartModule.dio.put(queryUrl, data: jsonEncode(data)); + if (response != null) { + if (response.data['code'] != HttpStatusCodes.ok) { + apiResponse.msg = response.data['msg']; + apiResponse.code = response.data['code']; + return apiResponse; + } + var responseData = + response.data is String ? jsonDecode(response.data) : response.data; + ApiResponse res = + ApiResponse.fromJson(responseData, (object) => object); + MyUtils.formatResponse(res, "操作成功".tr, "操作失败".tr); + return res; + } else { + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } + } catch (e) { + EasyDartModule.logger.info("确认消息分享失败->$e"); + DailyLogUtils.writeLog("确认消息分享失败->$e"); + return ApiResponse(code: -1, msg: "服务器.失败".tr); + } + } } diff --git a/lib/controller/mh_controller/mhdevice_share_controller.g.dart b/lib/controller/mh_controller/mhdevice_share_controller.g.dart index 454795c..4cceecd 100644 --- a/lib/controller/mh_controller/mhdevice_share_controller.g.dart +++ b/lib/controller/mh_controller/mhdevice_share_controller.g.dart @@ -8,10 +8,11 @@ part of 'mhdevice_share_controller.dart'; MHDeviceShareModel _$MHDeviceShareModelFromJson(Map json) => MHDeviceShareModel() - ..phone = json['phone'] as String? + ..account = json['account'] as String? ..type = (json['type'] as num?)?.toInt() ..msg = json['msg'] as String? ..show = (json['show'] as num?)?.toInt() + ..code = (json['code'] as num?)?.toInt() ..limit = (json['limit'] as num).toInt() ..offset = (json['offset'] as num).toInt() ..isLoading = json['isLoading'] as bool @@ -21,10 +22,11 @@ MHDeviceShareModel _$MHDeviceShareModelFromJson(Map json) => Map _$MHDeviceShareModelToJson(MHDeviceShareModel instance) => { - 'phone': instance.phone, + 'account': instance.account, 'type': instance.type, 'msg': instance.msg, 'show': instance.show, + 'code': instance.code, 'limit': instance.limit, 'offset': instance.offset, 'isLoading': instance.isLoading, diff --git a/lib/controller/mh_controller/repair_list_controller.dart b/lib/controller/mh_controller/repair_list_controller.dart index 4661862..1d5f589 100644 --- a/lib/controller/mh_controller/repair_list_controller.dart +++ b/lib/controller/mh_controller/repair_list_controller.dart @@ -39,7 +39,7 @@ class RepairListController extends GetControllerEx { String serviceName = ServiceConstant.server_service; String serviceApi = ServiceConstant.submit_repair; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; - requestWithLog( + await requestWithLog( logTitle: "查询报修数据", method: MyHttpMethod.get, queryUrl: queryUrl, diff --git a/lib/controller/mh_controller/repair_list_controller.g.dart b/lib/controller/mh_controller/repair_list_controller.g.dart index 0e260c6..274e511 100644 --- a/lib/controller/mh_controller/repair_list_controller.g.dart +++ b/lib/controller/mh_controller/repair_list_controller.g.dart @@ -12,9 +12,7 @@ RepairListModel _$RepairListModelFromJson(Map json) => ..offset = (json['offset'] as num).toInt() ..isLoading = json['isLoading'] as bool ..hasMore = json['hasMore'] as bool - ..repairList = (json['repairList'] as List) - .map((e) => ApplyRepairModel.fromJson(e as Map)) - .toList(); + ..repairList = json['repairList'] as List; Map _$RepairListModelToJson(RepairListModel instance) => { diff --git a/lib/enum/APPPackageType.dart b/lib/enum/APPPackageType.dart new file mode 100644 index 0000000..cc32653 --- /dev/null +++ b/lib/enum/APPPackageType.dart @@ -0,0 +1,11 @@ +enum APPPackageType { + TH(1, '太和'), + HUANSHUI(2, '欢睡'), + MHT(3, '眠花糖'), + ; + + final int code; + final String description; + + const APPPackageType(this.code, this.description); +} diff --git a/lib/main.dart b/lib/main.dart index 60faf3d..2b6fd41 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,7 +12,6 @@ import 'package:fluwx/fluwx.dart'; import 'package:get_storage/get_storage.dart'; import 'package:localstorage/localstorage.dart'; import 'package:syncfusion_localizations/syncfusion_localizations.dart'; -import 'package:vbvs_app/common/color/AppGlobal.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/util/CheckNetwork.dart'; import 'package:vbvs_app/common/util/CommonVariables.dart'; @@ -194,8 +193,6 @@ void initEasyDartModule() { //初始化 } - - Future initLogin() async { // 初始化控制器 Get.put(UserInfoController()); @@ -358,6 +355,8 @@ class MyApp extends StatelessWidget { Get.lazyPut(() => MHTDeviceCalibrationController()), Get.lazyPut(() => SleepReportController()), Get.lazyPut(() => CalendarController()), + Get.lazyPut(() => UserPdfController()), + Get.lazyPut(() => PrivacyPdfController()), Get.put(WebviewTestController()), ])); } diff --git a/lib/pages/common/selectDialog.dart b/lib/pages/common/selectDialog.dart index 52591c7..3284ddf 100644 --- a/lib/pages/common/selectDialog.dart +++ b/lib/pages/common/selectDialog.dart @@ -714,13 +714,13 @@ Future showDayTimeSelectionDialog( width: 100.rpx, height: 60.rpx, alignment: Alignment.center, - child: Text("取消", + child: Text("取消".tr, style: TextStyle( fontSize: 30.rpx, color: Colors.white)), ), ), Text( - title, + title.tr, style: TextStyle( fontFamily: 'Readex Pro', color: themeController.currentColor.sc3, @@ -742,7 +742,7 @@ Future showDayTimeSelectionDialog( width: 100.rpx, height: 60.rpx, alignment: Alignment.center, - child: Text("确认", + child: Text("确认".tr, style: TextStyle( fontSize: 30.rpx, color: Colors.white)), ), @@ -778,7 +778,7 @@ Future showDayTimeSelectionDialog( context, hours, hoursIndex, - unit: "时", + unit: "时".tr, ), ), Expanded( @@ -786,7 +786,7 @@ Future showDayTimeSelectionDialog( context, minutes, minutesIndex, - unit: "分", + unit: "分".tr, ), ), ], @@ -856,12 +856,12 @@ Future showOneSelectionDialog( alignment: Alignment.center, width: 100.rpx, height: 60.rpx, - child: Text("取消", + child: Text("取消".tr, style: TextStyle( fontSize: 30.rpx, color: Colors.white)), ), ), - Text(title, + Text(title.tr, style: TextStyle( fontFamily: 'Readex Pro', color: Colors.white, @@ -879,7 +879,7 @@ Future showOneSelectionDialog( alignment: Alignment.center, width: 100.rpx, height: 60.rpx, - child: Text("确认", + child: Text("确认".tr, style: TextStyle( fontSize: 30.rpx, color: Colors.white)), ), diff --git a/lib/pages/device_bind/componnet/bind_dialog.dart b/lib/pages/device_bind/componnet/bind_dialog.dart index eb7856e..090182c 100644 --- a/lib/pages/device_bind/componnet/bind_dialog.dart +++ b/lib/pages/device_bind/componnet/bind_dialog.dart @@ -1128,3 +1128,235 @@ Future showUnBindTipDialog( }, ); } + +Future showUnbindConfirmDialog({ + required BuildContext context, + required VoidCallback onConfirm, + required VoidCallback onCancel, + required String title, +}) async { + await showDialog( + context: context, + barrierDismissible: true, + builder: (BuildContext context) { + return FrostedDialog( + blurSigma: 3.0, + child: Container( + width: 520.rpx, + height: 460.rpx, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20.0), + ), + child: Padding( + padding: EdgeInsets.only( + left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: TextStyle( + fontSize: 30.rpx, + color: Colors.black, + ), + ), + const SizedBox(height: 12), + RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle(fontSize: 26.rpx, color: Colors.black87), + children: [ + TextSpan( + text: '该设备只可被一个用户绑定,', + style: TextStyle(fontSize: 26.rpx)), + TextSpan( + text: '解绑后', + style: TextStyle(color: Colors.red, fontSize: 26.rpx), + ), + TextSpan( + text: '其他用户才可以绑定', + style: TextStyle(fontSize: 26.rpx)), + ], + ), + ), + const SizedBox(height: 24), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomCard( + gradientDirection: GradientDirection.vertical, + borderRadius: 16.rpx, + onTap: () { + Get.back(); + onCancel(); + }, + colors: [ + Color(0xFF1592AA), + Color(0XFF0C83A7), + Color(0XFF006FA3) + ], + child: Container( + width: 200.rpx, + height: 90.rpx, + alignment: Alignment.center, + child: Text( + '取消', + style: TextStyle( + fontSize: 26.rpx, color: Colors.white), + ), + )), + CustomCard( + borderRadius: 16.rpx, + onTap: () { + Get.back(); + onConfirm(); + }, + colors: [ + Color(0xFF1592AA), + Color(0XFF0C83A7), + Color(0XFF006FA3) + ], + child: Container( + width: 200.rpx, + height: 90.rpx, + alignment: Alignment.center, + child: Text( + '解绑', + style: TextStyle( + fontSize: 26.rpx, color: Colors.white), + ), + )) + // _buildButton( + // text: '解绑', + // onPressed: () { + // Navigator.pop(context); + // onConfirm(); + // }, + // isGradient: true, + // ), + ], + ) + ], + ), + ), + )); + }, + ); +} + +Future showDeleteDeviceConfirmDialog({ + required BuildContext context, + required VoidCallback onConfirm, + required VoidCallback onCancel, + required String title, +}) async { + await showDialog( + context: context, + barrierDismissible: true, + builder: (BuildContext context) { + return FrostedDialog( + blurSigma: 3.0, + child: Container( + width: 520.rpx, + height: 460.rpx, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20.0), + ), + child: Padding( + padding: EdgeInsets.only( + left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: TextStyle( + fontSize: 30.rpx, + color: Colors.black, + ), + ), + const SizedBox(height: 12), + RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: TextStyle(fontSize: 26.rpx, color: Colors.black87), + children: [ + TextSpan( + text: '删除后,', + style: + TextStyle(color: Colors.red, fontSize: 26.rpx)), + TextSpan( + text: '该设备的历史数据将被清除', + style: TextStyle(fontSize: 26.rpx), + ), + ], + ), + ), + const SizedBox(height: 24), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CustomCard( + gradientDirection: GradientDirection.vertical, + borderRadius: 16.rpx, + onTap: () { + Get.back(); + onCancel(); + }, + colors: [ + Color(0xFF1592AA), + Color(0XFF0C83A7), + Color(0XFF006FA3) + ], + child: Container( + width: 200.rpx, + height: 90.rpx, + alignment: Alignment.center, + child: Text( + '取消', + style: TextStyle( + fontSize: 26.rpx, color: Colors.white), + ), + )), + CustomCard( + borderRadius: 16.rpx, + onTap: () { + Get.back(); + onConfirm(); + }, + colors: [ + Color(0xFF1592AA), + Color(0XFF0C83A7), + Color(0XFF006FA3) + ], + child: Container( + width: 200.rpx, + height: 90.rpx, + alignment: Alignment.center, + child: Text( + '删除', + style: TextStyle( + fontSize: 26.rpx, color: Colors.white), + ), + )) + // _buildButton( + // text: '解绑', + // onPressed: () { + // Navigator.pop(context); + // onConfirm(); + // }, + // isGradient: true, + // ), + ], + ) + ], + ), + ), + )); + }, + ); +} diff --git a/lib/pages/main_bottom/component/main_page_b_bottom_change.dart b/lib/pages/main_bottom/component/main_page_b_bottom_change.dart index b91780e..12d1f4e 100644 --- a/lib/pages/main_bottom/component/main_page_b_bottom_change.dart +++ b/lib/pages/main_bottom/component/main_page_b_bottom_change.dart @@ -1,12 +1,32 @@ +import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart'; import 'package:vbvs_app/pages/mh_page/MattressControl.dart'; -import 'package:vbvs_app/pages/mh_page/device_list.dart'; import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page.dart'; import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart'; import 'package:vbvs_app/pages/mh_page/new_mine_page.dart'; +import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; class MainPageBBottomChange extends StatefulWidget { + // 全局 key,用于静态访问 _HomePageState + static final GlobalKey<_HomePageState> globalKey = + GlobalKey<_HomePageState>(); + + MainPageBBottomChange({Key? key}) : super(key: globalKey); + + // 静态方法:外部调用,跳转 tab + static void jumpTo(int index) { + final state = globalKey.currentState; + if (state != null) { + state.switchTab(index); + } + } + + static int? getCurrentIndex() { + final state = globalKey.currentState; + return state?.selectedIndex; + } + @override _HomePageState createState() => _HomePageState(); } @@ -55,6 +75,7 @@ class _HomePageState extends State void _onTabTapped(int index) { setState(() { + dealWebSource(index); final begin = currentPosition; final end = index.toDouble(); _positionAnimation = Tween(begin: begin, end: end).animate( @@ -95,4 +116,31 @@ class _HomePageState extends State ), ); } + + void switchTab(int index) { + final begin = currentPosition; + final end = index.toDouble(); + + _positionAnimation = Tween(begin: begin, end: end).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeOut), + )..addListener(() { + setState(() {}); + }); + + _controller.forward(from: 0.0); + currentPosition = end; + + setState(() { + selectedIndex = index; + }); + } + + Future dealWebSource(int index) async { + WebviewTestController webviewTestController = Get.find(); + if (index == 2) { + await webviewTestController.web.jsbridge?.dart.pageActive(); + } else { + await webviewTestController.web.jsbridge?.dart.pageInActive(); + } + } } diff --git a/lib/pages/mh_page/BackMovement.dart b/lib/pages/mh_page/BackMovement.dart index 1c6432f..ef27e30 100644 --- a/lib/pages/mh_page/BackMovement.dart +++ b/lib/pages/mh_page/BackMovement.dart @@ -49,7 +49,7 @@ class _BackMovementPageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/HomeDeviceType.dart b/lib/pages/mh_page/HomeDeviceType.dart index 0164214..808458b 100644 --- a/lib/pages/mh_page/HomeDeviceType.dart +++ b/lib/pages/mh_page/HomeDeviceType.dart @@ -58,7 +58,7 @@ class _HomeDeviceTypeState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtom, ), ], diff --git a/lib/pages/mh_page/LanguagePage.dart b/lib/pages/mh_page/LanguagePage.dart index e71616e..3040719 100644 --- a/lib/pages/mh_page/LanguagePage.dart +++ b/lib/pages/mh_page/LanguagePage.dart @@ -12,16 +12,16 @@ class LanguagePage extends GetView { // } MHLanguageController controller = Get.find(); BoxConstraints? bodysize; - List languageList = [ - '简体中文', - '繁體中文', - 'English', - ]; - final Map languageMap = { - '简体中文': 'zh_CN', - '繁體中文': 'zh_TW', - 'English': 'en_US', - }; + // List languageList = [ + // '简体中文', + // '繁體中文', + // 'English', + // ]; + // final Map languageMap = { + // '简体中文': 'zh_CN', + // '繁體中文': 'zh_TW', + // 'English': 'en_US', + // }; // class _LanguagePageState extends State { RxBool checkboxValue = false.obs; @@ -56,7 +56,7 @@ class LanguagePage extends GetView { children: [ // 中间居中的标题 Text( - '切换语言', + '切换语言'.tr, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -135,7 +135,7 @@ class LanguagePage extends GetView { value: controller.selectLanguage.value?.language_code == model.language_code, onChanged: (newValue) async { - controller.selectLanguage.value = model; + controller.selectLanguage.value = model; // if (newValue!) { // selectLanguage!.value = languageMap[ // text]!; // Set selectLanguage to the current text value diff --git a/lib/pages/mh_page/MattressControl.dart b/lib/pages/mh_page/MattressControl.dart index 6d7331b..38f0f87 100644 --- a/lib/pages/mh_page/MattressControl.dart +++ b/lib/pages/mh_page/MattressControl.dart @@ -3,8 +3,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutter_switch/flutter_switch.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/pages/mh_page/test/WebviewTestModel.dart'; class MattressControlPage extends StatefulWidget { @@ -17,35 +15,6 @@ class MattressControlPage extends StatefulWidget { class _MattressControlPageState extends State { final controller = Get.put(ControlCardController()); - final data = { - "_id": "333330000000000000000000", - "uid": "684b90df767e00004e0072e2", - "bind_type": 1, - "device_type": 3, - "mac": "545024122666", - "bind_mac": null, - "bind_mac_a": "B43A45C3D411", - "bind_mac_b": "B43A45C3D388", - "position": 0, - "share_uid": null, - "person": null, - "op_type": null, - "show": true, - "create_time": 1750121686274, - "room_id": "684395bf9ef8601da20f6475", - "roomName": "主卧", - "shareNum": 0, - "status": { - "signal": -1, - "status": 0, - "inBed": 0, - "upgrade": 0, - "failure": 0, - "updateTime": -1 - }, - "code": "545024122666", - "blueToothStatus": 1 - }; int selectedIndex = 1; // 当前选中的tab索引 @override Widget build(BuildContext context) { @@ -138,10 +107,10 @@ class _MattressControlPageState extends State { body: SafeArea( child: WebviewTestView( - oncreate: (widget) { - return WebviewTestController(); - }, - ), + // oncreate: (widget) { + // return WebviewTestController(); + // }, + ), ), )))); } diff --git a/lib/pages/mh_page/MhMessageList.dart b/lib/pages/mh_page/MhMessageList.dart index d78605d..6afc202 100644 --- a/lib/pages/mh_page/MhMessageList.dart +++ b/lib/pages/mh_page/MhMessageList.dart @@ -39,7 +39,7 @@ class _MhMessageListWidgetState extends State { highlightColor: Color(0xFF055466), borderRadius: 20.rpx, padding: - EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 0.rpx, 33.rpx), + EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 26.rpx, 26.rpx), onTap: () {}, child: Column( mainAxisSize: MainAxisSize.max, @@ -95,66 +95,65 @@ class _MhMessageListWidgetState extends State { ), ].divide(SizedBox(width: 30.rpx)), ), - ], - ), - ), - if (messageInfo['type'] == 'app_system') - Positioned( - bottom: 46.rpx, - right: 20.rpx, - child: Container( - width: 123.rpx, - height: 47.rpx, - child: CustomCard( - borderRadius: AppConstants().button_container_radius, // 直角 - colors: messageInfo['status'] == 1 - ? [ - themeController.currentColor.sc1, - themeController.currentColor.sc2 - ] - : [themeController.currentColor.sc4], // 单色背景 - enableAnimation: true, // 有点击缩放动画 - enableGradient: false, // 不用渐变 - onTap: () { - if (messageInfo['status'] == 1) { - showConfirmDialog(context, Container(), "是否确认接受该设备".tr, - onConfirm: () async { - ApiResponse apiResponse = await deviceShareController - .confirmShare(messageInfo['data']['shareCode']); - if (apiResponse.code == HttpStatusCodes.ok) { - TopSlideNotification.show( - context, - text: apiResponse.msg!, - textColor: themeController.currentColor.sc2, - ); - messageController.getMessageList(); - messageController.updateAll(); - } else { - TopSlideNotification.show( - context, - text: apiResponse.msg!, - textColor: themeController.currentColor.sc9, - ); - messageController.getMessageList(); - messageController.updateAll(); - } - }, onCancel: () {}); - } - }, - child: Center( - child: Text( - getMessageStatus(messageInfo['status']), - style: TextStyle( - fontFamily: 'Inter', - fontSize: 26.rpx, - letterSpacing: 0.0, - color: Colors.white, + if (messageInfo['type'] == 'app_system') + + // // right: 26.rpx, + // left: 26.rpx, + Container( + // width: 123.rpx, + height: 61.rpx, + child: CustomCard( + borderRadius: 16.rpx, // 直角 + gradientDirection: GradientDirection.vertical, + colors: [Color(0xFF84F5FF)], + enableAnimation: true, // 有点击缩放动画 + enableGradient: false, // 不用渐变 + onTap: () { + // if (messageInfo['status'] == 1) { + // showConfirmDialog( + // context, Container(), "是否确认接受该设备".tr, + // onConfirm: () async { + // ApiResponse apiResponse = + // await deviceShareController.confirmShare( + // messageInfo['data']['shareCode']); + // if (apiResponse.code == HttpStatusCodes.ok) { + // TopSlideNotification.show( + // context, + // text: apiResponse.msg!, + // textColor: themeController.currentColor.sc2, + // ); + // messageController.getMessageList(); + // messageController.updateAll(); + // } else { + // TopSlideNotification.show( + // context, + // text: apiResponse.msg!, + // textColor: themeController.currentColor.sc9, + // ); + // messageController.getMessageList(); + // messageController.updateAll(); + // } + // }, onCancel: () {}); + // } + Get.toNamed('/messageDetail', arguments: messageInfo); + }, + child: Center( + child: Text( + // getMessageStatus(messageInfo['status']), + "查看详情", + style: TextStyle( + fontFamily: 'Inter', + fontSize: 26.rpx, + letterSpacing: 0.0, + color: Color(0xFF011D33), + ), + ), ), ), ), - ), - ), + ], ), + ), ], ); } diff --git a/lib/pages/mh_page/ShareDeviceDetailWidget.dart b/lib/pages/mh_page/ShareDeviceDetailWidget.dart new file mode 100644 index 0000000..86280e0 --- /dev/null +++ b/lib/pages/mh_page/ShareDeviceDetailWidget.dart @@ -0,0 +1,319 @@ +import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart'; +import 'package:ef/ef.dart'; +import 'package:flutter/material.dart'; +import 'package:flutterflow_ui/flutterflow_ui.dart'; +import 'package:vbvs_app/common/color/appColors.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/tool/CustomCard.dart'; +import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart'; +import 'package:vbvs_app/pages/common/selectDialog.dart'; + +import '../../common/color/appFontsize.dart'; + +class ShareDeviceDetailWidget extends GetView { + final scaffoldKey = GlobalKey(); + + @override + Widget build(BuildContext context) { + MHDeviceShareController deviceShareController = Get.find(); + var shareInfo = deviceShareController.model.mainShare; + RxInt type = 1.obs; + type.value = shareInfo['op_type']; + + return GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Scaffold( + key: scaffoldKey, + backgroundColor: FlutterFlowTheme.of(context).primaryBackground, + appBar: AppBar( + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + iconTheme: IconThemeData(color: Colors.white), + titleSpacing: 0, + // leading: returnIconButtomAddCallback(() { + // controller.saveDataApi(); + // updateParm(isShowToast: false); + // }), + // leading: returnIconButtomNew, + title: Container( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + // 中间居中的标题 + Text( + '详情', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, + ), + ), + // 左侧图标 + Positioned( + left: 0.rpx, + child: returnIconButtomNew, + ), + ], + ), + ), + + actions: [], + centerTitle: false, + ), + body: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height * 1, + decoration: BoxDecoration( + color: Color(0xFFF6F6F6), + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB(15, 0, 15, 0), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsetsDirectional.fromSTEB(0, 13, 0, 0), + child: Container( + width: MediaQuery.sizeOf(context).width, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).secondaryBackground, + borderRadius: BorderRadius.circular(8), + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB(16, 13, 16, 15), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${shareInfo['userName']}', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + color: Color(0xFF333333), + fontSize: 15, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + ), + ), + Text( + '分享时间:${MyUtils.timestampToDateString(int.parse(shareInfo['startTime'].toString()))}', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: 11, + letterSpacing: 0.0, + ), + ), + ].divide(SizedBox(height: 5)), + ), + Obx( + () => GestureDetector( + onTap: () { + // 当点击时,将 type 设置为 0(允许控制) + type.value = 1; + controller.updateAll(); + }, + child: Container( + width: MediaQuery.sizeOf(context).width, + constraints: BoxConstraints( + minHeight: 46, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '允许对方控制该设备'.tr, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + color: Color(0xFF333333), + fontSize: 13, + letterSpacing: 0.0, + ), + ), + Align( + alignment: AlignmentDirectional(0, -1), + child: Icon( + type.value == 1 + ? Icons.check_circle // 选中时为实心圆 + : Icons + .radio_button_unchecked, // 未选中时为空心圆 + color: type.value == 1 + ? Color(0xFFD3B684) // 选中时的颜色 + : Colors.grey, // 未选中时的颜色 + size: 18, + ), + ), + ], + ), + ), + ), + ), + Obx( + () => GestureDetector( + onTap: () { + // 当点击时,将 type 设置为 1(仅允许查看) + type.value = 2; + controller.updateAll(); + }, + child: Container( + width: MediaQuery.sizeOf(context).width, + constraints: BoxConstraints( + minHeight: 46, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '仅允许对方查看该设备'.tr, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Readex Pro', + color: Color(0xFF333333), + fontSize: 13, + letterSpacing: 0.0, + ), + ), + Align( + alignment: AlignmentDirectional(0, -1), + child: Icon( + type.value == 2 + ? Icons.check_circle // 选中时为实心圆 + : Icons + .radio_button_unchecked, // 未选中时为空心圆 + color: type.value == 2 + ? Color(0xFFD3B684) // 选中时的颜色 + : Colors.grey, // 未选中时的颜色 + size: 18, + ), + ), + ], + ), + ), + ), + ), + ].divide(SizedBox(height: 13)), + ), + ), + ), + ), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 15, 0, 15, AppConstants.page_button_bottom_padding), + child: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height * 0.056, + constraints: BoxConstraints( + minHeight: 46, + ), + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).secondaryBackground, + ), + child: Container( + width: MediaQuery.sizeOf(context).width, + height: MediaQuery.sizeOf(context).height * 0.056, + decoration: BoxDecoration( + color: + FlutterFlowTheme.of(context).secondaryBackground, + borderRadius: BorderRadius.circular(12), + ), + child: CustomCard( + borderRadius: 16.rpx, + gradientDirection: GradientDirection.vertical, + onTap: () async {}, + colors: const [ + Color(0xFFFCFCFC), + Color(0xFFF8FAF9), + Color(0XFFECF6F3), + Color(0XFFD9F0E9), + Color(0xFFCEECE3) + ], + child: Container( + width: double.infinity, + height: 90.rpx, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6), + ), + child: Text("解除分享".tr, + style: TextStyle( + color: const Color(0xFF003058), + fontSize: 30.rpx, + )), + ), + ) + + // FFButtonWidget( + // onPressed: () { + // showCustomConfirmDialog(context, "是否确定删除?").then((v) { + // if ('confirm' == v) { + // // deviceShareController + // // .deleteShare(shareInfo) + // // .then((d) { + // // deviceShareController.initData(); + // // deviceShareController.updateAll(); + // // Get.back(); + // // }); + // // print("showCustomConfirmDialog $v"); + // } + // }); + // }, + // text: '删除', + // options: FFButtonOptions( + // height: 40, + // padding: EdgeInsetsDirectional.fromSTEB(24, 0, 24, 0), + // iconPadding: + // EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0), + // color: Color(0xFFE55E92), + // textStyle: + // FlutterFlowTheme.of(context).titleSmall.override( + // fontFamily: 'Readex Pro', + // color: Colors.white, + // fontSize: 13, + // letterSpacing: 0.0, + // ), + // elevation: 3, + // borderSide: BorderSide( + // color: Colors.transparent, + // width: 1, + // ), + // borderRadius: BorderRadius.circular(8), + // ), + // ), + + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/mh_page/ShareUserWidget.dart b/lib/pages/mh_page/ShareUserWidget.dart index 08f9ed8..744208a 100644 --- a/lib/pages/mh_page/ShareUserWidget.dart +++ b/lib/pages/mh_page/ShareUserWidget.dart @@ -20,7 +20,7 @@ class ShareUserWidget extends GetView { onTap: () { repairListController.model.mainShare = repairListController.model.shareUser![index]; - Get.toNamed('/share_device_user_detail'); + Get.toNamed('/shareDeviceDetail'); }, child: Container( width: MediaQuery.sizeOf(context).width, @@ -77,10 +77,10 @@ class ShareUserWidget extends GetView { child: Align( alignment: const AlignmentDirectional(-1, 0), child: Text( - info['opType'] == 1 - ? '允许对方控制该设备' - : info['opType'] == 2 - ? '仅允许对方查看该设备' + info['op_type'] == 1 + ? '允许对方控制该设备'.tr + : info['op_type'] == 2 + ? '仅允许对方查看该设备'.tr : '', style: TextStyle( fontFamily: 'Readex Pro', diff --git a/lib/pages/mh_page/about_us.dart b/lib/pages/mh_page/about_us.dart new file mode 100644 index 0000000..9b52795 --- /dev/null +++ b/lib/pages/mh_page/about_us.dart @@ -0,0 +1,128 @@ +import 'package:ef/ef.dart'; +import 'package:flutter/material.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/tool/WebViewWidget.dart'; + +class MhAboutUsPage extends StatefulWidget { + late MyWebView webView; + MhAboutUsPage({super.key}); + + @override + State createState() => _MhAboutUsPageState(); +} + +class _MhAboutUsPageState extends State { + @override + void initState() { + super.initState(); + // pdfController.loadPdf(); + + widget.webView = MyWebView( + url: AppConstants().ent_type == 1 + ? "https://mp.weixin.qq.com/s/BrD3fTT2J2R-DxZrUuM4rw" + : "https://mp.weixin.qq.com/s/7BvvprVDqX1eOzM3Lms8dg", + onLoad: () { + print('网页载入完毕'); + }, + ); + } + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, bodySize) => GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/new_background.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, // 加上这一行 + appBar: AppBar( + backgroundColor: Colors.transparent, + // backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + iconTheme: IconThemeData(color: themeController.currentColor.sc3), + titleSpacing: 0, + // leading: returnIconButtom, + title: Container( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + /// 居中标题 + Text('关于我们'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + )), + + /// 左边返回按钮 + Positioned( + left: 0, + child: returnIconButtomNew, + ), + ], + ), + ), + + actions: [], + centerTitle: false, + ), + + // body: SafeArea( + // top: true, + // child: Padding( + // padding: EdgeInsets.symmetric(horizontal: 30.rpx), + // child: Column( + // children: [ + // Expanded( + // child: Obx(() { + // if (pdfController.localPdfPath.value == null) { + // return Center(child: CircularProgressIndicator()); + // } else { + // return PDFView( + // filePath: pdfController.localPdfPath.value!, + // autoSpacing: false, + // enableSwipe: true, + // swipeHorizontal: false, + // pageSnap: true, + // fitEachPage: true, + // defaultPage: 0, + // onRender: (pages) => print('PDF 渲染完成,共 $pages 页'), + // onError: (error) => print('PDF 加载错误: $error'), + // ); + // } + // }), + // ), + // ], + // ), + // ), + // ), + body: SafeArea( + top: true, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 0.rpx), + child: Column(children: [ + Expanded( + child: Container( + child: widget.webView, + ), + ), + ]), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/mh_page/address_list_page.dart b/lib/pages/mh_page/address_list_page.dart index 191c1c2..a6a3c35 100644 --- a/lib/pages/mh_page/address_list_page.dart +++ b/lib/pages/mh_page/address_list_page.dart @@ -56,7 +56,7 @@ class AddressListPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -71,37 +71,76 @@ class AddressListPage extends GetView { child: Column( mainAxisSize: MainAxisSize.max, children: [ + // Obx(() { + // if (controller.model.addressList!.isEmpty) { + // // 如果地址列表为空,显示 EmptyMessageWidget + // return Expanded(child: NullDataWidget()); + // } else { + // // 如果地址列表不为空,显示地址列表 + // return Expanded( + // child: Container( + // width: bodysize!.maxWidth, + // height: bodysize!.maxHeight * 1, + // decoration: BoxDecoration(), + // child: Obx(() => ListView( + // shrinkWrap: true, + // scrollDirection: Axis.vertical, + // children: (controller.model.addressList! + // .asMap() + // .entries + // .map((e) => AddressModuleWidget( + // index: e.key, + // addressListController: + // controller, + // )) + // .toList() as List) + // .divide(const SizedBox(height: 10)) + // .addToEnd(const SizedBox( + // height: + // AppConstants.list_end_height)), + // )), + // ), + // ); + // } + // }), Obx(() { - if (controller.model.addressList!.isEmpty) { - // 如果地址列表为空,显示 EmptyMessageWidget - return Expanded(child: NullDataWidget()); - } else { - // 如果地址列表不为空,显示地址列表 - return Expanded( - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 1, - decoration: BoxDecoration(), - child: Obx(() => ListView( - shrinkWrap: true, - scrollDirection: Axis.vertical, - children: (controller.model.addressList! - .asMap() - .entries - .map((e) => AddressModuleWidget( - index: e.key, - addressListController: - controller, - )) - .toList() as List) - .divide(const SizedBox(height: 10)) - .addToEnd(const SizedBox( - height: - AppConstants.list_end_height)), - )), - ), - ); - } + final originList = controller.model.addressList ?? []; + + // 拆出默认地址 + final defaultItem = originList.firstWhere( + (e) => e["default"] == 1, + orElse: () => null, + ); + + // 其他非默认地址 + final others = + originList.where((e) => e["default"] != 1).toList(); + + // 新的展示顺序列表(默认地址排前面) + final reorderedList = [ + if (defaultItem != null) defaultItem, + ...others, + ]; + + return Expanded( + child: ListView( + shrinkWrap: true, + padding: EdgeInsets.zero, + children: reorderedList + .map((item) { + final realIndex = + originList.indexOf(item); // 保留原始 index + return AddressModuleWidget( + index: realIndex, + addressListController: controller, + ); + }) + .toList() + .divide(const SizedBox(height: 10)) + .addToEnd(const SizedBox( + height: AppConstants.list_end_height)), + ), + ); }), Align( alignment: AlignmentDirectional(0, 1), diff --git a/lib/pages/mh_page/applyRepair/apply_repair_success.dart b/lib/pages/mh_page/applyRepair/apply_repair_success.dart index 01afb14..3eab052 100644 --- a/lib/pages/mh_page/applyRepair/apply_repair_success.dart +++ b/lib/pages/mh_page/applyRepair/apply_repair_success.dart @@ -38,7 +38,7 @@ class _ApplyRepairSuccessState extends State { decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/new_background.png'), // 本地图片 - fit: BoxFit.fill, // 填满整个 Container + fit: BoxFit.contain, // 填满整个 Container ), ), child: Scaffold( @@ -61,11 +61,11 @@ class _ApplyRepairSuccessState extends State { Text( '报修成功标题'.tr, style: TextStyle( - fontFamily: 'Readex Pro', - color: themeController.currentColor.sc3, - letterSpacing: 0, - fontSize: 30.rpx, - ), + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + ), ), /// 左边返回按钮 @@ -119,7 +119,7 @@ class _ApplyRepairSuccessState extends State { // width: double.infinity, decoration: BoxDecoration(), child: SvgPicture.asset('assets/img/icon/tick.svg', - fit: BoxFit.cover, color: Color(0XFF84F5FF)), + fit: BoxFit.contain, color: Color(0XFF84F5FF)), ), ), Padding( @@ -132,11 +132,11 @@ class _ApplyRepairSuccessState extends State { child: Text( '报修成功'.tr, style: TextStyle( - fontFamily: 'Inter', - fontSize: 30.rpx, - letterSpacing: 0.0, - color: themeController.currentColor.sc3, - ), + fontFamily: 'Inter', + fontSize: 30.rpx, + letterSpacing: 0.0, + color: themeController.currentColor.sc3, + ), ), ), ), @@ -229,12 +229,12 @@ class _ApplyRepairSuccessState extends State { Text( '查看报修历史'.tr, style: TextStyle( - color: Color(0xFF011D33), - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, // 自定义字体大小 - letterSpacing: 0.0, - ), + color: Color(0xFF011D33), + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, // 自定义字体大小 + letterSpacing: 0.0, + ), ), ].divide(SizedBox(width: 17.rpx)), ), @@ -272,13 +272,13 @@ class _ApplyRepairSuccessState extends State { children: [ Text( '绑定成功.返回'.tr, - style:TextStyle( - color: Color(0xFF011D33), - fontFamily: 'Inter', - fontSize: AppConstants() - .normal_text_fontSize, // 自定义字体大小 - letterSpacing: 0.0, - ), + style: TextStyle( + color: Color(0xFF011D33), + fontFamily: 'Inter', + fontSize: AppConstants() + .normal_text_fontSize, // 自定义字体大小 + letterSpacing: 0.0, + ), ), ].divide(SizedBox(width: 17.rpx)), ), @@ -322,11 +322,11 @@ class _ApplyRepairSuccessState extends State { Text( title, style: TextStyle( - fontFamily: 'Inter', - color: const Color(0xFFC2CED7), - fontSize: 30.rpx, - letterSpacing: 0.0, - ), + fontFamily: 'Inter', + color: const Color(0xFFC2CED7), + fontSize: 30.rpx, + letterSpacing: 0.0, + ), ), ClipRRect( borderRadius: BorderRadius.circular(8.rpx), diff --git a/lib/pages/mh_page/apply_repair_page.dart b/lib/pages/mh_page/apply_repair_page.dart index 8250901..049c208 100644 --- a/lib/pages/mh_page/apply_repair_page.dart +++ b/lib/pages/mh_page/apply_repair_page.dart @@ -79,7 +79,7 @@ class ApplyRepairPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -1168,90 +1168,100 @@ class ApplyRepairPage extends GetView { child: TextFormField( // autofocus: true, + obscureText: + false, onChanged: - (value) { + (val) { controller .model .apply_name = - value; + val; }, - obscureText: - false, + decoration: InputDecoration( - isDense: true, + contentPadding: + EdgeInsets + .symmetric( + vertical: + 25.rpx, + horizontal: + 26.rpx, + ), labelStyle: - const TextStyle( + TextStyle( fontFamily: 'Readex Pro', letterSpacing: 0, ), hintStyle: - const TextStyle( + TextStyle( fontFamily: 'Readex Pro', letterSpacing: 0, ), enabledBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - color: const Color( + const BorderSide( + color: Color( 0x00000000), - width: - 1.rpx, + width: 2, ), borderRadius: - BorderRadius.circular( - AppConstants().normal_container_radius), + BorderRadius + .circular(8), ), focusedBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - color: Colors - .transparent, - width: - 1.rpx, + const BorderSide( + color: Color( + 0x00000000), + width: 2, ), borderRadius: - BorderRadius.circular( - 8.rpx), + BorderRadius + .circular(8), ), errorBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - // - width: - 1.rpx, + const BorderSide( + color: Color( + 0x00000000), + width: 2, ), borderRadius: - BorderRadius.circular( - 8.rpx), + BorderRadius + .circular(8), ), focusedErrorBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - // - width: - 1.rpx, + const BorderSide( + color: Color( + 0x00000000), + width: 2, ), borderRadius: - BorderRadius.circular( - 8.rpx), + BorderRadius + .circular(8), ), ), - style: TextStyle( - letterSpacing: - 0, - color: Colors - .black, - fontSize: - 26.rpx), + style: + TextStyle( + fontFamily: + 'Readex Pro', + letterSpacing: + 0, + color: Colors + .black, + fontSize: + 26.rpx, + ), ), ), ), @@ -1324,90 +1334,100 @@ class ApplyRepairPage extends GetView { child: TextFormField( // autofocus: true, + obscureText: + false, onChanged: - (value) { + (val) { controller .model .tel = - value; + val; }, - obscureText: - false, + decoration: InputDecoration( - isDense: true, + contentPadding: + EdgeInsets + .symmetric( + vertical: + 25.rpx, + horizontal: + 26.rpx, + ), labelStyle: - const TextStyle( + TextStyle( fontFamily: 'Readex Pro', letterSpacing: 0, ), hintStyle: - const TextStyle( + TextStyle( fontFamily: 'Readex Pro', letterSpacing: 0, ), enabledBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - color: const Color( + const BorderSide( + color: Color( 0x00000000), - width: - 1.rpx, + width: 2, ), borderRadius: - BorderRadius.circular( - AppConstants().normal_container_radius), + BorderRadius + .circular(8), ), focusedBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - color: Colors - .transparent, - width: - 1.rpx, + const BorderSide( + color: Color( + 0x00000000), + width: 2, ), borderRadius: - BorderRadius.circular( - 8.rpx), + BorderRadius + .circular(8), ), errorBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - // - width: - 1.rpx, + const BorderSide( + color: Color( + 0x00000000), + width: 2, ), borderRadius: - BorderRadius.circular( - 8.rpx), + BorderRadius + .circular(8), ), focusedErrorBorder: - OutlineInputBorder( + UnderlineInputBorder( borderSide: - BorderSide( - // - width: - 1.rpx, + const BorderSide( + color: Color( + 0x00000000), + width: 2, ), borderRadius: - BorderRadius.circular( - 8.rpx), + BorderRadius + .circular(8), ), ), - style: TextStyle( - letterSpacing: - 0, - color: Colors - .black, - fontSize: - 26.rpx), + style: + TextStyle( + fontFamily: + 'Readex Pro', + letterSpacing: + 0, + color: Colors + .black, + fontSize: + 26.rpx, + ), ), ), ), diff --git a/lib/pages/mh_page/bluetooth.dart b/lib/pages/mh_page/bluetooth.dart index d6f3312..e22fd13 100644 --- a/lib/pages/mh_page/bluetooth.dart +++ b/lib/pages/mh_page/bluetooth.dart @@ -6,13 +6,28 @@ 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/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart'; +import 'package:vbvs_app/model/api_response.dart'; +import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart'; +import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; -class BluetoothPage extends GetView { - Map data; - BluetoothPage({required this.data}); +class BluetoothPage extends StatefulWidget { + final Map data; + BluetoothPage({Key? key, required this.data}); + @override + _BluetoothPageState createState() => _BluetoothPageState(); +} + +class _BluetoothPageState extends State { + late RxMap obsData; + @override + void initState() { + super.initState(); + obsData = Map.from(widget.data).obs; // 复制成 obs + } BoxConstraints? bodysize; - + DeviceListController deviceListController = Get.find(); @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, cc) { @@ -50,7 +65,7 @@ class BluetoothPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -72,7 +87,7 @@ class BluetoothPage extends GetView { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - data['name']?.toString() ?? '未命名', + obsData['name']?.toString() ?? '未命名', style: TextStyle( color: Colors.white, fontSize: 40.rpx, @@ -83,9 +98,15 @@ class BluetoothPage extends GetView { backgroundColor: Colors.transparent, highlightColor: const Color(0xFF055466), padding: EdgeInsets.only(left: 0), - onTap: () { - Get.toNamed("/editBedPage", - arguments: data); + onTap: () async { + var x = await Get.toNamed( + "/editBedPage", + arguments: obsData); + if (x != null) { + setState(() { + obsData.addAll(x); // 值更新后主动刷新页面 + }); + } }, child: Container( width: 42.rpx, @@ -98,7 +119,7 @@ class BluetoothPage extends GetView { ), const SizedBox(height: 4), - Text(data['mac']?.toString() ?? '未命名', + Text(obsData['mac']?.toString() ?? '未命名', style: TextStyle( color: Colors.white70, fontSize: 26.rpx)), @@ -107,7 +128,7 @@ class BluetoothPage extends GetView { // 蓝牙连接状态 Column( children: [ - data['blueToothStatus'] == 1 + obsData['blueToothStatus'] == 1 ? SvgPicture.asset( 'assets/img/icon/blue_fail.svg', width: 68.rpx, @@ -121,11 +142,11 @@ class BluetoothPage extends GetView { SizedBox(height: 4), //下面文字和颜色也根据上面变化 Text( - data['blueToothStatus'] == 1 + obsData['blueToothStatus'] == 1 ? '未连接' : '已连接', style: TextStyle( - color: data['blueToothStatus'] == 1 + color: obsData['blueToothStatus'] == 1 ? Color(0xFFFF7159) : Color(0xFF6BFDAC), fontSize: 26.rpx)), @@ -143,21 +164,74 @@ class BluetoothPage extends GetView { children: [ _buildMenuButton( context, '详情', "/devicePeopleInfo", - arguments: data), + arguments: obsData), _buildMenuButton( context, '人员资料', "/peopleInfoPage", - arguments: data), + arguments: obsData,), _buildMenuButton( context, '房间选择', "/roomPickerPage", - arguments: data), + arguments: obsData), _buildMenuButton(context, '设备校准', ""), _buildMenuButton(context, '体征传感器', ""), _buildMenuButton(context, 'WIFI配置', ""), _buildMenuButton( context, '睡眠习惯', "/sleepHabitPage"), _buildMenuButton( - context, '分享设备', "/deviceSharePage"), - _buildMenuButton(context, '解绑', ""), + context, '分享设备', "/deviceSharePage", + arguments: obsData), + _buildMenuButton( + context, + obsData['bind_type'] == 1 ? '解绑' : '删除', + "", + onTap: () { + if (obsData['bind_type'] == 1) { + // 解绑弹窗 + showUnbindConfirmDialog( + context: context, + title: "是否进行解绑?", + onConfirm: () async { + await deviceListController + .unbindDevice(obsData); + await deviceListController + .getDeviceList(); + try { + WebviewTestController + webviewTestController = + Get.find(); + webviewTestController + .web.jsbridge?.dart + .unBindDevice(); + } catch (e) { + ef.log("[h5]通知列表更新报错:$e"); + } + Get.toNamed("/mianPageBottomChange"); + // 执行解绑逻辑 + }, + onCancel: () { + // 点击取消后的逻辑 + }, + ); + } else if (obsData['bind_type'] == 2) { + // 删除弹窗 + showDeleteDeviceConfirmDialog( + context: context, + title: "是否进行删除?", + onConfirm: () async { + await deviceListController + .unbindDevice( + obsData, + ); + await deviceListController + .getDeviceList(); + Get.toNamed("/mianPageBottomChange"); + }, + onCancel: () { + // 点击取消后的逻辑 + }, + ); + } + }, + ), ], ), ), @@ -168,8 +242,13 @@ class BluetoothPage extends GetView { }); } - Widget _buildMenuButton(BuildContext context, String title, String? path, - {Map? arguments}) { + Widget _buildMenuButton( + BuildContext context, + String title, + String? path, { + Map? arguments, + VoidCallback? onTap, + }) { return Padding( padding: EdgeInsets.only(bottom: 19.rpx), child: ClickableContainer( @@ -177,7 +256,21 @@ class BluetoothPage extends GetView { highlightColor: Color(0XFF055466), padding: EdgeInsets.only(left: 0), onTap: () { - if (path?.isNotEmpty == true) { + // if (path?.isNotEmpty == true) { + // if (arguments != null) { + // Get.toNamed(path!, arguments: arguments); + // } else { + // Get.toNamed(path!); + // } + // } else { + // TopSlideNotification.show( + // context, + // text: "功能开发中...", + // ); + // } + if (onTap != null) { + onTap(); // 优先执行自定义逻辑 + } else if (path?.isNotEmpty == true) { if (arguments != null) { Get.toNamed(path!, arguments: arguments); } else { diff --git a/lib/pages/mh_page/book_info_page.dart b/lib/pages/mh_page/book_info_page.dart index 2883737..4f1eabb 100644 --- a/lib/pages/mh_page/book_info_page.dart +++ b/lib/pages/mh_page/book_info_page.dart @@ -63,7 +63,7 @@ class BookInfoPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/book_success_page.dart b/lib/pages/mh_page/book_success_page.dart index be7d55b..df5c257 100644 --- a/lib/pages/mh_page/book_success_page.dart +++ b/lib/pages/mh_page/book_success_page.dart @@ -62,7 +62,7 @@ class BookSuccessPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/component/mht_bind_dialog.dart b/lib/pages/mh_page/component/mht_bind_dialog.dart index c03f008..ab72290 100644 --- a/lib/pages/mh_page/component/mht_bind_dialog.dart +++ b/lib/pages/mh_page/component/mht_bind_dialog.dart @@ -157,6 +157,8 @@ void showBindDoubleDialog( ); } +Future showUnBindDeviceDialog(BuildContext context) async {} + Future showHaveBindDialog(BuildContext context) async { ThemeController themeController = Get.find(); diff --git a/lib/pages/mh_page/delete_account.dart b/lib/pages/mh_page/delete_account.dart index b5b9746..146bfac 100644 --- a/lib/pages/mh_page/delete_account.dart +++ b/lib/pages/mh_page/delete_account.dart @@ -49,7 +49,7 @@ class DeletedAccountPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/device/component/DeviceComponentWidget.dart b/lib/pages/mh_page/device/component/DeviceComponentWidget.dart index 2e46de8..869f095 100644 --- a/lib/pages/mh_page/device/component/DeviceComponentWidget.dart +++ b/lib/pages/mh_page/device/component/DeviceComponentWidget.dart @@ -20,6 +20,8 @@ import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/pages/mh_page/component/mht_bind_dialog.dart'; import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart'; import 'package:vbvs_app/pages/mh_page/device/model/BlueToothDataModel.dart'; +import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart'; +import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; class DeviceComponentWidget extends StatefulWidget { BlueToothDataModel bleDevice; @@ -36,6 +38,7 @@ class DeviceComponentWidget extends StatefulWidget { class _DeviceComponentWidgetState extends State { ThemeController themeController = Get.find(); MHTBlueToothController blueteethBindController = Get.find(); + MHTHomeController homeController = Get.find(); var lisObj; @override @@ -172,7 +175,7 @@ class _DeviceComponentWidgetState extends State { borderRadius: 16.rpx, onTap: () async { try { - // 连接前暂停扫描 + //连接前暂停扫描 blueteethBindController.pauseScanning(); if (blueteethBindController.currentDeviceMac?.value != null && @@ -225,6 +228,40 @@ class _DeviceComponentWidgetState extends State { TopSlideNotification.show(context, text: response.msg!); if (response.code == HttpStatusCodes.ok) { + try { + WebviewTestController webviewTestController = + Get.find(); + webviewTestController.web.jsbridge?.dart + .unBindDevice(); + } catch (e) { + ef.log("[h5]通知列表更新报错:$e"); + } + homeController.getPersonList(); + //请求绑定设备列表 + // homeController.getSleepReport(); + homeController.getDeviceNum().then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + Get.context!, + text: apiResponse.msg!, + textColor: themeController.currentColor.sc9, + ); + } + }); + homeController + .getDeviceList(group: 'room') + .then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + Get.context!, + text: apiResponse.msg!, + textColor: themeController.currentColor.sc9, + ); + } else { + //请求睡眠报告 + // deviceController.getSleepReport(); + } + }); //更新设备绑定流程 Get.toNamed("/mHTwifiPage", arguments: widget.bleDevice); @@ -242,6 +279,7 @@ class _DeviceComponentWidgetState extends State { textColor: themeController.currentColor.sc9, ); } + blueteethBindController.resumeScanning(); }, onCancel: () { print('用户点击了取消'); @@ -262,10 +300,11 @@ class _DeviceComponentWidgetState extends State { DailyLogUtils.writeLog("连接异常: $e"); } finally { // 确保在任何情况下都恢复扫描 - if (blueteethBindController - .currentDeviceMac.value.isEmpty) { - blueteethBindController.resumeScanning(); - } + // if (blueteethBindController + // .currentDeviceMac.value.isEmpty) { + // blueteethBindController.resumeScanning(); + // } + blueteethBindController.resumeScanning(); } }, colors: [stringToColor("1592AA"), stringToColor("006FA3")], @@ -452,7 +491,7 @@ class _DeviceComponentWidgetState extends State { try { // 连接设备 THapp bledevice = THapp(device: device.scanResult.device); - await bledevice.connect(); + await bledevice.connect(); var res2 = bledevice.isConnected; if (!res2) { @@ -468,7 +507,7 @@ class _DeviceComponentWidgetState extends State { blueteethBindController.blueConnectFlag.value = 2; blueteethBindController.currentDevice = bledevice; - + await Future.delayed(Duration(seconds: 2)); var read = bledevice.getresource('fff0/fff1'); await read!.characteristic.setNotifyValue(true); var write = bledevice.getresource('fff0/fff2'); diff --git a/lib/pages/mh_page/device/device.dart b/lib/pages/mh_page/device/device.dart index 2ba275a..7933cca 100644 --- a/lib/pages/mh_page/device/device.dart +++ b/lib/pages/mh_page/device/device.dart @@ -25,9 +25,9 @@ class DeviceInfoWidget extends GetView { child: Container( // width: MediaQuery.sizeOf(context).width, height: 381.rpx, - constraints: BoxConstraints( - minHeight: 140, - ), + // constraints: BoxConstraints( + // minHeight: 140, + // ), decoration: BoxDecoration( color: Color(0xFF003058), borderRadius: BorderRadius.circular(16.rpx), @@ -37,9 +37,9 @@ class DeviceInfoWidget extends GetView { child: Container( // width: MediaQuery.sizeOf(context).width, height: 381.rpx, - constraints: BoxConstraints( - minHeight: 106, - ), + // constraints: BoxConstraints( + // minHeight: 106, + // ), child: Container( // width: MediaQuery.sizeOf(context).width, @@ -96,88 +96,99 @@ class DeviceInfoWidget extends GetView { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: '设备ID:' + - (deviceListController.model - .deviceList[ - index]['_id'] ?? - ''), - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFFC8CBD2), - fontSize: 26.rpx, - letterSpacing: 0, - height: 1), - ), - // TextSpan( - // text: - // ' (${deviceListController.model.deviceList[index]['status'] ?? ''})', - // style: TextStyle( - // fontFamily: 'Readex Pro', - // color: deviceListController - // .model - // .deviceList[ - // index] - // ['status'] == - // '在线' - // ? Color( - // 0xFF07C160) // 在线的颜色 - // : Color( - // 0xFFEA7CA7), // 离线的颜色 - // fontSize: 26.rpx, - // letterSpacing: 0, - // ), - // ), - ], - ), - maxLines: 1, // 限制显示一行 - overflow: TextOverflow - .ellipsis, // 超出部分显示省略号 - ), - ), - ], - ), - Align( - alignment: AlignmentDirectional(-1, 0), - child: Text( - '房间:' + - (deviceListController + _buildInfoRow( + '设备ID', + deviceListController + .model.deviceList[index]["_id"] ?? + '', + valueColor: (deviceListController .model.deviceList[index] - ['roomName'] ?? - ''), - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFFC8CBD2), - fontSize: 26.rpx, - letterSpacing: 0, - height: 1), - ), - ), - Align( - alignment: AlignmentDirectional(-1, 0), - child: Text( - '设备状态:' + - (deviceListController - .model - .deviceList[index]["status"] - ?["status"] - ?.toString() ?? - ''), - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFFC8CBD2), - fontSize: 26.rpx, - letterSpacing: 0, - height: 1), - ), - ) + ["status"]?["status"]) == + 1 + ? Color(0xFF929699) + : null), + _buildInfoRow( + '房间', + deviceListController.model + .deviceList[index]["roomName"] ?? + '', + valueColor: (deviceListController + .model.deviceList[index] + ["status"]?["status"]) == + 1 + ? Color(0xFF929699) + : null), + _buildInfoRow( + '设备状态', + (deviceListController + .model.deviceList[index] + ["status"]?["status"]) == + 1 + ? '在线' + : '离线', + valueColor: (deviceListController + .model.deviceList[index] + ["status"]?["status"]) == + 1 + ? Color(0xFF6BFDAC) + : Color(0xFFFF7159)), + // Row( + // mainAxisSize: MainAxisSize.max, + // children: [ + // Expanded( + // child: RichText( + // text: TextSpan( + // children: [ + // TextSpan( + // text: '设备ID:' + + // (deviceListController.model + // .deviceList[ + // index]['_id'] ?? + // ''), + // style: TextStyle( + // fontFamily: 'Readex Pro', + // color: Color(0xFFC8CBD2), + // fontSize: 26.rpx, + // letterSpacing: 0, + // height: 1), + // ), + // ], + // ), + // maxLines: 1, // 限制显示一行 + // overflow: TextOverflow + // .ellipsis, // 超出部分显示省略号 + // ), + // ), + // ], + // ), + // Align( + // alignment: AlignmentDirectional(-1, 0), + // child: Text( + // '房间:' + + // (deviceListController + // .model.deviceList[index] + // ['roomName'] ?? + // ''), + // style: TextStyle( + // fontFamily: 'Readex Pro', + // color: Color(0xFFC8CBD2), + // fontSize: 26.rpx, + // letterSpacing: 0, + // height: 1), + // ), + // ), + // Align( + // alignment: AlignmentDirectional(-1, 0), + // child: Text( + // '设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}', + // style: TextStyle( + // fontFamily: 'Readex Pro', + // color: Color(0xFFC8CBD2), + // fontSize: 26.rpx, + // letterSpacing: 0, + // height: 1), + // ), + // ) ].divide(SizedBox(height: 36.rpx)), ), ), @@ -186,7 +197,7 @@ class DeviceInfoWidget extends GetView { Align( alignment: AlignmentDirectional(0, 0), child: Container( - width: MediaQuery.sizeOf(context).width * 0.21, + width: 150.rpx, height: 90.rpx, child: FFButtonWidget( onPressed: () { @@ -239,7 +250,9 @@ class DeviceInfoWidget extends GetView { children: [ InkWell( onTap: () async { - await Get.toNamed("/deviceSharePage"); + await Get.toNamed("/deviceSharePage", + arguments: deviceListController + .model.deviceList[index]); // if (device['type'] == 1) { // globalController.model.deviceMain = device; // await Get.toNamed("/deviceSharePage"); @@ -409,4 +422,25 @@ class DeviceInfoWidget extends GetView { ), ); } + + Widget _buildInfoRow(String label, String value, {Color? valueColor}) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + '$label ', + style: + TextStyle(color: Color(0XFF929699), fontSize: 26.rpx, height: 1), + ), + Flexible( + child: Text( + value, + style: TextStyle( + color: valueColor ?? Colors.white, fontSize: 26.rpx, height: 1), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ); + } } diff --git a/lib/pages/mh_page/device/mht_blueteeth_device_page.dart b/lib/pages/mh_page/device/mht_blueteeth_device_page.dart index baa0b1a..28a3461 100644 --- a/lib/pages/mh_page/device/mht_blueteeth_device_page.dart +++ b/lib/pages/mh_page/device/mht_blueteeth_device_page.dart @@ -601,6 +601,11 @@ class _MHTBlueteethDevicePageState extends State { Obx(() { if (mhtBlueToothController .model.deviceDataStatus!.isNotEmpty) { + final sortedList = mhtBlueToothController + .model.deviceDataStatus! + .toList() + ..sort((a, b) => b.scanResult.rssi + .compareTo(a.scanResult.rssi)); return Expanded( child: Container( width: double.infinity, @@ -608,8 +613,7 @@ class _MHTBlueteethDevicePageState extends State { child: Column( mainAxisSize: MainAxisSize.max, children: [ - ...mhtBlueToothController - .model.deviceDataStatus! + ...sortedList .map((device) { return DeviceComponentWidget( bleDevice: device, diff --git a/lib/pages/mh_page/device/mht_wifi_page.dart b/lib/pages/mh_page/device/mht_wifi_page.dart index 315d1ba..c2d033e 100644 --- a/lib/pages/mh_page/device/mht_wifi_page.dart +++ b/lib/pages/mh_page/device/mht_wifi_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_svg/svg.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/appConstants.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/common/util/requestWithLog.dart'; @@ -66,10 +67,12 @@ class _MHTWifiPageState extends State { blueteethBindController.updateAll(); } + @override @override void dispose() { _isDisposed = true; _cleanupResources(); + _disconnectDevice(); super.dispose(); } @@ -1097,4 +1100,14 @@ class _MHTWifiPageState extends State { onFailure: (res) {}, ); } + + void _disconnectDevice() async { + try { + THapp bledevice = THapp(device: widget.deviceInfo.scanResult.device); + await bledevice.disconnect(); + DailyLogUtils.writeLog("关闭蓝牙连接成功"); + } catch (e) { + DailyLogUtils.writeError("关闭蓝牙连接失败: $e"); + } + } } diff --git a/lib/pages/mh_page/device_list.dart b/lib/pages/mh_page/device_list.dart index f200b5c..973be21 100644 --- a/lib/pages/mh_page/device_list.dart +++ b/lib/pages/mh_page/device_list.dart @@ -70,7 +70,7 @@ class _DeviceListPageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/device_people_info.dart b/lib/pages/mh_page/device_people_info.dart index f3b971c..196a0a3 100644 --- a/lib/pages/mh_page/device_people_info.dart +++ b/lib/pages/mh_page/device_people_info.dart @@ -74,7 +74,7 @@ class DevicePeopleInfo extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -146,13 +146,13 @@ class DevicePeopleInfo extends GetView { ...List.generate(controller.model.peopleList.length, (index) { final person = controller.model.peopleList[index]; - String location_ = ''; - if ("${data["bindMacB"]}".length > 6 && - (person["direction"] == 1 || - person["direction"] == 2)) { - location_ = - person["direction"] == 1 ? '左侧' : '右侧'; - } + // String location_ = ''; + // if ("${data["bindMacB"]}".length > 6 && + // (person["direction"] == 1 || + // person["direction"] == 2)) { + // location_ = + // person["direction"] == 1 ? '左侧' : '右侧'; + // } return ClickableContainer( backgroundColor: Color(0xFF003058), @@ -176,9 +176,8 @@ class DevicePeopleInfo extends GetView { ), ), ), - if (location_.isNotEmpty) - getInfoRow(context, - "姓名:${person["name"] ?? "-"}"), + getInfoRow( + context, "姓名:${person["name"] ?? "-"}"), getInfoRow(context, "性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"), getInfoRow(context, diff --git a/lib/pages/mh_page/device_share_page.dart b/lib/pages/mh_page/device_share_page.dart index 9a4d110..7b98052 100644 --- a/lib/pages/mh_page/device_share_page.dart +++ b/lib/pages/mh_page/device_share_page.dart @@ -3,40 +3,31 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; -import 'package:vbvs_app/common/util/CommonVariables.dart'; +import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/NullDataComponentWidget.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; -import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart'; -import 'package:vbvs_app/pages/mh_page/EmptyMessageWidget.dart'; +import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/pages/mh_page/ShareUserWidget.dart'; class ShareDeviceWidget extends GetView { + var data; + ShareDeviceWidget({super.key, required this.data}); final scaffoldKey = GlobalKey(); - final ScrollController scrollController = ScrollController(); - // ShareDeviceWidget() { - // controller.initData(); - // scrollController.addListener(() { - // if (scrollController.position.pixels == - // scrollController.position.maxScrollExtent && - // controller.model.hasMore) { - // controller.initData(); - // controller.updateAll(); - // } - // }); - // } final _formKey = GlobalKey(); final _phoneController = TextEditingController(); @override Widget build(BuildContext context) { - var deviceController = Get.find(); controller.model.msg = ""; - controller.model.show = 0; + controller.model.code = 0; controller.model.type = 1; + controller.model.account = ''; return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Container( @@ -69,7 +60,7 @@ class ShareDeviceWidget extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -122,7 +113,7 @@ class ShareDeviceWidget extends GetView { ), ), Text( - '设备ID:${deviceController.model.deviceMain['mac']}', + '设备ID:${data['mac']}', style: TextStyle( fontFamily: 'Readex Pro', color: const Color(0xFF6BFDAC), @@ -152,7 +143,7 @@ class ShareDeviceWidget extends GetView { child: TextFormField( controller: _phoneController, decoration: InputDecoration( - hintText: '请输入对方手机号', + hintText: '请输入对方手机号/邮箱号', hintStyle: TextStyle( fontFamily: 'Readex Pro', color: @@ -192,82 +183,12 @@ class ShareDeviceWidget extends GetView { color: Colors.white, fontSize: 36.rpx, ), - validator: (value) { - if (value == null || - value.isEmpty) { - return '手机号不能为空'; - } - final phoneReg = - RegExp(r'^1[3-9]\d{9}$'); - if (!phoneReg.hasMatch(value)) { - return '请输入正确的手机号'; - } - return null; - }, onChanged: (value) { - controller.model.phone = value; + controller.model.account = + value; }, ), - ) - // TextFormField( - // // controller: _model.textController, - // // focusNode: _model.textFieldFocusNode, - // // autofocus: true, - // obscureText: false, - // decoration: InputDecoration( - // hintText: '请输入对方手机号', - // hintStyle: FlutterFlowTheme.of( - // context) - // .labelMedium - // .override( - // fontFamily: 'Readex Pro', - // color: - // const Color(0xFFD2D2D2), - // fontSize: 13, - // letterSpacing: 0.0, - // ), - // enabledBorder: - // const UnderlineInputBorder( - // borderSide: BorderSide( - // color: Color(0xFFCCCCCC), - // width: 1), - // ), - // focusedBorder: - // const UnderlineInputBorder( - // borderSide: BorderSide( - // color: Color(0xFF929699), - // width: 0), - // ), - // errorBorder: - // const UnderlineInputBorder( - // borderSide: BorderSide( - // color: Colors.red, width: 1), - // ), - // focusedErrorBorder: - // const UnderlineInputBorder( - // borderSide: BorderSide( - // color: Colors.redAccent, - // width: 1.5), - // ), - // contentPadding: - // const EdgeInsets.only( - // left: 10, bottom: 5), - // ), - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // fontSize: 13, - // letterSpacing: 0.0, - // ), - // onChanged: (value) { - // controller.model.phone = value; - // }, - // // validator: _model.textControllerValidator - // // .asValidator(context), - // ), - - ), + )), ), ), ClickableContainer( @@ -292,236 +213,280 @@ class ShareDeviceWidget extends GetView { ), ), )), - // Container( - // width: MediaQuery.sizeOf(context).width, - // constraints: const BoxConstraints( - // minHeight: 46, - // ), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(0), - // ), - // child: Align( - // alignment: - // const AlignmentDirectional(0, 0), - // child: Obx(() { - // if (controller.model.show == 0) { - // return Container(); - // } else { - // return GestureDetector( - // onTap: controller - // .model.msg!.isNotEmpty - // ? () { - // Clipboard.setData( - // ClipboardData( - // text: CommonVariables - // .shareText)); - // showToast( - // "复制成功,粘贴分享APP下载链接!", - // color: color_success); - // } - // : null, // 不可点击时设置为 null - // child: RichText( - // textAlign: TextAlign - // .center, // 设置整个 RichText 内容居中 - // text: TextSpan( - // children: - // controller.model.msg! - // .isNotEmpty - // ? [ - // TextSpan( - // text: controller - // .model - // .msg! + - // "!", // 第一部分文本 - // style: FlutterFlowTheme.of( + GestureDetector( + onTap: () { + // 当点击时,将 type 设置为 0(允许控制) + controller.model.type = 1; + controller.updateAll(); + }, + child: Container( + margin: EdgeInsets.only(top: 76.rpx), + width: MediaQuery.sizeOf(context).width, + constraints: const BoxConstraints( + minHeight: 46, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '允许对方控制该设备'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0.0, + ), + ), + Obx(() { + double h = 33.rpx; + bool check = + controller.model.type == 1; + + return Container( + height: 33.rpx, + child: AspectRatio( + aspectRatio: 1, + child: Center( + child: Container( + height: h, + width: h, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular( + h / 2), + border: Border.all( + width: check ? 1 : 0.5, + color: + Color(0xFFC8CBD2), + ), + ), + child: check + ? Center( + child: ClipOval( + child: Container( + width: h * 0.6, + height: h * 0.6, + color: const Color( + 0xFF6BFDAC), + ), + ), + ) + : null, + ), + ), + ), + ); + }), + ], + ), + ), + ), + + // Obx( + // () => GestureDetector( + // onTap: () { + // controller.model.type = 2; + // controller.updateAll(); + // }, + // child: Container( + // width: MediaQuery.sizeOf(context).width, + // constraints: const BoxConstraints( + // minHeight: 46, + // ), + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.circular(0), + // ), + // child: Row( + // mainAxisSize: MainAxisSize.max, + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Text( + // '仅允许对方查看该设备'.tr, + // style: TextStyle( + // fontFamily: 'Readex Pro', + // color: Colors.white, + // fontSize: 26.rpx, + // letterSpacing: 0.0, + // ), + // ), + // // Theme( + // // data: + // // Theme.of(context).copyWith( + // // unselectedWidgetColor: Color( + // // 0xFFC8CBD2), // 改变未选中状态边框颜色 + // // ), + // // child: Radio( + // // value: 2, + // // groupValue: + // // controller.model.type, + // // onChanged: (value) { + // // controller.model.type = + // // value!; + // // controller.updateAll(); + // // }, + // // activeColor: + // // const Color(0xFF6BFDAC), + // // materialTapTargetSize: + // // MaterialTapTargetSize + // // .shrinkWrap, // 减少内边距 + // // visualDensity: VisualDensity( + // // horizontal: -4, + // // vertical: -4), // 缩小视觉密度 + // // )) + // ClipOval( + // child: Container( + // height: + // MediaQuery.sizeOf(context) + // .height * + // 0.0449, + // child: AspectRatio( + // aspectRatio: 1, + // child: Center( + // child: LayoutBuilder( + // builder: (context, + // constraints) { + // double h = + // MediaQuery.sizeOf( // context) - // .bodyMedium - // .override( - // fontFamily: - // 'Readex Pro', - // color: const Color( - // 0xFFE55E92), // 设置为粉红色 - // fontSize: - // 26.rpx, - // letterSpacing: - // 0.0, - // ), + // .height * + // 0.0326; + // bool check = controller + // .model.type == + // 2; + // if (check) { + // return Container( + // height: h, + // width: h, + // decoration: + // BoxDecoration( + // borderRadius: + // BorderRadius + // .circular( + // h / 2), + // border: Border.all( + // width: 1, + // color: Color( + // 0xFF6BFDAC)), + // ), + // child: Center( + // child: ClipOval( + // child: Container( + // width: + // h * 0.6, + // height: + // h * 0.6, + // color: Color( + // 0xFF6BFDAC)), // ), - // const TextSpan( - // text: - // '\n', // 添加换行 - // ), - // WidgetSpan( - // child: SizedBox( - // height: 20 - // .rpx), // 添加间距 - // ), - // TextSpan( - // text: - // '点击复制APP下载链接', // 第二部分文本 - // style: FlutterFlowTheme.of( - // context) - // .bodyMedium - // .override( - // fontFamily: - // 'Readex Pro', - // color: const Color( - // 0xFF1890FF), // 设置为蓝色 - // fontSize: - // 20.rpx, - // letterSpacing: - // 0.0, - // decoration: - // TextDecoration - // .underline, // 添加下划线 - // ), - // ), - // ] - // : [ - // TextSpan( - // text: - // '发送成功!', // 当 msg 为空时显示的文本 - // style: FlutterFlowTheme.of( - // context) - // .bodyMedium - // .override( - // fontFamily: - // 'Readex Pro', - // color: const Color( - // 0xFF07C160), // 设置为绿色 - // fontSize: - // 20.rpx, - // letterSpacing: - // 0.0, - // ), - // ), - // ], + // ), + // ); + // } else { + // return Container( + // height: h, + // width: h, + // decoration: + // BoxDecoration( + // borderRadius: + // BorderRadius + // .circular( + // h / 2), + // border: Border.all( + // width: 0.5, + // color: Colors + // .white), + // ), + // ); + // } + // }, + // ), + // ), // ), // ), - // ); - // } - // })), + // ), + // ], + // ), + // ), + // ), // ), + GestureDetector( + onTap: () { + controller.model.type = 2; + controller.updateAll(); + }, + child: Container( + width: MediaQuery.sizeOf(context).width, + constraints: + const BoxConstraints(minHeight: 46), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(0), + ), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '仅允许对方查看该设备'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0.0, + ), + ), + // ✅ 只包住响应式控件部分 + Obx(() { + double h = 33.rpx; + bool check = + controller.model.type == 2; - Obx( - () => GestureDetector( - onTap: () { - // 当点击时,将 type 设置为 0(允许控制) - controller.model.type = 1; - controller.updateAll(); - }, - child: Container( - margin: EdgeInsets.only(top: 76.rpx), - width: MediaQuery.sizeOf(context).width, - constraints: const BoxConstraints( - minHeight: 46, - ), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(0), - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '允许对方控制该设备', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0.0, - ), - ), - Theme( - data: - Theme.of(context).copyWith( - unselectedWidgetColor: Color( - 0xFFC8CBD2), // 改变未选中状态边框颜色 + return Container( + height: 33.rpx, + child: AspectRatio( + aspectRatio: 1, + child: Center( + child: Container( + height: h, + width: h, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular( + h / 2), + border: Border.all( + width: check ? 1 : 0.5, + color: + Color(0xFFC8CBD2), + ), + ), + child: check + ? Center( + child: ClipOval( + child: Container( + width: h * 0.6, + height: h * 0.6, + color: const Color( + 0xFF6BFDAC), + ), + ), + ) + : null, + ), ), - child: Radio( - value: 1, - groupValue: - controller.model.type, - onChanged: (value) { - controller.model.type = - value!; - controller.updateAll(); - }, - activeColor: - const Color(0xFF6BFDAC), - materialTapTargetSize: - MaterialTapTargetSize - .shrinkWrap, // 减少内边距 - visualDensity: VisualDensity( - horizontal: -4, - vertical: -4), // 缩小视觉密度 - )) - ], - ), - ), - ), - ), - Obx( - () => GestureDetector( - onTap: () { - // 当点击时,将 type 设置为 1(仅允许查看) - controller.model.type = 2; - controller.updateAll(); - }, - child: Container( - width: MediaQuery.sizeOf(context).width, - constraints: const BoxConstraints( - minHeight: 46, - ), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(0), - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '仅允许对方查看该设备', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0.0, - ), - ), - Theme( - data: - Theme.of(context).copyWith( - unselectedWidgetColor: Color( - 0xFFC8CBD2), // 改变未选中状态边框颜色 - ), - child: Radio( - value: 2, - groupValue: - controller.model.type, - onChanged: (value) { - controller.model.type = - value!; - controller.updateAll(); - }, - activeColor: - const Color(0xFF6BFDAC), - materialTapTargetSize: - MaterialTapTargetSize - .shrinkWrap, // 减少内边距 - visualDensity: VisualDensity( - horizontal: -4, - vertical: -4), // 缩小视觉密度 - )) - ], - ), + ), + ); + }), + ], ), ), ), + Align( alignment: const AlignmentDirectional(0, 0), child: Padding( @@ -534,18 +499,21 @@ class ShareDeviceWidget extends GetView { child: FFButtonWidget( onPressed: () async { //todo 1:验证用户是否存在 2:发送邀请 - // controller.model.show = 1; - // String msg = - // await controller.sendInvite( - // controller.model.phone, - // deviceController - // .model.deviceMain['mac']); - // if (msg != null && msg.isNotEmpty) { - // controller.model.msg = msg; - // } - // controller.updateAll(); + ApiResponse apiResponse = + await controller + .shareDevice(data['mac']); + if (apiResponse.code == + HttpStatusCodes.ok) { + TopSlideNotification.show(context, + text: apiResponse.msg!); + } else { + TopSlideNotification.show(context, + text: apiResponse.msg!, + textColor: themeController + .currentColor.sc9); + } }, - text: '发送邀请', + text: '发送邀请'.tr, options: FFButtonOptions( height: 60.rpx, padding: @@ -588,7 +556,7 @@ class ShareDeviceWidget extends GetView { padding: const EdgeInsetsDirectional .fromSTEB(14, 0, 0, 16), child: Text( - '已分享用户', + '已分享用户'.tr, style: TextStyle( fontFamily: 'Readex Pro', color: Colors.white, @@ -617,10 +585,11 @@ class ShareDeviceWidget extends GetView { // .bodyMedium, // 可根据需要自定义样式 // ), // ); - return EmptyMessageWidget( - imagePath: - "assets/images/emptyUser.png", - ); + return NullDataWidget(); + // EmptyMessageWidget( + // imagePath: + // "assets/images/emptyUser.png", + // ); } // 否则显示正常的 ListView diff --git a/lib/pages/mh_page/edit_address_page.dart b/lib/pages/mh_page/edit_address_page.dart index 2100c6e..b891fbf 100644 --- a/lib/pages/mh_page/edit_address_page.dart +++ b/lib/pages/mh_page/edit_address_page.dart @@ -2,6 +2,7 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter_city_picker/listener/picker_listener.dart'; import 'package:flutter_city_picker/model/address.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; @@ -79,7 +80,7 @@ class EditAddressPage extends GetView ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -739,6 +740,158 @@ class EditAddressPage extends GetView ], ), ), + // Expanded( + // child: InkWell( + // onTap: () { + // CityPicker.show( + // context: + // context, + // cityPickerListener: + // this, + // // 在大屏/Web 上最大宽度为 600px + // // 移除内边距 + // ); + // }, + // child: Container( + // width: 100, + // height: 100, + // decoration: + // BoxDecoration( + // color: const Color( + // 0xFFF3F5F6), + // borderRadius: + // BorderRadius + // .circular( + // 8), + // ), + // alignment: + // Alignment + // .center, + // child: Obx(() { + // return TextFormField( + // enabled: + // false, + // controller: controller.onReDraw( + // TextEditingController( + // text: + // controller.model.all_address), + // (val) { + // val.text = + // controller.model.all_address ?? + // ""; + // }), + // // autofocus: true, + // obscureText: + // false, + // maxLines: 1, + // textAlignVertical: + // TextAlignVertical + // .center, // 垂直居中 + // decoration: InputDecoration( + // contentPadding: EdgeInsets.symmetric( + // vertical: + // 25.rpx, + // horizontal: + // 26.rpx, + // ), + // labelStyle: TextStyle( + // fontFamily: + // 'Readex Pro', + // letterSpacing: + // 0, + // ), + // hintStyle: TextStyle( + // fontFamily: + // 'Readex Pro', + // letterSpacing: + // 0, + // ), + // enabledBorder: UnderlineInputBorder( + // borderSide: + // const BorderSide( + // color: + // Color(0x00000000), + // width: + // 2, + // ), + // borderRadius: + // BorderRadius.circular(8), + // ), + // disabledBorder: UnderlineInputBorder( + // borderSide: + // const BorderSide( + // color: + // Color(0x00000000), + // width: + // 0, + // ), + // borderRadius: + // BorderRadius.circular(8), + // ), + // focusedBorder: UnderlineInputBorder( + // borderSide: + // const BorderSide( + // color: + // Color(0x00000000), + // width: + // 2, + // ), + // borderRadius: + // BorderRadius.circular(8), + // ), + // errorBorder: UnderlineInputBorder( + // borderSide: + // const BorderSide( + // color: + // Color(0x00000000), + // width: + // 2, + // ), + // borderRadius: + // BorderRadius.circular(8), + // ), + // focusedErrorBorder: UnderlineInputBorder( + // borderSide: + // const BorderSide( + // color: + // Color(0x00000000), + // width: + // 2, + // ), + // borderRadius: + // BorderRadius.circular(8), + // ), + // suffixIcon: Transform.rotate( + // angle: + // 1.5708, // 90 度相当于 pi / 2 弧度 + // child: + // Icon( + // Icons.arrow_forward_ios, + // color: + // Colors.black, + // size: + // 26.rpx, + // ), + // )), + // style: + // TextStyle( + // fontFamily: + // 'Readex Pro', + // letterSpacing: + // 0, + // color: Color( + // 0xFF333333), + // fontSize: + // 26.rpx, + // overflow: + // TextOverflow + // .ellipsis, + // ), + // ); + // })), + + // ), + // ), Expanded( child: InkWell( onTap: () { @@ -747,148 +900,71 @@ class EditAddressPage extends GetView context, cityPickerListener: this, - // 在大屏/Web 上最大宽度为 600px - // 移除内边距 ); }, child: Container( - width: 100, - height: 100, - decoration: - BoxDecoration( - color: const Color( - 0xFFF3F5F6), - borderRadius: - BorderRadius - .circular( - 8), - ), - alignment: - Alignment - .center, - child: Obx(() { - return TextFormField( - enabled: - false, - controller: controller.onReDraw( - TextEditingController( - text: - controller.model.all_address), - (val) { - val.text = - controller.model.all_address ?? - ""; - }), - // autofocus: true, - obscureText: - false, - textAlignVertical: - TextAlignVertical - .center, // 垂直居中 - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: - 25.rpx, - horizontal: + width: 100, + height: 100, + decoration: + BoxDecoration( + color: const Color( + 0xFFF3F5F6), + borderRadius: + BorderRadius + .circular( + 8), + ), + alignment: + Alignment + .center, + child: Obx(() { + return Row( + children: [ + Expanded( + child: + Padding( + padding: EdgeInsets.only( + left: 27 + .rpx, + right: + 10.rpx), + child: + Text( + controller.model.all_address ?? + '', + maxLines: + 1, + overflow: + TextOverflow.ellipsis, + style: + TextStyle( + fontFamily: + 'Readex Pro', + letterSpacing: + 0, + color: + Color(0xFF333333), + fontSize: 26.rpx, ), - labelStyle: TextStyle( - fontFamily: - 'Readex Pro', - letterSpacing: - 0, - ), - hintStyle: TextStyle( - fontFamily: - 'Readex Pro', - letterSpacing: - 0, - ), - enabledBorder: UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: - 2, - ), - borderRadius: - BorderRadius.circular(8), - ), - disabledBorder: UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: - 0, - ), - borderRadius: - BorderRadius.circular(8), - ), - focusedBorder: UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: - 2, - ), - borderRadius: - BorderRadius.circular(8), - ), - errorBorder: UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: - 2, - ), - borderRadius: - BorderRadius.circular(8), - ), - focusedErrorBorder: UnderlineInputBorder( - borderSide: - const BorderSide( - color: - Color(0x00000000), - width: - 2, - ), - borderRadius: - BorderRadius.circular(8), - ), - suffixIcon: Transform.rotate( - angle: - 1.5708, // 90 度相当于 pi / 2 弧度 - child: - Icon( - Icons.arrow_forward_ios, - color: - Colors.black, - size: - 26.rpx, - ), - )), - style: - TextStyle( - fontFamily: - 'Readex Pro', - letterSpacing: - 0, - color: Color( - 0xFF333333), - fontSize: - 26.rpx, - overflow: - TextOverflow - .ellipsis, - ), - ); - })), + ), + )), + Padding( + padding: + EdgeInsets.only(right: 27.rpx), + child: Container( + height: 30.rpx, + width: 30.rpx, + child: SvgPicture.asset( + 'assets/img/icon/expand_more.svg', + color: Colors.black, + ))) + ], + ); + }), + ), ), - ), + ) ].divide(const SizedBox( width: 15)), ), diff --git a/lib/pages/mh_page/edit_bed.dart b/lib/pages/mh_page/edit_bed.dart index 466f414..622d1c0 100644 --- a/lib/pages/mh_page/edit_bed.dart +++ b/lib/pages/mh_page/edit_bed.dart @@ -6,6 +6,9 @@ import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart'; +import 'package:vbvs_app/pages/mh_page/bluetooth.dart'; +import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; class EditBedPage extends StatefulWidget { final Map data; @@ -19,6 +22,7 @@ BoxConstraints? bodysize; class _EditBedPageState extends State { late Map editedData; late TextEditingController _nameController; //名称文本输入框 + DeviceListController deviceListController = Get.find(); @override void initState() { super.initState(); @@ -71,7 +75,7 @@ class _EditBedPageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -117,7 +121,7 @@ class _EditBedPageState extends State { editedData['name'] = val; }, textAlign: TextAlign.center, - initialValue: widget.data['name'], + decoration: InputDecoration( hintText: "请输入床的名称", contentPadding: @@ -205,6 +209,16 @@ class _EditBedPageState extends State { onSuccess: (res) { TopSlideNotification.show(context, text: "修改名称成功".tr); + deviceListController.getDeviceList(); + try { + WebviewTestController + webviewTestController = Get.find(); + webviewTestController.web.jsbridge?.dart + .alterDevice(); + } catch (e) { + ef.log("[h5]通知列表更新错误:$e"); + } + Get.back(result: editedData); }, ); }, @@ -222,7 +236,7 @@ class _EditBedPageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), ), - child: Text("完成", + child: Text("完成".tr, style: TextStyle( color: const Color(0xFF003058), fontSize: 26.rpx)), diff --git a/lib/pages/mh_page/experience_store_page.dart b/lib/pages/mh_page/experience_store_page.dart index f99f3bc..d9068be 100644 --- a/lib/pages/mh_page/experience_store_page.dart +++ b/lib/pages/mh_page/experience_store_page.dart @@ -11,6 +11,7 @@ import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/NullDataComponentWidget.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/mh_controller/experience_store_list_page.dart'; import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/pages/mh_page/Empty.dart'; @@ -94,7 +95,7 @@ class _ExperienceStorePageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), Positioned( @@ -104,7 +105,9 @@ class _ExperienceStorePageState extends State { highlightColor: Color(0xFF055466), padding: EdgeInsets.only(left: 0), onTap: () { - Get.toNamed("/myExperiencePage"); + TopSlideNotification.show(context, + text: "待开发功能".tr); + // Get.toNamed("/myExperiencePage"); }, child: SvgPicture.asset( 'assets/img/icon/history_store.svg', diff --git a/lib/pages/mh_page/help/article.dart b/lib/pages/mh_page/help/article.dart index 3aebe6c..1195661 100644 --- a/lib/pages/mh_page/help/article.dart +++ b/lib/pages/mh_page/help/article.dart @@ -2,135 +2,147 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:vbvs_app/common/color/appColors.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; -class HelpArticle extends StatelessWidget { - Map article; +class HelpArticle extends StatefulWidget { + final Map article; HelpArticle({super.key, required this.article}); - // get articleController => Get.find(); - get userInfoController => Get.find(); + @override + State createState() => _HelpArticleState(); +} - var isLike = 0.obs; +class _HelpArticleState extends State { + bool isLoading = true; @override Widget build(BuildContext context) { - String top_imgOrVideo = ""; - if (article['imgOrVideo'] == 0) { - top_imgOrVideo = - ''''''; - } else { - top_imgOrVideo = - ''''''; - } - String newText = article['text']; - - RegExp(" d.group(1)) - .toList() - .forEach((d) { - newText = newText.replaceAll("$d", getStorageResourceUrl("$d")); - }); - - String html = ''' - - - - - Test Page - - - - -
- ${top_imgOrVideo} -
-
${article['title']}
-
-
${article['author']}
-
${time_08_Formatter(article['created_at'])}
-
- ${newText} -
- - - - '''; - - print("$html"); - // articleController.readAdd(article['id']); - String? uid = userInfoController.model.user?.uid; - print("${userInfoController.model.user}"); - // uid = "sss"; - // if (uid != null) { - // articleController.findIsLike(uid, article['id']).then((d) { - // isLike.value = d; - // }); - // } - - return LayoutBuilder( - builder: (context, boxConstraints) => GestureDetector( - onTap: () => FocusScope.of(context).unfocus(), - child: Scaffold( - appBar: AppBar( - backgroundColor: AppColors.bg_color, - automaticallyImplyLeading: false, - iconTheme: IconThemeData(color: Colors.white), - titleSpacing: 0, - leading: returnIconButtom, + return Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/new_background.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container ), - body: SafeArea( - top: true, - child: Container( - width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height, - decoration: BoxDecoration( - color: Colors.white, - // color: AppColors.bg_color, - // image: DecorationImage( - // image: AssetImage("assets/images/background.png$test"), - // fit: BoxFit.cover, - // ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: AppBar( + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + iconTheme: IconThemeData(color: Colors.white), + titleSpacing: 0, + title: SizedBox( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + // 中间居中的标题 + Text( + '问题与帮助', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, + ), + ), + // 左侧图标 + Positioned( + left: 0.rpx, + child: returnIconButtomNew, + ), + ], + ), ), + actions: [], + centerTitle: false, + ), + body: Padding( + padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx), child: Column( children: [ - Expanded( - child: Container( - // child: WebViewWidget( - // controller: WebViewController() - // ..setJavaScriptMode(JavaScriptMode.unrestricted) - // ..loadHtmlString(html), - // ), - child: InAppWebView( - initialData: - InAppWebViewInitialData(data: html, encoding: ""), + Container( + padding: EdgeInsets.only( + left: 26.rpx, top: 53.rpx, bottom: 15.rpx), + alignment: Alignment.centerLeft, + child: Text( + widget.article['title'], + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, ), ), ), + Divider( + color: Color(0XFF929699), + thickness: 0.5.rpx, + ), + Expanded( + child: Stack( + children: [ + InAppWebView( + initialData: InAppWebViewInitialData( + data: wrapHtml(widget.article['content']), + ), + initialSettings: InAppWebViewSettings( + transparentBackground: true, + ), + onLoadStop: (controller, url) { + setState(() { + isLoading = false; + }); + }, + ), + if (isLoading) + Container( + color: const Color(0xFF042C46), + alignment: Alignment.center, + child: const CircularProgressIndicator( + valueColor: + AlwaysStoppedAnimation(Colors.white), + ), + ), + ], + ), + ), ], ), - ), - ), - ), - ), - ); + ))); + } + + String wrapHtml(String htmlContent) { + return """ + + + + + + + + + $htmlContent + + + """; } } diff --git a/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart b/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart index 602d80a..172781f 100644 --- a/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart +++ b/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart @@ -2,9 +2,12 @@ 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/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart'; +import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; class HomeDeviceStausWidget extends StatefulWidget { final deviceStatus; @@ -72,9 +75,22 @@ class _HomeDeviceStausWidgetState extends State { CustomCard( gradientDirection: GradientDirection.vertical, borderRadius: 10.rpx, - onTap: () { - // 点击回调逻辑放这里 - TopSlideNotification.show(context,text: "功能开发中...".tr); + onTap: () async { + try { + var device = widget.deviceStatus; + WebviewTestController webviewTestController = Get.find(); + var future = webviewTestController.web.jsbridge?.dart + .appToHtmlDevice(device); + Future.delayed(Duration(seconds: 5), () { + return; + }); + await future; + await webviewTestController.web.jsbridge?.dart + .pageActive(); + MainPageBBottomChange.jumpTo(2); + } catch (e) { + DailyLogUtils.writeError("发生异常: $e"); + } }, colors: AppConstants().mhtButtongradientColors, // 你原本没有渐变,单色即可 diff --git a/lib/pages/mh_page/homepage/controller/mht_home_controller.dart b/lib/pages/mh_page/homepage/controller/mht_home_controller.dart index 334c6c3..d7252f9 100644 --- a/lib/pages/mh_page/homepage/controller/mht_home_controller.dart +++ b/lib/pages/mh_page/homepage/controller/mht_home_controller.dart @@ -39,6 +39,7 @@ class MHTHomeController extends GetControllerEx { RxInt bindDeviceNum = 0.obs; //设备数量 RxMap deviceList = {}.obs; //设备列表 + RxList deviceListForWeb = [].obs; //h5设备列表 RxMap> sleepReportData = >{}.obs; //睡眠报告 RxList personnelList = [].obs; //人员信息列表 @@ -49,12 +50,13 @@ class MHTHomeController extends GetControllerEx { var sleepDays = [].obs; var homeSleepDays = [].obs; - var selectedDayIndex = (6).obs; var selectDevcie = ''.obs; var selectPerson = {}.obs; + bool initDeviceFlag = false; + Future getDeviceNum() async { try { ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); @@ -159,6 +161,68 @@ class MHTHomeController extends GetControllerEx { return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement } + Future getDeviceListForWeb( + {String? key, String? group, int? bindType}) async { + try { + ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr); + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.device_list; + + // 初始URL + String queryUrl = "$serviceAddress$serviceName$serviceApi"; + + // 用Map统一管理query参数 + Map queryParams = {}; + + if (key != null && key.isNotEmpty) { + queryParams['key'] = key; + } + + if (group != null && group.isNotEmpty) { + queryParams['group'] = group; + } + + if (bindType != null) { + queryParams['bindType'] = bindType.toString(); + } + + String? language = ""; + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + if (language != null && language.isNotEmpty) { + queryParams['lang'] = language; + } + + // 拼接完整URL + if (queryParams.isNotEmpty) { + queryUrl += '?' + Uri(queryParameters: queryParams).query; + } + + 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) { + deviceListForWeb.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 deleteDevice(Map device) async { try { ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr); @@ -428,6 +492,7 @@ class MHTHomeController extends GetControllerEx { }, ); } + Future getHomeSleeps(String? mac) async { String serviceAddress = ServiceConstant.service_address; String serviceName = ServiceConstant.server_service; @@ -495,4 +560,79 @@ class MHTHomeController extends GetControllerEx { }, ); } + + //开启定时器 + void startTimer(args) { + var tmp = args[0]; + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.user_setting; + String type = "control_${tmp['mac']}"; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + var data = { + "type": type, + "duration": tmp['duration'], + "mac": tmp['mac'], + "time": tmp['startTime'], + }; + requestWithLog( + logTitle: "更新控制倒计时", + method: MyHttpMethod.put, + queryUrl: queryUrl, + data: data, + onSuccess: (res) {}); + } + + //关闭定时器 + void cancelTimer(args) { + var tmp = args[0]; + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.user_setting; + String type = "control_${tmp['mac']}"; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + var data = { + "type": type, + "duration": 0, + "mac": tmp['mac'], + "time": tmp['startTime'], + }; + requestWithLog( + logTitle: "查询控制倒计时", + method: MyHttpMethod.put, + queryUrl: queryUrl, + data: data, + onSuccess: (res) {}); + } + + //恢复 + restoreTimer(args) async { + var data = {}; + try { + var tmp = args[0]; + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.user_setting; + String type = "control_${tmp}"; + String queryUrl = + "${serviceAddress}${serviceName}${serviceApi}?type=$type"; + await requestWithLog( + logTitle: "查询控制倒计时", + method: MyHttpMethod.get, + queryUrl: queryUrl, + onSuccess: (res) { + if (res.data != null) { + data = res.data; + } + }, + onFailure: (res) { + data = {}; + }, + ); + } catch (e) { + ef.log("$e"); + } + + return data; + } } diff --git a/lib/pages/mh_page/homepage/mht_sleep_report_page.dart b/lib/pages/mh_page/homepage/mht_sleep_report_page.dart index 8c234fb..58ec9ca 100644 --- a/lib/pages/mh_page/homepage/mht_sleep_report_page.dart +++ b/lib/pages/mh_page/homepage/mht_sleep_report_page.dart @@ -273,6 +273,7 @@ class _MhtSleepReportPageState extends State { 'backgroundImg': 'assets/images/new_background.png', 'arrow': false, + 'noBackImg':true, }, ), ); diff --git a/lib/pages/mh_page/homepage/new_Home_page.dart b/lib/pages/mh_page/homepage/new_Home_page.dart index 590d589..c72abe3 100644 --- a/lib/pages/mh_page/homepage/new_Home_page.dart +++ b/lib/pages/mh_page/homepage/new_Home_page.dart @@ -115,6 +115,39 @@ class _NewHomePageState extends State { // deviceController.getSleepReport(); } }); + if (userInfoController.model.login == 1) { + //查询人员信息列表 + deviceController.getPersonList(); + //请求绑定设备列表 + // homeController.getSleepReport(); + deviceController.getDeviceNum().then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + Get.context!, + text: apiResponse.msg!, + textColor: themeController.currentColor.sc9, + ); + } + }); + deviceController.getDeviceList(group: 'room').then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + Get.context!, + text: apiResponse.msg!, + textColor: themeController.currentColor.sc9, + ); + } else { + //请求睡眠报告 + // deviceController.getSleepReport(); + } + }); + } + WidgetsBinding.instance.addPostFrameCallback((_) { + if (homeController.homeSleepDays.value.isNotEmpty) { + homeController.selectedDayIndex.value = + homeController.homeSleepDays.value.length - 1; + } + }); int login = userInfoController.model.login!; return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), @@ -138,7 +171,14 @@ class _NewHomePageState extends State { children: [ // 左侧头像 Obx(() { - return userInfo(userInfoController.model.login); + return InkWell( + onTap: () { + if (userInfoController.model.login == 0) { + Get.toNamed("/loginPage"); + } + }, + child: userInfo(userInfoController.model.login), + ); }), const Spacer(), // 左右分隔 FloatingSvgIcon( @@ -332,7 +372,7 @@ class _NewHomePageState extends State { MediaQuery.sizeOf(context).height * 0.184, constraints: BoxConstraints( - minHeight: 350.rpx, + minHeight: 354.rpx, ), decoration: BoxDecoration( color: stringToColor("#003058"), @@ -345,8 +385,8 @@ class _NewHomePageState extends State { Padding( padding: EdgeInsetsDirectional.fromSTEB( - 30.rpx, - 16.rpx, + 20.rpx, + 20.rpx, 16.rpx, 25.rpx), child: Container( @@ -786,10 +826,15 @@ class _NewHomePageState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons.add, - size: 60.rpx, - color: stringToColor("#85F5FF"), + // Icon( + // Icons.add, + // size: 60.rpx, + // color: stringToColor("#85F5FF"), + // ), + SvgPicture.asset( + 'assets/images/icon/add.svg', + width: 42.rpx, + height: 42.rpx, ), SizedBox(width: 20.rpx), Text( diff --git a/lib/pages/mh_page/issue_list_page.dart b/lib/pages/mh_page/issue_list_page.dart index fd5278c..22fd649 100644 --- a/lib/pages/mh_page/issue_list_page.dart +++ b/lib/pages/mh_page/issue_list_page.dart @@ -64,7 +64,7 @@ class IssueListPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/issue_preview_widget.dart b/lib/pages/mh_page/issue_preview_widget.dart index e0e9241..efa5dbd 100644 --- a/lib/pages/mh_page/issue_preview_widget.dart +++ b/lib/pages/mh_page/issue_preview_widget.dart @@ -27,12 +27,12 @@ class IssuePreviewWidget extends GetView { // await Future.delayed(Duration(milliseconds: 100)); // issueListController.model.selectedIndex = -1; // issueListController.updateAll(); - // var article = issueListController.model.issueList![index]; - // Get.toNamed("/helpArticle", arguments: article); - TopSlideNotification.show( - context, - text: "功能开发中...", - ); + var article = issueListController.model.issueList![index]; + Get.toNamed("/helpArticle", arguments: article); + // TopSlideNotification.show( + // context, + // text: "功能开发中...", + // ); }, child: Obx(() { return Container( diff --git a/lib/pages/mh_page/message/messageDetail.dart b/lib/pages/mh_page/message/messageDetail.dart new file mode 100644 index 0000000..01fb5b4 --- /dev/null +++ b/lib/pages/mh_page/message/messageDetail.dart @@ -0,0 +1,262 @@ +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/appFontsize.dart'; +import 'package:vbvs_app/common/color/app_uri_status.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/mh_controller/message_controller.dart'; +import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart'; +import 'package:vbvs_app/model/api_response.dart'; + +class MessageDetailPage extends StatefulWidget { + final data; + const MessageDetailPage({super.key, required this.data}); + + @override + _MessageDetailPageState createState() => _MessageDetailPageState(); +} + +class _MessageDetailPageState extends State { + MHDeviceShareController controller = Get.find(); + MhMessageController messageController = Get.find(); + @override + Widget build(BuildContext context) { + var messageInfo = widget.data; + return LayoutBuilder( + builder: (context, boxConstraints) => GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: + AssetImage('assets/images/new_background.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), + ), + child: Scaffold( + appBar: AppBar( + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + iconTheme: + IconThemeData(color: themeController.currentColor.sc3), + titleSpacing: 0, + title: SizedBox( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + // 中间居中的标题 + Text( + '消息详情', + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, + ), + ), + // 左侧图标 + Positioned( + left: 0.rpx, + child: returnIconButtomNew, + ), + ], + ), + ), + actions: const [], + centerTitle: false, + ), + backgroundColor: Colors.transparent, + body: SafeArea( + top: true, + child: Padding( + padding: EdgeInsets.only(top: 30.rpx), + child: Column( + children: [ + Padding( + padding: + EdgeInsets.only(left: 30.rpx, right: 30.rpx), + child: Container( + decoration: BoxDecoration( + color: Color(0XFF003058), + borderRadius: BorderRadius.circular(16.rpx), + ), + child: Padding( + padding: EdgeInsets.only( + left: 30.rpx, + top: 20.rpx, + bottom: 20.rpx), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + constraints: BoxConstraints( + minHeight: 66.rpx), + child: Align( + alignment: + AlignmentDirectional(-1, 0), + child: Text( + "${messageInfo['data']['title']}", + style: TextStyle( + fontFamily: 'Inter', + fontSize: 30.rpx, + letterSpacing: 0.0, + color: themeController + .currentColor.sc3, + ), + ), + ), + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + constraints: BoxConstraints( + minWidth: 30.rpx, + maxWidth: 140.rpx), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: messageInfo['data'] + ['val'] + .map((mapItem) => + _buildInfoItem( + context, + mapItem['k'] ?? + '')) + .toList(), + ), + ), + Container( + constraints: BoxConstraints( + minWidth: 30.rpx), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: messageInfo['data'] + ['val'] + .map((mapItem) => + _buildValueItem( + context, + mapItem['v'] ?? + '')) + .toList(), + ), + ), + ].divide(SizedBox(width: 30.rpx)), + ), + ], + ))), + ), + const Spacer(), + bottomIcon(context) + ], + )), + ), + ), + ), + )); + } + + Container bottomIcon(BuildContext context) { + return Container( + height: 120.rpx, + decoration: BoxDecoration( + color: Color(0xFF003058), + ), + width: double.infinity, + child: TextButton( + onPressed: () async { + if (widget.data['status'] == 1) { + ApiResponse apiResponse = + await controller.confirmShare(widget.data['data']['shareCode']); + if (apiResponse.code == HttpStatusCodes.ok) { + TopSlideNotification.show(context, + text: apiResponse.msg!, textColor: Color(0xFF00C1AA)); + messageController.getMessageList(); + messageController.updateAll(); + } else { + TopSlideNotification.show(context, + text: apiResponse.msg!, textColor: Color(0XFFFF7159)); + messageController.getMessageList(); + messageController.updateAll(); + } + } + }, + child: Text( + getStatusText(widget.data['status']), + style: TextStyle( + fontFamily: 'Readex Pro', + color: widget.data['data']['status'] == 1 + ? Colors.white + : Color(0xFF929699), + fontSize: 26.rpx, + letterSpacing: 0, + ), + ), + ), + ); + } + + Widget _buildInfoItem(BuildContext context, String label) { + return Container( + constraints: BoxConstraints( + minHeight: 62.rpx, + ), + child: Align( + alignment: AlignmentDirectional(-1, 0), + child: Text( + overflow: TextOverflow.ellipsis, + maxLines: 1, + label.tr, + style: TextStyle( + fontFamily: 'Inter', + fontSize: 26.rpx, + letterSpacing: 0.0, + color: themeController.currentColor.sc4, + ), + ), + ), + ); + } + + Widget _buildValueItem(BuildContext context, value) { + return Container( + constraints: BoxConstraints( + minHeight: 62.rpx, + ), + child: Align( + alignment: AlignmentDirectional(-1, 0), + child: Text( + overflow: TextOverflow.ellipsis, + maxLines: 1, + "${value}", + style: TextStyle( + fontFamily: 'Inter', + fontSize: 26.rpx, + letterSpacing: 0.0, + color: themeController.currentColor.sc3, + ), + ), + ), + ); + } + + String getStatusText(int status) { + switch (status) { + case 1: + return '同意'; + case 2: + return '已同意'; + case 3: + return '已过期'; + default: + return '未知状态'; + } + } +} diff --git a/lib/pages/mh_page/message_page.dart b/lib/pages/mh_page/message_page.dart index bffeda1..36b69b8 100644 --- a/lib/pages/mh_page/message_page.dart +++ b/lib/pages/mh_page/message_page.dart @@ -175,7 +175,7 @@ class _MessagePageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -261,6 +261,7 @@ class _MessagePageState extends State { ), ), ); + } Container bottomIcon(BuildContext context) { diff --git a/lib/pages/mh_page/my_experience_page.dart b/lib/pages/mh_page/my_experience_page.dart index 2e52625..9674f11 100644 --- a/lib/pages/mh_page/my_experience_page.dart +++ b/lib/pages/mh_page/my_experience_page.dart @@ -88,7 +88,7 @@ class _MyExperiencePageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/new_mine_page.dart b/lib/pages/mh_page/new_mine_page.dart index 91ccc68..96205fa 100644 --- a/lib/pages/mh_page/new_mine_page.dart +++ b/lib/pages/mh_page/new_mine_page.dart @@ -141,7 +141,7 @@ class _MinePageState extends State { userInfoController .model.user!.avatar!.isEmpty ? Image.asset( - "assets/images/people_avatar.png", + "assets/images/default_avatar.png", fit: BoxFit.cover, ) : Image.network( @@ -149,7 +149,7 @@ class _MinePageState extends State { fit: BoxFit.cover, )) : Image.asset( - "assets/images/people_avatar.png", + "assets/images/default_avatar.png", fit: BoxFit.cover, ), ), @@ -250,7 +250,7 @@ class _MinePageState extends State { ), ), child: Text( - '我的智能床', + '我的智能设备'.tr, style: TextStyle( fontSize: 26.rpx, color: const Color(0xFF003058)), ), diff --git a/lib/pages/mh_page/new_settingPage.dart b/lib/pages/mh_page/new_settingPage.dart index 003ceec..fea8db7 100644 --- a/lib/pages/mh_page/new_settingPage.dart +++ b/lib/pages/mh_page/new_settingPage.dart @@ -63,7 +63,7 @@ class _SettingPageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -288,7 +288,9 @@ class _SettingPageState extends State { .currentColor.sc21, // 点击时的背景色 padding: EdgeInsetsDirectional.fromSTEB( 0.rpx, 0.rpx, 0.rpx, 0.rpx), - onTap: () {}, + onTap: () { + Get.toNamed('/aboutUs'); + }, child: Container( child: Padding( padding: EdgeInsetsDirectional.fromSTEB( @@ -335,8 +337,7 @@ class _SettingPageState extends State { padding: EdgeInsetsDirectional.fromSTEB( 40.rpx, 0.rpx, 40.rpx, 0.rpx), onTap: () { - TopSlideNotification.show(context, - text: "待开发功能".tr); + Get.toNamed("/userAgreementPage"); }, child: Container( child: Padding( @@ -384,8 +385,7 @@ class _SettingPageState extends State { padding: EdgeInsetsDirectional.fromSTEB( 0.rpx, 0.rpx, 0.rpx, 0.rpx), onTap: () { - TopSlideNotification.show(context, - text: "待开发功能".tr); + Get.toNamed("/privacyPolicyPage"); }, child: Container( child: Padding( @@ -568,8 +568,10 @@ class _SettingPageState extends State { ), ), Text( - AppConstants().ent_type == 1? 'Copyright © 202-2025 嘉兴太和信息技术有限责任公司 版权所有' - .tr:"Copyright © 202-2025 杭州欢睡科技有限公司 版权所有", + AppConstants().ent_type == 1 + ? 'Copyright © 202-2025 嘉兴太和信息技术有限责任公司 版权所有' + .tr + : "Copyright © 202-2025 杭州欢睡科技有限公司 版权所有", style: TextStyle( color: themeController.currentColor.sc4, fontFamily: 'Inter', diff --git a/lib/pages/mh_page/people_info.dart b/lib/pages/mh_page/people_info.dart index 175bc7d..17969a4 100644 --- a/lib/pages/mh_page/people_info.dart +++ b/lib/pages/mh_page/people_info.dart @@ -4,10 +4,12 @@ import 'package:ef/ef.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/mh_controller/people_info_controller.dart'; @@ -58,7 +60,7 @@ class PeopleInfoPage extends GetView { children: [ // 中间居中的标题 Text( - '人员资料', + '人员资料'.tr, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -67,7 +69,7 @@ class PeopleInfoPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), Positioned( @@ -89,7 +91,9 @@ class PeopleInfoPage extends GetView { d['height'].toString().isNotEmpty && int.tryParse(d['height'].toString()) == null) { - showToast("$prefix身高请输入数字"); + TopSlideNotification.show(context, + text: "请选择身高".tr, + textColor: Color(0xFFFF7159)); isValid = false; break; } @@ -98,16 +102,9 @@ class PeopleInfoPage extends GetView { d['weight'].toString().isNotEmpty && int.tryParse(d['weight'].toString()) == null) { - showToast("$prefix体重请输入数字"); - isValid = false; - break; - } - - if (d['tel'] != null && - d['tel'].toString().isNotEmpty && - !MyUtils.isValidPhoneNumber( - d['tel'].toString())) { - showToast("$prefix请输入正确的电话"); + TopSlideNotification.show(context, + text: "请选择体重".tr, + textColor: Color(0xFFFF7159)); isValid = false; break; } @@ -116,7 +113,9 @@ class PeopleInfoPage extends GetView { d['contact'].toString().isNotEmpty && !MyUtils.isValidPhoneNumber( d['contact'].toString())) { - showToast("$prefix请输入正确的紧急联系人电话"); + TopSlideNotification.show(context, + text: "请输入正确的联系人电话".tr, + textColor: Color(0xFFFF7159)); isValid = false; break; } @@ -126,13 +125,15 @@ class PeopleInfoPage extends GetView { if (isValid) { for (var data in controller.model.peopleList) { try { - await controller.savePeoples( - data); // 注意:你这个方法名是 savePeoples,建议改成 savePerson - showToast("保存成功(${data['mac']})", - color: color_success); + await controller.savePeoples(data); + TopSlideNotification.show(context, + text: "更新成功".tr, + textColor: Color(0XFF00C1AA)); } catch (e) { print("保存失败:$e"); - showToast("保存失败(${data['mac']})"); + TopSlideNotification.show(context, + text: "更新失败".tr, + textColor: Color(0xFFFF7159)); } } } @@ -153,7 +154,7 @@ class PeopleInfoPage extends GetView { // color: stringToColor("#182B7C"), // ), child: Text( - "保存", + "保存".tr, style: TextStyle( fontFamily: 'Readex Pro', color: Color(0XFF011D33), @@ -391,12 +392,16 @@ class PeopleInfoPage extends GetView { SizedBox( width: 16.rpx, ), - Icon( - Icons.expand_more, - color: - Colors.white, - size: 48.rpx, - ), + Container( + height: 30.rpx, + width: 30.rpx, + child: + SvgPicture + .asset( + 'assets/img/icon/expand_more.svg', + color: Colors + .white, + )) ], ), ], @@ -560,11 +565,15 @@ class PeopleInfoPage extends GetView { ), SizedBox( width: 16.rpx), - Icon( - Icons.expand_more, - color: - Colors.white, - size: 48.rpx), + Container( + height: 30.rpx, + width: 30.rpx, + child: SvgPicture + .asset( + 'assets/img/icon/expand_more.svg', + color: Colors + .white, + )) ], ), ], @@ -649,12 +658,16 @@ class PeopleInfoPage extends GetView { ), SizedBox( width: 16.rpx), - Icon( - Icons - .expand_more, - color: Colors - .white, - size: 48.rpx), + Container( + height: 30.rpx, + width: 30.rpx, + child: + SvgPicture + .asset( + 'assets/img/icon/expand_more.svg', + color: Colors + .white, + )) ], ), ], @@ -769,12 +782,16 @@ class PeopleInfoPage extends GetView { SizedBox( width: 16.rpx, ), - Icon( - Icons.expand_more, - color: - Colors.white, - size: 48.rpx, - ), + Container( + height: 30.rpx, + width: 30.rpx, + child: + SvgPicture + .asset( + 'assets/img/icon/expand_more.svg', + color: Colors + .white, + )) ], ), ], diff --git a/lib/pages/mh_page/privacy_policy.dart b/lib/pages/mh_page/privacy_policy.dart new file mode 100644 index 0000000..1e859d1 --- /dev/null +++ b/lib/pages/mh_page/privacy_policy.dart @@ -0,0 +1,121 @@ +import 'package:ef/ef.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_pdfview/flutter_pdfview.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/controller/setting/pdf/PrivacyPdfController.dart'; + +class PrivacyPolicyPage extends StatefulWidget { + PrivacyPolicyPage({super.key}); + + @override + State createState() => _PrivacyPolicyPageState(); +} + +class _PrivacyPolicyPageState extends State { + PrivacyPdfController pdfController = Get.find(); + + @override + void initState() { + super.initState(); + String language = "zh_CN"; // 默认语言 + int ent_type = AppConstants().ent_type; + if (languageController.selectLanguage?.value?.language_code != null) { + language = languageController.selectLanguage!.value!.language_code!; + } // 根据 ent_type 拼接不同的文件名 + String pdfName = + ent_type == 1 ? "$language.pdf" : "${language}_$ent_type.pdf"; + + pdfController.loadPdf( + 2, + "https://vsbst-api.he-info.cn/vsbs_sotrage/privacy-scheme/$pdfName", + ); + } + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, bodySize) => GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/new_background.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, // 加上这一行 + appBar: AppBar( + backgroundColor: themeController.currentColor.sc17, + automaticallyImplyLeading: false, + iconTheme: IconThemeData( + color: themeController.currentColor.sc3, + ), + titleSpacing: 0, + // leading: returnIconButtom, + title: Container( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + /// 居中标题 + Text( + '隐私协议'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + ), + ), + + /// 左边返回按钮 + Positioned( + left: 0, + child: returnIconButtomNew, + ), + ], + ), + ), + + actions: [], + centerTitle: false, + ), + body: SafeArea( + top: true, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 0.rpx), + child: Column( + children: [ + Expanded( + child: Obx(() { + if (pdfController.localPdfPath.value == null) { + return Center(child: CircularProgressIndicator()); + } else { + return PDFView( + filePath: pdfController.localPdfPath.value!, + autoSpacing: false, + enableSwipe: true, + swipeHorizontal: false, + pageSnap: true, + fitEachPage: true, + defaultPage: 0, + onRender: (pages) => print('PDF 渲染完成,共 $pages 页'), + onError: (error) => print('PDF 加载错误: $error'), + ); + } + }), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/mh_page/repair_history_page.dart b/lib/pages/mh_page/repair_history_page.dart index edada1c..211cd9e 100644 --- a/lib/pages/mh_page/repair_history_page.dart +++ b/lib/pages/mh_page/repair_history_page.dart @@ -106,7 +106,7 @@ class RepairHistoryListPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/repair_list.dart b/lib/pages/mh_page/repair_list.dart index 57b7580..81eb002 100644 --- a/lib/pages/mh_page/repair_list.dart +++ b/lib/pages/mh_page/repair_list.dart @@ -3,6 +3,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/component/NullDataComponentWidget.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/mh_controller/apply_repair_controller.dart'; import 'package:vbvs_app/controller/mh_controller/repair_list_controller.dart'; @@ -75,7 +76,7 @@ class DeviceRepairPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -257,7 +258,7 @@ class DeviceRepairPage extends GetView { )) .toList(), ) - : EmptyMessageWidget(); + : NullDataWidget(); }), ), ], diff --git a/lib/pages/mh_page/room_picker.dart b/lib/pages/mh_page/room_picker.dart index 6a0b87d..4853cd7 100644 --- a/lib/pages/mh_page/room_picker.dart +++ b/lib/pages/mh_page/room_picker.dart @@ -5,6 +5,9 @@ import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; +import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart'; +import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; class RoomPickerPage extends StatefulWidget { final Map data; @@ -16,7 +19,7 @@ class RoomPickerPage extends StatefulWidget { class _RoomPickerPageState extends State { late Map editedData; RxList rooms = [].obs; - + DeviceListController deviceListController = Get.find(); @override void initState() { super.initState(); @@ -79,7 +82,7 @@ class _RoomPickerPageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -186,7 +189,25 @@ class _RoomPickerPageState extends State { "roomId": rooms[selectedIndex]['_id'], }, onSuccess: (res) { - '更新人员信息成功: $res'; + + TopSlideNotification.show(context, + text: "更新成功".tr, + textColor: Color(0XFF00C1AA)); + deviceListController.getDeviceList(); + try { + WebviewTestController + webviewTestController = Get.find(); + webviewTestController.web.jsbridge?.dart + .alterDevice(); + } catch (e) { + ef.log("[h5]通知列表更新错误:$e"); + } + Get.back(result:editedData); + }, + onFailure: (res) { + TopSlideNotification.show(context, + text: "更新失败".tr, + textColor: Color(0xFFFF7159)); }, ); } catch (e) { @@ -207,7 +228,7 @@ class _RoomPickerPageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6), ), - child: Text("完成", + child: Text("完成".tr, style: TextStyle( color: const Color(0xFF003058), fontSize: 30.rpx, diff --git a/lib/pages/mh_page/score_page.dart b/lib/pages/mh_page/score_page.dart index 8a4faa1..0299a3d 100644 --- a/lib/pages/mh_page/score_page.dart +++ b/lib/pages/mh_page/score_page.dart @@ -42,7 +42,7 @@ class ScorePage extends GetView { children: [ // 中间居中的标题 Text( - '评价', + '评价'.tr, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -51,7 +51,7 @@ class ScorePage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -107,7 +107,7 @@ class ScorePage extends GetView { alignment: AlignmentDirectional(0, 0), child: Text( - '我要评价', + '我要评价'.tr, style: TextStyle( fontFamily: 'Readex Pro', fontSize: 30.rpx, diff --git a/lib/pages/mh_page/searchWidget.dart b/lib/pages/mh_page/searchWidget.dart index 3e5b0b7..ad7e729 100644 --- a/lib/pages/mh_page/searchWidget.dart +++ b/lib/pages/mh_page/searchWidget.dart @@ -117,6 +117,9 @@ class SearchWidget extends GetView { // validator: _model // .textControllerValidator // .asValidator(context), + onChanged: (d) { + onChange?.call(d); + }, ), ), ), @@ -125,29 +128,33 @@ class SearchWidget extends GetView { ), ), 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: stringToColor("#333333"), //固定 - ), + padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0), + child: InkWell( + onTap: () { + findCallback?.call(); + }, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + height: 30.rpx, + child: VerticalDivider( + thickness: 2.rpx, + color: stringToColor("#333333"), //固定 + ), + ), + Text( + '搜索'.tr, + style: TextStyle( + fontFamily: 'Inter', + fontSize: 30.rpx, + letterSpacing: 0.0, + color: stringToColor("#333333"), //固定 + ), + ), + ].divide(SizedBox(width: 26.rpx)), ), - Text( - '搜索'.tr, - style: TextStyle( - fontFamily: 'Inter', - fontSize: 30.rpx, - letterSpacing: 0.0, - color: stringToColor("#333333"), //固定 - ), - ), - ].divide(SizedBox(width: 26.rpx)), - ), - ), + )), ], ), ), diff --git a/lib/pages/mh_page/sleep_habit.dart b/lib/pages/mh_page/sleep_habit.dart index fb321b4..a4c3d3b 100644 --- a/lib/pages/mh_page/sleep_habit.dart +++ b/lib/pages/mh_page/sleep_habit.dart @@ -40,7 +40,7 @@ class _SleepHabitPageState extends State { children: [ // 中间居中的标题 Text( - '设备报修', + '睡眠习惯'.tr, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -49,7 +49,7 @@ class _SleepHabitPageState extends State { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -77,7 +77,7 @@ class _SleepHabitPageState extends State { width: bodysize!.maxWidth * 1, height: bodysize!.maxHeight * 0.056, child: Text( - '柔性唤醒', + '柔性唤醒'.tr, style: TextStyle( fontSize: 26.rpx, color: Colors.white), ))), @@ -95,7 +95,7 @@ class _SleepHabitPageState extends State { width: bodysize!.maxWidth * 1, height: bodysize!.maxHeight * 0.056, child: Text( - '睡眠隐私', + '睡眠隐私'.tr, style: TextStyle( fontSize: 26.rpx, color: Colors.white), ))) diff --git a/lib/pages/mh_page/smys.dart b/lib/pages/mh_page/smys.dart index b07413a..7369952 100644 --- a/lib/pages/mh_page/smys.dart +++ b/lib/pages/mh_page/smys.dart @@ -66,7 +66,7 @@ class Smys extends GetView { children: [ // 中间居中的标题 Text( - '睡眠隐私', + '睡眠隐私'.tr, textAlign: TextAlign.center, style: TextStyle( color: Colors.white, @@ -75,7 +75,7 @@ class Smys extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], @@ -125,7 +125,7 @@ class Smys extends GetView { MainAxisAlignment.spaceBetween, children: [ Text( - '睡眠隐私功能', + '睡眠隐私功能'.tr, style: TextStyle( fontFamily: 'Readex Pro', color: Color(0xFF9EA4B7), @@ -156,52 +156,52 @@ class Smys extends GetView { ), )), // getLine(), - Container( - width: double.infinity, - height: MediaQuery.sizeOf(context).height * 0.055, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color(0xFF929699), - width: 0.rpx), + InkWell( + onTap: () async { + showDayTimeSelectionDialog(context, + dayTimeArr: controller.model.smysStartTime, + title: "开始时间".tr, checkChange: (d) { + controller.attr.update((getmodel) { + getmodel.model.smysStartTime = [ + int.parse("${d[0]}"), + int.parse("${d[1]}") + ]; + }); + // updateParm(); + }); + }, + child: Container( + width: double.infinity, + height: + MediaQuery.sizeOf(context).height * 0.055, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color(0xFF929699), + width: 0.rpx), + ), ), - ), - constraints: BoxConstraints( - minHeight: 90.rpx, // 设置最小高度 - ), - child: Padding( - padding: EdgeInsets.fromLTRB( - 39.rpx, 0.rpx, 30.rpx, 0.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '开始时间', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: 26.rpx, - letterSpacing: 0, + constraints: BoxConstraints( + minHeight: 90.rpx, // 设置最小高度 + ), + child: Padding( + padding: EdgeInsets.fromLTRB( + 39.rpx, 0.rpx, 30.rpx, 0.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '开始时间'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: 26.rpx, + letterSpacing: 0, + ), ), - ), - InkWell( - onTap: () async { - showDayTimeSelectionDialog(context, - dayTimeArr: - controller.model.smysStartTime, - title: "开始时间", checkChange: (d) { - controller.attr.update((getmodel) { - getmodel.model.smysStartTime = [ - int.parse("${d[0]}"), - int.parse("${d[1]}") - ]; - }); - // updateParm(); - }); - }, - child: Row( + Row( mainAxisSize: MainAxisSize.max, children: [ Text( @@ -225,57 +225,56 @@ class Smys extends GetView { )) ], ), - ), - ], - ), - )), - // getLine(), - Container( - width: double.infinity, - height: MediaQuery.sizeOf(context).height * 0.055, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - color: const Color(0xFF929699), - width: 0.rpx), - ), - ), - constraints: BoxConstraints( - minHeight: 90.rpx, // 设置最小高度 - ), - child: Padding( - padding: EdgeInsets.fromLTRB( - 39.rpx, 0.rpx, 30.rpx, 0.rpx), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - '结束时间', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: 26.rpx, - letterSpacing: 0, - ), + ], ), - InkWell( - onTap: () async { - showDayTimeSelectionDialog(context, - dayTimeArr: - controller.model.smysEndTime, - title: "结束时间", checkChange: (d) { - controller.attr.update((getmodel) { - getmodel.model.smysEndTime = [ - int.parse("${d[0]}"), - int.parse("${d[1]}") - ]; - }); - // updateParm(); - }); - }, - child: Row( + )), + ), + // getLine(), + InkWell( + onTap: () async { + showDayTimeSelectionDialog(context, + dayTimeArr: controller.model.smysEndTime, + title: "结束时间".tr, checkChange: (d) { + controller.attr.update((getmodel) { + getmodel.model.smysEndTime = [ + int.parse("${d[0]}"), + int.parse("${d[1]}") + ]; + }); + // updateParm(); + }); + }, + child: Container( + width: double.infinity, + height: MediaQuery.sizeOf(context).height * 0.055, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: const Color(0xFF929699), + width: 0.rpx), + ), + ), + constraints: BoxConstraints( + minHeight: 90.rpx, // 设置最小高度 + ), + child: Padding( + padding: EdgeInsets.fromLTRB( + 39.rpx, 0.rpx, 30.rpx, 0.rpx), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '结束时间'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: 26.rpx, + letterSpacing: 0, + ), + ), + Row( mainAxisSize: MainAxisSize.max, children: [ Text( @@ -299,12 +298,11 @@ class Smys extends GetView { )) ], ), - ), - ], + ], + ), ), ), - ), - // getLine(), + ), // getLine(), SizedBox( height: 30.rpx, ), @@ -314,7 +312,7 @@ class Smys extends GetView { width: double.infinity, decoration: BoxDecoration(), child: Text( - '*注:开启睡眠隐私功能后,在设置的时间段内,将不会采集您的睡眠数据。', + '*注:开启睡眠隐私功能后,在设置的时间段内,将不会采集您的睡眠数据。'.tr, style: TextStyle( fontFamily: 'Readex Pro', color: Color(0xFF9EA4B7), diff --git a/lib/pages/mh_page/test/WebviewTestModel.dart b/lib/pages/mh_page/test/WebviewTestModel.dart index 45dbd5a..7646d81 100644 --- a/lib/pages/mh_page/test/WebviewTestModel.dart +++ b/lib/pages/mh_page/test/WebviewTestModel.dart @@ -1,9 +1,16 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:EasyDartModule/EasyDartModule.dart' as edm; +import 'package:easydevice/easydevice.dart'; +import 'package:easyweb/base/easyws.dart'; +import 'package:easyweb/base/minisdk.dart'; import 'package:easyweb/easyweb.dart'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; -import 'package:easyweb/base/minisdk.dart'; -import 'package:easydevice/easydevice.dart'; +import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart'; @@ -16,14 +23,18 @@ class WebviewTestModel { } class WebviewTestController extends GetControllerEx { - var selectDevice; - var bluetooth = false; + var selectDevice = {}; + var lastSelectDevice = {}; + var bluetooth = 0; + List personList = []; + List instantData = []; + WebviewTestController() : super(WebviewTestModel()) { web = WebviewHelper( jsbridge: buildsdk( - father: this, + // father: this, // clientId: '494641114', - //dbgserverUrl: 'ws://192.168.1.2:9001', + // dbgserverUrl: 'ws://192.168.1.2:9001', ), settings: buildsettings(), params: PlatformHeadlessInAppWebViewCreationParams( @@ -46,12 +57,32 @@ class WebviewTestController extends GetControllerEx { bridge.sdk.updateDeviceRoute((args) async { ef.log('updateDeviceRoute: $args'); selectDevice['blueToothStatus'] = bluetooth; - Get.toNamed("$args[0]", arguments: selectDevice); + Get.toNamed("${args[0]}", arguments: selectDevice); return true; }); bridge.sdk.selectDevice((args) async { +<<<<<<< HEAD ef.log('selectDevice: $args'); selectDevice = args[0]; +======= + try { + ef.log('selectDevice: $args'); + selectDevice = args[0]; + await queryPersonInfoByMac(); + if (selectDevice != null && + selectDevice.isNotEmpty && + selectDevice['mac'] != null && + (selectDevice['mac'] != args[0]['mac'])) { + lastSelectDevice = selectDevice; + } + dealInstantData(selectDevice); + } catch (e) { + ef.log("[aaaa]$e"); + } + + //查询人员信息 + +>>>>>>> 13eb25e1c30dcd81c87aa85bcb5306ca0931ed21 return true; }); bridge.sdk.updateBlueToothStatus((args) async { @@ -59,6 +90,57 @@ class WebviewTestController extends GetControllerEx { bluetooth = args[0]; return true; }); + //sdk定义接口 + bridge.sdk.querySelectDevice((args) async { + ef.log('updateBlueToothStatus: $args'); + // bluetooth = args[0]; + MHTHomeController deviceController = Get.find(); + final allDevices = deviceController.deviceList.values + .expand((list) => list) + .toList(); + return allDevices; + }); + //请求token信息 + bridge.sdk.queryUserToken((args) async { + ef.log('queryUserToken: $args'); + // bluetooth = args[0]; + return edm.EasyDartModule.dio.token; + }); + //请求设备人员信息 + bridge.sdk.queryPersonInfo((args) async { + ef.log('queryPersonInfo: $args'); + // bluetooth = args[0]; + return personList; + }); + //请求实时体征数据 + bridge.sdk.queryInstantData((args) async { + ef.log('queryInstantData: $args'); + // bluetooth = args[0]; + return instantData; + }); + bridge.sdk.queryInstantData((args) async { + ef.log('queryInstantData: $args'); + // bluetooth = args[0]; + return instantData; + }); + bridge.sdk.startTimer((args) async { + ef.log('queryInstantData: $args'); + MHTHomeController homeController = Get.find(); + homeController.startTimer(args); + return true; + }); + bridge.sdk.cancelTimer((args) async { + ef.log('queryInstantData: $args'); + MHTHomeController homeController = Get.find(); + homeController.cancelTimer(args); + return true; + }); + bridge.sdk.restoreTimer((args) async { + ef.log('queryInstantData: $args'); + MHTHomeController homeController = Get.find(); + var data = await homeController.restoreTimer(args); + return data; + }); }); web //.file( @@ -80,6 +162,116 @@ class WebviewTestController extends GetControllerEx { late WebviewHelper web; var ready = false.obs; var cnt = 0.obs; + + Future queryPersonInfoByMac() async { + UserInfoController userInfoController = Get.find(); + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.person_info; + String queryUrl = + "${serviceAddress}${serviceName}${serviceApi}?mac=${selectDevice['mac']}"; + try { + final res = await requestWithLog( + logTitle: "查询设备绑定人员列表", + method: MyHttpMethod.get, + queryUrl: queryUrl, + onSuccess: (res) { + personList = res.data; + }); + } catch (e) { + print("查询设备绑定列表失败: $e"); + } + } + + void dealInstantData(selectDevice) { + //处理实时数据 + // edm.EasyDartModule.websocket.sendData( + // jsonEncode(WebSocketMessage(path: "/vsbs/web/rt/marttress", type: 2))); + lastSelectDevice; + var ws; + ws = Easyws( + url: ServiceConstant.webSocketService, + onData: (data) { + ef.log("ws recv =>$data"); + try { + var tmp; + if (data is String) { + tmp = jsonDecode(data); // 只有是 String 才 decode + } else if (data is Map) { + tmp = data; // 直接用 + } else { + print("未知数据格式"); + } + if (tmp['data'] != null && tmp['data'] is Map) { + var newData = tmp['data']; + var mac = newData['mac']; + if (mac != null) { + // 删除已有的同 mac 项 + instantData.removeWhere((element) => element['mac'] == mac); + // 添加新的数据 + instantData.add(newData); + } + } + } catch (e) { + ef.log("ws error =>$e"); + } + }, + onStateChange: (x) { + ef.log("ws =>$x"); + if (x == EasywsState.connected) { + try { + if (lastSelectDevice != null && lastSelectDevice.isNotEmpty) { + List oldMacList = [ + lastSelectDevice['bind_mac_a'], + lastSelectDevice['bind_mac_b'], + ]; + for (String? mac in oldMacList) { + if (mac != null && mac.isNotEmpty) { + bool success = ws.send({ + "type": 2, + "path": "/vsbs/web/rt/marttress", + "data": {"mac": mac}, + }); + if (success) { + ef.log("✅ 已取消监听:$mac"); + } + } + } + } + } catch (e) { + ef.log("❌ 取消旧设备监听失败: $e"); + } + try { + // 2. 开始监听新设备(A/B 都监听) + if (selectDevice != null && selectDevice.isNotEmpty) { + List newMacList = [ + selectDevice['bind_mac_a'], + selectDevice['bind_mac_b'], + ]; + for (String? mac in newMacList) { + if (mac != null && mac.isNotEmpty) { + bool success = ws.send({ + "type": 1, + "path": "/vsbs/web/rt/marttress", + "data": {"mac": mac}, + }); + if (success) { + ef.log("✅ 开始监听新设备:$mac"); + } + } + } + + // 更新记录 + lastSelectDevice = selectDevice; + } + } catch (e) { + ef.log("❌ 监听新设备失败: $e"); + } + } + }, + ); + ws.connect(); + } //EasyFlutter End } @@ -90,7 +282,7 @@ class WebviewTestView extends GetComponent { Widget build(BuildContext context) { UserInfoController userInfoController = Get.find(); MHTHomeController deviceController = Get.find(); - deviceController.getDeviceList(group: 'room').then((x) { + deviceController.getDeviceList().then((x) { if (controller.web.jsbridge!.inited) { //发送测试消息给webview controller.web.jsbridge!.dart diff --git a/lib/pages/mh_page/user/page/edit_userinfo_page.dart b/lib/pages/mh_page/user/page/edit_userinfo_page.dart index 7a1cc12..a0a64ce 100644 --- a/lib/pages/mh_page/user/page/edit_userinfo_page.dart +++ b/lib/pages/mh_page/user/page/edit_userinfo_page.dart @@ -82,7 +82,7 @@ class _UpdateUserPageState extends State { ), ), Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), Positioned( diff --git a/lib/pages/mh_page/user/page/find_password_page.dart b/lib/pages/mh_page/user/page/find_password_page.dart index 3642c71..4c052fb 100644 --- a/lib/pages/mh_page/user/page/find_password_page.dart +++ b/lib/pages/mh_page/user/page/find_password_page.dart @@ -70,7 +70,7 @@ class FindPasswordPage extends GetView { ), // 左侧图标 Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/user/page/mht_login_page.dart b/lib/pages/mh_page/user/page/mht_login_page.dart index be93d93..c38c2b5 100644 --- a/lib/pages/mh_page/user/page/mht_login_page.dart +++ b/lib/pages/mh_page/user/page/mht_login_page.dart @@ -144,8 +144,36 @@ class MHTLoginPage extends GetView { ), child: Scaffold( backgroundColor: Colors.transparent, - resizeToAvoidBottomInset: true, - // key: scaffoldKey, + resizeToAvoidBottomInset: false, + appBar: AppBar( + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + iconTheme: IconThemeData(color: Colors.white), + titleSpacing: 0, + title: Container( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + // Text( + // '用户注册', + // textAlign: TextAlign.center, + // style: TextStyle( + // color: Colors.white, + // fontSize: 30.rpx, + // ), + // ), + Positioned( + left: 0.rpx, + child: returnIconButtomNew, + ), + ], + ), + ), + actions: [], + centerTitle: false, + ), body: PopScope( canPop: false, onPopInvokedWithResult: (disposition, result) async { @@ -161,70 +189,180 @@ class MHTLoginPage extends GetView { } } }, - child: SingleChildScrollView( - controller: _scrollController, - child: Align( - alignment: AlignmentDirectional(0, 0), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 1, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.contain, - image: Image.asset( - 'assets/img/background.png', - ).image, + child: Align( + alignment: AlignmentDirectional(0, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + height: 50.rpx, ), - ), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.07, + Expanded( + child: Container( decoration: BoxDecoration(), - ), - Expanded( - child: Align( - alignment: AlignmentDirectional(0, 0), - child: Container( - // width: bodysize!.maxWidth * 0.74, - height: bodysize!.maxHeight * 0.79, - decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 1, - decoration: BoxDecoration(), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Obx(() { - return Visibility( - visible: - controller.model.loginStyle == 1 - ? true - : false, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 54, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + decoration: BoxDecoration(), + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 1 + ? true + : false, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0.rpx, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.06, + decoration: BoxDecoration(), child: Container( width: bodysize!.maxWidth, height: bodysize!.maxHeight * 0.06, decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: - bodysize!.maxHeight * 0.06, - decoration: BoxDecoration(), - child: SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Row( - mainAxisSize: - MainAxisSize.max, - children: [ - Container( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.165, + height: MediaQuery.sizeOf( + context) + .height * + 1, + constraints: BoxConstraints( + minWidth: 100, + ), + decoration: BoxDecoration(), + child: Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.165, + height: MediaQuery.sizeOf( + context) + .height * + 1, + constraints: + BoxConstraints( + minWidth: 124, + ), + decoration: + BoxDecoration(), + child: Column( + mainAxisSize: + MainAxisSize.max, + children: [ + Padding( + padding: + EdgeInsetsDirectional + .fromSTEB( + 0, + 0, + 0, + 8), + child: Container( + width: MediaQuery + .sizeOf( + context) + .width * + 0.165, + height: MediaQuery + .sizeOf( + context) + .height * + 0.045, + constraints: + BoxConstraints( + minWidth: 124, + ), + decoration: + BoxDecoration(), + child: Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.162, + height: MediaQuery.sizeOf( + context) + .height * + 0.055, + decoration: + BoxDecoration(), + child: Align( + alignment: + AlignmentDirectional( + 0, 1), + child: Text( + '密码登录'.tr, + style: + TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "#84F5FF"), + fontSize: + AppFontsize + .title_size, + letterSpacing: + 0, + ), + ), + ), + ), + ), + ), + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Container( + width: MediaQuery + .sizeOf( + context) + .width * + 0.156, + height: MediaQuery + .sizeOf( + context) + .height * + 0.003, + constraints: + BoxConstraints( + minWidth: 100, + maxWidth: 100, + maxHeight: 6, + ), + decoration: + BoxDecoration( + color: stringToColor( + "#84F5FF"), + ), + ), + ), + ], + ), + ), + ), + InkWell( + onTap: () { + controller + .model.loginStyle = 2; + controller.updateAll(); + }, + child: Container( width: MediaQuery.sizeOf( context) .width * @@ -239,143 +377,111 @@ class MHTLoginPage extends GetView { ), decoration: BoxDecoration(), - child: Container( - width: - MediaQuery.sizeOf( - context) + child: Column( + mainAxisSize: + MainAxisSize.max, + children: [ + Container( + width: MediaQuery + .sizeOf( + context) .width * - 0.165, - height: - MediaQuery.sizeOf( - context) + 0.14, + height: MediaQuery + .sizeOf( + context) .height * - 1, - constraints: - BoxConstraints( - minWidth: 124, - ), - decoration: - BoxDecoration(), - child: Column( - mainAxisSize: - MainAxisSize.max, - children: [ - Padding( - padding: - EdgeInsetsDirectional - .fromSTEB( - 0, - 0, - 0, - 8), - child: Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.165, - height: MediaQuery.sizeOf( - context) - .height * - 0.045, - constraints: - BoxConstraints( - minWidth: 124, - ), - decoration: - BoxDecoration(), - child: - Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.162, - height: MediaQuery.sizeOf( - context) - .height * - 0.055, - decoration: - BoxDecoration(), - child: Align( - alignment: - AlignmentDirectional( - 0, - 1), - child: Text( - '密码登录'.tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "#84F5FF"), - fontSize: - AppFontsize.title_size, - letterSpacing: - 0, - ), - ), - ), - ), - ), + 0.045, + constraints: + BoxConstraints( + minWidth: 105, ), - Align( + decoration: + BoxDecoration(), + child: Align( alignment: AlignmentDirectional( - 0, 0), - child: Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.156, - height: MediaQuery.sizeOf( - context) - .height * - 0.003, - constraints: - BoxConstraints( - minWidth: 100, - maxWidth: 100, - maxHeight: 6, - ), - decoration: - BoxDecoration( - color: stringToColor( - "#84F5FF"), + 0, 1), + child: Text( + '短信登录'.tr, + style: + TextStyle( + fontFamily: + 'Readex Pro', + color: Colors + .white, + fontSize: + AppFontsize + .normal_text_size, + letterSpacing: + 0, ), ), ), - ], - ), + ), + ], ), ), - InkWell( - onTap: () { - controller.model - .loginStyle = 2; - controller.updateAll(); - }, - child: Container( - width: - MediaQuery.sizeOf( - context) - .width * - 0.165, - height: - MediaQuery.sizeOf( - context) - .height * - 1, - constraints: - BoxConstraints( - minWidth: 100, - ), - decoration: - BoxDecoration(), - child: Column( - mainAxisSize: - MainAxisSize.max, - children: [ - Container( + ), + ], + ), + ), + ), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 2 + ? true + : false, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.06, + decoration: BoxDecoration(), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.06, + decoration: BoxDecoration(), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + InkWell( + onTap: () { + controller + .model.loginStyle = 1; + controller.updateAll(); + }, + child: Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.165, + height: MediaQuery.sizeOf( + context) + .height * + 1, + constraints: + BoxConstraints( + minWidth: 100, + ), + decoration: + BoxDecoration(), + child: Column( + mainAxisSize: + MainAxisSize.max, + children: [ + Align( + alignment: + AlignmentDirectional( + 0, 1), + child: Container( width: MediaQuery .sizeOf( context) @@ -397,7 +503,7 @@ class MHTLoginPage extends GetView { AlignmentDirectional( 0, 1), child: Text( - '短信登录'.tr, + '密码登录'.tr, style: TextStyle( fontFamily: @@ -413,117 +519,25 @@ class MHTLoginPage extends GetView { ), ), ), - ], - ), + ), + ], ), ), - ], - ), - ), - ), - ), - ), - ); - }), - Obx(() { - return Visibility( - visible: - controller.model.loginStyle == 2 - ? true - : false, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 54, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.06, - decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: - bodysize!.maxHeight * 0.06, - decoration: BoxDecoration(), - child: SingleChildScrollView( - scrollDirection: - Axis.horizontal, - child: Row( - mainAxisSize: - MainAxisSize.max, - children: [ - InkWell( - onTap: () { - controller.model - .loginStyle = 1; - controller.updateAll(); - }, - child: Container( - width: - MediaQuery.sizeOf( - context) - .width * - 0.165, - height: - MediaQuery.sizeOf( - context) - .height * - 1, - constraints: - BoxConstraints( - minWidth: 100, - ), - decoration: - BoxDecoration(), - child: Column( - mainAxisSize: - MainAxisSize.max, - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 1), - child: Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.14, - height: MediaQuery.sizeOf( - context) - .height * - 0.045, - constraints: - BoxConstraints( - minWidth: 105, - ), - decoration: - BoxDecoration(), - child: Align( - alignment: - AlignmentDirectional( - 0, 1), - child: Text( - '密码登录'.tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: Colors - .white, - fontSize: - AppFontsize - .normal_text_size, - letterSpacing: - 0, - ), - ), - ), - ), - ), - ], - ), - ), + ), + Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.165, + height: MediaQuery.sizeOf( + context) + .height * + 1, + constraints: BoxConstraints( + minWidth: 100, ), - Container( + decoration: BoxDecoration(), + child: Container( width: MediaQuery.sizeOf( context) .width * @@ -534,1002 +548,98 @@ class MHTLoginPage extends GetView { 1, constraints: BoxConstraints( - minWidth: 100, + minWidth: 124, ), decoration: BoxDecoration(), - child: Container( - width: - MediaQuery.sizeOf( - context) - .width * - 0.165, - height: - MediaQuery.sizeOf( - context) - .height * - 1, - constraints: - BoxConstraints( - minWidth: 124, - ), - decoration: - BoxDecoration(), - child: Column( - mainAxisSize: - MainAxisSize.max, - children: [ - Padding( - padding: - EdgeInsetsDirectional - .fromSTEB( - 0, - 0, - 0, - 8), + child: Column( + mainAxisSize: + MainAxisSize.max, + children: [ + Padding( + padding: + EdgeInsetsDirectional + .fromSTEB( + 0, + 0, + 0, + 8), + child: Container( + width: MediaQuery + .sizeOf( + context) + .width * + 0.165, + height: MediaQuery + .sizeOf( + context) + .height * + 0.045, + constraints: + BoxConstraints( + minWidth: 124, + ), + decoration: + BoxDecoration(), child: Container( width: MediaQuery.sizeOf( context) .width * - 0.165, + 0.162, height: MediaQuery.sizeOf( context) .height * - 0.045, - constraints: - BoxConstraints( - minWidth: 124, - ), + 0.055, decoration: BoxDecoration(), - child: - Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.162, - height: MediaQuery.sizeOf( - context) - .height * - 0.055, - decoration: - BoxDecoration(), - child: Align( - alignment: - AlignmentDirectional( - 0, - 1), - child: Text( - '短信登录'.tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "#84F5FF"), - fontSize: - AppFontsize.title_size, - letterSpacing: - 0, - ), + child: Align( + alignment: + AlignmentDirectional( + 0, 1), + child: Text( + '短信登录'.tr, + style: + TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "#84F5FF"), + fontSize: + AppFontsize + .title_size, + letterSpacing: + 0, ), ), ), ), ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.156, - height: MediaQuery.sizeOf( - context) - .height * - 0.003, - constraints: - BoxConstraints( - minWidth: 100, - maxWidth: 100, - maxHeight: 6, - ), - decoration: - BoxDecoration( - color: stringToColor( - "#84F5FF"), - ), - ), - ), - ], - ), - ), - ), - ], - ), - ), - ), - ), - ), - ); - }), - Obx(() { - return Visibility( - visible: - controller.model.loginStyle == 1 - ? true - : false, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 17, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: 46, - decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: - bodysize!.maxHeight * 0.06, - decoration: BoxDecoration( - color: Color(0xFFF3F5F6), - borderRadius: - BorderRadius.circular(12), - ), - child: Align( - alignment: - AlignmentDirectional(0, 0), - child: TextFormField( - // focusNode: _focusNode1, - onChanged: (value) { - controller.model.account = - value; - }, - initialValue: - controller.model.account, - obscureText: false, - decoration: InputDecoration( - labelStyle: TextStyle( - fontFamily: 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - hintText: '请输入账号', - hintStyle: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFFD2D2D2), - fontSize: 13.px, - letterSpacing: 0, - ), - enabledBorder: - InputBorder.none, - focusedBorder: - InputBorder.none, - errorBorder: - InputBorder.none, - focusedErrorBorder: - InputBorder.none, - contentPadding: - EdgeInsetsDirectional - .fromSTEB( - 10, 0, 0, 5), - ), - style: TextStyle( - fontFamily: 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - ), - ), - ), - ), - ), - ); - }), - Obx(() { - return Visibility( - visible: - controller.model.loginStyle == 1 - ? true - : false, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 17, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: 46, - decoration: BoxDecoration(), - child: Stack( - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Container( - width: MediaQuery.sizeOf( - context) - .width, - height: 46, - decoration: BoxDecoration( - color: Color(0xFFF3F5F6), - borderRadius: - BorderRadius.circular( - 12), - ), - child: Align( - alignment: - AlignmentDirectional( - 0, 0), - child: TextFormField( - obscureText: controller - .model.showPd!, - onChanged: (value) { - controller.model - .password = value; - }, - initialValue: controller - .model.password, - decoration: - InputDecoration( - labelStyle: TextStyle( - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - hintText: '请输入密码', - hintStyle: TextStyle( - fontFamily: - 'Readex Pro', - color: Color( - 0xFFD2D2D2), - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - enabledBorder: - InputBorder.none, - focusedBorder: - InputBorder.none, - errorBorder: - InputBorder.none, - focusedErrorBorder: - InputBorder.none, - contentPadding: - EdgeInsetsDirectional - .fromSTEB(10, - 12, 0, 0), - suffixIcon: - IconButton( - icon: Icon( - // 根据 pdshow 控制图标 - controller.model - .showPd! - ? Icons - .visibility_off - : Icons - .visibility, - color: Color( - 0xFF333333), - size: 16, - ), - onPressed: () { - // 切换 pdshow 状态 - controller.model - .showPd = - !controller - .model - .showPd!; - controller - .updateAll(); - }, - ), - ), - style: TextStyle( - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - ), - ), - ), - ), - Obx(() { - return Visibility( - visible: controller - .model.loginStyle == - 2, - child: Align( - alignment: - AlignmentDirectional( - 0.2, 0.3), - child: Container( - width: 3, - height: 30, - decoration: - BoxDecoration( - color: stringToColor( - "#929699"), - ), - ), - ), - ); - }), - Obx(() { - return Visibility( - visible: controller - .model.loginStyle == - 2, - child: Align( - alignment: - AlignmentDirectional( - 0.9, 0), - child: Container( - width: - MediaQuery.sizeOf( - context) - .width * - 0.157, - height: - MediaQuery.sizeOf( - context) - .height * - 0.014, - constraints: - BoxConstraints( - minWidth: 118, - minHeight: 30, - maxWidth: 118, - ), - decoration: - BoxDecoration(), - child: Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Obx(() { - final CountdownController - countdownController = - Get.find< - CountdownController>(); - return InkWell( - onTap: () async { - if (countdownController - .countdown - .value != - 0) { - return; - } - if (CommonVariables - .isNetWorkOn == - false) { - TopSlideNotification.show( - context, - text: "网络未连接,请开启设备网络后重试" - .tr, - textColor: themeController - .currentColor - .sc9); - return; - } - String msg = - await controller - .getCode( - context); - if (msg - .isNotEmpty) { - return; - } - countdownController - .countdown - .value == - 0 - ? countdownController - .startCountdown( - AppConstants.code_time) - : null; - }, - child: Text( - countdownController - .countdown - .value == - 0 - ? '获取验证码'.tr - : '${countdownController.countdown.value}' + - '秒'.tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: Color( - 0xFF333333), - fontSize: - AppFontsize - .normal_text_size, - letterSpacing: - 0, - ), - ), - ); - }), - ), - ), - ), - ); - }) - ], - ), - ), - ), - ); - }), - Obx(() { - return Visibility( - visible: - controller.model.loginStyle == 2 - ? true - : false, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 17, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: 46, - decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: - bodysize!.maxHeight * 0.06, - decoration: BoxDecoration( - color: Color(0xFFF3F5F6), - borderRadius: - BorderRadius.circular(12), - ), - child: Align( - alignment: - AlignmentDirectional(0, 0), - child: TextFormField( - // focusNode: _focusNode3, - onChanged: (value) { - controller.model.phone = - value; - }, - obscureText: false, - decoration: InputDecoration( - labelStyle: TextStyle( - fontFamily: 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - hintText: '请输入手机号'.tr, - hintStyle: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFFD2D2D2), - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - enabledBorder: - InputBorder.none, - focusedBorder: - InputBorder.none, - errorBorder: - InputBorder.none, - focusedErrorBorder: - InputBorder.none, - contentPadding: - EdgeInsetsDirectional - .fromSTEB( - 10, 0, 0, 5), - ), - style: TextStyle( - fontFamily: 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - ), - ), - ), - ), - ), - ); - }), - Obx(() { - return Visibility( - visible: - controller.model.loginStyle == 2 - ? true - : false, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 17, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: 46, - decoration: BoxDecoration(), - child: Stack( - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Container( - width: MediaQuery.sizeOf( - context) - .width, - height: 46, - decoration: BoxDecoration( - color: Color(0xFFF3F5F6), - borderRadius: - BorderRadius.circular( - 12), - ), - child: Align( - alignment: - AlignmentDirectional( - 0, 0), - child: TextFormField( - // focusNode: _focusNode4, - onChanged: (value) { - controller.model - .code = value; - }, - obscureText: false, - decoration: - InputDecoration( - labelStyle: TextStyle( - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - hintText: '请输入验证码', - hintStyle: TextStyle( - fontFamily: - 'Readex Pro', - color: Color( - 0xFFD2D2D2), - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - enabledBorder: - InputBorder.none, - focusedBorder: - InputBorder.none, - errorBorder: - InputBorder.none, - focusedErrorBorder: - InputBorder.none, - contentPadding: - EdgeInsetsDirectional - .fromSTEB(10, - 0, 0, 5), - ), - style: TextStyle( - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - ), - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0.2, 0.1), - child: Container( - width: 1.rpx, - height: 38.rpx, - decoration: BoxDecoration( - color: stringToColor( - "#929699"), - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0.9, 0), - child: Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.157, - height: MediaQuery.sizeOf( - context) - .height * - 0.014, - constraints: BoxConstraints( - minWidth: 118, - minHeight: 30, - ), - decoration: BoxDecoration(), - child: Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Obx(() { - final CountdownController - countdownController = - Get.find< - CountdownController>(); - return InkWell( - onTap: () async { - if (countdownController - .countdown - .value != - 0) { - return; - } - if (CommonVariables - .isNetWorkOn == - false) { - TopSlideNotification.show( - context, - text: - "网络未连接,请开启设备网络后重试" - .tr, - textColor: - themeController - .currentColor - .sc9); - return; - } - String msg = - await controller - .getCode( - context); - if (msg - .isNotEmpty) { - return; - } - countdownController - .countdown - .value == - 0 - ? countdownController - .startCountdown( - AppConstants - .code_time) - : null; - }, - child: Text( - countdownController - .countdown - .value == - 0 - ? '获取验证码' - : '${countdownController.countdown.value}' + - '秒'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Color( - 0xFF333333), - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, - ), - ), - ); - }), - ), - ), - ), - ], - ), - ), - ), - ); - }), - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 96.rpx, 17, 96.rpx, 0), - child: SizedBox( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.056, - child: CustomCard( - gradientDirection: - GradientDirection.vertical, - borderRadius: AppConstants() - .normal_container_radius, - onTap: () async { - if (CommonVariables.isNetWorkOn == - false) { - TopSlideNotification.show(context, - text: "网络未连接,请开启设备网络后重试".tr, - textColor: themeController - .currentColor.sc9); - return; - } - String msg = - await controller.login(context); - if (msg == null || msg.isEmpty) { - final box = GetStorage(); - box.remove('countdown'); - CountdownController - countdownController = - Get.find(); - countdownController.countdown = - 0.obs; - countdownController - .startCountdown(0); - - controller.fluwxCancelable - ?.cancel(); - Checknetwork.subscription - ?.cancel(); - - isProgrammaticPop = true; - MHTLoginController - loginController = Get.find(); - loginController.model.account = - null; - loginController.model.password = - null; - loginController.model.phone = - null; - loginController.model.code = null; - MHTRegisterController - registerController = - Get.find(); - registerController - .model.register_agree = false; - Get.offAndToNamed( - "/mianPageBottomChange"); - } - }, - colors: [ - stringToColor("FCFCFC"), - stringToColor("CEECE3") - ], // 纯色背景 - enableGradient: true, // 不启用渐变 - child: Center( - child: Text( - '登录'.tr, - style: TextStyle( - color: stringToColor("#003058"), - fontSize: 26.rpx, - letterSpacing: 0, - ), - ), - ), - ), - ), - ), - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 96.rpx, 19, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.022, - constraints: BoxConstraints( - minWidth: 466, - minHeight: 30, - ), - // decoration: - // BoxDecoration(color: Colors.green), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.022, - constraints: BoxConstraints( - minWidth: 466, - minHeight: 30, - ), - decoration: BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Align( - alignment: - AlignmentDirectional(0, 0), - child: Padding( - padding: EdgeInsetsDirectional - .fromSTEB(0, 3, 0, 0), - child: Container( - width: 36, - height: 36, - decoration: BoxDecoration(), - child: Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Theme( - data: ThemeData( - checkboxTheme: - CheckboxThemeData( - visualDensity: - VisualDensity - .compact, - materialTapTargetSize: - MaterialTapTargetSize - .shrinkWrap, - shape: - RoundedRectangleBorder( - borderRadius: - BorderRadius - .circular( - 64), - ), - ), - unselectedWidgetColor: - Color( - 0xFFD3D3D3), - ), - child: Obx( - () => Checkbox( - value: registerController - .model - .register_agree ?? - false, - onChanged: - (newValue) async { - registerController - .model - .register_agree = - newValue; - - controller - .updateAll(); - registerController - .updateAll(); - // 获取设备信息,需要用户点击确认隐私协议与用户协议选择框时才能获取 - // if (newValue == - // true) { - // Deviceconfig - // .initPlatformState(); - // } - }, - side: BorderSide( - width: 1.5, - color: Colors - .white, - ), - activeColor: - stringToColor( - "#84F5FF"), - checkColor: - stringToColor( - "#011D33"), - ), - )), - ), - ), - ), - ), - Flexible( - child: Padding( - padding: EdgeInsetsDirectional - .fromSTEB(0, 0, 0, 0), - child: Container( - width: MediaQuery.sizeOf( - context) - .width * - 0.622, - height: MediaQuery.sizeOf( - context) - .height * - 1, - constraints: BoxConstraints( - minWidth: 466, - minHeight: 30, - ), - decoration: BoxDecoration(), - child: Container( - width: 100, - height: 100, - decoration: - BoxDecoration(), - child: Row( - mainAxisSize: - MainAxisSize.max, - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '我已阅读并同意'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors - .white, - fontSize: 12, - letterSpacing: - 0, - ), - ), ), Align( alignment: AlignmentDirectional( 0, 0), - child: InkWell( - onTap: () { - // showCustomConfirmOfWebViewDialog( - // context, - // "用户协议", - // "/#/pages/agreement/agreement?type=2&hideHead=true", - // btnName: - // "同意并继续"); - }, - child: Text( - '《用户协议》'.tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "FF9F66"), - fontSize: 12, - letterSpacing: - 0, - ), + child: Container( + width: MediaQuery + .sizeOf( + context) + .width * + 0.156, + height: MediaQuery + .sizeOf( + context) + .height * + 0.003, + constraints: + BoxConstraints( + minWidth: 100, + maxWidth: 100, + maxHeight: 6, ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '与'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors - .white, - fontSize: 12, - letterSpacing: - 0, - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: InkWell( - onTap: () { - // showCustomConfirmOfWebViewDialog( - // context, - // "隐私协议", - // "/#/pages/agreement/agreement?type=1&hideHead=true", - // btnName: - // "同意并继续"); - }, - child: Text( - '《隐私协议》'.tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "FF9F66"), - fontSize: 12, - letterSpacing: - 0, - ), + decoration: + BoxDecoration( + color: stringToColor( + "#84F5FF"), ), ), ), @@ -1537,420 +647,1248 @@ class MHTLoginPage extends GetView { ), ), ), - ), - ), - ], - ), - ), - ), - ), - Obx(() { - return Visibility( - // maintainState: true, - // maintainAnimation: true, - // maintainSize: true, - visible: - controller.model.loginStyle == 2, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 0, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.03, - decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: - bodysize!.maxHeight * 0.025, - constraints: BoxConstraints( - minWidth: 466, - minHeight: 30, - ), - decoration: BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Padding( - padding: - EdgeInsetsDirectional - .fromSTEB( - 0, 0, 0, 0), - child: Container( - width: 36, - height: 36, - decoration: - BoxDecoration(), - ), - ), - ), - Flexible( - child: Padding( - padding: - EdgeInsetsDirectional - .fromSTEB( - 0, 0, 0, 0), - child: Container( - width: - MediaQuery.sizeOf( - context) - .width * - 0.622, - height: - MediaQuery.sizeOf( - context) - .height * - 1, - // constraints: - // BoxConstraints( - // minWidth: 466, - // minHeight: 30, - // ), - decoration: - BoxDecoration(), - child: Container( - // width: 100, - // height: 100, - decoration: - BoxDecoration(), - child: Row( - mainAxisSize: - MainAxisSize - .max, - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '注:首次登录会自动创建账号' - .tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "#FFFFFF"), - fontSize: - 23.rpx, - letterSpacing: - 0, - ), - ), - ), - ], - ), - ), - ), - ), - ), ], ), ), ), ), - ); - }), - Obx(() { - return Visibility( - // maintainState: true, - // maintainAnimation: true, - // maintainSize: true, - visible: - controller.model.loginStyle == 2, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 0, 96.rpx, 0), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 1 + ? true + : false, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 17, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: 46, + decoration: BoxDecoration(), child: Container( width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.03, - decoration: BoxDecoration(), - ), - ), - ); - }), - Obx(() { - return Visibility( - // maintainState: true, - // maintainAnimation: true, - // maintainSize: true, - visible: - controller.model.loginStyle == 2, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 0, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 0.03, - decoration: BoxDecoration(), - ), - ), - ); - }), - Obx(() { - return Visibility( - // maintainState: true, - // maintainAnimation: true, - // maintainSize: true, - visible: - controller.model.loginStyle == 1, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 0, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - // height: bodysize!.maxHeight * 0.06, - height: bodysize!.maxHeight * 0.03, - // decoration: - // BoxDecoration(color: Colors.pink), - ), - ), - ); - }), - Obx(() { - return Visibility( - // maintainState: true, - // maintainAnimation: true, - // maintainSize: true, - visible: - controller.model.loginStyle == 1, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 0, 96.rpx, 0), - child: Container( - width: bodysize!.maxWidth, - // height: bodysize!.maxHeight * 0.06, - height: bodysize!.maxHeight * 0.03, - child: Container( - width: bodysize!.maxWidth, - height: - bodysize!.maxHeight * 0.06, - decoration: BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - InkWell( - onTap: () { - Get.toNamed( - "/findPasswordPage"); - }, - child: Text( - '找回密码'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "#84F5FF"), - fontSize: AppFontsize - .small_text_size, - letterSpacing: 0, - ), - ), + height: bodysize!.maxHeight * 0.06, + decoration: BoxDecoration( + color: Color(0xFFF3F5F6), + borderRadius: + BorderRadius.circular(12), + ), + child: Align( + alignment: + AlignmentDirectional(0, 0), + child: TextFormField( + // focusNode: _focusNode1, + onChanged: (value) { + controller.model.account = + value; + }, + initialValue: + controller.model.account, + obscureText: false, + decoration: InputDecoration( + labelStyle: TextStyle( + fontFamily: 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, ), - InkWell( - onTap: () { - Get.toNamed( - "/registerPage"); - }, - child: Text( - '注册'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "#84F5FF"), - fontSize: AppFontsize - .small_text_size, - letterSpacing: 0, - ), - ), + hintText: '请输入账号', + hintStyle: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFFD2D2D2), + fontSize: 13.px, + letterSpacing: 0, ), - ].divide(SizedBox( - width: 57.rpx, - )), + enabledBorder: + InputBorder.none, + focusedBorder: + InputBorder.none, + errorBorder: InputBorder.none, + focusedErrorBorder: + InputBorder.none, + contentPadding: + EdgeInsetsDirectional + .fromSTEB( + 10, 0, 0, 5), + ), + style: TextStyle( + fontFamily: 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), ), ), ), ), - ); - }), - Obx(() { - return Visibility( - // maintainState: true, - // maintainAnimation: true, - // maintainSize: true, - visible: - controller.model.loginStyle == 1, - child: Padding( - padding: - EdgeInsetsDirectional.fromSTEB( - 96.rpx, 0, 96.rpx, 0), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 1 + ? true + : false, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 17, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: 46, + decoration: BoxDecoration(), + child: Stack( + children: [ + Align( + alignment: + AlignmentDirectional(0, 0), + child: Container( + width: + MediaQuery.sizeOf(context) + .width, + height: 46, + decoration: BoxDecoration( + color: Color(0xFFF3F5F6), + borderRadius: + BorderRadius.circular( + 12), + ), + child: Align( + alignment: + AlignmentDirectional( + 0, 0), + child: TextFormField( + obscureText: controller + .model.showPd!, + onChanged: (value) { + controller.model + .password = value; + }, + initialValue: controller + .model.password, + decoration: + InputDecoration( + labelStyle: TextStyle( + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + hintText: '请输入密码', + hintStyle: TextStyle( + fontFamily: + 'Readex Pro', + color: + Color(0xFFD2D2D2), + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + enabledBorder: + InputBorder.none, + focusedBorder: + InputBorder.none, + errorBorder: + InputBorder.none, + focusedErrorBorder: + InputBorder.none, + contentPadding: + EdgeInsetsDirectional + .fromSTEB(10, + 12, 0, 0), + suffixIcon: IconButton( + icon: Icon( + // 根据 pdshow 控制图标 + controller.model + .showPd! + ? Icons + .visibility_off + : Icons + .visibility, + color: Color( + 0xFF333333), + size: 16, + ), + onPressed: () { + // 切换 pdshow 状态 + controller.model + .showPd = + !controller + .model + .showPd!; + controller + .updateAll(); + }, + ), + ), + style: TextStyle( + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + ), + ), + ), + ), + Obx(() { + return Visibility( + visible: controller + .model.loginStyle == + 2, + child: Align( + alignment: + AlignmentDirectional( + 0.2, 0.3), + child: Container( + width: 3, + height: 30, + decoration: BoxDecoration( + color: stringToColor( + "#929699"), + ), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller + .model.loginStyle == + 2, + child: Align( + alignment: + AlignmentDirectional( + 0.9, 0), + child: Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.157, + height: MediaQuery.sizeOf( + context) + .height * + 0.014, + constraints: + BoxConstraints( + minWidth: 118, + minHeight: 30, + maxWidth: 118, + ), + decoration: + BoxDecoration(), + child: Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Obx(() { + final CountdownController + countdownController = + Get.find< + CountdownController>(); + return InkWell( + onTap: () async { + if (countdownController + .countdown + .value != + 0) { + return; + } + if (CommonVariables + .isNetWorkOn == + false) { + TopSlideNotification.show( + context, + text: + "网络未连接,请开启设备网络后重试" + .tr, + textColor: + themeController + .currentColor + .sc9); + return; + } + String msg = + await controller + .getCode( + context); + if (msg + .isNotEmpty) { + return; + } + countdownController + .countdown + .value == + 0 + ? countdownController + .startCountdown( + AppConstants + .code_time) + : null; + }, + child: Text( + countdownController + .countdown + .value == + 0 + ? '获取验证码'.tr + : '${countdownController.countdown.value}' + + '秒'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Color( + 0xFF333333), + fontSize: + AppFontsize + .normal_text_size, + letterSpacing: + 0, + ), + ), + ); + }), + ), + ), + ), + ); + }) + ], + ), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 2 + ? true + : false, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 17, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: 46, + decoration: BoxDecoration(), child: Container( width: bodysize!.maxWidth, - // height: bodysize!.maxHeight * 0.06, - height: bodysize!.maxHeight * 0.03, - // decoration: - // BoxDecoration(color: Colors.pink), + height: bodysize!.maxHeight * 0.06, + decoration: BoxDecoration( + color: Color(0xFFF3F5F6), + borderRadius: + BorderRadius.circular(12), + ), + child: Align( + alignment: + AlignmentDirectional(0, 0), + child: TextFormField( + // focusNode: _focusNode3, + onChanged: (value) { + controller.model.phone = + value; + }, + obscureText: false, + decoration: InputDecoration( + labelStyle: TextStyle( + fontFamily: 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + hintText: '请输入手机号'.tr, + hintStyle: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFFD2D2D2), + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + enabledBorder: + InputBorder.none, + focusedBorder: + InputBorder.none, + errorBorder: InputBorder.none, + focusedErrorBorder: + InputBorder.none, + contentPadding: + EdgeInsetsDirectional + .fromSTEB( + 10, 0, 0, 5), + ), + style: TextStyle( + fontFamily: 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + ), + ), ), ), - ); - }), - Divider( - color: stringToColor("#495A67"), // 线的颜色 - thickness: 1.rpx, // 线的粗细 - height: 20, // 垂直方向的占位高度 - indent: 16, // 左边缩进 - endIndent: 16, // 右边缩进 + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 2 + ? true + : false, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 17, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: 46, + decoration: BoxDecoration(), + child: Stack( + children: [ + Align( + alignment: + AlignmentDirectional(0, 0), + child: Container( + width: + MediaQuery.sizeOf(context) + .width, + height: 46, + decoration: BoxDecoration( + color: Color(0xFFF3F5F6), + borderRadius: + BorderRadius.circular( + 12), + ), + child: Align( + alignment: + AlignmentDirectional( + 0, 0), + child: TextFormField( + // focusNode: _focusNode4, + onChanged: (value) { + controller.model.code = + value; + }, + obscureText: false, + decoration: + InputDecoration( + labelStyle: TextStyle( + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + hintText: '请输入验证码', + hintStyle: TextStyle( + fontFamily: + 'Readex Pro', + color: + Color(0xFFD2D2D2), + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + enabledBorder: + InputBorder.none, + focusedBorder: + InputBorder.none, + errorBorder: + InputBorder.none, + focusedErrorBorder: + InputBorder.none, + contentPadding: + EdgeInsetsDirectional + .fromSTEB(10, 0, + 0, 5), + ), + style: TextStyle( + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + ), + ), + ), + ), + Align( + alignment: AlignmentDirectional( + 0.2, 0.1), + child: Container( + width: 1.rpx, + height: 38.rpx, + decoration: BoxDecoration( + color: stringToColor( + "#929699"), + ), + ), + ), + Align( + alignment: AlignmentDirectional( + 0.9, 0), + child: Container( + width: + MediaQuery.sizeOf(context) + .width * + 0.157, + height: + MediaQuery.sizeOf(context) + .height * + 0.014, + constraints: BoxConstraints( + minWidth: 118, + minHeight: 30, + ), + decoration: BoxDecoration(), + child: Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Obx(() { + final CountdownController + countdownController = + Get.find< + CountdownController>(); + return InkWell( + onTap: () async { + if (countdownController + .countdown + .value != + 0) { + return; + } + if (CommonVariables + .isNetWorkOn == + false) { + TopSlideNotification.show( + context, + text: + "网络未连接,请开启设备网络后重试" + .tr, + textColor: + themeController + .currentColor + .sc9); + return; + } + String msg = + await controller + .getCode( + context); + if (msg.isNotEmpty) { + return; + } + countdownController + .countdown + .value == + 0 + ? countdownController + .startCountdown( + AppConstants + .code_time) + : null; + }, + child: Text( + countdownController + .countdown + .value == + 0 + ? '获取验证码' + : '${countdownController.countdown.value}' + + '秒'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Color( + 0xFF333333), + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + ), + ); + }), + ), + ), + ), + ], + ), + ), + ), + ); + }), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 34.rpx, 96.rpx, 0), + child: SizedBox( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.056, + child: CustomCard( + gradientDirection: + GradientDirection.vertical, + borderRadius: AppConstants() + .normal_container_radius, + onTap: () async { + if (CommonVariables.isNetWorkOn == + false) { + TopSlideNotification.show(context, + text: "网络未连接,请开启设备网络后重试".tr, + textColor: themeController + .currentColor.sc9); + return; + } + String msg = + await controller.login(context); + if (msg == null || msg.isEmpty) { + final box = GetStorage(); + box.remove('countdown'); + CountdownController + countdownController = + Get.find(); + countdownController.countdown = + 0.obs; + countdownController + .startCountdown(0); + + controller.fluwxCancelable + ?.cancel(); + Checknetwork.subscription?.cancel(); + + isProgrammaticPop = true; + MHTLoginController loginController = + Get.find(); + loginController.model.account = + null; + loginController.model.password = + null; + loginController.model.phone = null; + loginController.model.code = null; + MHTRegisterController + registerController = Get.find(); + registerController + .model.register_agree = false; + Get.offAndToNamed( + "/mianPageBottomChange"); + } + }, + colors: [ + stringToColor("FCFCFC"), + stringToColor("CEECE3") + ], // 纯色背景 + enableGradient: true, // 不启用渐变 + child: Center( + child: Text( + '登录'.tr, + style: TextStyle( + color: stringToColor("#003058"), + fontSize: 26.rpx, + letterSpacing: 0, + ), + ), + ), + ), ), - Text( - "其他登录方式".tr, - style: TextStyle( - color: Colors.white, - fontSize: AppConstants() - .normal_text_fontSize), - ), - SizedBox( - height: 30.rpx, - ), - ClickableContainer( - backgroundColor: Colors.white, // 背景色 - highlightColor: Colors.grey, // 点击水波纹颜色 - borderRadius: 999.rpx, - padding: EdgeInsets.zero, - onTap: () async { - //loginController.model.isIos == true && - // if (loginController - // .model.register_agree == - // null || - // loginController - // .model.register_agree != - // true) { - // TopSlideNotification.show( - // context, - // text: "登录页.未同意协议".tr, - // textColor: - // themeController.currentColor.sc9, - // ); - // return; - // } - // await loginController - // .wxLoginSendAuth(context); - TopSlideNotification.show(context, - text: "测试阶段,暂不支持".tr); - }, + ), + Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 38.rpx, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.022, + constraints: BoxConstraints( + minWidth: 466, + minHeight: 30, + ), + // decoration: + // BoxDecoration(color: Colors.green), child: Container( - width: 90.rpx, - height: 90.rpx, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage( - 'assets/images/wechat.png'), // 本地图片 - fit: BoxFit.fill, // 填满整个 Container - ), + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.022, + constraints: BoxConstraints( + minWidth: 466, + minHeight: 30, + ), + decoration: BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Align( + alignment: + AlignmentDirectional(0, 0), + child: Padding( + padding: EdgeInsetsDirectional + .fromSTEB(0, 3, 0, 0), + child: Container( + width: 36, + height: 36, + decoration: BoxDecoration(), + child: Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Theme( + data: ThemeData( + checkboxTheme: + CheckboxThemeData( + visualDensity: + VisualDensity + .compact, + materialTapTargetSize: + MaterialTapTargetSize + .shrinkWrap, + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 64), + ), + ), + unselectedWidgetColor: + Color(0xFFD3D3D3), + ), + child: Obx( + () => Checkbox( + value: registerController + .model + .register_agree ?? + false, + onChanged: + (newValue) async { + registerController + .model + .register_agree = + newValue; + + controller + .updateAll(); + registerController + .updateAll(); + // 获取设备信息,需要用户点击确认隐私协议与用户协议选择框时才能获取 + // if (newValue == + // true) { + // Deviceconfig + // .initPlatformState(); + // } + }, + side: BorderSide( + width: 1.5, + color: + Colors.white, + ), + activeColor: + stringToColor( + "#84F5FF"), + checkColor: + stringToColor( + "#011D33"), + ), + )), + ), + ), + ), + ), + Flexible( + child: Padding( + padding: EdgeInsetsDirectional + .fromSTEB(0, 0, 0, 0), + child: Container( + width: + MediaQuery.sizeOf(context) + .width * + 0.622, + height: + MediaQuery.sizeOf(context) + .height * + 1, + constraints: BoxConstraints( + minWidth: 466, + minHeight: 30, + ), + decoration: BoxDecoration(), + child: Container( + width: 100, + height: 100, + decoration: BoxDecoration(), + child: Row( + mainAxisSize: + MainAxisSize.max, + children: [ + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Text( + '我已阅读并同意'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: + Colors.white, + fontSize: 12, + letterSpacing: 0, + ), + ), + ), + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: InkWell( + onTap: () { + // showCustomConfirmOfWebViewDialog( + // context, + // "用户协议", + // "/#/pages/agreement/agreement?type=2&hideHead=true", + // btnName: + // "同意并继续"); + }, + child: Text( + '《用户协议》'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: + stringToColor( + "FF9F66"), + fontSize: 12, + letterSpacing: + 0, + ), + ), + ), + ), + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Text( + '与'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: + Colors.white, + fontSize: 12, + letterSpacing: 0, + ), + ), + ), + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: InkWell( + onTap: () { + // showCustomConfirmOfWebViewDialog( + // context, + // "隐私协议", + // "/#/pages/agreement/agreement?type=1&hideHead=true", + // btnName: + // "同意并继续"); + }, + child: Text( + '《隐私协议》'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: + stringToColor( + "FF9F66"), + fontSize: 12, + letterSpacing: + 0, + ), + ), + ), + ), + ], + ), + ), + ), + ), + ), + ], ), ), ), - ], - ), - ), - ), - ), - ), - Container( - width: bodysize!.maxWidth * 0.365, - height: MediaQuery.sizeOf(context).height * 0.044, - decoration: BoxDecoration(), - child: ClipRRect( - borderRadius: BorderRadius.circular(8), - child: Image.asset( - 'assets/images/_18328.png', - width: 300, - height: 200, - fit: BoxFit.contain, - ), - ), - ), - SizedBox( - height: 73.rpx, - ), - Container( - width: bodysize!.maxWidth, - // height: bodysize!.maxHeight * 0.118, - height: bodysize!.maxHeight * 0.09, - constraints: BoxConstraints( - minWidth: 335, - minHeight: 61, - ), - decoration: BoxDecoration(), - child: Container( - width: bodysize!.maxWidth, - height: bodysize!.maxHeight * 1, - constraints: BoxConstraints( - minWidth: 335, - minHeight: 61, - ), - decoration: BoxDecoration(), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: AlignmentDirectional(0, 0), - child: Text( - '合肥眠花糖家具有限责任公司版权所有', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: AppFontsize.explain_size, - letterSpacing: 0, + ), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 2, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.03, + decoration: BoxDecoration(), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.025, + constraints: BoxConstraints( + minWidth: 466, + minHeight: 30, + ), + decoration: BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Padding( + padding: + EdgeInsetsDirectional + .fromSTEB( + 0, 0, 0, 0), + child: Container( + width: 36, + height: 36, + decoration: + BoxDecoration(), + ), + ), + ), + Flexible( + child: Padding( + padding: + EdgeInsetsDirectional + .fromSTEB( + 0, 0, 0, 0), + child: Container( + width: MediaQuery.sizeOf( + context) + .width * + 0.622, + height: MediaQuery.sizeOf( + context) + .height * + 1, + // constraints: + // BoxConstraints( + // minWidth: 466, + // minHeight: 30, + // ), + decoration: + BoxDecoration(), + child: Container( + // width: 100, + // height: 100, + decoration: + BoxDecoration(), + child: Row( + mainAxisSize: + MainAxisSize.max, + children: [ + Align( + alignment: + AlignmentDirectional( + 0, 0), + child: Text( + '注:首次登录会自动创建账号' + .tr, + style: + TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "#FFFFFF"), + fontSize: + 23.rpx, + letterSpacing: + 0, + ), + ), + ), + ], + ), + ), + ), + ), + ), + ], + ), + ), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 2, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.03, + decoration: BoxDecoration(), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 2, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.03, + decoration: BoxDecoration(), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 1, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.03, + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 1, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.03, + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.06, + decoration: BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + InkWell( + onTap: () { + Get.toNamed( + "/registerPage"); + }, + child: Text.rich( + TextSpan( + children: [ + TextSpan( + text: "还没有账号? ".tr, + style: TextStyle( + color: Colors + .white, // 设置"还没有账号?"为白色 + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .small_text_size, + ), + ), + TextSpan( + text: '前往注册'.tr, + style: TextStyle( + color: stringToColor( + "#84F5FF"), // 保持"前往注册"为指定颜色 + fontFamily: + 'Readex Pro', + fontSize: AppFontsize + .small_text_size, + ), + ), + ], + ), + ), + ), + InkWell( + onTap: () { + Get.toNamed( + "/findPasswordPage"); + }, + child: Text( + '找回密码 '.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: stringToColor( + "#84F5FF"), + fontSize: AppFontsize + .small_text_size, + letterSpacing: 0, + ), + ), + ), + ].divide(SizedBox( + width: 57.rpx, + )), + ), + ), + ), + ), + ); + }), + Obx(() { + return Visibility( + visible: controller.model.loginStyle == 1, + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 96.rpx, 0, 96.rpx, 0), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 0.03, + ), + ), + ); + }), + Divider( + color: stringToColor("#495A67"), // 线的颜色 + thickness: 1.rpx, // 线的粗细 + height: 20, // 垂直方向的占位高度 + indent: 16, // 左边缩进 + endIndent: 16, // 右边缩进 + ), + Text( + "其他登录方式".tr, + style: TextStyle( + color: Colors.white, + fontSize: AppConstants() + .normal_text_fontSize), + ), + SizedBox( + height: 30.rpx, + ), + ClickableContainer( + backgroundColor: Colors.white, // 背景色 + highlightColor: Colors.grey, // 点击水波纹颜色 + borderRadius: 999.rpx, + padding: EdgeInsets.zero, + onTap: () async { + //loginController.model.isIos == true && + // if (loginController + // .model.register_agree == + // null || + // loginController + // .model.register_agree != + // true) { + // TopSlideNotification.show( + // context, + // text: "登录页.未同意协议".tr, + // textColor: + // themeController.currentColor.sc9, + // ); + // return; + // } + // await loginController + // .wxLoginSendAuth(context); + TopSlideNotification.show(context, + text: "测试阶段,暂不支持".tr); + }, + child: Container( + width: 90.rpx, + height: 90.rpx, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + 'assets/images/wechat.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), ), ), ), - Align( - alignment: AlignmentDirectional(0, 0), - child: Text( - 'Copyright© 2019-2029', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: AppFontsize.explain_size, - letterSpacing: 0, - ), - ), - ), - // Align( - // alignment: AlignmentDirectional(0, 0), - // child: Text( - // ' 网上国网 版权所有', - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // color: Color(0xFF9EA4B7), - // fontSize: AppFontsize.explain_size, - // letterSpacing: 0, - // ), - // ), - // ), ], ), ), ), ), - ], - ), + ), + Container( + child: Column( + children: [ + Container( + width: bodysize!.maxWidth * 0.365, + height: MediaQuery.sizeOf(context).height * 0.044, + decoration: BoxDecoration(), + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: Image.asset( + 'assets/images/_18328.png', + width: 300, + height: 200, + fit: BoxFit.contain, + ), + ), + ), + SizedBox( + height: 73.rpx, + ), + Container( + width: bodysize!.maxWidth, + // height: bodysize!.maxHeight * 0.118, + height: bodysize!.maxHeight * 0.09, + constraints: BoxConstraints( + minWidth: 335, + minHeight: 61, + ), + decoration: BoxDecoration(), + child: Container( + width: bodysize!.maxWidth, + height: bodysize!.maxHeight * 1, + constraints: BoxConstraints( + minWidth: 335, + minHeight: 61, + ), + decoration: BoxDecoration(), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: AlignmentDirectional(0, 0), + child: Text( + '合肥眠花糖家具有限责任公司版权所有', + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: AppFontsize.explain_size, + letterSpacing: 0, + ), + ), + ), + Align( + alignment: AlignmentDirectional(0, 0), + child: Text( + 'Copyright© 2019-2029', + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: AppFontsize.explain_size, + letterSpacing: 0, + ), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + ], ), ), ), diff --git a/lib/pages/mh_page/user/page/register_page.dart b/lib/pages/mh_page/user/page/register_page.dart index 507dfb2..d14dd19 100644 --- a/lib/pages/mh_page/user/page/register_page.dart +++ b/lib/pages/mh_page/user/page/register_page.dart @@ -56,7 +56,7 @@ class RegisterPage extends GetView { ), ), Positioned( - left: 20.rpx, + left: 0.rpx, child: returnIconButtomNew, ), ], diff --git a/lib/pages/mh_page/user/page/rxhx_mht.dart b/lib/pages/mh_page/user/page/rxhx_mht.dart index 924a696..f414ef7 100644 --- a/lib/pages/mh_page/user/page/rxhx_mht.dart +++ b/lib/pages/mh_page/user/page/rxhx_mht.dart @@ -219,52 +219,6 @@ class _RxhxMhtState extends State { ], ), ), - // leading: returnIconButtomAddCallback(() { - // controller.saveDataApi(); - // }), - - // Container( - // width: double.infinity, - // height: 70.rpx, - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // '柔性唤醒', - // style: TextStyle( - // fontFamily: 'Readex Pro', - // color: Colors.white, - // letterSpacing: 0, - // fontSize: 30.rpx), - // ), - // InkWell( - // onTap: () { - // alarmChange(); - // }, - // child: Container( - // margin: EdgeInsets.only(right: 30.rpx), - // width: 140.rpx, - // height: 66.rpx, - // alignment: Alignment.center, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(5), - // color: stringToColor("#182B7C")), - // child: Text( - // "保存", - // style: FlutterFlowTheme.of(context) - // .bodyMedium - // .override( - // fontFamily: 'Readex Pro', - // color: stringToColor("#9EA4B7"), - // letterSpacing: 0, - // fontSize: 30.rpx), - // ), - // ), - // ) - // ], - // ), - // ), actions: [], centerTitle: false, ), @@ -343,39 +297,40 @@ class _RxhxMhtState extends State { ), ), getLine(), - Container( - margin: EdgeInsets.only(left: 40.rpx, right: 30.rpx), - width: double.infinity, - height: 90.rpx, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '唤醒时间', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0, + InkWell( + onTap: () async { + showDayTimeSelectionDialog(context, + dayTimeArr: controller.model.rxhxWakeTime, + title: "唤醒时间", checkChange: (d) { + controller.attr.update((getmodel) { + getmodel.model.rxhxWakeTime = [ + int.parse("${d[0]}"), + int.parse("${d[1]}") + ]; + }); + print("$d"); + }); + }, + child: Container( + margin: + EdgeInsets.only(left: 40.rpx, right: 30.rpx), + width: double.infinity, + height: 90.rpx, + decoration: const BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + '唤醒时间', + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0, + ), ), - ), - InkWell( - onTap: () async { - showDayTimeSelectionDialog(context, - dayTimeArr: controller.model.rxhxWakeTime, - title: "唤醒时间", checkChange: (d) { - controller.attr.update((getmodel) { - getmodel.model.rxhxWakeTime = [ - int.parse("${d[0]}"), - int.parse("${d[1]}") - ]; - }); - print("$d"); - }); - }, - child: Row( + Row( mainAxisSize: MainAxisSize.max, children: [ Text( @@ -399,133 +354,134 @@ class _RxhxMhtState extends State { )) ], ), - ), - ], + ], + ), ), ), getLine(), - Container( - margin: EdgeInsets.only(left: 40.rpx, right: 30.rpx), - width: double.infinity, - height: 90.rpx, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '按摩', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0, - ), - ), - InkWell( - onTap: () { - showOneSelectionDialog( - context, - arr: ['开', "关"], - checkIndex: - controller.model.rxhxIsAnMo ? 0 : 1, - title: "按摩", - checkChange: (index) { - controller.attr.update((getmodel) { - getmodel.model.rxhxIsAnMo = - index == 0 ? true : false; - }); - }, - ); - }, - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Text( - controller.model.rxhxIsAnMo ? '开' : '关', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0, - ), + InkWell( + onTap: () { + showOneSelectionDialog( + context, + arr: ['开', "关"], + checkIndex: controller.model.rxhxIsAnMo ? 0 : 1, + title: "按摩", + checkChange: (index) { + controller.attr.update((getmodel) { + getmodel.model.rxhxIsAnMo = + index == 0 ? true : false; + }); + }, + ); + }, + child: Container( + margin: + EdgeInsets.only(left: 40.rpx, right: 30.rpx), + width: double.infinity, + height: 90.rpx, + decoration: const BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '按摩', + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0, ), - SizedBox( - width: 16.rpx, - ), - Container( - height: 30.rpx, - width: 30.rpx, - child: SvgPicture.asset( - 'assets/img/icon/expand_more.svg', + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Text( + controller.model.rxhxIsAnMo ? '开' : '关', + style: TextStyle( + fontFamily: 'Readex Pro', color: Colors.white, - )) - ], - ), - ), - ], - ), + fontSize: 26.rpx, + letterSpacing: 0, + ), + ), + SizedBox( + width: 16.rpx, + ), + Container( + height: 30.rpx, + width: 30.rpx, + child: SvgPicture.asset( + 'assets/img/icon/expand_more.svg', + color: Colors.white, + )) + ], + ), + ], + )), ), getLine(), - Container( - margin: EdgeInsets.only(left: 40.rpx, right: 30.rpx), - width: double.infinity, - height: 90.rpx, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '唤醒部位', - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0, - ), - ), - InkWell( - onTap: () { - showOneSelectionDialog( - context, - arr: location, - checkIndex: controller.model.rxhxLocation, - title: "唤醒部位", - checkChange: (index) { - controller.attr.update((getmodel) { - getmodel.model.rxhxLocation = index; - }); - }, - ); - }, - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Text( - location[controller.model.rxhxLocation], - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0, - ), + InkWell( + onTap: () { + showOneSelectionDialog( + context, + arr: location, + checkIndex: controller.model.rxhxLocation, + title: "唤醒部位", + checkChange: (index) { + controller.attr.update((getmodel) { + getmodel.model.rxhxLocation = index; + }); + }, + ); + }, + child: Container( + margin: + EdgeInsets.only(left: 40.rpx, right: 30.rpx), + width: double.infinity, + height: 90.rpx, + decoration: const BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + '唤醒部位', + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0, ), - SizedBox( - width: 16.rpx, - ), - Container( - height: 30.rpx, - width: 30.rpx, - child: SvgPicture.asset( - 'assets/img/icon/expand_more.svg', + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Text( + location[controller.model.rxhxLocation], + style: TextStyle( + fontFamily: 'Readex Pro', color: Colors.white, - )) - ], - ), - ), - ], - ), + fontSize: 26.rpx, + letterSpacing: 0, + ), + ), + SizedBox( + width: 16.rpx, + ), + Container( + height: 30.rpx, + width: 30.rpx, + child: SvgPicture.asset( + 'assets/img/icon/expand_more.svg', + color: Colors.white, + )) + ], + ), + ], + )), ), getLine(), Container( @@ -550,65 +506,120 @@ class _RxhxMhtState extends State { letterSpacing: 0, ), ), + // Padding( + // padding: EdgeInsetsDirectional.fromSTEB( + // 0, 20.rpx, 0, 0), + // child: Container( + // width: double.infinity, + // height: + // MediaQuery.sizeOf(context).height * 0.046, + // decoration: const BoxDecoration(), + // child: Row( + // mainAxisSize: MainAxisSize.max, + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // ...List.generate(7, (index) { + // return InkWell( + // onTap: () { + // controller.attr.update((getmodel) { + // getmodel.model + // .rxhxWeeks[index] = getmodel + // .model + // .rxhxWeeks[index] == + // 0 + // ? 1 + // : 0; + // }); + // }, + // child: AspectRatio( + // aspectRatio: 1, + // child: ClipOval( + // child: Container( + // height: double.infinity, + // decoration: BoxDecoration( + // color: controller.model + // .rxhxWeeks[ + // index] == + // 1 + // ? Color(0xFF84F5FF) + // : Color(0XFF003058)), + // child: Center( + // child: Text( + // weeks[index], + // style: TextStyle( + // color: controller.model + // .rxhxWeeks[ + // index] == + // 1 + // ? Color(0XFF003058) + // : Colors.white), + // ), + // ), + // ), + // ), + // ), + // ); + // }), + // ], + // ), + // ), + // ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 0, 20.rpx, 0, 0), - child: Container( + child: SizedBox( width: double.infinity, height: MediaQuery.sizeOf(context).height * 0.046, - decoration: const BoxDecoration(), child: Row( - mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - ...List.generate(7, (index) { - return InkWell( - onTap: () { - controller.attr.update((getmodel) { - getmodel.model - .rxhxWeeks[index] = getmodel - .model - .rxhxWeeks[index] == - 0 - ? 1 - : 0; - }); - }, - child: AspectRatio( - aspectRatio: 1, - child: ClipOval( - child: Container( - height: double.infinity, - decoration: BoxDecoration( - color: controller.model - .rxhxWeeks[ - index] == - 1 - ? Color(0xFF84F5FF) - : Color(0XFF003058)), - child: Center( - child: Text( - weeks[index], - style: TextStyle( - color: controller.model - .rxhxWeeks[ - index] == - 1 - ? Color(0XFF003058) - : Colors.white), - ), - ), - ), + children: List.generate(7, (index) { + final bool selected = + controller.model.rxhxWeeks[index] == + 1; + return InkWell( + onTap: () { + controller.attr.update((getmodel) { + getmodel.model.rxhxWeeks[index] = + getmodel.model + .rxhxWeeks[index] == + 0 + ? 1 + : 0; + }); + }, + borderRadius: BorderRadius.circular( + 50), // 点击水波圆角区域 + child: Container( + width: MediaQuery.sizeOf(context) + .height * + 0.046, // 保证是正圆 + height: MediaQuery.sizeOf(context) + .height * + 0.046, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: selected + ? const Color(0xFF84F5FF) + : const Color(0xFF003058), + ), + alignment: Alignment.center, + child: Text( + weeks[index], + style: TextStyle( + color: selected + ? const Color(0xFF003058) + : Colors.white, ), ), - ); - }), - ], + ), + ); + }), ), ), - ), + ) ], ), ), @@ -624,7 +635,7 @@ class _RxhxMhtState extends State { '*注:开启该功能后,在设置的时间点,设备将启动一段固定时长的柔性唤醒功能。', style: TextStyle( fontFamily: 'Readex Pro', - color: Colors.white, + color: Color(0xFF929699), fontSize: 20.rpx, letterSpacing: 0, ), diff --git a/lib/pages/mh_page/user_agreement_page.dart b/lib/pages/mh_page/user_agreement_page.dart new file mode 100644 index 0000000..5a91f46 --- /dev/null +++ b/lib/pages/mh_page/user_agreement_page.dart @@ -0,0 +1,126 @@ +import 'package:ef/ef.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_pdfview/flutter_pdfview.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; +import 'package:vbvs_app/common/util/FitTool.dart'; +import 'package:vbvs_app/common/util/MyUtils.dart'; +import 'package:vbvs_app/controller/setting/pdf/UserPdfController.dart'; + +class UserAgreementPage extends StatefulWidget { + UserAgreementPage({super.key}); + + @override + State createState() => _UserAgreementPageState(); +} + +class _UserAgreementPageState extends State { + UserPdfController pdfController = Get.find(); + + @override + void initState() { + super.initState(); + String language = "zh_CN"; // 默认语言 + + if (languageController.selectLanguage?.value?.language_code != null) { + language = languageController.selectLanguage!.value!.language_code!; + } + + int ent_type = AppConstants().ent_type; + + // 根据 ent_type 拼接不同的文件名 + String pdfName = + ent_type == 1 ? "$language.pdf" : "${language}_$ent_type.pdf"; + + pdfController.loadPdf( + 1, + "https://vsbst-api.he-info.cn/vsbs_sotrage/user-scheme/$pdfName", + ); + } + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, bodySize) => GestureDetector( + onTap: () => FocusScope.of(context).unfocus(), + child: Container( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/new_background.png'), // 本地图片 + fit: BoxFit.fill, // 填满整个 Container + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, // 加上这一行 + appBar: AppBar( + backgroundColor: Colors.transparent, + automaticallyImplyLeading: false, + iconTheme: IconThemeData( + color: themeController.currentColor.sc3, + ), + titleSpacing: 0, + // leading: returnIconButtom, + title: Container( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + /// 居中标题 + Text( + '用户协议'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + ), + ), + + /// 左边返回按钮 + Positioned( + left: 0, + child: returnIconButtomNew, + ), + ], + ), + ), + + actions: [], + centerTitle: false, + ), + + body: SafeArea( + top: true, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 0.rpx), + child: Column( + children: [ + Expanded( + child: Obx(() { + if (pdfController.localPdfPath.value == null) { + return Center(child: CircularProgressIndicator()); + } else { + return PDFView( + filePath: pdfController.localPdfPath.value!, + autoSpacing: false, + enableSwipe: true, + swipeHorizontal: false, + pageSnap: true, + fitEachPage: true, + defaultPage: 0, + onRender: (pages) => print('PDF 渲染完成,共 $pages 页'), + onError: (error) => print('PDF 加载错误: $error'), + ); + } + }), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/sleep_report/mht_new_sleep_report_page.dart b/lib/pages/sleep_report/mht_new_sleep_report_page.dart index aa1ba79..78bb41e 100644 --- a/lib/pages/sleep_report/mht_new_sleep_report_page.dart +++ b/lib/pages/sleep_report/mht_new_sleep_report_page.dart @@ -179,8 +179,8 @@ class _MHTNewSleepReportPageState extends State { if (widget.data['arrow'] == null || widget.data['arrow'] == true) Positioned( - left: 0, - child: returnIconButtom, + left: 20, + child: returnIconButtomNew, ), ], ), diff --git a/lib/pages/sleep_report/new_sleep_report_page copy.dart b/lib/pages/sleep_report/new_sleep_report_page copy.dart index 94979b3..8f61913 100644 --- a/lib/pages/sleep_report/new_sleep_report_page copy.dart +++ b/lib/pages/sleep_report/new_sleep_report_page copy.dart @@ -122,8 +122,8 @@ class _NewSleepReportPageState extends State { /// 左边返回按钮 Positioned( - left: 0, - child: returnIconButtom, + left: 20, + child: returnIconButtomNew, ), ], ), diff --git a/lib/pages/sleep_report/new_sleep_report_page.dart b/lib/pages/sleep_report/new_sleep_report_page.dart index f68b177..7252701 100644 --- a/lib/pages/sleep_report/new_sleep_report_page.dart +++ b/lib/pages/sleep_report/new_sleep_report_page.dart @@ -13,6 +13,7 @@ import 'package:vbvs_app/controller/home/home_controller.dart'; import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart'; import 'package:vbvs_app/language/AppLanguage.dart'; import 'package:vbvs_app/pages/common/selectDialog.dart'; +import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart'; import 'package:vbvs_app/pages/sleep_report/component/AIAdviceWidget.dart'; import 'package:vbvs_app/pages/sleep_report/component/BreatheCard.dart'; import 'package:vbvs_app/pages/sleep_report/component/BreathePauseNewWidget.dart'; @@ -91,8 +92,16 @@ class _NewSleepReportPageState extends State { _scrollToTargetComponent(sleepReportController.sleepReport); }, onFailure: (res) { - TopSlideNotification.show(context, - text: res.msg!, textColor: themeController.currentColor.sc9); + if (MainPageBBottomChange.getCurrentIndex() != null) { + if (MainPageBBottomChange.getCurrentIndex() == 1) { + TopSlideNotification.show(context, + text: res.msg!, textColor: themeController.currentColor.sc9); + } + } else { + TopSlideNotification.show(context, + text: res.msg!, textColor: themeController.currentColor.sc9); + } + sleepReportController.sleepReport.value = {}; sleepReportController.updateAll(); print(res); @@ -149,15 +158,28 @@ class _NewSleepReportPageState extends State { builder: (context, bodySize) => GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Container( + // decoration: BoxDecoration( + // image: DecorationImage( + // image: (widget.data['backgroundImg'] != null && + // widget.data['backgroundImg'].toString().isNotEmpty) + // ? AssetImage(widget.data['backgroundImg']) + // : AssetImage('assets/img/bgNoImg.png') as ImageProvider, + // fit: BoxFit.fill, + // ), + // ), decoration: BoxDecoration( - image: DecorationImage( - image: (widget.data['backgroundImg'] != null && - widget.data['backgroundImg'].toString().isNotEmpty) - ? AssetImage(widget.data['backgroundImg']) - : AssetImage('assets/img/bgNoImg.png') as ImageProvider, - fit: BoxFit.fill, - ), + image: (widget.data['noBackImg'] != null && + widget.data['noBackImg'] == true) + ? null // ✅ 不要背景图 + : DecorationImage( + image: (widget.data['backgroundImg'] != null && + widget.data['backgroundImg'].toString().isNotEmpty) + ? AssetImage(widget.data['backgroundImg']) + : AssetImage('assets/img/bgNoImg.png') as ImageProvider, + fit: BoxFit.fill, + ), ), + child: Scaffold( backgroundColor: Colors.transparent, // 背景透明 appBar: AppBar( @@ -189,7 +211,7 @@ class _NewSleepReportPageState extends State { widget.data['arrow'] == true) Positioned( left: 0, - child: returnIconButtom, + child: returnIconButtomNew, ), ], ), diff --git a/lib/pages/sleep_report/sleep_report_page.dart b/lib/pages/sleep_report/sleep_report_page.dart index 9622efc..9903d58 100644 --- a/lib/pages/sleep_report/sleep_report_page.dart +++ b/lib/pages/sleep_report/sleep_report_page.dart @@ -77,7 +77,7 @@ class _SleepReportPageState extends State { /// 左边返回按钮 Positioned( left: 0, - child: returnIconButtom, + child: returnIconButtomNew, ), ], ), diff --git a/lib/pages/user/about_us_page.dart b/lib/pages/user/about_us_page.dart index 494a07a..df41923 100644 --- a/lib/pages/user/about_us_page.dart +++ b/lib/pages/user/about_us_page.dart @@ -57,15 +57,13 @@ class _AboutUsPageState extends State { alignment: Alignment.center, children: [ /// 居中标题 - Text( - '关于我们'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: themeController.currentColor.sc3, - letterSpacing: 0, - fontSize: 30.rpx, - ), - ), + Text('关于我们'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + )), /// 左边返回按钮 Positioned( diff --git a/lib/routers/mh_routers.dart b/lib/routers/mh_routers.dart index a29f31b..0ae14e3 100644 --- a/lib/routers/mh_routers.dart +++ b/lib/routers/mh_routers.dart @@ -1,5 +1,6 @@ import 'package:ef/ef.dart'; import 'package:flutter/cupertino.dart'; +import 'package:path/path.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; @@ -8,6 +9,8 @@ import 'package:vbvs_app/main.dart'; import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart'; import 'package:vbvs_app/pages/mh_page/HomeDeviceType.dart'; import 'package:vbvs_app/pages/mh_page/LanguagePage.dart'; +import 'package:vbvs_app/pages/mh_page/ShareDeviceDetailWidget.dart'; +import 'package:vbvs_app/pages/mh_page/about_us.dart'; import 'package:vbvs_app/pages/mh_page/address_list_page.dart'; import 'package:vbvs_app/pages/mh_page/applyRepair/apply_repair_success.dart'; import 'package:vbvs_app/pages/mh_page/apply_repair_page.dart'; @@ -24,6 +27,8 @@ import 'package:vbvs_app/pages/mh_page/device_people_info.dart'; import 'package:vbvs_app/pages/mh_page/device_share_page.dart'; import 'package:vbvs_app/pages/mh_page/edit_bed.dart'; import 'package:vbvs_app/pages/mh_page/help/article.dart'; +import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart'; +import 'package:vbvs_app/pages/mh_page/privacy_policy.dart'; import 'package:vbvs_app/pages/mh_page/user/page/edit_userinfo_page.dart'; import 'package:vbvs_app/pages/mh_page/experience_store_page.dart'; import 'package:vbvs_app/pages/mh_page/issue_list_page.dart'; @@ -39,9 +44,11 @@ import 'package:vbvs_app/pages/mh_page/user/page/find_password_page.dart'; import 'package:vbvs_app/pages/mh_page/user/page/mht_login_page.dart'; import 'package:vbvs_app/pages/mh_page/user/page/rxhx_mht.dart'; import 'package:vbvs_app/pages/mh_page/user/page/update_password_page.dart'; +import 'package:vbvs_app/pages/mh_page/user_agreement_page.dart'; import 'package:vbvs_app/pages/sleep_report/new_sleep_report_page.dart'; import '../pages/mh_page/bluetooth.dart'; import '../pages/mh_page/edit_address_page.dart'; +import '../pages/mh_page/message/messageDetail.dart'; import '../pages/mh_page/message_page.dart'; import '../pages/mh_page/new_settingPage.dart'; @@ -49,6 +56,7 @@ ThemeController themeController = Get.find(); var mhroutes = { "/mianPageBottomChange": (contxt) => MainPageBBottomChange(), + "/homePage": (context) => NewHomePage(), "/homeDeviceType": (contxt) => HomeDeviceType(), "/editUserInfoPage": (contxt) => EditUserPage(), "/peopleInfoPage": (contxt, {arguments}) => PeopleInfoPage( @@ -81,7 +89,8 @@ var mhroutes = { "/findPasswordPage": (context) => FindPasswordPage(), "/loginPage": (context) => MHTLoginPage(), "/updatePasswordPage": (context) => UpdatePasswordPage(), - "/deviceSharePage": (context) => ShareDeviceWidget(), + "/deviceSharePage": (context, {arguments}) => + ShareDeviceWidget(data: arguments), "/deviceListPage": (context) => DeviceListPage(), "/mHTDeviceTypePage": (context, {arguments}) => MHTBindDeviceTypePage(), "/mHTBlueteethDevicePage": (context, {arguments}) => @@ -95,6 +104,12 @@ var mhroutes = { "/helpArticle": (contxt, {arguments}) => HelpArticle(article: arguments), "/mHTPeopleInfoPage": (contxt) => MHTPeopleInfoPage(), "/applyRepairSuccess": (contxt) => ApplyRepairSuccess(), + "/aboutUs": (contxt) => MhAboutUsPage(), + "/userAgreementPage": (context) => UserAgreementPage(), + "/privacyPolicyPage": (context) => PrivacyPolicyPage(), + "/shareDeviceDetail": (context) => ShareDeviceDetailWidget(), + "/messageDetail": (context, {arguments}) => + MessageDetailPage(data: arguments), }; var mhonGenerateRoute = (RouteSettings settings) { final String? name = settings.name; // 获取路由名称,如 /news 或 /search diff --git a/pubspec.lock b/pubspec.lock index f825957..671f5ea 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -444,7 +444,11 @@ packages: description: path: "." ref: main +<<<<<<< HEAD resolved-ref: "840bcea66ee9222d9698a58f12a06107f337b59f" +======= + resolved-ref: f307495aac440031d119a728beaccf5d33003932 +>>>>>>> 13eb25e1c30dcd81c87aa85bcb5306ca0931ed21 url: "https://gitea.wslpc.real.he-info.cn:94/flutter/easydevice.git" source: git version: "0.0.1" @@ -452,8 +456,13 @@ packages: dependency: "direct main" description: path: "." +<<<<<<< HEAD ref: main resolved-ref: "13a86afdcf71b55017ebf7ee2c22af211e642603" +======= + ref: e86d515f77 + resolved-ref: e86d515f77a736a5e6f09036e5e022153cde425d +>>>>>>> 13eb25e1c30dcd81c87aa85bcb5306ca0931ed21 url: "https://gitea.wslpc.real.he-info.cn:94/flutter/easyweb.git" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index ebb1971..729babb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -66,7 +66,7 @@ dependencies: easyweb: git: url: https://gitea.wslpc.real.he-info.cn:94/flutter/easyweb.git - ref: main + ref: e86d515f77 archive: ^4.0.0