更新新版控制

This commit is contained in:
wyf
2025-12-30 15:58:19 +08:00
parent 1dcef1090d
commit 36f19a71eb
20 changed files with 359 additions and 71 deletions

View File

@@ -1,3 +1,3 @@
[
"assets/miniapp/mhtControl_1.0.89.zip"
"assets/miniapp/mhtControl_1.0.90.zip"
]

View File

@@ -313,8 +313,8 @@
"开始校准": "Start calibration",
"校准完成": "Calibration complete!",
"微信安装提示": "Please install WeChat APP first",
"安卓启用网络提示": "",
"ios启用网络提示": "",
"安卓启用网络提示": "The network is not enabled. Please enable the network connection",
"ios启用网络提示": "The network is not enabled. Please enable the network connection",
"设备报修": "Device repair",
"联系人": "Contact",
"手机号": "Phone",
@@ -623,5 +623,7 @@
"注意!关闭后将无法接受任何消息": "Note! After closing, you will not receive any messages",
"手机号登录": "Phone Login",
"邮箱登录": "Email Login",
"输入邮箱": "Enter Email"
"输入邮箱": "Enter Email",
"隐私协议加载失败": "Privacy Agreement Failed to Load",
"请检查网络连接后重试": "Please check the network connection and try again"
}

View File

@@ -313,8 +313,8 @@
"开始校准": "开始校准",
"校准完成": "校准完成!",
"微信安装提示": "请先安装微信APP再使用微信登录",
"安卓启用网络提示": "",
"ios启用网络提示": "",
"安卓启用网络提示": "网络未开启,请打开网络连接",
"ios启用网络提示": "网络未开启,请打开网络连接",
"设备报修": "设备报修",
"联系人": "联系人",
"手机号": "手机号",
@@ -624,7 +624,9 @@
"注意!关闭后将无法接受任何消息":"注意!关闭后将无法接受任何消息",
"手机号登录":"手机号登录",
"邮箱登录":"邮箱登录",
"输入邮箱":"输入邮箱"
"输入邮箱":"输入邮箱",
"隐私协议加载失败": "隐私协议加载失败",
"请检查网络连接后重试": "请检查网络连接后重试"
}

View File

@@ -314,8 +314,8 @@
"开始校准": "開始校準",
"校准完成": "校準完成!",
"微信安装提示": "請先安裝微信APP再使用微信登錄",
"安卓启用网络提示": "",
"ios启用网络提示": "",
"安卓启用网络提示": "請開啟網絡再使用APP",
"ios启用网络提示": "請開啟網絡再使用APP",
"设备报修": "設備報修",
"联系人": "聯繫人",
"手机号": "手機號",
@@ -621,5 +621,7 @@
"注意!关闭后将无法接受任何消息": "注意!關閉將無法接受任何消息",
"手机号登录": "手機登入",
"邮箱登录": "電子郵件登入",
"输入邮箱": "輸入電子郵件"
"输入邮箱": "輸入電子郵件",
"隐私协议加载失败": "隱私協議加載失敗",
"请检查网络连接后重试": "請檢查網絡連接後重試"
}

View File

@@ -638,5 +638,9 @@
"选择城市": "Select City",
"请选择城市": "city",
"输入关键词": "Enter keywords",
"输入国家、省份或城市": "Enter country, province, or city"
"输入国家、省份或城市": "Enter country, province, or city",
"安卓启用网络提示": "The network is not enabled. Please enable the network connection",
"ios启用网络提示": "The network is not enabled. Please enable the network connection",
"隐私协议加载失败": "Privacy Agreement Failed to Load",
"请检查网络连接后重试": "Please check the network connection and try again"
}

View File

@@ -645,5 +645,10 @@
"选择城市": "选择城市",
"请选择城市": "请选择城市",
"输入关键词": "输入关键词",
"输入国家、省份或城市": "输入国家、省份或城市"
"输入国家、省份或城市": "输入国家、省份或城市",
"安卓启用网络提示": "网络未开启,请打开网络连接",
"ios启用网络提示": "网络未开启,请打开网络连接",
"隐私协议加载失败": "隐私协议加载失败",
"请检查网络连接后重试": "请检查网络连接后重试"
}

View File

