Merge remote-tracking branch 'origin/master'

This commit is contained in:
czz
2025-07-22 14:03:07 +08:00
18 changed files with 2333 additions and 106 deletions

View File

@@ -4,7 +4,7 @@ flutter.sdk=C:\\dev\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1
flutter.minSdkVersion=21
flutter.minSdkVersion=22
flutter.targetSdkVersion=35
flutter.compileSdkVersion=35
flutter.ndkVersion=28.0.12433566

View File

@@ -1,3 +1,3 @@
[
"assets/miniapp/mhtControl_1.0.0.zip"
"assets/miniapp/mhtControl_1.0.30.zip"
]

View File

@@ -213,5 +213,6 @@
"每日得分": "每日得分",
"每日得分介绍": "每日得分介绍",
"与上月对比": "与上月对比",
"设备状态":"设备状态"
"设备状态":"设备状态",
"校准未完成提示":"校准还未完成,是否确认退出校准流程?"
}

View File

@@ -2,9 +2,11 @@ class CommonVariables {
static bool isNetWorkOn = false;
static String supabaseUrl = "https://zhmht.swes.com.cn:3443";
// 企业微信客服拉起的url地址
static String wxKfUrl = "https://work.weixin.qq.com/kfid/kfcab6a07e8aac68945";
// static String wxKfUrl = "https://work.weixin.qq.com/kfid/kfcab6a07e8aac68945";
static String wxKfUrl = "https://work.weixin.qq.com/kfid/kfc7d2337b9c07b1269";
// 企业微信ID
static String wxCorpId = "wwc17348c75dbde1dc";
// static String wxCorpId = "wwc17348c75dbde1dc";
static String wxCorpId = "ww51feda6026280cd0";
//ICP备案号
static String ICPRightCode = "皖ICP备2024068219号-1A";
//公司名称

View File

@@ -140,10 +140,13 @@ Future<void> initWX() async {
Fluwx fluwx = Fluwx();
fluwx.registerApi(
//请填写自己的微信appid
appId: "wxeb2688220799e2c5",
// appId: "wxeb2688220799e2c5",//太和
appId: "wx929c548fea6af9c7",//眠花糖
doOnAndroid: true,
doOnIOS: true,
universalLink: "https://app.he-info.com/theh/");
// universalLink: "https://app.he-info.com/theh/",
universalLink: "https://zhmht.swes.com.cn/app/",
);
}
Timer? _messageTimer;

View File

@@ -226,6 +226,9 @@ class _HomePageState extends State<MainPageBBottomChange>
//如果当前没有连接该设备,则返回
return;
}
if (webviewTestController.selectDevice['blueToothStatus']!=2) {
return;
}
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
to: data['from'],
// to: ef.kvRoot.websocketId,

View File

