更新界面布局

This commit is contained in:
wyf
2025-06-04 11:54:01 +08:00
parent 40732066fe
commit 857317caf1
34 changed files with 4961 additions and 459 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 KiB

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -420,6 +420,7 @@
"今日数据":"yesterday", "今日数据":"yesterday",
"昨日数据":"today", "昨日数据":"today",
"次":"times", "次":"times",
"秒":"sec" "秒":"sec",
"暂无":"none"
} }

View File

@@ -116,7 +116,7 @@
}, },
"绑定成功":{ "绑定成功":{
"标题":"绑定完成", "标题":"绑定完成",
"绑定成功":"绑定成功! ", "绑定成功":"配置成功! ",
"分享标题":"是否进行分享?", "分享标题":"是否进行分享?",
"分享内容":"设备绑定成功后,如需对朋友或家人共享我的睡眠情况,可以进行立即分享,分享成功后,对方即可享受查看该设备权限,可以收到该设备的睡眠报告。", "分享内容":"设备绑定成功后,如需对朋友或家人共享我的睡眠情况,可以进行立即分享,分享成功后,对方即可享受查看该设备权限,可以收到该设备的睡眠报告。",
"立即分享":"立即分享", "立即分享":"立即分享",
@@ -428,7 +428,16 @@
"未配置网络提示":"当前设备未进行网络配置,是否确认跳过网络配置", "未配置网络提示":"当前设备未进行网络配置,是否确认跳过网络配置",
"退出":"退出", "退出":"退出",
"完成":"完成", "完成":"完成",
"时长":"时长:" "时长":"时长:",
"继续":"继续",
"下次再说":"下次再说",
"发现":"发现!",
"检测到":"检测到",
"绑定流程未走完是否继续":"绑定流程未走完是否继续",
"暂无":"暂无",
"设备连接超时,请重试":"设备连接超时,请点击刷新重试",
"设备连接失败":"设备连接失败,请点击刷新重试"
} }

View File

@@ -393,7 +393,7 @@ var returnIconButtomNew = ClickableContainer(
// ), // ),
// ); // );
var returnIconButtomAddCallback = (returnCallBack) {
var returnIconButtomAddCallback = ( var returnIconButtomAddCallback = (
VoidCallback? returnCallBack, { VoidCallback? returnCallBack, {
bool enableBack = true, bool enableBack = true,

View File

@@ -16,6 +16,7 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
part 'login_controller.g.dart'; part 'login_controller.g.dart';
@@ -199,10 +200,14 @@ class LoginController extends GetControllerEx<LoginModel> {
scope: 'snsapi_userinfo', scope: 'snsapi_userinfo',
state: 'wechat_sdk_theh_wxlogin', state: 'wechat_sdk_theh_wxlogin',
)) ))
.then((data) { .then((data) async {
//返回true表示成功或者false表示失败这边没有意义从login_controller页面构造函数监听中去处理 //返回true表示成功或者false表示失败这边没有意义从login_controller页面构造函数监听中去处理
debugPrint('msg:$data'); debugPrint('msg:$data');
EasyDartModule.logger.error('msg:$data'); EasyDartModule.logger.error('msg:$data');
if (data) {
//登陆成功
// await dealBindProcess();
}
}); });
} catch (e) { } catch (e) {
debugPrint('msg:$e'); debugPrint('msg:$e');

View File

@@ -47,6 +47,8 @@ class PersonController extends GetControllerEx<PersonModel> {
RxString height = "".obs; RxString height = "".obs;
DateTime? dateTime = DateTime.now(); //选择时间 DateTime? dateTime = DateTime.now(); //选择时间
RxList diseaseList = [].obs; RxList diseaseList = [].obs;
RxString update_person_mac = "".obs;
var after_deveice;
Future<ApiResponse> savePersonData() async { Future<ApiResponse> savePersonData() async {
try { try {

View File

@@ -17,7 +17,6 @@ import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
part 'user_info_controller.g.dart'; part 'user_info_controller.g.dart';
@JsonSerializable() @JsonSerializable()
@@ -59,6 +58,9 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
attr = GetModel(UserInfoModel()).obs; attr = GetModel(UserInfoModel()).obs;
} }
List device_bind_status = [];
int device_bind_flag = 0;//0。未初始化 1.已初始化
Future<ApiResponse> uploadImg() async { Future<ApiResponse> uploadImg() async {
EasyDartModule.logger.info("请求上传图片"); EasyDartModule.logger.info("请求上传图片");
DailyLogUtils.writeLog("请求上传图片"); DailyLogUtils.writeLog("请求上传图片");
@@ -239,6 +241,4 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
countdownController.countdown.value = 0; countdownController.countdown.value = 0;
return apiResponse; return apiResponse;
} }
} }

View File

@@ -16,6 +16,8 @@ import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/CheckNetwork.dart'; import 'package:vbvs_app/common/util/CheckNetwork.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart'; import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/date/CalendarController.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/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart'; import 'package:vbvs_app/controller/device/body_device_controller.dart';
@@ -56,10 +58,9 @@ import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/controller/weather/weather_controller.dart';
import 'package:vbvs_app/language/AppLanguage.dart'; import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/model/CustomThemeColor.dart'; import 'package:vbvs_app/model/CustomThemeColor.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
import 'package:vbvs_app/pages/device_control/BackMovement.dart';
import 'package:vbvs_app/pages/device_control/MattressControl.dart'; import 'package:vbvs_app/pages/device_control/MattressControl.dart';
import 'package:vbvs_app/pages/device_control/people_info.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart'; import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'package:vbvs_app/routers/mh_routers.dart'; import 'package:vbvs_app/routers/mh_routers.dart';
@@ -208,12 +209,66 @@ Future<void> initLogin() async {
// 根据token去请求 // 根据token去请求
// await userInfoController.autoLogin(token); // await userInfoController.autoLogin(token);
EasyDartModule.dio.token = token; EasyDartModule.dio.token = token;
// await dealBindProcess();
} else { } else {
// 如果没有 token则将用户标记为未登录 // 如果没有 token则将用户标记为未登录
userInfoController.model.login = 0; userInfoController.model.login = 0;
} }
} }
//处理绑定未完成的数据
Future<void> dealBindProcess() async {
UserInfoController userInfoController = Get.find();
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?bindType=1";
userInfoController.device_bind_status = [];
try {
final res = await requestWithLog(
logTitle: "查询设备绑定列表",
method: MyHttpMethod.get,
queryUrl: queryUrl,
);
List data = res.data ?? [];
if (data.isNotEmpty) {
// 使用 Future.wait 等待所有设备的查询完成
await Future.wait(
data.map((element) async {
String mac = element['mac'];
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${ServiceConstant.user_setting}?type=${type}";
try {
final res = await requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
);
if (res.data != null && res.data.isNotEmpty) {
bool celibration = res.data['celibration'];
bool person_info = res.data['person_info'];
bool wifi = res.data['wifi'];
if (!celibration || !person_info || !wifi) {
res.data['device_info'] = element;
userInfoController.device_bind_status.add(res.data);
}
}
} catch (e) {
print("查询绑定流程失败: $e");
}
}),
);
}
} catch (e) {
print("查询设备绑定列表失败: $e");
}
}
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
MyApp({super.key}); MyApp({super.key});
final ThemeController themeController = Get.put(ThemeController()); final ThemeController themeController = Get.put(ThemeController());
@@ -257,7 +312,6 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => DeviceShareListController()), Get.lazyPut(() => DeviceShareListController()),
Get.lazyPut(() => DeviceCalibrationController()), Get.lazyPut(() => DeviceCalibrationController()),
Get.lazyPut(() => RepairController()), Get.lazyPut(() => RepairController()),
Get.lazyPut(() => PdfController()),
])); ]));
} }
@@ -286,7 +340,7 @@ class MyApp extends StatelessWidget {
initialBinding: BindingsBuilder(() => [ initialBinding: BindingsBuilder(() => [
// Get.lazyPut(() => UserInfoController()), // Get.lazyPut(() => UserInfoController()),
Get.put(GlobalController()), Get.put(GlobalController()),
Get.put(WeatherModelController()), Get.put(WeatherModelController()),
Get.lazyPut(() => MainPageController()), Get.lazyPut(() => MainPageController()),
Get.lazyPut(() => BlueteethBindController()), Get.lazyPut(() => BlueteethBindController()),
Get.lazyPut(() => PersonController()), Get.lazyPut(() => PersonController()),
@@ -299,17 +353,17 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => DeviceShareListController()), Get.lazyPut(() => DeviceShareListController()),
Get.lazyPut(() => DeviceCalibrationController()), Get.lazyPut(() => DeviceCalibrationController()),
Get.lazyPut(() => RepairController()), Get.lazyPut(() => RepairController()),
Get.lazyPut(() => UserPdfController()), Get.lazyPut(() => UserPdfController()),
Get.lazyPut(() => PrivacyPdfController()), Get.lazyPut(() => PrivacyPdfController()),
Get.lazyPut(() => CalendarController()), Get.lazyPut(() => CalendarController()),
Get.lazyPut(() => SleepReportController()), Get.lazyPut(() => SleepReportController()),
Get.lazyPut(() => MessageReviewController()), Get.lazyPut(() => MessageReviewController()),
Get.lazyPut(() => MessageSettingController()), Get.lazyPut(() => MessageSettingController()),
Get.lazyPut(() => CommonMessageSettingController()), Get.lazyPut(() => CommonMessageSettingController()),
])); ]));
} }
final selectapp = "mht"; final selectapp = "th";
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@@ -1043,6 +1043,8 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
widget.device['_id']; widget.device['_id'];
personController.name.value = personController.name.value =
widget.device['person']['name']; widget.device['person']['name'];
personController.update_person_mac.value =
widget.device['mac'];
personController.gender.value = personController.gender.value =
widget.device['person']['gender'] ?? 1; widget.device['person']['gender'] ?? 1;
personController.weight?.value = personController.weight?.value =
@@ -1065,8 +1067,16 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
MyUtils.formatBirthdayTime( MyUtils.formatBirthdayTime(
widget.device['person']['birthday']); widget.device['person']['birthday']);
} else { } else {
personController.update_person_mac.value =
widget.device['mac'];
personController.currentPersonId.value = personController.currentPersonId.value =
widget.device['_id']; widget.device['_id'];
personController.name.value = "";
personController.gender.value = 1;
personController.dateTime = null;
personController.height.value = "";
personController.weight.value = "";
personController.diseaseList.value = [];
} }
await Get.toNamed("/updatePersonPage", await Get.toNamed("/updatePersonPage",
arguments: widget.device['bind_type']); arguments: widget.device['bind_type']);
@@ -1292,7 +1302,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
bodyDeviceController.wifiMac = device['mac']; bodyDeviceController.wifiMac = device['mac'];
Get.toNamed("/wifiPagePerson", arguments: device); Get.toNamed("/wifiPagePerson", arguments: device);
return; return;
} }
double _calculateMaxMenuItemWidth(List<String> texts, TextStyle style) { double _calculateMaxMenuItemWidth(List<String> texts, TextStyle style) {

View File

@@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
@@ -24,8 +25,9 @@ class DeviceStatusInfoWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ClickableContainer( return ClickableContainer(
backgroundColor: themeController.currentColor.sc5, // backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController.currentColor.sc5, backgroundColor: stringToColor("#242835").withOpacity(0.8),
highlightColor: themeController.currentColor.sc21,
borderRadius: AppConstants().normal_container_radius, borderRadius: AppConstants().normal_container_radius,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onTap: () { onTap: () {
@@ -76,7 +78,7 @@ class DeviceStatusInfoWidget extends StatelessWidget {
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
color: themeController.currentColor.sc3, color: themeController.currentColor.sc4,
), ),
), ),
].divide(SizedBox(height: 39.rpx)), ].divide(SizedBox(height: 39.rpx)),

View File

@@ -169,6 +169,7 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
print(res); print(res);
}, },
); );
} }
@override @override

View File

