diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..4039166
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "cmake.sourceDirectory": "D:/flutter/vbvs_app-1/linux"
+}
diff --git a/assets/images/active_bluetooth.png b/assets/images/active_bluetooth.png
new file mode 100644
index 0000000..d2b37a7
Binary files /dev/null and b/assets/images/active_bluetooth.png differ
diff --git a/assets/images/bar_control.svg b/assets/images/bar_control.svg
new file mode 100644
index 0000000..a42c2d0
--- /dev/null
+++ b/assets/images/bar_control.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/images/bar_heart.svg b/assets/images/bar_heart.svg
new file mode 100644
index 0000000..1f2ea46
--- /dev/null
+++ b/assets/images/bar_heart.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/images/bar_home.svg b/assets/images/bar_home.svg
new file mode 100644
index 0000000..0411b21
--- /dev/null
+++ b/assets/images/bar_home.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/images/bar_mine.svg b/assets/images/bar_mine.svg
new file mode 100644
index 0000000..3cc9e92
--- /dev/null
+++ b/assets/images/bar_mine.svg
@@ -0,0 +1,22 @@
+
diff --git a/assets/images/bed_control.png b/assets/images/bed_control.png
new file mode 100644
index 0000000..7149ac7
Binary files /dev/null and b/assets/images/bed_control.png differ
diff --git a/assets/images/bed_name.png b/assets/images/bed_name.png
new file mode 100644
index 0000000..3a30c96
Binary files /dev/null and b/assets/images/bed_name.png differ
diff --git a/assets/images/device_bed.png b/assets/images/device_bed.png
new file mode 100644
index 0000000..7089767
Binary files /dev/null and b/assets/images/device_bed.png differ
diff --git a/assets/images/edit.svg b/assets/images/edit.svg
new file mode 100644
index 0000000..244e842
--- /dev/null
+++ b/assets/images/edit.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/images/electric_bed.png b/assets/images/electric_bed.png
new file mode 100644
index 0000000..670fe82
Binary files /dev/null and b/assets/images/electric_bed.png differ
diff --git a/assets/images/new_background.png b/assets/images/new_background.png
new file mode 100644
index 0000000..974ec90
Binary files /dev/null and b/assets/images/new_background.png differ
diff --git a/assets/images/new_empty.png b/assets/images/new_empty.png
new file mode 100644
index 0000000..47b9a23
Binary files /dev/null and b/assets/images/new_empty.png differ
diff --git a/assets/images/people_avatar.png b/assets/images/people_avatar.png
new file mode 100644
index 0000000..07122c8
Binary files /dev/null and b/assets/images/people_avatar.png differ
diff --git a/assets/images/read_message.svg b/assets/images/read_message.svg
new file mode 100644
index 0000000..5aa3c6b
--- /dev/null
+++ b/assets/images/read_message.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/img/icon/bluetooth_edit.svg b/assets/img/icon/bluetooth_edit.svg
new file mode 100644
index 0000000..36ed11f
--- /dev/null
+++ b/assets/img/icon/bluetooth_edit.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/img/icon/expand.svg b/assets/img/icon/expand.svg
new file mode 100644
index 0000000..a0eae77
--- /dev/null
+++ b/assets/img/icon/expand.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/img/icon/history_store.svg b/assets/img/icon/history_store.svg
new file mode 100644
index 0000000..326df56
--- /dev/null
+++ b/assets/img/icon/history_store.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/img/icon/message.svg b/assets/img/icon/message.svg
new file mode 100644
index 0000000..6956b9f
--- /dev/null
+++ b/assets/img/icon/message.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/img/icon/people_info.svg b/assets/img/icon/people_info.svg
new file mode 100644
index 0000000..860629a
--- /dev/null
+++ b/assets/img/icon/people_info.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/img/icon/return_buttom.svg b/assets/img/icon/return_buttom.svg
new file mode 100644
index 0000000..4788c77
--- /dev/null
+++ b/assets/img/icon/return_buttom.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/img/icon/xiaoe.svg b/assets/img/icon/xiaoe.svg
new file mode 100644
index 0000000..f996a3d
--- /dev/null
+++ b/assets/img/icon/xiaoe.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/common/util/FitTool.dart b/lib/common/util/FitTool.dart
index 212c2b0..3c83270 100644
--- a/lib/common/util/FitTool.dart
+++ b/lib/common/util/FitTool.dart
@@ -1,5 +1,3 @@
-
-
class FitTool {
static double rpx = 0;
static bool isInit = false;
@@ -9,7 +7,8 @@ class FitTool {
}
if (isInit == false) {
isInit = true;
- rpx = v / 750.0;
+ // rpx = v / 750.0;
+ rpx=v/1624.0;
}
}
diff --git a/lib/common/util/MyUtils.dart b/lib/common/util/MyUtils.dart
index 76c1121..97620dc 100644
--- a/lib/common/util/MyUtils.dart
+++ b/lib/common/util/MyUtils.dart
@@ -2,10 +2,12 @@ import 'dart:async';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
+import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/language/AppLanguage.dart';
@@ -361,6 +363,37 @@ var returnIconButtom = IconButton(
icon: Icon(Icons.navigate_before, size: 60.rpx),
);
+var returnIconButtomNew = ClickableContainer(
+ backgroundColor: Colors.transparent,
+ highlightColor: Colors.transparent,
+ padding: EdgeInsets.only(right: 0),
+ onTap: () => Get.back(),
+ child: Container(
+ // height: 42.rpx,
+ // width: 42.rpx,
+ child: SvgPicture.asset(
+ 'assets/img/icon/return_buttom.svg',
+ width: 42.rpx,
+ height: 42.rpx,
+ ),
+ // SvgPicture.asset(
+ // 'assets/img/icon/expand.svg',
+ // color: Colors.white,
+ // )
+ ));
+
+// IconButton(
+// padding: EdgeInsets.zero, // 去除默认 padding
+// constraints: BoxConstraints(), // 去除最小尺寸限制
+// onPressed: () => Get.back(),
+// icon: SvgPicture.asset(
+// 'assets/img/icon/return_buttom.svg',
+// width: 42.rpx,
+// height: 42.rpx,
+// ),
+// );
+
+var returnIconButtomAddCallback = (returnCallBack) {
var returnIconButtomAddCallback = (
VoidCallback? returnCallBack, {
bool enableBack = true,
diff --git a/lib/component/img/img_default_widget.dart b/lib/component/img/img_default_widget.dart
new file mode 100644
index 0000000..e16d5a7
--- /dev/null
+++ b/lib/component/img/img_default_widget.dart
@@ -0,0 +1,77 @@
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+
+import '../../controller/mh/apply_repair_controller.dart';
+
+
+class ImgPreviewDefaultWidget extends GetView {
+ ApplyRepairController applyRepairController;
+
+ ImgPreviewDefaultWidget({required this.applyRepairController}) {}
+
+ @override
+ Widget build(BuildContext context) {
+ return InkWell(
+ // onTap: applyRepairController.uploadImg,
+ onTap: ()async{},
+ child: Container(
+ width: MediaQuery.sizeOf(context).width * 0.25,
+ height: MediaQuery.sizeOf(context).height * 0.15,
+ constraints: BoxConstraints(
+ minHeight: 152,
+ ),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.max,
+ children: [
+ Expanded(
+ child: Container(
+ width: MediaQuery.sizeOf(context).width,
+ height: MediaQuery.sizeOf(context).height * 0.116,
+ constraints: BoxConstraints(
+ minHeight: 152,
+ ),
+ decoration: BoxDecoration(
+ color: Color(0xFFF3F5F6),
+ borderRadius: BorderRadius.circular(16),
+ ),
+ child: Align(
+ alignment: AlignmentDirectional(0, 0),
+ child: Container(
+ width: 35,
+ height: 35,
+ decoration: BoxDecoration(
+ image: DecorationImage(
+ fit: BoxFit.cover,
+ image: Image.asset(
+ 'assets/images/camera.png',
+ ).image,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ Align(
+ alignment: AlignmentDirectional(0, 0),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(0, 8, 0, 13),
+ child: Text(
+ ' ',
+ style: FlutterFlowTheme.of(context).bodyMedium.override(
+ fontFamily: 'Readex Pro',
+ color: Color(0xFF9EA4B7),
+ fontSize: 11,
+ letterSpacing: 0,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/component/img/img_preview_controller.dart b/lib/component/img/img_preview_controller.dart
new file mode 100644
index 0000000..5652db0
--- /dev/null
+++ b/lib/component/img/img_preview_controller.dart
@@ -0,0 +1,23 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'img_preview_controller.g.dart';
+
+@JsonSerializable()
+class ImgPreviewModel {
+ //版本id
+ String? url; //图片地址
+
+
+ ImgPreviewModel();
+
+ static ImgPreviewModel fromJson(Map json) =>
+ _$ImgPreviewModelFromJson(json);
+ Map toJson() => _$ImgPreviewModelToJson(this);
+}
+
+class ImgPreviewController extends GetControllerEx {
+ ImgPreviewController() {
+ attr = GetModel(ImgPreviewModel()).obs;
+ }
+}
diff --git a/lib/component/img/img_preview_controller.g.dart b/lib/component/img/img_preview_controller.g.dart
new file mode 100644
index 0000000..869e00e
--- /dev/null
+++ b/lib/component/img/img_preview_controller.g.dart
@@ -0,0 +1,15 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'img_preview_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+ImgPreviewModel _$ImgPreviewModelFromJson(Map json) =>
+ ImgPreviewModel()..url = json['url'] as String?;
+
+Map _$ImgPreviewModelToJson(ImgPreviewModel instance) =>
+ {
+ 'url': instance.url,
+ };
diff --git a/lib/component/img/img_preview_widget.dart b/lib/component/img/img_preview_widget.dart
new file mode 100644
index 0000000..af5c52a
--- /dev/null
+++ b/lib/component/img/img_preview_widget.dart
@@ -0,0 +1,80 @@
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+import '../../common/color/appFontsize.dart';
+import '../../controller/mh/apply_repair_controller.dart';
+
+class ImgPreviewWidget extends GetView {
+ String imgUrl;
+ int index;
+ ApplyRepairController applyRepairController;
+ bool isDel;
+
+ ImgPreviewWidget(
+ {required this.imgUrl,
+ required this.index,
+ required this.applyRepairController,
+ required this.isDel}) {}
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ width: MediaQuery.sizeOf(context).width * 0.25,
+ height: MediaQuery.sizeOf(context).height * 0.15,
+ constraints: BoxConstraints(
+ minHeight: 140,
+ ),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Container(
+ width: MediaQuery.sizeOf(context).width,
+ height: MediaQuery.sizeOf(context).height * 0.116,
+ decoration: BoxDecoration(
+ color: Color(0xFFF3F5F6),
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(8),
+ child: Image.network(
+ 'https://picsum.photos/seed/73/600',
+ // applyRepairController.getPublicUrl(imgUrl),
+
+ width: 300,
+ height: 200,
+ fit: BoxFit.cover,
+ ),
+ ),
+ ),
+ ),
+ Visibility(
+ visible: isDel,
+ child: Align(
+ alignment: AlignmentDirectional(0, 0),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(0, 8, 0, 13),
+ child: InkWell(
+ onTap: () {
+ applyRepairController.model.issue_img!.removeAt(index);
+ applyRepairController.updateAll();
+ },
+ child: Text(
+ '删除',
+ style: FlutterFlowTheme.of(context).bodyMedium.override(
+ fontFamily: 'Readex Pro',
+ color: Color(0xFF9EA4B7),
+ fontSize: AppFontsize.small_text_size,
+ letterSpacing: 0,
+ ),
+ ),
+ )),
+ )),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/component/tool/CustomCard.dart b/lib/component/tool/CustomCard.dart
index 69b649f..2da20f7 100644
--- a/lib/component/tool/CustomCard.dart
+++ b/lib/component/tool/CustomCard.dart
@@ -1,6 +1,102 @@
+// import 'package:flutter/material.dart';
+// import 'package:vbvs_app/common/util/FitTool.dart';
+
+// class CustomCard extends StatefulWidget {
+// final double borderRadius; // 圆角
+// final VoidCallback onTap; // 点击回调
+// final List colors; // 背景颜色列表
+// final Widget child; // 子组件
+// final bool enableAnimation; // 是否启用动画效果
+// final bool enableGradient; // 是否启用渐变
+
+// const CustomCard({
+// Key? key,
+// required this.borderRadius,
+// required this.onTap,
+// required this.colors,
+// required this.child,
+// this.enableAnimation = true, // 默认启用动画效果
+// this.enableGradient = true, // 默认启用渐变效果
+// }) : super(key: key);
+
+// @override
+// State createState() => _CustomCardState();
+// }
+
+// class _CustomCardState extends State
+// with SingleTickerProviderStateMixin {
+// double _scale = 1.0;
+// final Duration _animationDuration = const Duration(milliseconds: 50);
+
+// Future _handleTap() async {
+// if (widget.enableAnimation) {
+// setState(() {
+// _scale = 0.95;
+// });
+
+// await Future.delayed(_animationDuration);
+
+// setState(() {
+// _scale = 1.0;
+// });
+// }
+
+// widget.onTap();
+// }
+
+// @override
+// Widget build(BuildContext context) {
+// final bool isGradient = widget.enableGradient && widget.colors.length > 1;
+// final Color baseColor = widget.colors.first;
+
+// return Material(
+// color: Colors.transparent,
+// borderRadius: BorderRadius.circular(widget.borderRadius),
+// child: InkWell(
+// onTap: _handleTap,
+// borderRadius: BorderRadius.circular(widget.borderRadius),
+// splashColor: widget.colors.first.withOpacity(0.2),
+// child: widget.enableAnimation
+// ? AnimatedScale(
+// scale: _scale,
+// duration: _animationDuration,
+// curve: Curves.easeInOut,
+// child: _buildContent(isGradient, baseColor),
+// )
+// : _buildContent(isGradient, baseColor),
+// ),
+// );
+// }
+
+// Widget _buildContent(bool isGradient, Color baseColor) {
+// return Container(
+// decoration: BoxDecoration(
+// color: isGradient ? null : baseColor,
+// gradient: isGradient
+// ? LinearGradient(
+// colors: widget.colors,
+// begin: Alignment.topLeft,
+// end: Alignment.bottomRight,
+// )
+// : null,
+// borderRadius: BorderRadius.circular(widget.borderRadius),
+// ),
+// child: Padding(
+// padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 5.rpx),
+// child: widget.child,
+// ),
+// );
+// }
+// }
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
+/// 枚举控制渐变方向
+enum GradientDirection {
+ horizontal,
+ vertical,
+}
+
class CustomCard extends StatefulWidget {
final double borderRadius; // 圆角
final VoidCallback onTap; // 点击回调
@@ -8,6 +104,8 @@ class CustomCard extends StatefulWidget {
final Widget child; // 子组件
final bool enableAnimation; // 是否启用动画效果
final bool enableGradient; // 是否启用渐变
+ final GradientDirection gradientDirection; // 渐变方向
+ final EdgeInsetsGeometry? margin; // 外部间距
const CustomCard({
Key? key,
@@ -15,8 +113,10 @@ class CustomCard extends StatefulWidget {
required this.onTap,
required this.colors,
required this.child,
- this.enableAnimation = true, // 默认启用动画效果
- this.enableGradient = true, // 默认启用渐变效果
+ this.enableAnimation = true,
+ this.enableGradient = true,
+ this.gradientDirection = GradientDirection.horizontal,
+ this.margin,
}) : super(key: key);
@override
@@ -49,21 +149,24 @@ class _CustomCardState extends State
final bool isGradient = widget.enableGradient && widget.colors.length > 1;
final Color baseColor = widget.colors.first;
- return Material(
- color: Colors.transparent,
- borderRadius: BorderRadius.circular(widget.borderRadius),
- child: InkWell(
- onTap: _handleTap,
+ return Container(
+ margin: widget.margin, // 应用外部间距
+ child: Material(
+ color: Colors.transparent,
borderRadius: BorderRadius.circular(widget.borderRadius),
- splashColor: widget.colors.first.withOpacity(0.2),
- child: widget.enableAnimation
- ? AnimatedScale(
- scale: _scale,
- duration: _animationDuration,
- curve: Curves.easeInOut,
- child: _buildContent(isGradient, baseColor),
- )
- : _buildContent(isGradient, baseColor),
+ child: InkWell(
+ onTap: _handleTap,
+ borderRadius: BorderRadius.circular(widget.borderRadius),
+ splashColor: widget.colors.first.withOpacity(0.2),
+ child: widget.enableAnimation
+ ? AnimatedScale(
+ scale: _scale,
+ duration: _animationDuration,
+ curve: Curves.easeInOut,
+ child: _buildContent(isGradient, baseColor),
+ )
+ : _buildContent(isGradient, baseColor),
+ ),
),
);
}
@@ -75,14 +178,18 @@ class _CustomCardState extends State
gradient: isGradient
? LinearGradient(
colors: widget.colors,
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
+ begin: widget.gradientDirection == GradientDirection.vertical
+ ? Alignment.topCenter
+ : Alignment.centerLeft,
+ end: widget.gradientDirection == GradientDirection.vertical
+ ? Alignment.bottomCenter
+ : Alignment.centerRight,
)
: null,
borderRadius: BorderRadius.circular(widget.borderRadius),
),
child: Padding(
- padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 5.rpx),
+ padding: EdgeInsets.fromLTRB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
child: widget.child,
),
);
diff --git a/lib/controller/main_bottom/main_page_b_controller.dart b/lib/controller/main_bottom/main_page_b_controller.dart
new file mode 100644
index 0000000..ae22364
--- /dev/null
+++ b/lib/controller/main_bottom/main_page_b_controller.dart
@@ -0,0 +1,31 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:vbvs_app/controller/main_bottom/main_page_controller.dart';
+part 'main_page_b_controller.g.dart';
+
+@JsonSerializable()
+class MainPageBModel {
+ int currentIndex = 0;
+ MainPageBModel();
+ factory MainPageBModel.fromJson(Map json) {
+ try {
+ return _$MainPageBModelFromJson(json);
+ } catch (e) {
+ // 在实际应用中,应该有更细致的异常处理策略和错误日志
+ return MainPageBModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
+ }
+ }
+
+ // 序列化为JSON时的异常处理
+ Map toJson() => _$MainPageBModelToJson(this);
+}
+
+class MainPageBController extends GetControllerEx {
+ MainPageBController() {
+ attr = GetModel(MainPageBModel()).obs;
+ }
+
+ resetParm() {
+ model.currentIndex = 0;
+ }
+}
diff --git a/lib/controller/main_bottom/main_page_b_controller.g.dart b/lib/controller/main_bottom/main_page_b_controller.g.dart
new file mode 100644
index 0000000..390ec91
--- /dev/null
+++ b/lib/controller/main_bottom/main_page_b_controller.g.dart
@@ -0,0 +1,15 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'main_page_b_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+MainPageBModel _$MainPageBModelFromJson(Map json) =>
+ MainPageBModel()..currentIndex = (json['currentIndex'] as num).toInt();
+
+Map _$MainPageBModelToJson(MainPageBModel instance) =>
+ {
+ 'currentIndex': instance.currentIndex,
+ };
diff --git a/lib/controller/mh/address_controller.dart b/lib/controller/mh/address_controller.dart
new file mode 100644
index 0000000..63b2f10
--- /dev/null
+++ b/lib/controller/mh/address_controller.dart
@@ -0,0 +1,155 @@
+import 'package:ef/ef.dart';
+import 'package:flutter_city_picker/model/address.dart';
+import 'package:flutterflow_ui/flutterflow_ui.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:vbvs_app/controller/mh/user_data.dart';
+import 'package:vbvs_app/controller/mh/muser_info_controller.dart';
+
+part 'address_controller.g.dart';
+
+@JsonSerializable()
+class AddressModel {
+ //版本id
+ String? province; //省份
+ String? city; //市
+ String? county; //区
+ String? street; //街道
+ String? detail; //详细信息
+ String? name; //名字
+ String? phone; //手机号
+ bool? ischecked = false; //是否默认
+
+ int currentType = 0;
+ String? all_address;
+ @JsonKey(ignore: true)
+ List? addressList = [];
+
+ AddressModel();
+
+ static AddressModel fromJson(Map json) =>
+ _$AddressModelFromJson(json);
+ Map toJson() => _$AddressModelToJson(this);
+}
+
+class AddressController extends GetControllerEx {
+ AddressController() {
+ attr = GetModel(AddressModel()).obs;
+ }
+
+ Future updateAddress(
+ Map address, AddressModel model) async {
+ if (model.addressList != null && model.addressList!.isNotEmpty) {
+ if (model.addressList!.length > 0) {
+ address["province"] = model.addressList![0].name; // 第一个元素为省
+ }
+ if (model.addressList!.length > 1) {
+ address["city"] = model.addressList![1].name; // 第二个元素为市
+ }
+ if (model.addressList!.length > 2) {
+ address["county"] = model.addressList![2].name; // 第三个元素为区
+ }
+ if (model.addressList!.length > 3) {
+ address["street"] = model.addressList![3].name; // 第四个元素为街道
+ }
+ }
+ address['detail'] = model.detail;
+ address['name'] = model.name;
+ address['phone'] = model.phone;
+ address['isChecked'] = model.ischecked;
+
+ try {
+ final data = await ef.client.rpc("get_now_datetime");
+ final response = await ef.client.from("app_user_address").update({
+ 'province': address["province"],
+ 'city': address["city"],
+ 'county': address["county"],
+ 'street': address["street"],
+ 'detail': address["detail"],
+ 'name': address["name"],
+ 'phone': address["phone"],
+ 'ischecked': address['isChecked'] ? 1 : 0,
+ 'update_time':
+ DateFormat("yyyy-MM-dd HH:mm:ss").parse("$data").toString(),
+ }).eq("id", address['id']);
+ } catch (e) {
+ print('Error fetching repairs: $e');
+ return e.toString();
+ }
+ return '';
+ }
+
+ addAddress(AddressModel model) async {
+ try {
+ final MUserInfoController userInfoController =
+ Get.find();
+ UserModel user = userInfoController.model.user!;
+
+ // 设置省市区街道名称
+ if (model.addressList != null && model.addressList!.isNotEmpty) {
+ if (model.addressList!.length > 0)
+ model.province = model.addressList![0].name; // 第一个元素为省
+ if (model.addressList!.length > 1)
+ model.city = model.addressList![1].name; // 第二个元素为市
+ if (model.addressList!.length > 2)
+ model.county = model.addressList![2].name; // 第三个元素为区
+ if (model.addressList!.length > 3)
+ model.street = model.addressList![3].name; // 第四个元素为街道
+ }
+
+ // 查询数据库是否已有该用户的地址
+ final existingAddresses = await ef.client
+ .from('app_user_address')
+ .select()
+ .eq('user_id', user.uid!);
+
+ // 如果没有地址,将新增地址默认选中
+ if (existingAddresses.isEmpty) {
+ model.ischecked = true;
+ } else if (model.ischecked == true) {
+ // 如果新地址被选中,将其他地址的 `ischecked` 字段设为 `0`
+ await ef.client
+ .from('app_user_address')
+ .update({'ischecked': 0}).eq('user_id', user.uid!);
+ }
+
+ // 添加新地址
+ final response = await ef.client.from('app_user_address').insert({
+ 'province': model.province,
+ 'city': model.city,
+ 'county': model.county,
+ 'street': model.street,
+ 'detail': model.detail,
+ 'name': model.name,
+ 'phone': model.phone,
+ 'ischecked': model.ischecked! ? 1 : 0,
+ 'user_id': user.uid,
+ });
+ } catch (e) {
+ print(e);
+ }
+ }
+
+ Future> getData({int? level, int? pid}) async {
+ // 构建查询
+ var query = ef.from("app_area_city").select();
+
+ // 如果 pid 不为 null,添加 pid 的条件
+ if (pid != null) {
+ query = query.eq("pid", pid);
+ }
+ if (level != null) {
+ query = query.eq("deep", level);
+ }
+ List arr = await query;
+
+ List addressNodes = arr.map((item) {
+ return AddressNode.fromJson({
+ "name": item["ext_name"], // ext_name 对应 name
+ "code": item["id"], // id 对应 code
+ "letter": item["pinyin_prefix_upper"], // pinyin_prefix_upper 对应 letter
+ });
+ }).toList();
+
+ return addressNodes;
+ }
+}
diff --git a/lib/controller/mh/address_controller.g.dart b/lib/controller/mh/address_controller.g.dart
new file mode 100644
index 0000000..2e0927c
--- /dev/null
+++ b/lib/controller/mh/address_controller.g.dart
@@ -0,0 +1,33 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'address_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+AddressModel _$AddressModelFromJson(Map json) => AddressModel()
+ ..province = json['province'] as String?
+ ..city = json['city'] as String?
+ ..county = json['county'] as String?
+ ..street = json['street'] as String?
+ ..detail = json['detail'] as String?
+ ..name = json['name'] as String?
+ ..phone = json['phone'] as String?
+ ..ischecked = json['ischecked'] as bool?
+ ..currentType = (json['currentType'] as num).toInt()
+ ..all_address = json['all_address'] as String?;
+
+Map _$AddressModelToJson(AddressModel instance) =>
+ {
+ 'province': instance.province,
+ 'city': instance.city,
+ 'county': instance.county,
+ 'street': instance.street,
+ 'detail': instance.detail,
+ 'name': instance.name,
+ 'phone': instance.phone,
+ 'ischecked': instance.ischecked,
+ 'currentType': instance.currentType,
+ 'all_address': instance.all_address,
+ };
diff --git a/lib/controller/mh/address_list_controller.dart b/lib/controller/mh/address_list_controller.dart
new file mode 100644
index 0000000..25b0456
--- /dev/null
+++ b/lib/controller/mh/address_list_controller.dart
@@ -0,0 +1,64 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+
+part 'address_list_controller.g.dart';
+
+@JsonSerializable()
+class AddressListModel {
+ List addressList = [];
+ Map address = {}; //之前控制的设备
+
+ int? type = 1; //1添加,2编辑
+
+ AddressListModel();
+
+ static AddressListModel fromJson(Map json) =>
+ _$AddressListModelFromJson(json);
+ Map toJson() => _$AddressListModelToJson(this);
+}
+
+class AddressListController extends GetControllerEx {
+ AddressListController() {
+ attr = GetModel(AddressListModel()).obs;
+ }
+
+ // getAddressList() async {
+ // await ApiService.request.get("/api/address/info/list").then((d) {
+ // model.addressList = d.data["data"] ?? [];
+ // updateAll();
+ // }).catchError((e) {
+ // print("$e");
+ // });
+ // }
+
+ // //更新默认
+ // Future updateDefault(address) async {
+ // var id = address['id'];
+ // var uid = address['userId'];
+ // try {
+ // await ef.client
+ // .from("app_user_address")
+ // .update({
+ // 'ischecked': 0,
+ // })
+ // .eq("user_id", address['userId'])
+ // .eq("ischecked", 1);
+ // await ef.client.from("app_user_address").update({
+ // 'ischecked': 1,
+ // }).eq("id", address['id']);
+ // } catch (e) {
+ // print('Error fetching repairs: $e');
+ // }
+ // }
+
+ // // 删除地址
+ // Future deleteAddress(String id) async {
+ // try {
+ // await ef.client.from("app_user_address").delete().eq("id", id);
+ // print("Address with ID $id has been successfully deleted.");
+ // } catch (e) {
+ // print("Error deleting address with ID $id: $e");
+ // }
+ // }
+}
diff --git a/lib/controller/mh/address_list_controller.g.dart b/lib/controller/mh/address_list_controller.g.dart
new file mode 100644
index 0000000..316d37c
--- /dev/null
+++ b/lib/controller/mh/address_list_controller.g.dart
@@ -0,0 +1,20 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'address_list_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+AddressListModel _$AddressListModelFromJson(Map json) =>
+ AddressListModel()
+ ..addressList = json['addressList'] as List
+ ..address = json['address'] as Map
+ ..type = (json['type'] as num?)?.toInt();
+
+Map _$AddressListModelToJson(AddressListModel instance) =>
+ {
+ 'addressList': instance.addressList,
+ 'address': instance.address,
+ 'type': instance.type,
+ };
diff --git a/lib/controller/mh/apply_repair_controller.dart b/lib/controller/mh/apply_repair_controller.dart
new file mode 100644
index 0000000..f3e2acc
--- /dev/null
+++ b/lib/controller/mh/apply_repair_controller.dart
@@ -0,0 +1,198 @@
+import 'dart:io';
+
+import 'package:ef/ef.dart';
+import 'package:flutter/src/widgets/framework.dart';
+import 'package:flutterflow_ui/flutterflow_ui.dart';
+import 'package:img_picker/img_picker.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+import 'package:path/path.dart' as p;
+import 'package:uuid/uuid.dart';
+import 'package:vbvs_app/common/util/MyUtils.dart';
+
+import 'muser_info_controller.dart';
+
+part 'apply_repair_controller.g.dart';
+
+@JsonSerializable()
+class ApplyRepairModel {
+ int? id; //报修id
+ String? apply_name; //申请人名称
+ String? tel; //手机号
+ String? address; //地址
+ String? desc; //问题描述
+ DateTime? create_time; //创建时间
+
+ String? device_type; //类型 床,床垫 不能为空
+ String? device_category; //型号 不能为空
+ String? device_id; //序列号 设备id 不能为空
+
+ String? device_name; //名称 可为空
+
+ List? issue_img = []; //图片
+ int? imagesLImit = 3; //图片限制上传数量
+ String? img_bucket = 'mianhuatang_repair';
+
+ String? status; //维修状态
+
+ String? select_device;
+ // String? select_type;
+ // List? device_list = ['床垫/BY-H/智能床垫', '床垫/BY-A/智能床垫', '床垫/BY-C/智能床垫'];
+ List? device_list = [];
+ int? score;
+ DateTime? score_time; //创建时间
+
+ int? messageType = 1; //消息类型
+ int? repairId; //消息类型
+
+ ApplyRepairModel();
+ static ApplyRepairModel fromJson(Map json) =>
+ _$ApplyRepairModelFromJson(json);
+ Map toJson() => _$ApplyRepairModelToJson(this);
+}
+
+class ApplyRepairController extends GetControllerEx {
+ // RepairRepository repairRepository = RepairRepository();
+ ApplyRepairController() {
+ attr = GetModel(ApplyRepairModel()).obs;
+ }
+
+ // //上传图片
+ // Future uploadImg() async {
+ // final ImagePicker picker = ImagePicker();
+ // final XFile? image = await picker.pickImage(source: ImageSource.gallery);
+ // final user = Supabase.instance.client.auth.currentUser;
+ // try {
+ // if (image != null) {
+ // int fileSize = await image.length(); // 获取图片大小,单位为字节
+ // if (fileSize > 1024 * 1024 * 5) {
+ // // 1 MB = 1024 * 1024 bytes
+ // showToast("上传图片不能超过5MB");
+ // return;
+ // }
+ // final filePath = image.path; // 获取文件路径
+ // final fileExtension = p.extension(filePath); // 获取文件扩展名,包括点(.)
+ // // 获取当前日期并格式化为 yyyy-MM-dd
+ // final String folderName =
+ // DateFormat('yyyy-MM-dd').format(DateTime.now());
+ // final file = File(image.path);
+ // // 构造文件路径,文件会被上传到 record_img 文件夹下的当天日期文件夹
+ // var response = await ef.client.storage
+ // .from(model.img_bucket!)
+ // .upload('$folderName/${Uuid().v4()}$fileExtension', file);
+ // if (response != null) {
+ // String publicUrl =
+ // ef.client.storage.from(model.img_bucket!).getPublicUrl(response);
+
+ // print('文件上传成功: $response');
+ // print('文件上传成功: $publicUrl');
+ // String prefixToRemove = 'mianhuatang_repair/';
+ // model.issue_img!.add(response.startsWith(prefixToRemove)
+ // ? response.substring(prefixToRemove.length)
+ // : response);
+ // updateAll();
+ // }
+ // print('/$model.img_bucket');
+ // } else {
+ // print('未选择图片');
+ // return;
+ // }
+ // } catch (e) {
+ // print('上传失败: $e');
+ // }
+ // }
+
+ // //提交
+ // Future submitRepair(BuildContext context) async {
+ // //tmp
+ // // return '';
+ // String message = '';
+ // final MyDialogController myDialogController =
+ // Get.find();
+ // if (model.device_type == null || model.device_type!.isEmpty) {
+ // message = '请选择设备类型!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.device_category == null || model.device_category!.isEmpty) {
+ // message = '请输入设备型号!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.device_id == null || model.device_id!.isEmpty) {
+ // message = '请输入设备序列号id!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.apply_name == null || model.apply_name!.isEmpty) {
+ // message = '请输入姓名!';
+ // showToast(message);
+ // return message;
+ // }
+ // RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$');
+
+ // if (!nameRegExp.hasMatch(model.apply_name!)) {
+ // message = '姓名必须为2到4个汉字!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.tel == null || model.tel!.isEmpty) {
+ // message = '请输入手机号!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (!MyUtils.isValidPhoneNumber(model.tel!)) {
+ // message = '无效的手机号!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.address == null || model.address!.isEmpty) {
+ // message = '请输入地址!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.desc == null || model.desc!.isEmpty) {
+ // message = '请输入问题描述!';
+ // showToast(message);
+ // return message;
+ // }
+ // if (model.issue_img == null || model.issue_img!.isEmpty) {
+ // message = '请至少上传一张问题图片!';
+ // showToast(message);
+ // return message;
+ // }
+ // model.status = RepairStatus.pending;
+ // await repairRepository.saveRepair(model);
+ // return message;
+ // }
+
+ // Future getDeviceList() async {
+ // final UserInfoController userInfoController =
+ // Get.find();
+ // // UserModel loginUser = userInfoController.model.user!;
+ // DeviceListController deviceListController = Get.find();
+ // await deviceListController.getDeviceList();
+ // var aa = deviceListController.model.deviceListWyf;
+ // ApplyRepairController applyRepairController = Get.find();
+ // applyRepairController.model.device_list = aa;
+ // }
+
+ // String getPublicUrl(String path) {
+ // try {
+ // String bucketPath = '${model.img_bucket}/';
+ // if (path.contains(bucketPath)) {
+ // int firstIndex = path.indexOf(bucketPath);
+ // // int secondIndex =
+ // // response.indexOf(bucketPath, firstIndex + bucketPath.length);
+ // if (firstIndex != -1) {
+ // // 去掉第一个存储桶路径
+ // path = path.replaceFirst(bucketPath, '', firstIndex);
+ // }
+ // }
+ // String publicUrl =
+ // ef.client.storage.from(model.img_bucket!).getPublicUrl(path);
+ // return publicUrl;
+ // } catch (e) {}
+ // return '';
+ // }
+}
diff --git a/lib/controller/mh/apply_repair_controller.g.dart b/lib/controller/mh/apply_repair_controller.g.dart
new file mode 100644
index 0000000..8a5b4d0
--- /dev/null
+++ b/lib/controller/mh/apply_repair_controller.g.dart
@@ -0,0 +1,60 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'apply_repair_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+ApplyRepairModel _$ApplyRepairModelFromJson(Map json) =>
+ ApplyRepairModel()
+ ..id = (json['id'] as num?)?.toInt()
+ ..apply_name = json['apply_name'] as String?
+ ..tel = json['tel'] as String?
+ ..address = json['address'] as String?
+ ..desc = json['desc'] as String?
+ ..create_time = json['create_time'] == null
+ ? null
+ : DateTime.parse(json['create_time'] as String)
+ ..device_type = json['device_type'] as String?
+ ..device_category = json['device_category'] as String?
+ ..device_id = json['device_id'] as String?
+ ..device_name = json['device_name'] as String?
+ ..issue_img = (json['issue_img'] as List?)
+ ?.map((e) => e as String)
+ .toList()
+ ..imagesLImit = (json['imagesLImit'] as num?)?.toInt()
+ ..img_bucket = json['img_bucket'] as String?
+ ..status = json['status'] as String?
+ ..select_device = json['select_device'] as String?
+ ..device_list = json['device_list'] as List?
+ ..score = (json['score'] as num?)?.toInt()
+ ..score_time = json['score_time'] == null
+ ? null
+ : DateTime.parse(json['score_time'] as String)
+ ..messageType = (json['messageType'] as num?)?.toInt()
+ ..repairId = (json['repairId'] as num?)?.toInt();
+
+Map _$ApplyRepairModelToJson(ApplyRepairModel instance) =>
+ {
+ 'id': instance.id,
+ 'apply_name': instance.apply_name,
+ 'tel': instance.tel,
+ 'address': instance.address,
+ 'desc': instance.desc,
+ 'create_time': instance.create_time?.toIso8601String(),
+ 'device_type': instance.device_type,
+ 'device_category': instance.device_category,
+ 'device_id': instance.device_id,
+ 'device_name': instance.device_name,
+ 'issue_img': instance.issue_img,
+ 'imagesLImit': instance.imagesLImit,
+ 'img_bucket': instance.img_bucket,
+ 'status': instance.status,
+ 'select_device': instance.select_device,
+ 'device_list': instance.device_list,
+ 'score': instance.score,
+ 'score_time': instance.score_time?.toIso8601String(),
+ 'messageType': instance.messageType,
+ 'repairId': instance.repairId,
+ };
diff --git a/lib/controller/mh/book_info_controller.dart b/lib/controller/mh/book_info_controller.dart
new file mode 100644
index 0000000..4b4420d
--- /dev/null
+++ b/lib/controller/mh/book_info_controller.dart
@@ -0,0 +1,74 @@
+import 'dart:convert';
+
+import 'package:ef/ef.dart';
+
+
+class BookInfoModel {
+ // DateTime? dateTime; //预约时间
+ String? userName; //预约人
+ String? userPhone; //预约电话
+ List time_period = []; //预约时段
+ // String? select_time; //选择时间
+ int? select_time_index; //选择时间
+
+ List datetimes = [];
+ int? datetimes_index;
+ Map dataT = {};
+
+ BookInfoModel();
+}
+
+class BookInfoController extends GetControllerEx {
+ BookInfoController() {
+ attr = GetModel(BookInfoModel()).obs;
+ }
+
+ // get userInfoController => Get.find();
+
+ // getData(id) {
+ // model.datetimes = [];
+ // model.datetimes_index = null;
+ // model.dataT = {};
+ // updateAll();
+ // ApiService.reservation.get("/agent/userBook/config/detailConfigByStore?storeId=$id")
+ // .then((d) {
+ // model.datetimes = d.data["dateList"];
+ // model.datetimes_index = 0;
+ // model.dataT = d.data;
+ // time_periodChange();
+ // });
+ // }
+
+ // time_periodChange() {
+ // if(model.datetimes_index == null) {
+ // return;
+ // }
+ // model.select_time_index = null;
+ // model.time_period = model.dataT[model.datetimes?[model.datetimes_index!]["day"]];
+ // updateAll();
+ // }
+
+ // submitData(id) {
+ // String tel = userInfoController.model?.user?.tel ?? "";
+ // if(tel.isEmpty) {
+ // showToast("用户未存在手机号");
+ // return;
+ // }
+ // return ApiService.reservation.post("/agent/userBook/submitBook", data: {
+ // "extUserId": tel,
+ // "storeId": id,
+ // "realName": model.userName,
+ // "userPhone": model.userPhone,
+ // "bookDateId": model.time_period[model.select_time_index!]["id"]
+ // });
+ // }
+
+ // messageAdd(Map data) {
+ // return ApiService.request.post("/api/message/info", data: {
+ // "type": 0,
+ // "status": 1,
+ // "read": 1,
+ // "data": jsonEncode(data)
+ // });
+ // }
+}
diff --git a/lib/controller/mh/experience_store_list_page.dart b/lib/controller/mh/experience_store_list_page.dart
new file mode 100644
index 0000000..c856721
--- /dev/null
+++ b/lib/controller/mh/experience_store_list_page.dart
@@ -0,0 +1,125 @@
+import 'dart:ui';
+
+import 'package:ef/ef.dart';
+
+
+import 'package:json_annotation/json_annotation.dart';
+
+part 'experience_store_list_page.g.dart';
+
+@JsonSerializable()
+class ExperienceStoreListModel {
+ List experienceStoreModelList = []; //体验店列
+
+ @JsonKey(ignore: true)
+ String? keyword = '';
+ @JsonKey(ignore: true)
+ Color? color = Color(0xFFFFFFFF);
+
+ ExperienceStoreListModel();
+ // static ExperienceStoreListModel fromJson(Map json) =>
+ // _$ExperienceStoreListModelFromJson(json);
+ // Map toJson() => _$ExperienceStoreListModelToJson(this);
+}
+
+class ExperienceStoreListController
+ extends GetControllerEx {
+ ExperienceStoreListController() {
+ attr = GetModel(ExperienceStoreListModel()).obs;
+ }
+
+ // Position? position;
+ // double latitude = 31.8512;
+ // double longitude = 117.26061;
+
+ // int total = 0;
+ // int page = 0;
+ // bool lock = false;
+
+
+ // resetParm() {
+ // position = null;
+ // total = 0;
+ // page = 0;
+ // lock = false;
+ // model.experienceStoreModelList = [];
+ // updateAll();
+ // }
+
+ // getData({int count = 10}) async {
+ // if (page != 0 && page * count > total) {
+ // return;
+ // }
+ // if (lock) {
+ // return;
+ // }
+ // if (page == 0) {
+ // position = await locationCheck();
+ // }
+ // lock = true;
+ // int page_ = page;
+ // ApiService.reservation
+ // .get(
+ // "/agent/userBook/config/getBookStoreList?storeName=${"${model.keyword}".isNotEmpty ? model.keyword : ''}&latitude=${position == null ? latitude : position?.latitude}&longitude=${position == null ? longitude : position?.longitude}&page=$page&size=$count&sort=distance")
+ // .then((d) {
+ // lock = false;
+ // if (page == 0) {
+ // model.experienceStoreModelList = d.data["records"];
+ // } else {
+ // int index = 0;
+ // d.data["records"]?.forEach((item) {
+ // if (model.experienceStoreModelList
+ // .indexWhere((item2) => item2["id"] == item["id"]) ==
+ // -1) {
+ // model.experienceStoreModelList.add(item);
+ // } else {
+ // model.experienceStoreModelList[index] = item;
+ // }
+ // index++;
+ // });
+ // }
+ // page = page_ + 1;
+ // total = d.data["total"];
+ // updateAll();
+ // }).catchError((d) {
+ // lock = false;
+ // });
+ // }
+
+ determinePosition() async {
+ // bool serviceEnabled;
+ // LocationPermission permission;
+
+ // // Test if location services are enabled.
+ // serviceEnabled = await Geolocator.isLocationServiceEnabled();
+ // if (!serviceEnabled) {
+ // // Location services are not enabled don't continue
+ // // accessing the position and request users of the
+ // // App to enable the location services.
+ // return Future.error('Location services are disabled.');
+ // }
+
+ // permission = await Geolocator.checkPermission();
+ // if (permission == LocationPermission.denied) {
+ // permission = await Geolocator.requestPermission();
+ // if (permission == LocationPermission.denied) {
+ // // Permissions are denied, next time you could try
+ // // requesting permissions again (this is also where
+ // // Android's shouldShowRequestPermissionRationale
+ // // returned true. According to Android guidelines
+ // // your App should show an explanatory UI now.
+ // return Future.error('Location permissions are denied');
+ // }
+ // }
+
+ // if (permission == LocationPermission.deniedForever) {
+ // // Permissions are denied forever, handle appropriately.
+ // return Future.error(
+ // 'Location permissions are permanently denied, we cannot request permissions.');
+ // }
+
+ // // When we reach here, permissions are granted and we can
+ // // continue accessing the position of the device.
+ // position = await Geolocator.getCurrentPosition();
+ }
+}
diff --git a/lib/controller/mh/experience_store_list_page.g.dart b/lib/controller/mh/experience_store_list_page.g.dart
new file mode 100644
index 0000000..6c658c4
--- /dev/null
+++ b/lib/controller/mh/experience_store_list_page.g.dart
@@ -0,0 +1,19 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'experience_store_list_page.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+ExperienceStoreListModel _$ExperienceStoreListModelFromJson(
+ Map json) =>
+ ExperienceStoreListModel()
+ ..experienceStoreModelList =
+ json['experienceStoreModelList'] as List;
+
+Map _$ExperienceStoreListModelToJson(
+ ExperienceStoreListModel instance) =>
+ {
+ 'experienceStoreModelList': instance.experienceStoreModelList,
+ };
diff --git a/lib/controller/mh/issue_controller.dart b/lib/controller/mh/issue_controller.dart
new file mode 100644
index 0000000..222a666
--- /dev/null
+++ b/lib/controller/mh/issue_controller.dart
@@ -0,0 +1,55 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:vbvs_app/common/color/appConstants.dart';
+
+part 'issue_controller.g.dart';
+
+@JsonSerializable()
+class IssueListModel {
+ List issueList = [];
+
+ int limit = AppConstants.limit;
+ int offset = 0;
+ bool isLoading = false;
+ bool hasMore = true;
+
+ int? selectedIndex;
+
+ IssueListModel();
+ static IssueListModel fromJson(Map json) =>
+ _$IssueListModelFromJson(json);
+ Map toJson() => _$IssueListModelToJson(this);
+}
+
+class IssueListController extends GetControllerEx {
+ // HelpRepository helpRepository = HelpRepository();
+ IssueListController() {
+ attr = GetModel(IssueListModel()).obs;
+ }
+
+
+ // //初始化列表数据
+ // Future initData() async {
+ // if (model.isLoading) {
+ // return;
+ // }
+ // model.isLoading = true;
+ // final List fetchedRepairs = await helpRepository.findHelpInfos(
+ // limit: model.limit, offset: model.offset);
+ // if (fetchedRepairs != null) {
+ // List infos = [];
+ // List tmp = fetchedRepairs as List;
+ // try {
+ // // infos = tmp.map((repair) => IssueModel.fromJson(repair)).toList();
+ // // model.issueList!.addAll(infos);
+ // model.issueList.addAll(tmp);
+ // } catch (e) {
+ // print('Error parsing JSON: $e');
+ // }
+ // }
+ // model.offset += model.limit; // 更新 offset,下一次查询跳过当前已经加载的记录
+ // model.hasMore = fetchedRepairs.length == model.limit; // 判断是否还有更多数据
+ // model.isLoading = false;
+ // updateAll();
+ // }
+}
diff --git a/lib/controller/mh/issue_controller.g.dart b/lib/controller/mh/issue_controller.g.dart
new file mode 100644
index 0000000..ac15cea
--- /dev/null
+++ b/lib/controller/mh/issue_controller.g.dart
@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'issue_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+IssueListModel _$IssueListModelFromJson(Map json) =>
+ IssueListModel()
+ ..issueList = json['issueList'] as List
+ ..limit = (json['limit'] as num).toInt()
+ ..offset = (json['offset'] as num).toInt()
+ ..isLoading = json['isLoading'] as bool
+ ..hasMore = json['hasMore'] as bool
+ ..selectedIndex = (json['selectedIndex'] as num?)?.toInt();
+
+Map _$IssueListModelToJson(IssueListModel instance) =>
+ {
+ 'issueList': instance.issueList,
+ 'limit': instance.limit,
+ 'offset': instance.offset,
+ 'isLoading': instance.isLoading,
+ 'hasMore': instance.hasMore,
+ 'selectedIndex': instance.selectedIndex,
+ };
diff --git a/lib/controller/mh/issue_preview_controller.dart b/lib/controller/mh/issue_preview_controller.dart
new file mode 100644
index 0000000..c436572
--- /dev/null
+++ b/lib/controller/mh/issue_preview_controller.dart
@@ -0,0 +1,20 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'issue_preview_controller.g.dart';
+
+@JsonSerializable()
+class IssuePreviewInfoModel {
+
+ IssuePreviewInfoModel();
+
+ static IssuePreviewInfoModel fromJson(Map json) =>
+ _$IssuePreviewInfoModelFromJson(json);
+ Map toJson() => _$IssuePreviewInfoModelToJson(this);
+}
+
+class IssuePreviewInfoController extends GetControllerEx {
+ IssuePreviewInfoController() {
+ attr = GetModel(IssuePreviewInfoModel()).obs;
+ }
+}
diff --git a/lib/controller/mh/issue_preview_controller.g.dart b/lib/controller/mh/issue_preview_controller.g.dart
new file mode 100644
index 0000000..c6cfbd1
--- /dev/null
+++ b/lib/controller/mh/issue_preview_controller.g.dart
@@ -0,0 +1,15 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'issue_preview_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+IssuePreviewInfoModel _$IssuePreviewInfoModelFromJson(
+ Map json) =>
+ IssuePreviewInfoModel();
+
+Map _$IssuePreviewInfoModelToJson(
+ IssuePreviewInfoModel instance) =>
+ {};
diff --git a/lib/controller/mh/message_controller.dart b/lib/controller/mh/message_controller.dart
new file mode 100644
index 0000000..f4389dd
--- /dev/null
+++ b/lib/controller/mh/message_controller.dart
@@ -0,0 +1,198 @@
+import 'dart:convert';
+
+import 'package:EasyDartModule/EasyDartModule.dart';
+import 'package:ef/ef.dart';
+import 'package:flutterflow_ui/flutterflow_ui.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/DailyLogUtils.dart';
+import 'package:vbvs_app/common/util/MyUtils.dart';
+import 'package:vbvs_app/model/api_response.dart';
+
+part 'message_controller.g.dart'; // 由json_serializable自动生成的部分
+
+@JsonSerializable()
+class MhMessageModel {
+ int? type = 1; //设备类型 1:体征消息 2.系统消息
+ int? body_message_read = 0; //体征消息 0:已读 1:未读
+ int? system_message_read = 0; //系统消息 0:已读 1:未读
+
+ MhMessageModel();
+
+ // 从JSON反序列化时的异常处理
+
+ factory MhMessageModel.fromJson(Map json) {
+ try {
+ return _$MhMessageModelFromJson(json);
+ } catch (e) {
+ // 在实际应用中,应该有更细致的异常处理策略和错误日志
+ return MhMessageModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
+ }
+ }
+
+ // 序列化为JSON时的异常处理
+ Map toJson() => _$MhMessageModelToJson(this);
+}
+
+class MhMessageController extends GetControllerEx {
+ MhMessageController() {
+ attr = GetModel(MhMessageModel()).obs;
+ }
+
+ RxList messageList = [].obs;
+
+ Future getMessageList({String? key}) async {
+ try {
+ ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
+ String serviceAddress = ServiceConstant.service_address;
+ String serviceName = ServiceConstant.server_service;
+ String serviceApi = ServiceConstant.message_list;
+ String messageType = "app_system";
+ if (model.type == 1) {
+ messageType = "app_body";
+ } else {
+ messageType = "app_system";
+ }
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}?type=${messageType}";
+ String? language = "";
+ if (languageController.selectLanguage != null) {
+ language = languageController.selectLanguage.value!.language_code;
+ }
+ if (language != null && language.isNotEmpty) {
+ if (queryUrl.contains("?")) {
+ queryUrl += "&lang=$language";
+ } else {
+ queryUrl += "?lang=$language";
+ }
+ }
+ var response = await EasyDartModule.dio.get(queryUrl);
+ if (response != null) {
+ var responseData =
+ response.data is String ? jsonDecode(response.data) : response.data;
+ ApiResponse res =
+ ApiResponse.fromJson(responseData, (object) => object);
+ MyUtils.formatResponse(res, "请求成功".tr, "请求失败".tr);
+ if (res.code == HttpStatusCodes.ok) {
+ updateAll();
+ messageList.value = res.data;
+ return res;
+ }
+ } else {
+ return ApiResponse(code: -1, msg: "服务器.失败".tr);
+ }
+ return apiResponse;
+ } catch (e) {
+ EasyDartModule.logger.info("设备请求列表: $e");
+ DailyLogUtils.writeLog("设备请求列表: $e");
+ }
+ return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
+ }
+
+ //获取消息已读未读
+ Future getMessageStatus() async {
+ try {
+ ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
+ // return apiResponse;
+ String serviceAddress = ServiceConstant.service_address;
+ String serviceName = ServiceConstant.server_service;
+ String serviceApi = ServiceConstant.message_read;
+
+ String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
+ String? language = "";
+ if (languageController.selectLanguage != null) {
+ language = languageController.selectLanguage.value!.language_code;
+ }
+ if (language != null && language.isNotEmpty) {
+ if (queryUrl.contains("?")) {
+ queryUrl += "&lang=$language";
+ } else {
+ queryUrl += "?lang=$language";
+ }
+ }
+ var response = await EasyDartModule.dio.get(queryUrl);
+ if (response != null) {
+ var responseData =
+ response.data is String ? jsonDecode(response.data) : response.data;
+ ApiResponse res =
+ ApiResponse.fromJson(responseData, (object) => object);
+ MyUtils.formatResponse(res, "请求成功".tr, "请求失败".tr);
+ if (res.code == HttpStatusCodes.ok) {
+ updateAll();
+ List dataList = res.data;
+
+ // 查找 type 为 app_vsm 的项
+ var vsmItem = dataList.firstWhere(
+ (e) => e['type'] == 'app_vsm',
+ orElse: () => null,
+ );
+ model.body_message_read = vsmItem?['count'] ?? 0;
+
+ // 查找 type 为 app_system 的项
+ var systemItem = dataList.firstWhere(
+ (e) => e['type'] == 'app_system',
+ orElse: () => null,
+ );
+ model.system_message_read = systemItem?['count'] ?? 0;
+
+ updateAll();
+ return res;
+ }
+ } else {
+ return ApiResponse(code: -1, msg: "服务器.失败".tr);
+ }
+ return apiResponse;
+ } catch (e) {
+ EasyDartModule.logger.info("获取消息已读未读: $e");
+ DailyLogUtils.writeLog("获取消息已读未读: $e");
+ }
+ return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
+ }
+
+ //更新消息已读
+ Future updateMessageStatus({String? type}) async {
+ EasyDartModule.logger.info("更新消息已读状态");
+ DailyLogUtils.writeLog("更新消息已读状态");
+ try {
+ ApiResponse apiResponse = ApiResponse(code: -1, msg: "操作失败".tr);
+ String serviceAddress = ServiceConstant.service_address;
+ String serviceName = ServiceConstant.server_service;
+ String serviceApi = ServiceConstant.message_read;
+
+ // 拼接 URL,添加 type 参数
+ String queryUrl = "$serviceAddress$serviceName$serviceApi";
+ if (type != null && type.isNotEmpty) {
+ queryUrl += "?type=$type";
+ }
+
+ String? language = "";
+ if (languageController.selectLanguage != null) {
+ language = languageController.selectLanguage.value!.language_code;
+ }
+ if (language != null && language.isNotEmpty) {
+ if (queryUrl.contains("?")) {
+ queryUrl += "&lang=$language";
+ } else {
+ queryUrl += "?lang=$language";
+ }
+ }
+ var response = await EasyDartModule.dio.post(queryUrl);
+
+ if (response != null) {
+ var responseData =
+ response.data is String ? jsonDecode(response.data) : response.data;
+ ApiResponse res =
+ ApiResponse.fromJson(responseData, (object) => object);
+ MyUtils.formatResponse(res, "操作成功".tr, "操作成功".tr);
+ return res;
+ } else {
+ return ApiResponse(code: -1, msg: "服务器.失败".tr);
+ }
+ } catch (e) {
+ EasyDartModule.logger.info("更新消息已读状态->$e");
+ DailyLogUtils.writeLog("更新消息已读状态->$e");
+ return ApiResponse(code: -1, msg: "服务器.失败".tr);
+ }
+ }
+}
diff --git a/lib/controller/mh/message_controller.g.dart b/lib/controller/mh/message_controller.g.dart
new file mode 100644
index 0000000..564e51f
--- /dev/null
+++ b/lib/controller/mh/message_controller.g.dart
@@ -0,0 +1,20 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'message_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+MhMessageModel _$MhMessageModelFromJson(Map json) =>
+ MhMessageModel()
+ ..type = (json['type'] as num?)?.toInt()
+ ..body_message_read = (json['body_message_read'] as num?)?.toInt()
+ ..system_message_read = (json['system_message_read'] as num?)?.toInt();
+
+Map _$MhMessageModelToJson(MhMessageModel instance) =>
+ {
+ 'type': instance.type,
+ 'body_message_read': instance.body_message_read,
+ 'system_message_read': instance.system_message_read,
+ };
diff --git a/lib/controller/mh/muser_info_controller.dart b/lib/controller/mh/muser_info_controller.dart
new file mode 100644
index 0000000..96fb747
--- /dev/null
+++ b/lib/controller/mh/muser_info_controller.dart
@@ -0,0 +1,177 @@
+import 'dart:io';
+
+import 'package:ef/ef.dart';
+import 'package:fluwx/fluwx.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+import 'package:path/path.dart' as p;
+
+import 'package:vbvs_app/controller/mh/user_data.dart';
+part 'muser_info_controller.g.dart';
+
+@JsonSerializable()
+class MUserInfoModel {
+ int? message = 0; //消息数量
+
+ UserModel? user; //用户信息
+ String? token; //token值
+ String? runSystem; //运行系统
+ String? phoneVersion; //手机版本
+ String? deviceId; //手机唯一
+ String? deviceModel; //设备可见型号(如 "iPhone","iPad")
+ String? appVersion; //app版本信息
+
+ @JsonKey(ignore: true)
+ Session? superbase_session;
+ @JsonKey(ignore: true)
+ User? superbase_user;
+
+ String? img_bucket = 'user';
+ int? login = 0; //是否登录0:未登录 1:已登录
+
+ MUserInfoModel();
+ static MUserInfoModel fromJson(Map json) =>
+ _$MUserInfoModelFromJson(json);
+ Map toJson() => _$MUserInfoModelToJson(this);
+}
+
+class MUserInfoController extends GetControllerEx {
+ // 初始化实例
+ final Fluwx fluwx = Fluwx();
+
+ MUserInfoController() {
+ attr = GetModel(MUserInfoModel()).obs;
+ }
+
+ // Future uploadImg() async {
+ // final ImagePicker picker = ImagePicker();
+ // final XFile? image = await picker.pickImage(source: ImageSource.gallery);
+ // final user = Supabase.instance.client.auth.currentUser;
+ // try {
+ // if (image != null) {
+ // int fileSize = await image.length(); // 获取图片大小,单位为字节
+ // if (fileSize > 1048576) {
+ // // 1 MB = 1024 * 1024 bytes
+ // showToast("头像图片不能超过1MB");
+ // return;
+ // }
+ // final filePath = image.path; // 获取文件路径
+ // final fileExtension = p.extension(filePath); // 获取文件扩展名,包括点(.)
+ // // 获取当前日期并格式化为 yyyy-MM-dd
+ // final String folderName =
+ // DateFormat('yyyy-MM-dd').format(DateTime.now());
+ // final file = File(image.path);
+ // // 构造文件路径,文件会被上传到 record_img 文件夹下的当天日期文件夹
+ // var response = await ef.client.storage
+ // .from(model.img_bucket!)
+ // .upload('$folderName/${Uuid().v4()}$fileExtension', file);
+ // if (response != null) {
+ // String publicUrl =
+ // ef.client.storage.from(model.img_bucket!).getPublicUrl(response);
+
+ // print('文件上传成功: $response');
+ // print('文件上传成功: $publicUrl');
+ // String prefixToRemove = 'user/';
+ // // model.user!.tmpHead = model.user!.head;
+ // model.user!.tmpHead = publicUrl.startsWith(prefixToRemove)
+ // ? response.substring(prefixToRemove.length)
+ // : response;
+ // updateAll();
+ // }
+ // print('/$model.img_bucket');
+ // } else {
+ // print('未选择图片');
+ // return;
+ // }
+ // } catch (e) {
+ // print('上传失败: $e');
+ // }
+ // }
+
+ // updateData() {
+ // UserInfoController controller = Get.find();
+ // UserRepository userRepository = UserRepository();
+ // return userRepository.updateInfo(controller.model.user!);
+ // }
+
+ // autoLogin(String token) async {
+ // final UserInfoController userInfoController = Get.find();
+ // try {
+ // final Map requestBody = {
+ // 'token': token,
+ // };
+
+ // var response = await ApiService.request
+ // .post("/api/auth/account/info/autoLogin", data: requestBody);
+ // if (response.statusCode == 200) {
+ // if (response.data != null) {
+ // ApiResponse apiResponse = ApiResponse.fromJson(
+ // response.data,
+ // (json) => UserModel.fromJson(json as Map));
+ // if (apiResponse.code == HttpStatusCodes.ok) {
+ // userInfoController.model.user = apiResponse.data;
+ // userInfoController.model.token = response.headers['token']!.first;
+ // userInfoController.model.login = 1;
+
+ // final box = GetStorage();
+ // box.write(
+ // 'user', userInfoController.model.user!.toJson()); // 存储用户信息
+ // box.write('token', userInfoController.model.token); // 存储 token
+ // String efPd = await getValueBySysConfigKey(CommonVariables.efKey);
+ // if (efPd != null && efPd.isNotEmpty) {
+ // await initDataEf(key: efPd);
+ // } else {
+ // print("efPD为空,无法初始化");
+ // // 清除本地缓存
+ // final box = GetStorage();
+ // box.remove('user');
+ // box.remove('token');
+ // userInfoController.model.token = null;
+ // userInfoController.model.user = null;
+ // // 设置成未登录
+ // userInfoController.model.login = 0;
+ // return;
+ // }
+
+ // final AuthResponse res = await ef.client.auth.signInWithPassword(
+ // phone: userInfoController.model.user!.tel,
+ // password: userInfoController.model.user!.exp1!,
+ // );
+ // userInfoController.model.superbase_session = res.session;
+ // userInfoController.model.superbase_user = res.user;
+ // userInfoController.updateAll();
+ // // 登录成功移出网络检查监听
+ // Checknetwork.subscription?.cancel();
+ // }
+ // }
+ // } else {
+ // // 处理非 200 响应
+ // print('Failed to sign in. Status code: ${response.statusCode}');
+ // print('Response data: ${response.data}');
+ // }
+ // } catch (e) {
+ // e.printError();
+ // // 清除本地缓存
+ // final box = GetStorage();
+ // box.remove('user');
+ // box.remove('token');
+ // userInfoController.model.token = null;
+ // userInfoController.model.user = null;
+ // // 设置成未登录
+ // userInfoController.model.login = 0;
+ // }
+ // }
+
+ // // 拉起微信企业客服
+ // Future openWeChatCustomerService() async {
+ // bool isWeChatInstalled = await fluwx.isWeChatInstalled;
+ // if (!isWeChatInstalled) {
+ // showToast("请先安装微信APP,再联系客服", color: color_error);
+ // return;
+ // }
+ // showToast('正在打开微信客服...', color: color_success);
+ // await fluwx.open(
+ // target: CustomerServiceChat(
+ // corpId: CommonVariables.wxCorpId, url: CommonVariables.wxKfUrl));
+ // }
+}
diff --git a/lib/controller/mh/muser_info_controller.g.dart b/lib/controller/mh/muser_info_controller.g.dart
new file mode 100644
index 0000000..1dc29be
--- /dev/null
+++ b/lib/controller/mh/muser_info_controller.g.dart
@@ -0,0 +1,36 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'muser_info_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+MUserInfoModel _$MUserInfoModelFromJson(Map json) =>
+ MUserInfoModel()
+ ..message = (json['message'] as num?)?.toInt()
+ ..user = json['user'] == null
+ ? null
+ : UserModel.fromJson(json['user'] as Map)
+ ..token = json['token'] as String?
+ ..runSystem = json['runSystem'] as String?
+ ..phoneVersion = json['phoneVersion'] as String?
+ ..deviceId = json['deviceId'] as String?
+ ..deviceModel = json['deviceModel'] as String?
+ ..appVersion = json['appVersion'] as String?
+ ..img_bucket = json['img_bucket'] as String?
+ ..login = (json['login'] as num?)?.toInt();
+
+Map _$MUserInfoModelToJson(MUserInfoModel instance) =>
+ {
+ 'message': instance.message,
+ 'user': instance.user,
+ 'token': instance.token,
+ 'runSystem': instance.runSystem,
+ 'phoneVersion': instance.phoneVersion,
+ 'deviceId': instance.deviceId,
+ 'deviceModel': instance.deviceModel,
+ 'appVersion': instance.appVersion,
+ 'img_bucket': instance.img_bucket,
+ 'login': instance.login,
+ };
diff --git a/lib/controller/mh/my_experience_list_controller.dart b/lib/controller/mh/my_experience_list_controller.dart
new file mode 100644
index 0000000..b4b7c41
--- /dev/null
+++ b/lib/controller/mh/my_experience_list_controller.dart
@@ -0,0 +1,115 @@
+import 'dart:convert';
+
+import 'package:ef/ef.dart';
+
+
+class BookExperienceListModel {
+ List bookInfoList = []; //预约列表
+ List experienceStoreModelList = [];
+}
+
+class BookExperienceListController
+ extends GetControllerEx {
+ BookExperienceListController() {
+ attr = GetModel(BookExperienceListModel()).obs;
+ }
+
+ // resetParm() {
+ // model.bookInfoList = [];
+ // model.experienceStoreModelList = [];
+ // total = 0;
+ // page = 0;
+ // lock = false;
+ // updateAll();
+ // }
+
+ // getAllBook() {
+ // ApiService.reservation
+ // .get(
+ // "/agent/userBook/config/getBookStoreList?storeName=&latitude=31.8512&longitude=117.26061&page=0&size=20000&sort=distance")
+ // .then((d) {
+ // model.experienceStoreModelList = d.data["records"];
+ // updateAll();
+ // });
+ // }
+
+ // int total = 0;
+ // int page = 0;
+ // bool lock = false;
+
+ // getData({int count = 10, Function? finished}) {
+ // if (page != 0 && page * count > total) {
+ // finished?.call();
+ // return;
+ // }
+ // if (lock) {
+ // finished?.call();
+ // return;
+ // }
+ // lock = true;
+ // int page_ = page;
+ // String tel = Get.find().model.user?.tel ?? "";
+ // if (tel.isEmpty) {
+ // showToast("用户未存在手机号");
+ // finished?.call();
+ // return;
+ // }
+ // ApiService.reservation
+ // .get(
+ // "/agent/userBook/list?extUserId=$tel&page=$page_&size=$count&sort=create_time,desc")
+ // .then((d) {
+ // lock = false;
+ // finished?.call();
+ // if (page == 0) {
+ // model.bookInfoList = d.data["records"];
+ // } else {
+ // int index = 0;
+ // d.data["records"]?.forEach((item) {
+ // if (model.bookInfoList
+ // .indexWhere((item2) => item2["id"] == item["id"]) ==
+ // -1) {
+ // model.bookInfoList.add(item);
+ // } else {
+ // model.bookInfoList[index] = item;
+ // }
+ // index++;
+ // });
+ // }
+ // page = page_ + 1;
+ // total = d.data["total"];
+ // updateAll();
+ // }).catchError((d) {
+ // lock = false;
+ // finished?.call();
+ // });
+ // }
+
+ // cancelBook(id, {Function? success}) {
+ // String tel = Get.find().model.user?.tel ?? "";
+ // if (tel.isEmpty) {
+ // showToast("用户未存在手机号");
+ // return;
+ // }
+ // LoadingDialog.show("提交中...");
+ // ApiService.reservation
+ // .post("/agent/userBook/cancel?extUserId=$tel&id=$id")
+ // .then((d) {
+ // page = 0;
+ // getData(finished: () {
+ // LoadingDialog.hide();
+ // });
+ // success?.call();
+ // }).catchError((d) {
+ // LoadingDialog.hide();
+ // });
+ // }
+
+ // messageAdd(Map data) {
+ // return ApiService.request.post("/api/message/info", data: {
+ // "type": 0,
+ // "status": 1,
+ // "read": 1,
+ // "data": jsonEncode(data)
+ // });
+ // }
+}
diff --git a/lib/controller/mh/people_info_controller.dart b/lib/controller/mh/people_info_controller.dart
new file mode 100644
index 0000000..14a36be
--- /dev/null
+++ b/lib/controller/mh/people_info_controller.dart
@@ -0,0 +1,111 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
+
+part 'people_info_controller.g.dart'; // 由json_serializable自动生成的部分
+
+class PeopleInfoModel {
+ List peopleList = [PeopleInfoPojo(), PeopleInfoPojo()];
+}
+
+@JsonSerializable()
+class PeopleInfoPojo {
+ String? name;
+ String sex = "男";
+ String? height;
+ String? weight;
+ DateTime? birthday;
+ String? tel;
+ String? emergencyContact;
+
+ PeopleInfoPojo();
+
+ // // 从JSON反序列化时的异常处理
+
+ factory PeopleInfoPojo.fromJson(Map json) {
+ try {
+ return _$PeopleInfoPojoFromJson(json);
+ } catch (e) {
+ // 在实际应用中,应该有更细致的异常处理策略和错误日志
+ return PeopleInfoPojo(); // 或者返回一个带有错误信息的特定PeopleInfoModel实例
+ }
+ }
+
+ // 序列化为JSON时的异常处理
+ Map toJson() => _$PeopleInfoPojoToJson(this);
+}
+
+class PeopleInfoController extends GetControllerEx {
+ PeopleInfoController() {
+ attr = GetModel(PeopleInfoModel()).obs;
+ }
+
+ GlobalController get glcontroller => Get.find();
+
+ // getPeoples() async {
+ // var arr = [];
+ // String bindMacA =
+ // glcontroller.getUpperCaseMac(glcontroller.model.deviceMain["bindMacA"]);
+ // String bindMacB =
+ // glcontroller.getUpperCaseMac(glcontroller.model.deviceMain["bindMacB"]);
+ // arr.add(bindMacA);
+ // if (bindMacB.length > 6) {
+ // arr.add(bindMacB);
+ // } else {
+ // model.peopleList[1] = PeopleInfoPojo();
+ // }
+ // model.peopleList[0] = PeopleInfoPojo();
+ // print("getuser $arr");
+ // var data = await ef.from("app_personnel").select().inFilter("mac", arr);
+ // print("getuser $data");
+ // data?.forEach((d) {
+ // PeopleInfoPojo peopleInfoPojo = PeopleInfoPojo();
+ // peopleInfoPojo.name = d["name"];
+ // peopleInfoPojo.sex = d["gender"] == 1 ? "男" : "女";
+ // peopleInfoPojo.height = d["height"] == null ? null : "${d["height"]}";
+ // peopleInfoPojo.weight = d["weight"] == null ? null : "${d["weight"]}";
+ // if (d["birthday"] != null) {
+ // peopleInfoPojo.birthday = DateTime.parse(d["birthday"]).toLocal();
+ // }
+ // peopleInfoPojo.tel = d["tel"];
+ // peopleInfoPojo.emergencyContact = d["contact"];
+ // if (glcontroller.getUpperCaseMac(d['mac']) == bindMacA) {
+ // model.peopleList[0] = peopleInfoPojo;
+ // }
+ // if (glcontroller.getUpperCaseMac(d['mac']) == bindMacB) {
+ // model.peopleList[1] = peopleInfoPojo;
+ // }
+ // });
+ // updateAll();
+ // attr.value.updateAll();
+ // }
+
+ // savePeoples() async {
+ // String bindMacA =
+ // glcontroller.getUpperCaseMac(glcontroller.model.deviceMain["bindMacA"]);
+ // String bindMacB =
+ // glcontroller.getUpperCaseMac(glcontroller.model.deviceMain["bindMacB"]);
+ // List arr = [];
+ // for (var i = 0; i < 2; i++) {
+ // if (i == 1 && bindMacB.length < 6) {
+ // break;
+ // }
+ // arr.add(ef.from("app_personnel").update({
+ // "name": model.peopleList[i].name,
+ // "gender": model.peopleList[i].sex == "男" ? 1 : 0,
+ // "height": int.tryParse("${model.peopleList[i].height}"),
+ // "weight": int.tryParse("${model.peopleList[i].weight}"),
+ // "birthday": model.peopleList[i].birthday == null
+ // ? null
+ // : model.peopleList[i].birthday.toString(),
+ // "tel": model.peopleList[i].tel,
+ // "contact": model.peopleList[i].emergencyContact
+ // }).eq("mac", i == 0 ? bindMacA : bindMacB));
+ // }
+ // return Future.wait(arr);
+ // }
+
+ // Future saveOnePeople(mac, data) async {
+ // return ef.from("app_personnel").update(data).eq("mac", mac);
+ // }
+}
diff --git a/lib/controller/mh/people_info_controller.g.dart b/lib/controller/mh/people_info_controller.g.dart
new file mode 100644
index 0000000..1c66eb4
--- /dev/null
+++ b/lib/controller/mh/people_info_controller.g.dart
@@ -0,0 +1,30 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'people_info_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+PeopleInfoPojo _$PeopleInfoPojoFromJson(Map json) =>
+ PeopleInfoPojo()
+ ..name = json['name'] as String?
+ ..sex = json['sex'] as String
+ ..height = json['height'] as String?
+ ..weight = json['weight'] as String?
+ ..birthday = json['birthday'] == null
+ ? null
+ : DateTime.parse(json['birthday'] as String)
+ ..tel = json['tel'] as String?
+ ..emergencyContact = json['emergencyContact'] as String?;
+
+Map _$PeopleInfoPojoToJson(PeopleInfoPojo instance) =>
+ {
+ 'name': instance.name,
+ 'sex': instance.sex,
+ 'height': instance.height,
+ 'weight': instance.weight,
+ 'birthday': instance.birthday?.toIso8601String(),
+ 'tel': instance.tel,
+ 'emergencyContact': instance.emergencyContact,
+ };
diff --git a/lib/controller/mh/repair_info_controller.dart b/lib/controller/mh/repair_info_controller.dart
new file mode 100644
index 0000000..b21eae7
--- /dev/null
+++ b/lib/controller/mh/repair_info_controller.dart
@@ -0,0 +1,68 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:vbvs_app/controller/mh/apply_repair_controller.dart';
+import 'package:vbvs_app/controller/mh/repair_process.dart';
+
+part 'repair_info_controller.g.dart';
+
+@JsonSerializable()
+class RepairInfoModel {
+ String? id; //记录id
+ DateTime? create_time; //提交时间
+ String? status; //状态
+ String? desc; //描述
+ int? record_id; //归属记录id
+
+ List repairProcessList = []; //审核流程
+ String? device_name;
+ ApplyRepairModel? applyRepairModel;
+
+ RepairInfoModel();
+
+ static RepairInfoModel fromJson(Map json) =>
+ _$RepairInfoModelFromJson(json);
+ Map toJson() => _$RepairInfoModelToJson(this);
+}
+
+class RepairInfoController extends GetControllerEx {
+ // RepairRepository repairRepository = RepairRepository();
+ RepairInfoController() {
+ attr = GetModel(RepairInfoModel()).obs;
+ }
+
+ // Future initData(ApplyRepairModel applyRepairModel) async {
+ // if (applyRepairModel != null) {
+ // final List fetchedRepairs =
+ // await repairRepository.findData(applyRepairModel.id!);
+ // RepairListController repairListController = Get.find();
+ // final List info = await repairListController.repairRepository
+ // .findRecordData(applyRepairModel.id!);
+ // if (info.isNotEmpty) {
+ // List infos = [];
+ // List tmp = info as List;
+ // try {
+ // infos =
+ // tmp.map((repair) => ApplyRepairModel.fromJson(repair)).toList();
+ // model.applyRepairModel = infos.first;
+ // updateAll();
+ // } catch (e) {
+ // print('Error parsing JSON: $e');
+ // }
+ // // model.applyRepairModel = applyRepairModel;
+ // }
+
+ // if (fetchedRepairs != null) {
+ // List infos = [];
+ // List tmp = fetchedRepairs as List;
+ // try {
+ // infos =
+ // tmp.map((repair) => RepairProcessModel.fromJson(repair)).toList();
+ // model.repairProcessList = infos;
+ // updateAll();
+ // } catch (e) {
+ // print('Error parsing JSON: $e');
+ // }
+ // }
+ // }
+ // }
+}
diff --git a/lib/controller/mh/repair_info_controller.g.dart b/lib/controller/mh/repair_info_controller.g.dart
new file mode 100644
index 0000000..0ef35b6
--- /dev/null
+++ b/lib/controller/mh/repair_info_controller.g.dart
@@ -0,0 +1,37 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'repair_info_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+RepairInfoModel _$RepairInfoModelFromJson(Map json) =>
+ RepairInfoModel()
+ ..id = json['id'] as String?
+ ..create_time = json['create_time'] == null
+ ? null
+ : DateTime.parse(json['create_time'] as String)
+ ..status = json['status'] as String?
+ ..desc = json['desc'] as String?
+ ..record_id = (json['record_id'] as num?)?.toInt()
+ ..repairProcessList = (json['repairProcessList'] as List)
+ .map((e) => RepairProcessModel.fromJson(e as Map))
+ .toList()
+ ..device_name = json['device_name'] as String?
+ ..applyRepairModel = json['applyRepairModel'] == null
+ ? null
+ : ApplyRepairModel.fromJson(
+ json['applyRepairModel'] as Map);
+
+Map _$RepairInfoModelToJson(RepairInfoModel instance) =>
+ {
+ 'id': instance.id,
+ 'create_time': instance.create_time?.toIso8601String(),
+ 'status': instance.status,
+ 'desc': instance.desc,
+ 'record_id': instance.record_id,
+ 'repairProcessList': instance.repairProcessList,
+ 'device_name': instance.device_name,
+ 'applyRepairModel': instance.applyRepairModel,
+ };
diff --git a/lib/controller/mh/repair_list_controller.dart b/lib/controller/mh/repair_list_controller.dart
new file mode 100644
index 0000000..edd58ce
--- /dev/null
+++ b/lib/controller/mh/repair_list_controller.dart
@@ -0,0 +1,83 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+import 'package:vbvs_app/common/color/appConstants.dart';
+import 'apply_repair_controller.dart';
+part 'repair_list_controller.g.dart';
+
+@JsonSerializable()
+class RepairListModel {
+ int limit = AppConstants.limit;
+ int offset = 0;
+ bool isLoading = false;
+ bool hasMore = true;
+
+ List repairList = [];
+
+ RepairListModel();
+ static RepairListModel fromJson(Map json) =>
+ _$RepairListModelFromJson(json);
+ Map toJson() => _$RepairListModelToJson(this);
+}
+
+class RepairListController extends GetControllerEx {
+ // RepairRepository repairRepository = RepairRepository();
+ // RepairListController() {
+ // attr = GetModel(RepairListModel()).obs;
+ // }
+
+ // //初始化列表数据
+ // Future initData() async {
+ // if (model.isLoading) {
+ // return;
+ // }
+ // model.isLoading = true;
+ // final List fetchedRepairs = await repairRepository.fetchRepairs(
+ // limit: model.limit, offset: model.offset);
+ // if (fetchedRepairs != null) {
+ // List infos = [];
+ // List tmp = fetchedRepairs as List;
+ // try {
+ // infos = tmp.map((repair) => ApplyRepairModel.fromJson(repair)).toList();
+ // model.repairList.addAll(infos);
+ // } catch (e) {
+ // print('Error parsing JSON: $e');
+ // }
+ // }
+ // model.offset += model.limit; // 更新 offset,下一次查询跳过当前已经加载的记录
+ // model.hasMore = fetchedRepairs.length == model.limit; // 判断是否还有更多数据
+ // model.isLoading = false;
+ // updateAll();
+ // }
+
+ // Future addScore(int id, int score) async {
+ // return await repairRepository.addScore(id, score);
+ // }
+ @override
+ void onInit() {
+ super.onInit();
+ loadMockRepairList();
+ }
+
+ void loadMockRepairList() {
+ model.repairList = [
+ ApplyRepairModel()
+ ..id = 1001
+ ..device_category = '智能床垫 BY-H'
+ ..status = '待维修'
+ ..create_time = DateTime.now().subtract(Duration(days: 1))
+ ..device_id = 'BYH-001',
+ ApplyRepairModel()
+ ..id = 1002
+ ..device_category = '智能床垫 BY-A'
+ ..status = '维修中'
+ ..create_time = DateTime.now().subtract(Duration(days: 2))
+ ..device_id = 'BYA-002',
+ ApplyRepairModel()
+ ..id = 1003
+ ..device_category = '智能床垫 BY-C'
+ ..status = '已完成'
+ ..create_time = DateTime.now().subtract(Duration(days: 3))
+ ..device_id = 'BYC-003',
+ ];
+ }
+}
diff --git a/lib/controller/mh/repair_list_controller.g.dart b/lib/controller/mh/repair_list_controller.g.dart
new file mode 100644
index 0000000..0e260c6
--- /dev/null
+++ b/lib/controller/mh/repair_list_controller.g.dart
@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'repair_list_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+RepairListModel _$RepairListModelFromJson(Map json) =>
+ RepairListModel()
+ ..limit = (json['limit'] as num).toInt()
+ ..offset = (json['offset'] as num).toInt()
+ ..isLoading = json['isLoading'] as bool
+ ..hasMore = json['hasMore'] as bool
+ ..repairList = (json['repairList'] as List)
+ .map((e) => ApplyRepairModel.fromJson(e as Map))
+ .toList();
+
+Map _$RepairListModelToJson(RepairListModel instance) =>
+ {
+ 'limit': instance.limit,
+ 'offset': instance.offset,
+ 'isLoading': instance.isLoading,
+ 'hasMore': instance.hasMore,
+ 'repairList': instance.repairList,
+ };
diff --git a/lib/controller/mh/repair_process.dart b/lib/controller/mh/repair_process.dart
new file mode 100644
index 0000000..de3e16d
--- /dev/null
+++ b/lib/controller/mh/repair_process.dart
@@ -0,0 +1,18 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part 'repair_process.g.dart';
+
+@JsonSerializable()
+class RepairProcessModel {
+ String? status; //审核状态
+ DateTime? create_time; //审核时间
+ String? desc; //审核意见
+ int? record_id; //归属记录
+
+ int? deal_user; //处理人
+
+ RepairProcessModel();
+ static RepairProcessModel fromJson(Map json) =>
+ _$RepairProcessModelFromJson(json);
+ Map toJson() => _$RepairProcessModelToJson(this);
+}
diff --git a/lib/controller/mh/repair_process.g.dart b/lib/controller/mh/repair_process.g.dart
new file mode 100644
index 0000000..d55573e
--- /dev/null
+++ b/lib/controller/mh/repair_process.g.dart
@@ -0,0 +1,26 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'repair_process.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+RepairProcessModel _$RepairProcessModelFromJson(Map json) =>
+ RepairProcessModel()
+ ..status = json['status'] as String?
+ ..create_time = json['create_time'] == null
+ ? null
+ : DateTime.parse(json['create_time'] as String)
+ ..desc = json['desc'] as String?
+ ..record_id = (json['record_id'] as num?)?.toInt()
+ ..deal_user = (json['deal_user'] as num?)?.toInt();
+
+Map _$RepairProcessModelToJson(RepairProcessModel instance) =>
+ {
+ 'status': instance.status,
+ 'create_time': instance.create_time?.toIso8601String(),
+ 'desc': instance.desc,
+ 'record_id': instance.record_id,
+ 'deal_user': instance.deal_user,
+ };
diff --git a/lib/controller/mh/score_controller.dart b/lib/controller/mh/score_controller.dart
new file mode 100644
index 0000000..f804a70
--- /dev/null
+++ b/lib/controller/mh/score_controller.dart
@@ -0,0 +1,20 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'score_controller.g.dart';
+
+@JsonSerializable()
+class ScoreModel {
+ int? score = 5;
+
+ ScoreModel();
+ static ScoreModel fromJson(Map json) =>
+ _$ScoreModelFromJson(json);
+ Map toJson() => _$ScoreModelToJson(this);
+}
+
+class ScoreController extends GetControllerEx {
+ ScoreController() {
+ attr = GetModel(ScoreModel()).obs;
+ }
+}
diff --git a/lib/controller/mh/score_controller.g.dart b/lib/controller/mh/score_controller.g.dart
new file mode 100644
index 0000000..fb345f6
--- /dev/null
+++ b/lib/controller/mh/score_controller.g.dart
@@ -0,0 +1,15 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'score_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+ScoreModel _$ScoreModelFromJson(Map json) =>
+ ScoreModel()..score = (json['score'] as num?)?.toInt();
+
+Map _$ScoreModelToJson(ScoreModel instance) =>
+ {
+ 'score': instance.score,
+ };
diff --git a/lib/controller/mh/sleeping_habit_controller.dart b/lib/controller/mh/sleeping_habit_controller.dart
new file mode 100644
index 0000000..85e590b
--- /dev/null
+++ b/lib/controller/mh/sleeping_habit_controller.dart
@@ -0,0 +1,94 @@
+import 'dart:convert';
+
+import 'package:dio/src/form_data.dart' as formdata;
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'sleeping_habit_controller.g.dart'; // 由json_serializable自动生成的部分
+
+@JsonSerializable()
+class SleepingHabitModel {
+ bool rxhxIsStart = false;
+ List rxhxWakeTime = [0, 0];
+ bool rxhxIsBell = false;
+ bool rxhxIsAnMo = false;
+ int rxhxLocation = 0;
+ List rxhxWeeks = [0, 0, 0, 0, 0, 0, 0];
+
+ bool dhgyIsStart = false;
+
+ bool smysIsStart = false;
+ List smysStartTime = [20, 0];
+ List smysEndTime = [9, 0];
+
+ String get rxhxWakeTimeToString {
+ return '${rxhxWakeTime[0]}'.padLeft(2, "0") +
+ ":" +
+ '${rxhxWakeTime[1]}'.padLeft(2, "0");
+ }
+
+ String get smysStartTimeToString {
+ return '${smysStartTime[0]}'.padLeft(2, "0") +
+ ":" +
+ '${smysStartTime[1]}'.padLeft(2, "0");
+ }
+
+ String get smysEndTimeToString {
+ return '${smysEndTime[0]}'.padLeft(2, "0") +
+ ":" +
+ '${smysEndTime[1]}'.padLeft(2, "0");
+ }
+
+ SleepingHabitModel();
+
+ factory SleepingHabitModel.fromJson(Map json) {
+ try {
+ return _$SleepingHabitModelFromJson(json);
+ } catch (e) {
+ print("$e");
+ // 在实际应用中,应该有更细致的异常处理策略和错误日志
+ return SleepingHabitModel(); // 或者返回一个带有错误信息的特定AboutModel实例
+ }
+ }
+ Map toJson() => _$SleepingHabitModelToJson(this);
+}
+
+class SleepingHabitController extends GetControllerEx {
+ SleepingHabitController() {
+ attr = GetModel(SleepingHabitModel()).obs;
+ }
+
+ // saveDataApi() {
+ // String mac = Get.find().model.deviceMain["mac"];
+ // ApiService.request.post("/api/device/info/config",
+ // data: formdata.FormData.fromMap({
+ // "mac": mac,
+ // "type": "sleepHabit",
+ // "data": jsonEncode(model.toJson())
+ // }));
+ // }
+
+ // loadDataApi({int time = 3}) {
+ // String mac = Get.find().model.deviceMain["mac"];
+
+ // ApiService.request
+ // .get("/api/device/info/config?type=sleepHabit&mac=${mac}")
+ // .then((d) async {
+ // if (d.data["data"] != null && d.data["data"]["data"] != null) {
+ // attr.value.model =
+ // SleepingHabitModel.fromJson(jsonDecode(d.data["data"]["data"]));
+ // print("load ${model.toJson()}");
+ // } else {
+ // attr.value.model = SleepingHabitModel();
+ // print("load error");
+ // }
+ // updateAll();
+ // }).catchError((d) {
+ // if (time > 0) {
+ // loadDataApi(time: time - 1);
+ // } else {
+ // attr.value.model = SleepingHabitModel();
+ // }
+ // });
+ // }
+}
diff --git a/lib/controller/mh/sleeping_habit_controller.g.dart b/lib/controller/mh/sleeping_habit_controller.g.dart
new file mode 100644
index 0000000..2cde832
--- /dev/null
+++ b/lib/controller/mh/sleeping_habit_controller.g.dart
@@ -0,0 +1,40 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'sleeping_habit_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+SleepingHabitModel _$SleepingHabitModelFromJson(Map json) =>
+ SleepingHabitModel()
+ ..rxhxIsStart = json['rxhxIsStart'] as bool
+ ..rxhxWakeTime = (json['rxhxWakeTime'] as List)
+ .map((e) => (e as num).toInt())
+ .toList()
+ ..rxhxIsBell = json['rxhxIsBell'] as bool
+ ..rxhxIsAnMo = json['rxhxIsAnMo'] as bool
+ ..rxhxLocation = (json['rxhxLocation'] as num).toInt()
+ ..rxhxWeeks = json['rxhxWeeks'] as List
+ ..dhgyIsStart = json['dhgyIsStart'] as bool
+ ..smysIsStart = json['smysIsStart'] as bool
+ ..smysStartTime = (json['smysStartTime'] as List)
+ .map((e) => (e as num).toInt())
+ .toList()
+ ..smysEndTime = (json['smysEndTime'] as List)
+ .map((e) => (e as num).toInt())
+ .toList();
+
+Map _$SleepingHabitModelToJson(SleepingHabitModel instance) =>
+ {
+ 'rxhxIsStart': instance.rxhxIsStart,
+ 'rxhxWakeTime': instance.rxhxWakeTime,
+ 'rxhxIsBell': instance.rxhxIsBell,
+ 'rxhxIsAnMo': instance.rxhxIsAnMo,
+ 'rxhxLocation': instance.rxhxLocation,
+ 'rxhxWeeks': instance.rxhxWeeks,
+ 'dhgyIsStart': instance.dhgyIsStart,
+ 'smysIsStart': instance.smysIsStart,
+ 'smysStartTime': instance.smysStartTime,
+ 'smysEndTime': instance.smysEndTime,
+ };
diff --git a/lib/controller/mh/user_data.dart b/lib/controller/mh/user_data.dart
new file mode 100644
index 0000000..ea76499
--- /dev/null
+++ b/lib/controller/mh/user_data.dart
@@ -0,0 +1,22 @@
+import 'package:json_annotation/json_annotation.dart';
+
+part 'user_data.g.dart';
+
+@JsonSerializable()
+class UserModel {
+ String? uid;
+ String? userName;
+ String? nickName;
+ String? tel;
+ String? avatar;
+ String? exp1;
+ String? exp2;
+ String? head;
+ String? tmpHead;
+ String? tmpNickName;
+
+ UserModel();
+ static UserModel fromJson(Map json) =>
+ _$UserModelFromJson(json);
+ Map toJson() => _$UserModelToJson(this);
+}
diff --git a/lib/controller/mh/user_data.g.dart b/lib/controller/mh/user_data.g.dart
new file mode 100644
index 0000000..89d1e4c
--- /dev/null
+++ b/lib/controller/mh/user_data.g.dart
@@ -0,0 +1,32 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'user_data.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+UserModel _$UserModelFromJson(Map json) => UserModel()
+ ..uid = json['uid'] as String?
+ ..userName = json['userName'] as String?
+ ..nickName = json['nickName'] as String?
+ ..tel = json['tel'] as String?
+ ..avatar = json['avatar'] as String?
+ ..exp1 = json['exp1'] as String?
+ ..exp2 = json['exp2'] as String?
+ ..head = json['head'] as String?
+ ..tmpHead = json['tmpHead'] as String?
+ ..tmpNickName = json['tmpNickName'] as String?;
+
+Map _$UserModelToJson(UserModel instance) => {
+ 'uid': instance.uid,
+ 'userName': instance.userName,
+ 'nickName': instance.nickName,
+ 'tel': instance.tel,
+ 'avatar': instance.avatar,
+ 'exp1': instance.exp1,
+ 'exp2': instance.exp2,
+ 'head': instance.head,
+ 'tmpHead': instance.tmpHead,
+ 'tmpNickName': instance.tmpNickName,
+ };
diff --git a/lib/main.dart b/lib/main.dart
index fa8d3d4..6f33c56 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -31,6 +31,20 @@ import 'package:vbvs_app/controller/message/common_message_setting_controller.da
import 'package:vbvs_app/controller/message/message_controller.dart';
import 'package:vbvs_app/controller/message/message_review_controller.dart';
import 'package:vbvs_app/controller/message/message_setting_controller.dart';
+import 'package:vbvs_app/controller/mh/address_controller.dart';
+import 'package:vbvs_app/controller/mh/address_list_controller.dart';
+import 'package:vbvs_app/controller/mh/book_info_controller.dart';
+import 'package:vbvs_app/controller/mh/experience_store_list_page.dart';
+import 'package:vbvs_app/controller/mh/issue_controller.dart';
+import 'package:vbvs_app/controller/mh/issue_preview_controller.dart';
+import 'package:vbvs_app/controller/mh/message_controller.dart';
+import 'package:vbvs_app/controller/mh/muser_info_controller.dart';
+import 'package:vbvs_app/controller/mh/my_experience_list_controller.dart';
+import 'package:vbvs_app/controller/mh/people_info_controller.dart';
+import 'package:vbvs_app/controller/mh/repair_info_controller.dart';
+import 'package:vbvs_app/controller/mh/repair_list_controller.dart';
+import 'package:vbvs_app/controller/mh/score_controller.dart';
+import 'package:vbvs_app/controller/mh/sleeping_habit_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/repair/repair_controller.dart';
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
@@ -43,7 +57,13 @@ import 'package:vbvs_app/controller/weather/weather_controller.dart';
import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/model/CustomThemeColor.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/people_info.dart';
+import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
+import 'package:vbvs_app/routers/mh_routers.dart';
+import 'controller/mh/apply_repair_controller.dart';
import 'controller/user_info_controller.dart';
import 'routers/routers.dart';
@@ -198,55 +218,87 @@ class MyApp extends StatelessWidget {
MyApp({super.key});
final ThemeController themeController = Get.put(ThemeController());
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- themeController.changeTheme(CustomThemeColor.dark);
- UserInfoController userInfoController = Get.find();
- return LayoutBuilder(builder: (contxt, cons) {
- double width = cons.maxWidth;
- double height = cons.maxHeight;
- if (width < 1) {
- return Container();
- }
- FitTool.init(width < height ? width : height);
- return GetMaterialApp(
- translations: AppLanguage(),
- // locale: const Locale("zh", "CN"),
- locale: AppLanguage().currentLocale, // ✅ 动态读取当前语言
- fallbackLocale: const Locale("zh", "CN"),
- localizationsDelegates: [
- GlobalMaterialLocalizations.delegate,
- GlobalWidgetsLocalizations.delegate,
- GlobalCupertinoLocalizations.delegate,
- SfGlobalLocalizations.delegate,
- ],
- supportedLocales: [
- const Locale('zh', 'CN'), // 中文
- const Locale('en', 'US'), // ⚠️ 添加你支持的语言
- ],
- debugShowCheckedModeBanner: false,
- title: '',
- theme: themeController.currentTheme,
- // home: const MyHomePage(title: '智慧眠花糖 Home Page'),
- initialRoute: "/mianPageBottomChange",
- onGenerateRoute: onGenerateRoute,
- initialBinding: BindingsBuilder(() => [
- // Get.lazyPut(() => UserInfoController()),
- Get.put(GlobalController()),
+ Widget buildmht(BuildContext context, BoxConstraints cons) {
+ return GetMaterialApp(
+ translations: AppLanguage(),
+ debugShowCheckedModeBanner: false,
+ title: '',
+ theme: themeController.currentTheme,
+ home: MainPageBBottomChange(),
+ onGenerateRoute: mhonGenerateRoute,
+ initialBinding: BindingsBuilder(() => [
+ // Get.lazyPut(() => UserInfoController()),
+ Get.put(GlobalController()),
+ Get.lazyPut(() => ControlCardController()),
+ Get.lazyPut(() => RepairListController()),
+ Get.lazyPut(() => RepairInfoController()),
+ Get.lazyPut(() => MUserInfoController()),
+ Get.lazyPut(() => MhMessageController()),
+ Get.lazyPut(() => ScoreController()),
+ Get.lazyPut(() => ExperienceStoreListController()),
+ Get.lazyPut(() => BookExperienceListController()),
+ Get.lazyPut(() => IssuePreviewInfoController()),
+ Get.lazyPut(() => IssueListController()),
+ Get.lazyPut(() => ApplyRepairController()),
+ Get.lazyPut(() => SleepingHabitController()),
+ Get.lazyPut(() => PeopleInfoController()),
+ Get.lazyPut(() => MainPageController()),
+ Get.lazyPut(() => AddressListController()),
+ Get.lazyPut(() => AddressController()),
+ Get.lazyPut(() => BlueteethBindController()),
+ Get.lazyPut(() => BookInfoController()),
+ Get.lazyPut(() => PersonController()),
+ Get.lazyPut(() => CountdownController()),
+ Get.lazyPut(() => LoginController()),
+ Get.lazyPut(() => DeviceTypeController()),
+ Get.lazyPut(() => BodyDeviceController()),
+ Get.lazyPut(() => HomeController()),
+ Get.lazyPut(() => DeviceShareController()),
+ Get.lazyPut(() => DeviceShareListController()),
+ Get.lazyPut(() => DeviceCalibrationController()),
+ Get.lazyPut(() => RepairController()),
+ Get.lazyPut(() => PdfController()),
+ ]));
+ }
+
+ Widget buildth(BuildContext context, BoxConstraints cons) {
+ return GetMaterialApp(
+ translations: AppLanguage(),
+ // locale: const Locale("zh", "CN"),
+ locale: AppLanguage().currentLocale, // ✅ 动态读取当前语言
+ fallbackLocale: const Locale("zh", "CN"),
+ localizationsDelegates: [
+ GlobalMaterialLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ GlobalCupertinoLocalizations.delegate,
+ SfGlobalLocalizations.delegate,
+ ],
+ supportedLocales: [
+ const Locale('zh', 'CN'), // 中文
+ const Locale('en', 'US'), // ⚠️ 添加你支持的语言
+ ],
+ debugShowCheckedModeBanner: false,
+ title: '',
+ theme: themeController.currentTheme,
+ // home: const MyHomePage(title: '智慧眠花糖 Home Page'),
+ initialRoute: "/mianPageBottomChange",
+ onGenerateRoute: onGenerateRoute,
+ initialBinding: BindingsBuilder(() => [
+ // Get.lazyPut(() => UserInfoController()),
+ Get.put(GlobalController()),
Get.put(WeatherModelController()),
- Get.lazyPut(() => MainPageController()),
- Get.lazyPut(() => BlueteethBindController()),
- Get.lazyPut(() => PersonController()),
- Get.lazyPut(() => CountdownController()),
- Get.lazyPut(() => LoginController()),
- Get.lazyPut(() => DeviceTypeController()),
- Get.lazyPut(() => BodyDeviceController()),
- Get.lazyPut(() => HomeController()),
- Get.lazyPut(() => DeviceShareController()),
- Get.lazyPut(() => DeviceShareListController()),
- Get.lazyPut(() => DeviceCalibrationController()),
- Get.lazyPut(() => RepairController()),
+ Get.lazyPut(() => MainPageController()),
+ Get.lazyPut(() => BlueteethBindController()),
+ Get.lazyPut(() => PersonController()),
+ Get.lazyPut(() => CountdownController()),
+ Get.lazyPut(() => LoginController()),
+ Get.lazyPut(() => DeviceTypeController()),
+ Get.lazyPut(() => BodyDeviceController()),
+ Get.lazyPut(() => HomeController()),
+ Get.lazyPut(() => DeviceShareController()),
+ Get.lazyPut(() => DeviceShareListController()),
+ Get.lazyPut(() => DeviceCalibrationController()),
+ Get.lazyPut(() => RepairController()),
Get.lazyPut(() => UserPdfController()),
Get.lazyPut(() => PrivacyPdfController()),
Get.lazyPut(() => CalendarController()),
@@ -254,7 +306,25 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => MessageReviewController()),
Get.lazyPut(() => MessageSettingController()),
Get.lazyPut(() => CommonMessageSettingController()),
- ]));
+ ]));
+ }
+
+ final selectapp = "mht";
+ // This widget is the root of your application.
+ @override
+ Widget build(BuildContext context) {
+ var co = MediaQuery.sizeOf(context);
+ FitTool.init(co.height);
+ themeController.changeTheme(CustomThemeColor.dark);
+ return LayoutBuilder(builder: (contxt, cons) {
+ switch (selectapp) {
+ case "th":
+ return buildth(context, cons);
+ case "mht":
+ return buildmht(contxt, cons);
+ default:
+ return buildth(context, cons);
+ }
});
}
}
diff --git a/lib/pages/common/bezier_bottom_navigation_bar.dart b/lib/pages/common/bezier_bottom_navigation_bar.dart
new file mode 100644
index 0000000..77672be
--- /dev/null
+++ b/lib/pages/common/bezier_bottom_navigation_bar.dart
@@ -0,0 +1,151 @@
+// bezier_bottom_navigation_bar.dart
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:vbvs_app/common/util/FitTool.dart';
+
+class BezierBottomNavigationBar extends StatelessWidget {
+ final int selectedIndex;
+ final double animatedPosition;
+ final ValueChanged onTap;
+ final List path;
+ final List titles;
+
+ const BezierBottomNavigationBar({
+ Key? key,
+ required this.selectedIndex,
+ required this.animatedPosition,
+ required this.onTap,
+ required this.path,
+ required this.titles,
+ }) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ final itemCount = path.length;
+ return SizedBox(
+ height: 130.rpx,
+ child: Stack(
+ children: [
+ Positioned.fill(
+ child: CustomPaint(
+ size: Size(MediaQuery.of(context).size.width, 130.rpx),
+ painter: BezierPainter(
+ position: animatedPosition,
+ itemCount: itemCount,
+ ),
+ ),
+ ),
+ Row(
+ children: path.asMap().entries.map((entry) {
+ final i = entry.key;
+ final icon = entry.value;
+ return Expanded(
+ child: GestureDetector(
+ // 用 InkWell 替换 GestureDetector,支持点击反馈
+ onTap: () => onTap(i),
+ // splashColor: Colors.transparent, // 可选:关闭 splash 效果
+ // highlightColor: Colors.transparent, // 可选:关闭高亮效果
+ child: SizedBox.expand(
+ child: Padding(
+ padding: EdgeInsets.only(top: 14.rpx),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.only(top: 11.rpx),
+ child: SvgPicture.asset(icon,
+ width: 42.rpx,
+ height: 42.rpx,
+ color: selectedIndex == i
+ ? Colors.white
+ : Color(0XFF929699)),
+ ),
+ SizedBox(height: 3),
+ Text(
+ titles[i],
+ style: TextStyle(
+ fontSize: 22.rpx,
+ color: selectedIndex == i
+ ? Colors.white
+ : Colors.grey.shade400,
+ ),
+ ),
+ ],
+ ),
+ )
+ // 关键点:撑满 Expanded 区域
+
+ ),
+ ),
+ );
+ }).toList(),
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+class BezierPainter extends CustomPainter {
+ final double position;
+ final int itemCount;
+
+ BezierPainter({required this.position, required this.itemCount});
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ final paint = Paint()
+ ..color = Colors.white
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 1.0;
+
+ final path = Path();
+ final itemWidth = size.width / itemCount;
+ final curveWidth = itemWidth * 0.8;
+ double curveHeight = 8.5;
+
+ final centerX = itemWidth * position + itemWidth / 2;
+ final left = centerX - curveWidth / 2;
+ final right = centerX + curveWidth / 2;
+
+ // 控制点偏移比例(越小越平滑)
+ final controlOffsetX = curveWidth * 0.2;
+ final controlOffsetY = curveHeight * 0.9;
+
+ // 起点
+ path.moveTo(0, 0);
+
+ // 到左侧前的一段直线
+ path.lineTo(left, 0);
+
+ // 凸起贝塞尔曲线
+ path.cubicTo(
+ left + controlOffsetX,
+ 0,
+ centerX - controlOffsetX,
+ -controlOffsetY,
+ centerX,
+ -controlOffsetY,
+ );
+ path.cubicTo(
+ centerX + controlOffsetX,
+ -controlOffsetY,
+ right - controlOffsetX,
+ 0,
+ right,
+ 0,
+ );
+
+ // 右边剩余直线
+ path.lineTo(size.width, 0);
+
+ // 向下平移,保证凸起在容器内部
+ canvas.translate(0, controlOffsetY);
+ canvas.drawPath(path, paint);
+ }
+
+ @override
+ bool shouldRepaint(covariant BezierPainter oldDelegate) {
+ return oldDelegate.position != position;
+ }
+}
diff --git a/lib/pages/device_control/BackMovement.dart b/lib/pages/device_control/BackMovement.dart
new file mode 100644
index 0000000..1c6432f
--- /dev/null
+++ b/lib/pages/device_control/BackMovement.dart
@@ -0,0 +1,228 @@
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+import 'package:vbvs_app/common/util/FitTool.dart';
+import 'dart:math' as math;
+import 'package:vbvs_app/common/util/MyUtils.dart';
+
+class BackMovementPage extends StatefulWidget {
+ const BackMovementPage({super.key});
+
+ @override
+ State createState() => _BackMovementPageState();
+}
+
+class _BackMovementPageState extends State {
+ double intensity = 4;
+ int selectedTime = 10;
+
+ final List timeOptions = [10, 20, 30];
+
+ @override
+ Widget build(BuildContext context) {
+ return LayoutBuilder(builder: (context, bodysize) {
+ final double totalWidth = bodysize.maxWidth - 40.rpx * 2; // 减去左右 padding
+ final double spacing = 34.rpx;
+ final double buttonHeight = 101.rpx;
+ return GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Container(
+ child: Scaffold(
+ appBar: AppBar(
+ iconTheme: IconThemeData(color: themeController.currentColor.sc3),
+ backgroundColor: const Color(0xFF011C33), // 统一背景色
+ automaticallyImplyLeading: false,
+ titleSpacing: 0,
+ title: SizedBox(
+ width: double.infinity,
+ height: 180.rpx,
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ // 中间居中的标题
+ Text(
+ '背部律动',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 30.rpx,
+ ),
+ ),
+ // 左侧图标
+ Positioned(
+ left: 20.rpx,
+ child: returnIconButtomNew,
+ ),
+ ],
+ ),
+ ),
+ centerTitle: false,
+ ),
+ backgroundColor: const Color(0xFF011C33),
+ body: Padding(
+ padding: EdgeInsets.fromLTRB(0.rpx, 0, 0.rpx, 0),
+ child: Column(
+ // crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ SingleChildScrollView(
+ child: Column(
+ children: [
+ SizedBox(height: 30.rpx),
+ Text(
+ '力度调节',
+ style: TextStyle(color: Colors.grey, fontSize: 30.rpx),
+ ),
+ SizedBox(height: 148.rpx),
+ Text(
+ intensity.toInt().toString(),
+ style:
+ TextStyle(color: Colors.white, fontSize: 160.rpx),
+ ),
+ SizedBox(height: 41.rpx),
+ SizedBox(
+ height: 451.rpx, // 外部容器高度固定
+ child: Stack(
+ children: [
+ // 左边的 强/弱 文本
+ Positioned(
+ left: 0,
+ top: 0,
+ bottom: 0,
+ child: SizedBox(
+ width: 60.rpx,
+ child: Column(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text('强',
+ style: TextStyle(
+ color: Colors.grey,
+ fontSize: 30.rpx)),
+ Text('弱',
+ style: TextStyle(
+ color: Colors.grey,
+ fontSize: 30.rpx)),
+ ],
+ ),
+ ),
+ ),
+
+ // 右侧 slider,27.rpx 后居中
+ Positioned(
+ left: 60.rpx - 27.rpx, // 60 是文字宽度,27 是间隔
+ right: 0,
+ top: 0,
+ bottom: 0,
+ child: Center(
+ child: Transform.rotate(
+ angle: -math.pi / 2,
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: 451.rpx,
+ maxHeight: 451.rpx,
+ ),
+ child: SliderTheme(
+ data: SliderTheme.of(context).copyWith(
+ trackHeight: 60.rpx,
+ thumbShape: RoundSliderThumbShape(
+ enabledThumbRadius: 45.rpx),
+ overlayShape:
+ const RoundSliderOverlayShape(
+ overlayRadius: 20),
+ ),
+ child: Slider(
+ value: intensity,
+ min: 1,
+ max: 6,
+ divisions: 7,
+ activeColor: Colors.cyanAccent,
+ inactiveColor: Colors.blue.shade900,
+ onChanged: (value) {
+ setState(() {
+ intensity = value;
+ });
+ },
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ SizedBox(height: 118.rpx),
+ Padding(
+ padding: EdgeInsets.only(
+ left: 47.rpx), // 👈 控制间隔大小(也可以是 all / symmetric)
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ '按摩定时',
+ style: TextStyle(
+ color: Colors.white70, fontSize: 30.rpx),
+ ),
+ ),
+ ),
+ SizedBox(height: 74.rpx),
+ Padding(
+ padding: EdgeInsets.fromLTRB(40.rpx, 0, 40.rpx, 0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children:
+ List.generate(timeOptions.length, (index) {
+ final min = timeOptions[index];
+ final isSelected = selectedTime == min;
+ return SizedBox(
+ height: buttonHeight,
+ child: ElevatedButton(
+ onPressed: () {
+ setState(() {
+ selectedTime = min;
+ });
+ },
+ style: ElevatedButton.styleFrom(
+ backgroundColor: isSelected
+ ? Colors.cyanAccent
+ : Colors.blue.shade900,
+ foregroundColor: isSelected
+ ? Colors.black
+ : Colors.white,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(6),
+ ),
+ ),
+ child: Text('$min分钟'),
+ ));
+ }),
+ )),
+ ],
+ )),
+ Padding(
+ padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx,
+ 81.rpx), // 👈 控制上方间隔(也可以用 all / symmetric)
+ child: OutlinedButton(
+ onPressed: () {
+ setState(() {
+ intensity = 4;
+ selectedTime = 10;
+ });
+ },
+ style: OutlinedButton.styleFrom(
+ side: const BorderSide(color: Color(0XFF74DAE5)),
+ foregroundColor: Colors.cyanAccent,
+ minimumSize: Size(bodysize.maxWidth, 92.rpx),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(6),
+ ),
+ ),
+ child: const Text('恢复到默认设置'),
+ ),
+ ),
+ ],
+ ),
+ ),
+ )));
+ });
+ }
+}
diff --git a/lib/pages/device_control/ColorChangeOnTap.dart b/lib/pages/device_control/ColorChangeOnTap.dart
new file mode 100644
index 0000000..8af73e6
--- /dev/null
+++ b/lib/pages/device_control/ColorChangeOnTap.dart
@@ -0,0 +1,94 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+import 'package:vbvs_app/common/util/MyUtils.dart';
+
+class ColorChangeOnPress extends StatefulWidget {
+ final Color? initialColor; // 初始颜色
+ final Color pressColor; // 按下时的颜色
+ final bool shouldNavigate; // 是否需要跳转
+ final String? routeName; // 路由名称
+ final Widget child; // 子组件
+ final String? toastMessage; // Toast 消息
+ final ToastColor? toastColor; // Toast 颜色
+ final double topLeft; // 左上圆角
+ final double topRight; // 右上圆角
+ final double bottomRight; // 右下圆角
+ final double bottomLeft; // 左下圆角
+ final VoidCallback? onTap; // 点击回调
+
+ const ColorChangeOnPress({
+ Key? key,
+ this.initialColor = Colors.white, // 默认初始颜色为白色
+ this.pressColor = Colors.grey, // 默认按下颜色为灰色
+ this.shouldNavigate = false, // 默认不跳转
+ this.routeName,
+ required this.child,
+ this.toastMessage, // Toast 消息
+ this.toastColor, // Toast 颜色
+ this.topLeft = 0.0, // 左上圆角
+ this.topRight = 0.0, // 右上圆角
+ this.bottomRight = 0.0, // 右下圆角
+ this.bottomLeft = 0.0, // 左下圆角
+ this.onTap, // 点击回调
+ }) : super(key: key);
+
+ @override
+ _ColorChangeOnPressState createState() => _ColorChangeOnPressState();
+}
+
+class _ColorChangeOnPressState extends State {
+ Color? _currentColor;
+
+ @override
+ void initState() {
+ super.initState();
+ _currentColor = widget.initialColor; // 初始化为初始颜色
+ }
+
+ void _handleTap() {
+ // 如果提供了 onTap 回调,调用它
+ if (widget.onTap != null) {
+ widget.onTap!(); // 执行自定义逻辑
+ }
+
+ setState(() {
+ _currentColor = widget.pressColor; // 改变为按下的颜色
+ });
+
+ // 显示 Toast 消息
+ if (widget.toastMessage != null) {
+ showToast(widget.toastMessage!, color: widget.toastColor!);
+ }
+
+ // 在0.5秒后恢复颜色
+ Future.delayed(const Duration(milliseconds: 100), () {
+ setState(() {
+ _currentColor = widget.initialColor; // 恢复为初始颜色
+ });
+
+ // 如果需要跳转,则执行路由跳转
+ if (widget.shouldNavigate && widget.routeName != null) {
+ Get.toNamed(widget.routeName!); // 在颜色恢复后执行跳转
+ }
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ decoration: BoxDecoration(
+ color: _currentColor,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(widget.topLeft), // 左上圆角
+ topRight: Radius.circular(widget.topRight), // 右上圆角
+ bottomRight: Radius.circular(widget.bottomRight), // 右下圆角
+ bottomLeft: Radius.circular(widget.bottomLeft), // 左下圆角
+ ),
+ ),
+ child: InkWell(
+ onTap: _handleTap,
+ child: widget.child,
+ ),
+ );
+ }
+}
diff --git a/lib/pages/device_control/Empty.dart b/lib/pages/device_control/Empty.dart
new file mode 100644
index 0000000..311a512
--- /dev/null
+++ b/lib/pages/device_control/Empty.dart
@@ -0,0 +1,54 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:vbvs_app/common/util/FitTool.dart';
+
+class Empty extends StatefulWidget {
+ Empty({super.key});
+
+ @override
+ State createState() => _EmptyState();
+}
+
+class _EmptyState extends State {
+ String empty = "";
+ bool closepage = false;
+
+ @override
+ void initState() {
+ // TODO: implement initState
+ super.initState();
+ Timer(const Duration(milliseconds: 1200), () {
+ if (empty.isEmpty && closepage == false) {
+ setState(() {
+ empty = "assets/images/new_empty.png";
+ });
+ }
+ });
+ }
+
+ @override
+ void dispose() {
+ // TODO: implement dispose
+ super.dispose();
+ closepage = true;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ if (empty.isEmpty) {
+ return Container();
+ } else {
+ return Container(
+ width: double.infinity,
+ margin: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.3),
+ alignment: Alignment.center,
+ child: Container(
+ width: 164.rpx,
+ height: 230.rpx,
+ child: Image.asset(empty),
+ ),
+ );
+ }
+ }
+}
diff --git a/lib/pages/device_control/EmptyMessageWidget.dart b/lib/pages/device_control/EmptyMessageWidget.dart
new file mode 100644
index 0000000..e62d9f4
--- /dev/null
+++ b/lib/pages/device_control/EmptyMessageWidget.dart
@@ -0,0 +1,37 @@
+import 'dart:async';
+
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+import 'package:vbvs_app/common/util/FitTool.dart';
+
+class EmptyMessageWidget extends StatelessWidget {
+ final String imagePath;
+ final double width;
+ final double height;
+ var empty = "".obs;
+
+ EmptyMessageWidget({
+ Key? key,
+ this.imagePath = 'assets/images/new_empty.png', // 默认图片路径
+ double? width, // 默认宽度
+ double? height, // 默认高度
+ }) : width = 164.rpx, // 初始化宽度
+ height = 230.rpx, // 初始化高度变为原来的三分之二
+ super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ Timer(Duration(milliseconds: 5000), () {
+ empty.value = "assets/images/new_empty.png";
+ });
+ return Center(
+ child: Image.asset(
+ imagePath,
+ width: width,
+ height: height,
+ color: Colors.white,
+ ),
+
+ );
+ }
+}
diff --git a/lib/pages/device_control/HomeDeviceType.dart b/lib/pages/device_control/HomeDeviceType.dart
new file mode 100644
index 0000000..91a66aa
--- /dev/null
+++ b/lib/pages/device_control/HomeDeviceType.dart
@@ -0,0 +1,245 @@
+import 'dart:async';
+
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+import 'package:vbvs_app/common/util/FitTool.dart';
+import 'package:vbvs_app/common/util/MyUtils.dart';
+
+
+class HomeDeviceType extends StatefulWidget {
+ HomeDeviceType({super.key});
+ @override
+ State createState() => _HomeDeviceTypeState();
+}
+
+class _HomeDeviceTypeState extends State {
+ bool isExec = false;
+
+ @override
+ Widget build(BuildContext context) {
+ // if (isExec == false) {
+ // Timer(const Duration(milliseconds: 10), () {
+ // controller.getDeviceType();
+ // });
+ // isExec = true;
+ // }
+ return LayoutBuilder(
+ builder: (context, boxConstraints) => GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Container(
+ decoration: const BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage('assets/images/new_background.png'), // 本地图片
+ fit: BoxFit.fill, // 填满整个 Container
+ ),
+ ),
+ child: Scaffold(
+ backgroundColor: Colors.transparent,
+ appBar: AppBar(
+ backgroundColor: Colors.transparent,
+ automaticallyImplyLeading: false,
+ iconTheme: const IconThemeData(color: Colors.white),
+ titleSpacing: 0,
+ // leading: returnIconButtom,
+ title: SizedBox(
+ width: double.infinity,
+ height: 180.rpx,
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ // 中间居中的标题
+ Text(
+ '添加设备',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 30.rpx,
+ ),
+ ),
+ // 左侧图标
+ Positioned(
+ left: 20.rpx,
+ child: returnIconButtom,
+ ),
+ ],
+ ),
+ ),
+
+ centerTitle: false,
+ ),
+ body: SafeArea(
+ top: true,
+ child: Container(
+ width: MediaQuery.sizeOf(context).width,
+ height: MediaQuery.sizeOf(context).height * 1.123,
+ // decoration: const BoxDecoration(
+ // image: DecorationImage(
+ // image: AssetImage("assets/images/new_background.png"),
+ // fit: BoxFit.cover,
+ // ),
+ // ),
+ child: SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.max,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 48.rpx, 24.rpx, 0, 0),
+ child: Text(
+ '选择类型',
+ style: FlutterFlowTheme.of(context)
+ .bodyMedium
+ .override(
+ fontFamily: 'Readex Pro',
+ color: Colors.white,
+ fontSize: 30.rpx,
+ letterSpacing: 0,
+ ),
+ ),
+ ),
+ _buildControlCard(context),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ )),
+ );
+ }
+}
+
+Widget _buildControlCard(BuildContext context) {
+ final List