@@ -236,11 +236,11 @@ class _BluetoothPageState extends State<BluetoothPage> {
});
}
}),
_buildMenuButton(context, '设备校准', ""),
_buildMenuButton(context, '设备校准', "/mhtCalibrationAfterPage", arguments: obsData,),
_buildMenuButton(
context, '体征传感器', "/vitalSignsSensorPage",
arguments: obsData),
_buildMenuButton(context, 'WIFI配置', ""),
_buildMenuButton(context, 'WIFI配置', "/mhtWifiAfterPage",arguments: obsData,),
// _buildMenuButton(
// context, '睡眠习惯', "/sleepHabitPage"),
_buildMenuButton(

File diff suppressed because it is too large Load Diff

View File

@@ -68,7 +68,6 @@ class _MHTWifiPageState extends State<MHTWifiPage> {
blueteethBindController.updateAll();
}
@override
@override
void dispose() {
_isDisposed = true;

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,9 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:fluwx/fluwx.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/CommonVariables.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';
@@ -13,6 +15,8 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'dart:ui' as ui;
import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart';
class NewMinePage extends StatefulWidget {
const NewMinePage({super.key});
@@ -302,7 +306,14 @@ class _MinePageState extends State<NewMinePage> {
'assets/img/icon/customer_service.svg',
'在线客服',
'购买和使用智能床过程中,如果遇到疑问可与客服进行联系',
path: ""),
path: "",
onTap: () async {
MHTLoginController mhtLoginController =
Get.find<MHTLoginController>();
await mhtLoginController
.openWeChatCustomerService(context);
},
),
],
),
),
@@ -334,20 +345,24 @@ class _MinePageState extends State<NewMinePage> {
String svgPath,
String title,
String subtitle, {
// VoidCallback? onTap,
String? path,
bool showTopLine = false,
VoidCallback? onTap, // ✅ 新增可选 onTap 参数
}) {
return ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.white,
padding: EdgeInsets.all(0.rpx),
onTap: () {
if (onTap != null) {
onTap(); // ✅ 使用外部传入的 onTap
} else {
if (path == null || path.isEmpty) {
TopSlideNotification.show(context, text: "待开发功能".tr);
} else {
Get.toNamed(path);
}
}
},
child: Container(
decoration: BoxDecoration(
@@ -363,18 +378,16 @@ class _MinePageState extends State<NewMinePage> {
padding: EdgeInsets.fromLTRB(40.rpx, 0.rpx, 40.rpx, 0.rpx),
child: Row(
children: [
Container(
child: SvgPicture.asset(
SvgPicture.asset(
svgPath,
width: 42.rpx,
height: 42.rpx,
),
),
SizedBox(width: 30.rpx),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, // 垂直方向居中对齐
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
title,
@@ -383,7 +396,6 @@ class _MinePageState extends State<NewMinePage> {
fontSize: 30.rpx,
),
),
// SizedBox(height: 6.rpx), // 加点间距
Text(
subtitle,
style: TextStyle(
@@ -392,7 +404,7 @@ class _MinePageState extends State<NewMinePage> {
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
softWrap: true, // 允许换行
softWrap: true,
),
],
),
@@ -408,11 +420,14 @@ class _MinePageState extends State<NewMinePage> {
child: SvgPicture.asset(
'assets/img/icon/expand.svg',
color: Colors.white,
))),
),
),
),
],
),
),
));
),
);
}
Widget _buildSettingButton() {

View File

@@ -86,6 +86,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
bridge.sdk.updateBlueToothStatus((args) async {
ef.log('updateBlueToothStatus: $args');
bluetooth = args[0];
selectDevice['blueToothStatus'] = bluetooth;
return true;
});
//sdk定义接口
@@ -145,7 +146,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
ef.log('更新睡眠习惯: $args[0]');
try {
MHTBlueToothController blueToothController = Get.find();
blueToothController.saveHabitData(args[0]);
await blueToothController.saveHabitData(args[0]);
} catch (e) {
ef.log("[更新睡眠习惯失败]:$e");
}
@@ -172,6 +173,16 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
}
return true;
});
// bridge.sdk.bluetoothConnect((args) async {
// ef.log('[蓝牙连接失败]: $args[0]');
// try {
// selectDevice['blueToothStatus'] = 2;
// return true;
// } catch (e) {
// ef.log("[蓝牙连接失败]:$e");
// }
// return true;
// });
});
} catch (e, s) {
ef.log('$e,$s');

View File

@@ -6,11 +6,14 @@ import 'package:fluwx/fluwx.dart';
import 'package:get_storage/get_storage.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
@@ -247,12 +250,54 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
// await repository.logout();
}
loginByWechatCode(String code) async {
// return await repository.loginByWechatCode(code);
Future<int> loginByWechatCode(String code) async {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.login;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
String? language = "";
var data = {
"type": 2,
"password": code,
"khCode": "mht",
};
ApiResponse apiResponse = await requestWithLog(
logTitle: "微信登录",
method: MyHttpMethod.post,
queryUrl: queryUrl,
data: data);
if (apiResponse.code == HttpStatusCodes.ok) {
UserInfoController userInfoController = Get.find();
userInfoController.model.login = 1;
userInfoController.model.user = UserModel.fromJson(apiResponse.data);
String token = apiResponse.rawResponse.headers['token']!.first;
EasyDartModule.dio.token = token;
final box = GetStorage();
box.write('token', token); // 存储 token
box.write('user', userInfoController.model.user!.toJson()); // 存储用户信息
}
return apiResponse.code!;
}
//注销账号
deletedAccount() async {
// return await repository.deletedAccount();
}
Future<void> openWeChatCustomerService(BuildContext context) async {
bool isWeChatInstalled = await fluwx.isWeChatInstalled;
if (!isWeChatInstalled) {
TopSlideNotification.show(context,
text: "请先安装微信APP再联系客服".tr,
textColor: themeController.currentColor.sc9);
return;
}
TopSlideNotification.show(
context,
text: "正在打开微信客服...".tr,
);
await fluwx.open(
target: CustomerServiceChat(
corpId: CommonVariables.wxCorpId, url: CommonVariables.wxKfUrl));
}
}

View File

@@ -91,8 +91,8 @@ class MHTLoginPage extends GetView<MHTLoginController> {
textColor: themeController.currentColor.sc9);
return;
}
String msg = await controller.loginByWechatCode(code);
if (msg.isEmpty) {
int rescode = await controller.loginByWechatCode(code);
if (rescode == 1) {
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
controller.fluwxCancelable?.cancel();
// 登录成功移出网络检查监听
@@ -1786,24 +1786,28 @@ class MHTLoginPage extends GetView<MHTLoginController> {
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);
MHTRegisterController
registerController = Get.find();
if (registerController
.model.register_agree ==
null ||
registerController
.model.register_agree !=
true) {
TopSlideNotification.show(
context,
text: "登录页.未同意协议".tr,
textColor:
themeController.currentColor.sc9,
);
return;
}
MHTLoginController loginController =
Get.find();
await loginController
.wxLoginSendAuth();
// TopSlideNotification.show(context,
// text: "测试阶段,暂不支持".tr);
},
child: Container(
width: 90.rpx,

View File

@@ -43,7 +43,17 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
List showLabel = widget.sleepReport['score']['type'];
List stages = widget.sleepReport['score']['stages'];
List<SegmentData> segments = parseSegments(widget.sleepReport);
int level = widget.sleepReport['score']['level'];
// 查找与 level 匹配的 map
String? matchedColor;
final matchedLabel = showLabel.firstWhere(
(item) => item['level'] == level,
orElse: () => null,
);
if (matchedLabel != null) {
matchedColor = matchedLabel['color'];
}
return Container(
width: double.infinity,
// decoration: BoxDecoration(color: Colors.green),
@@ -81,7 +91,11 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
Text(
'${widget.sleepReport['score']?['avg']}',
style: TextStyle(
color: Colors.white,
// color: Colors.white,
color: stringToColor(
matchedColor?.trim().isEmpty ?? true
? "#FFFFFF"
: matchedColor!),
fontSize: 48.rpx,
letterSpacing: 0.0,
),
@@ -103,7 +117,12 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
Text(
'${getSleepLevel(widget.sleepReport)}',
style: TextStyle(
color: stringToColor("#FF9F66"),
// color: stringToColor("#FF9F66"),
color: stringToColor(
matchedColor?.trim().isEmpty ?? true
? "#FFFFFF"
: matchedColor!),
fontSize: 48.rpx,
letterSpacing: 0.0,
),
@@ -139,7 +158,11 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
Text(
'${widget.sleepReport['score']?['score']}',
style: TextStyle(
color: stringToColor("#FF9F66"),
// color: stringToColor("#FF9F66"),
color: stringToColor(
matchedColor?.trim().isEmpty ?? true
? "#FFFFFF"
: matchedColor!),
fontSize: 100.rpx),
),
],

View File

@@ -21,8 +21,10 @@ import 'package:vbvs_app/pages/mh_page/device/mht_bind_device_success.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_bind_device_type.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_blueteeth_device_page.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_device_calibration.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_device_calibration_after.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_people_info.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_wifi_page.dart';
import 'package:vbvs_app/pages/mh_page/device/mht_wifi_page_after.dart';
import 'package:vbvs_app/pages/mh_page/device_list.dart';
import 'package:vbvs_app/pages/mh_page/device_people_info.dart';
import 'package:vbvs_app/pages/mh_page/device_share_page.dart';
@@ -100,6 +102,8 @@ var mhroutes = {
MHTBlueteethDevicePage(deviceType: arguments),
"/mHTwifiPage": (contxt, {arguments}) => MHTWifiPage(deviceInfo: arguments),
"/calibrationPage": (contxt) => MHTCalibrationPage(),
"/mhtCalibrationAfterPage": (contxt, {arguments}) =>
MHTCalibrationAfterPage(deviceInfo: arguments),
"/bindDeviceSuccess": (contxt) => MHTBindDeviceSuccess(),
"/newSleepReportPage": (contxt, {arguments}) =>
NewSleepReportPage(data: arguments),
@@ -119,6 +123,8 @@ var mhroutes = {
"/vitalSignsSensorPage": (context, {arguments}) => VitalSignsSensorPage(
data: arguments,
),
"/mhtWifiAfterPage": (contxt, {arguments}) =>
MHTWifiAfterPage(deviceInfo: arguments),
};
var mhonGenerateRoute = (RouteSettings settings) {
final String? name = settings.name; // 获取路由名称,如 /news 或 /search

View File

@@ -7,6 +7,16 @@ version: 1.0.0+1
environment:
sdk: ^3.5.4
fluwx:
app_id: 'wx929c548fea6af9c7' #填写自己的 WeChat app id.
debug_logging: false # Logging in debug mode.
android:
# interrupt_wx_request: true # Defaults to true.
# flutter_activity: 'MainActivity' # Defaults to app's launcher
ios:
universal_link: https://zhmht.swes.com.cn
no_pay: true # Set to true to disable payment.
dependencies:
qr_flutter: ^4.1.0
flutter: