设备分享

This commit is contained in:
czz
2025-06-30 20:35:02 +08:00
parent ee88290dfe
commit 8a69c90572
18 changed files with 908 additions and 207 deletions

View File

@@ -1,4 +1,4 @@
package com.taihe.vbvs_app
package com.taihe.mh_app
import io.flutter.embedding.android.FlutterActivity

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="30" height="30" viewBox="0 0 30 30"><g><g><g><g></g></g><g><g><g><path d="M15.00048859375,18.657226875C14.87255859375,18.657226875,14.74462859375,18.608396875,14.64648859375,18.510746875C14.64648859375,18.510746875,8.33154259375,12.195312875,8.33154259375,12.195312875C8.13623049375,11.999999875,8.13623049375,11.683593875,8.33154259375,11.488280875C8.52636759375,11.292968775,8.84326159375,11.292968775,9.03857459375,11.488280875C9.03857459375,11.488280875,15.00048859375,17.450196875,15.00048859375,17.450196875C15.00048859375,17.450196875,20.96235859375,11.488280875,20.96235859375,11.488280875C21.15725859375,11.292968775,21.473658593750002,11.292968775,21.66945859375,11.488280875C21.86425859375,11.683593875,21.86425859375,11.999999875,21.66945859375,12.195312875C21.66945859375,12.195312875,15.35351859375,18.510746875,15.35351859375,18.510746875C15.256348593750001,18.608396875,15.12841859375,18.657226875,15.00048859375,18.657226875C15.00048859375,18.657226875,15.00048859375,18.657226875,15.00048859375,18.657226875Z" fill="#333333" fill-opacity="1"/></g></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -204,6 +204,7 @@
"请选择体重": "请输入体重",
"请选择身高": "请输入身高",
"人员资料": "人员资料",
"请输入姓名": "请输入姓名"
"请输入姓名": "请输入姓名",
"解除分享":"解除分享"
}

View File

@@ -67,7 +67,7 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
}
if (!MyUtils.isValidPhoneNumber(model.account!) &&
!MyUtils.isValidEmail(model.account!)) {
apiResponse.msg = '请输入正确的手机号'.tr;
apiResponse.msg = '请输入正确的手机号/邮箱号'.tr;
return apiResponse;
}
String serviceAddress = ServiceConstant.service_address;
@@ -133,4 +133,55 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
},
);
}
Future<ApiResponse> confirmShare(String shareCode) async {
EasyDartModule.logger.info("确认消息分享");
DailyLogUtils.writeLog("确认消息分享");
try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
if (shareCode == null || shareCode.isEmpty) {
apiResponse.msg = "请求失败".tr;
return apiResponse;
}
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_share;
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";
}
}
final data = {
"code": shareCode,
};
var response =
await EasyDartModule.dio.put(queryUrl, data: jsonEncode(data));
if (response != null) {
if (response.data['code'] != HttpStatusCodes.ok) {
apiResponse.msg = response.data['msg'];
apiResponse.code = response.data['code'];
return apiResponse;
}
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);
}
}
}

View File

@@ -357,6 +357,7 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => SleepReportController()),
Get.lazyPut(() => CalendarController()),
Get.lazyPut(() => UserPdfController()),
Get.lazyPut(() => PrivacyPdfController()),
Get.put(WebviewTestController()),
]));
}

View File

