解绑设备
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/util/DailyLogUtils.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/model/api_response.dart';
|
||||
@@ -19,7 +20,6 @@ class DeviceListModel {
|
||||
//设备列表
|
||||
List<dynamic> deviceList = [];
|
||||
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
String? keyword;
|
||||
@JsonKey(ignore: true)
|
||||
@@ -70,4 +70,35 @@ class DeviceListController extends GetControllerEx<DeviceListModel> {
|
||||
}
|
||||
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/src/form_data.dart' as formdata;
|
||||
import 'package:ef/ef.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/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';
|
||||
|
||||
@JsonSerializable()
|
||||
class MHDeviceShareModel {
|
||||
String? phone;
|
||||
String? account;
|
||||
int? type = 1;
|
||||
|
||||
String? msg;
|
||||
int? show = 0;
|
||||
|
||||
int? code = 0;
|
||||
int limit = AppConstants.limit;
|
||||
int offset = 0;
|
||||
bool isLoading = false;
|
||||
@@ -37,86 +46,91 @@ class MHDeviceShareController extends GetControllerEx<MHDeviceShareModel> {
|
||||
attr = GetModel(MHDeviceShareModel()).obs;
|
||||
}
|
||||
|
||||
// RxString account = "".obs;
|
||||
// RxString msg = "".obs;
|
||||
// RxInt code = 0.obs;
|
||||
@override
|
||||
void onInit() {
|
||||
Future<void> onInit() async {
|
||||
super.onInit();
|
||||
model.shareUser = [
|
||||
{
|
||||
'userName': '张三',
|
||||
'opType': 1, // 允许控制
|
||||
},
|
||||
{
|
||||
'userName': '李四',
|
||||
'opType': 2, // 仅查看
|
||||
},
|
||||
{
|
||||
'userName': '王五',
|
||||
'opType': 1,
|
||||
},
|
||||
];
|
||||
update(); // 刷新UI
|
||||
await shareDeviceList(Get.arguments["mac"]);
|
||||
}
|
||||
|
||||
// Future<String> sendInvite(String? phone, String mac) async {
|
||||
// if (phone == null || phone.isEmpty) {
|
||||
// return "手机号不能为空";
|
||||
// }
|
||||
// if (!MyUtils.isValidPhoneNumber(phone)) {
|
||||
// return "手机号格式不正确";
|
||||
// }
|
||||
// var type = model.type;
|
||||
// try {
|
||||
// var aa = await ApiService.requestNoInfo.post("/api/device/info/share",
|
||||
// data: formdata.FormData.fromMap(
|
||||
// {"mac": mac, "tel": phone, "type": type}));
|
||||
// return "";
|
||||
// } catch (e) {
|
||||
// if (e is DioError) {
|
||||
// // 返回 DioError 的 message 属性
|
||||
// return e.message!;
|
||||
// } else {
|
||||
// // 处理其他类型的错误
|
||||
// return e.toString();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Future<ApiResponse> shareDevice(String mac) async {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr);
|
||||
EasyDartModule.logger.info("分享设备");
|
||||
DailyLogUtils.writeLog("分享设备");
|
||||
try {
|
||||
model.account = model.account!.trim();
|
||||
if (model.account == null || model.account!.isEmpty) {
|
||||
apiResponse.msg = "请输入手机号".tr;
|
||||
return apiResponse;
|
||||
}
|
||||
if (!MyUtils.isValidPhoneNumber(model.account!) &&
|
||||
!MyUtils.isValidEmail(model.account!)) {
|
||||
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";
|
||||
}
|
||||
}
|
||||
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 {
|
||||
// //todo 请求分享列表
|
||||
// var deviceController = Get.find<GlobalController>();
|
||||
// var query = {
|
||||
// "mac": deviceController.model.deviceMain['mac'],
|
||||
// };
|
||||
// var data = await ApiService.request
|
||||
// .get("/api/device/info/share", data: formdata.FormData.fromMap(query));
|
||||
|
||||
// if (data.data["data"] != null) {
|
||||
// try {
|
||||
// List<dynamic> tmp = data.data["data"] as List<dynamic>;
|
||||
// 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']}));
|
||||
// }
|
||||
shareDeviceList(String mac) async {
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_share;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?mac=$mac";
|
||||
await requestWithLog(
|
||||
logTitle: '分享用户列表',
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) => {
|
||||
model.shareUser = res.data,
|
||||
updateAll(),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ part of 'mhdevice_share_controller.dart';
|
||||
|
||||
MHDeviceShareModel _$MHDeviceShareModelFromJson(Map<String, dynamic> json) =>
|
||||
MHDeviceShareModel()
|
||||
..phone = json['phone'] as String?
|
||||
..account = json['account'] as String?
|
||||
..type = (json['type'] as num?)?.toInt()
|
||||
..msg = json['msg'] as String?
|
||||
..show = (json['show'] as num?)?.toInt()
|
||||
@@ -21,7 +21,7 @@ MHDeviceShareModel _$MHDeviceShareModelFromJson(Map<String, dynamic> json) =>
|
||||
|
||||
Map<String, dynamic> _$MHDeviceShareModelToJson(MHDeviceShareModel instance) =>
|
||||
<String, dynamic>{
|
||||
'phone': instance.phone,
|
||||
'phone': instance.account,
|
||||
'type': instance.type,
|
||||
'msg': instance.msg,
|
||||
'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();
|
||||
BoxConstraints? bodysize;
|
||||
List<String> languageList = [
|
||||
'简体中文',
|
||||
'繁體中文',
|
||||
'English',
|
||||
];
|
||||
final Map<String, String> languageMap = {
|
||||
'简体中文': 'zh_CN',
|
||||
'繁體中文': 'zh_TW',
|
||||
'English': 'en_US',
|
||||
};
|
||||
// List<String> languageList = [
|
||||
// '简体中文',
|
||||
// '繁體中文',
|
||||
// 'English',
|
||||
// ];
|
||||
// final Map<String, String> languageMap = {
|
||||
// '简体中文': 'zh_CN',
|
||||
// '繁體中文': 'zh_TW',
|
||||
// 'English': 'en_US',
|
||||
// };
|
||||
|
||||
// class _LanguagePageState extends State<LanguagePage> {
|
||||
RxBool checkboxValue = false.obs;
|
||||
@@ -56,7 +56,7 @@ class LanguagePage extends GetView<MHLanguageController> {
|
||||
children: [
|
||||
// 中间居中的标题
|
||||
Text(
|
||||
'切换语言',
|
||||
'切换语言'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -135,7 +135,7 @@ class LanguagePage extends GetView<MHLanguageController> {
|
||||
value: controller.selectLanguage.value?.language_code ==
|
||||
model.language_code,
|
||||
onChanged: (newValue) async {
|
||||
controller.selectLanguage.value = model;
|
||||
controller.selectLanguage.value = model;
|
||||
// if (newValue!) {
|
||||
// selectLanguage!.value = languageMap[
|
||||
// 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/component/tool/ClickableContainer.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 {
|
||||
Map data;
|
||||
BluetoothPage({required this.data});
|
||||
|
||||
BoxConstraints? bodysize;
|
||||
DeviceListController deviceListController = Get.find();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -156,8 +160,44 @@ class BluetoothPage extends GetView {
|
||||
_buildMenuButton(
|
||||
context, '睡眠习惯', "/sleepHabitPage"),
|
||||
_buildMenuButton(
|
||||
context, '分享设备', "/deviceSharePage"),
|
||||
_buildMenuButton(context, '解绑', ""),
|
||||
context, '分享设备', "/deviceSharePage",
|
||||
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,
|
||||
{Map<dynamic, dynamic>? arguments}) {
|
||||
Widget _buildMenuButton(
|
||||
BuildContext context,
|
||||
String title,
|
||||
String? path, {
|
||||
Map<dynamic, dynamic>? arguments,
|
||||
VoidCallback? onTap,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 19.rpx),
|
||||
child: ClickableContainer(
|
||||
@@ -177,7 +222,21 @@ class BluetoothPage extends GetView {
|
||||
highlightColor: Color(0XFF055466),
|
||||
padding: EdgeInsets.only(left: 0),
|
||||
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) {
|
||||
Get.toNamed(path!, arguments: arguments);
|
||||
} else {
|
||||
|
||||
@@ -157,6 +157,8 @@ void showBindDoubleDialog(
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showUnBindDeviceDialog(BuildContext context) async {}
|
||||
|
||||
Future<void> showHaveBindDialog(BuildContext context) async {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
|
||||
@@ -163,13 +163,7 @@ class DeviceInfoWidget extends GetView {
|
||||
Align(
|
||||
alignment: AlignmentDirectional(-1, 0),
|
||||
child: Text(
|
||||
'设备状态:' +
|
||||
(deviceListController
|
||||
.model
|
||||
.deviceList[index]["status"]
|
||||
?["status"]
|
||||
?.toString() ??
|
||||
''),
|
||||
'设备状态:${(deviceListController.model.deviceList[index]["status"]?["status"]) == 1 ? '在线' : '离线'}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0xFFC8CBD2),
|
||||
@@ -239,7 +233,9 @@ class DeviceInfoWidget extends GetView {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await Get.toNamed("/deviceSharePage");
|
||||
await Get.toNamed("/deviceSharePage",
|
||||
arguments: deviceListController
|
||||
.model.deviceList[index]);
|
||||
// if (device['type'] == 1) {
|
||||
// globalController.model.deviceMain = device;
|
||||
// await Get.toNamed("/deviceSharePage");
|
||||
|
||||
@@ -146,13 +146,13 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
||||
...List.generate(controller.model.peopleList.length,
|
||||
(index) {
|
||||
final person = controller.model.peopleList[index];
|
||||
String location_ = '';
|
||||
if ("${data["bindMacB"]}".length > 6 &&
|
||||
(person["direction"] == 1 ||
|
||||
person["direction"] == 2)) {
|
||||
location_ =
|
||||
person["direction"] == 1 ? '左侧' : '右侧';
|
||||
}
|
||||
// String location_ = '';
|
||||
// if ("${data["bindMacB"]}".length > 6 &&
|
||||
// (person["direction"] == 1 ||
|
||||
// person["direction"] == 2)) {
|
||||
// location_ =
|
||||
// person["direction"] == 1 ? '左侧' : '右侧';
|
||||
// }
|
||||
|
||||
return ClickableContainer(
|
||||
backgroundColor: Color(0xFF003058),
|
||||
@@ -176,9 +176,8 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (location_.isNotEmpty)
|
||||
getInfoRow(context,
|
||||
"姓名:${person["name"] ?? "-"}"),
|
||||
getInfoRow(
|
||||
context, "姓名:${person["name"] ?? "-"}"),
|
||||
getInfoRow(context,
|
||||
"性别:${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"),
|
||||
getInfoRow(context,
|
||||
|
||||
@@ -3,40 +3,34 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.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/FitTool.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/TopSlideNotification.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/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/EmptyMessageWidget.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/ShareUserWidget.dart';
|
||||
|
||||
class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
var data;
|
||||
ShareDeviceWidget({super.key, required this.data});
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
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 _phoneController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var deviceController = Get.find<GlobalController>();
|
||||
controller.model.msg = "";
|
||||
controller.model.show = 0;
|
||||
controller.model.code = 0;
|
||||
controller.model.type = 1;
|
||||
controller.model.account = '';
|
||||
return GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
@@ -122,7 +116,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'设备ID:${deviceController.model.deviceMain['mac']}',
|
||||
'设备ID:${data['mac']}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: const Color(0xFF6BFDAC),
|
||||
@@ -192,82 +186,12 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
color: Colors.white,
|
||||
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) {
|
||||
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(
|
||||
@@ -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(
|
||||
() => GestureDetector(
|
||||
onTap: () {
|
||||
@@ -534,16 +347,19 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
//todo 1:验证用户是否存在 2:发送邀请
|
||||
// controller.model.show = 1;
|
||||
// String msg =
|
||||
// await controller.sendInvite(
|
||||
// controller.model.phone,
|
||||
// deviceController
|
||||
// .model.deviceMain['mac']);
|
||||
// if (msg != null && msg.isNotEmpty) {
|
||||
// controller.model.msg = msg;
|
||||
// }
|
||||
// controller.updateAll();
|
||||
ApiResponse apiResponse =
|
||||
await controller
|
||||
.shareDevice(data['mac']);
|
||||
if (apiResponse.code ==
|
||||
HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!);
|
||||
} else {
|
||||
TopSlideNotification.show(context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
}
|
||||
},
|
||||
text: '发送邀请',
|
||||
options: FFButtonOptions(
|
||||
@@ -617,10 +433,11 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
|
||||
// .bodyMedium, // 可根据需要自定义样式
|
||||
// ),
|
||||
// );
|
||||
return EmptyMessageWidget(
|
||||
imagePath:
|
||||
"assets/images/emptyUser.png",
|
||||
);
|
||||
return NullDataWidget();
|
||||
// EmptyMessageWidget(
|
||||
// imagePath:
|
||||
// "assets/images/emptyUser.png",
|
||||
// );
|
||||
}
|
||||
|
||||
// 否则显示正常的 ListView
|
||||
|
||||
@@ -14,123 +14,195 @@ class HelpArticle extends StatelessWidget {
|
||||
|
||||
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) {
|
||||
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,
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF042C46),
|
||||
appBar: AppBar(
|
||||
backgroundColor: const Color(0xFF042C46),
|
||||
title: Text("问题与帮助", style: TextStyle(color: Colors.white)),
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
article['title'],
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
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: ""),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Expanded(
|
||||
child: InAppWebView(
|
||||
initialData: InAppWebViewInitialData(
|
||||
data: wrapHtml(article['content']),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 包装成完整 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));
|
||||
// issueListController.model.selectedIndex = -1;
|
||||
// issueListController.updateAll();
|
||||
// var article = issueListController.model.issueList![index];
|
||||
// Get.toNamed("/helpArticle", arguments: article);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "功能开发中...",
|
||||
);
|
||||
var article = issueListController.model.issueList![index];
|
||||
Get.toNamed("/helpArticle", arguments: article);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "功能开发中...",
|
||||
// );
|
||||
},
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
|
||||
@@ -250,7 +250,7 @@ class _MinePageState extends State<NewMinePage> {
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'我的智能床',
|
||||
'我的智能设备'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx, color: const Color(0xFF003058)),
|
||||
),
|
||||
|
||||
@@ -117,6 +117,9 @@ class SearchWidget extends GetView {
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
onChanged: (d) {
|
||||
onChange?.call(d);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -125,29 +128,33 @@ class SearchWidget extends GetView {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30.rpx,
|
||||
child: VerticalDivider(
|
||||
thickness: 2.rpx,
|
||||
color: stringToColor("#333333"), //固定
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 0, 0, 0),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
findCallback?.call();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
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(),
|
||||
"/loginPage": (context) => MHTLoginPage(),
|
||||
"/updatePasswordPage": (context) => UpdatePasswordPage(),
|
||||
"/deviceSharePage": (context) => ShareDeviceWidget(),
|
||||
"/deviceSharePage": (context, {arguments}) =>
|
||||
ShareDeviceWidget(data: arguments),
|
||||
"/deviceListPage": (context) => DeviceListPage(),
|
||||
"/mHTDeviceTypePage": (context, {arguments}) => MHTBindDeviceTypePage(),
|
||||
"/mHTBlueteethDevicePage": (context, {arguments}) =>
|
||||
|
||||
Reference in New Issue
Block a user