更新
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
class ServiceConstant {
|
||||
static const String baseHost = "vsbs-test.he-info.cn"; //服务地址
|
||||
static const String baseHost = "zhmht.swes.com.cn:27020"; //服务地址
|
||||
// static const String baseHost = "vsbs-test.he-info.cn"; //服务地址
|
||||
// static const String baseHost = "vsbst-api.he-info.cn";//服务地址
|
||||
static const String service_address = "http://$baseHost";
|
||||
// static const String service_address = "http://$baseHost";
|
||||
static const String service_address = "https://$baseHost";
|
||||
|
||||
static String server_service = "/vsbs_app_server"; //服务名称
|
||||
|
||||
@@ -17,7 +19,7 @@ class ServiceConstant {
|
||||
static String person_info = "/api/personnel/info"; //用户资料
|
||||
static String sleep_report = "/api/device/sleep/data"; //睡眠报告
|
||||
static String device_share = "/api/device/share"; //分享设备
|
||||
|
||||
|
||||
static String message_list = "/api/mesasge/list"; //消息列表
|
||||
static String message_read = "/api/mesasge/read"; //消息未读数量
|
||||
static String device_show = "/api/device/bind"; //更新设备绑定
|
||||
@@ -32,7 +34,6 @@ class ServiceConstant {
|
||||
static String city_data = "/api/city/data/info"; //城市数据
|
||||
static String address_list = "/api/addresss/list"; //查询地址列表
|
||||
static String add_address = "/api/addresss/info"; //添加地址
|
||||
|
||||
|
||||
static String logService = "$service_address/vsbs_log";
|
||||
static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'package:ef/ef.dart';
|
||||
|
||||
class CommonVariables {
|
||||
static bool isNetWorkOn = false;
|
||||
static String supabaseUrl = "https://zhmht.swes.com.cn:3443";
|
||||
@@ -12,7 +14,7 @@ class CommonVariables {
|
||||
//公司名称
|
||||
static String enterpriseName = "合肥眠花糖家具有限责任公司";
|
||||
//备案时间
|
||||
static String ICPTime = "2022-2025";
|
||||
static String ICPTime = "2019-2029";
|
||||
static String shoph5Url = "https://zhmht.swes.com.cn:1443";
|
||||
|
||||
static Map<String, Function(dynamic)> callMap = {};
|
||||
@@ -22,4 +24,10 @@ class CommonVariables {
|
||||
static String shareText = "您的朋友邀请您使用《智慧眠花糖》APP,请复制后面链接在浏览器中打开! " +
|
||||
shoph5Url +
|
||||
"/#/pages/download/download";
|
||||
|
||||
List permissionInfo = [
|
||||
["位置权限说明".tr, "获得位置信息,连接附近的蓝牙设备与推荐附近门店".tr],
|
||||
["蓝牙权限说明".tr, "搜索链接附近的蓝牙设备".tr],
|
||||
["附近设备权限说明".tr, "搜索链接附近的蓝牙设备".tr]
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2,11 +2,14 @@ import 'dart:async';
|
||||
|
||||
import 'package:EasyDartModule/EasyDartModule.dart';
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:weather/weather.dart';
|
||||
|
||||
part 'weather_controller.g.dart';
|
||||
@@ -100,8 +103,6 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
// 调用获取天气方法
|
||||
_getCurrentWeather();
|
||||
} catch (e) {
|
||||
|
||||
|
||||
print(e);
|
||||
EasyDartModule.logger.error("获取位置失败: $e");
|
||||
}
|
||||
@@ -117,7 +118,20 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
return Future.error('位置服务未启用');
|
||||
}
|
||||
|
||||
permission = await Geolocator.checkPermission();
|
||||
showPermissionInfoDialog(Get.context!, CommonVariables().permissionInfo);
|
||||
// permission = await Geolocator.checkPermission();
|
||||
try {
|
||||
// 2️⃣ 检查权限(系统弹窗)—— 此时你的提示框仍然显示
|
||||
permission = await Geolocator.checkPermission();
|
||||
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
}
|
||||
} finally {
|
||||
// 3️⃣ 无论如何都关闭你的提示弹窗
|
||||
Navigator.of(Get.context!, rootNavigator: true).pop();
|
||||
}
|
||||
|
||||
if (permission == LocationPermission.denied) {
|
||||
permission = await Geolocator.requestPermission();
|
||||
if (permission == LocationPermission.denied) {
|
||||
@@ -199,166 +213,3 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// import 'dart:async';
|
||||
// import 'package:EasyDartModule/EasyDartModule.dart';
|
||||
// import 'package:ef/ef.dart';
|
||||
// import 'package:amap_flutter_location/amap_flutter_location.dart'; // 导入 amap_flutter_location 插件
|
||||
// import 'package:geocoding/geocoding.dart';
|
||||
// import 'package:json_annotation/json_annotation.dart';
|
||||
// import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
// import 'package:vbvs_app/controller/setting/language/language_controller.dart';
|
||||
// import 'package:weather/weather.dart';
|
||||
|
||||
// part 'weather_controller.g.dart';
|
||||
|
||||
// @JsonSerializable()
|
||||
// class WeatherModel {
|
||||
// double? longitude; // 经度
|
||||
// double? latitude; // 纬度
|
||||
// String? weather_info = ''; // 天气
|
||||
// int? current_temperature; // 温度
|
||||
// int? min_temperature; // 最低温度
|
||||
// int? max_temperature; // 最高温度
|
||||
// String? wind_direction; // 风向
|
||||
// int? wind_speed; // 风速等级
|
||||
// String? cityName; // 城市名
|
||||
// String? weatherIcon; // 天气图标
|
||||
// String? weatherIconurl; // 天气图标url
|
||||
|
||||
// WeatherModel();
|
||||
|
||||
// static WeatherModel fromJson(Map<String, dynamic> json) =>
|
||||
// _$WeatherModelFromJson(json);
|
||||
|
||||
// Map<String, dynamic> toJson() => _$WeatherModelToJson(this);
|
||||
// }
|
||||
|
||||
// class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
// LanguageController languageController = Get.find();
|
||||
// WeatherModelController() {
|
||||
// attr = GetModel(WeatherModel()).obs;
|
||||
// weatherFactory = WeatherFactory(CommonVariables.weather_apiKey,
|
||||
// language: Language.CHINESE_SIMPLIFIED);
|
||||
// }
|
||||
|
||||
// Timer? _weatherTimer;
|
||||
// Timer? _locationTimer;
|
||||
|
||||
// late WeatherFactory weatherFactory;
|
||||
// late AMapFlutterLocation location; // 声明 AMapFlutterLocation 实例
|
||||
|
||||
// @override
|
||||
// Future<void> onInit() async {
|
||||
// super.onInit();
|
||||
|
||||
// location = AMapFlutterLocation(); // 初始化 AMapFlutterLocation
|
||||
|
||||
// try {
|
||||
// await _getCurrentLocation();
|
||||
// _weatherTimer = Timer.periodic(Duration(seconds: 5), (timer) {
|
||||
// _getCurrentWeather(); // 每 5 秒更新一次天气
|
||||
// });
|
||||
|
||||
// _locationTimer = Timer.periodic(Duration(minutes: 10), (timer) {
|
||||
// _getCurrentLocation(); // 每 10 分钟更新一次位置
|
||||
// });
|
||||
// } catch (e) {
|
||||
// ef.log("[天气和定位请求失败]");
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void onClose() {
|
||||
// _weatherTimer?.cancel(); // 取消天气更新定时器
|
||||
// _locationTimer?.cancel(); // 取消位置更新定时器
|
||||
// location.stopLocation(); // 停止高德定位
|
||||
// super.onClose();
|
||||
// }
|
||||
|
||||
// // 获取当前位置并存储到 model
|
||||
// Future<void> _getCurrentLocation() async {
|
||||
// try {
|
||||
// // 开始定位
|
||||
// location.startLocation();
|
||||
|
||||
// // 监听定位回调
|
||||
|
||||
// location.onLocationChanged().listen((Map<String, Object> result) {
|
||||
// ///result即为定位结果
|
||||
// ef.log("[位置]:${result}");
|
||||
// });
|
||||
|
||||
// // location.onLocationChanged.listen((locationData) {
|
||||
// // if (locationData.latitude != null && locationData.longitude != null) {
|
||||
// // model.latitude = locationData.latitude;
|
||||
// // model.longitude = locationData.longitude;
|
||||
|
||||
// // // 获取位置对应的城市名
|
||||
// // _getCityName(locationData.latitude!, locationData.longitude!);
|
||||
// // }
|
||||
// // });
|
||||
// } catch (e) {
|
||||
// print(e);
|
||||
// EasyDartModule.logger.error("获取位置失败: $e");
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 获取城市名
|
||||
// Future<void> _getCityName(double latitude, double longitude) async {
|
||||
// try {
|
||||
// List<Placemark> placemarks =
|
||||
// await placemarkFromCoordinates(latitude, longitude);
|
||||
|
||||
// if (placemarks.isNotEmpty) {
|
||||
// model.cityName = placemarks[0].locality ?? "未知数据".tr;
|
||||
// }
|
||||
// // 获取天气
|
||||
// _getCurrentWeather();
|
||||
// } catch (e) {
|
||||
// print(e);
|
||||
// EasyDartModule.logger.error("获取城市名失败: $e");
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 获取天气信息
|
||||
// Future<void> _getCurrentWeather() async {
|
||||
// if (model.latitude == null || model.longitude == null) {
|
||||
// EasyDartModule.logger.error("获取天气失败:位置数据获取失败");
|
||||
// return; // 如果位置数据没有获取到,则不更新天气
|
||||
// }
|
||||
|
||||
// try {
|
||||
// weatherFactory.language = Language.CHINESE_SIMPLIFIED;
|
||||
// Weather weather = await weatherFactory.currentWeatherByLocation(
|
||||
// model.latitude!, model.longitude!);
|
||||
|
||||
// model.weather_info = weather.weatherDescription;
|
||||
// model.min_temperature = weather.tempMin?.celsius?.toInt();
|
||||
// model.max_temperature = weather.tempMax?.celsius?.toInt();
|
||||
// model.current_temperature = weather.temperature?.celsius?.toInt();
|
||||
// model.wind_speed = weather.windSpeed?.toInt();
|
||||
// model.weatherIcon = weather.weatherIcon;
|
||||
// if (model.weatherIcon != null) {
|
||||
// model.weatherIconurl =
|
||||
// "https://openweathermap.org/img/w/${model.weatherIcon}.png";
|
||||
// }
|
||||
// updateAll(); // 更新 UI
|
||||
// } catch (e) {
|
||||
// EasyDartModule.logger.error("获取天气失败: $e");
|
||||
// print('获取天气失败: $e');
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 获取 5 天天气预报
|
||||
// Future<List<Weather>> getWeatherForecast(
|
||||
// double latitude, double longitude) async {
|
||||
// try {
|
||||
// return await weatherFactory.fiveDayForecastByLocation(
|
||||
// latitude, longitude);
|
||||
// } catch (e) {
|
||||
// print('获取天气预报失败: $e');
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -137,9 +137,13 @@ class _LanguagePageState extends State<LanguagePage> {
|
||||
.value = language;
|
||||
final list = deviceController
|
||||
.personnelList.value;
|
||||
deviceController.getHomeSleeps(
|
||||
list[0]["mac"], context);
|
||||
|
||||
if (list != null &&
|
||||
list.isNotEmpty) {
|
||||
deviceController
|
||||
.getHomeSleeps(
|
||||
list[0]["mac"],
|
||||
context);
|
||||
}
|
||||
try {
|
||||
// ef.kv.set("language",
|
||||
// language.language_code);
|
||||
@@ -203,10 +207,13 @@ class _LanguagePageState extends State<LanguagePage> {
|
||||
deviceController
|
||||
.personnelList
|
||||
.value;
|
||||
deviceController
|
||||
.getHomeSleeps(
|
||||
list[0]["mac"],
|
||||
context);
|
||||
if (list != null &&
|
||||
list.isNotEmpty) {
|
||||
deviceController
|
||||
.getHomeSleeps(
|
||||
list[0]["mac"],
|
||||
context);
|
||||
}
|
||||
|
||||
try {
|
||||
// ef.kv.set("language",
|
||||
|
||||
@@ -280,7 +280,7 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
1;
|
||||
}
|
||||
});
|
||||
await homeController.getPersonList();
|
||||
await homeController.getPersonList();
|
||||
} else {
|
||||
blueteethBindController.resumeScanning();
|
||||
blueteethBindController.currentDeviceMac.value = "";
|
||||
@@ -494,59 +494,130 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
}
|
||||
|
||||
//获取智能床/床垫mac
|
||||
// Future<String> getBindTHMAC(
|
||||
// BuildContext context, BlueToothDataModel device, Map deviceType) async {
|
||||
// const int maxRetries = 2;
|
||||
// const Duration timeout = Duration(seconds: 5);
|
||||
// String? macAddress;
|
||||
// try {
|
||||
// // 连接设备
|
||||
// THapp bledevice = THapp(device: device.scanResult.device);
|
||||
// await bledevice.connect();
|
||||
// var res2 = bledevice.isConnected;
|
||||
// if (!res2) {
|
||||
// edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
|
||||
// DailyLogUtils.printLog("蓝牙连接失败".tr);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "蓝牙连接失败".tr,
|
||||
// textColor: themeController.currentColor.sc9,
|
||||
// );
|
||||
// throw Exception("蓝牙连接失败".tr);
|
||||
// }
|
||||
// blueteethBindController.blueConnectFlag.value = 2;
|
||||
// blueteethBindController.currentDevice = bledevice;
|
||||
// await Future.delayed(Duration(seconds: 2));
|
||||
|
||||
// if (deviceType['type'] == 3) {
|
||||
// //智能床垫
|
||||
// macAddress = await getMacFromType3(bledevice, timeout);
|
||||
// } else if (deviceType['type'] == 2) {
|
||||
// //智能床
|
||||
// macAddress = await getMacFromType2(bledevice, timeout);
|
||||
// } else {
|
||||
// throw Exception("不支持的设备类型".tr);
|
||||
// }
|
||||
|
||||
// if (macAddress == null) {
|
||||
// throw Exception("未能获取到MAC地址".tr);
|
||||
// }
|
||||
|
||||
// // device.macA = macAddress;
|
||||
// print('MAC地址: $macAddress');
|
||||
// return macAddress;
|
||||
// } catch (e) {
|
||||
// blueteethBindController.currentDeviceMac.value = "";
|
||||
// edm.EasyDartModule.logger.error("蓝牙获取MAC失败:$e");
|
||||
// DailyLogUtils.printLog("蓝牙获取MAC失败:$e");
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// // text: e.message ?? "设备连接失败,请重试".tr,
|
||||
// text: "获取不到传感器mac,请重试".tr,
|
||||
// textColor: themeController.currentColor.sc9,
|
||||
// );
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<String> getBindTHMAC(
|
||||
BuildContext context, BlueToothDataModel device, Map deviceType) async {
|
||||
const int maxRetries = 2;
|
||||
const int maxRetries = 2; // 重试2次
|
||||
const Duration timeout = Duration(seconds: 5);
|
||||
String? macAddress;
|
||||
try {
|
||||
// 连接设备
|
||||
THapp bledevice = THapp(device: device.scanResult.device);
|
||||
await bledevice.connect();
|
||||
var res2 = bledevice.isConnected;
|
||||
if (!res2) {
|
||||
edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
|
||||
DailyLogUtils.printLog("蓝牙连接失败".tr);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "蓝牙连接失败".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
throw Exception("蓝牙连接失败".tr);
|
||||
}
|
||||
blueteethBindController.blueConnectFlag.value = 2;
|
||||
blueteethBindController.currentDevice = bledevice;
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
||||
if (deviceType['type'] == 3) {
|
||||
//智能床垫
|
||||
macAddress = await getMacFromType3(bledevice, timeout);
|
||||
} else if (deviceType['type'] == 2) {
|
||||
//智能床
|
||||
macAddress = await getMacFromType2(bledevice, timeout);
|
||||
} else {
|
||||
throw Exception("不支持的设备类型".tr);
|
||||
}
|
||||
for (int attempt = 1; attempt <= maxRetries; attempt++) {
|
||||
try {
|
||||
// 连接设备
|
||||
THapp bledevice = THapp(device: device.scanResult.device);
|
||||
await bledevice.connect();
|
||||
var res2 = bledevice.isConnected;
|
||||
|
||||
if (macAddress == null) {
|
||||
throw Exception("未能获取到MAC地址".tr);
|
||||
}
|
||||
if (!res2) {
|
||||
edm.EasyDartModule.logger.error("蓝牙连接失败".tr);
|
||||
DailyLogUtils.printLog("蓝牙连接失败".tr);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "蓝牙连接失败".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
throw Exception("蓝牙连接失败".tr);
|
||||
}
|
||||
|
||||
// device.macA = macAddress;
|
||||
print('MAC地址: $macAddress');
|
||||
return macAddress;
|
||||
} catch (e) {
|
||||
blueteethBindController.currentDeviceMac.value = "";
|
||||
edm.EasyDartModule.logger.error("蓝牙获取MAC失败:$e");
|
||||
DailyLogUtils.printLog("蓝牙获取MAC失败:$e");
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
// text: e.message ?? "设备连接失败,请重试".tr,
|
||||
text: "获取不到传感器mac,请重试".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
rethrow;
|
||||
blueteethBindController.blueConnectFlag.value = 2;
|
||||
blueteethBindController.currentDevice = bledevice;
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
||||
// 根据设备类型获取 MAC
|
||||
if (deviceType['type'] == 3) {
|
||||
macAddress = await getMacFromType3(bledevice, timeout);
|
||||
} else if (deviceType['type'] == 2) {
|
||||
macAddress = await getMacFromType2(bledevice, timeout);
|
||||
} else {
|
||||
throw Exception("不支持的设备类型".tr);
|
||||
}
|
||||
|
||||
if (macAddress != null) {
|
||||
print('MAC地址: $macAddress');
|
||||
return macAddress; // 成功获取直接返回
|
||||
}
|
||||
|
||||
// 当前尝试失败,准备重试
|
||||
DailyLogUtils.printLog("第$attempt次尝试未获取到MAC地址");
|
||||
|
||||
if (attempt < maxRetries) {
|
||||
await Future.delayed(Duration(seconds: 1)); // 等待后重试
|
||||
}
|
||||
} catch (e) {
|
||||
DailyLogUtils.printLog("第$attempt次蓝牙获取MAC失败: $e");
|
||||
edm.EasyDartModule.logger.error("第$attempt次蓝牙获取MAC失败: $e");
|
||||
|
||||
// 最后一次尝试失败后才提示
|
||||
if (attempt == maxRetries) {
|
||||
blueteethBindController.currentDeviceMac.value = "";
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "获取不到传感器mac,请重试".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
rethrow; // 抛出最后的异常
|
||||
}
|
||||
|
||||
// 否则继续尝试
|
||||
}
|
||||
}
|
||||
|
||||
// 正常不会到这里
|
||||
throw Exception("未知错误");
|
||||
}
|
||||
|
||||
fillTHMac(
|
||||
|
||||
@@ -558,7 +558,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'ICP备案号:浙ICP备2023000785号-1'.tr,
|
||||
'ICP备案号:皖ICP备2024068219号-1A'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontFamily: 'Inter',
|
||||
@@ -571,7 +571,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
AppConstants().ent_type == 1
|
||||
? 'Copyright © 202-2025 嘉兴太和信息技术有限责任公司 版权所有'
|
||||
.tr
|
||||
: "Copyright © 202-2025 杭州欢睡科技有限公司 版权所有".tr,
|
||||
: "Copyright © 202-2025 合肥眠花糖家具有限责任公司 版权所有".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontFamily: 'Inter',
|
||||
|
||||
@@ -538,7 +538,7 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() {
|
||||
return (controller.ready.value)
|
||||
?controller.web.build()
|
||||
? controller.web.build()
|
||||
: Center(child: CircularProgressIndicator());
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -115,6 +115,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
}
|
||||
sleepReportController = Get.find(tag: widget.data["tag"]);
|
||||
sleepReportController.sleepReport.value = {};
|
||||
|
||||
if (widget.data['date'] == null) {
|
||||
widget.data['date'] = DateTime.now();
|
||||
}
|
||||
@@ -129,6 +130,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
}
|
||||
String date = MyUtils.formatToDate(widget.data['date']);
|
||||
// String date = '2025-5-27';
|
||||
sleepReportController.isLoading.value = true;
|
||||
requestWithLog(
|
||||
logTitle: "查询睡眠报告",
|
||||
method: MyHttpMethod.get,
|
||||
@@ -136,6 +138,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
"https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.data['mac']}&time=${date}&type=${sleepReportController.model.type}",
|
||||
onSuccess: (res) {
|
||||
print(res);
|
||||
sleepReportController.isLoading.value = false;
|
||||
sleepReportController.sleepReport.value = res.data;
|
||||
sleepReportController.updateAll();
|
||||
_scrollToTargetComponent(sleepReportController.sleepReport);
|
||||
@@ -148,6 +151,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
}
|
||||
} else {}
|
||||
sleepReportController.sleepReport.value = {};
|
||||
sleepReportController.isLoading.value = false;
|
||||
sleepReportController.updateAll();
|
||||
print(res);
|
||||
});
|
||||
@@ -624,23 +628,34 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
(sleepReport == null || sleepReport.isEmpty)
|
||||
? Container(
|
||||
child: Expanded(child: NullDataWidget()),
|
||||
)
|
||||
: (sleepReportController.model.type == 1
|
||||
? DailyDataWidget(
|
||||
sleepReport,
|
||||
sleepCardKey,
|
||||
heartRateCardKey,
|
||||
breatheCardKey,
|
||||
widget.data)
|
||||
: sleepReportController.model.type == 2
|
||||
? WeekDataWidget(sleepReport, widget.data)
|
||||
: sleepReportController.model.type == 3
|
||||
? MonthDataWidget(
|
||||
sleepReport, widget.data)
|
||||
: NullDataWidget()),
|
||||
Obx(() {
|
||||
if (sleepReportController.isLoading.value) {
|
||||
return Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (sleepReport == null || sleepReport.isEmpty) {
|
||||
// 空数据
|
||||
return Expanded(child: NullDataWidget());
|
||||
} else {
|
||||
// 有数据,根据类型返回不同 widget
|
||||
switch (sleepReportController.model.type) {
|
||||
case 1:
|
||||
return DailyDataWidget(
|
||||
sleepReport,
|
||||
sleepCardKey,
|
||||
heartRateCardKey,
|
||||
breatheCardKey,
|
||||
widget.data,
|
||||
);
|
||||
case 2:
|
||||
return WeekDataWidget(sleepReport, widget.data);
|
||||
case 3:
|
||||
return MonthDataWidget(
|
||||
sleepReport, widget.data);
|
||||
default:
|
||||
return Expanded(child: NullDataWidget());
|
||||
}
|
||||
}
|
||||
}),
|
||||
].divide(SizedBox(
|
||||
height: 25.rpx,
|
||||
)),
|
||||
|
||||
@@ -567,7 +567,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'ICP备案号:浙ICP备2023000785号-1'.tr,
|
||||
'ICP备案号:皖ICP备2024068219号-1A'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontFamily: 'Inter',
|
||||
@@ -578,9 +578,9 @@ class _SettingPageState extends State<SettingPage> {
|
||||
),
|
||||
Text(
|
||||
AppConstants().ent_type == 1
|
||||
? 'Copyright © 202-2025 嘉兴太和信息技术有限责任公司 版权所有'
|
||||
? 'Copyright © 2022-2025 嘉兴太和信息技术有限责任公司 版权所有'
|
||||
.tr
|
||||
: "Copyright © 202-2025 杭州欢睡科技有限公司 版权所有",
|
||||
: "Copyright © 2019-2029 合肥眠花糖家具有限责任公司 版权所有",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc4,
|
||||
fontFamily: 'Inter',
|
||||
|
||||
Reference in New Issue
Block a user