@@ -39,7 +39,7 @@ class _MhMessageListWidgetState extends State<MhMessageListWidget> {
highlightColor: Color(0xFF055466),
borderRadius: 20.rpx,
padding:
EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 0.rpx, 33.rpx),
EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 26.rpx, 26.rpx),
onTap: () {},
child: Column(
mainAxisSize: MainAxisSize.max,
@@ -95,65 +95,64 @@ class _MhMessageListWidgetState extends State<MhMessageListWidget> {
),
].divide(SizedBox(width: 30.rpx)),
),
],
),
),
if (messageInfo['type'] == 'app_system')
Positioned(
bottom: 46.rpx,
right: 20.rpx,
child: Container(
width: 123.rpx,
height: 47.rpx,
// // right: 26.rpx,
// left: 26.rpx,
Container(
// width: 123.rpx,
height: 61.rpx,
child: CustomCard(
borderRadius: AppConstants().button_container_radius, // 直角
colors: messageInfo['status'] == 1
? [
themeController.currentColor.sc1,
themeController.currentColor.sc2
]
: [themeController.currentColor.sc4], // 单色背景
borderRadius: 16.rpx, // 直角
gradientDirection: GradientDirection.vertical,
colors: [Color(0xFF84F5FF)],
enableAnimation: true, // 有点击缩放动画
enableGradient: false, // 不用渐变
onTap: () {
if (messageInfo['status'] == 1) {
showConfirmDialog(context, Container(), "是否确认接受该设备".tr,
onConfirm: () async {
ApiResponse apiResponse = await deviceShareController
.confirmShare(messageInfo['data']['shareCode']);
if (apiResponse.code == HttpStatusCodes.ok) {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: themeController.currentColor.sc2,
);
messageController.getMessageList();
messageController.updateAll();
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: themeController.currentColor.sc9,
);
messageController.getMessageList();
messageController.updateAll();
}
}, onCancel: () {});
}
// if (messageInfo['status'] == 1) {
// showConfirmDialog(
// context, Container(), "是否确认接受该设备".tr,
// onConfirm: () async {
// ApiResponse apiResponse =
// await deviceShareController.confirmShare(
// messageInfo['data']['shareCode']);
// if (apiResponse.code == HttpStatusCodes.ok) {
// TopSlideNotification.show(
// context,
// text: apiResponse.msg!,
// textColor: themeController.currentColor.sc2,
// );
// messageController.getMessageList();
// messageController.updateAll();
// } else {
// TopSlideNotification.show(
// context,
// text: apiResponse.msg!,
// textColor: themeController.currentColor.sc9,
// );
// messageController.getMessageList();
// messageController.updateAll();
// }
// }, onCancel: () {});
// }
Get.toNamed('/messageDetail', arguments: messageInfo);
},
child: Center(
child: Text(
getMessageStatus(messageInfo['status']),
// getMessageStatus(messageInfo['status']),
"查看详情",
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: Colors.white,
color: Color(0xFF011D33),
),
),
),
),
),
],
),
),
],
);

View File

