解绑设备
This commit is contained in:
1
assets/img/icon/xiaoyi.svg
Normal file
1
assets/img/icon/xiaoyi.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.1 KiB |
@@ -171,5 +171,8 @@
|
|||||||
"用户协议": "用户协议",
|
"用户协议": "用户协议",
|
||||||
"隐私协议": "隐私协议",
|
"隐私协议": "隐私协议",
|
||||||
"退出登录": "退出登录",
|
"退出登录": "退出登录",
|
||||||
"注销账号": "注销账号"
|
"注销账号": "注销账号",
|
||||||
|
"我的智能设备":"我的智能设备",
|
||||||
|
"解绑成功": "解绑成功",
|
||||||
|
"解绑失败": "解绑失败"
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
|||||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||||
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
|
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||||
|
|
||||||
import 'package:vbvs_app/controller/mh_controller/device.dart';
|
import 'package:vbvs_app/controller/mh_controller/device.dart';
|
||||||
import 'package:vbvs_app/model/api_response.dart';
|
import 'package:vbvs_app/model/api_response.dart';
|
||||||
@@ -19,7 +20,6 @@ class DeviceListModel {
|
|||||||
//设备列表
|
//设备列表
|
||||||
List<dynamic> deviceList = [];
|
List<dynamic> deviceList = [];
|
||||||
|
|
||||||
|
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
String? keyword;
|
String? keyword;
|
||||||
@JsonKey(ignore: true)
|
@JsonKey(ignore: true)
|
||||||
@@ -70,4 +70,35 @@ class DeviceListController extends GetControllerEx<DeviceListModel> {
|
|||||||
}
|
}
|
||||||
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
|
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//解绑设备
|
||||||
|
Future<String> unbindDevice(Map<dynamic, dynamic> device) async {
|
||||||
|
String serviceAddress = ServiceConstant.service_address;
|
||||||
|
String serviceName = ServiceConstant.server_service;
|
||||||
|
String serviceApi = ServiceConstant.device_bind;
|
||||||
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||||
|
String msg = '';
|
||||||
|
int type = device['bind_type'];
|
||||||
|
await requestWithLog(
|
||||||
|
logTitle: '解绑设备',
|
||||||
|
method: MyHttpMethod.delete,
|
||||||
|
queryUrl: queryUrl,
|
||||||
|
data: {"mac": device['mac'], "uid": device['uid']},
|
||||||
|
onSuccess: (res) {
|
||||||
|
if (type == 1) {
|
||||||
|
msg = '解绑成功'.tr;
|
||||||
|
} else {
|
||||||
|
msg = '删除成功'.tr;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onFailure: (res) {
|
||||||
|
if (type == 1) {
|
||||||
|
msg = '解绑失败'.tr;
|
||||||
|
} else {
|
||||||
|
msg = '删除失败'.tr;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,28 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:EasyDartModule/EasyDartModule.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio/src/form_data.dart' as formdata;
|
import 'package:dio/src/form_data.dart' as formdata;
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||||
|
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||||
|
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
|
||||||
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
|
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||||
|
import 'package:vbvs_app/model/api_response.dart';
|
||||||
|
|
||||||
part 'mhdevice_share_controller.g.dart';
|
part 'mhdevice_share_controller.g.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class MHDeviceShareModel {
|
class MHDeviceShareModel {
|
||||||
String? phone;
|
String? account;
|
||||||
int? type = 1;
|
int? type = 1;
|
||||||
|
|
||||||
String? msg;
|
String? msg;
|
||||||
int? show = 0;
|
int? show = 0;
|
||||||
|
int? code = 0;
|
||||||
int limit = AppConstants.limit;
|
int limit = AppConstants.limit;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
@@ -37,86 +46,91 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
|
|||||||
attr = GetModel(MHDeviceShareModel()).obs;
|
attr = GetModel(MHDeviceShareModel()).obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RxString account = "".obs;
|
||||||
|
// RxString msg = "".obs;
|
||||||
|
// RxInt code = 0.obs;
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
Future<void> onInit() async {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
model.shareUser = [
|
await shareDeviceList(Get.arguments["mac"]);
|
||||||
{
|
|
||||||
'userName': '张三',
|
|
||||||
'opType': 1, // 允许控制
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'userName': '李四',
|
|
||||||
'opType': 2, // 仅查看
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'userName': '王五',
|
|
||||||
'opType': 1,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
update(); // 刷新UI
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<String> sendInvite(String? phone, String mac) async {
|
Future<ApiResponse> shareDevice(String mac) async {
|
||||||
// if (phone == null || phone.isEmpty) {
|
ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
|
||||||
// return "手机号不能为空";
|
EasyDartModule.logger.info("分享设备");
|
||||||
// }
|
DailyLogUtils.writeLog("分享设备");
|
||||||
// if (!MyUtils.isValidPhoneNumber(phone)) {
|
try {
|
||||||
// return "手机号格式不正确";
|
model.account = model.account!.trim();
|
||||||
// }
|
if (model.account == null || model.account!.isEmpty) {
|
||||||
// var type = model.type;
|
apiResponse.msg = "请输入手机号".tr;
|
||||||
// try {
|
return apiResponse;
|
||||||
// var aa = await ApiService.requestNoInfo.post("/api/device/info/share",
|
}
|
||||||
// data: formdata.FormData.fromMap(
|
if (!MyUtils.isValidPhoneNumber(model.account!) &&
|
||||||
// {"mac": mac, "tel": phone, "type": type}));
|
!MyUtils.isValidEmail(model.account!)) {
|
||||||
// return "";
|
apiResponse.msg = '请输入正确的手机号'.tr;
|
||||||
// } catch (e) {
|
return apiResponse;
|
||||||
// if (e is DioError) {
|
}
|
||||||
// // 返回 DioError 的 message 属性
|
String serviceAddress = ServiceConstant.service_address;
|
||||||
// return e.message!;
|
String serviceName = ServiceConstant.server_service;
|
||||||
// } else {
|
String serviceApi = ServiceConstant.device_share;
|
||||||
// // 处理其他类型的错误
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||||
// return e.toString();
|
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 data = {"type": model.type, "userName": model.account, "mac": mac};
|
||||||
|
var response =
|
||||||
|
await EasyDartModule.dio.post(queryUrl, data: jsonEncode(data));
|
||||||
|
if (response != null) {
|
||||||
|
var responseData =
|
||||||
|
response.data is String ? jsonDecode(response.data) : response.data;
|
||||||
|
ApiResponse res =
|
||||||
|
ApiResponse.fromJson(responseData, (object) => object);
|
||||||
|
if (res.code != HttpStatusCodes.ok) {
|
||||||
|
if (res.msg == null || res.msg!.isEmpty) {
|
||||||
|
res.msg = apiResponse.msg;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (res.msg == null || res.msg!.isEmpty) {
|
||||||
|
res.msg = "操作成功".tr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (res.code != HttpStatusCodes.ok) {
|
||||||
|
model.msg = res.msg!;
|
||||||
|
}
|
||||||
|
model.code = res.code!;
|
||||||
|
updateAll();
|
||||||
|
return res;
|
||||||
|
} else {
|
||||||
|
return ApiResponse(code: -1, msg: "服务器.失败".tr);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
EasyDartModule.logger.info("分享设备失败:${e.toString()}");
|
||||||
|
DailyLogUtils.writeLog("分享设备失败:${e.toString()}");
|
||||||
|
return ApiResponse(code: -1, msg: "服务器.失败".tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Future<void> initData() async {
|
shareDeviceList(String mac) async {
|
||||||
// //todo 请求分享列表
|
String serviceAddress = ServiceConstant.service_address;
|
||||||
// var deviceController = Get.find<GlobalController>();
|
String serviceName = ServiceConstant.server_service;
|
||||||
// var query = {
|
String serviceApi = ServiceConstant.device_share;
|
||||||
// "mac": deviceController.model.deviceMain['mac'],
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?mac=$mac";
|
||||||
// };
|
await requestWithLog(
|
||||||
// var data = await ApiService.request
|
logTitle: '分享用户列表',
|
||||||
// .get("/api/device/info/share", data: formdata.FormData.fromMap(query));
|
method: MyHttpMethod.get,
|
||||||
|
queryUrl: queryUrl,
|
||||||
// if (data.data["data"] != null) {
|
onSuccess: (res) => {
|
||||||
// try {
|
model.shareUser = res.data,
|
||||||
// List<dynamic> tmp = data.data["data"] as List<dynamic>;
|
updateAll(),
|
||||||
// model.shareUser = tmp;
|
},
|
||||||
// } catch (e) {
|
);
|
||||||
// print(e);
|
}
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// model.shareUser = [];
|
|
||||||
// }
|
|
||||||
// updateAll();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //保存
|
|
||||||
// saveShareDevice(Map shareInfo, RxInt type) async {
|
|
||||||
// return await ApiService.request.put("/api/device/info/share",
|
|
||||||
// data: formdata.FormData.fromMap({
|
|
||||||
// "mac": shareInfo['mac'],
|
|
||||||
// "tel": shareInfo['tel'],
|
|
||||||
// "type": type.value
|
|
||||||
// }));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //删除
|
|
||||||
// deleteShare(Map shareInfo) async {
|
|
||||||
// return await ApiService.request.delete("/api/device/info/share",
|
|
||||||
// data: formdata.FormData.fromMap(
|
|
||||||
// {"mac": shareInfo['mac'], "tel": shareInfo['tel']}));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ part of 'mhdevice_share_controller.dart';
|
|||||||
|
|
||||||
MHDeviceShareModel _$MHDeviceShareModelFromJson(Map<String, dynamic> json) =>
|
MHDeviceShareModel _$MHDeviceShareModelFromJson(Map<String, dynamic> json) =>
|
||||||
MHDeviceShareModel()
|
MHDeviceShareModel()
|
||||||
..phone = json['phone'] as String?
|
..account = json['account'] as String?
|
||||||
..type = (json['type'] as num?)?.toInt()
|
..type = (json['type'] as num?)?.toInt()
|
||||||
..msg = json['msg'] as String?
|
..msg = json['msg'] as String?
|
||||||
..show = (json['show'] as num?)?.toInt()
|
..show = (json['show'] as num?)?.toInt()
|
||||||
@@ -21,7 +21,7 @@ MHDeviceShareModel _$MHDeviceShareModelFromJson(Map<String, dynamic> json) =>
|
|||||||
|
|
||||||
Map<String, dynamic> _$MHDeviceShareModelToJson(MHDeviceShareModel instance) =>
|
Map<String, dynamic> _$MHDeviceShareModelToJson(MHDeviceShareModel instance) =>
|
||||||
<String, dynamic>{
|
<String, dynamic>{
|
||||||
'phone': instance.phone,
|
'phone': instance.account,
|
||||||
'type': instance.type,
|
'type': instance.type,
|
||||||
'msg': instance.msg,
|
'msg': instance.msg,
|
||||||
'show': instance.show,
|
'show': instance.show,
|
||||||
|
|||||||
@@ -1128,3 +1128,235 @@ Future<void> showUnBindTipDialog(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> showUnbindConfirmDialog({
|
||||||
|
required BuildContext context,
|
||||||
|
required VoidCallback onConfirm,
|
||||||
|
required VoidCallback onCancel,
|
||||||
|
required String title,
|
||||||
|
}) async {
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return FrostedDialog(
|
||||||
|
blurSigma: 3.0,
|
||||||
|
child: Container(
|
||||||
|
width: 520.rpx,
|
||||||
|
height: 460.rpx,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30.rpx,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '该设备只可被一个用户绑定,',
|
||||||
|
style: TextStyle(fontSize: 26.rpx)),
|
||||||
|
TextSpan(
|
||||||
|
text: '解绑后',
|
||||||
|
style: TextStyle(color: Colors.red, fontSize: 26.rpx),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: '其他用户才可以绑定',
|
||||||
|
style: TextStyle(fontSize: 26.rpx)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
CustomCard(
|
||||||
|
gradientDirection: GradientDirection.vertical,
|
||||||
|
borderRadius: 16.rpx,
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
onCancel();
|
||||||
|
},
|
||||||
|
colors: [
|
||||||
|
Color(0xFF1592AA),
|
||||||
|
Color(0XFF0C83A7),
|
||||||
|
Color(0XFF006FA3)
|
||||||
|
],
|
||||||
|
child: Container(
|
||||||
|
width: 200.rpx,
|
||||||
|
height: 90.rpx,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.rpx, color: Colors.white),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
CustomCard(
|
||||||
|
borderRadius: 16.rpx,
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
onConfirm();
|
||||||
|
},
|
||||||
|
colors: [
|
||||||
|
Color(0xFF1592AA),
|
||||||
|
Color(0XFF0C83A7),
|
||||||
|
Color(0XFF006FA3)
|
||||||
|
],
|
||||||
|
child: Container(
|
||||||
|
width: 200.rpx,
|
||||||
|
height: 90.rpx,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'解绑',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.rpx, color: Colors.white),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
// _buildButton(
|
||||||
|
// text: '解绑',
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// onConfirm();
|
||||||
|
// },
|
||||||
|
// isGradient: true,
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> showDeleteDeviceConfirmDialog({
|
||||||
|
required BuildContext context,
|
||||||
|
required VoidCallback onConfirm,
|
||||||
|
required VoidCallback onCancel,
|
||||||
|
required String title,
|
||||||
|
}) async {
|
||||||
|
await showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return FrostedDialog(
|
||||||
|
blurSigma: 3.0,
|
||||||
|
child: Container(
|
||||||
|
width: 520.rpx,
|
||||||
|
height: 460.rpx,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 45.rpx, right: 45.rpx, top: 90.rpx, bottom: 60.rpx),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30.rpx,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(fontSize: 26.rpx, color: Colors.black87),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '删除后,',
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.red, fontSize: 26.rpx)),
|
||||||
|
TextSpan(
|
||||||
|
text: '该设备的历史数据将被清除',
|
||||||
|
style: TextStyle(fontSize: 26.rpx),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
CustomCard(
|
||||||
|
gradientDirection: GradientDirection.vertical,
|
||||||
|
borderRadius: 16.rpx,
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
onCancel();
|
||||||
|
},
|
||||||
|
colors: [
|
||||||
|
Color(0xFF1592AA),
|
||||||
|
Color(0XFF0C83A7),
|
||||||
|
Color(0XFF006FA3)
|
||||||
|
],
|
||||||
|
child: Container(
|
||||||
|
width: 200.rpx,
|
||||||
|
height: 90.rpx,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'取消',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.rpx, color: Colors.white),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
CustomCard(
|
||||||
|
borderRadius: 16.rpx,
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
onConfirm();
|
||||||
|
},
|
||||||
|
colors: [
|
||||||
|
Color(0xFF1592AA),
|
||||||
|
Color(0XFF0C83A7),
|
||||||
|
Color(0XFF006FA3)
|
||||||
|
],
|
||||||
|
child: Container(
|
||||||
|
width: 200.rpx,
|
||||||
|
height: 90.rpx,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'删除',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 26.rpx, color: Colors.white),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
// _buildButton(
|
||||||
|
// text: '解绑',
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// onConfirm();
|
||||||
|
// },
|
||||||
|
// isGradient: true,
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ class LanguagePage extends GetView<MHLanguageController> {
|
|||||||
// }
|
// }
|
||||||
MHLanguageController controller = Get.find();
|
MHLanguageController controller = Get.find();
|
||||||
BoxConstraints? bodysize;
|
BoxConstraints? bodysize;
|
||||||
List<String> languageList = [
|
// List<String> languageList = [
|
||||||
'简体中文',
|
// '简体中文',
|
||||||
'繁體中文',
|
// '繁體中文',
|
||||||
'English',
|
// 'English',
|
||||||
];
|
// ];
|
||||||
final Map<String, String> languageMap = {
|
// final Map<String, String> languageMap = {
|
||||||
'简体中文': 'zh_CN',
|
// '简体中文': 'zh_CN',
|
||||||
'繁體中文': 'zh_TW',
|
// '繁體中文': 'zh_TW',
|
||||||
'English': 'en_US',
|
// 'English': 'en_US',
|
||||||
};
|
// };
|
||||||
|
|
||||||
// class _LanguagePageState extends State<LanguagePage> {
|
// class _LanguagePageState extends State<LanguagePage> {
|
||||||
RxBool checkboxValue = false.obs;
|
RxBool checkboxValue = false.obs;
|
||||||
@@ -56,7 +56,7 @@ class LanguagePage extends GetView<MHLanguageController> {
|
|||||||
children: [
|
children: [
|
||||||
// 中间居中的标题
|
// 中间居中的标题
|
||||||
Text(
|
Text(
|
||||||
'切换语言',
|
'切换语言'.tr,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@@ -135,7 +135,7 @@ class LanguagePage extends GetView<MHLanguageController> {
|
|||||||
value: controller.selectLanguage.value?.language_code ==
|
value: controller.selectLanguage.value?.language_code ==
|
||||||
model.language_code,
|
model.language_code,
|
||||||
onChanged: (newValue) async {
|
onChanged: (newValue) async {
|
||||||
controller.selectLanguage.value = model;
|
controller.selectLanguage.value = model;
|
||||||
// if (newValue!) {
|
// if (newValue!) {
|
||||||
// selectLanguage!.value = languageMap[
|
// selectLanguage!.value = languageMap[
|
||||||
// text]!; // Set selectLanguage to the current text value
|
// text]!; // Set selectLanguage to the current text value
|
||||||
|
|||||||
@@ -6,12 +6,16 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
|||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||||
|
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
|
||||||
|
import 'package:vbvs_app/model/api_response.dart';
|
||||||
|
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||||
|
|
||||||
class BluetoothPage extends GetView {
|
class BluetoothPage extends GetView {
|
||||||
Map data;
|
Map data;
|
||||||
BluetoothPage({required this.data});
|
BluetoothPage({required this.data});
|
||||||
|
|
||||||
BoxConstraints? bodysize;
|
BoxConstraints? bodysize;
|
||||||
|
DeviceListController deviceListController = Get.find();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -156,8 +160,44 @@ class BluetoothPage extends GetView {
|
|||||||
_buildMenuButton(
|
_buildMenuButton(
|
||||||
context, '睡眠习惯', "/sleepHabitPage"),
|
context, '睡眠习惯', "/sleepHabitPage"),
|
||||||
_buildMenuButton(
|
_buildMenuButton(
|
||||||
context, '分享设备', "/deviceSharePage"),
|
context, '分享设备', "/deviceSharePage",
|
||||||
_buildMenuButton(context, '解绑', ""),
|
arguments: data),
|
||||||
|
_buildMenuButton(
|
||||||
|
context,
|
||||||
|
data['bind_type'] == 1 ? '解绑' : '删除',
|
||||||
|
"",
|
||||||
|
onTap: () {
|
||||||
|
if (data['bind_type'] == 1) {
|
||||||
|
// 解绑弹窗
|
||||||
|
showUnbindConfirmDialog(
|
||||||
|
context: context,
|
||||||
|
title: "是否进行解绑?",
|
||||||
|
onConfirm: () {
|
||||||
|
deviceListController
|
||||||
|
.unbindDevice(data);
|
||||||
|
// 执行解绑逻辑
|
||||||
|
},
|
||||||
|
onCancel: () {
|
||||||
|
// 点击取消后的逻辑
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else if (data['bind_type'] == 2) {
|
||||||
|
// 删除弹窗
|
||||||
|
showDeleteDeviceConfirmDialog(
|
||||||
|
context: context,
|
||||||
|
title: "是否进行删除?",
|
||||||
|
onConfirm: () {
|
||||||
|
deviceListController.unbindDevice(
|
||||||
|
data,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onCancel: () {
|
||||||
|
// 点击取消后的逻辑
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -168,8 +208,13 @@ class BluetoothPage extends GetView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMenuButton(BuildContext context, String title, String? path,
|
Widget _buildMenuButton(
|
||||||
{Map<dynamic, dynamic>? arguments}) {
|
BuildContext context,
|
||||||
|
String title,
|
||||||
|
String? path, {
|
||||||
|
Map<dynamic, dynamic>? arguments,
|
||||||
|
VoidCallback? onTap,
|
||||||
|
}) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: 19.rpx),
|
padding: EdgeInsets.only(bottom: 19.rpx),
|
||||||
child: ClickableContainer(
|
child: ClickableContainer(
|
||||||
@@ -177,7 +222,21 @@ class BluetoothPage extends GetView {
|
|||||||
highlightColor: Color(0XFF055466),
|
highlightColor: Color(0XFF055466),
|
||||||
padding: EdgeInsets.only(left: 0),
|
padding: EdgeInsets.only(left: 0),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (path?.isNotEmpty == true) {
|
// if (path?.isNotEmpty == true) {
|
||||||
|
// if (arguments != null) {
|
||||||
|
// Get.toNamed(path!, arguments: arguments);
|
||||||
|
// } else {
|
||||||
|
// Get.toNamed(path!);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// TopSlideNotification.show(
|
||||||
|
// context,
|
||||||
|
// text: "功能开发中...",
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
if (onTap != null) {
|
||||||
|
onTap(); // 优先执行自定义逻辑
|
||||||
|
} else if (path?.isNotEmpty == true) {
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
Get.toNamed(path!, arguments: arguments);
|
Get.toNamed(path!, arguments: arguments);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ void showBindDoubleDialog(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> showUnBindDeviceDialog(BuildContext context) async {}
|
||||||
|
|
||||||
Future<void> showHaveBindDialog(BuildContext context) async {
|
Future<void> showHaveBindDialog(BuildContext context) async {
|
||||||
ThemeController themeController = Get.find();
|
ThemeController themeController = Get.find();
|
||||||
|
|
||||||
|
|||||||
@@ -163,13 +163,7 @@ class DeviceInfoWidget extends GetView {
|
|||||||
Align(
|
Align(
|
||||||
alignment: AlignmentDirectional(-1, 0),
|
alignment: AlignmentDirectional(-1, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'设备状态:' +
|
'设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
|
||||||
(deviceListController
|
|
||||||
.model
|
|
||||||
.deviceList[index]["status"]
|
|
||||||
?["status"]
|
|
||||||
?.toString() ??
|
|
||||||
''),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
color: Color(0xFFC8CBD2),
|
color: Color(0xFFC8CBD2),
|
||||||
@@ -239,7 +233,9 @@ class DeviceInfoWidget extends GetView {
|
|||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Get.toNamed("/deviceSharePage");
|
await Get.toNamed("/deviceSharePage",
|
||||||
|
arguments: deviceListController
|
||||||
|
.model.deviceList[index]);
|
||||||
// if (device['type'] == 1) {
|
// if (device['type'] == 1) {
|
||||||
// globalController.model.deviceMain = device;
|
// globalController.model.deviceMain = device;
|
||||||
// await Get.toNamed("/deviceSharePage");
|
// await Get.toNamed("/deviceSharePage");
|
||||||
|
|||||||
@@ -146,13 +146,13 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
|||||||
...List.generate(controller.model.peopleList.length,
|
...List.generate(controller.model.peopleList.length,
|
||||||
(index) {
|
(index) {
|
||||||
final person = controller.model.peopleList[index];
|
final person = controller.model.peopleList[index];
|
||||||
String location_ = '';
|
// String location_ = '';
|
||||||
if ("${data["bindMacB"]}".length > 6 &&
|
// if ("${data["bindMacB"]}".length > 6 &&
|
||||||
(person["direction"] == 1 ||
|
// (person["direction"] == 1 ||
|
||||||
person["direction"] == 2)) {
|
// person["direction"] == 2)) {
|
||||||
location_ =
|
// location_ =
|
||||||
person["direction"] == 1 ? '左侧' : '右侧';
|
// person["direction"] == 1 ? '左侧' : '右侧';
|
||||||
}
|
// }
|
||||||
|
|
||||||
return ClickableContainer(
|
return ClickableContainer(
|
||||||
backgroundColor: Color(0xFF003058),
|
backgroundColor: Color(0xFF003058),
|
||||||
@@ -176,9 +176,8 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (location_.isNotEmpty)
|
getInfoRow(
|
||||||
getInfoRow(context,
|
context, "姓名:${person["name"] ?? "-"}"),
|
||||||
"姓名:${person["name"] ?? "-"}"),
|
|
||||||
getInfoRow(context,
|
getInfoRow(context,
|
||||||
"性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"),
|
"性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"),
|
||||||
getInfoRow(context,
|
getInfoRow(context,
|
||||||
|
|||||||
@@ -3,40 +3,34 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||||
|
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
|
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||||
|
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||||
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
|
import 'package:vbvs_app/controller/mh_controller/mhdevice_share_controller.dart';
|
||||||
|
import 'package:vbvs_app/model/api_response.dart';
|
||||||
import 'package:vbvs_app/pages/mh_page/EmptyMessageWidget.dart';
|
import 'package:vbvs_app/pages/mh_page/EmptyMessageWidget.dart';
|
||||||
import 'package:vbvs_app/pages/mh_page/ShareUserWidget.dart';
|
import 'package:vbvs_app/pages/mh_page/ShareUserWidget.dart';
|
||||||
|
|
||||||
class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||||
|
var data;
|
||||||
|
ShareDeviceWidget({super.key, required this.data});
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
final ScrollController scrollController = ScrollController();
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
// ShareDeviceWidget() {
|
|
||||||
// controller.initData();
|
|
||||||
// scrollController.addListener(() {
|
|
||||||
// if (scrollController.position.pixels ==
|
|
||||||
// scrollController.position.maxScrollExtent &&
|
|
||||||
// controller.model.hasMore) {
|
|
||||||
// controller.initData();
|
|
||||||
// controller.updateAll();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
final _phoneController = TextEditingController();
|
final _phoneController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var deviceController = Get.find<GlobalController>();
|
|
||||||
controller.model.msg = "";
|
controller.model.msg = "";
|
||||||
controller.model.show = 0;
|
controller.model.code = 0;
|
||||||
controller.model.type = 1;
|
controller.model.type = 1;
|
||||||
|
controller.model.account = '';
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -122,7 +116,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'设备ID:${deviceController.model.deviceMain['mac']}',
|
'设备ID:${data['mac']}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Readex Pro',
|
fontFamily: 'Readex Pro',
|
||||||
color: const Color(0xFF6BFDAC),
|
color: const Color(0xFF6BFDAC),
|
||||||
@@ -192,82 +186,12 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 36.rpx,
|
fontSize: 36.rpx,
|
||||||
),
|
),
|
||||||
validator: (value) {
|
|
||||||
if (value == null ||
|
|
||||||
value.isEmpty) {
|
|
||||||
return '手机号不能为空';
|
|
||||||
}
|
|
||||||
final phoneReg =
|
|
||||||
RegExp(r'^1[3-9]\d{9}$');
|
|
||||||
if (!phoneReg.hasMatch(value)) {
|
|
||||||
return '请输入正确的手机号';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
controller.model.phone = value;
|
controller.model.account =
|
||||||
|
value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)),
|
||||||
// TextFormField(
|
|
||||||
// // controller: _model.textController,
|
|
||||||
// // focusNode: _model.textFieldFocusNode,
|
|
||||||
// // autofocus: true,
|
|
||||||
// obscureText: false,
|
|
||||||
// decoration: InputDecoration(
|
|
||||||
// hintText: '请输入对方手机号',
|
|
||||||
// hintStyle: FlutterFlowTheme.of(
|
|
||||||
// context)
|
|
||||||
// .labelMedium
|
|
||||||
// .override(
|
|
||||||
// fontFamily: 'Readex Pro',
|
|
||||||
// color:
|
|
||||||
// const Color(0xFFD2D2D2),
|
|
||||||
// fontSize: 13,
|
|
||||||
// letterSpacing: 0.0,
|
|
||||||
// ),
|
|
||||||
// enabledBorder:
|
|
||||||
// const UnderlineInputBorder(
|
|
||||||
// borderSide: BorderSide(
|
|
||||||
// color: Color(0xFFCCCCCC),
|
|
||||||
// width: 1),
|
|
||||||
// ),
|
|
||||||
// focusedBorder:
|
|
||||||
// const UnderlineInputBorder(
|
|
||||||
// borderSide: BorderSide(
|
|
||||||
// color: Color(0xFF929699),
|
|
||||||
// width: 0),
|
|
||||||
// ),
|
|
||||||
// errorBorder:
|
|
||||||
// const UnderlineInputBorder(
|
|
||||||
// borderSide: BorderSide(
|
|
||||||
// color: Colors.red, width: 1),
|
|
||||||
// ),
|
|
||||||
// focusedErrorBorder:
|
|
||||||
// const UnderlineInputBorder(
|
|
||||||
// borderSide: BorderSide(
|
|
||||||
// color: Colors.redAccent,
|
|
||||||
// width: 1.5),
|
|
||||||
// ),
|
|
||||||
// contentPadding:
|
|
||||||
// const EdgeInsets.only(
|
|
||||||
// left: 10, bottom: 5),
|
|
||||||
// ),
|
|
||||||
// style: FlutterFlowTheme.of(context)
|
|
||||||
// .bodyMedium
|
|
||||||
// .override(
|
|
||||||
// fontFamily: 'Readex Pro',
|
|
||||||
// fontSize: 13,
|
|
||||||
// letterSpacing: 0.0,
|
|
||||||
// ),
|
|
||||||
// onChanged: (value) {
|
|
||||||
// controller.model.phone = value;
|
|
||||||
// },
|
|
||||||
// // validator: _model.textControllerValidator
|
|
||||||
// // .asValidator(context),
|
|
||||||
// ),
|
|
||||||
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ClickableContainer(
|
ClickableContainer(
|
||||||
@@ -292,117 +216,6 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
// Container(
|
|
||||||
// width: MediaQuery.sizeOf(context).width,
|
|
||||||
// constraints: const BoxConstraints(
|
|
||||||
// minHeight: 46,
|
|
||||||
// ),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(0),
|
|
||||||
// ),
|
|
||||||
// child: Align(
|
|
||||||
// alignment:
|
|
||||||
// const AlignmentDirectional(0, 0),
|
|
||||||
// child: Obx(() {
|
|
||||||
// if (controller.model.show == 0) {
|
|
||||||
// return Container();
|
|
||||||
// } else {
|
|
||||||
// return GestureDetector(
|
|
||||||
// onTap: controller
|
|
||||||
// .model.msg!.isNotEmpty
|
|
||||||
// ? () {
|
|
||||||
// Clipboard.setData(
|
|
||||||
// ClipboardData(
|
|
||||||
// text: CommonVariables
|
|
||||||
// .shareText));
|
|
||||||
// showToast(
|
|
||||||
// "复制成功,粘贴分享APP下载链接!",
|
|
||||||
// color: color_success);
|
|
||||||
// }
|
|
||||||
// : null, // 不可点击时设置为 null
|
|
||||||
// child: RichText(
|
|
||||||
// textAlign: TextAlign
|
|
||||||
// .center, // 设置整个 RichText 内容居中
|
|
||||||
// text: TextSpan(
|
|
||||||
// children:
|
|
||||||
// controller.model.msg!
|
|
||||||
// .isNotEmpty
|
|
||||||
// ? [
|
|
||||||
// TextSpan(
|
|
||||||
// text: controller
|
|
||||||
// .model
|
|
||||||
// .msg! +
|
|
||||||
// "!", // 第一部分文本
|
|
||||||
// style: FlutterFlowTheme.of(
|
|
||||||
// context)
|
|
||||||
// .bodyMedium
|
|
||||||
// .override(
|
|
||||||
// fontFamily:
|
|
||||||
// 'Readex Pro',
|
|
||||||
// color: const Color(
|
|
||||||
// 0xFFE55E92), // 设置为粉红色
|
|
||||||
// fontSize:
|
|
||||||
// 26.rpx,
|
|
||||||
// letterSpacing:
|
|
||||||
// 0.0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const TextSpan(
|
|
||||||
// text:
|
|
||||||
// '\n', // 添加换行
|
|
||||||
// ),
|
|
||||||
// WidgetSpan(
|
|
||||||
// child: SizedBox(
|
|
||||||
// height: 20
|
|
||||||
// .rpx), // 添加间距
|
|
||||||
// ),
|
|
||||||
// TextSpan(
|
|
||||||
// text:
|
|
||||||
// '点击复制APP下载链接', // 第二部分文本
|
|
||||||
// style: FlutterFlowTheme.of(
|
|
||||||
// context)
|
|
||||||
// .bodyMedium
|
|
||||||
// .override(
|
|
||||||
// fontFamily:
|
|
||||||
// 'Readex Pro',
|
|
||||||
// color: const Color(
|
|
||||||
// 0xFF1890FF), // 设置为蓝色
|
|
||||||
// fontSize:
|
|
||||||
// 20.rpx,
|
|
||||||
// letterSpacing:
|
|
||||||
// 0.0,
|
|
||||||
// decoration:
|
|
||||||
// TextDecoration
|
|
||||||
// .underline, // 添加下划线
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ]
|
|
||||||
// : [
|
|
||||||
// TextSpan(
|
|
||||||
// text:
|
|
||||||
// '发送成功!', // 当 msg 为空时显示的文本
|
|
||||||
// style: FlutterFlowTheme.of(
|
|
||||||
// context)
|
|
||||||
// .bodyMedium
|
|
||||||
// .override(
|
|
||||||
// fontFamily:
|
|
||||||
// 'Readex Pro',
|
|
||||||
// color: const Color(
|
|
||||||
// 0xFF07C160), // 设置为绿色
|
|
||||||
// fontSize:
|
|
||||||
// 20.rpx,
|
|
||||||
// letterSpacing:
|
|
||||||
// 0.0,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// })),
|
|
||||||
// ),
|
|
||||||
|
|
||||||
Obx(
|
Obx(
|
||||||
() => GestureDetector(
|
() => GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -534,16 +347,19 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
|||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
//todo 1:验证用户是否存在 2:发送邀请
|
//todo 1:验证用户是否存在 2:发送邀请
|
||||||
// controller.model.show = 1;
|
ApiResponse apiResponse =
|
||||||
// String msg =
|
await controller
|
||||||
// await controller.sendInvite(
|
.shareDevice(data['mac']);
|
||||||
// controller.model.phone,
|
if (apiResponse.code ==
|
||||||
// deviceController
|
HttpStatusCodes.ok) {
|
||||||
// .model.deviceMain['mac']);
|
TopSlideNotification.show(context,
|
||||||
// if (msg != null && msg.isNotEmpty) {
|
text: apiResponse.msg!);
|
||||||
// controller.model.msg = msg;
|
} else {
|
||||||
// }
|
TopSlideNotification.show(context,
|
||||||
// controller.updateAll();
|
text: apiResponse.msg!,
|
||||||
|
textColor: themeController
|
||||||
|
.currentColor.sc9);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
text: '发送邀请',
|
text: '发送邀请',
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
@@ -617,10 +433,11 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
|||||||
// .bodyMedium, // 可根据需要自定义样式
|
// .bodyMedium, // 可根据需要自定义样式
|
||||||
// ),
|
// ),
|
||||||
// );
|
// );
|
||||||
return EmptyMessageWidget(
|
return NullDataWidget();
|
||||||
imagePath:
|
// EmptyMessageWidget(
|
||||||
"assets/images/emptyUser.png",
|
// imagePath:
|
||||||
);
|
// "assets/images/emptyUser.png",
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
// 否则显示正常的 ListView
|
// 否则显示正常的 ListView
|
||||||
|
|||||||
@@ -14,123 +14,195 @@ class HelpArticle extends StatelessWidget {
|
|||||||
|
|
||||||
var isLike = 0.obs;
|
var isLike = 0.obs;
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
// String top_imgOrVideo = "";
|
||||||
|
// if (article['imgOrVideo'] == 0) {
|
||||||
|
// top_imgOrVideo =
|
||||||
|
// '''<img class="video" src="${getStorageResourceUrl(article['coverUrl'])}" />''';
|
||||||
|
// } else {
|
||||||
|
// top_imgOrVideo =
|
||||||
|
// '''<video controls class="video" src="${getStorageResourceUrl(article['videoUrl'])}" ></video>''';
|
||||||
|
// }
|
||||||
|
// String newText = article['text'];
|
||||||
|
|
||||||
|
// RegExp("<img\\s*src=\"([^\"]*)\"")
|
||||||
|
// .allMatches(newText)
|
||||||
|
// .toList()
|
||||||
|
// .map((d) => d.group(1))
|
||||||
|
// .toList()
|
||||||
|
// .forEach((d) {
|
||||||
|
// newText = newText.replaceAll("$d", getStorageResourceUrl("$d"));
|
||||||
|
// });
|
||||||
|
|
||||||
|
// String html = '''
|
||||||
|
// <html>
|
||||||
|
// <meta name="viewport" charset="UTF-8"
|
||||||
|
// content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
||||||
|
|
||||||
|
// <head>
|
||||||
|
// <title>Test Page</title>
|
||||||
|
// </head>
|
||||||
|
// <style>
|
||||||
|
|
||||||
|
// body {
|
||||||
|
// width: 98%;
|
||||||
|
// margin: 0 auto;
|
||||||
|
// overflow-x: hidden;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .video {
|
||||||
|
// width: 100%;
|
||||||
|
// height: 270px;
|
||||||
|
// background-color: #9EA4B7;
|
||||||
|
// border-radius: 6px;
|
||||||
|
// }
|
||||||
|
// </style>
|
||||||
|
|
||||||
|
// <body>
|
||||||
|
// <div style="padding: 15px;width: calc(100% - 36px);">
|
||||||
|
// ${top_imgOrVideo}
|
||||||
|
// <div style="height: 2px;width: 100%;background-color: #D6D6D6;margin: 15px 0 15px 0;"></div>
|
||||||
|
// <div style="line-height: 22px;font-size: 15px;">${article['title']}</div>
|
||||||
|
// <div style="display: flex;align-items: center;font-size: 13;margin-bottom: 24px;margin-top: 10px;">
|
||||||
|
// <div style="color: #182B7C;">${article['author']}</div>
|
||||||
|
// <div style="margin-left: 13px; color: #D3D3D3;">${time_08_Formatter(article['created_at'])}</div>
|
||||||
|
// </div>
|
||||||
|
// ${newText}
|
||||||
|
// </div>
|
||||||
|
// </body>
|
||||||
|
|
||||||
|
// </html>
|
||||||
|
// ''';
|
||||||
|
|
||||||
|
// print("$html");
|
||||||
|
// // articleController.readAdd(article['id']);
|
||||||
|
// String? uid = userInfoController.model.user?.uid;
|
||||||
|
// print("${userInfoController.model.user}");
|
||||||
|
// // uid = "sss";
|
||||||
|
// // if (uid != null) {
|
||||||
|
// // articleController.findIsLike(uid, article['id']).then((d) {
|
||||||
|
// // isLike.value = d;
|
||||||
|
// // });
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// return LayoutBuilder(
|
||||||
|
// builder: (context, boxConstraints) => GestureDetector(
|
||||||
|
// onTap: () => FocusScope.of(context).unfocus(),
|
||||||
|
// child: Scaffold(
|
||||||
|
// appBar: AppBar(
|
||||||
|
// backgroundColor: AppColors.bg_color,
|
||||||
|
// automaticallyImplyLeading: false,
|
||||||
|
// iconTheme: IconThemeData(color: Colors.white),
|
||||||
|
// titleSpacing: 0,
|
||||||
|
// leading: returnIconButtom,
|
||||||
|
// ),
|
||||||
|
// body: SafeArea(
|
||||||
|
// top: true,
|
||||||
|
// child: Container(
|
||||||
|
// width: MediaQuery.sizeOf(context).width,
|
||||||
|
// height: MediaQuery.sizeOf(context).height,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Colors.white,
|
||||||
|
// // color: AppColors.bg_color,
|
||||||
|
// // image: DecorationImage(
|
||||||
|
// // image: AssetImage("assets/images/background.png$test"),
|
||||||
|
// // fit: BoxFit.cover,
|
||||||
|
// // ),
|
||||||
|
// ),
|
||||||
|
// child: Column(
|
||||||
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// child: Container(
|
||||||
|
// // child: WebViewWidget(
|
||||||
|
// // controller: WebViewController()
|
||||||
|
// // ..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||||
|
// // ..loadHtmlString(html),
|
||||||
|
// // ),
|
||||||
|
// child: InAppWebView(
|
||||||
|
// initialData:
|
||||||
|
// InAppWebViewInitialData(data: html, encoding: ""),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String top_imgOrVideo = "";
|
return Scaffold(
|
||||||
if (article['imgOrVideo'] == 0) {
|
backgroundColor: const Color(0xFF042C46),
|
||||||
top_imgOrVideo =
|
appBar: AppBar(
|
||||||
'''<img class="video" src="${getStorageResourceUrl(article['coverUrl'])}" />''';
|
backgroundColor: const Color(0xFF042C46),
|
||||||
} else {
|
title: Text("问题与帮助", style: TextStyle(color: Colors.white)),
|
||||||
top_imgOrVideo =
|
centerTitle: true,
|
||||||
'''<video controls class="video" src="${getStorageResourceUrl(article['videoUrl'])}" ></video>''';
|
leading: IconButton(
|
||||||
}
|
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||||
String newText = article['text'];
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
RegExp("<img\\s*src=\"([^\"]*)\"")
|
elevation: 0,
|
||||||
.allMatches(newText)
|
),
|
||||||
.toList()
|
body: Column(
|
||||||
.map((d) => d.group(1))
|
children: [
|
||||||
.toList()
|
Container(
|
||||||
.forEach((d) {
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
newText = newText.replaceAll("$d", getStorageResourceUrl("$d"));
|
alignment: Alignment.centerLeft,
|
||||||
});
|
child: Text(
|
||||||
|
article['title'],
|
||||||
String html = '''
|
style: const TextStyle(
|
||||||
<html>
|
color: Colors.white,
|
||||||
<meta name="viewport" charset="UTF-8"
|
fontSize: 18,
|
||||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
<head>
|
|
||||||
<title>Test Page</title>
|
|
||||||
</head>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
body {
|
|
||||||
width: 98%;
|
|
||||||
margin: 0 auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.video {
|
|
||||||
width: 100%;
|
|
||||||
height: 270px;
|
|
||||||
background-color: #9EA4B7;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div style="padding: 15px;width: calc(100% - 36px);">
|
|
||||||
${top_imgOrVideo}
|
|
||||||
<div style="height: 2px;width: 100%;background-color: #D6D6D6;margin: 15px 0 15px 0;"></div>
|
|
||||||
<div style="line-height: 22px;font-size: 15px;">${article['title']}</div>
|
|
||||||
<div style="display: flex;align-items: center;font-size: 13;margin-bottom: 24px;margin-top: 10px;">
|
|
||||||
<div style="color: #182B7C;">${article['author']}</div>
|
|
||||||
<div style="margin-left: 13px; color: #D3D3D3;">${time_08_Formatter(article['created_at'])}</div>
|
|
||||||
</div>
|
|
||||||
${newText}
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
''';
|
|
||||||
|
|
||||||
print("$html");
|
|
||||||
// articleController.readAdd(article['id']);
|
|
||||||
String? uid = userInfoController.model.user?.uid;
|
|
||||||
print("${userInfoController.model.user}");
|
|
||||||
// uid = "sss";
|
|
||||||
// if (uid != null) {
|
|
||||||
// articleController.findIsLike(uid, article['id']).then((d) {
|
|
||||||
// isLike.value = d;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
return LayoutBuilder(
|
|
||||||
builder: (context, boxConstraints) => GestureDetector(
|
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
backgroundColor: AppColors.bg_color,
|
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
iconTheme: IconThemeData(color: Colors.white),
|
|
||||||
titleSpacing: 0,
|
|
||||||
leading: returnIconButtom,
|
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
Expanded(
|
||||||
top: true,
|
child: InAppWebView(
|
||||||
child: Container(
|
initialData: InAppWebViewInitialData(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
data: wrapHtml(article['content']),
|
||||||
height: MediaQuery.sizeOf(context).height,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
// color: AppColors.bg_color,
|
|
||||||
// image: DecorationImage(
|
|
||||||
// image: AssetImage("assets/images/background.png$test"),
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
// child: WebViewWidget(
|
|
||||||
// controller: WebViewController()
|
|
||||||
// ..setJavaScriptMode(JavaScriptMode.unrestricted)
|
|
||||||
// ..loadHtmlString(html),
|
|
||||||
// ),
|
|
||||||
child: InAppWebView(
|
|
||||||
initialData:
|
|
||||||
InAppWebViewInitialData(data: html, encoding: ""),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 包装成完整 HTML 页面,添加适配样式
|
||||||
|
String wrapHtml(String htmlContent) {
|
||||||
|
return """
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
color: #FFFFFF;
|
||||||
|
background-color: #042C46;
|
||||||
|
font-family: sans-serif;
|
||||||
|
padding: 16px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
p, li {
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
ol {
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
strong {
|
||||||
|
color: #6BFDAC;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
$htmlContent
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ class IssuePreviewWidget extends GetView<IssuePreviewInfoController> {
|
|||||||
// await Future.delayed(Duration(milliseconds: 100));
|
// await Future.delayed(Duration(milliseconds: 100));
|
||||||
// issueListController.model.selectedIndex = -1;
|
// issueListController.model.selectedIndex = -1;
|
||||||
// issueListController.updateAll();
|
// issueListController.updateAll();
|
||||||
// var article = issueListController.model.issueList![index];
|
var article = issueListController.model.issueList![index];
|
||||||
// Get.toNamed("/helpArticle", arguments: article);
|
Get.toNamed("/helpArticle", arguments: article);
|
||||||
TopSlideNotification.show(
|
// TopSlideNotification.show(
|
||||||
context,
|
// context,
|
||||||
text: "功能开发中...",
|
// text: "功能开发中...",
|
||||||
);
|
// );
|
||||||
},
|
},
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class _MinePageState extends State<NewMinePage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'我的智能床',
|
'我的智能设备'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 26.rpx, color: const Color(0xFF003058)),
|
fontSize: 26.rpx, color: const Color(0xFF003058)),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ class SearchWidget extends GetView {
|
|||||||
// validator: _model
|
// validator: _model
|
||||||
// .textControllerValidator
|
// .textControllerValidator
|
||||||
// .asValidator(context),
|
// .asValidator(context),
|
||||||
|
onChanged: (d) {
|
||||||
|
onChange?.call(d);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -125,29 +128,33 @@ class SearchWidget extends GetView {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
||||||
child: Row(
|
child: InkWell(
|
||||||
mainAxisSize: MainAxisSize.max,
|
onTap: () {
|
||||||
children: [
|
findCallback?.call();
|
||||||
SizedBox(
|
},
|
||||||
height: 30.rpx,
|
child: Row(
|
||||||
child: VerticalDivider(
|
mainAxisSize: MainAxisSize.max,
|
||||||
thickness: 2.rpx,
|
children: [
|
||||||
color: stringToColor("#333333"), //固定
|
SizedBox(
|
||||||
),
|
height: 30.rpx,
|
||||||
|
child: VerticalDivider(
|
||||||
|
thickness: 2.rpx,
|
||||||
|
color: stringToColor("#333333"), //固定
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'搜索'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'Inter',
|
||||||
|
fontSize: 30.rpx,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
color: stringToColor("#333333"), //固定
|
||||||
|
),
|
||||||
|
),
|
||||||
|
].divide(SizedBox(width: 26.rpx)),
|
||||||
),
|
),
|
||||||
Text(
|
)),
|
||||||
'搜索'.tr,
|
|
||||||
style: TextStyle(
|
|
||||||
fontFamily: 'Inter',
|
|
||||||
fontSize: 30.rpx,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
color: stringToColor("#333333"), //固定
|
|
||||||
),
|
|
||||||
),
|
|
||||||
].divide(SizedBox(width: 26.rpx)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ var mhroutes = {
|
|||||||
"/findPasswordPage": (context) => FindPasswordPage(),
|
"/findPasswordPage": (context) => FindPasswordPage(),
|
||||||
"/loginPage": (context) => MHTLoginPage(),
|
"/loginPage": (context) => MHTLoginPage(),
|
||||||
"/updatePasswordPage": (context) => UpdatePasswordPage(),
|
"/updatePasswordPage": (context) => UpdatePasswordPage(),
|
||||||
"/deviceSharePage": (context) => ShareDeviceWidget(),
|
"/deviceSharePage": (context, {arguments}) =>
|
||||||
|
ShareDeviceWidget(data: arguments),
|
||||||
"/deviceListPage": (context) => DeviceListPage(),
|
"/deviceListPage": (context) => DeviceListPage(),
|
||||||
"/mHTDeviceTypePage": (context, {arguments}) => MHTBindDeviceTypePage(),
|
"/mHTDeviceTypePage": (context, {arguments}) => MHTBindDeviceTypePage(),
|
||||||
"/mHTBlueteethDevicePage": (context, {arguments}) =>
|
"/mHTBlueteethDevicePage": (context, {arguments}) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user