@@ -109,7 +109,7 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
minHeight: 200.rpx, minHeight: 200.rpx,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.transparent, color: Colors.white,
), ),
child: child:
(widget.device['code']?.toString().isNotEmpty ?? (widget.device['code']?.toString().isNotEmpty ??
@@ -124,6 +124,7 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
SizedBox(height: 20.rpx),
Container( Container(
height: 50.rpx, height: 50.rpx,
decoration: BoxDecoration(), decoration: BoxDecoration(),

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,907 @@
import 'package:ef/ef.dart';
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: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/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/SelectableTagButton.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/person/select_time.dart';
class AfterUpdatePersonPage extends StatefulWidget {
AfterUpdatePersonPage({super.key});
@override
State<AfterUpdatePersonPage> createState() => _AfterUpdatePersonPageState();
}
class _AfterUpdatePersonPageState extends State<AfterUpdatePersonPage> {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find();
BodyDeviceController bodyDeviceController = Get.find();
ThemeController themeController = Get.find();
@override
void initState() {
super.initState();
// personController.dateTime = null;
personController.getDiseaseData().then((apiResponse) {
if (apiResponse.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
context,
text: apiResponse.msg ?? '',
textColor: themeController.currentColor.sc9,
);
}
});
}
@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/img/bgNoImg.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: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
/// 左边返回按钮
Positioned(
left: 0,
child: returnIconButtomAddCallback(() {
bodyDeviceController.getDeviceList();
bodyDeviceController.updateAll();
}),
),
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
ApiResponse apiRespons =
await personController.savePersonData();
if (apiRespons.code == HttpStatusCodes.ok) {
updateDeviceBindStatus(
personController.update_person_mac.value);
TopSlideNotification.show(context,
text: apiRespons.msg!);
List device_bind_process =
userInfoController.device_bind_status;
String mac =
personController.update_person_mac.value;
device_bind_process.removeWhere(
(element) => element['mac'] == mac);
await Get.offNamed("/bindDeviceSuccess");
} else {
TopSlideNotification.show(context,
text: apiRespons.msg!,
textColor: themeController.currentColor.sc9);
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 140.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0, 16.rpx, 0),
child: Text(
'下一步'.tr,
style: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
),
),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 141.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: TextFormField(
// controller: _model.textController1,
// focusNode: _model.textFieldFocusNode1,
initialValue: personController.name.value,
onChanged: (Value) {
personController.name.value = Value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
hintText: '人员资料.名字输入提示'.tr,
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color:
themeController.currentColor.sc3,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
// validator: _model.textController1Validator
// .asValidator(context),
),
),
),
),
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 90.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Obx(
() {
bool isMaleGreyed =
personController.gender.value ==
0; // gender == 0 时男生部分变灰
return GestureDetector(
onTap: () {
personController.gender.value =
1; // 点击时将 gender 设置为 1女生部分被选中
},
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 90.rpx,
height: 90.rpx,
child: ClipOval(
child: Opacity(
opacity: isMaleGreyed
? 0.4
: 1.0, // 控制透明度
child: Image.asset(
"assets/img/man.png",
fit: BoxFit.cover,
),
),
),
),
Text(
''.tr,
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: isMaleGreyed
? themeController
.currentColor
.sc4
: themeController
.currentColor
.sc3,
),
),
].divide(
SizedBox(height: 14.rpx)),
),
);
},
),
// 女性部分
Obx(
() {
bool isFemaleGreyed =
personController.gender.value ==
1; // gender == 1 时女生部分变灰
return GestureDetector(
onTap: () {
personController.gender.value =
0; // 点击时将 gender 设置为 0男生部分被选中
},
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 90.rpx,
height: 90.rpx,
child: ClipOval(
child: Opacity(
opacity: isFemaleGreyed
? 0.4
: 1.0, // 控制透明度
child: Image.asset(
"assets/img/man.png",
fit: BoxFit.cover,
),
),
),
),
Text(
''.tr,
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: isFemaleGreyed
? themeController
.currentColor
.sc4
: themeController
.currentColor
.sc3,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
].divide(
SizedBox(height: 14.rpx)),
),
);
},
),
].divide(SizedBox(width: 170.rpx)),
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(Duration(milliseconds: 250),
() {
showDateSelectionDialog(
context,
checkDate: personController.dateTime ??
DateTime.now(),
checkChange: (DateTime d) {
personController.birthday.value =
MyUtils.formatBindTime(d);
personController.dateTime = d;
personController.updateAll();
},
title: "生日".tr,
);
});
},
child: Center(
child: Text(
personController.dateTime != null
? DateFormat("yyyy年MM月dd日").format(
personController.dateTime!)
: '人员资料.生日输入提示'.tr,
textAlign: TextAlign.right,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: personController.dateTime !=
null
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 18.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
],
initialValue: personController
.height.value
.toString(),
onChanged: (value) {
personController.height.value = value;
},
autofocus: false,
obscureText: false,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
Colors.transparent, // 隐藏输入文字
letterSpacing: 0.0,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
hintText: '身高输入提示'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
),
Obx(() {
final height =
personController.height.value;
return (height == null ||
height.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${height}cm',
textAlign: TextAlign.center,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
);
}),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 18.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
// 实际输入框(输入逻辑保留)
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
],
initialValue: personController
.weight.value
.toString(),
onChanged: (value) {
personController.weight.value = value;
},
autofocus: false,
obscureText: false,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
Colors.transparent, // 隐藏输入文字
letterSpacing: 0.0,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
hintText: '人员资料.体重输入提示'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0.0,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
),
Obx(() {
final weight =
personController.weight?.value;
return (weight == null ||
weight.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${weight}kg',
textAlign: TextAlign.center,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
);
}),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 117.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
'人员资料.疾病标题'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: Color(0xFFF3F4F5),
fontSize: 30.rpx,
letterSpacing: 0.0,
),
),
),
),
),
Obx(() {
final selectedIds =
personController.selectedDiseaseIds;
final diseases = personController.diseaseList;
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 70.rpx, 70.rpx, 0),
child: Wrap(
spacing: 20.rpx,
runSpacing: 20.rpx,
children: diseases.map<Widget>((disease) {
final id = disease['_id'];
final name = disease['disease_type_name'];
final isSelected = selectedIds.contains(id);
return SelectableTagButton(
label: name,
selected: isSelected,
onTap: () {
if (isSelected) {
selectedIds.remove(id);
} else {
selectedIds.add(id);
}
personController.model.read = 0;
personController.updateAll();
//切换语言
// Get.updateLocale(Locale("en", "us"));
},
);
}).toList(),
),
);
}),
],
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 52.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 30.rpx, 30.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0),
child: Container(
width: 23.rpx,
height: 23.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
),
),
),
Expanded(
child: Text(
'人员资料.提示'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController.currentColor.sc4,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
),
].divide(SizedBox(width: 23.rpx)),
),
),
),
),
SizedBox(
height: 20.rpx,
),
],
),
),
),
),
),
),
);
}
Widget _buildDeviceCard(BuildContext context,
{required String title, required String imageUrl, required String type}) {
return CustomCard(
borderRadius: 20.rpx, // 圆角大小
onTap: () {
if (type != null) {
if (type == '1') {
Get.toNamed("/blueteethDevice");
}
}
},
colors: [themeController.currentColor.sc17], // 背景色
child: Container(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135,
constraints: BoxConstraints(
minHeight: 220.rpx,
),
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
color: const Color(0xFFC2CED7),
fontSize: 30.rpx,
letterSpacing: 0.0,
),
),
ClipRRect(
borderRadius: BorderRadius.circular(8.rpx),
child: Image.asset(
imageUrl,
width: 212.rpx,
height: 168.rpx,
),
),
],
),
),
);
}
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": true,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,9 +3,11 @@ import 'package:easydevice/easydevice.dart';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
@@ -89,12 +91,12 @@ class _SingleBlueteethDeviceCompoentWidgetState
await blueteethBindController.bindDeviceAndMAC(device); await blueteethBindController.bindDeviceAndMAC(device);
TopSlideNotification.show(context, text: response.msg!); TopSlideNotification.show(context, text: response.msg!);
if (response.code == HttpStatusCodes.ok) { if (response.code == HttpStatusCodes.ok) {
//更新设备绑定流程
updateDeviceBindStatus(device);
Get.toNamed("/wifiPage"); Get.toNamed("/wifiPage");
THapp bledevice = THapp(device: widget.bleDevice.device); THapp bledevice = THapp(device: widget.bleDevice.device);
blueteethBindController.currentDevice = bledevice; blueteethBindController.currentDevice = bledevice;
// blueteethBindController.currentDeviceMac.value = ""; // blueteethBindController.currentDeviceMac.value = "";
} else { } else {
blueteethBindController.currentDeviceMac.value = ""; blueteethBindController.currentDeviceMac.value = "";
blueteethBindController.updateAll(); blueteethBindController.updateAll();
@@ -252,4 +254,30 @@ class _SingleBlueteethDeviceCompoentWidgetState
), ),
); );
} }
//更新设备绑定状态
void updateDeviceBindStatus(BleDeviceData device) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String mac = device.mac!;
String type = "device_bind_status_${mac}";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": false,
"celibration": false,
"person_info": false,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新用户绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
}
} }