@@ -0,0 +1,319 @@
import 'package:ef/base/widget/flutterflow/FlutterFlowTheme.dart';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appColors.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
import 'package:vbvs_app/pages/common/selectDialog.dart';
import '../../common/color/appFontsize.dart';
class ShareDeviceDetailWidget extends GetView {
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
MHDeviceShareController deviceShareController = Get.find();
var shareInfo = deviceShareController.model.mainShare;
RxInt type = 1.obs;
type.value = shareInfo['op_type'];
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
key: scaffoldKey,
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
// leading: returnIconButtomAddCallback(() {
// controller.saveDataApi();
// updateParm(isShowToast: false);
// }),
// leading: returnIconButtomNew,
title: Container(
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,
),
],
),
),
actions: [],
centerTitle: false,
),
body: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 1,
decoration: BoxDecoration(
color: Color(0xFFF6F6F6),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(15, 0, 15, 0),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 13, 0, 0),
child: Container(
width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground,
borderRadius: BorderRadius.circular(8),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(16, 13, 16, 15),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${shareInfo['userName']}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize: 15,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
),
),
Text(
'分享时间:${MyUtils.timestampToDateString(int.parse(shareInfo['startTime'].toString()))}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF9EA4B7),
fontSize: 11,
letterSpacing: 0.0,
),
),
].divide(SizedBox(height: 5)),
),
Obx(
() => GestureDetector(
onTap: () {
// 当点击时,将 type 设置为 0允许控制
type.value = 1;
controller.updateAll();
},
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints(
minHeight: 46,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'允许对方控制该设备'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize: 13,
letterSpacing: 0.0,
),
),
Align(
alignment: AlignmentDirectional(0, -1),
child: Icon(
type.value == 1
? Icons.check_circle // 选中时为实心圆
: Icons
.radio_button_unchecked, // 未选中时为空心圆
color: type.value == 1
? Color(0xFFD3B684) // 选中时的颜色
: Colors.grey, // 未选中时的颜色
size: 18,
),
),
],
),
),
),
),
Obx(
() => GestureDetector(
onTap: () {
// 当点击时,将 type 设置为 1仅允许查看
type.value = 2;
controller.updateAll();
},
child: Container(
width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints(
minHeight: 46,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'仅允许对方查看该设备'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize: 13,
letterSpacing: 0.0,
),
),
Align(
alignment: AlignmentDirectional(0, -1),
child: Icon(
type.value == 2
? Icons.check_circle // 选中时为实心圆
: Icons
.radio_button_unchecked, // 未选中时为空心圆
color: type.value == 2
? Color(0xFFD3B684) // 选中时的颜色
: Colors.grey, // 未选中时的颜色
size: 18,
),
),
],
),
),
),
),
].divide(SizedBox(height: 13)),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
15, 0, 15, AppConstants.page_button_bottom_padding),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.056,
constraints: BoxConstraints(
minHeight: 46,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground,
),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.056,
decoration: BoxDecoration(
color:
FlutterFlowTheme.of(context).secondaryBackground,
borderRadius: BorderRadius.circular(12),
),
child: CustomCard(
borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical,
onTap: () async {},
colors: const [
Color(0xFFFCFCFC),
Color(0xFFF8FAF9),
Color(0XFFECF6F3),
Color(0XFFD9F0E9),
Color(0xFFCEECE3)
],
child: Container(
width: double.infinity,
height: 90.rpx,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
),
child: Text("解除分享".tr,
style: TextStyle(
color: const Color(0xFF003058),
fontSize: 30.rpx,
)),
),
)
// FFButtonWidget(
// onPressed: () {
// showCustomConfirmDialog(context, "是否确定删除?").then((v) {
// if ('confirm' == v) {
// // deviceShareController
// // .deleteShare(shareInfo)
// // .then((d) {
// // deviceShareController.initData();
// // deviceShareController.updateAll();
// // Get.back();
// // });
// // print("showCustomConfirmDialog $v");
// }
// });
// },
// text: '删除',
// options: FFButtonOptions(
// height: 40,
// padding: EdgeInsetsDirectional.fromSTEB(24, 0, 24, 0),
// iconPadding:
// EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0),
// color: Color(0xFFE55E92),
// textStyle:
// FlutterFlowTheme.of(context).titleSmall.override(
// fontFamily: 'Readex Pro',
// color: Colors.white,
// fontSize: 13,
// letterSpacing: 0.0,
// ),
// elevation: 3,
// borderSide: BorderSide(
// color: Colors.transparent,
// width: 1,
// ),
// borderRadius: BorderRadius.circular(8),
// ),
// ),
),
),
),
],
),
),
),
),
);
}
}

View File