@@ -638,5 +638,9 @@
"选择城市": "選擇城市",
"请选择城市": "請選擇城市",
"输入关键词": "輸入關鍵詞",
"输入国家、省份或城市": "輸入國家、省份或城市"
"输入国家、省份或城市": "輸入國家、省份或城市",
"安卓启用网络提示": "請開啟網絡再使用APP",
"ios启用网络提示": "請開啟網絡再使用APP",
"隐私协议加载失败": "隱私協議加載失敗",
"请检查网络连接后重试": "請檢查網絡連接後重試"
}

Binary file not shown.

View File

@@ -5,8 +5,10 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:ef/ef.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class Checknetwork {
@@ -87,10 +89,33 @@ class Checknetwork {
// isShowDialog = true;
// showCustomConfirmDialog(context!, name).then((d) {
// isShowDialog = false;
// });
showTipDialog(context!,Text(name,style: TextStyle(
color: themeController.currentColor.sc3,
),));
// });
if (AppConstants().ent_type == APPPackageType.MHT.code) {
showTipDialog(
context!,
Text(
name,
style: TextStyle(
color: stringToColor("333333"),
),
),
backgroundColor: stringToColor("#FFFFFF"),
colors: [
stringToColor("1592AA"),
stringToColor("0C83A7"),
stringToColor("006FA3"),
]);
} else if (AppConstants().ent_type == APPPackageType.TH.code) {
showTipDialog(
context!,
Text(
name,
style: TextStyle(
color: themeController.currentColor.sc3,
),
),
);
}
}
});
}

View File

@@ -0,0 +1,37 @@
// lib/utils/config_reader.dart
import 'dart:io';
import 'package:path/path.dart' as path;
class ConfigReader {
static int getAppType() {
try {
// 获取当前Dart文件所在目录
final scriptDir = File(Platform.script.toFilePath()).parent.path;
// 从lib目录向上回退到项目根目录再进入android目录
final projectRoot = path.dirname(path.dirname(scriptDir));
final localPropertiesPath = path.join(projectRoot, 'android', 'local.properties');
final file = File(localPropertiesPath);
if (file.existsSync()) {
final content = file.readAsStringSync();
final lines = content.split('\n');
for (final line in lines) {
final trimmedLine = line.trim();
if (trimmedLine.startsWith('app.type=')) {
final value = trimmedLine.split('=')[1].trim();
return int.tryParse(value) ?? 3;
}
}
} else {
print('配置文件不存在: $localPropertiesPath');
}
} catch (e) {
print('读取配置文件失败: $e');
}
return 3; // 默认值
}
}

View File