View File

@@ -437,33 +437,34 @@ void showConfirmDialog(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
// 标题 // 标题
Row( // Row(
mainAxisAlignment: MainAxisAlignment.end, // mainAxisAlignment: MainAxisAlignment.end,
children: [ // children: [
ClickableContainer( // ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色 // backgroundColor: Colors.transparent, // 容器背景色
highlightColor: // highlightColor:
themeController.currentColor.sc21, // 点击时的背景色 // themeController.currentColor.sc21, // 点击时的背景色
padding: EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围 // padding: EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () { // onTap: () {
Get.back(); // Get.back();
onCancel(); // onCancel();
}, // },
child: Padding( // child: Padding(
// padding: // // padding:
// EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.rpx), // // EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.rpx),
padding: EdgeInsetsDirectional.fromSTEB( // padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 33.rpx, 33.rpx, 33.rpx), // 33.rpx, 33.rpx, 33.rpx, 33.rpx),
child: SvgPicture.asset( // child: SvgPicture.asset(
'assets/img/icon/close.svg', // 'assets/img/icon/close.svg',
width: 25.rpx, // width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置 // height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: themeController.currentColor.sc3, // color: themeController.currentColor.sc3,
), // ),
), // ),
), // ),
], // ],
), // ),
Align( Align(
alignment: AlignmentDirectional(0, 0), alignment: AlignmentDirectional(0, 0),
child: Padding( child: Padding(
@@ -892,8 +893,8 @@ Future<void> showTipDialog(
Align( Align(
alignment: AlignmentDirectional(0, 0), alignment: AlignmentDirectional(0, 0),
child: Padding( child: Padding(
padding: padding: EdgeInsetsDirectional.fromSTEB(
EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 74.rpx), 0.rpx, 93.rpx, 0, 74.rpx),
child: widget, child: widget,
), ),
), ),
@@ -926,8 +927,142 @@ Future<void> showTipDialog(
.override( .override(
color: themeController.currentColor.sc3, color: themeController.currentColor.sc3,
fontFamily: 'Inter', fontFamily: 'Inter',
fontSize: fontSize: AppConstants().normal_text_fontSize,
AppConstants().normal_text_fontSize, letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
],
),
),
),
);
},
);
}
Future<void> showUnBindTipDialog(
BuildContext context,
Widget widget, {
Color? backgroundColor,
VoidCallback? onConfirm, // “继续”按钮回调
VoidCallback? onCancel, // “下次再说”按钮回调
}) {
ThemeController themeController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
return showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5),
builder: (BuildContext context) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
decoration: BoxDecoration(
color: backgroundColor ?? themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 93.rpx, 0, 30.rpx),
child: widget,
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onConfirm != null) {
onConfirm(); // 调用确认回调
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'继续'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 19.rpx, 0, 60.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onCancel != null) {
onCancel(); // 调用取消回调
}
},
colors: [Colors.transparent],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 0.5.rpx,
),
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius),
),
constraints: BoxConstraints(
minWidth: 500.rpx,
minHeight: 90.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'下次再说'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),

View File

@@ -156,11 +156,11 @@ class _CalibrationPageState extends State<CalibrationPage> {
themeController.currentColor.sc2, themeController.currentColor.sc2,
], ],
child: Container( child: Container(
width: 130.rpx, width: 140.rpx,
height: 60.rpx, height: 60.rpx,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0, 0.rpx, 0), 16.rpx, 0, 16.rpx, 0),
child: Text( child: Text(
'下一步'.tr, '下一步'.tr,
style: TextStyle( style: TextStyle(
@@ -959,6 +959,8 @@ class _CalibrationPageState extends State<CalibrationPage> {
deviceCalibrationController.flag.value = 2; deviceCalibrationController.flag.value = 2;
progressNotifier.value = 0; // 重置进度条 progressNotifier.value = 0; // 重置进度条
failureNotifier.value = false; // 重置失败状态 failureNotifier.value = false; // 重置失败状态
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
} }
}, },
onFailure: (res) { onFailure: (res) {
@@ -1022,4 +1024,39 @@ class _CalibrationPageState extends State<CalibrationPage> {
return Container(); return Container();
} }
//更新设备绑定状态
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": true,
"person_info": false,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
} }

View File