@@ -20,7 +20,7 @@ class ShareUserWidget extends GetView {
onTap: () {
repairListController.model.mainShare =
repairListController.model.shareUser![index];
Get.toNamed('/share_device_user_detail');
Get.toNamed('/shareDeviceDetail');
},
child: Container(
width: MediaQuery.sizeOf(context).width,
@@ -77,9 +77,9 @@ class ShareUserWidget extends GetView {
child: Align(
alignment: const AlignmentDirectional(-1, 0),
child: Text(
info['opType'] == 1
info['op_type'] == 1
? '允许对方控制该设备'.tr
: info['opType'] == 2
: info['op_type'] == 2
? '仅允许对方查看该设备'.tr
: '',
style: TextStyle(

View File

@@ -21,7 +21,7 @@ class _MhAboutUsPageState extends State<MhAboutUsPage> {
widget.webView = MyWebView(
url: AppConstants().ent_type == 1
? "https://mp.weixin.qq.com/s/IAr4RNBy0hGJXGKyMxe7eQ"
? "https://mp.weixin.qq.com/s/BrD3fTT2J2R-DxZrUuM4rw"
: "https://mp.weixin.qq.com/s/7BvvprVDqX1eOzM3Lms8dg",
onLoad: () {
print('网页载入完毕');

View File

@@ -38,7 +38,7 @@ class _ApplyRepairSuccessState extends State<ApplyRepairSuccess> {
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
fit: BoxFit.contain, // 填满整个 Container
),
),
child: Scaffold(
@@ -119,7 +119,7 @@ class _ApplyRepairSuccessState extends State<ApplyRepairSuccess> {
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset('assets/img/icon/tick.svg',
fit: BoxFit.cover, color: Color(0XFF84F5FF)),
fit: BoxFit.contain, color: Color(0XFF84F5FF)),
),
),
Padding(
@@ -272,7 +272,7 @@ class _ApplyRepairSuccessState extends State<ApplyRepairSuccess> {
children: [
Text(
'绑定成功.返回'.tr,
style:TextStyle(
style: TextStyle(
color: Color(0xFF011D33),
fontFamily: 'Inter',
fontSize: AppConstants()

View File

@@ -25,9 +25,9 @@ class DeviceInfoWidget extends GetView {
child: Container(
// width: MediaQuery.sizeOf(context).width,
height: 381.rpx,
constraints: BoxConstraints(
minHeight: 140,
),
// constraints: BoxConstraints(
// minHeight: 140,
// ),
decoration: BoxDecoration(
color: Color(0xFF003058),
borderRadius: BorderRadius.circular(16.rpx),
@@ -37,9 +37,9 @@ class DeviceInfoWidget extends GetView {
child: Container(
// width: MediaQuery.sizeOf(context).width,
height: 381.rpx,
constraints: BoxConstraints(
minHeight: 106,
),
// constraints: BoxConstraints(
// minHeight: 106,
// ),
child: Container(
// width: MediaQuery.sizeOf(context).width,
@@ -96,82 +96,99 @@ class DeviceInfoWidget extends GetView {
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: '设备ID' +
(deviceListController.model
.deviceList[
index]['_id'] ??
''),
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFC8CBD2),
fontSize: 26.rpx,
letterSpacing: 0,
height: 1),
),
// TextSpan(
// text:
// ' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: deviceListController
// .model
// .deviceList[
// index]
// ['status'] ==
// '在线'
// ? Color(
// 0xFF07C160) // 在线的颜色
// : Color(
// 0xFFEA7CA7), // 离线的颜色
// fontSize: 26.rpx,
// letterSpacing: 0,
// ),
// ),
],
),
maxLines: 1, // 限制显示一行
overflow: TextOverflow
.ellipsis, // 超出部分显示省略号
),
),
],
),
Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'房间:' +
_buildInfoRow(
'设备ID',
deviceListController
.model.deviceList[index]["_id"] ??
'',
valueColor: (deviceListController
.model.deviceList[index]
["status"]?["status"]) ==
1
? Color(0xFF929699)
: null),
_buildInfoRow(
'房间',
deviceListController.model
.deviceList[index]["roomName"] ??
'',
valueColor: (deviceListController
.model.deviceList[index]
["status"]?["status"]) ==
1
? Color(0xFF929699)
: null),
_buildInfoRow(
'设备状态',
(deviceListController
.model.deviceList[index]
['roomName'] ??
''),
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFC8CBD2),
fontSize: 26.rpx,
letterSpacing: 0,
height: 1),
),
),
Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFFC8CBD2),
fontSize: 26.rpx,
letterSpacing: 0,
height: 1),
),
)
["status"]?["status"]) ==
1
? '在线'
: '离线',
valueColor: (deviceListController
.model.deviceList[index]
["status"]?["status"]) ==
1
? Color(0xFF6BFDAC)
: Color(0xFFFF7159)),
// Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Expanded(
// child: RichText(
// text: TextSpan(
// children: [
// TextSpan(
// text: '设备ID' +
// (deviceListController.model
// .deviceList[
// index]['_id'] ??
// ''),
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFFC8CBD2),
// fontSize: 26.rpx,
// letterSpacing: 0,
// height: 1),
// ),
// ],
// ),
// maxLines: 1, // 限制显示一行
// overflow: TextOverflow
// .ellipsis, // 超出部分显示省略号
// ),
// ),
// ],
// ),
// Align(
// alignment: AlignmentDirectional(-1, 0),
// child: Text(
// '房间:' +
// (deviceListController
// .model.deviceList[index]
// ['roomName'] ??
// ''),
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFFC8CBD2),
// fontSize: 26.rpx,
// letterSpacing: 0,
// height: 1),
// ),
// ),
// Align(
// alignment: AlignmentDirectional(-1, 0),
// child: Text(
// '设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: Color(0xFFC8CBD2),
// fontSize: 26.rpx,
// letterSpacing: 0,
// height: 1),
// ),
// )
].divide(SizedBox(height: 36.rpx)),
),
),
@@ -180,7 +197,7 @@ class DeviceInfoWidget extends GetView {
Align(
alignment: AlignmentDirectional(0, 0),
child: Container(
width: MediaQuery.sizeOf(context).width * 0.21,
width: 150.rpx,
height: 90.rpx,
child: FFButtonWidget(
onPressed: () {
@@ -405,4 +422,25 @@ class DeviceInfoWidget extends GetView {
),
);
}
Widget _buildInfoRow(String label, String value, {Color? valueColor}) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'$label ',
style:
TextStyle(color: Color(0XFF929699), fontSize: 26.rpx, height: 1),
),
Flexible(
child: Text(
value,
style: TextStyle(
color: valueColor ?? Colors.white, fontSize: 26.rpx, height: 1),
overflow: TextOverflow.ellipsis,
),
),
],
);
}
}