@@ -25,6 +25,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/JPushUtil.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/config/ConfigReader.dart';
import 'package:vbvs_app/controller/date/CalendarController.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
@@ -982,6 +983,7 @@ class MyApp extends StatelessWidget {
});
}
// final selectapp = ConfigReader.getAppType();
int selectapp = AppConstants().ent_type;
@override
Widget build(BuildContext context) {

View File

@@ -1776,7 +1776,9 @@ Future showCustomConfirmOfWebViewDialog(
{String btnName = "确定",
bool showCancel = false,
String cancelName = "取消",
ConfirmDialogIcon icon = ConfirmDialogIcon.warn}) async {
ConfirmDialogIcon icon = ConfirmDialogIcon.warn,
int type = 1
}) async {
return showDialog(
context: context,
barrierDismissible: true,
@@ -1863,7 +1865,7 @@ Future showCustomConfirmOfWebViewDialog(
onTap: () {
Get.back(result: "confirm");
},
colors: AppConstants().mhtNormalButton, // 渐变背景
colors: type == 3?AppConstants().mhtNormalButton:AppConstants().thNormalButton, // 渐变背景
gradientDirection: GradientDirection.horizontal,
child: Container(
// width: MediaQuery.sizeOf(context).width * 0.5, // 宽度占屏幕一半

View File

@@ -137,7 +137,10 @@ class _HomePageState extends State<MainPageBBottomChange>
cancelName = "退出".tr;
}
showCustomConfirmOfWebViewDialog(context, "隐私协议".tr, getPrivacy(1),
btnName: btnName, showCancel: true, cancelName: cancelName)
btnName: btnName,
showCancel: true,
cancelName: cancelName,
type: 3)
.then((e) {
if (e == "confirm") {
getStorage.write("isShowYingShiDialog", "true");

View File

@@ -578,6 +578,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "control_${tmp['mac']}";
if (tmp['type'] != null) {
type = "${type}_${tmp['type']}";
}
String queryUrl = "$serviceAddress$serviceName$serviceApi";
var data = {
"type": type,
@@ -624,6 +627,9 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "control_${tmp}";
if(tmp['type'] != null){
type = "control_${tmp['mac']}_${tmp['type']}";
}
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=$type";
await requestWithLog(

View File

@@ -4,21 +4,17 @@ 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/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/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.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/date/CalendarController.dart';
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
import 'package:vbvs_app/controller/user_info_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/mh_page/homepage/controller/mht_home_controller.dart';
import 'package:vbvs_app/pages/sleep_report/component/SleepScoreWidget.dart';
import 'package:vbvs_app/pages/sleep_report/component/Vital_signs.dart';

View File

@@ -253,7 +253,7 @@ class _SettingPageState extends State<SettingPage> {
),
].divide(SizedBox(width: 22.rpx)),
),
Text('SWES2025.12.24',
Text('SWES2025.12.30',
style: TextStyle(
color: Colors.white,
fontSize: 26.rpx,

View File

@@ -45,7 +45,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
isheadless: false,
jsbridge: buildsdk(
father: this,
clientId: '494641114',
// clientId: '494641114',
// clientId: '123',
// dbgserverUrl: 'ws://192.168.1.2:9001',
),

View File

@@ -1,6 +1,9 @@
import 'dart:async';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.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/device/blueteeth_bind_controller.dart';
@@ -8,6 +11,7 @@ import 'package:vbvs_app/controller/device/device_type_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/enum/APPPackageType.dart';
class PrivacyPolicyNewPage extends StatefulWidget {
var sleepUri;
@@ -27,16 +31,55 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
DeviceTypeController deviceTypeController = Get.find();
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
ValueNotifier<bool> loadFailed = ValueNotifier<bool>(false);
Timer? _timeoutTimer;
InAppWebViewController? _webViewController;
@override
void initState() {
super.initState();
// 启动5秒超时计时器
_startTimeoutTimer();
}
void _startTimeoutTimer() {
// 先清除之前的计时器
_timeoutTimer?.cancel();
// 设置5秒超时
_timeoutTimer = Timer(Duration(seconds: 5), () {
if (isPageLoading.value) {
// 5秒后仍在加载显示加载失败
isPageLoading.value = false;
loadFailed.value = true;
}
});
}
void _retryLoad() {
// 重置状态
loadFailed.value = false;
isPageLoading.value = true;
// 重新启动超时计时器
_startTimeoutTimer();
// 重新加载页面
if (_webViewController != null) {
_webViewController!.reload();
} else {
// 如果控制器还未初始化需要重新构建webview
setState(() {});
}
}
@override
void dispose() {
// 清理 ValueNotifier
// 清理所有资源
_timeoutTimer?.cancel();
isPageLoading.dispose();
loadFailed.dispose();
_webViewController = null;
super.dispose();
}
@@ -44,17 +87,10 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, bodySize) => GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),,
child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
// fit: BoxFit.fill, // 填满整个 Container
// ),
// ),
color: Colors.white,
child: Scaffold(
backgroundColor: Colors.transparent, // 背景透明
backgroundColor: Colors.transparent,
appBar: (widget.showAppbar != null && widget.showAppbar == false)
? null
: AppBar(
@@ -91,40 +127,20 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
),
body: SafeArea(
top: true,
child: Stack(
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 30.rpx, 0),
child: InAppWebView(
key: UniqueKey(),
initialUrlRequest:
URLRequest(url: WebUri(widget.sleepUri)),
onLoadStart: (controller, url) {
// 页面开始加载时显示加载指示器
isPageLoading.value = true;
},
onLoadStop: (controller, url) {
// 页面加载完成后隐藏加载指示器
isPageLoading.value = false;
},
),
),
ValueListenableBuilder<bool>(
valueListenable: isPageLoading,
builder: (context, isLoading, child) {
return isLoading
? Center(
child:CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
), // 加载指示器
)
: SizedBox.shrink();
},
),
],
child: ValueListenableBuilder<bool>(
valueListenable: loadFailed,
builder: (context, failed, child) {
if (failed) {
// 显示加载失败页面
if (AppConstants().ent_type == APPPackageType.MHT.code) {
return _buildErrorView();
}
return _buildTHErrorView();
} else {
// 显示WebView或加载指示器
return _buildWebView();
}
},
),
),
),
@@ -132,4 +148,185 @@ class _PrivacyPolicyNewPageState extends State<PrivacyPolicyNewPage> {
),
);
}
Widget _buildWebView() {
return Stack(
children: [
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 30.rpx, 0),
child: InAppWebView(
key: UniqueKey(),
initialUrlRequest: URLRequest(url: WebUri(widget.sleepUri)),
onWebViewCreated: (controller) {
_webViewController = controller;
},
onLoadStart: (controller, url) {
// 页面开始加载时显示加载指示器
isPageLoading.value = true;
loadFailed.value = false;
},
onLoadStop: (controller, url) {
// 页面加载完成后隐藏加载指示器
isPageLoading.value = false;
loadFailed.value = false;
_timeoutTimer?.cancel(); // 加载成功时取消计时器
},
onLoadError: (controller, url, code, message) {
// 加载出错时显示失败页面
isPageLoading.value = false;
loadFailed.value = true;
_timeoutTimer?.cancel(); // 出错时取消计时器
},
),
),
ValueListenableBuilder<bool>(
valueListenable: isPageLoading,
builder: (context, isLoading, child) {
return isLoading
? Center(
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
)
: SizedBox.shrink();
},
),
],
);
}
//眠花糖
Widget _buildErrorView() {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.wifi_off,
size: 60.rpx,
color: stringToColor("84F5FF"),
),
SizedBox(height: 20.rpx),
Text(
'隐私协议加载失败'.tr,
style: TextStyle(
fontSize: 28.rpx,
color: Colors.black,
),
),
Text(
'请检查网络连接后重试'.tr,
style: TextStyle(
fontSize: 24.rpx,
color: Colors.black,
),
),
SizedBox(height: 30.rpx),
ElevatedButton(
onPressed: _retryLoad,
style: ElevatedButton.styleFrom(
backgroundColor: stringToColor("84F5FF"),
foregroundColor: Colors.white,
padding: EdgeInsets.symmetric(
horizontal: 40.rpx,
vertical: 15.rpx,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25.rpx),
),
),
child: Text(
'重试'.tr,
style: TextStyle(
fontSize: 26.rpx,
color: Colors.black,
),
),
),
],
),
);
}
//太和
Widget _buildTHErrorView() {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.wifi_off,
size: 60.rpx,
// color: stringToColor("84F5FF"),
color: themeController.currentColor.sc2,
),
SizedBox(height: 20.rpx),
Text(
'隐私协议加载失败'.tr,
style: TextStyle(
fontSize: AppConstants().title_text_fontSize,
color: Colors.black,
),
),
Text(
'请检查网络连接后重试'.tr,
style: TextStyle(
fontSize: 24.rpx,
color: Colors.black,
),
),
SizedBox(height: 30.rpx),
ElevatedButton(
onPressed: _retryLoad,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Colors.transparent),
foregroundColor: MaterialStateProperty.all(Colors.white),
padding: MaterialStateProperty.all(
EdgeInsets.symmetric(
horizontal: 40.rpx,
vertical: 15.rpx,
),
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25.rpx),
),
),
overlayColor:
MaterialStateProperty.all(Colors.white.withOpacity(0.2)),
elevation: MaterialStateProperty.all(0),
),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
// 这里设置您的渐变色
themeController.currentColor.sc2,
themeController.currentColor.sc1, // 假设这是另一种颜色
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(25.rpx),
),
padding: EdgeInsets.symmetric(
horizontal: 40.rpx,
vertical: 15.rpx,
),
child: Text(
'重试'.tr,
style: TextStyle(
fontSize: 26.rpx,
color: Colors.white, // 建议白色文字,渐变背景下更清晰
),
),
),
),
],
),
);
}
}

View File

@@ -9,7 +9,7 @@ import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart';
//睡眠规律性
//生命体征
class VitalSignsWidget extends StatefulWidget {
var sleepReport;
final VoidCallback? onRefresh; // 添加回调函数

View File

@@ -59,7 +59,8 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
if (Get.isRegistered<SleepReportController>()) {
sleepReportController.isLoading.value = false;
sleepReportController.model.type = 1;
sleepReportController.sleepReport.value = {};
// sleepReportController.sleepReport.value = {};
//返回详情无数据ios
}
});
}