@@ -149,7 +149,7 @@ class _CalibrationPageState extends State<CalibrationPage> {
themeController.currentColor.sc2, themeController.currentColor.sc2,
], ],
child: Container( child: Container(
width: 130.rpx, width: 140.rpx,
height: 60.rpx, height: 60.rpx,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(

View File

@@ -953,6 +953,8 @@ class _CalibrationPersonPageState extends State<CalibrationPersonPage> {
deviceCalibrationController.flag.value = 0; // 重置标志允许再次点击 deviceCalibrationController.flag.value = 0; // 重置标志允许再次点击
} else if (isSecondStep && per >= 100 && currStep == 5 && status) { } else if (isSecondStep && per >= 100 && currStep == 5 && status) {
// 第二步完成 // 第二步完成
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
_pollingTimer?.cancel(); _pollingTimer?.cancel();
TopSlideNotification.show(context, text: "设备校准完成".tr); TopSlideNotification.show(context, text: "设备校准完成".tr);
deviceCalibrationController.bed_calibration.value = 1; deviceCalibrationController.bed_calibration.value = 1;
@@ -1024,4 +1026,38 @@ class _CalibrationPersonPageState extends State<CalibrationPersonPage> {
return Container(); return Container();
} }
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": true,
"person_info": res.data['person_info'],
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
} }

View File

@@ -6,9 +6,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.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/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -75,6 +77,8 @@ class _WifiPageState extends State<WifiPage> {
blueteethBindController.netType.value = 2; blueteethBindController.netType.value = 2;
blueteethBindController.connectStatus.value = 1; blueteethBindController.connectStatus.value = 1;
blueteethBindController.updateAll(); blueteethBindController.updateAll();
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
Future.delayed(const Duration(seconds: 1), () { Future.delayed(const Duration(seconds: 1), () {
Get.toNamed("/calibrationPage", arguments: 1); Get.toNamed("/calibrationPage", arguments: 1);
}); });
@@ -224,11 +228,11 @@ class _WifiPageState extends State<WifiPage> {
themeController.currentColor.sc2, themeController.currentColor.sc2,
], ],
child: Container( child: Container(
width: 130.rpx, width: 140.rpx,
height: 60.rpx, height: 60.rpx,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0, 0.rpx, 0), 16.rpx, 0, 16.rpx, 0),
child: Text( child: Text(
'下一步'.tr, '下一步'.tr,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
@@ -618,6 +622,10 @@ class _WifiPageState extends State<WifiPage> {
? 1 ? 1
: 0; : 0;
if (wifiStatus) { if (wifiStatus) {
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!
.value);
// Navigator.pop(context); // Navigator.pop(context);
TopSlideNotification TopSlideNotification
.show( .show(
@@ -749,6 +757,9 @@ class _WifiPageState extends State<WifiPage> {
blueteethBindController blueteethBindController
.connectStatus.value = 1; .connectStatus.value = 1;
blueteethBindController.updateAll(); blueteethBindController.updateAll();
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!.value);
Future.delayed( Future.delayed(
const Duration(seconds: 1), () { const Duration(seconds: 1), () {
Get.toNamed("/calibrationPage", Get.toNamed("/calibrationPage",
@@ -843,6 +854,7 @@ class _WifiPageState extends State<WifiPage> {
await getDeviceWifiStatus(blueteethBindController.currentDevice!, 1); await getDeviceWifiStatus(blueteethBindController.currentDevice!, 1);
if (aa != null && aa is Map) { if (aa != null && aa is Map) {
wifiStatus = true; wifiStatus = true;
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
blueteethBindController.connect_wifi.value = aa; blueteethBindController.connect_wifi.value = aa;
} else { } else {
wifiStatus = false; wifiStatus = false;
@@ -1090,6 +1102,7 @@ class _WifiPageState extends State<WifiPage> {
// text: "4g设备配置wifi提示".tr, // text: "4g设备配置wifi提示".tr,
// textColor: themeController.currentColor.sc9, // textColor: themeController.currentColor.sc9,
// ); // );
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
TopSlideNotification.show( TopSlideNotification.show(
context, context,
@@ -1148,4 +1161,38 @@ class _WifiPageState extends State<WifiPage> {
await FlutterBluePlus.stopScan(); await FlutterBluePlus.stopScan();
} }
} }
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": true,
"celibration":res.data['celibration'],
"person_info":res.data['person_info'],
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
} }

View File

@@ -6,9 +6,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.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/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -563,6 +565,10 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
? 1 ? 1
: 0; : 0;
if (wifiStatus) { if (wifiStatus) {
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!
.value);
// Navigator.pop(context); // Navigator.pop(context);
TopSlideNotification TopSlideNotification
.show( .show(
@@ -702,6 +708,9 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
.currentDevice!, .currentDevice!,
1); 1);
if (aa == "4g") { if (aa == "4g") {
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!.value);
TopSlideNotification.show( TopSlideNotification.show(
context, context,
text: "4g设备配置wifi提示".tr, text: "4g设备配置wifi提示".tr,
@@ -793,6 +802,7 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
var aa = var aa =
await getDeviceWifiStatus(blueteethBindController.currentDevice!, 0); await getDeviceWifiStatus(blueteethBindController.currentDevice!, 0);
if (aa != null && aa is Map) { if (aa != null && aa is Map) {
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
wifiStatus = true; wifiStatus = true;
blueteethBindController.connect_wifi.value = aa; blueteethBindController.connect_wifi.value = aa;
} else { } else {
@@ -994,6 +1004,8 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
// ); // );
blueteethBindController.netType.value = 2; blueteethBindController.netType.value = 2;
blueteethBindController.updateAll(); blueteethBindController.updateAll();
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
// WidgetsBinding.instance.addPostFrameCallback((_) { // WidgetsBinding.instance.addPostFrameCallback((_) {
// TopSlideNotification.show( // TopSlideNotification.show(
// context, // context,
@@ -1094,4 +1106,39 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
], ],
)); ));
} }
//更新设备绑定状态
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": true,
"celibration":res.data['celibration'],
"person_info":res.data['person_info'],
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
} }

View File

@@ -497,7 +497,7 @@ class _NewHomePageState extends State<NewHomePage> {
Alignment Alignment
.center, .center,
child: Text( child: Text(
'${day['scoreType'] ?? "暂无"}', '${day['scoreType'] ?? "暂无".tr}',
style: FlutterFlowTheme.of( style: FlutterFlowTheme.of(
context) context)
.bodyMedium .bodyMedium

View File

@@ -19,6 +19,7 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart'; import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/api_response.dart';
class OtherLoginPage extends StatefulWidget { class OtherLoginPage extends StatefulWidget {
@@ -337,7 +338,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
alignment: AlignmentDirectional(-1, 0), alignment: AlignmentDirectional(-1, 0),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 19.rpx, 0, 0), 0, 26.rpx, 0, 0),
child: Container( child: Container(
height: bodysize.maxHeight * 0.056, height: bodysize.maxHeight * 0.056,
width: double.infinity, width: double.infinity,
@@ -476,7 +477,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
SizedBox( SizedBox(
height: 50.rpx, height: 30.rpx,
child: VerticalDivider( child: VerticalDivider(
thickness: 2.rpx, thickness: 2.rpx,
color: themeController color: themeController
@@ -594,7 +595,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
), ),
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 35.rpx, 0, 0), 0, 26.rpx, 0, 0),
child: CustomCard( child: CustomCard(
borderRadius: AppConstants() borderRadius: AppConstants()
.button_container_radius, // 圆角半径 .button_container_radius, // 圆角半径
@@ -623,6 +624,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.currentColor.sc9, .currentColor.sc9,
); );
} else { } else {
// await dealBindProcess();
CountdownController CountdownController
countdownController = Get.find(); countdownController = Get.find();
countdownController.countdown.value = countdownController.countdown.value =
@@ -685,7 +687,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
), ),
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
25.rpx, 83.rpx, 25.rpx, 50.rpx), 25.rpx, 42.rpx, 25.rpx, 50.rpx),
child: Container( child: Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration(), decoration: BoxDecoration(),
@@ -760,7 +762,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 20.rpx,
color: themeController color: themeController
.currentColor.sc3, .currentColor.sc3,
), ),
@@ -773,7 +775,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 20.rpx,
color: stringToColor( color: stringToColor(
"#FF9F66"), "#FF9F66"),
), ),
@@ -786,7 +788,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 20.rpx,
color: themeController color: themeController
.currentColor.sc3, .currentColor.sc3,
), ),
@@ -799,7 +801,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 20.rpx,
color: stringToColor( color: stringToColor(
"#FF9F66"), "#FF9F66"),
), ),
@@ -812,7 +814,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 20.rpx,
color: themeController color: themeController
.currentColor.sc3, .currentColor.sc3,
), ),
@@ -825,7 +827,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override( .override(
fontFamily: 'Inter', fontFamily: 'Inter',
letterSpacing: 0.0, letterSpacing: 0.0,
fontSize: 26.rpx, fontSize: 20.rpx,
color: stringToColor( color: stringToColor(
"#FF9F66"), "#FF9F66"),
), ),

View File

@@ -35,8 +35,8 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
return Stack( return Stack(
children: [ children: [
ClickableContainer( ClickableContainer(
backgroundColor: Color(0xFF003058), backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController.currentColor.sc3, highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx, borderRadius: 20.rpx,
padding: padding:
EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 0.rpx, 33.rpx), EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 0.rpx, 33.rpx),

View File

@@ -17,10 +17,13 @@ import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart'; import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/home/home_controller.dart'; import 'package:vbvs_app/controller/home/home_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/controller/weather/weather_controller.dart';
import 'package:vbvs_app/enum/LoginStatus.dart'; import 'package:vbvs_app/enum/LoginStatus.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
const HomePage({super.key}); const HomePage({super.key});
@@ -164,6 +167,18 @@ class _HomePageState extends State<HomePage> {
_popupEntry = null; _popupEntry = null;
} }
@override
void didChangeDependencies() {
super.didChangeDependencies();
// 页面返回时重新判断是否当前路由是HomePage
WidgetsBinding.instance.addPostFrameCallback((_) {
if (ModalRoute.of(context)?.isCurrent ?? false) {
checkAndShowBindProcess();
}
});
}
@override @override
initState() { initState() {
super.initState(); super.initState();
@@ -191,6 +206,152 @@ class _HomePageState extends State<HomePage> {
} }
}); });
} }
if (userInfoController.device_bind_flag == 0) {
dealBindProcess().then((value) {
WidgetsBinding.instance.addPostFrameCallback((_) {
userInfoController.device_bind_flag = 1;
checkAndShowBindProcess();
// List device_bind_process = userInfoController.device_bind_status;
// if (device_bind_process != null && device_bind_process.isNotEmpty) {
// int currentIndex = 0;
// void showNextDialog() {
// if (currentIndex >= device_bind_process.length) return;
// String code = device_bind_process[currentIndex]['mac'];
// showUnBindTipDialog(
// context,
// Column(
// children: [
// Text(
// "发现".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// SizedBox(height: 20.rpx),
// Text.rich(
// TextSpan(
// children: [
// TextSpan(
// text: "检测到".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// TextSpan(
// text: code,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc8,
// ),
// ),
// TextSpan(
// text: "绑定流程未走完是否继续?".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// onConfirm: () async {
// print("继续设备:$code");
// var data = device_bind_process[currentIndex];
// BlueteethBindController blueteethBindController = Get.find();
// blueteethBindController.currentDeviceMac?.value = data['mac'];
// PersonController personController = Get.find();
// personController.after_deveice = data['device_info'];
// // 从 WiFi 开始配置
// if (data['wifi'] == false) {
// await Get.toNamed("/afterWifiPagePerson",
// arguments: data['device_info'])!
// .then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 从设备校准开始配置
// if (data['celibration'] == false) {
// await Get.toNamed("/afterCalibrationPersonPage")!.then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 从人员信息配置开始
// if (data['person_info'] == false) {
// if (data['device_info']['person'] != null) {
// personController.currentPersonId.value =
// data['device_info']['_id'];
// personController.name.value =
// data['device_info']['person']['name'];
// personController.update_person_mac.value =
// data['device_info']['mac'];
// personController.gender.value =
// data['device_info']['person']['gender'] ?? 1;
// personController.weight?.value =
// data['device_info']['person']['weight']?.toString() ??
// '';
// personController.height.value =
// data['device_info']['person']['height']?.toString() ??
// '';
// personController.selectedDiseaseIds.value =
// data['device_info']['person']['disease'] ?? [];
// personController.birthday.value =
// data['device_info']['person']['birthday'] ?? '';
// personController.dateTime = MyUtils.formatBirthdayTime(
// data['device_info']['person']['birthday']);
// } else {
// personController.update_person_mac.value =
// data['device_info']['mac'];
// personController.currentPersonId.value =
// data['device_info']['_id'];
// personController.name.value = "";
// personController.gender.value = 1;
// personController.dateTime = null;
// personController.height.value = "";
// personController.weight.value = "";
// personController.diseaseList.value = [];
// }
// await Get.toNamed("/afterUpdatePersonPage")!.then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 如果以上都走完了,继续下一个弹窗
// currentIndex++;
// showNextDialog();
// },
// onCancel: () {
// print("跳过设备:$code");
// device_bind_process.removeAt(currentIndex);
// showNextDialog();
// },
// );
// }
// showNextDialog();
// }
});
});
}
} }
@override @override
@@ -1081,4 +1242,120 @@ class _HomePageState extends State<HomePage> {
), ),
); );
} }
void checkAndShowBindProcess() {
UserInfoController userInfoController = Get.find();
List device_bind_process = userInfoController.device_bind_status;
if (device_bind_process != null && device_bind_process.isNotEmpty) {
int currentIndex = 0;
void showNextDialog() {
if (currentIndex >= device_bind_process.length) return;
String code = device_bind_process[currentIndex]['mac'];
showUnBindTipDialog(
context,
Column(
children: [
Text(
"发现".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
SizedBox(height: 20.rpx),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "检测到".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
TextSpan(
text: code,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc8,
),
),
TextSpan(
text: "绑定流程未走完是否继续?".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
],
),
onConfirm: () async {
var data = device_bind_process[currentIndex];
PersonController personController = Get.find();
personController.after_deveice = data['device_info'];
// 判断逻辑...
if (data['wifi'] == false) {
await Get.toNamed("/afterWifiPagePerson",
arguments: data['device_info']);
return;
}
if (data['celibration'] == false) {
await Get.toNamed("/afterCalibrationPersonPage");
return;
}
if (data['person_info'] == false) {
PersonController personController = Get.find();
if (data['device_info']['person'] != null) {
personController.currentPersonId.value =
data['device_info']['_id'];
personController.name.value =
data['device_info']['person']['name'];
personController.update_person_mac.value =
data['device_info']['mac'];
personController.gender.value =
data['device_info']['person']['gender'] ?? 1;
personController.weight?.value =
data['device_info']['person']['weight']?.toString() ?? '';
personController.height.value =
data['device_info']['person']['height']?.toString() ?? '';
personController.selectedDiseaseIds.value =
data['device_info']['person']['disease'] ?? [];
personController.birthday.value =
data['device_info']['person']['birthday'] ?? '';
personController.dateTime = MyUtils.formatBirthdayTime(
data['device_info']['person']['birthday']);
} else {
personController.update_person_mac.value =
data['device_info']['mac'];
personController.currentPersonId.value =
data['device_info']['_id'];
personController.name.value = "";
personController.gender.value = 1;
personController.dateTime = null;
personController.height.value = "";
personController.weight.value = "";
personController.diseaseList.value = [];
}
await Get.toNamed("/afterUpdatePersonPage");
return;
}
currentIndex++;
showNextDialog();
},
onCancel: () {
device_bind_process.removeAt(currentIndex);
showNextDialog();
},
);
}
showNextDialog();
}
}
} }