View File

@@ -143,7 +143,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
child: TextFormField(
controller: _phoneController,
decoration: InputDecoration(
hintText: '请输入对方手机号',
hintText: '请输入对方手机号/邮箱号',
hintStyle: TextStyle(
fontFamily: 'Readex Pro',
color:

View File

@@ -7,6 +7,8 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
import 'package:vbvs_app/pages/mh_page/bluetooth.dart';
import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart';
class EditBedPage extends StatefulWidget {
final Map data;
@@ -119,7 +121,7 @@ class _EditBedPageState extends State<EditBedPage> {
editedData['name'] = val;
},
textAlign: TextAlign.center,
initialValue: widget.data['name'],
decoration: InputDecoration(
hintText: "请输入床的名称",
contentPadding:
@@ -208,6 +210,15 @@ class _EditBedPageState extends State<EditBedPage> {
TopSlideNotification.show(context,
text: "修改名称成功".tr);
deviceListController.getDeviceList();
try {
WebviewTestController
webviewTestController = Get.find();
webviewTestController.web.jsbridge?.dart
.alterDevice();
} catch (e) {
ef.log("[h5]通知列表更新错误:$e");
}
Get.back(result: editedData);
},
);
},

View File

@@ -0,0 +1,262 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appFontsize.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/mh_controller/message_controller.dart';
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
class MessageDetailPage extends StatefulWidget {
final data;
const MessageDetailPage({super.key, required this.data});
@override
_MessageDetailPageState createState() => _MessageDetailPageState();
}
class _MessageDetailPageState extends State<MessageDetailPage> {
MHDeviceShareController controller = Get.find();
MhMessageController messageController = Get.find();
@override
Widget build(BuildContext context) {
var messageInfo = widget.data;
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(
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme:
IconThemeData(color: themeController.currentColor.sc3),
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,
),
],
),
),
actions: const [],
centerTitle: false,
),
backgroundColor: Colors.transparent,
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsets.only(top: 30.rpx),
child: Column(
children: [
Padding(
padding:
EdgeInsets.only(left: 30.rpx, right: 30.rpx),
child: Container(
decoration: BoxDecoration(
color: Color(0XFF003058),
borderRadius: BorderRadius.circular(16.rpx),
),
child: Padding(
padding: EdgeInsets.only(
left: 30.rpx,
top: 20.rpx,
bottom: 20.rpx),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
constraints: BoxConstraints(
minHeight: 66.rpx),
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: Text(
"${messageInfo['data']['title']}",
style: TextStyle(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
constraints: BoxConstraints(
minWidth: 30.rpx,
maxWidth: 140.rpx),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: messageInfo['data']
['val']
.map<Widget>((mapItem) =>
_buildInfoItem(
context,
mapItem['k'] ??
''))
.toList(),
),
),
Container(
constraints: BoxConstraints(
minWidth: 30.rpx),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: messageInfo['data']
['val']
.map<Widget>((mapItem) =>
_buildValueItem(
context,
mapItem['v'] ??
''))
.toList(),
),
),
].divide(SizedBox(width: 30.rpx)),
),
],
))),
),
const Spacer(),
bottomIcon(context)
],
)),
),
),
),
));
}
Container bottomIcon(BuildContext context) {
return Container(
height: 120.rpx,
decoration: BoxDecoration(
color: Color(0xFF003058),
),
width: double.infinity,
child: TextButton(
onPressed: () async {
if (widget.data['status'] == 1) {
ApiResponse apiResponse =
await controller.confirmShare(widget.data['data']['shareCode']);
if (apiResponse.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context,
text: apiResponse.msg!, textColor: Color(0xFF00C1AA));
messageController.getMessageList();
messageController.updateAll();
} else {
TopSlideNotification.show(context,
text: apiResponse.msg!, textColor: Color(0XFFFF7159));
messageController.getMessageList();
messageController.updateAll();
}
}
},
child: Text(
getStatusText(widget.data['status']),
style: TextStyle(
fontFamily: 'Readex Pro',
color: widget.data['data']['status'] == 1
? Colors.white
: Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
),
),
);
}
Widget _buildInfoItem(BuildContext context, String label) {
return Container(
constraints: BoxConstraints(
minHeight: 62.rpx,
),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
overflow: TextOverflow.ellipsis,
maxLines: 1,
label.tr,
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
);
}
Widget _buildValueItem(BuildContext context, value) {
return Container(
constraints: BoxConstraints(
minHeight: 62.rpx,
),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
overflow: TextOverflow.ellipsis,
maxLines: 1,
"${value}",
style: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
),
);
}
String getStatusText(int status) {
switch (status) {
case 1:
return '同意';
case 2:
return '已同意';
case 3:
return '已过期';
default:
return '未知状态';
}
}
}

View File

@@ -261,6 +261,7 @@ class _MessagePageState extends State<MessagePage> {
),
),
);
}
Container bottomIcon(BuildContext context) {

View File

@@ -6,6 +6,8 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart';
class RoomPickerPage extends StatefulWidget {
final Map data;
@@ -17,7 +19,7 @@ class RoomPickerPage extends StatefulWidget {
class _RoomPickerPageState extends State<RoomPickerPage> {
late Map<String, dynamic> editedData;
RxList rooms = [].obs;
DeviceListController deviceListController = Get.find();
@override
void initState() {
super.initState();
@@ -191,6 +193,16 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
TopSlideNotification.show(context,
text: "更新成功".tr,
textColor: Color(0XFF00C1AA));
deviceListController.getDeviceList();
try {
WebviewTestController
webviewTestController = Get.find();
webviewTestController.web.jsbridge?.dart
.alterDevice();
} catch (e) {
ef.log("[h5]通知列表更新错误:$e");
}
Get.toNamed('bluetoothPage');
},
onFailure: (res) {
TopSlideNotification.show(context,

View File

@@ -9,6 +9,7 @@ import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'package:vbvs_app/pages/mh_page/HomeDeviceType.dart';
import 'package:vbvs_app/pages/mh_page/LanguagePage.dart';
import 'package:vbvs_app/pages/mh_page/ShareDeviceDetailWidget.dart';
import 'package:vbvs_app/pages/mh_page/about_us.dart';
import 'package:vbvs_app/pages/mh_page/address_list_page.dart';
import 'package:vbvs_app/pages/mh_page/applyRepair/apply_repair_success.dart';
@@ -47,6 +48,7 @@ import 'package:vbvs_app/pages/mh_page/user_agreement_page.dart';
import 'package:vbvs_app/pages/sleep_report/new_sleep_report_page.dart';
import '../pages/mh_page/bluetooth.dart';
import '../pages/mh_page/edit_address_page.dart';
import '../pages/mh_page/message/messageDetail.dart';
import '../pages/mh_page/message_page.dart';
import '../pages/mh_page/new_settingPage.dart';
@@ -105,6 +107,9 @@ var mhroutes = {
"/aboutUs": (contxt) => MhAboutUsPage(),
"/userAgreementPage": (context) => UserAgreementPage(),
"/privacyPolicyPage": (context) => PrivacyPolicyPage(),
"/shareDeviceDetail": (context) => ShareDeviceDetailWidget(),
"/messageDetail": (context, {arguments}) =>
MessageDetailPage(data: arguments),
};
var mhonGenerateRoute = (RouteSettings settings) {
final String? name = settings.name; // 获取路由名称,如 /news 或 /search