View File

@@ -206,7 +206,7 @@ class _MinePageState extends State<MinePage> {
? (userInfoController.model ? (userInfoController.model
.user!.nick_name ?? .user!.nick_name ??
'未命名'.tr) '未命名'.tr)
: "我的.未登录".tr, : "未命名".tr,
style: style:
FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
@@ -240,7 +240,7 @@ class _MinePageState extends State<MinePage> {
return "微信用户".tr; return "微信用户".tr;
} }
})() })()
: "我的.未登录".tr, : "未知数据".tr,
style: style:
FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
@@ -650,8 +650,12 @@ class _MinePageState extends State<MinePage> {
// themeController.currentColor.sc2, // themeController.currentColor.sc2,
// ); // );
Get.toNamed("/newSleepReportPage", Get.toNamed("/newSleepReportPage",
arguments: {'date':DateTime.now() arguments: {
.millisecondsSinceEpoch,"mac":'aaaaaaeeeeeq','type':1}); 'date': DateTime.now()
.millisecondsSinceEpoch,
"mac": 'aaaaaaeeeeeq',
'type': 1
});
} }
}, },
child: Container( child: Container(
@@ -737,5 +741,4 @@ class _MinePageState extends State<MinePage> {
), ),
); );
} }
} }

View File

@@ -1,11 +1,14 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.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/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/SelectableTagButton.dart'; import 'package:vbvs_app/component/tool/SelectableTagButton.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -109,6 +112,7 @@ class _EPageState extends State<PersonPage> {
if (apiRespons.code == HttpStatusCodes.ok) { if (apiRespons.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: apiRespons.msg!); text: apiRespons.msg!);
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
Get.offNamed("/bindDeviceSuccess"); Get.offNamed("/bindDeviceSuccess");
} else { } else {
TopSlideNotification.show(context, TopSlideNotification.show(context,
@@ -768,15 +772,21 @@ class _EPageState extends State<PersonPage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0), 0, 8.rpx, 0, 0),
child: Icon( child: Container(
Icons.arrow_back, width: 23.rpx,
color: themeController.currentColor.sc4, height: 23.rpx,
size: 24.rpx, // width: double.infinity,
), decoration: BoxDecoration(),
), child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
),
),
),
Expanded( Expanded(
child: Text( child: Text(
'人员资料.提示'.tr, '人员资料.提示'.tr,
@@ -851,3 +861,36 @@ class _EPageState extends State<PersonPage> {
); );
} }
} }
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": true,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}

View File

@@ -1,11 +1,14 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.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/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/SelectableTagButton.dart'; import 'package:vbvs_app/component/tool/SelectableTagButton.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -107,6 +110,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
ApiResponse apiRespons = ApiResponse apiRespons =
await personController.savePersonData(); await personController.savePersonData();
if (apiRespons.code == HttpStatusCodes.ok) { if (apiRespons.code == HttpStatusCodes.ok) {
updateDeviceBindStatus(
personController.update_person_mac.value);
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: apiRespons.msg!); text: apiRespons.msg!);
} else { } else {
@@ -775,10 +780,16 @@ class _UpdatePageState extends State<UpdatePersonPage> {
Padding( Padding(
padding: EdgeInsetsDirectional.fromSTEB( padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0), 0, 8.rpx, 0, 0),
child: Icon( child: Container(
Icons.arrow_back, width: 23.rpx,
color: themeController.currentColor.sc4, height: 23.rpx,
size: 24.rpx, // width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
),
), ),
), ),
Expanded( Expanded(
@@ -857,4 +868,38 @@ class _UpdatePageState extends State<UpdatePersonPage> {
), ),
); );
} }
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": true,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
} }

View File

@@ -13,8 +13,6 @@ class AboutUsPage extends StatefulWidget {
} }
class _AboutUsPageState extends State<AboutUsPage> { class _AboutUsPageState extends State<AboutUsPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -110,7 +108,7 @@ class _AboutUsPageState extends State<AboutUsPage> {
body: SafeArea( body: SafeArea(
top: true, top: true,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.rpx), padding: EdgeInsets.symmetric(horizontal: 0.rpx),
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: Container( child: Container(

View File

@@ -9,6 +9,9 @@ import 'package:vbvs_app/pages/device/device_detail.dart';
import 'package:vbvs_app/pages/device/instant_body_page.dart'; import 'package:vbvs_app/pages/device/instant_body_page.dart';
import 'package:vbvs_app/pages/device/message_review_page.dart'; import 'package:vbvs_app/pages/device/message_review_page.dart';
import 'package:vbvs_app/pages/device_bind/MobileScannerTestPage.dart'; import 'package:vbvs_app/pages/device_bind/MobileScannerTestPage.dart';
import 'package:vbvs_app/pages/device_bind/after/after_device_calibration_person.dart';
import 'package:vbvs_app/pages/device_bind/after/after_update_person_page.dart';
import 'package:vbvs_app/pages/device_bind/after/after_wifi_page_person.dart';
import 'package:vbvs_app/pages/device_bind/bind_device_success.dart'; import 'package:vbvs_app/pages/device_bind/bind_device_success.dart';
import 'package:vbvs_app/pages/device_bind/blueteeth_device_page.dart'; import 'package:vbvs_app/pages/device_bind/blueteeth_device_page.dart';
import 'package:vbvs_app/pages/device_bind/device_calibration.dart'; import 'package:vbvs_app/pages/device_bind/device_calibration.dart';
@@ -19,9 +22,7 @@ import 'package:vbvs_app/pages/device_bind/device_type.dart';
import 'package:vbvs_app/pages/device_bind/device_type_list.dart'; import 'package:vbvs_app/pages/device_bind/device_type_list.dart';
import 'package:vbvs_app/pages/device_bind/wifi_page.dart'; import 'package:vbvs_app/pages/device_bind/wifi_page.dart';
import 'package:vbvs_app/pages/device_bind/wifi_page_person.dart'; import 'package:vbvs_app/pages/device_bind/wifi_page_person.dart';
import 'package:vbvs_app/pages/login/login.dart';
import 'package:vbvs_app/pages/login/other_login.dart'; import 'package:vbvs_app/pages/login/other_login.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'package:vbvs_app/pages/main_bottom/e_page.dart'; import 'package:vbvs_app/pages/main_bottom/e_page.dart';
import 'package:vbvs_app/pages/main_bottom/follow_page.dart'; import 'package:vbvs_app/pages/main_bottom/follow_page.dart';
import 'package:vbvs_app/pages/main_bottom/help_page.dart'; import 'package:vbvs_app/pages/main_bottom/help_page.dart';
@@ -60,7 +61,7 @@ var routes = {
"/deviceType": (contxt, {arguments}) => DeviceTypePage(), "/deviceType": (contxt, {arguments}) => DeviceTypePage(),
"/blueteethDevice": (contxt) => BlueteethDevicePage(), "/blueteethDevice": (contxt) => BlueteethDevicePage(),
"/personPage": (contxt) => PersonPage(), "/personPage": (contxt) => PersonPage(),
"/bindDeviceSuccess": (contxt) => BindDeviceSuccess(), "/bindDeviceSuccess": (contxt) => BindDeviceSuccess(),
"/wifiPage": (contxt, {arguments}) => WifiPage(type: arguments), "/wifiPage": (contxt, {arguments}) => WifiPage(type: arguments),
"/wifiPagePerson": (contxt, {arguments}) => WifiPagePerson(type: arguments), "/wifiPagePerson": (contxt, {arguments}) => WifiPagePerson(type: arguments),
"/updateUserPage": (contxt) => UpdateUserPage(), "/updateUserPage": (contxt) => UpdateUserPage(),
@@ -79,7 +80,8 @@ var routes = {
"/deviceShareListPage": (contxt, {arguments}) => "/deviceShareListPage": (contxt, {arguments}) =>
DeviceShareListPage(device: arguments), DeviceShareListPage(device: arguments),
"/calibrationPage": (contxt, {arguments}) => CalibrationPage(type: arguments), "/calibrationPage": (contxt, {arguments}) => CalibrationPage(type: arguments),
"/calibrationPersonPage": (contxt, {arguments}) => CalibrationPersonPage(type: arguments), "/calibrationPersonPage": (contxt, {arguments}) =>
CalibrationPersonPage(type: arguments),
"/applyRepairPage": (contxt) => ApplyRepairPage(), "/applyRepairPage": (contxt) => ApplyRepairPage(),
"/languageSetting": (contxt) => LanguageSetting(), "/languageSetting": (contxt) => LanguageSetting(),
"/helpPage": (contxt) => HelpPage(), "/helpPage": (contxt) => HelpPage(),
@@ -96,8 +98,12 @@ var routes = {
MessageReviewPage(data: arguments), MessageReviewPage(data: arguments),
"/messageSettingPage": (contxt, {arguments}) => "/messageSettingPage": (contxt, {arguments}) =>
MessageSettingPage(data: arguments), MessageSettingPage(data: arguments),
"/commonMessageSettingPage": (contxt) => "/commonMessageSettingPage": (contxt) => CommonMessageSettingPage(),
CommonMessageSettingPage(), "/afterCalibrationPersonPage": (contxt) => AfterCalibrationPersonPage(),
"/afterUpdatePersonPage": (contxt) => AfterUpdatePersonPage(),
"/afterWifiPagePerson": (contxt, {arguments}) => AfterWifiPagePerson(
type: arguments,
),
}; };
var onGenerateRoute = (RouteSettings settings) { var onGenerateRoute = (RouteSettings settings) {

View File

@@ -58,6 +58,7 @@ dependencies:
# fl_chart: ^1.0.0 # fl_chart: ^1.0.0
video_player: ^2.9.5 video_player: ^2.9.5
chewie: ^1.10.0 chewie: ^1.10.0
gif: ^2.3.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: